Skip to content

Commit

Permalink
Code changes to accommodate the compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulKlint committed Feb 7, 2024
1 parent b6847c4 commit 8e0f7b2
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/org/rascalmpl/library/Location.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,17 @@ Strict containment between two locations `inner` and `outer` holds when
}
bool isStrictlyContainedIn(loc inner, loc outer){
if(inner == outer){
return false;
}
if(isSameFile(inner, outer)){
if(inner.offset?){
return outer.offset? ==> ( inner.offset == outer.offset && inner.offset + inner.length < outer.offset + outer.length
|| inner.offset > outer.offset && inner.offset + inner.length <= outer.offset + outer.length
);
} else {
return inner.offset > 0 && !outer.offset?;
if(outer.offset?){
return inner.offset == outer.offset && inner.offset + inner.length < outer.offset + outer.length
|| inner.offset > outer.offset && inner.offset + inner.length <= outer.offset + outer.length;
} else {
return inner.offset > 0;
}
}
}
return false;
Expand All @@ -102,7 +106,11 @@ Containment between two locations `inner` and `outer` holds when
bool isContainedIn(loc inner, loc outer){
if(isSameFile(inner, outer)){
if(inner.offset?){
return outer.offset? ==> (inner.offset >= outer.offset && inner.offset + inner.length <= outer.offset + outer.length);
if(outer.offset?){
return (inner.offset >= outer.offset && inner.offset + inner.length <= outer.offset + outer.length);
} else {
return true;
}
} else {
return !outer.offset?;
}
Expand Down

0 comments on commit 8e0f7b2

Please sign in to comment.