rascal icon indicating copy to clipboard operation
rascal copied to clipboard

loc splicing does not build URIs the right way (e.g. spaces end up being not encoded when the loc is printed)

Open jurgenvinju opened this issue 9 years ago • 4 comments

rascal>str myPath = "  ";
str: "  "
rascal>|hello://<myPath>|
|prompt:///|(0,18,<1,0>,<1,18>): MalFormedURI("hello://  ")
        at $shell$(|prompt:///|(0,18,<1,0>,<1,18>))
rascal>|hello:///| + myPath 
loc: |hello:///%20%20|

jurgenvinju avatar Dec 08 '15 10:12 jurgenvinju

that could be solved by calling the correct overload of the sourceLocation method of the ValueFactory.

I think that now we first concat everything and then use new URI() on that string. Which is easier to code, but incorrect.

DavyLandman avatar Dec 08 '15 10:12 DavyLandman

so it would mean that in java for the interpolated source location literal you have to find in which part (scheme, authority, path,...) the interpolation is.

DavyLandman avatar Dec 08 '15 10:12 DavyLandman

Yes; we should change the template grammar to make sure we can store each field in the proper place (i.e. authority has a different notations from path, etc).

jurgenvinju avatar Dec 08 '15 19:12 jurgenvinju