Skip to content

Commit

Permalink
Merge pull request #2069 from usethesource/fix/at-column-restriction
Browse files Browse the repository at this point in the history
Fixed @<column> requirement implementation
  • Loading branch information
DavyLandman authored Nov 12, 2024
2 parents 11c9eaf + 13e29dd commit 7de3427
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module lang::rascal::tests::concrete::AtColumnRequirement

import ParseTree;
import Exception;

lexical C = C C C | "a"@2 | "b";

bool testParse(str input, bool shouldParse) {
try {
parse(#C, input);
} catch ParseError(_): {
return !shouldParse;
}

return shouldParse;
}

test bool testA() = testParse("a", false);

test bool testBab() = testParse("bab", false);

test bool testBba() = testParse("bba", true);
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public AtColumnRequirement(int column){
}

public boolean isFiltered(int[] input, int start, PositionStore positionStore){
return positionStore.isAtColumn(start, column);
return !positionStore.isAtColumn(start, column);
}

public boolean isEqual(IEnterFilter otherEnterFilter){
Expand Down

0 comments on commit 7de3427

Please sign in to comment.