johnedquinn/kanonic

Modify child functions to return a single node or multiple depending on count

Opened this issue · 0 comments

For rule:

some_rule
    : other_rule PLUS other_rule --> rule_name
    ;

The generate rule looks like:

data class RuleName(...) : SomeRule(...) {
    public fun otherRule(): List<OtherRule> = {...}
    public fun PLUS(): List<TerminalNode> = {...}
}

But, we KNOW that only a single PLUS can be present, so, the function should be:

    public fun PLUS(): TerminalNode = {...}

We need to account for generated/hidden nodes while counting too.