1 # Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 # file at the top-level directory of this distribution and at
3 # http://rust-lang.org/COPYRIGHT.
5 # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 # option. This file may not be copied, modified, or distributed
9 # except according to those terms.
11 BG = $(CFG_BUILD_DIR)/grammar/
13 B = $(CFG_BUILD_DIR)/$(CFG_BUILD)/stage2/
14 L = $(B)lib/rustlib/$(CFG_BUILD)/lib
15 LD = $(CFG_BUILD)/stage2/lib/rustlib/$(CFG_BUILD)/lib/
18 # Run the reference lexer against libsyntax and compare the tokens and spans.
19 # If "// ignore-lexer-test" is present in the file, it will be ignored.
21 # $(1) is the file to test.
23 grep "// ignore-lexer-test" $(1) ; \
24 if [ $$? -eq 1 ]; then \
25 CLASSPATH=$(B)grammar $(CFG_GRUN) RustLexer tokens -tokens < $(1) \
26 | $(B)grammar/verify $(1) ; \
33 $(BG)RustLexer.class: $(SG)RustLexer.g4
34 $(Q)$(CFG_ANTLR4) -o $(B)grammar $(SG)RustLexer.g4
35 $(Q)$(CFG_JAVAC) -d $(BG) $(BG)RustLexer.java
37 $(BG)verify: $(SG)verify.rs rustc-stage2-H-$(CFG_BUILD) $(LD)stamp.regex_macros $(LD)stamp.rustc
38 $(Q)$(RUSTC) -O --out-dir $(BG) -L $(L) $(SG)verify.rs
40 check-lexer: $(BG) $(BG)RustLexer.class $(BG)verify
41 $(info Verifying libsyntax against the reference lexer ...)
42 $(Q)find $(S) -iname '*.rs' -exec "$(SG)check.sh" {} "$(BG)" \
43 "$(CFG_GRUN)" "$(BG)verify" "$(BG)RustLexer.tokens" "$(VERBOSE)" \;