Skip to content

Commit e535d67

Browse files
author
Dean Karn
authored
Merge pull request #4 from absolutscottie/comma-as-operator
Treat comma as an operation in ParseOp
2 parents 1f6e2e6 + fac892b commit e535d67

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9-
## [0.1.0] - 2022-06-08
9+
## [0.1.2] - 2022-06-08
10+
### Fixed
11+
- Handling of commas in arrays.
12+
13+
## [0.1.1] - 2022-06-08
1014
### Fixed
1115
- CLI output to be JSON.
1216

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ksql
22
=====
3-
![Project status](https://img.shields.io/badge/version-0.1.1-green.svg)
3+
![Project status](https://img.shields.io/badge/version-0.1.2-green.svg)
44
[![GoDoc](https://godoc.org/github.com/go-playground/ksql?status.svg)](https://pkg.go.dev/github.com/go-playground/ksql)
55
![License](https://img.shields.io/dub/l/vibe-d.svg)
66

parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ func parseOp(value Expression, tokens []Token, pos *int) (Expression, error) {
316316
return nil, errors.New("no value between ()")
317317
}
318318
return parseOp(op, tokens, pos)
319-
case CloseParen, CloseBracket:
319+
case CloseParen, CloseBracket, Comma:
320320
return value, nil
321321
default:
322322
return nil, fmt.Errorf("invalid token after ident %d %s", tok.kind, tok.value)

parser_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,18 @@ func TestParser(t *testing.T) {
198198
src: `{"field1":[]}`,
199199
expected: false,
200200
},
201+
{
202+
name: "ident IN value true",
203+
exp: `.field1 IN ["test"]`,
204+
src: `{"field1":"test"}`,
205+
expected: true,
206+
},
207+
{
208+
name: "ident IN value true multiple",
209+
exp: `.field1 IN ["test","foo","bar",]`,
210+
src: `{"field1":"test"}`,
211+
expected: true,
212+
},
201213
{
202214
name: "array eq false",
203215
exp: `[] == ["test"]`,

0 commit comments

Comments
 (0)