llguidance 0.7.27__tar.gz → 0.7.29__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {llguidance-0.7.27 → llguidance-0.7.29}/CHANGELOG.md +8 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/Cargo.lock +6 -6
- {llguidance-0.7.27 → llguidance-0.7.29}/PKG-INFO +1 -1
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/Cargo.toml +1 -1
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/earley/parser.rs +42 -22
- {llguidance-0.7.27 → llguidance-0.7.29}/pyproject.toml +1 -1
- {llguidance-0.7.27 → llguidance-0.7.29}/python_ext/Cargo.toml +1 -1
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/tests/test_raw_parser.rs +16 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie/Cargo.toml +1 -1
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie_hf_downloader/Cargo.toml +1 -1
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie_hf_tokenizers/Cargo.toml +1 -1
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie_tiktoken/Cargo.toml +1 -1
- {llguidance-0.7.27 → llguidance-0.7.29}/.github/workflows/rust.yml +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/.github/workflows/wheels.yml +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/.gitignore +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/CODE_OF_CONDUCT.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/Cargo.toml +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/LICENSE +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/README.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/SECURITY.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/SUPPORT.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/c_sample/Makefile +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/c_sample/README.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/c_sample/c_sample.cpp +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/docs/fast_forward.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/docs/json_schema.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/docs/mask_plot.png +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/docs/optimizations.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/docs/special_tokens.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/docs/syntax.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/docs/toktrie.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/json_stats/Cargo.toml +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/json_stats/expected_maskbench.json +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/json_stats/jstats.sh +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/json_stats/scripts/split-stats.sh +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/json_stats/scripts/split_plot.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/json_stats/src/json_stats.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/json_stats/src/lib.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/json_stats/src/stats.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/LICENSE +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/README.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/build.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/cbindgen.toml +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/grammars/character.json +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/grammars/json.json +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/llguidance.h +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/api.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/constraint.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/earley/from_guidance.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/earley/grammar.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/earley/lexer.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/earley/lexerspec.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/earley/mod.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/earley/perf.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/earley/regexvec.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/earley/slicer.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/factory.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/ffi.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/ffi_par.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/grammar_builder.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/json/README.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/json/compiler.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/json/context_ref.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/json/context_simple/context.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/json/context_simple/draft.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/json/context_simple/mod.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/json/formats.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/json/mod.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/json/numeric.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/json/schema.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/json/shared_context.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/json_validation.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/lark/README.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/lark/ast.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/lark/common.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/lark/compiler.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/lark/lexer.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/lark/mod.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/lark/parser.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/lib.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/logging.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/matcher.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/output.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/panic_utils.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/regex_rewrite.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/stop_controller.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/substring.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/tokenizer_json.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/parser/src/tokenparser.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/plan.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/llguidance/__init__.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/llguidance/_grammar_from.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/llguidance/_lib.pyi +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/llguidance/_struct_tag.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/llguidance/_tokenizer.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/llguidance/_util.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/llguidance/cli.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/llguidance/gbnf_to_lark.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/llguidance/hf.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/llguidance/llamacpp.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/llguidance/mlx.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/llguidance/numpy.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/llguidance/py.typed +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/llguidance/tiktoken.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/llguidance/torch.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/mypy.ini +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/torch_tests/__init__.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/torch_tests/test_bitmask.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/torch_tests/test_hf.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/torch_tests/test_llamacpp.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/torch_tests/test_matcher.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python/torch_tests/test_tiktoken.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python_ext/src/lib.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python_ext/src/llamatokenizer.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python_ext/src/llinterpreter.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python_ext/src/llmatcher.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python_ext/src/parserlimits.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python_ext/src/py.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/python_ext/src/pyjson.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/Cargo.toml +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/README.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/cli.sh +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/blog.sample.json +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/blog.schema.json +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/blog.schema.ll.json +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/from-llama.cpp/README.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/from-llama.cpp/arithmetic.gbnf +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/from-llama.cpp/c.gbnf +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/from-llama.cpp/chess.gbnf +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/from-llama.cpp/english.gbnf +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/from-llama.cpp/japanese.gbnf +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/from-llama.cpp/json.gbnf +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/from-llama.cpp/json_arr.gbnf +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/from-llama.cpp/list.gbnf +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/from-llama.cpp/vllm-sql.gbnf +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/lark.lark +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/rfc.lark +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/rfc.xml +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/data/ulysses.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/gtest.sh +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/lark.sh +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/run.sh +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/src/lib.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/src/minimal.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/src/sample_parser.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/tests/test_lark.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/tests/test_ll.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/sample_parser/tests/test_stop.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/annotate_asm.js +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/bump.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/cbindgen.sh +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/checklinks.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/checklinks.sh +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/ci-publish.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/disasm.sh +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/gbnf_to_lark.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/gen-testcase.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/git-version.sh +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/install-deps.sh +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/jsonschema-stats.js +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/remote-guidance-test.sh +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/rust-size.js +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/rust_size.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/test-guidance.sh +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/tokenizer_test.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/scripts/update-git.py +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie/LICENSE +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie/README.md +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie/src/bytes.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie/src/lib.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie/src/recognizer.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie/src/rng.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie/src/svob.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie/src/tokenv.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie/src/toktree.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie/tests/test_svob.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie_hf_downloader/LICENSE +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie_hf_downloader/src/lib.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie_hf_tokenizers/LICENSE +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie_hf_tokenizers/src/lib.rs +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie_tiktoken/LICENSE +0 -0
- {llguidance-0.7.27 → llguidance-0.7.29}/toktrie_tiktoken/src/lib.rs +0 -0
|
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
If a release doesn't introduce any interesting changes (build fixes etc.), it's skipped.
|
|
6
6
|
|
|
7
|
+
#### [0.7.29](https://github.com/guidance-ai/llguidance/compare/v0.7.28...0.7.29) 2025-06-06
|
|
8
|
+
|
|
9
|
+
- cargo fmt
|
|
10
|
+
|
|
11
|
+
#### [0.7.28](https://github.com/guidance-ai/llguidance/compare/v0.7.27...0.7.28) 2025-06-06
|
|
12
|
+
|
|
13
|
+
- fix lexer_stack=... panic with numeric tokens [`4e91b0f`](https://github.com/guidance-ai/llguidance/commit/4e91b0fa0c03572a5fc221ac0e0b05035af9dcfa)
|
|
14
|
+
|
|
7
15
|
#### [0.7.27](https://github.com/guidance-ai/llguidance/compare/v0.7.26...0.7.27) 2025-06-04
|
|
8
16
|
|
|
9
17
|
- add toktrie_tiktoken and llguidance.tiktoken.lltokenizer_from_encoding [`#154`](https://github.com/guidance-ai/llguidance/issues/154)
|
|
@@ -1211,7 +1211,7 @@ checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856"
|
|
|
1211
1211
|
|
|
1212
1212
|
[[package]]
|
|
1213
1213
|
name = "llguidance"
|
|
1214
|
-
version = "0.7.
|
|
1214
|
+
version = "0.7.29"
|
|
1215
1215
|
dependencies = [
|
|
1216
1216
|
"anyhow",
|
|
1217
1217
|
"derivre",
|
|
@@ -1230,7 +1230,7 @@ dependencies = [
|
|
|
1230
1230
|
|
|
1231
1231
|
[[package]]
|
|
1232
1232
|
name = "llguidance_py"
|
|
1233
|
-
version = "0.7.
|
|
1233
|
+
version = "0.7.29"
|
|
1234
1234
|
dependencies = [
|
|
1235
1235
|
"anyhow",
|
|
1236
1236
|
"bytemuck",
|
|
@@ -2395,7 +2395,7 @@ dependencies = [
|
|
|
2395
2395
|
|
|
2396
2396
|
[[package]]
|
|
2397
2397
|
name = "toktrie"
|
|
2398
|
-
version = "0.7.
|
|
2398
|
+
version = "0.7.29"
|
|
2399
2399
|
dependencies = [
|
|
2400
2400
|
"anyhow",
|
|
2401
2401
|
"bytemuck",
|
|
@@ -2406,7 +2406,7 @@ dependencies = [
|
|
|
2406
2406
|
|
|
2407
2407
|
[[package]]
|
|
2408
2408
|
name = "toktrie_hf_downloader"
|
|
2409
|
-
version = "0.7.
|
|
2409
|
+
version = "0.7.29"
|
|
2410
2410
|
dependencies = [
|
|
2411
2411
|
"anyhow",
|
|
2412
2412
|
"hf-hub",
|
|
@@ -2417,7 +2417,7 @@ dependencies = [
|
|
|
2417
2417
|
|
|
2418
2418
|
[[package]]
|
|
2419
2419
|
name = "toktrie_hf_tokenizers"
|
|
2420
|
-
version = "0.7.
|
|
2420
|
+
version = "0.7.29"
|
|
2421
2421
|
dependencies = [
|
|
2422
2422
|
"anyhow",
|
|
2423
2423
|
"log",
|
|
@@ -2429,7 +2429,7 @@ dependencies = [
|
|
|
2429
2429
|
|
|
2430
2430
|
[[package]]
|
|
2431
2431
|
name = "toktrie_tiktoken"
|
|
2432
|
-
version = "0.7.
|
|
2432
|
+
version = "0.7.29"
|
|
2433
2433
|
dependencies = [
|
|
2434
2434
|
"anyhow",
|
|
2435
2435
|
"log",
|
|
@@ -435,6 +435,7 @@ struct ParserState {
|
|
|
435
435
|
// history - items are not popped in definitive mode.
|
|
436
436
|
lexer_stack: Vec<LexerState>,
|
|
437
437
|
lexer_stack_top_eos: bool,
|
|
438
|
+
lexer_stack_flush_position: usize,
|
|
438
439
|
rows: Vec<Row>,
|
|
439
440
|
rows_valid_end: usize,
|
|
440
441
|
|
|
@@ -665,6 +666,7 @@ impl ParserState {
|
|
|
665
666
|
limits,
|
|
666
667
|
backtrack_byte_count: 0,
|
|
667
668
|
lexer_stack_top_eos: false,
|
|
669
|
+
lexer_stack_flush_position: 0,
|
|
668
670
|
lexer_stack: vec![LexerState {
|
|
669
671
|
row_idx: 0,
|
|
670
672
|
lexer_state,
|
|
@@ -793,12 +795,6 @@ impl ParserState {
|
|
|
793
795
|
});
|
|
794
796
|
}
|
|
795
797
|
|
|
796
|
-
if set.is_zero() {
|
|
797
|
-
// nothing allowed
|
|
798
|
-
// we're going to be stopped outside - we better flush the lexer
|
|
799
|
-
let _ = self.flush_lexer();
|
|
800
|
-
}
|
|
801
|
-
|
|
802
798
|
let eos = computer.trie().eos_token();
|
|
803
799
|
if eos != INVALID_TOKEN && start.is_empty() && self.lexer_allows_eos() {
|
|
804
800
|
set.allow_token(eos);
|
|
@@ -935,7 +931,7 @@ impl ParserState {
|
|
|
935
931
|
self.stats = ParserStats::default();
|
|
936
932
|
}
|
|
937
933
|
|
|
938
|
-
fn
|
|
934
|
+
fn assert_definitive_inner(&self) {
|
|
939
935
|
assert!(self.scratch.definitive);
|
|
940
936
|
assert!(self.backtrack_byte_count == 0);
|
|
941
937
|
if self.num_rows() != self.row_infos.len() {
|
|
@@ -947,6 +943,14 @@ impl ParserState {
|
|
|
947
943
|
}
|
|
948
944
|
}
|
|
949
945
|
|
|
946
|
+
fn assert_definitive(&self) {
|
|
947
|
+
self.assert_definitive_inner();
|
|
948
|
+
|
|
949
|
+
if self.lexer_spec().can_rollback() {
|
|
950
|
+
self.check_lexer_bytes_invariant();
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
|
|
950
954
|
pub fn get_bytes(&self) -> &[u8] {
|
|
951
955
|
&self.bytes
|
|
952
956
|
}
|
|
@@ -995,7 +999,6 @@ impl ParserState {
|
|
|
995
999
|
n_bytes,
|
|
996
1000
|
self.byte_to_token_idx.len()
|
|
997
1001
|
);
|
|
998
|
-
self.check_lexer_bytes_invariant();
|
|
999
1002
|
|
|
1000
1003
|
let new_len = self.byte_to_token_idx.len() - n_bytes;
|
|
1001
1004
|
|
|
@@ -1010,7 +1013,6 @@ impl ParserState {
|
|
|
1010
1013
|
self.rows_valid_end = self.num_rows();
|
|
1011
1014
|
|
|
1012
1015
|
self.assert_definitive();
|
|
1013
|
-
self.check_lexer_bytes_invariant();
|
|
1014
1016
|
|
|
1015
1017
|
Ok(())
|
|
1016
1018
|
}
|
|
@@ -1097,6 +1099,12 @@ impl ParserState {
|
|
|
1097
1099
|
.push(self.token_idx.try_into().unwrap());
|
|
1098
1100
|
}
|
|
1099
1101
|
}
|
|
1102
|
+
debug_def!(
|
|
1103
|
+
self,
|
|
1104
|
+
"add_numeric_token: idx={:?} bytes={:?}",
|
|
1105
|
+
idx,
|
|
1106
|
+
tok_bytes
|
|
1107
|
+
);
|
|
1100
1108
|
let ok = self.advance_parser(PreLexeme::just_idx(MatchingLexemesIdx::Single(idx)));
|
|
1101
1109
|
ensure!(
|
|
1102
1110
|
ok,
|
|
@@ -1156,9 +1164,20 @@ impl ParserState {
|
|
|
1156
1164
|
let row_idx = self.num_rows() - 1;
|
|
1157
1165
|
self.row_infos[row_idx].apply_token_idx(self.token_idx);
|
|
1158
1166
|
|
|
1167
|
+
self.lexer_stack_flush_position = 0;
|
|
1159
1168
|
let idx = self.flush_and_check_numeric(tok_id).unwrap();
|
|
1160
1169
|
self.add_numeric_token(idx, tok_bytes)?;
|
|
1161
1170
|
|
|
1171
|
+
// if flush_lexer() added a stack entry
|
|
1172
|
+
if self.lexer_stack_flush_position > 0 {
|
|
1173
|
+
// we make sure it's not on the top
|
|
1174
|
+
assert!(self.lexer_stack_flush_position + 1 < self.lexer_stack.len());
|
|
1175
|
+
// and remove it
|
|
1176
|
+
self.lexer_stack.remove(self.lexer_stack_flush_position);
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
self.assert_definitive();
|
|
1180
|
+
|
|
1162
1181
|
return Ok(0);
|
|
1163
1182
|
}
|
|
1164
1183
|
}
|
|
@@ -1314,6 +1333,8 @@ impl ParserState {
|
|
|
1314
1333
|
self.print_row(self.num_rows() - 1);
|
|
1315
1334
|
}
|
|
1316
1335
|
|
|
1336
|
+
self.assert_definitive();
|
|
1337
|
+
|
|
1317
1338
|
Ok(0)
|
|
1318
1339
|
}
|
|
1319
1340
|
|
|
@@ -1474,10 +1495,6 @@ impl ParserState {
|
|
|
1474
1495
|
// debug!("trie_started: rows={} lexer={}", self.num_rows(), self.lexer_stack.len());
|
|
1475
1496
|
self.assert_definitive();
|
|
1476
1497
|
|
|
1477
|
-
if self.lexer_spec().can_rollback() {
|
|
1478
|
-
self.check_lexer_bytes_invariant();
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
1498
|
self.trie_lexer_stack = self.lexer_stack.len();
|
|
1482
1499
|
self.trie_grammar_stack = self.scratch.grammar_stack.len();
|
|
1483
1500
|
self.scratch.definitive = false;
|
|
@@ -1514,6 +1531,7 @@ impl ParserState {
|
|
|
1514
1531
|
self.assert_definitive();
|
|
1515
1532
|
self.rows_valid_end = self.num_rows();
|
|
1516
1533
|
self.scratch.log_override = false; // reset
|
|
1534
|
+
self.lexer_stack_flush_position = 0;
|
|
1517
1535
|
}
|
|
1518
1536
|
|
|
1519
1537
|
fn run_speculative<T>(&mut self, lbl: &str, f: impl FnOnce(&mut Self) -> T) -> T {
|
|
@@ -1672,16 +1690,19 @@ impl ParserState {
|
|
|
1672
1690
|
}
|
|
1673
1691
|
let curr = self.lexer_state();
|
|
1674
1692
|
let lex_result = self.lexer_mut().try_lexeme_end(curr.lexer_state);
|
|
1693
|
+
let prev_len = self.lexer_stack.len();
|
|
1675
1694
|
let r = self.advance_lexer_or_parser(lex_result, curr);
|
|
1695
|
+
if self.lexer_stack.len() != prev_len {
|
|
1696
|
+
assert!(self.lexer_stack.len() == prev_len + 1);
|
|
1697
|
+
assert!(prev_len > 0);
|
|
1698
|
+
self.lexer_stack_flush_position = prev_len;
|
|
1699
|
+
}
|
|
1676
1700
|
assert!(self.backtrack_byte_count == 0);
|
|
1677
1701
|
r
|
|
1678
1702
|
}
|
|
1679
1703
|
|
|
1680
1704
|
pub fn scan_eos(&mut self) -> bool {
|
|
1681
1705
|
self.assert_definitive(); // ???
|
|
1682
|
-
if self.lexer_spec().can_rollback() {
|
|
1683
|
-
self.check_lexer_bytes_invariant();
|
|
1684
|
-
}
|
|
1685
1706
|
|
|
1686
1707
|
let lexer_eos = self.lexer_allows_eos();
|
|
1687
1708
|
|
|
@@ -1710,9 +1731,7 @@ impl ParserState {
|
|
|
1710
1731
|
self.lexer_stack_top_eos = true;
|
|
1711
1732
|
}
|
|
1712
1733
|
|
|
1713
|
-
|
|
1714
|
-
self.check_lexer_bytes_invariant();
|
|
1715
|
-
}
|
|
1734
|
+
self.assert_definitive(); // ???
|
|
1716
1735
|
|
|
1717
1736
|
false
|
|
1718
1737
|
}
|
|
@@ -2361,7 +2380,7 @@ impl ParserState {
|
|
|
2361
2380
|
});
|
|
2362
2381
|
}
|
|
2363
2382
|
if self.scratch.definitive {
|
|
2364
|
-
self.
|
|
2383
|
+
self.assert_definitive_inner();
|
|
2365
2384
|
}
|
|
2366
2385
|
} else {
|
|
2367
2386
|
if trace_here {
|
|
@@ -2374,7 +2393,7 @@ impl ParserState {
|
|
|
2374
2393
|
byte: None,
|
|
2375
2394
|
..no_hidden
|
|
2376
2395
|
});
|
|
2377
|
-
self.
|
|
2396
|
+
self.assert_definitive_inner();
|
|
2378
2397
|
self.backtrack_byte_count = hidden_bytes.len();
|
|
2379
2398
|
} else {
|
|
2380
2399
|
// prevent any further matches in this branch
|
|
@@ -2499,10 +2518,11 @@ impl ParserState {
|
|
|
2499
2518
|
}
|
|
2500
2519
|
}
|
|
2501
2520
|
}
|
|
2521
|
+
debug_def!(self, " push normal: {no_hidden:?}");
|
|
2502
2522
|
self.lexer_stack.push(no_hidden);
|
|
2503
2523
|
}
|
|
2504
2524
|
if self.scratch.definitive {
|
|
2505
|
-
self.
|
|
2525
|
+
self.assert_definitive_inner();
|
|
2506
2526
|
}
|
|
2507
2527
|
true
|
|
2508
2528
|
} else {
|
|
@@ -268,3 +268,19 @@ fn test_trigger_lexer_error() {
|
|
|
268
268
|
unreachable!();
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
+
|
|
272
|
+
#[test]
|
|
273
|
+
fn test_lexer_inv_crash() {
|
|
274
|
+
let tokenv = get_tok_env();
|
|
275
|
+
let t1 = tokenv.tokenize("#");
|
|
276
|
+
let t2 = tokenv.tokenize("?");
|
|
277
|
+
let tokens = tokenv.tokenize("a#");
|
|
278
|
+
assert!(t1.len() == 1);
|
|
279
|
+
assert!(t2.len() == 1);
|
|
280
|
+
let grm = format!("start: /[a-z]+/ ( <[{}]> | <[{}]> )", t1[0], t2[0]);
|
|
281
|
+
let parser = make_parser(&grm);
|
|
282
|
+
let mut matcher = Matcher::new(Ok(parser));
|
|
283
|
+
for t in tokens {
|
|
284
|
+
matcher.consume_token(t).unwrap();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|