Skip to content

Commit

Permalink
Fixed end-of-line sequence to the source end-of-lines
Browse files Browse the repository at this point in the history
This should make the tests succeed on the Windows CI machine
  • Loading branch information
PieterOlivier committed Oct 4, 2024
1 parent 3572860 commit e8b5239
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Tree parsePico(str input, bool visualize=false)

bool checkError(Tree t, str expectedError) {
str bestError = getErrorText(findBestError(t));
println("best error: <bestError>, expected: <expectedError>");
//println("best error: <bestError>, expected: <expectedError>");
return size(bestError) == size(expectedError);
}

Expand Down Expand Up @@ -88,7 +88,8 @@ test bool picoMissingSemi() {
input := input - 1
od
end");
return checkError(t, "input := input - 1\n od");
return checkError(t, "input := input - 1
od");
}

test bool picoTypoSmall() {
Expand All @@ -112,5 +113,6 @@ test bool picoMissingSemiSmall() {
od
end");

return checkError(t, "output := 0\n od");
}
return checkError(t, "output := 0
od");
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@ import lang::rascal::\syntax::Rascal;
import ParseTree;
import IO;

bool debugging = false;

Tree parseRascal(type[&T] t, str input, bool visualize=false) {
Tree result = parser(t, allowRecovery=true, allowAmbiguity=true)(input, |unknown:///?visualize=<"<visualize>">|);
list[Tree] errors = findAllErrors(result);
if (errors != []) {
println("Tree has <size(errors)> errors");
for (error <- errors) {
println("- <getErrorText(error)>");
if (debugging) {
list[Tree] errors = findAllErrors(result);
if (errors != []) {
println("Tree has <size(errors)> errors");
for (error <- errors) {
println("- <getErrorText(error)>");
}

Tree disambiguated = defaultErrorDisambiguationFilter(result);
println("Best error: <getErrorText(findFirstError(disambiguated))>");
}

Tree disambiguated = defaultErrorDisambiguationFilter(result);
println("Best error: <getErrorText(findFirstError(disambiguated))>");
}

return result;
Expand Down

0 comments on commit e8b5239

Please sign in to comment.