Przeglądaj źródła
Merge pull request #155 from amaanq/fix-attribute
feat: add `attribute_specifier` to struct
pull/156/head
Amaan Qureshi
3 lat temu
committed by
GitHub
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z
58699 dodań i
58460 usunięć
-
grammar.js
-
src/grammar.json
-
src/parser.c
-
test/corpus/declarations.txt
|
|
|
@ -575,6 +575,7 @@ module.exports = grammar({ |
|
|
|
|
|
|
|
struct_specifier: $ => prec.right(seq( |
|
|
|
'struct', |
|
|
|
optional($.attribute_specifier), |
|
|
|
optional($.ms_declspec_modifier), |
|
|
|
choice( |
|
|
|
seq( |
|
|
|
|
|
|
|
@ -3708,6 +3708,18 @@ |
|
|
|
"type": "STRING", |
|
|
|
"value": "struct" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"type": "CHOICE", |
|
|
|
"members": [ |
|
|
|
{ |
|
|
|
"type": "SYMBOL", |
|
|
|
"name": "attribute_specifier" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"type": "BLANK" |
|
|
|
} |
|
|
|
] |
|
|
|
}, |
|
|
|
{ |
|
|
|
"type": "CHOICE", |
|
|
|
"members": [ |
|
|
|
|
|
|
|
@ -676,6 +676,10 @@ enum Z { |
|
|
|
A |
|
|
|
} __attribute__((aligned(16))); |
|
|
|
|
|
|
|
struct __attribute__((__packed__)) foo_t { |
|
|
|
int x; |
|
|
|
}; |
|
|
|
|
|
|
|
-------------------------------------------------------------------------------- |
|
|
|
|
|
|
|
(translation_unit |
|
|
|
@ -889,4 +893,13 @@ enum Z { |
|
|
|
(call_expression |
|
|
|
(identifier) |
|
|
|
(argument_list |
|
|
|
(number_literal))))))) |
|
|
|
(number_literal)))))) |
|
|
|
(struct_specifier |
|
|
|
(attribute_specifier |
|
|
|
(argument_list |
|
|
|
(identifier))) |
|
|
|
(type_identifier) |
|
|
|
(field_declaration_list |
|
|
|
(field_declaration |
|
|
|
(primitive_type) |
|
|
|
(field_identifier))))) |