This repository was archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 149
Tokenize punctuation #107
Closed
Closed
Tokenize punctuation #107
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
ab9277a
Tokenize punctuation
MaximSokolov e98b1c0
Add 'definition' subscope
MaximSokolov 6ffdb05
Tokenize ';' as 'punctuation.terminator.statement'
MaximSokolov 6b175ff
Drop 'other' subscope
MaximSokolov 0d8b634
Improve parameters, arguments matching
MaximSokolov 15fdd44
:art:
MaximSokolov 66eca84
:fire: Don't scope the entire block as `meta.block`
MaximSokolov da8ee72
:bug: Tokenize unmatched curly bracket
MaximSokolov 8ef80ce
Wrap brackets with `meta.brace`
MaximSokolov eaf7b00
Add `bracket.curly/round/square` subscopes
MaximSokolov f7160dc
Rename 'punctuation.comma/period' -> 'punctuation.separator.comma/per…
MaximSokolov 57ec9ef
Revert 'Wrap brackets with `meta.brace`'
MaximSokolov 7c23f83
:bug: Don't use begin/end capture for preprocessor rules
MaximSokolov c18d8e1
Add missing `bracket.round`
MaximSokolov 5782039
:art:
MaximSokolov a606212
Merge branch 'master' into punctuation-improvments
MaximSokolov 00fc6a5
Tokenize unmatched brackets as illegal
MaximSokolov b0b2305
Rename 'function_call' -> 'function_calls'
MaximSokolov 8e74503
:fire: Remove legacy code
MaximSokolov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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': [ | ||
| { | ||
|
|
@@ -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': [ | ||
| { | ||
|
|
@@ -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': | ||
|
|
@@ -174,7 +173,7 @@ | |
| 'beginCaptures': | ||
| '1': | ||
| 'name': 'punctuation.definition.parameters.c' | ||
| 'end': '(?=\\{)' | ||
| 'end': '(?={)' | ||
| 'name': 'meta.function.constructor.initializer-list.cpp' | ||
| 'patterns': [ | ||
| { | ||
|
|
@@ -211,15 +210,15 @@ | |
| 'captures': | ||
| '1': | ||
| 'name': 'keyword.control.namespace.$2' | ||
| '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' | ||
|
|
@@ -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)?' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to match for optional whitespace here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checking for missing semicolon
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we replace this with |
||
| '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': [ | ||
|
|
@@ -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' | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
.cppat the end.