Question

I guess the titles says it all. In my program I have a bunch of loc's and I would like to extract the line numbers / column numbers from them.

Is there a way to do this?

Was it helpful?

Solution

rascal>myLoc = |project://HelloWorld/src/ByeWorld.java|(24,669,<3,0>,<45,1>);
loc: |project://HelloWorld/src/ByeWorld.java|(24,669,<3,0>,<45,1>)

rascal>myLoc.begin
tuple[int line,int column]: <3,0>

rascal>myLoc.begin.line
int: 3

rascal>myLoc.begin.column
int: 0

See also: http://tutor.rascal-mpl.org/Rascal/Expressions/Values/Location/Location.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top