Skip to content

Commit 72a14b7

Browse files
committed
fix: shebang lexical precedence
1 parent 2f1bf09 commit 72a14b7

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

bindings/rust/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// -*- coding: utf-8 -*-
21
// ------------------------------------------------------------------------------------------------
32
// Copyright © 2021, tree-sitter-rust authors.
43
// See the LICENSE file in this repo for license details.
@@ -49,6 +48,9 @@ pub const GRAMMAR: &str = include_str!("../../grammar.js");
4948
/// The syntax highlighting query for this language.
5049
pub const HIGHLIGHT_QUERY: &str = include_str!("../../queries/highlights.scm");
5150

51+
/// The injections query for this language.
52+
pub const INJECTIONS_QUERY: &str = include_str!("../../queries/injections.scm");
53+
5254
/// The symbol tagging query for this language.
5355
pub const TAGGING_QUERY: &str = include_str!("../../queries/tags.scm");
5456

grammar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ module.exports = grammar({
9292
$._declaration_statement
9393
),
9494

95-
shebang: $ => /#!.*/,
96-
9795
empty_statement: $ => ';',
9896

9997
expression_statement: $ => choice(
@@ -1468,6 +1466,8 @@ module.exports = grammar({
14681466

14691467
identifier: $ => /(r#)?[_\p{XID_Start}][_\p{XID_Continue}]*/,
14701468

1469+
shebang: $ => /#!.*/,
1470+
14711471
_reserved_identifier: $ => alias(choice(
14721472
'default',
14731473
'union',

src/grammar.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8452,6 +8452,10 @@
84528452
"type": "PATTERN",
84538453
"value": "(r#)?[_\\p{XID_Start}][_\\p{XID_Continue}]*"
84548454
},
8455+
"shebang": {
8456+
"type": "PATTERN",
8457+
"value": "#!.*"
8458+
},
84558459
"_reserved_identifier": {
84568460
"type": "ALIAS",
84578461
"content": {

0 commit comments

Comments
 (0)