fork of https://github.com/tree-sitter/tree-sitter-graph
Changelog#
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
v0.11.3 -- 2024-05-29#
Library#
Fixed#
- Excerpts shown as part of errors now use formatting that works both in light and dark mode.
v0.11.2 -- 2024-03-08#
DSL#
Added#
- Support adding an edge multiple times, or setting an attribute multiple times with the same value. Previously these would raise runtime errors.
v0.11.1 -- 2024-03-06#
Updated the tree-sitter dependency to include the required minimal patch version.
v0.11.0 -- 2023-07-17#
Library#
Added#
- Store a debug attribute for the matched syntax node, providing information about the syntactic category of the match that gave rise to the graph node.
v0.10.5 -- 2023-06-26#
Fixed#
- A panic that sometimes occurred in lazy execution mode.
v0.10.4 -- 2023-06-02#
Library#
Added#
- Several errors include more context in the error message: Duplicate errors report both statements using source snippets. Edge statements report which argument (the source or the sink) triggered an evluation error.
Fixed#
- Ensure that edge attribute statements are executed after edges are created, to prevent non-deterministic ordering bugs in lazy execution mode.
v0.10.3 -- 2023-06-01#
DSL#
Added#
- Scoped variables can be inherited by child nodes by specifying
inherit .var_nameas part of the source. Using@node.var_namewill either use the value set on the node itself, or otherwise the one set on the closest enclosing node.
v0.10.2 -- 2023-05-25#
Library#
Added#
- Edge debug information now contains the TSG location of the
edgestatement ifExecutionConfig::location_attris set.
Changed#
- The TSG location in the debug information is formatted more explicitly as
line XX column YYinstead of(XX, YY).
v0.10.1 -- 2023-05-15#
Library#
Added#
- The
ast::File::try_visit_matchesmethod can be used to execute the stanza query matching without executing the stanza bodies.
v0.10.0 -- 2023-05-10#
DSL#
Changed#
- Unused captures in patterns are now considered errors, unless they start with an underscore.
Library#
Fixed#
- Some execution errors were not always reported in lazy execution mode, depending on whether variables were used or not. This has been fixed to behave more consistently, so that errors are always reported regardless of variable use.
CLI#
Added#
- Errors from setting a scoped variable twice on the same node are now reported with source snippets for both statements involved.
v0.9.2 -- 2023-04-14#
Library#
Added#
- The
parse_error::Excerpttype, which is used to show source excerpts, is now public.
v0.9.1 -- 2023-04-03#
CLI#
Added#
- Errors from parsing and checking the TSG file are now displayed with source excerpts.
v0.9.0 -- 2023-03-31#
Library#
Changed#
- The method
ParseError::display(source: &str, verbose: bool)has been replaced by two methodsParseError::display(path: &path, source: &str)andParseError::display_pretty(path: &Path, source: &str).
CLI#
Changed#
- Parse errors are now displayed with the same excerpt style as execution errors.
0.8.0 -- 2023-03-29#
Library#
Fixed#
- Fix error formatting panic with strict execution.
Changed#
- The traits stored in
Functionsmust now implementSendandSyncto ensure they can be shared more easily in concurrent situations.
0.7.0 -- 2022-10-18#
DSL#
Added#
- Global variables can be given default string values using
global NAME = "STRING"syntax. - Function
eqto compare two values for equality. - Function
formatto format strings. - Function
concatto concatenate lists. - Function
jointo join a list of values using an optional separator.
Removed#
- References to undefined variables now result in errors, instead of assuming its an undeclared global variable.
Library#
Fixed#
- Query errors now report the correct column for errors on the first row of a query.
Added#
- The
Variablestype has additional methodsis_emptyanditer.
Changed#
- References to
ExecutionConfigpassed toFile::execute*are not required to be mutable anymore.
0.6.1 -- 2022-09-06#
Library#
Fixed#
- Cancellation errors during execution are now propagated all the way up, instead of being wrapped in other errors.
Added#
- The
ExecutionErrortype now supports formatting errors with excerpts from the program and TSG source by using the.display_prettymethod.
Changed#
Variables::nesteddoes now accept a non-mutable reference.
CLI#
Added#
- Execution errors now include excerpts from the program and TSG source when printed.
0.6.0 -- 20220-08-23#
Library#
Added#
- Cancellation of
ast::Fileexecution is now supported by passing an implementation of theCancellationFlagtrait. TheNoCancellationtype provides a noop implementation.
Fixed#
- Fixed bug in
Identifiersoast::Fileinstances can be safely shared between threads.
Changed#
- Functions are not passed as mutable anymore, so that they can safely used concurrently and reused between executions.
ast::File::executerequires an extraCancellationFlagparameter. Use&NoCancellationif no cancellation is required.
CLI#
Added#
- Global variables can be provided by passing
--global VAR=VALflags. Only string values are supported.
0.5.1 -- 2022-05-11#
DSL#
- Reference the new VS Code extension in the README.
0.5.0 -- 2022-05-09#
DSL#
Fixed#
- Report query errors with correct source locations.
Library#
Changed#
- In JSON output, all values are represented as objects with a
typefield indicating the value type, and additional value fields that vary per type.
CLI#
Added#
- Flag
--output/-oto set JSON output path.
0.4.0 -- 2022-03-21#
DSL#
Added#
- Global variable declarations.
- Attribute shorthands.
- List and set comprehensions.
Deprecated#
- Use of undeclared global variables.
Library#
Added#
- Module
parse_errorfor finding and displayingtree-sitterparse errors. - Option in
ExecutionConfigto automatically add debug graph node attributes that describe the source location and variable name of the originatingnodestatement in the DSL source.
Changed#
- Calls to
executewill fail with a runtime error if declared global variables are missing in the global environment. - Calls to
executewill not fail early on parse trees with errors. Errors may occur during query execution if matched parts of the tree are missing. - The seperate arguments to
executeare replaced by a singleExecutionConfigargument, which makes it easier to add optional arguments without breaking all use sites.
Removed#
- The
execute_lazymethod has been removed. Lazy evalaution is enabled by setting thelazyflag in theExecutionConfig.
CLI#
Added#
- Flag
--allow-parse-errorsthat allows running against input files with parse errors.
Changed#
- Improved formatting of parse error messages.
0.3.0 - 2022-02-08#
DSL#
Added#
- Loop statement to iterate over list values.
- Conditional statement to check optional and boolean values.
- Boolean functions
and,or, andnot. - Lazy evaluation strategy that does not rely on textual stanza order.
Changed#
- Variables are now scoped in blocks, and will not escape or overwrite variables defined in enclosing blocks.
- Fix nested function calls, which would lose their arguments.
- Fix nested
scanstatements, which would lose outer captures after the inner statement. - Construct capture values based in query quantifiers, e.g., create a list for
@cap*or an optional value for@cap?. - Rename
child-indexto the more accuratenamed-child-index
Removed#
- The
scanstatement cannot be applied to values that are not local to the stanza, i.e., values that depend on scoped variables.
Library#
Added#
- Method
File::execute_lazyto use lazy evaluation strategy. - Methods
File::execute_intoandFile::execute_lazy_intoto use an existing graph instance, instead of creating a new one. - Various
Value::into_*andValue::as_*methods.
Changed#
- The method
Graph::display_withis renamed toGraph::pretty_print.
Deprecated#
- The method
File::parseis deprecated because it it not sound anymore, and should be replaced by theFile::from_strmethod. - The method
Value::into_syntax_nodeis deprecated, and should be replaced by explicit graph indexing.
Removed#
- The
Contextobject for string interning is removed, along with thectxparameters of methods.
CLI#
Added#
- JSON output mode for the resulting graph, controlled by the
--jsonflag. - A
--lazyflag to use the lazy evaluation strategy. - A
--quietflag to suppress graph output.