Slide 115
Slide 115 text
Instead of achieving this by adjusting the node
construction in the semantic action, try achieving
it by changing the production rules themselves.
Revised parse.y so that it no longer relies on post hoc AST rewriting, and instead resolves the
issue through the production rules alone. I added a long, dedicated rule for rescue ... in ..., and
assigned %prec tLOWEST to the shorter ... rescue ... side so that keyword_in is picked up
fi
rst. At the same time, I introduced a pattern entry point speci
fi
cally for the right-hand side of
rescue, so that |, .., …, and => can be parsed without breaking ordinary pattern matching.