rust/crates
bors[bot] ce694ae118 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 <edwin0cheng@gmail.com>
2019-05-27 07:28:13 +00:00
..
gen_lsp_server updated gen_lsp_server examples 2019-05-22 20:35:12 -05:00
ra_arena Add is_empty to Arena 2019-04-26 11:42:10 -04:00
ra_assists Merge #1281 2019-05-22 07:39:54 +00:00
ra_batch
ra_cli Colorize Rust code as HTML 2019-05-25 13:42:34 +03:00
ra_db add profile calls to parsing/expansion routines 2019-05-22 11:31:07 +03:00
ra_fmt apply T! macro where it is possible 2019-05-15 15:35:47 +03:00
ra_hir rename code_model_api -> code_model 2019-05-23 21:14:19 +03:00
ra_ide_api Colorize Rust code as HTML 2019-05-25 13:42:34 +03:00
ra_lsp_server Added local macro goto 2019-05-04 17:39:51 +01:00
ra_mbe Remove duplicated code 2019-05-26 02:41:00 +08:00
ra_parser Merge #1328 2019-05-27 07:28:13 +00:00
ra_prof better profilig 2019-05-22 00:00:58 +03:00
ra_project_model
ra_syntax Change TokenSource to iteration based 2019-05-25 20:41:03 +08:00
ra_text_edit
ra_tt Use slice instead of Vec 2019-05-23 21:05:22 +08:00
test_utils
thread_worker
tools