pub trait TokenSource {
// Required methods
fn next_token(&mut self) -> Result<Token>;
fn unget_token(&mut self, token: Token);
fn interner(&self) -> &StringInterner;
fn interner_mut(&mut self) -> &mut StringInterner;
fn files(&self) -> &FileRegistry;
// Provided method
fn is_file_in_target(&self, file_id: FileId) -> bool { ... }
}Expand description
トークンを供給するソースの抽象化
Required Methods§
Sourcefn next_token(&mut self) -> Result<Token>
fn next_token(&mut self) -> Result<Token>
次のトークンを取得
Sourcefn unget_token(&mut self, token: Token)
fn unget_token(&mut self, token: Token)
トークンを先読みバッファに戻す
Sourcefn interner(&self) -> &StringInterner
fn interner(&self) -> &StringInterner
StringInterner への参照を取得
Sourcefn interner_mut(&mut self) -> &mut StringInterner
fn interner_mut(&mut self) -> &mut StringInterner
StringInterner への可変参照を取得
Sourcefn files(&self) -> &FileRegistry
fn files(&self) -> &FileRegistry
FileRegistry への参照を取得
Provided Methods§
Sourcefn is_file_in_target(&self, file_id: FileId) -> bool
fn is_file_in_target(&self, file_id: FileId) -> bool
指定されたファイルがターゲットディレクトリ内かどうかを判定 デフォルト実装は常に false を返す(TokenSlice など)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl TokenSource for Preprocessor
TokenSource trait の実装
Parser がプリプロセッサをトークンソースとして使用できるようにする