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

4.6 :RegularExpressionParser is broken #30

Open
xgillard opened this issue Feb 21, 2019 · 0 comments
Open

4.6 :RegularExpressionParser is broken #30

xgillard opened this issue Feb 21, 2019 · 0 comments

Comments

@xgillard
Copy link

Concerns : JaCoP 4.6 (Java 11).

I spotted a few issues in the code of the RegularExpressionParser class introduced in 4.6.

  • (this one is fixed in the enclosed patched file) the class is unusable since the result of lexer.nextToken() is never used. As a consequence of that, any call to parse yields 'null'.
  • The dot notation parsing is flaky. For instance, the following two examples relate toi the handling of epsilon expressions but are not orthogonal to one another.
// Prints "null.(32)*"
System.out.println(new PatchedRegexParser(new StringReader("(.32*)")).parse(false));

// Warns of a syntax error then prints "32.(null).*"
System.out.println(new PatchedRegexParser(new StringReader("(32.*)")).parse(false));
  • In some cases (ie when a dot is missing) the parser silently drops a whole portion of the text to parse. For example, consider the following example:
// Prints "(17)*.23" and nothing more.
System.out.println(new PatchedRegexParser(new StringReader("(32.14*)17*.23")).parse(false));

Btw, I wonder if reusing the . and + symbols for summation and concatenation was judicious. Indeed, these symbols have different meaning in POSIX-style regexes (and I assume most people would expect that meaning)

PatchedRegexParser.java.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant