Skip to content

Commit

Permalink
[FIX] If the logical operator contained uppercase letters, production…
Browse files Browse the repository at this point in the history
… rule failed.
  • Loading branch information
shellyln committed Jan 8, 2025
1 parent a2fa213 commit c00a317
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion soql/parser/core/helpers.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package core

import (
"strings"

. "github.com/shellyln/takenoco/base"
objparser "github.com/shellyln/takenoco/object"
)
Expand Down Expand Up @@ -31,7 +33,7 @@ func makeOpMatcher(className string, ops []string) func(c interface{}) bool {
}
val := ast.Value.(string)
for _, op := range ops {
if op == val {
if strings.EqualFold(op, val) {
return true
}
}
Expand Down
12 changes: 12 additions & 0 deletions soql/parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ func TestParse(t *testing.T) {
want: nil,
wantErr: false,
dbgBreak: true,
}, {
name: "Fix bug (2025-01-08) #1",
args: args{s: `SELECT Id FROM Contact WHERE LastName = 'bar' or (Name = 'bar' and LastName = 'foo')`},
want: nil,
wantErr: false,
dbgBreak: true,
}, {
name: "Fix bug (2025-01-08) #2",
args: args{s: `SELECT Id FROM Contact WHERE LastName = 'bar' OR (Name = 'bar' AND LastName = 'foo')`},
want: nil,
wantErr: false,
dbgBreak: true,
}}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit c00a317

Please sign in to comment.