melt-umn / silver

An attribute grammar-based programming language for composable language extensions
http://melt.cs.umn.edu/silver/
GNU Lesser General Public License v3.0
58 stars 7 forks source link

FIx bug with location of terminals in metatranslated ASTs #816

Closed krame505 closed 10 months ago

krame505 commented 10 months ago

Changes

Terminals have an associated location, analagous to the old location annotation, even when origin tracking is enabled on nonterminals. When a production has terminal children, sometimes we use the terminal locations in error messages, rather than querying the parsed origin info..

When constructing terminals in an AST we should use the dynamic origin location rather than the compile-time one from the qutoted AST, if possible.

Documentation

Added a few comments.

Testing

Checked the 1 ++ 2 gives the correct error location.