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
# isla_and_not.pyfromisla.languageimportparse_islaif__name__=="__main__":
parse_isla('(and (= <isbn10> "a") (= <isbn10> "b"))') # no not -> okparse_isla('(not (= <isbn10> "a")) and (not (= <isbn10> "b"))') # infix and -> okparse_isla('(and (not (= <isbn10> "a")) (not (= <isbn10> "b")))') # prefix and -> fails
Output:
$ python isla_and_not.pyline 1:6 no viable alternative at input 'not'Traceback (most recent call last): File "/home/isla/isla/src/isla/isla_language/IslaLanguageParser.py", line 1398, in sexpr la_ = self._interp.adaptivePredict(self._input,21,self._ctx) File "/usr/local/lib/python3.10/site-packages/antlr4/atn/ParserATNSimulator.py", line 346, in adaptivePredict alt = self.execATN(dfa, s0, input, index, outerContext) File "/usr/local/lib/python3.10/site-packages/antlr4/atn/ParserATNSimulator.py", line 418, in execATN raise eantlr4.error.Errors.NoViableAltException: NoneDuring handling of the above exception, another exception occurred:Traceback (most recent call last): File "/isla/files/isla_isbn10.py", line 79, in <module> parse_isla('(and (not (= <isbn10> "a")) (not (= <isbn10> "b")))') File "/home/isla/isla/src/isla/language.py", line 2921, in parse_isla antlr4.ParseTreeWalker().walk(isla_emitter, parser.start()) File "/home/isla/isla/src/isla/isla_language/IslaLanguageParser.py", line 226, in start self.formula(0) File "/home/isla/isla/src/isla/isla_language/IslaLanguageParser.py", line 971, in formula self.sexpr(0) File "/home/isla/isla/src/isla/isla_language/IslaLanguageParser.py", line 1521, in sexpr self.sexpr(0) File "/home/isla/isla/src/isla/isla_language/IslaLanguageParser.py", line 1515, in sexpr localctx.op = self.sexpr(0) File "/home/isla/isla/src/isla/isla_language/IslaLanguageParser.py", line 1623, in sexpr self._errHandler.recover(self, re) File "/home/isla/isla/src/isla/language.py", line 2099, in recover super().recover(recognizer, e) File "/usr/local/lib/python3.10/site-packages/antlr4/error/ErrorStrategy.py", line 697, in recover raise ParseCancellationException(e)antlr4.error.Errors.ParseCancellationException: None
The text was updated successfully, but these errors were encountered:
Thanks for reporting this. For the record (Michael knows this already): Expressing the constraint in infix/prefix syntax (without S-expressions!) circumvents this problem.
Here is a file reproducing the problem:
Output:
The text was updated successfully, but these errors were encountered: