rust/src/grammar
bors 2e7d7bc05d Auto merge of #25337 - bleibig:update-grammar, r=nikomatsakis
* Correctly lex CRLF in string literals
* Update `extern CRATE as NAME` syntax
* Allow leading `::` in view paths
* Allow TySums in type ascriptions and impls
* Allow macros to have visibility and attributes
* Update syntax for qualified path types and expressions
* Allow block expressions to be called () and indexed []
2015-05-18 23:29:26 +00:00
..
.gitignore
check.sh Model lexer: Fix remaining issues 2015-04-21 12:02:12 +02:00
lexer.l Update the bison grammar for various language changes 2015-05-12 09:20:43 -07:00
parser-lalr-main.c
parser-lalr.y Update the bison grammar for various language changes 2015-05-12 09:20:43 -07:00
raw-string-literal-ambiguity.md
README.md Model lexer: Fix remaining issues 2015-04-21 12:02:12 +02:00
RustLexer.g4 Declare other tokens used later in the reference grammar 2015-05-05 19:47:50 -04:00
testparser.py
tokens.h
verify.rs Revert "Panic if the grammar verifier sees a token it doesn't recognize" 2015-05-17 10:48:42 -04:00
xidcontinue.g4 Finished unicode support in the model lexer. 2015-04-19 23:05:32 +02:00
xidstart.g4 Finished unicode support in the model lexer. 2015-04-19 23:05:32 +02:00

Reference grammar.

Uses antlr4 and a custom Rust tool to compare ASTs/token streams generated. You can use the check-lexer make target to run all of the available tests.

To use manually:

antlr4 RustLexer.g4
javac *.java
rustc -O verify.rs
for file in ../*/**.rs; do
    echo $file;
    grun RustLexer tokens -tokens < "$file" | ./verify "$file" RustLexer.tokens || break
done

Note That the ../*/**.rs glob will match every *.rs file in the above directory and all of its recursive children. This is a zsh extension.