Castle: The best Real-Time/Embedded/HighTech language EVER. Attempt 2
Revision | c3522f82dc29e20af0deabba3a81339250dca067 (tree) |
---|---|
Zeit | 2022-01-15 06:58:06 |
Autor | Albert Mietus < albert AT mietus DOT nl > |
Commiter | Albert Mietus < albert AT mietus DOT nl > |
Added make missing_visitors to warn on missing_visitors
@@ -1,6 +1,6 @@ | ||
1 | -default: test | |
1 | +default: all | |
2 | 2 | |
3 | -all: test | |
3 | +all: test missing_visitors | |
4 | 4 | |
5 | 5 | test: |
6 | 6 | (cd pytst/; pytest) |
@@ -17,3 +17,11 @@ | ||
17 | 17 | rm -f *.dot |
18 | 18 | rm -f pytst/*.dot |
19 | 19 | |
20 | +GRAMMAR_RULES := $(shell grep '^ *def ' ./grammar.py | awk '{print $$2}' | sed 's/()://') | |
21 | + | |
22 | +missing_visitors: | |
23 | + @for R in ${GRAMMAR_RULES}; do \ | |
24 | + if ! grep -q -E "^ *((def)|(# *NOVISITOR_NEEDED:)) *visit_$$R" ./visitor.py> /dev/null ; then\ | |
25 | + echo "Warning: $${R} has no visitor (nor is marked as to need none)" ;\ | |
26 | + fi ;\ | |
27 | + done |
@@ -7,6 +7,15 @@ | ||
7 | 7 | |
8 | 8 | class QuantityError(ValueError): pass |
9 | 9 | |
10 | + | |
11 | +#NOVISITOR_NEEDED: visit_str_no_s1 | |
12 | +#NOVISITOR_NEEDED: visit_str_no_d1 | |
13 | +#NOVISITOR_NEEDED: visit_str_no_s3 | |
14 | +#NOVISITOR_NEEDED: visit_str_no_d3 | |
15 | +#NOVISITOR_NEEDED: visit_comment | |
16 | +#NOVISITOR_NEEDED: visit_ID | |
17 | +#NOVISITOR_NEEDED: visit_re_no_slash | |
18 | + | |
10 | 19 | class PegVisitor(arpeggio.PTNodeVisitor): |
11 | 20 | token_2_class = {'?': peg.Optional, |
12 | 21 | '*': peg.ZeroOrMore, |