diff options
| author | Margaret Meyerhofer <mmeyerho@andrew> | 2012-05-22 17:27:20 -0700 |
|---|---|---|
| committer | Margaret Meyerhofer <mmeyerho@andrew> | 2012-05-22 17:27:20 -0700 |
| commit | f1cea3ce21eb896b0849eca0a8fd9ea4e03ab35f (patch) | |
| tree | d0d7277f0666b7d5e9b864d34b861df06a9aa615 /src/librustsyntax/parse | |
| parent | 248e439638dbabf822bf9017eb99b44f0e1a0370 (diff) | |
| download | rust-f1cea3ce21eb896b0849eca0a8fd9ea4e03ab35f.tar.gz rust-f1cea3ce21eb896b0849eca0a8fd9ea4e03ab35f.zip | |
Changed the lexer to accept #! comments on the first line.
Diffstat (limited to 'src/librustsyntax/parse')
| -rw-r--r-- | src/librustsyntax/parse/lexer.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/librustsyntax/parse/lexer.rs b/src/librustsyntax/parse/lexer.rs index e486355501f..91013ca9a76 100644 --- a/src/librustsyntax/parse/lexer.rs +++ b/src/librustsyntax/parse/lexer.rs @@ -119,6 +119,17 @@ fn consume_any_line_comment(rdr: reader) { '*' { rdr.bump(); rdr.bump(); ret consume_block_comment(rdr); } _ { ret; } } + } else if rdr.curr == '#' { + if rdr.next() == '!' { + let cmap = codemap::new_codemap(); + (*cmap).files.push(rdr.filemap); + let mut loc = codemap::lookup_char_pos_adj(cmap, rdr.chpos); + if loc.line == 1u && loc.col == 0u { + while rdr.curr != '\n' && !rdr.is_eof() { rdr.bump(); } + loc = codemap::lookup_char_pos_adj(cmap, rdr.chpos); + ret consume_whitespace_and_comments(rdr); + } + } } } |
