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/
16 RUSTC = $(STAGE2_T_$(CFG_BUILD)_H_$(CFG_BUILD))
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: $(BG) $(SG)RustLexer.g4
34 $(Q)$(CFG_ANTLR4) -o $(BG) $(SG)RustLexer.g4
35 $(Q)$(CFG_JAVAC) -d $(BG) $(BG)RustLexer.java
37 check-build-lexer-verifier: $(BG)verify
40 VERIFY_DEPS := rustc-stage2-H-$(CFG_BUILD) $(LD)stamp.regex_macros $(LD)stamp.rustc
45 $(BG)verify: $(BG) $(SG)verify.rs $(VERIFY_DEPS)
46 $(Q)$(RUSTC) --out-dir $(BG) -L $(L) $(SG)verify.rs
51 check-lexer: $(BG) $(BG)RustLexer.class check-build-lexer-verifier
52 $(info Verifying libsyntax against the reference lexer ...)
53 $(Q)$(SG)check.sh $(S) "$(BG)" \
54 "$(CFG_GRUN)" "$(BG)verify" "$(BG)RustLexer.tokens"
56 $(info cfg: grun not available, skipping lexer test...)
61 $(info cfg: antlr4 not available, skipping lexer test...)
66 $(info cfg: javac not available, skipping lexer test...)