Skip to content

Commit

Permalink
Parse extern imports
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickpeterse committed Apr 24, 2024
1 parent 8917c7b commit e6ff25e
Show file tree
Hide file tree
Showing 7 changed files with 3,645 additions and 3,342 deletions.
3 changes: 3 additions & 0 deletions bindings/rust/build.rs

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

8 changes: 8 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = grammar({
rules: {
source_file: $ => repeat($._top_level),
_top_level: $ => choice(
$.extern_import,
$.import,
$.external_function,
$.module_method,
Expand All @@ -52,6 +53,13 @@ module.exports = grammar({
import_as($.constant, $.constant),
),
tags: $ => seq('if', list($.identifier, 'and', false)),
extern_import: $ => seq(
'import',
'extern',
field('path', alias($.extern_import_path, $.path)),
field('tags', optional($.tags)),
),
extern_import_path: $ => seq('"', /[^"]*/, '"'),

// Methods
external_function: $ => seq(
Expand Down
63 changes: 63 additions & 0 deletions src/grammar.json

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

36 changes: 35 additions & 1 deletion 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 e6ff25e

Please sign in to comment.