Skip to content

Commit

Permalink
Add constinit keyword highlighted. (fixes jeff-hykin#575)
Browse files Browse the repository at this point in the history
  • Loading branch information
soroshsabz committed Oct 15, 2021
1 parent 89a5c27 commit 35f350e
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 43 deletions.
2 changes: 1 addition & 1 deletion autogenerated/cpp.embedded.macro.tmLanguage.json

Large diffs are not rendered by default.

80 changes: 40 additions & 40 deletions autogenerated/cpp.tmLanguage.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions language_examples/feature_consteval.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
- comment.line.double-slash
scopes:
- punctuation.definition.comment
- source: " ITNOA\r"
- source: ' ITNOA'
- source: //
scopes:
- punctuation.definition.comment
- source: " consteval is not coloerize, so it is wrong\r"
- source: ' consteval is not coloerize, so it is wrong'
scopesEnd:
- comment.line.double-slash
- source: constexpr
Expand Down
9 changes: 9 additions & 0 deletions language_examples/feature_constinit.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// ITNOA


int foo()
{
constinit const char* c = f(true);
}

extern thread_local constinit int x;
88 changes: 88 additions & 0 deletions language_examples/feature_constinit.spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
- source: //
scopesBegin:
- comment.line.double-slash
scopes:
- punctuation.definition.comment
- source: ' ITNOA'
scopesEnd:
- comment.line.double-slash
- source: int
scopesBegin:
- meta.function.definition
scopes:
- meta.qualified_type
- storage.type.primitive
- storage.type.built-in.primitive
- source: foo
scopesBegin:
- meta.head.function.definition
scopes:
- entity.name.function.definition
- source: (
scopes:
- punctuation.section.parameters.begin.bracket.round
- source: )
scopes:
- punctuation.section.parameters.end.bracket.round
- source: '{'
scopes:
- punctuation.section.block.begin.bracket.curly.function.definition
scopesEnd:
- meta.head.function.definition
- source: constinit
scopesBegin:
- meta.body.function.definition
scopes:
- keyword.other.constinit
- source: const
scopes:
- storage.modifier.specifier.const
- source: char
scopes:
- storage.type.primitive
- storage.type.built-in.primitive
- source: '*'
scopes:
- keyword.operator.arithmetic
- source: ' c '
- source: '='
scopes:
- keyword.operator.assignment
- source: f
scopes:
- entity.name.function.call
- source: (
scopes:
- punctuation.section.arguments.begin.bracket.round.function.call
- source: 'true'
scopes:
- constant.language.true
- source: )
scopes:
- punctuation.section.arguments.end.bracket.round.function.call
- source: ;
scopes:
- punctuation.terminator.statement
- source: '}'
scopes:
- punctuation.section.block.end.bracket.curly.function.definition
scopesEnd:
- meta.function.definition
- meta.body.function.definition
- source: extern
scopes:
- storage.modifier.specifier.extern
- source: thread_local
scopes:
- storage.modifier.specifier.thread_local
- source: constinit
scopes:
- keyword.other.constinit
- source: int
scopes:
- storage.type.primitive
- storage.type.built-in.primitive
- source: ' x'
- source: ;
scopes:
- punctuation.terminator.statement
1 change: 1 addition & 0 deletions main/tokens.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
#
{ representation: "typedef" , name: "typedef" , isCurrentlyAMiscKeyword: true },
{ representation: "decltype" , name: "decltype" , isSpecifier: true, isFunctionLike: true },
{ representation: "constinit" , name: "constinit" , isSpecifier: true , isCurrentlyAMiscKeyword: true},
{ representation: "typename" , name: "typename" },
#
{ representation: "asm" , name: "asm" },
Expand Down

0 comments on commit 35f350e

Please sign in to comment.