kaby76 / Trash

Toolkit for grammars
MIT License
71 stars 5 forks source link

Reasoning about off-channel content #434

Closed kaby76 closed 2 months ago

kaby76 commented 2 months ago

If I create an Arithmetic example (trgen --arithmetic -t CSharp), I can parse an expression with WS. The parse tree contains "Attribute Before" nodes, but I really cannot reason much about them because (1) I don't know what the lexer token type is, (2) I cannot see what channel it is on.

Suppose I want to parse Antlr4 grammars and find out whether a grammar formatter works or not. I can certainly get the parse tree and remove all inter-token content by trparse *.g4 | trdelete ' //@*'. But, I cannot determine whether comments were changed because I cannot query for just the COMMENT tokens.

Attributes are now referenced by @<token-name>.

Fixed by https://github.com/kaby76/Domemtech.Trash/pull/419.

kaby76 commented 2 months ago

Additional fix with