Fix 'ComparisonOperator' parsing

This commit is contained in:
Pijus Kamandulis 2025-02-18 19:12:08 +02:00
parent 14c5400d23
commit 6e3f4169a1
3 changed files with 28 additions and 28 deletions

View File

@ -2107,40 +2107,40 @@ var g = &grammar{
alternatives: []any{
&litMatcher{
pos: position{line: 406, col: 24, offset: 11503},
val: "=",
ignoreCase: false,
want: "\"=\"",
},
&litMatcher{
pos: position{line: 406, col: 30, offset: 11509},
val: "!=",
ignoreCase: false,
want: "\"!=\"",
},
&litMatcher{
pos: position{line: 406, col: 37, offset: 11516},
val: "<",
ignoreCase: false,
want: "\"<\"",
},
&litMatcher{
pos: position{line: 406, col: 43, offset: 11522},
val: "<=",
ignoreCase: false,
want: "\"<=\"",
},
&litMatcher{
pos: position{line: 406, col: 50, offset: 11529},
val: ">",
ignoreCase: false,
want: "\">\"",
},
&litMatcher{
pos: position{line: 406, col: 56, offset: 11535},
pos: position{line: 406, col: 31, offset: 11510},
val: ">=",
ignoreCase: false,
want: "\">=\"",
},
&litMatcher{
pos: position{line: 406, col: 38, offset: 11517},
val: "=",
ignoreCase: false,
want: "\"=\"",
},
&litMatcher{
pos: position{line: 406, col: 44, offset: 11523},
val: "!=",
ignoreCase: false,
want: "\"!=\"",
},
&litMatcher{
pos: position{line: 406, col: 51, offset: 11530},
val: "<",
ignoreCase: false,
want: "\"<\"",
},
&litMatcher{
pos: position{line: 406, col: 57, offset: 11536},
val: ">",
ignoreCase: false,
want: "\">\"",
},
},
},
},

View File

@ -403,7 +403,7 @@ OrderBy <- "ORDER"i ws "BY"i
Offset <- "OFFSET"i
ComparisonOperator <- ("=" / "!=" / "<" / "<=" / ">" / ">=") {
ComparisonOperator <- ("<=" / ">=" / "=" / "!=" / "<" / ">") {
return string(c.text), nil
}

View File

@ -67,7 +67,7 @@ func Test_Parse_Were(t *testing.T) {
t,
`select c.id
FROM c
WHERE c.isCool=true AND (c.id = "123" OR c.id = "456")`,
WHERE c.isCool=true AND (c.id = "123" OR c.id <= "456")`,
parsers.SelectStmt{
SelectItems: []parsers.SelectItem{
{Path: []string{"c", "id"}},
@ -90,7 +90,7 @@ func Test_Parse_Were(t *testing.T) {
Right: testutils.SelectItem_Constant_String("123"),
},
parsers.ComparisonExpression{
Operation: "=",
Operation: "<=",
Left: parsers.SelectItem{Path: []string{"c", "id"}},
Right: testutils.SelectItem_Constant_String("456"),
},