Store tree nodes in congruent, compact arena array. Define handle types to refer to tree nodes rather than pointers to structure instances. Free tree with context.
267 lines
7.1 KiB
Markdown
267 lines
7.1 KiB
Markdown
## v5.0.0
|
|
|
|
### API Changes
|
|
|
|
- Tree generation mode now stores all tree nodes in a compact arena owned by
|
|
the parser context (a flat node array plus a shared child-link array).
|
|
This replaces the previous design of one heap allocation per node with
|
|
layout-punned typed structs.
|
|
- Tree nodes are now referenced by lightweight handles rather than pointers.
|
|
`p_result()` and the field accessors return handle values.
|
|
- The whole tree is freed together with the context by `p_context_delete()`.
|
|
The `p_tree_delete()` / `p_tree_delete_XXX()` functions have been removed;
|
|
tree node handles are only valid while the context is alive.
|
|
- Tree node field access changed per target language:
|
|
- C: per-field accessor functions (e.g. `p_Start_pItems(node)`) plus tree
|
|
walk macros (e.g. `p_tree_walk_Start(node, pItems, pItem, pToken1, token)`),
|
|
and generic accessors `p_node_valid()`, `p_node_position()`,
|
|
`p_node_end_position()`, `p_node_n_fields()`, `p_node_data()`, `p_node_id()`.
|
|
- C++: handle methods called with `()` (e.g. `node.pItems().pToken1().token()`),
|
|
plus the same C-style functions/macros for convenience.
|
|
- D: `@property` accessors preserving the previous field-access syntax
|
|
(e.g. `node.pItems.pToken1.token`); null checks use `.valid` instead of
|
|
`is null`.
|
|
- Tree-mode parser rule user code: `$$` and `$1` etc. now yield node handles.
|
|
Reference child fields through the target-language accessors described above
|
|
rather than through struct pointer members.
|
|
|
|
## v4.8.1
|
|
|
|
### Fixes
|
|
|
|
- Fix tree node struct type forward-declarations for C/C++
|
|
|
|
## v4.8.0
|
|
|
|
### New Features
|
|
|
|
- Add `p_parse_inner_XXX()` APIs that accept a caller-provided set of follow
|
|
tokens. These behave the same as `p_parse_XXX()` by parsing starting at the
|
|
given start rule, but instead of expecting the rest of the input to match
|
|
the start rule they allow specifying a set of tokens that may follow the
|
|
start rule.
|
|
- Add `p_set_position()` API to set the current text position stored in the
|
|
context. Useful for setting the initial text position to something other
|
|
than `(1, 1)` for a nested parse operation.
|
|
- Add `p_input_index()` API to get the current input text byte offset.
|
|
- Add `p_set_input_index()` API to set the current input text byte offset.
|
|
Useful together with `p_set_position()` to rewind the input part-way through
|
|
a parse in order to re-read an earlier section of the input.
|
|
|
|
## v4.7.0
|
|
|
|
### New Features
|
|
|
|
- Support parser rule user code blocks in tree generation mode.
|
|
|
|
### Fixes
|
|
|
|
- propane.vim: do not highlight rule components as propane keywords
|
|
|
|
## v4.6.0
|
|
|
|
### New Features
|
|
|
|
- Add lexer user code API to access matched input text positions
|
|
- Track rule component text positions and add parser user code API to access
|
|
|
|
### Fixes
|
|
|
|
- Fixed a few user guide and source comments related to text input positions
|
|
|
|
## v4.5.0
|
|
|
|
### New Features
|
|
|
|
- Add `noline` grammar statement to skip emitting `#line` directives
|
|
- Attempt to autodetect target language (D/C++) in extra/vim/syntax/propane.vim
|
|
|
|
### Fixes
|
|
|
|
- Fix #line reset directives
|
|
- Update keyword list in extra/vim/syntax/propane.vim
|
|
- Fix propane.vim keyword detection
|
|
|
|
## v4.4.0
|
|
|
|
### New Features
|
|
|
|
- Add p_value_get() / p_value_get_XXX() accessors
|
|
|
|
## v4.3.0
|
|
|
|
### New Features
|
|
|
|
- Use #line for user code blocks to report input grammar position for errors.
|
|
|
|
## v4.2.0
|
|
|
|
### New Features
|
|
|
|
- Add support for a custom lex function.
|
|
|
|
## v4.1.0
|
|
|
|
### New Features
|
|
|
|
- Add `p_context_delete()` and `p_tree_delete()` for D targets.
|
|
|
|
## v4.0.0
|
|
|
|
### New Features
|
|
|
|
- Add `context_user_fields` statement to allow custom context user fields.
|
|
- Add `token_user_fields` statement to allow custom token user fields.
|
|
- Add `on_token_node` statement to allow custom code when constructing token nodes.
|
|
- Add `free_token_node` statement to allow custom code when freeing token nodes.
|
|
- Add `p_context_delete()`.
|
|
- Allow `drop` patterns to execute lexer user code blocks.
|
|
|
|
### Breaking Changes
|
|
|
|
- Replace `p_context_init()` with `p_context_new()` and `p_context_delete()`.
|
|
- Renamed `p_free_tree()` to `p_tree_delete()`.
|
|
- The `free_token_node` statement now takes a user code block instead of a
|
|
function name parameter.
|
|
|
|
## v3.0.0
|
|
|
|
### New Features
|
|
|
|
- Add support for multiple starting rules (#38)
|
|
- Add `p_free_tree()` functions to reclaim generated tree memory
|
|
- Add `free_token_node` grammar statement to reclaim user-allocated memory stored in a Token tree node `pvalue` field
|
|
- Add valgrind memory leak tests to unit tests
|
|
- Fix build issues for C++ to officially support C++ target output
|
|
|
|
### Improvements
|
|
|
|
- Document `p_lex()` and `p_token_info_t` in user guide (#37)
|
|
|
|
### Breaking Changes
|
|
|
|
- Rename AST generation mode to tree generation mode (see [UPGRADING.md](UPGRADING.md))
|
|
|
|
## v2.3.0
|
|
|
|
### New Features
|
|
|
|
- Add \D, \S, \w, \W special character classes
|
|
|
|
### Improvements
|
|
|
|
- Include line numbers for pattern errors
|
|
- Improve performance in a few places
|
|
- Parallelize parser table generation on Linux hosts
|
|
- Add github workflow to run unit tests
|
|
|
|
### Fixes
|
|
|
|
- Fix a couple clang warnings for C backend
|
|
- Fix C backend not fully initializing pvalues when multiple ptypes are used with different sizes.
|
|
- Fix some user guide examples
|
|
|
|
## v2.2.1
|
|
|
|
### Fixes
|
|
|
|
- Fix GC issue for D backend when AST is enabled (#36)
|
|
|
|
## v2.2.0
|
|
|
|
### Improvements
|
|
|
|
- Allow multiple lexer modes to be specified for a lexer pattern (#35)
|
|
- Document p_decode_code_point() API function (#34)
|
|
|
|
## v2.1.1
|
|
|
|
### Fixes
|
|
|
|
- Field aliases for AST node fields could alias incorrect field when multiple rule alternatives present for one rule set (#33)
|
|
|
|
## v2.1.0
|
|
|
|
### Improvements
|
|
|
|
- Report rule name and line number for conflicting AST node field positions errors (#32)
|
|
|
|
## v2.0.0
|
|
|
|
### Improvements
|
|
|
|
- Log conflicting rules on reduce/reduce conflict (#31)
|
|
- Use 1-based row and column values for position values (#30)
|
|
|
|
### Fixes
|
|
|
|
- Fix named optional rules (#29)
|
|
|
|
### Upgrading
|
|
|
|
- Adjust all uses of p_position_t row and col values to expect 1-based instead
|
|
of 0-based values.
|
|
|
|
## v1.5.1
|
|
|
|
### Improvements
|
|
|
|
- Improve performance (#28)
|
|
|
|
## v1.5.0
|
|
|
|
### New Features
|
|
|
|
- Track start and end text positions for tokens and rules in AST node structures (#27)
|
|
- Add warnings for shift/reduce conflicts to log file (#25)
|
|
- Add -w command line switch to treat warnings as errors and output to stderr (#26)
|
|
- Add rule field aliases (#24)
|
|
|
|
### Improvements
|
|
|
|
- Show line numbers of rules on conflict (#23)
|
|
|
|
## v1.4.0
|
|
|
|
### New Features
|
|
|
|
- Allow user to specify AST node name prefix or suffix
|
|
- Allow specifying the start rule name
|
|
- Allow rule terms to be marked as optional
|
|
|
|
### Improvements
|
|
|
|
- Give a better error message when a referenced ptype has not been declared
|
|
|
|
## v1.3.0
|
|
|
|
### New Features
|
|
|
|
- Add AST generation (#22)
|
|
|
|
## v1.2.0
|
|
|
|
### New Features
|
|
|
|
- Allow one line user code blocks (#21)
|
|
- Add backslash escape codes (#19)
|
|
- Add API to access unexpected token found (#18)
|
|
- Add token_names API (#17)
|
|
- Add D example to user guide for p_context_init() (#16)
|
|
- Allow user termination from lexer code blocks (#15)
|
|
|
|
### Fixes
|
|
|
|
- Fix generator hang when state transition cycle is present (#20)
|
|
|
|
## v1.1.0
|
|
|
|
### New Features
|
|
|
|
- Add user parser terminations (#13)
|
|
- Document generated parser API in user guide (#14)
|
|
|
|
## v1.0.0
|
|
|
|
- Initial release
|