Stratego programs should be able to inspect, maybe even manipulate position information. One use case is in comparing the positions of terms (e.g, "is this declaration the same node in the tree, or is it a duplicate somewhere else?).

Submitted by Lennart Kats on 16 February 2010 at 16:02

On 16 February 2010 at 16:04 Lennart Kats commented:

This issue currently blocks Spoofax/12.


On 31 March 2010 at 12:25 Lennart Kats commented:

Some functions that should be in this API:

  • origin-term
  • origin-text – to get the original text string
  • origin-equals(|x)
  • origin-line
  • origin-column
  • origin-track-forced(s) = !Some(<id>); all(s); ?Some(<id>)

On 31 March 2010 at 15:53 Nathan Bruning commented:
  • origin-strip
    • Enabling garbage collection of the associated AST
  • origin-available / has-origin
    • Might just be defined as not(origin-term)

Also, origin-preserve might be a better name than origin-track-forced.


On 6 April 2010 at 08:48 Lennart Kats commented:

Implemented in 0.4.3.

(Note that I prefer the name origin-track-forced since it’s “origin tracking”, not “origin preservation”. Also, it is usually automatic, but in this case you’re forcing it.)

Log in to post comments