Skip to content

Commit

Permalink
Merge pull request #22 from bhmj/v1-1-1-unicode-and-fixes
Browse files Browse the repository at this point in the history
unicode support and some bugfixes
  • Loading branch information
bhmj authored Jan 2, 2022
2 parents 6f359fc + 42e2ad3 commit f6fba1c
Show file tree
Hide file tree
Showing 7 changed files with 337 additions and 181 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ help:
echo " run - run jsonslice CLI"
echo " lint - run linters"
echo " test - run tests"
echo " test-short - run tests without fuzzy tests"

configure:
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
Expand All @@ -34,9 +35,12 @@ lint:
golangci-lint run
gocyclo -over 18 .

test:
test:
go test ./...

.PHONY: all configure help build run lint test
test-short:
go test -test.short ./...

.PHONY: all configure help build run lint test test-short

$(V).SILENT:
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ $ cat example/sample1.json | ./build/jsonslice '$[0].author'
### Overview
```
$ -- root node (can be either object or array)
.node -- dot-notated child
.'some node' -- dot-notated child (syntax extension)
$.node -- dot-notated child
$.node.deeper -- dot-notated child (chain of them)
$.'some node' -- dot-notated child (syntax extension)
['node'] -- bracket-notated child
['foo','bar'] -- bracket-notated children (aggregation)
[5] -- array index
Expand All @@ -92,6 +93,10 @@ $ cat example/sample1.json | ./build/jsonslice '$[0].author'
[1:9:2] -- array slice (+step)
.* .[*] .[:] -- wildcard
..key -- deepscan
.'\'' -- escape sequences supported (\", \', \n, \r, \t, \0, \\)
.'k\x0A' -- escaped hex bytes supported
.'k\u00F6' -- escaped 16-bit unicode codepoints supported
.'k\U000000F6' -- escaped 32-bit unicode codepoints supported
```
### Functions
```
Expand Down Expand Up @@ -194,6 +199,13 @@ ok github.com/bhmj/jsonslice 52.452s

## Changelog

**1.1.2** (2022-01-02) -- Unicode support added. Expression parser upgrade to v0.9.1
Bugfix: indexing of array element inside expression (`@[-1]`).
Bugfix: ecaped backslash in node key now works (`["\\"]`).
See `Test_Fixes` function for bugfix details.

**1.1.1** (2022-10-20) -- Expression parser upgrade to v0.9.0

**1.1.0** (2021-11-12) -- Expression parser/evaluator has been separated to [different project](https://github.com/bhmj/xpression/) and completely rewritten. Parentheses now fully supported. Exponentiation operator added (`**`). Bitwise operators added (`|`, `&`, `^`, `<<`, `>>`). All expression calculations are JavaScript-compliant.

**1.0.6** (2021-10-31) -- JS-like behaviour on string/number/boolean values comparison. `===` operator added for strict comparison. Strings are now comparable.
Expand Down Expand Up @@ -261,6 +273,7 @@ ok github.com/bhmj/jsonslice 52.452s
- [x] syntax extensions: `$.'keys with spaces'.price`
- [x] flexible syntax: `$[0]` works on both `[1,2,3]` and `{"0":"abc"}`
- [x] JavaScript-compatible expressions
- [x] Unicode support
- [ ] IN (), NOT IN ()
- [ ] cache parsed jsonpaths of used variables at filterMatch.varFunc(str)
- [ ] Optionally unmarshal the result
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/bhmj/jsonslice

go 1.17

require github.com/bhmj/xpression v0.9.0
require github.com/bhmj/xpression v0.9.1
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github.com/bhmj/xpression v0.9.0 h1:fptQyWeYLUybLW3BnSGBnBvjZPdR0/j/SwFVrfenZLo=
github.com/bhmj/xpression v0.9.0/go.mod h1:j9oYmEXJjeL9mrgW1+ZDBKJXnbupsCPGhlO9J5YhS1Q=
github.com/bhmj/xpression v0.9.1 h1:N7bX/nWx9oFi/zsiMTx2ehoRApTDAWdQadq/5o2wMGk=
github.com/bhmj/xpression v0.9.1/go.mod h1:j9oYmEXJjeL9mrgW1+ZDBKJXnbupsCPGhlO9J5YhS1Q=
Loading

0 comments on commit f6fba1c

Please sign in to comment.