Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions grammars/c++.cson
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@
'1':
'name': 'entity.name.function.cpp'
'2':
'name': 'punctuation.definition.parameters.begin.c'
'name': 'punctuation.definition.parameters.begin.bracket.round.c'
'end': '\\)'
'endCaptures':
'0':
'name': 'punctuation.definition.parameters.end.c'
'name': 'punctuation.definition.parameters.end.bracket.round.c'
'name': 'meta.function.destructor.cpp'
'patterns': [
{
Expand All @@ -99,11 +99,11 @@
'1':
'name': 'entity.name.function.cpp'
'2':
'name': 'punctuation.definition.parameters.begin.c'
'name': 'punctuation.definition.parameters.begin.bracket.round.c'
'end': '\\)'
'endCaptures':
'0':
'name': 'punctuation.definition.parameters.end.c'
'name': 'punctuation.definition.parameters.end.bracket.round.c'
'name': 'meta.function.destructor.prototype.cpp'
'patterns': [
{
Expand All @@ -126,15 +126,14 @@
}
]
'block':
'begin': '\\{'
'begin': '{'
'beginCaptures':
'0':
'name': 'punctuation.section.block.begin.c'
'end': '\\}'
'name': 'punctuation.definition.section.block.begin.bracket.curly.c'
'end': '}'
'endCaptures':
'0':
'name': 'punctuation.section.block.end.c'
'name': 'meta.block.cpp'
'name': 'punctuation.definition.section.block.end.bracket.curly.c'
'patterns': [
{
'captures':
Expand Down Expand Up @@ -174,7 +173,7 @@
'beginCaptures':
'1':
'name': 'punctuation.definition.parameters.c'
'end': '(?=\\{)'
'end': '(?={)'
'name': 'meta.function.constructor.initializer-list.cpp'
'patterns': [
{
Expand Down Expand Up @@ -211,15 +210,15 @@
'captures':
'1':
'name': 'keyword.control.namespace.$2'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't fix this in this PR, but this capture is missing a .cpp at the end.

'end': '(?<=\\})|(?=(;|,|\\(|\\)|>|\\[|\\]|=))'
'end': '(?<=})|(?=(;|,|\\(|\\)|>|\\[|\\]|=))'
'name': 'meta.namespace-block.cpp'
'patterns': [
{
'begin': '\\{'
'begin': '{'
'beginCaptures':
'0':
'name': 'punctuation.definition.scope.cpp'
'end': '\\}'
'end': '}'
'endCaptures':
'0':
'name': 'punctuation.definition.scope.cpp'
Expand Down Expand Up @@ -269,14 +268,14 @@
'include': '#angle_brackets'
}
{
'begin': '\\{'
'begin': '{'
'beginCaptures':
'0':
'name': 'punctuation.section.block.begin.cpp'
'end': '(\\})(\\s*\\n)?'
'name': 'punctuation.definition.section.block.begin.bracket.curly.c'
'end': '(})(\\s*\\n)?'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to match for optional whitespace here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking for missing semicolon

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we replace this with (\\s*$)? instead then?

'endCaptures':
'1':
'name': 'punctuation.section.block.end.cpp'
'name': 'punctuation.definition.section.block.begin.bracket.curly.c'
'2':
'name': 'invalid.illegal.you-forgot-semicolon.cpp'
'patterns': [
Expand All @@ -297,22 +296,23 @@
]
}
{
# extern "C" {}
'begin': '\\b(extern)(?=\\s*")'
'beginCaptures':
'1':
'name': 'storage.modifier.cpp'
'end': '(?<=\\})|(?=\\w)|(?=\\s*#\\s*endif\\b)'
'end': '(?<=})'
'name': 'meta.extern-block.cpp'
'patterns': [
{
'begin': '\\{'
'begin': '{'
'beginCaptures':
'0':
'name': 'punctuation.section.block.begin.c'
'end': '\\}|(?=\\s*#\\s*endif\\b)'
'name': 'punctuation.definition.section.block.begin.bracket.curly.c'
'end': '}'
'endCaptures':
'0':
'name': 'punctuation.section.block.end.c'
'name': 'punctuation.definition.section.block.end.bracket.curly.c'
'patterns': [
{
'include': '#special_block'
Expand Down
Loading