mirror of
https://github.com/pikami/cosmium.git
synced 2025-03-31 23:20:30 +01:00
Fix 'ComparisonOperator' parsing
This commit is contained in:
parent
14c5400d23
commit
6e3f4169a1
@ -2107,40 +2107,40 @@ var g = &grammar{
|
|||||||
alternatives: []any{
|
alternatives: []any{
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 406, col: 24, offset: 11503},
|
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: "<=",
|
val: "<=",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"<=\"",
|
want: "\"<=\"",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 406, col: 50, offset: 11529},
|
pos: position{line: 406, col: 31, offset: 11510},
|
||||||
val: ">",
|
|
||||||
ignoreCase: false,
|
|
||||||
want: "\">\"",
|
|
||||||
},
|
|
||||||
&litMatcher{
|
|
||||||
pos: position{line: 406, col: 56, offset: 11535},
|
|
||||||
val: ">=",
|
val: ">=",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\">=\"",
|
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: "\">\"",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -403,7 +403,7 @@ OrderBy <- "ORDER"i ws "BY"i
|
|||||||
|
|
||||||
Offset <- "OFFSET"i
|
Offset <- "OFFSET"i
|
||||||
|
|
||||||
ComparisonOperator <- ("=" / "!=" / "<" / "<=" / ">" / ">=") {
|
ComparisonOperator <- ("<=" / ">=" / "=" / "!=" / "<" / ">") {
|
||||||
return string(c.text), nil
|
return string(c.text), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ func Test_Parse_Were(t *testing.T) {
|
|||||||
t,
|
t,
|
||||||
`select c.id
|
`select c.id
|
||||||
FROM c
|
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{
|
parsers.SelectStmt{
|
||||||
SelectItems: []parsers.SelectItem{
|
SelectItems: []parsers.SelectItem{
|
||||||
{Path: []string{"c", "id"}},
|
{Path: []string{"c", "id"}},
|
||||||
@ -90,7 +90,7 @@ func Test_Parse_Were(t *testing.T) {
|
|||||||
Right: testutils.SelectItem_Constant_String("123"),
|
Right: testutils.SelectItem_Constant_String("123"),
|
||||||
},
|
},
|
||||||
parsers.ComparisonExpression{
|
parsers.ComparisonExpression{
|
||||||
Operation: "=",
|
Operation: "<=",
|
||||||
Left: parsers.SelectItem{Path: []string{"c", "id"}},
|
Left: parsers.SelectItem{Path: []string{"c", "id"}},
|
||||||
Right: testutils.SelectItem_Constant_String("456"),
|
Right: testutils.SelectItem_Constant_String("456"),
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user