Skip to content

Commit 21a4d5d

Browse files
authored
Merge pull request #2 from shellyln/fix-logical-op-prod-rule-250108-1
[FIX] If the logical operator contained uppercase letters, production rule failed.
2 parents a2fa213 + c00a317 commit 21a4d5d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

soql/parser/core/helpers.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package core
22

33
import (
4+
"strings"
5+
46
. "github.com/shellyln/takenoco/base"
57
objparser "github.com/shellyln/takenoco/object"
68
)
@@ -31,7 +33,7 @@ func makeOpMatcher(className string, ops []string) func(c interface{}) bool {
3133
}
3234
val := ast.Value.(string)
3335
for _, op := range ops {
34-
if op == val {
36+
if strings.EqualFold(op, val) {
3537
return true
3638
}
3739
}

soql/parser/parser_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@ func TestParse(t *testing.T) {
9191
want: nil,
9292
wantErr: false,
9393
dbgBreak: true,
94+
}, {
95+
name: "Fix bug (2025-01-08) #1",
96+
args: args{s: `SELECT Id FROM Contact WHERE LastName = 'bar' or (Name = 'bar' and LastName = 'foo')`},
97+
want: nil,
98+
wantErr: false,
99+
dbgBreak: true,
100+
}, {
101+
name: "Fix bug (2025-01-08) #2",
102+
args: args{s: `SELECT Id FROM Contact WHERE LastName = 'bar' OR (Name = 'bar' AND LastName = 'foo')`},
103+
want: nil,
104+
wantErr: false,
105+
dbgBreak: true,
94106
}}
95107
for _, tt := range tests {
96108
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)