Skip to content

Commit 1bd5b34

Browse files
committed
Allow parse macro identifiers with parenthesis
1 parent f82fbd5 commit 1bd5b34

File tree

5 files changed

+689812
-686311
lines changed

5 files changed

+689812
-686311
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Jaime Gonzalez <jaime.gonzalez@appentra.com>
3+
Date: Fri, 10 Oct 2025 09:30:06 +0200
4+
Subject: Allow parse macro identifiers with parenthesis
5+
6+
---
7+
grammar.js | 11 +++++++++++
8+
1 file changed, 11 insertions(+)
9+
10+
diff --git a/grammar.js b/grammar.js
11+
index b5c11d1..88c86b8 100644
12+
--- a/grammar.js
13+
+++ b/grammar.js
14+
@@ -1145,6 +1145,16 @@ module.exports = grammar({
15+
';'
16+
),
17+
18+
+ macro_expression: $ => seq(
19+
+ $.macro_identifier,
20+
+ optional(seq(
21+
+ '(',
22+
+ commaSep($._expression),
23+
+ ')'
24+
+ )
25+
+ ),
26+
+ ),
27+
+
28+
_statements: $ => choice(
29+
$.assignment_statement,
30+
$.pointer_association_statement,
31+
@@ -1182,6 +1192,7 @@ module.exports = grammar({
32+
// Not strictly valid, but can catch extensions and preprocessor macros
33+
$.call_expression,
34+
$.include_statement,
35+
+ $.macro_expression,
36+
),
37+
38+
statement_label: $ => prec(1, alias($._integer_literal, 'statement_label')),

grammar.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,16 @@ module.exports = grammar({
11451145
';'
11461146
),
11471147

1148+
macro_expression: $ => seq(
1149+
$.macro_identifier,
1150+
optional(seq(
1151+
'(',
1152+
commaSep($._expression),
1153+
')'
1154+
)
1155+
),
1156+
),
1157+
11481158
_statements: $ => choice(
11491159
$.assignment_statement,
11501160
$.pointer_association_statement,
@@ -1182,6 +1192,7 @@ module.exports = grammar({
11821192
// Not strictly valid, but can catch extensions and preprocessor macros
11831193
$.call_expression,
11841194
$.include_statement,
1195+
$.macro_expression,
11851196
),
11861197

11871198
statement_label: $ => prec(1, alias($._integer_literal, 'statement_label')),

0 commit comments

Comments
 (0)