diff options
| author | bors <bors@rust-lang.org> | 2013-04-03 11:31:03 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-04-03 11:31:03 -0700 |
| commit | 6153aae809387bf5d8e99eda9d2a3c86e80d1b2d (patch) | |
| tree | 8ace223fbff35ea48430490b55fb4af533391a59 /src/libsyntax/parse/lexer.rs | |
| parent | 260d74dfcc095d02add8fc97c31922824ddf92fd (diff) | |
| parent | f2e47cddf835af49a925d91639d7fefb8c23d08f (diff) | |
| download | rust-6153aae809387bf5d8e99eda9d2a3c86e80d1b2d.tar.gz rust-6153aae809387bf5d8e99eda9d2a3c86e80d1b2d.zip | |
auto merge of #5559 : jbclements/rust/change-to-tt-based-parsing, r=jbclements
Changes the parser to parse all streams into token-trees before hitting the parser proper, in preparation for hygiene. As an added bonus, it appears to speed up the parser (albeit by a totally imperceptible 1%). Also, many comments in the parser. Also, field renaming in token-trees (readme->forest, cur->stack).
Diffstat (limited to 'src/libsyntax/parse/lexer.rs')
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 17d6ba3ac93..5e06ecf6090 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -80,7 +80,8 @@ pub fn new_low_level_string_reader(span_diagnostic: @span_handler, last_pos: filemap.start_pos, col: CharPos(0), curr: initial_char, - filemap: filemap, interner: itr, + filemap: filemap, + interner: itr, /* dummy values; not read */ peek_tok: token::EOF, peek_span: codemap::dummy_sp() @@ -150,6 +151,7 @@ impl reader for TtReader { } // EFFECT: advance peek_tok and peek_span to refer to the next token. +// EFFECT: update the interner, maybe. fn string_advance_token(r: @mut StringReader) { match (consume_whitespace_and_comments(r)) { Some(comment) => { @@ -539,6 +541,9 @@ fn ident_continue(c: char) -> bool { || (c > 'z' && char::is_XID_continue(c)) } +// return the next token from the string +// EFFECT: advances the input past that token +// EFFECT: updates the interner fn next_token_inner(rdr: @mut StringReader) -> token::Token { let mut accum_str = ~""; let mut c = rdr.curr; |
