]> git.lizzy.rs Git - rust.git/blob - src/grammar/check.sh
lexer tests: makefile/configure
[rust.git] / src / grammar / check.sh
1 #!/bin/sh
2
3 # Run the reference lexer against libsyntax and compare the tokens and spans.
4 # If "// ignore-lexer-test" is present in the file, it will be ignored.
5 #
6 # Argument $1 is the file to check, $2 is the classpath to use, $3 is the path
7 # to the grun binary, $4 is the path to the verify binary, $5 is the path to
8 # RustLexer.tokens
9
10 if [ "${VERBOSE}" == "1" ]; then
11     set -x
12 fi
13
14 grep -q "// ignore lexer-test" $1;
15
16 if [ $? -eq 1 ]; then
17     cd $2 # This `cd` is so java will pick up RustLexer.class. I couldn't
18     # figure out how to wrangle the CLASSPATH, just adding build/grammr didn't
19     # seem to have anny effect.
20     $3 RustLexer tokens -tokens < $1 | $4 $1 $5
21 fi