Skip to content

Commit

Permalink
Merge pull request #158 from amaanq/thread-and-more
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
amaanq committed Jul 27, 2023
2 parents ad09589 + 43a147a commit 28d910c
Show file tree
Hide file tree
Showing 6 changed files with 64,409 additions and 62,248 deletions.
5 changes: 3 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ module.exports = grammar({
...preprocIf('', $ => $._block_item),
...preprocIf('_in_field_declaration_list', $ => $._field_declaration_list_item),

preproc_arg: _ => token(prec(-1, /\S([^/\n]|\\\r?\n)*/)),
preproc_arg: _ => token(prec(-1, /\S([^/\n]|\/[^*]|\\\r?\n)*/)),
preproc_directive: _ => /#[ \t]*[a-zA-Z0-9]\w*/,

_preproc_expression: $ => choice(
Expand Down Expand Up @@ -233,7 +233,7 @@ module.exports = grammar({
declaration: $ => seq(
$._declaration_specifiers,
commaSep1(field('declarator', choice(
$._declarator,
seq($._declarator, optional($.gnu_asm_expression)),
$.init_declarator,
))),
';',
Expand Down Expand Up @@ -497,6 +497,7 @@ module.exports = grammar({
'register',
'inline',
'thread_local',
'__thread',
),

type_qualifier: _ => choice(
Expand Down
48 changes: 43 additions & 5 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@
"value": -1,
"content": {
"type": "PATTERN",
"value": "\\S([^/\\n]|\\\\\\r?\\n)*"
"value": "\\S([^/\\n]|\\/[^*]|\\\\\\r?\\n)*"
}
}
},
Expand Down Expand Up @@ -1918,8 +1918,25 @@
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_declarator"
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_declarator"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "gnu_asm_expression"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "SYMBOL",
Expand All @@ -1944,8 +1961,25 @@
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_declarator"
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_declarator"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "gnu_asm_expression"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "SYMBOL",
Expand Down Expand Up @@ -3321,6 +3355,10 @@
{
"type": "STRING",
"value": "thread_local"
},
{
"type": "STRING",
"value": "__thread"
}
]
},
Expand Down
8 changes: 8 additions & 0 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,10 @@
"type": "_declarator",
"named": true
},
{
"type": "gnu_asm_expression",
"named": true
},
{
"type": "init_declarator",
"named": true
Expand Down Expand Up @@ -3925,6 +3929,10 @@
"type": "__thiscall",
"named": false
},
{
"type": "__thread",
"named": false
},
{
"type": "__unaligned",
"named": false
Expand Down

0 comments on commit 28d910c

Please sign in to comment.