aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/syntax_kind
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-05-27 08:28:13 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-05-27 08:28:13 +0100
commitce694ae11854a806031db98c51c068253f927519 (patch)
tree2996ecd85ff9aa57b6f208e83d42dd03a7370d1e /crates/ra_parser/src/syntax_kind
parent4f4e50db908ba44f113faeb356ae2b3d0788d308 (diff)
parent90764fc54b2be1e0fc5d6ac9c9e960d7bb059b14 (diff)
Merge #1328
1328: Change TokenSource to iteration based r=matklad a=edwin0cheng This PR change the `TokenSource` trait from random access to be an iteration based trait: ```rust /// `TokenSource` abstracts the source of the tokens parser operates one. /// /// Hopefully this will allow us to treat text and token trees in the same way! pub trait TokenSource { fn current(&self) -> Token; /// Lookahead n token fn lookahead_nth(&self, n: usize) -> Token; /// bump cursor to next token fn bump(&mut self); /// Is the current token a specified keyword? fn is_keyword(&self, kw: &str) -> bool; } /// `TokenCursor` abstracts the cursor of `TokenSource` operates one. #[derive(Debug, Copy, Clone, Eq, PartialEq)] pub struct Token { /// What is the current token? pub kind: SyntaxKind, /// Is the current token joined to the next one (`> >` vs `>>`). pub is_jointed_to_next: bool, } ``` Note that the refactoring based on this new trait will be separated to incoming PRs Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_parser/src/syntax_kind')
0 files changed, 0 insertions, 0 deletions