Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add README #3

Closed
wants to merge 18 commits into from
Closed

Add README #3

wants to merge 18 commits into from

Conversation

bbannier
Copy link

@bbannier bbannier commented Aug 5, 2024

This is a workaround for zeek/tree-sitter-zeek#15.

ckreibich and others added 18 commits February 1, 2022 20:27
The grammar previously treated func, event and hook differently than
other decls. While all other decls where self-contained, these types
leaked an extra header type into the parse tree, and also never had an
id accessible under the decl.

We now introduce dedicated decls for each of these types.
This node introduces no new data and serves more as a tool for parser
writers. Consumers of the parser on the other hand need to always unwrap
it at each use.

This patch hides the node from consumers.
The grammar previously treated scope-local `local` and `const`
declarations differently than `global` or module-level `const`
declarations. This introduced correct constrains on where these
constructs could appear, but also lead to ambiguities which needed to be
worked around by using different matchers for global and local
declarations; these differences made especially local declarations hard
to work with.

This patch completely removes the notion of global decls; instead we now
allow declarations everywhere. This makes matching source-level
declarations anywhere straightforward, but now also allows to parse
invalid inputs (e.g., inputs containing type declarations at function
scope). Such inputs should if needed be instead rejected by a dedicated
validator pass since the grammar allows them.
In order for users to match nodes of the form

    r$field
    r?$field

they should be named.

This patch introduces them as nodes named `field_access` and
`field_check`.
This works around the issue reported in zeek/zeekscript#69.
(cherry picked from commit e694eba)
Their pattern accidentally allowed newline characters to slip in if they
followed right after the "#", i.e., empty comments could accidentally be parsed
by swallowing the subsequent line.

(cherry picked from commit b492614)
This adds support for "{ ... }-style table/set initializers in assignment
expressions (as opposed to declarations, where they already existed), as well as
the recently introduced trailing commas.

This removes the `init` token since it's now fully covered by expressions.

(cherry picked from commit e5ca3ff)
@bbannier bbannier closed this Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants