rust/src/grammar
bors 725cc06464 Auto merge of #22011 - fhahn:separate-parse-fail-tests, r=nikomatsakis
This PR moves all `compile-fail` tests that fail at the parsing stage to a `parse-fail` directory, in order to use the tests in the `parse-fail` directory to test if the new LALR parser rejects the same files as the Rust parser. I also adjusted the `testparser.py` script to handle the tests in `parse-fail` differently.

However during working on this, I discovered, that Rust's parser sometimes fails during parsing, but does not return a nonzero return code, e.g. compiling `/test/compile-fail/doc-before-semi.rs` with `-Z parse-only` prints an error message, but returns status code 0. Compiling the same file without `-Z parse-only`, the same error message is displayed, but error code 101 returned. I'll look into that over the next week.
2015-02-08 12:35:03 +00:00
..
.gitignore Byte/raw binary literal fixes 2014-07-21 10:59:58 -07:00
check.sh Clean up tidy scripts, coverage, performance 2015-02-05 14:37:16 -08: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 Fix for misspelled comments. 2015-02-04 23:00:02 -05:00
raw-string-literal-ambiguity.md adding proof of context-sensitivy of raw string literals 2014-07-27 02:13:19 -04:00
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.