Commit 2c99b9b
authored
Compile time path (#101)
* Add initial implementation for JSONPath procedural macro
Introduces `jsonpath-rust-impl` crate as a procedural macro for JSONPath parsing and validation. Includes AST definitions, Pest-based grammar, and integration with the main library. Starts refining error handling and debugging within parsing logic.
* Swap syn crates, refactor CompOp, continue writing
* It compiles
* Overly verbose version of ToTokens on AST, will replace with macro ASAP once we know what the spec should be
* Created first basic test suite with a script and now debugging
* Eliminate whitespace validation via compound-atomic($) and not-atomics(!) in pest
* almost all tests cleansed
* Add nonempty parsing to `PestIgnoredPunctuated`
Introduce `parse_terminated_nonempty` to enforce nonempty parsing for `PestIgnoredPunctuated`. Updated relevant AST nodes to use this stricter parsing function, ensuring better validation and error handling for empty input cases.
* Add new compile error tests for invalid JSONPath queries
These tests validate that the `json_query!` macro correctly rejects various malformed JSONPath expressions. The added cases cover scenarios like empty segments, unexpected tokens, and improper syntax for selectors.
* Refactor imports and remove unused public re-exports
* Rustfmt all, add trim() calls on raw strings for identifiers, and literals so that rust str->lit parsing doesn't crash on extraneous spaces.
* **Consolidate and refactor compile test organization**
Refactor compile tests by consolidating failing cases into a single `compile_but_expect_err.rs` file and updating test structure. Removed redundant individual files to streamline file management while retaining all test case coverage. Also adjusted parsing utilities to better handle edge cases and ensure clarity.
* fmt
* Refactor function parsing and add support for new keywords. All tests including rfc passing.
Work still needed to remove redundant parsing logic from main crate.
Updated the function parsing logic to support one-arg and two-arg functions, and check function names within the pest grammar. Adjusted syntax rules and tests to reflect these changes.
* Add preliminary documentation for the `compiled-path` feature
* fmt1 parent a550f89 commit 2c99b9b
File tree
18 files changed
+2798
-8
lines changed- jsonpath-ast
- src
- jsonpath-rust-impl
- src
- tests
- rfc9535_compile_tests
- basic
- rfc9535
- test_suite
- src/parser/grammar
18 files changed
+2798
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| 27 | + | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
254 | 275 | | |
255 | 276 | | |
256 | 277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
0 commit comments