masaori335 opened a new issue, #13701:
URL: https://github.com/apache/trafficserver/issues/13701

   ## Summary
   
   The grammar has a statement alternative for a bare operator without 
parentheses:
   
https://github.com/apache/trafficserver/blob/13ef6a7618bda4c36835aab291de95d02e86f2ed/tools/hrw4u/grammar/hrw4u.g4#L171
   
   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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to