Summary
The grammar has a statement alternative for a bare operator without parentheses:
Nothing written that way compiles. Every op is rejected, so the alternative is
unreachable and should be removed from the grammar.
Reproduce
| source |
result |
no-op(); |
no-op |
no-op; |
error: This operator requires an argument |
skip-remap;, set-debug; |
same error |
Why remove rather than fix
The call form is the only form anything produces or documents:
| producer |
form |
doc/admin-guide/configuration/hrw4u.en.rst |
no-op();, set-debug(), skip-remap() |
reverse conversion, u4wrh (src/hrw_symbols.py:315) |
always name() |
test corpus (tests/data) |
no-op();, 0 bare-op inputs |
Making the bare form work instead (check arity rather than validator presence)
would add a second spelling for the same statement with no caller asking for
it. break; is a separate alternative and is unaffected either way.
Trade-off: after removal, no-op; becomes an ANTLR syntax error rather than a
named one. If the friendlier message matters, it belongs in the suggestion
engine, not in a grammar alternative that produces no output.
Note
test_the_corpus_reaches_every_grammar_rule does not catch this: it records
rule names, and statement is reached through its other alternatives.
Summary
The grammar has a statement alternative for a bare operator without parentheses:
trafficserver/tools/hrw4u/grammar/hrw4u.g4
Line 171 in 13ef6a7
Nothing written that way compiles. Every op is rejected, so the alternative is
unreachable and should be removed from the grammar.
Reproduce
no-op();no-opno-op;error: This operator requires an argumentskip-remap;,set-debug;Why remove rather than fix
The call form is the only form anything produces or documents:
doc/admin-guide/configuration/hrw4u.en.rstno-op();,set-debug(),skip-remap()src/hrw_symbols.py:315)name()tests/data)no-op();, 0 bare-op inputsMaking the bare form work instead (check arity rather than validator presence)
would add a second spelling for the same statement with no caller asking for
it.
break;is a separate alternative and is unaffected either way.Trade-off: after removal,
no-op;becomes an ANTLR syntax error rather than anamed one. If the friendlier message matters, it belongs in the suggestion
engine, not in a grammar alternative that produces no output.
Note
test_the_corpus_reaches_every_grammar_ruledoes not catch this: it recordsrule names, and
statementis reached through its other alternatives.