renatahodovan / grammarinator

ANTLR v4 grammar-based test generator
Other
348 stars 62 forks source link

Ensure that listener sees correct name when lexer rule refers to another lexer rule #239

Closed akosthekiss closed 1 month ago

akosthekiss commented 1 month ago

Since token sub-rules (e.g., fragments) are not represented by unique nodes in the tree, even though listeners are called when the generation of a sub-rule starts or ends, the listeners only see the top-level token node and the name of the top-level lexer rule.

This commit changes this by faking the top-level token node to have the name of the sub-rule rule while generating the sub-rule.

coveralls commented 1 month ago

Coverage Status

coverage: 85.62% (+0.2%) from 85.394% when pulling 6b49680e8e0e97d3fce6dc1fd25e9335e8841204 on akosthekiss:fix-fragment-name into 76e8eb54a3918cbb201ed309b6d8fd8ab2a47daa on renatahodovan:master.