Skip to content

Commit 5e18e2b

Browse files
committed
using directives: allow attributes to appear at the beginning
1 parent ac5dc6f commit 5e18e2b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

grammar.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ module.exports = grammar(C, {
6565
[$.sized_type_specifier],
6666
[$.attributed_statement],
6767
[$._declaration_modifiers, $.attributed_statement],
68+
[$._declaration_modifiers, $.using_declaration],
69+
[$._declaration_modifiers, $.attributed_statement, $.using_declaration],
6870
[$._top_level_item, $._top_level_statement],
6971
[$._block_item, $.statement],
7072
[$.type_qualifier, $.extension_expression],
@@ -804,6 +806,7 @@ module.exports = grammar(C, {
804806
)),
805807

806808
using_declaration: $ => seq(
809+
repeat($.attribute_declaration),
807810
'using',
808811
optional(choice('namespace', 'enum')),
809812
choice(

test/corpus/declarations.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ using ::e::f::g;
9898
using h = i::j;
9999
using namespace std;
100100
using enum Foo;
101+
[[deprecated]] using namespace std;
101102

102103
template <typename T>
103104
using a = typename b<T>::c;
@@ -134,6 +135,11 @@ using foobar [[deprecated]] [[maybe_unused]] = int;
134135
(identifier))
135136
(using_declaration
136137
(identifier))
138+
(using_declaration
139+
(attribute_declaration
140+
(attribute
141+
(identifier)))
142+
(identifier))
137143
(template_declaration
138144
(template_parameter_list
139145
(type_parameter_declaration

0 commit comments

Comments
 (0)