You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using this library in one of my projects. It is very convenient, and simple.
However, I am not sure why vertical bar (|) is treated in a special way. Could you provide the complete grammar of the s-expression you recognize?
Thanks,
Ahmet
The text was updated successfully, but these errors were encountered:
The | is a secondary escape mechanism. With just quotes, there's no way to include an atom that contains a " (double quote). The below code helps illustrate:
importstaticde.tudresden.inf.lat.jsexp.SexpFactory.parse;
importde.tudresden.inf.lat.jsexp.SexpParserException;
publicclassFoo {
publicstaticvoidmain(String[] args) throwsSexpParserException {
Strings1 = "abcd"; // normalStrings2 = "a\"bcd"; // error, missing quotation markStrings3 = "a|bcd"; // error (unhelpfully throws NPE)Strings4 = "|ab\"cd|"; // how to include a "Strings5 = "\"ab|cd\""; // how to include a |System.out.println(parse(s1));
try {
parse(s2);
} catch (SexpParserExceptione) {
System.out.println("expected");
}
try {
System.out.println(parse(s3));
} catch (SexpParserExceptione) {
System.out.println("expected but not encountered");
} catch (NullPointerExceptione) {
System.out.println("it is what it is");
}
System.out.println(parse(s4));
System.out.println(parse(s5));
}
}
I am using this library in one of my projects. It is very convenient, and simple.
However, I am not sure why vertical bar (|) is treated in a special way. Could you provide the complete grammar of the s-expression you recognize?
Thanks,
Ahmet
The text was updated successfully, but these errors were encountered: