vaticle / typeql

TypeQL: the polymorphic query language of TypeDB
https://typedb.com
Mozilla Public License 2.0
213 stars 45 forks source link

TypeQL ParsePattern throws syntax error for basic conjunction #136

Open jmsfltchr opened 4 years ago

jmsfltchr commented 4 years ago

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 commented 4 years ago

Related to #134

flyingsilverfin commented 1 year ago

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)