juanthropic commented on code in PR #13180:
URL: https://github.com/apache/trafficserver/pull/13180#discussion_r3276646657


##########
tools/hrw4u/grammar/hrw4u.g4:
##########
@@ -88,6 +88,7 @@ AND           : '&&';
 OR            : '||';
 TILDE         : '~';
 NOT_TILDE     : '!~';
+BANG          : '!';
 COLON         : ':';

Review Comment:
   Verified against the regenerated parser: `BANG` never reaches user-facing 
diagnostics. ANTLR's `Vocabulary.getDisplayName()` prefers the literal alias 
when one exists, so the token is always rendered as `'!'` in expected-token 
sets — same as `NEQ` (`'!='`), `LPAREN` (`'('`), etc.
   
   Repro:
   ```
   echo 'REMAP { if x && }' | hrw4u
   # → expecting {TRUE, FALSE, qualified name (e.g. 'Namespace::Name'), 
identifier, '(', '!'}
   ```
   
   Grepping for `BANG` in the output is empty across every malformed input I 
tried that triggers a `mismatched input ... expecting {...}` error. The 
pre-existing `_TOKEN_NAMES` entries for `LPAREN`, `NEQ`, etc. are defensive — 
`humanize_error_message` only actually fires for tokens without a literal alias 
(`QUALIFIED_IDENT`, `IDENT`, `IPV4_LITERAL`, …). Skipping the change.



-- 
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