Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#3743): Add Error Location for Custom Errors #3766

Merged
merged 6 commits into from
Dec 26, 2024
Merged
Prev Previous commit
Next Next commit
feat(#3743): remove redundant code
  • Loading branch information
volodya-lombrozo committed Dec 26, 2024
commit 9a11b5420cba16e54570881287483ca912a89634
11 changes: 1 addition & 10 deletions eo-parser/src/main/java/org/eolang/parser/XeEoListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -1112,23 +1112,14 @@ public void enterData(final EoParser.DataContext ctx) {
text.substring(1, text.length() - 1)
).getBytes(StandardCharsets.UTF_8)
);
} else if (ctx.TEXT() != null) {
} else {
base = "string";
final int indent = ctx.getStart().getCharPositionInLine();
data = new BytesToHex(
StringEscapeUtils.unescapeJava(
XeEoListener.trimMargin(text, indent)
).getBytes(StandardCharsets.UTF_8)
);
} else {
base = "unknown";
data = ctx::getText;
this.errors.add(
new ParsingException(
ctx.getStart().getLine(),
String.format("Unknown data type: %s", ctx.getText())
)
);
}
this.objects.prop("base", base).data(data.get());
}
Expand Down
Loading