Search code examples
rascal

How to strip off the line information from a Location?


Assume I have a location:

loc originalLocation = |project://proj/src/Test.java|(15,536,<3,0>,<41,1>),5,11,39)

How do I strip off the line info, so I get:

 |project://proj/src/Test.java|

I tried:

 loc l= ||+originalLocation.uri;

and:

loc l = |originalLocation.uri| 

but in the last case it is off course handled as text.


Solution

  • You can get it using the top field in locations.

    rascal> originalLocation.top
    loc: |project://proj/src/Test.java|