typeql icon indicating copy to clipboard operation
typeql copied to clipboard

TypeQL ParsePattern throws syntax error for basic conjunction

Open jmsfltchr opened this issue 4 years ago • 2 comments

Description

Java's ParsePattern is throwing unexpected syntax errors for basic conjunctions. This is if the conjunction is given without surrounding {}. With the enclosing braces the conjunction is parsed correctly.

Environment

  1. OS (where TypeDB server runs): Mac OS 10
  2. Grakn version (and platform): Grakn Core 2.14.0
  3. TypeDB client: client-java

Reproducible Steps

Steps to create the smallest reproducible scenario:

Try parsing the following query

Pattern expected = TypeDB.parsePattern("$x isa person, has age 10;");

Expected Output

This was expected to parse the query into a conjunction.

Actual Output

[TQL03] TypeQL Error: There is a syntax error at line 1:
$x isa person, has age 10;
                         ^
extraneous input ';' expecting <EOF>

Additional information

Enclosing with {} parses correctly:

Pattern expected = TypeQL.parsePattern("{$x isa person, has age 10;}");

jmsfltchr avatar Jun 23 '20 11:06 jmsfltchr

Related to #134

jmsfltchr avatar Jun 23 '20 11:06 jmsfltchr

This is still an issue - testing the parser for the pattern rule fails for something as simple as $x isa person; This is in our grammar, a conjunction is matched after a variable, and only conjunctions are parsed with a trailing ; (issue updated to reflect)

flyingsilverfin avatar Jan 10 '23 12:01 flyingsilverfin