Skip to content

Commit

Permalink
fix for #215
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-hykin committed May 29, 2019
1 parent 68d6d59 commit 1c84f49
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 73 deletions.
31 changes: 16 additions & 15 deletions source/languages/cpp/generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def generateBlockFinder( name:"", tag_as:"", start_pattern:nil, needs_semicolon:
:meta_preprocessor_pragma,
:predefined_macros,
:operators,
:attributes_context, # this is here because it needs to be lower than :operators. TODO: once all the contexts are cleaned up, this should be put in a better spot
:block,
:parentheses,
:type_casting_operators,
Expand All @@ -201,6 +202,21 @@ def generateBlockFinder( name:"", tag_as:"", start_pattern:nil, needs_semicolon:
:semicolon,
:comma,
]
cpp_grammar[:special_block_context] = [
# TODO: the :attributes_context probably belongs here but see issue #215 for why they were removed
:using_namespace,
:type_alias,
:namespace_alias,
:namespace_block,
:typedef_class,
:typedef_struct,
:typedef_union,
:class_block,
:struct_block,
:union_block,
:enum_block,
:extern_block,
]
# this is currently just :root_context without :function_definition
cpp_grammar[:function_body_context] = [
:type_casting_operators,
Expand Down Expand Up @@ -1909,21 +1925,6 @@ def generateBlockFinder( name:"", tag_as:"", start_pattern:nil, needs_semicolon:
]
}
]
cpp_grammar[:special_block_context] = [
:attributes_context,
:using_namespace,
:type_alias,
:namespace_alias,
:namespace_block,
:typedef_class,
:typedef_struct,
:typedef_union,
:class_block,
:struct_block,
:union_block,
:enum_block,
:extern_block,
]
cpp_grammar[:string_context] = [
{
begin: "(u|u8|U|L)?\"",
Expand Down
86 changes: 43 additions & 43 deletions syntaxes/cpp.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@
{
"include": "#operators"
},
{
"include": "#attributes_context"
},
{
"include": "#block"
},
Expand Down Expand Up @@ -297,6 +300,46 @@
}
]
},
"special_block_context": {
"patterns": [
{
"include": "#using_namespace"
},
{
"include": "#type_alias"
},
{
"include": "#namespace_alias"
},
{
"include": "#namespace_block"
},
{
"include": "#typedef_class"
},
{
"include": "#typedef_struct"
},
{
"include": "#typedef_union"
},
{
"include": "#class_block"
},
{
"include": "#struct_block"
},
{
"include": "#union_block"
},
{
"include": "#enum_block"
},
{
"include": "#extern_block"
}
]
},
"function_body_context": {
"patterns": [
{
Expand Down Expand Up @@ -5386,49 +5429,6 @@
}
]
},
"special_block_context": {
"patterns": [
{
"include": "#attributes_context"
},
{
"include": "#using_namespace"
},
{
"include": "#type_alias"
},
{
"include": "#namespace_alias"
},
{
"include": "#namespace_block"
},
{
"include": "#typedef_class"
},
{
"include": "#typedef_struct"
},
{
"include": "#typedef_union"
},
{
"include": "#class_block"
},
{
"include": "#struct_block"
},
{
"include": "#union_block"
},
{
"include": "#enum_block"
},
{
"include": "#extern_block"
}
]
},
"string_context": {
"patterns": [
{
Expand Down
30 changes: 15 additions & 15 deletions syntaxes/cpp.tmLanguage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
- include: "#meta_preprocessor_pragma"
- include: "#predefined_macros"
- include: "#operators"
- include: "#attributes_context"
- include: "#block"
- include: "#parentheses"
- include: "#type_casting_operators"
Expand All @@ -141,6 +142,20 @@
- include: "#empty_square_brackets"
- include: "#semicolon"
- include: "#comma"
special_block_context:
patterns:
- include: "#using_namespace"
- include: "#type_alias"
- include: "#namespace_alias"
- include: "#namespace_block"
- include: "#typedef_class"
- include: "#typedef_struct"
- include: "#typedef_union"
- include: "#class_block"
- include: "#struct_block"
- include: "#union_block"
- include: "#enum_block"
- include: "#extern_block"
function_body_context:
patterns:
- include: "#type_casting_operators"
Expand Down Expand Up @@ -2835,21 +2850,6 @@
name: meta.function.constructor.initializer-list.cpp
patterns:
- include: "#root_context"
special_block_context:
patterns:
- include: "#attributes_context"
- include: "#using_namespace"
- include: "#type_alias"
- include: "#namespace_alias"
- include: "#namespace_block"
- include: "#typedef_class"
- include: "#typedef_struct"
- include: "#typedef_union"
- include: "#class_block"
- include: "#struct_block"
- include: "#union_block"
- include: "#enum_block"
- include: "#extern_block"
string_context:
patterns:
- begin: (u|u8|U|L)?"
Expand Down

0 comments on commit 1c84f49

Please sign in to comment.