rust/src/grammar
2015-03-15 09:08:21 -07:00
..
.gitignore
check.sh Strip all leading/trailing newlines 2015-03-15 09:08:21 -07:00
lexer.l Add a LALR grammar for Rust with testing support 2015-01-20 18:47:17 -08:00
parser-lalr-main.c Add a LALR grammar for Rust with testing support 2015-01-20 18:47:17 -08:00
parser-lalr.y Bison grammar: parse higher ranked constraints in where clauses 2015-03-01 13:59:35 -08:00
raw-string-literal-ambiguity.md
README.md Update src/grammar/README.md 2014-12-30 16:49:27 +01:00
RustLexer.g4 Handle question marks in model lexer, closes #15879 2015-01-13 23:31:53 +01:00
testparser.py Move compile-fail tests that are rejected by the parser to parse-fail 2015-02-06 22:23:16 +01:00
tokens.h Add a LALR grammar for Rust with testing support 2015-01-20 18:47:17 -08:00
verify.rs cleanup: replace as[_mut]_slice() calls with deref coercions 2015-02-05 13:45:01 -05: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.