Skip to content
This repository was archived by the owner on Feb 11, 2022. It is now read-only.

Commit bc88039

Browse files
authored
Merge pull request #1 from tarantool/update-rockspec-for-tarantool
Update rockspec and small refactor
2 parents a865525 + fc078d5 commit bc88039

File tree

7 files changed

+156
-137
lines changed

7 files changed

+156
-137
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.rocks
2+
.idea
3+
luaunit

.luacheckrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
std = {
2+
read_globals = {'box', 'require', 'debug', 'pcall', 'xpcall', 'tostring',
3+
'tonumber', 'type', 'assert', 'ipairs', 'math', 'error', 'string',
4+
'table', 'pairs', 'os', 'io', 'select', 'unpack', 'dofile', 'next',
5+
'loadstring', 'setfenv', 'print',
6+
'getmetatable', 'setmetatable', 'SCRIPT_PATH'
7+
},
8+
globals = {'process_request', 'package'}
9+
}
10+
redefined = False

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.PHONY: lint
2+
lint:
3+
luacheck --config=.luacheckrc --no-unused-args --no-redefined \
4+
jsonpath.lua
5+
6+
.PHONY: test
7+
test: build lint
8+
./test/test.lua
9+
10+
.PHONY: build
11+
build:
12+
tarantoolctl rocks make
13+
14+
all: build test

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Query Lua data structures with JsonPath expressions. Robust and safe JsonPath en
44

55
This library implements Stefan Goessner's [JsonPath syntax](http://goessner.net/articles/JsonPath/) in Lua. Lua JsonPath is compatible with David Chester's [Javascript implementation](https://github.com/dchester/jsonpath).
66

7-
The JsonPath Lua library was written from scratch by Frank Edelhaeuser. It's a pure Lua implementation based on a PEG grammer handled by Roberto Ierusalimschy's fabulous [LPeg pattern-matching library](http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html).
7+
The JsonPath Lua library was written from scratch by Frank Edelhaeuser. It's a pure Lua implementation based on a PEG grammer handled by [LulPeg pattern-matching library](https://github.com/pygy/LuLPeg).
88

99
Some of this README and a subset of test cases were adopted from David Chester's [Javascript implementation](https://github.com/dchester/jsonpath) which is based on Stefan Goessner's [original work](http://goessner.net/articles/JsonPath/).
1010

@@ -188,8 +188,8 @@ Provides the lua-jsonpath LPEG grammer for embedding in higher level LPEG gramme
188188
The abstract syntax tree matched for JsonPath elementes in a higher level LPEG grammer can then be supplied to `jp.nodes()`, `jp.paths()` or `jp.query()` instead of the string `pathExpression`.
189189

190190
```lua
191-
local lpeg = require('lpeg')
192-
local assignment = lpeg.C(lpeg.R'az') * lpeg.P'=' * lpeg.P'"' * jp.grammer() * lpeg.P'"'
191+
local lulpeg = require('lulpeg')
192+
local assignment = lulpeg.C(lulpeg.R'az') * lulpeg.P'=' * lulpeg.P'"' * jp.grammer() * lulpeg.P'"'
193193
local var, ast = assignment:match('x="$..author"')
194194
-- var = 'x'
195195
local results = jp.query(data, ast)
@@ -237,7 +237,7 @@ Some of David Chester's API methods are not implemented in Lua JsonPath:
237237

238238
The `jp.value` API method does not support the third argument (`newValue`).
239239

240-
The `jp.grammer` API method was added in Lua JsonPath. The `jp.query`, `jp.value`, `jp.paths`, `jp.nodes` functions accept abstract syntax trees returned by `lpeg.match` for Lua JsonPath expressions matched using `jp.grammer`. This is for embedding Lua JsonPath into higher level grammers.
240+
The `jp.grammer` API method was added in Lua JsonPath. The `jp.query`, `jp.value`, `jp.paths`, `jp.nodes` functions accept abstract syntax trees returned by `lulpeg.match` for Lua JsonPath expressions matched using `jp.grammer`. This is for embedding Lua JsonPath into higher level grammers.
241241

242242

243243
## License

jsonpath-1.0-1.rockspec

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package = 'jsonpath'
22
version = '1.0-1'
33
source = {
4-
url = 'git://github.com/mrpace2/lua-jsonpath',
4+
url = 'git://github.com/tarantool/lua-jsonpath',
55
tag = '1.0'
66
}
77
description = {
@@ -11,21 +11,18 @@ This library implements Stefan Goessner's JsonPath syntax (http://goessner.net/a
1111
1212
Lua JsonPath is compatible with David Chester's Javascript implementation (https://github.com/dchester/jsonpath).
1313
14-
The Lua JsonPath library was written from scratch by Frank Edelhaeuser. It's a pure Lua implementation based on a PEG grammer handled by Roberto Ierusalimschy's fabulous LPeg pattern-matching library (http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html).
14+
The Lua JsonPath library was written from scratch by Frank Edelhaeuser. It's a pure Lua implementation based on a PEG grammer handled by LulPeg pattern-matching library (https://github.com/pygy/LuLPeg.git).
1515
]],
16-
homepage = 'https://github.com/mrpace2/lua-jsonpath',
16+
homepage = 'https://github.com/tarantool/lua-jsonpath',
1717
license = 'MIT'
1818
}
1919
dependencies = {
2020
'lua >= 5.1',
21-
'lpeg >= 1.0.0'
21+
'lulpeg'
2222
}
2323
build = {
2424
type = 'builtin',
2525
modules = {
2626
jsonpath = 'jsonpath.lua'
27-
},
28-
copy_directories = {
29-
'test'
3027
}
3128
}

0 commit comments

Comments
 (0)