renatahodovan / grammarinator

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

Fix the trampoline functions of recurring labeled alternatives #243

Closed akosthekiss closed 1 month ago

akosthekiss commented 1 month ago

These trampoline functions are normally only used in mutation scenarios when a subtree of a labeled alternative is re-generated by calling the function named as the labeled alternative. If the label is recurring, this function is an artificial trampoline that calls one of the functions that have the same name prefix but differ in a numbered suffix (e.g., rule_Label calls rule_Label_1 or rule_Label_2). The trampoline function is expected to be transparent, i.e., to create a tree structure as if one of the number-suffixed functions was called.

However, until now, the tree structures created by the trampolines and the way the trees were created were incorrect. The trampoline created two extra nodes in the tree: one UnparserRule node named as the labeled alternative (e.g., rule_Lable) and one UnparserRuleAlternative node.

This commit fixes both issues.

coveralls commented 1 month ago

Coverage Status

coverage: 85.627% (-0.4%) from 86.015% when pulling 4190f73508fd5ed9027add9ce3580a9e032f33b0 on akosthekiss:recur-trampolines into 35417bc64d6e79e6bb116a5501fdc4f815558867 on renatahodovan:master.