@@ -289,7 +289,7 @@ def blockFinderFor( name:"", tag_as:"", start_pattern:nil, needs_semicolon: true
289289 tag_as : "keyword.control.exception.$match"
290290 )
291291 cpp_grammar [ :other_keywords ] = newPattern (
292- match : variableBounds [ /(using| typedef)/ ] ,
292+ match : variableBounds [ /(typedef)/ ] ,
293293 tag_as : "keyword.other.$match"
294294 )
295295 cpp_grammar [ :the_this_keyword ] = the_this_keyword = newPattern (
@@ -1283,7 +1283,7 @@ def blockFinderFor( name:"", tag_as:"", start_pattern:nil, needs_semicolon: true
12831283 match : /final/ ,
12841284 tag_as : "storage.type.modifier.final" ,
12851285 )
1286- generateClassOrStructBlockFinder = -> ( name ) do
1286+ generateClassOrStructBlockFinder = -> ( name , tail_includes = [ :$initial_context ] ) do
12871287 return blockFinderFor (
12881288 tag_as : "meta.block.#{ name } " ,
12891289 name : name ,
@@ -1340,6 +1340,7 @@ def blockFinderFor( name:"", tag_as:"", start_pattern:nil, needs_semicolon: true
13401340 :comments_context ,
13411341 ] ,
13421342 body_includes : [ :function_pointer , :constructor_context , :$initial_context ] ,
1343+ tail_includes : tail_includes
13431344 )
13441345 end
13451346 cpp_grammar [ :class_block ] = generateClassOrStructBlockFinder [ "class" ]
@@ -1357,7 +1358,26 @@ def blockFinderFor( name:"", tag_as:"", start_pattern:nil, needs_semicolon: true
13571358 head_includes : [ :$initial_context ] ,
13581359 secondary_includes : [ :$initial_context ]
13591360 )
1360-
1361+ generateTypedefClassOrStructBlockFinder = -> ( name ) do
1362+ return PatternRange . new (
1363+ start_pattern : newPattern (
1364+ match : variableBounds [ /typedef/ ] ,
1365+ tag_as : "keyword.other.typedef"
1366+ ) . maybe ( @spaces ) . lookAheadFor ( variableBounds [ /#{ name } / ] ) ,
1367+ end_pattern : lookBehindFor ( /;/ ) ,
1368+ includes : [
1369+ generateClassOrStructBlockFinder [ name , [
1370+ newPattern (
1371+ match : variable_name ,
1372+ tag_as : "entity.name.type.alias"
1373+ )
1374+ ] ]
1375+ ]
1376+ )
1377+ end
1378+ cpp_grammar [ :typedef_class ] = generateTypedefClassOrStructBlockFinder [ "class" ]
1379+ cpp_grammar [ :typedef_struct ] = generateTypedefClassOrStructBlockFinder [ "struct" ]
1380+ cpp_grammar [ :typedef_union ] = generateTypedefClassOrStructBlockFinder [ "union" ]
13611381#
13621382# preprocessor directives
13631383#
@@ -1727,6 +1747,9 @@ def blockFinderFor( name:"", tag_as:"", start_pattern:nil, needs_semicolon: true
17271747 :using_namespace ,
17281748 :type_alias ,
17291749 :namespace_block ,
1750+ :typedef_class ,
1751+ :typedef_struct ,
1752+ :typedef_union ,
17301753 :class_block ,
17311754 :struct_block ,
17321755 :union_block ,
0 commit comments