Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/topic/bbannier/zeek-catchup'
Browse files Browse the repository at this point in the history
  • Loading branch information
bbannier committed Nov 25, 2024
2 parents 7a59594 + a2d079d commit 26e598e
Show file tree
Hide file tree
Showing 7 changed files with 90,798 additions and 88,057 deletions.
21 changes: 14 additions & 7 deletions grammar.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/// <reference types="tree-sitter-cli/dsl" />
// @ts-check

// Aliases that make things easier to read
prec_r = prec.right;
prec_l = prec.left;
Expand Down Expand Up @@ -86,12 +89,10 @@ module.exports = grammar({
seq(
"redef",
"record",
$.id,
"+=",
"{",
repeat($.type_spec),
"}",
optional($.attr_list),
choice(
seq($.id, "+=", "{", repeat($.type_spec), "}", optional($.attr_list)),
seq($.expr, "-=", "{", $.attr_list, "}"),
),
";",
),
type_decl: ($) =>
Expand Down Expand Up @@ -421,14 +422,18 @@ module.exports = grammar({
seq("@ifndef", "(", $.id, ")"),
"@endif",
"@else",
$.pragma,
),

pragma: () =>
seq(token("@pragma"), choice("push", "pop"), /[A-Za-z0-9][A-Za-z0-9\-]*/),

// These directives return strings.
string_directive: ($) => choice("@DIR", "@FILENAME"),

event_hdr: ($) => seq($.id, "(", optional($.expr_list), ")"),

id: () => /(([A-Za-z_][A-Za-z_0-9]*)?::)?[A-Za-z_][A-Za-z_0-9]*/,
id: () => /(::)?([A-Za-z_][A-Za-z_0-9]*)(::[A-Za-z_][A-Za-z_0-9]*)*/,
file: ($) => /[^ \t\r\n]+/,
pattern: ($) => /\/((\\\/)?[^\r\n\/]?)*\/i?/,

Expand Down Expand Up @@ -480,6 +485,8 @@ module.exports = grammar({
nl: ($) => /\r?\n/,
},

conflicts: ($) => [[$.expr, $.redef_record_decl]],

extras: ($) => [
/[ \t]+/,
$.nl,
Expand Down
129 changes: 101 additions & 28 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 26e598e

Please sign in to comment.