lib/lrama/grammar/rule_builder.rb in lrama-0.6.2 vs lib/lrama/grammar/rule_builder.rb in lrama-0.6.3

- old
+ new

@@ -179,12 +179,19 @@ end if referring_symbol[1] == 0 # Refers to LHS ref.name = '$' else - ref.index = referring_symbol[1] + ref.number = referring_symbol[1] end end + end + + if ref.number + # TODO: When Inlining is implemented, for example, if `$1` is expanded to multiple RHS tokens, + # `$2` needs to access `$2 + n` to actually access it. So, after the Inlining implementation, + # it needs resolves from number to index. + ref.index = ref.number end # TODO: Need to check index of @ too? next if ref.type == :at