diff --git a/c/generate.rb b/c/generate.rb index f6e445af..c65c5020 100644 --- a/c/generate.rb +++ b/c/generate.rb @@ -22,7 +22,8 @@ :default_statement, :case_statement, :switch_statement, - :switch_conditional_parentheses + :switch_conditional_parentheses, + :static_assert, ] for each in import_names c_grammar[each] = @cpp_grammar[each] diff --git a/c/tags.txt b/c/tags.txt index fa200135..c09db189 100644 --- a/c/tags.txt +++ b/c/tags.txt @@ -1,4 +1,5 @@ colon.cpp.c +comma.cpp.c comment.block.c comment.line.banner.cpp.c comment.line.double-slash.cpp.c @@ -44,6 +45,7 @@ keyword.operator.logical.c keyword.operator.sizeof.c keyword.operator.ternary.c keyword.other.typedef.c +keyword.static_assert.cpp.c meta.block.c meta.block.switch.c meta.body.switch.cpp.c @@ -64,6 +66,7 @@ meta.preprocessor.include.c meta.preprocessor.macro.c meta.preprocessor.pragma.c meta.section.c +meta.static_assert.message.cpp.c meta.tail.switch.cpp.c meta.toc-list.banner.block.c meta.toc-list.banner.line.c @@ -79,8 +82,10 @@ punctuation.definition.string.begin.c punctuation.definition.string.end.c punctuation.range-based.cpp.c punctuation.section.arguments.begin.bracket.round.c +punctuation.section.arguments.begin.bracket.round.cpp.c punctuation.section.arguments.begin.bracket.round.function.member.c punctuation.section.arguments.end.bracket.round.c +punctuation.section.arguments.end.bracket.round.cpp.c punctuation.section.arguments.end.bracket.round.function.member.c punctuation.section.block.begin.bracket.curly.c punctuation.section.block.begin.bracket.curly.switch.cpp.c @@ -97,6 +102,7 @@ punctuation.section.parens.end.bracket.round.initialization.c punctuation.separator.case.cpp.c punctuation.separator.case.default.cpp.c punctuation.separator.delimiter.c +punctuation.separator.delimiter.cpp.c punctuation.separator.dot-access.c punctuation.separator.parameters.c punctuation.separator.pointer-access.c diff --git a/cpp/generate.rb b/cpp/generate.rb index dc40c947..cbf88cb0 100644 --- a/cpp/generate.rb +++ b/cpp/generate.rb @@ -98,6 +98,7 @@ def blockFinderFor( name:"", tag_as:"", start_pattern:nil, needs_semicolon: true :storage_specifiers, :access_control_keywords, :exception_keywords, + :static_assert, :other_keywords, :memory_operators, :the_this_keyword, @@ -791,6 +792,36 @@ def blockFinderFor( name:"", tag_as:"", start_pattern:nil, needs_semicolon: true end_pattern: lookBehindFor(/\)/), includes: [ :parameter_struct, :function_context_c ] ) + # static assert is special as it can be outside of normal places function calls can be + cpp_grammar[:static_assert] = Range.new( + start_pattern: newPattern( + match: /static_assert|_Static_assert/, + tag_as: "keyword.static_assert", + ).maybe(@spaces).then( + match: /\(/, + tag_as: "punctuation.section.arguments.begin.bracket.round", + ), + end_pattern: newPattern( + match: /\)/, + tag_as: "punctuation.section.arguments.end.bracket.round", + ), + includes: [ + # special handling for the assert message + Range.new( + start_pattern: newPattern( + match: /,/, + tag_as: "comma punctuation.separator.delimiter", + ).maybe(@spaces).lookAheadFor(maybe(/L|u8|u|U/.maybe(@spaces).then(/\"/))), + end_pattern: lookAheadFor(/\)/), + tag_as: "meta.static_assert.message", + includes: [ + :string_context, + :string_context_c, + ] + ), + :function_call_context_c, + ] + ) # a full match example of function call would be: aNameSpace::subClassFunctionName<5>( cpp_grammar[:function_call] = Range.new( start_pattern: avoid_invalid_function_names.then( diff --git a/cpp/tags.txt b/cpp/tags.txt index 995bc845..b51b0d28 100644 --- a/cpp/tags.txt +++ b/cpp/tags.txt @@ -94,6 +94,7 @@ keyword.other.unit.suffix.floating-point.cpp keyword.other.unit.suffix.integer.cpp keyword.other.unit.user-defined.cpp keyword.other.using.directive.cpp +keyword.static_assert.cpp memory.cpp meta.block.class.cpp meta.block.cpp @@ -142,6 +143,7 @@ meta.preprocessor.macro.cpp meta.preprocessor.pragma.cpp meta.scope-resolution.cpp meta.section.cpp +meta.static_assert.message.cpp meta.tail.class.cpp meta.tail.enum.cpp meta.tail.extern.cpp diff --git a/syntaxes/c.tmLanguage.json b/syntaxes/c.tmLanguage.json index bd416cad..8839b6bc 100644 --- a/syntaxes/c.tmLanguage.json +++ b/syntaxes/c.tmLanguage.json @@ -1 +1 @@ -{"name":"C","scopeName":"source.c","information_for_contributors":["This code was auto generated by a much-more-readble ruby file: https://github.com/jeff-hykin/cpp-textmate-grammar/blob/master/generate_c.rb","This file essentially an updated/improved fork of the atom syntax https://github.com/atom/language-c/blob/master/grammars/c.cson"],"version":"https://github.com/jeff-hykin/cpp-textmate-grammar/blob/master/syntaxes/c.tmLanguage.json","patterns":[{"include":"#preprocessor-rule-enabled"},{"include":"#preprocessor-rule-disabled"},{"include":"#preprocessor-rule-conditional"},{"include":"#comments"},{"include":"#switch_statement"},{"match":"\\b(break|continue|do|else|for|goto|if|_Pragma|return|while)\\b","name":"keyword.control.c"},{"include":"#storage_types"},{"match":"typedef","name":"keyword.other.typedef.c"},{"match":"\\b(const|extern|register|restrict|static|volatile|inline)\\b","name":"storage.modifier.c"},{"match":"\\bk[A-Z]\\w*\\b","name":"constant.other.variable.mac-classic.c"},{"match":"\\bg[A-Z]\\w*\\b","name":"variable.other.readwrite.global.mac-classic.c"},{"match":"\\bs[A-Z]\\w*\\b","name":"variable.other.readwrite.static.mac-classic.c"},{"match":"\\b(NULL|true|false|TRUE|FALSE)\\b","name":"constant.language.c"},{"include":"#operators"},{"include":"#numbers"},{"include":"#strings"},{"begin":"(?x)\n^\\s* ((\\#)\\s*define) \\s+\t# define\n((?[a-zA-Z_$][\\w$]*))\t # macro name\n(?:\n (\\()\n\t(\n\t \\s* \\g \\s*\t\t # first argument\n\t ((,) \\s* \\g \\s*)* # additional arguments\n\t (?:\\.\\.\\.)?\t\t\t# varargs ellipsis?\n\t)\n (\\))\n)?","beginCaptures":{"1":{"name":"keyword.control.directive.define.c"},"2":{"name":"punctuation.definition.directive.c"},"3":{"name":"entity.name.function.preprocessor.c"},"5":{"name":"punctuation.definition.parameters.begin.c"},"6":{"name":"variable.parameter.preprocessor.c"},"8":{"name":"punctuation.separator.parameters.c"},"9":{"name":"punctuation.definition.parameters.end.c"}},"end":"(?=(?://|/\\*))|(?","endCaptures":{"0":{"name":"punctuation.definition.string.end.c"}},"name":"string.quoted.other.lt-gt.include.c"}]},{"include":"#pragma-mark"},{"begin":"^\\s*((#)\\s*line)\\b","beginCaptures":{"1":{"name":"keyword.control.directive.line.c"},"2":{"name":"punctuation.definition.directive.c"}},"end":"(?=(?://|/\\*))|(?\\]\\)]))\\s*([a-zA-Z_]\\w*)\\s*(?=(?:\\[\\]\\s*)?(?:,|\\)))","captures":{"1":{"name":"variable.parameter.probably.c"}}},"access-method":{"name":"meta.function-call.member.c","begin":"([a-zA-Z_][a-zA-Z_0-9]*|(?<=[\\]\\)]))\\s*(?:(\\.)|(->))((?:(?:[a-zA-Z_][a-zA-Z_0-9]*)\\s*(?:(?:\\.)|(?:->)))*)\\s*([a-zA-Z_][a-zA-Z_0-9]*)(\\()","beginCaptures":{"1":{"name":"variable.object.c"},"2":{"name":"punctuation.separator.dot-access.c"},"3":{"name":"punctuation.separator.pointer-access.c"},"4":{"patterns":[{"match":"\\.","name":"punctuation.separator.dot-access.c"},{"match":"->","name":"punctuation.separator.pointer-access.c"},{"match":"[a-zA-Z_][a-zA-Z_0-9]*","name":"variable.object.c"},{"name":"everything.else.c","match":".+"}]},"5":{"name":"entity.name.function.member.c"},"6":{"name":"punctuation.section.arguments.begin.bracket.round.function.member.c"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.arguments.end.bracket.round.function.member.c"}},"patterns":[{"include":"#function-call-innards"}]},"block":{"patterns":[{"begin":"{","beginCaptures":{"0":{"name":"punctuation.section.block.begin.bracket.curly.c"}},"end":"}|(?=\\s*#\\s*(?:elif|else|endif)\\b)","endCaptures":{"0":{"name":"punctuation.section.block.end.bracket.curly.c"}},"name":"meta.block.c","patterns":[{"include":"#block_innards"}]}]},"block_innards":{"patterns":[{"include":"#preprocessor-rule-enabled-block"},{"include":"#preprocessor-rule-disabled-block"},{"include":"#preprocessor-rule-conditional-block"},{"include":"#method_access"},{"include":"#member_access"},{"include":"#c_function_call"},{"name":"meta.initialization.c","begin":"(?x)\n(?:\n (?:\n\t(?=\\s)(?=+!]+ | \\(\\) | \\[\\]))\n)\n\\s*(\\() # opening bracket","beginCaptures":{"1":{"name":"variable.other.c"},"2":{"name":"punctuation.section.parens.begin.bracket.round.initialization.c"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.initialization.c"}},"patterns":[{"include":"#function-call-innards"}]},{"begin":"{","beginCaptures":{"0":{"name":"punctuation.section.block.begin.bracket.curly.c"}},"end":"}|(?=\\s*#\\s*(?:elif|else|endif)\\b)","endCaptures":{"0":{"name":"punctuation.section.block.end.bracket.curly.c"}},"patterns":[{"include":"#block_innards"}]},{"include":"#parens-block"},{"include":"$base"}]},"c_function_call":{"begin":"(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(?=\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*\\( # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)","end":"(?<=\\))(?!\\w)","name":"meta.function-call.c","patterns":[{"include":"#function-call-innards"}]},"comments":{"patterns":[{"captures":{"1":{"name":"meta.toc-list.banner.block.c"}},"match":"^/\\* =(\\s*.*?)\\s*= \\*/$\\n?","name":"comment.block.c"},{"begin":"/\\*","beginCaptures":{"0":{"name":"punctuation.definition.comment.begin.c"}},"end":"\\*/","endCaptures":{"0":{"name":"punctuation.definition.comment.end.c"}},"name":"comment.block.c"},{"match":"\\*/.*\\n","name":"invalid.illegal.stray-comment-end.c"},{"captures":{"1":{"name":"meta.toc-list.banner.line.c"}},"match":"^// =(\\s*.*?)\\s*=\\s*$\\n?","name":"comment.line.banner.cpp.c"},{"begin":"(^[ \\t]+)?(?=//)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.cpp.c"}},"end":"(?!\\G)","patterns":[{"begin":"//","beginCaptures":{"0":{"name":"punctuation.definition.comment.cpp.c"}},"end":"(?=\\n)","name":"comment.line.double-slash.cpp.c","patterns":[{"include":"#line_continuation_character"}]}]}]},"disabled":{"begin":"^\\s*#\\s*if(n?def)?\\b.*$","end":"^\\s*#\\s*endif\\b","patterns":[{"include":"#disabled"},{"include":"#pragma-mark"}]},"line_continuation_character":{"patterns":[{"match":"(\\\\)\\n","captures":{"1":{"name":"constant.character.escape.line-continuation.c"}}}]},"numbers":{"patterns":[{"match":"\\b((0(x|X)[0-9a-fA-F]([0-9a-fA-F']*[0-9a-fA-F])?)|(0(b|B)[01]([01']*[01])?)|(([0-9]([0-9']*[0-9])?\\.?[0-9]*([0-9']*[0-9])?)|(\\.[0-9]([0-9']*[0-9])?))((e|E)(\\+|-)?[0-9]([0-9']*[0-9])?)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b","name":"constant.numeric.c"}]},"parens":{"name":"meta.parens.c","begin":"\\(","beginCaptures":{"0":{"name":"punctuation.section.parens.begin.bracket.round.c"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.c"}},"patterns":[{"include":"$base"}]},"parens-block":{"name":"meta.parens.block.c","begin":"\\(","beginCaptures":{"0":{"name":"punctuation.section.parens.begin.bracket.round.c"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.c"}},"patterns":[{"include":"#block_innards"},{"match":"(?-mix:(?>=|\\|=","name":"keyword.operator.assignment.compound.bitwise.c"},{"match":"<<|>>","name":"keyword.operator.bitwise.shift.c"},{"match":"!=|<=|>=|==|<|>","name":"keyword.operator.comparison.c"},{"match":"&&|!|\\|\\|","name":"keyword.operator.logical.c"},{"match":"&|\\||\\^|~","name":"keyword.operator.c"},{"match":"=","name":"keyword.operator.assignment.c"},{"match":"%|\\*|/|-|\\+","name":"keyword.operator.c"},{"begin":"(\\?)","beginCaptures":{"1":{"name":"keyword.operator.ternary.c"}},"end":"(:)","endCaptures":{"1":{"name":"keyword.operator.ternary.c"}},"patterns":[{"include":"#function-call-innards"},{"include":"$base"}]}]},"strings":{"patterns":[{"begin":"\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.c"}},"end":"\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.c"}},"name":"string.quoted.double.c","patterns":[{"include":"#string_escaped_char"},{"include":"#string_placeholder"},{"include":"#line_continuation_character"}]},{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.c"}},"end":"'","endCaptures":{"0":{"name":"punctuation.definition.string.end.c"}},"name":"string.quoted.single.c","patterns":[{"include":"#string_escaped_char"},{"include":"#line_continuation_character"}]}]},"string_escaped_char":{"patterns":[{"match":"(?x)\\\\ (\n\\\\\t\t\t |\n[abefnprtv'\"?] |\n[0-3]\\d{,2}\t |\n[4-7]\\d?\t\t|\nx[a-fA-F0-9]{,2} |\nu[a-fA-F0-9]{,4} |\nU[a-fA-F0-9]{,8} )","name":"constant.character.escape.c"},{"match":"\\\\.","name":"invalid.illegal.unknown-escape.c"}]},"string_placeholder":{"patterns":[{"match":"(?x) %\n(\\d+\\$)?\t\t\t\t\t\t # field (argument #)\n[#0\\- +']*\t\t\t\t\t\t # flags\n[,;:_]?\t\t\t\t\t\t\t # separator character (AltiVec)\n((-?\\d+)|\\*(-?\\d+\\$)?)?\t\t # minimum field width\n(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)?\t# precision\n(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier\n[diouxXDOUeEfFgGaACcSspn%]\t\t # conversion type","name":"constant.other.placeholder.c"},{"match":"(%)(?!\"\\s*(PRI|SCN))","captures":{"1":{"name":"invalid.illegal.placeholder.c"}}}]},"storage_types":{"patterns":[{"match":"(?-mix:(?=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)","end":"(?<=\\))(?!\\w)|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()","beginCaptures":{"1":{"name":"entity.name.function.c"},"2":{"name":"punctuation.section.arguments.begin.bracket.round.c"}},"end":"(\\))|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()","beginCaptures":{"1":{"name":"entity.name.function.c"},"2":{"name":"punctuation.section.parameters.begin.bracket.round.c"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parameters.end.bracket.round.c"}},"patterns":[{"include":"#probably_a_parameter"},{"include":"#function-innards"}]},{"begin":"\\(","beginCaptures":{"0":{"name":"punctuation.section.parens.begin.bracket.round.c"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.c"}},"patterns":[{"include":"#function-innards"}]},{"include":"$base"}]},"function-call-innards":{"patterns":[{"include":"#comments"},{"include":"#storage_types"},{"include":"#method_access"},{"include":"#member_access"},{"include":"#operators"},{"begin":"(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()","beginCaptures":{"1":{"name":"entity.name.function.c"},"2":{"name":"punctuation.section.arguments.begin.bracket.round.c"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.arguments.end.bracket.round.c"}},"patterns":[{"include":"#function-call-innards"}]},{"begin":"\\(","beginCaptures":{"0":{"name":"punctuation.section.parens.begin.bracket.round.c"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.c"}},"patterns":[{"include":"#function-call-innards"}]},{"include":"#block_innards"}]},"default_statement":{"name":"meta.conditional.case.c","begin":"((?\\[\\]=]))","patterns":[{"include":"#switch_conditional_parentheses"},{"name":"meta.head.switch.cpp.c","begin":"\\G| ","end":"((?:\\{|(?=;)))","endCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.switch.cpp.c"}},"patterns":[{"include":"#switch_conditional_parentheses"},{"include":"$base"}]},{"name":"meta.body.switch.cpp.c","begin":"(?<=\\{)","end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.switch.cpp.c"}},"patterns":[{"include":"#default_statement"},{"include":"#case_statement"},{"include":"$base"}]},{"name":"meta.tail.switch.cpp.c","begin":"(?<=})[\\s\\n]*","end":"[\\s\\n]*(?=;)","patterns":[{"include":"$base"}]}]},"switch_conditional_parentheses":{"name":"meta.conditional.switch.c","begin":"(\\()","beginCaptures":{"1":{"name":"punctuation.section.parens.begin.bracket.round.conditional.switch.cpp.c"}},"end":"(\\))","endCaptures":{"1":{"name":"punctuation.section.parens.end.bracket.round.conditional.switch.cpp.c"}},"patterns":[{"include":"#conditional_context"}]},"conditional_context":{"patterns":[{"include":"$base"}]},"member_access":{"match":"((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!(?:void|char|short|int|signed|unsigned|long|float|double|bool|_Bool|_Complex|_Imaginary|u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|div_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t|pthread_attr_t|pthread_cond_t|pthread_condattr_t|pthread_mutex_t|pthread_mutexattr_t|pthread_once_t|pthread_rwlock_t|pthread_rwlockattr_t|pthread_t|pthread_key_t|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t|memory_order|atomic_bool|atomic_char|atomic_schar|atomic_uchar|atomic_short|atomic_ushort|atomic_int|atomic_uint|atomic_long|atomic_ulong|atomic_llong|atomic_ullong|atomic_char16_t|atomic_char32_t|atomic_wchar_t|atomic_int_least8_t|atomic_uint_least8_t|atomic_int_least16_t|atomic_uint_least16_t|atomic_int_least32_t|atomic_uint_least32_t|atomic_int_least64_t|atomic_uint_least64_t|atomic_int_fast8_t|atomic_uint_fast8_t|atomic_int_fast16_t|atomic_uint_fast16_t|atomic_int_fast32_t|atomic_uint_fast32_t|atomic_int_fast64_t|atomic_uint_fast64_t|atomic_intptr_t|atomic_uintptr_t|atomic_size_t|atomic_ptrdiff_t|atomic_intmax_t|atomic_uintmax_t))[a-zA-Z_]\\w*\\b(?!\\())","captures":{"1":{"name":"variable.other.object.access.c"},"2":{"name":"punctuation.separator.dot-access.c"},"3":{"name":"punctuation.separator.pointer-access.c"},"4":{"patterns":[{"include":"#member_access"},{"include":"#method_access"},{"match":"((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))","captures":{"1":{"name":"variable.other.object.access.c"},"2":{"name":"punctuation.separator.dot-access.c"},"3":{"name":"punctuation.separator.pointer-access.c"}}}]},"5":{"name":"variable.other.member.c"}}},"method_access":{"contentName":"meta.function-call.member","begin":"((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*([a-zA-Z_]\\w*)(\\()","beginCaptures":{"1":{"name":"variable.other.object.access.c"},"2":{"name":"punctuation.separator.dot-access.c"},"3":{"name":"punctuation.separator.pointer-access.c"},"4":{"patterns":[{"include":"#member_access"},{"include":"#method_access"},{"match":"((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))","captures":{"1":{"name":"variable.other.object.access.c"},"2":{"name":"punctuation.separator.dot-access.c"},"3":{"name":"punctuation.separator.pointer-access.c"}}}]},"5":{"name":"entity.name.function.member.c"},"6":{"name":"punctuation.section.arguments.begin.bracket.round.function.member.c"}},"end":"(\\))","endCaptures":{"1":{"name":"punctuation.section.arguments.end.bracket.round.function.member.c"}},"patterns":[{"include":"#function-call-innards"}]}}} \ No newline at end of file +{"name":"C","scopeName":"source.c","information_for_contributors":["This code was auto generated by a much-more-readble ruby file: https://github.com/jeff-hykin/cpp-textmate-grammar/blob/master/generate_c.rb","This file essentially an updated/improved fork of the atom syntax https://github.com/atom/language-c/blob/master/grammars/c.cson"],"version":"https://github.com/jeff-hykin/cpp-textmate-grammar/blob/master/syntaxes/c.tmLanguage.json","patterns":[{"include":"#preprocessor-rule-enabled"},{"include":"#preprocessor-rule-disabled"},{"include":"#preprocessor-rule-conditional"},{"include":"#comments"},{"include":"#switch_statement"},{"match":"\\b(break|continue|do|else|for|goto|if|_Pragma|return|while)\\b","name":"keyword.control.c"},{"include":"#storage_types"},{"match":"typedef","name":"keyword.other.typedef.c"},{"match":"\\b(const|extern|register|restrict|static|volatile|inline)\\b","name":"storage.modifier.c"},{"match":"\\bk[A-Z]\\w*\\b","name":"constant.other.variable.mac-classic.c"},{"match":"\\bg[A-Z]\\w*\\b","name":"variable.other.readwrite.global.mac-classic.c"},{"match":"\\bs[A-Z]\\w*\\b","name":"variable.other.readwrite.static.mac-classic.c"},{"match":"\\b(NULL|true|false|TRUE|FALSE)\\b","name":"constant.language.c"},{"include":"#operators"},{"include":"#numbers"},{"include":"#strings"},{"begin":"(?x)\n^\\s* ((\\#)\\s*define) \\s+\t# define\n((?[a-zA-Z_$][\\w$]*))\t # macro name\n(?:\n (\\()\n\t(\n\t \\s* \\g \\s*\t\t # first argument\n\t ((,) \\s* \\g \\s*)* # additional arguments\n\t (?:\\.\\.\\.)?\t\t\t# varargs ellipsis?\n\t)\n (\\))\n)?","beginCaptures":{"1":{"name":"keyword.control.directive.define.c"},"2":{"name":"punctuation.definition.directive.c"},"3":{"name":"entity.name.function.preprocessor.c"},"5":{"name":"punctuation.definition.parameters.begin.c"},"6":{"name":"variable.parameter.preprocessor.c"},"8":{"name":"punctuation.separator.parameters.c"},"9":{"name":"punctuation.definition.parameters.end.c"}},"end":"(?=(?://|/\\*))|(?","endCaptures":{"0":{"name":"punctuation.definition.string.end.c"}},"name":"string.quoted.other.lt-gt.include.c"}]},{"include":"#pragma-mark"},{"begin":"^\\s*((#)\\s*line)\\b","beginCaptures":{"1":{"name":"keyword.control.directive.line.c"},"2":{"name":"punctuation.definition.directive.c"}},"end":"(?=(?://|/\\*))|(?\\]\\)]))\\s*([a-zA-Z_]\\w*)\\s*(?=(?:\\[\\]\\s*)?(?:,|\\)))","captures":{"1":{"name":"variable.parameter.probably.c"}}},"access-method":{"name":"meta.function-call.member.c","begin":"([a-zA-Z_][a-zA-Z_0-9]*|(?<=[\\]\\)]))\\s*(?:(\\.)|(->))((?:(?:[a-zA-Z_][a-zA-Z_0-9]*)\\s*(?:(?:\\.)|(?:->)))*)\\s*([a-zA-Z_][a-zA-Z_0-9]*)(\\()","beginCaptures":{"1":{"name":"variable.object.c"},"2":{"name":"punctuation.separator.dot-access.c"},"3":{"name":"punctuation.separator.pointer-access.c"},"4":{"patterns":[{"match":"\\.","name":"punctuation.separator.dot-access.c"},{"match":"->","name":"punctuation.separator.pointer-access.c"},{"match":"[a-zA-Z_][a-zA-Z_0-9]*","name":"variable.object.c"},{"name":"everything.else.c","match":".+"}]},"5":{"name":"entity.name.function.member.c"},"6":{"name":"punctuation.section.arguments.begin.bracket.round.function.member.c"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.arguments.end.bracket.round.function.member.c"}},"patterns":[{"include":"#function-call-innards"}]},"block":{"patterns":[{"begin":"{","beginCaptures":{"0":{"name":"punctuation.section.block.begin.bracket.curly.c"}},"end":"}|(?=\\s*#\\s*(?:elif|else|endif)\\b)","endCaptures":{"0":{"name":"punctuation.section.block.end.bracket.curly.c"}},"name":"meta.block.c","patterns":[{"include":"#block_innards"}]}]},"block_innards":{"patterns":[{"include":"#preprocessor-rule-enabled-block"},{"include":"#preprocessor-rule-disabled-block"},{"include":"#preprocessor-rule-conditional-block"},{"include":"#method_access"},{"include":"#member_access"},{"include":"#c_function_call"},{"name":"meta.initialization.c","begin":"(?x)\n(?:\n (?:\n\t(?=\\s)(?=+!]+ | \\(\\) | \\[\\]))\n)\n\\s*(\\() # opening bracket","beginCaptures":{"1":{"name":"variable.other.c"},"2":{"name":"punctuation.section.parens.begin.bracket.round.initialization.c"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.initialization.c"}},"patterns":[{"include":"#function-call-innards"}]},{"begin":"{","beginCaptures":{"0":{"name":"punctuation.section.block.begin.bracket.curly.c"}},"end":"}|(?=\\s*#\\s*(?:elif|else|endif)\\b)","endCaptures":{"0":{"name":"punctuation.section.block.end.bracket.curly.c"}},"patterns":[{"include":"#block_innards"}]},{"include":"#parens-block"},{"include":"$base"}]},"c_function_call":{"begin":"(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(?=\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*\\( # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)","end":"(?<=\\))(?!\\w)","name":"meta.function-call.c","patterns":[{"include":"#function-call-innards"}]},"comments":{"patterns":[{"captures":{"1":{"name":"meta.toc-list.banner.block.c"}},"match":"^/\\* =(\\s*.*?)\\s*= \\*/$\\n?","name":"comment.block.c"},{"begin":"/\\*","beginCaptures":{"0":{"name":"punctuation.definition.comment.begin.c"}},"end":"\\*/","endCaptures":{"0":{"name":"punctuation.definition.comment.end.c"}},"name":"comment.block.c"},{"match":"\\*/.*\\n","name":"invalid.illegal.stray-comment-end.c"},{"captures":{"1":{"name":"meta.toc-list.banner.line.c"}},"match":"^// =(\\s*.*?)\\s*=\\s*$\\n?","name":"comment.line.banner.cpp.c"},{"begin":"(^[ \\t]+)?(?=//)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.cpp.c"}},"end":"(?!\\G)","patterns":[{"begin":"//","beginCaptures":{"0":{"name":"punctuation.definition.comment.cpp.c"}},"end":"(?=\\n)","name":"comment.line.double-slash.cpp.c","patterns":[{"include":"#line_continuation_character"}]}]}]},"disabled":{"begin":"^\\s*#\\s*if(n?def)?\\b.*$","end":"^\\s*#\\s*endif\\b","patterns":[{"include":"#disabled"},{"include":"#pragma-mark"}]},"line_continuation_character":{"patterns":[{"match":"(\\\\)\\n","captures":{"1":{"name":"constant.character.escape.line-continuation.c"}}}]},"numbers":{"patterns":[{"match":"\\b((0(x|X)[0-9a-fA-F]([0-9a-fA-F']*[0-9a-fA-F])?)|(0(b|B)[01]([01']*[01])?)|(([0-9]([0-9']*[0-9])?\\.?[0-9]*([0-9']*[0-9])?)|(\\.[0-9]([0-9']*[0-9])?))((e|E)(\\+|-)?[0-9]([0-9']*[0-9])?)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b","name":"constant.numeric.c"}]},"parens":{"name":"meta.parens.c","begin":"\\(","beginCaptures":{"0":{"name":"punctuation.section.parens.begin.bracket.round.c"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.c"}},"patterns":[{"include":"$base"}]},"parens-block":{"name":"meta.parens.block.c","begin":"\\(","beginCaptures":{"0":{"name":"punctuation.section.parens.begin.bracket.round.c"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.c"}},"patterns":[{"include":"#block_innards"},{"match":"(?-mix:(?>=|\\|=","name":"keyword.operator.assignment.compound.bitwise.c"},{"match":"<<|>>","name":"keyword.operator.bitwise.shift.c"},{"match":"!=|<=|>=|==|<|>","name":"keyword.operator.comparison.c"},{"match":"&&|!|\\|\\|","name":"keyword.operator.logical.c"},{"match":"&|\\||\\^|~","name":"keyword.operator.c"},{"match":"=","name":"keyword.operator.assignment.c"},{"match":"%|\\*|/|-|\\+","name":"keyword.operator.c"},{"begin":"(\\?)","beginCaptures":{"1":{"name":"keyword.operator.ternary.c"}},"end":"(:)","endCaptures":{"1":{"name":"keyword.operator.ternary.c"}},"patterns":[{"include":"#function-call-innards"},{"include":"$base"}]}]},"strings":{"patterns":[{"begin":"\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.c"}},"end":"\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.c"}},"name":"string.quoted.double.c","patterns":[{"include":"#string_escaped_char"},{"include":"#string_placeholder"},{"include":"#line_continuation_character"}]},{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.c"}},"end":"'","endCaptures":{"0":{"name":"punctuation.definition.string.end.c"}},"name":"string.quoted.single.c","patterns":[{"include":"#string_escaped_char"},{"include":"#line_continuation_character"}]}]},"string_escaped_char":{"patterns":[{"match":"(?x)\\\\ (\n\\\\\t\t\t |\n[abefnprtv'\"?] |\n[0-3]\\d{,2}\t |\n[4-7]\\d?\t\t|\nx[a-fA-F0-9]{,2} |\nu[a-fA-F0-9]{,4} |\nU[a-fA-F0-9]{,8} )","name":"constant.character.escape.c"},{"match":"\\\\.","name":"invalid.illegal.unknown-escape.c"}]},"string_placeholder":{"patterns":[{"match":"(?x) %\n(\\d+\\$)?\t\t\t\t\t\t # field (argument #)\n[#0\\- +']*\t\t\t\t\t\t # flags\n[,;:_]?\t\t\t\t\t\t\t # separator character (AltiVec)\n((-?\\d+)|\\*(-?\\d+\\$)?)?\t\t # minimum field width\n(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)?\t# precision\n(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier\n[diouxXDOUeEfFgGaACcSspn%]\t\t # conversion type","name":"constant.other.placeholder.c"},{"match":"(%)(?!\"\\s*(PRI|SCN))","captures":{"1":{"name":"invalid.illegal.placeholder.c"}}}]},"storage_types":{"patterns":[{"match":"(?-mix:(?=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)","end":"(?<=\\))(?!\\w)|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()","beginCaptures":{"1":{"name":"entity.name.function.c"},"2":{"name":"punctuation.section.arguments.begin.bracket.round.c"}},"end":"(\\))|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()","beginCaptures":{"1":{"name":"entity.name.function.c"},"2":{"name":"punctuation.section.parameters.begin.bracket.round.c"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parameters.end.bracket.round.c"}},"patterns":[{"include":"#probably_a_parameter"},{"include":"#function-innards"}]},{"begin":"\\(","beginCaptures":{"0":{"name":"punctuation.section.parens.begin.bracket.round.c"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.c"}},"patterns":[{"include":"#function-innards"}]},{"include":"$base"}]},"function-call-innards":{"patterns":[{"include":"#comments"},{"include":"#storage_types"},{"include":"#method_access"},{"include":"#member_access"},{"include":"#operators"},{"begin":"(?x)\n(?!(?:while|for|do|if|else|switch|catch|enumerate|return|typeid|alignof|alignas|sizeof|[cr]?iterate|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++ # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()","beginCaptures":{"1":{"name":"entity.name.function.c"},"2":{"name":"punctuation.section.arguments.begin.bracket.round.c"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.arguments.end.bracket.round.c"}},"patterns":[{"include":"#function-call-innards"}]},{"begin":"\\(","beginCaptures":{"0":{"name":"punctuation.section.parens.begin.bracket.round.c"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.c"}},"patterns":[{"include":"#function-call-innards"}]},{"include":"#block_innards"}]},"default_statement":{"name":"meta.conditional.case.c","begin":"((?\\[\\]=]))","patterns":[{"include":"#switch_conditional_parentheses"},{"name":"meta.head.switch.cpp.c","begin":"\\G| ","end":"((?:\\{|(?=;)))","endCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.switch.cpp.c"}},"patterns":[{"include":"#switch_conditional_parentheses"},{"include":"$base"}]},{"name":"meta.body.switch.cpp.c","begin":"(?<=\\{)","end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.switch.cpp.c"}},"patterns":[{"include":"#default_statement"},{"include":"#case_statement"},{"include":"$base"}]},{"name":"meta.tail.switch.cpp.c","begin":"(?<=})[\\s\\n]*","end":"[\\s\\n]*(?=;)","patterns":[{"include":"$base"}]}]},"switch_conditional_parentheses":{"name":"meta.conditional.switch.c","begin":"(\\()","beginCaptures":{"1":{"name":"punctuation.section.parens.begin.bracket.round.conditional.switch.cpp.c"}},"end":"(\\))","endCaptures":{"1":{"name":"punctuation.section.parens.end.bracket.round.conditional.switch.cpp.c"}},"patterns":[{"include":"#conditional_context"}]},"static_assert":{"begin":"(static_assert|_Static_assert)\\s*(\\()","beginCaptures":{"1":{"name":"keyword.static_assert.cpp.c"},"2":{"name":"punctuation.section.arguments.begin.bracket.round.cpp.c"}},"end":"(\\))","endCaptures":{"1":{"name":"punctuation.section.arguments.end.bracket.round.cpp.c"}},"patterns":[{"name":"meta.static_assert.message.cpp.c","begin":"(,)\\s*(?=(?:L|u8|u|U\\s*\\\")?)","beginCaptures":{"1":{"name":"comma.cpp.c punctuation.separator.delimiter.cpp.c"}},"end":"(?=\\))","patterns":[{"include":"#string_context"},{"include":"#string_context_c"}]},{"include":"#function_call_context_c"}]},"conditional_context":{"patterns":[{"include":"$base"}]},"member_access":{"match":"((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!(?:void|char|short|int|signed|unsigned|long|float|double|bool|_Bool|_Complex|_Imaginary|u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|div_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t|pthread_attr_t|pthread_cond_t|pthread_condattr_t|pthread_mutex_t|pthread_mutexattr_t|pthread_once_t|pthread_rwlock_t|pthread_rwlockattr_t|pthread_t|pthread_key_t|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t|memory_order|atomic_bool|atomic_char|atomic_schar|atomic_uchar|atomic_short|atomic_ushort|atomic_int|atomic_uint|atomic_long|atomic_ulong|atomic_llong|atomic_ullong|atomic_char16_t|atomic_char32_t|atomic_wchar_t|atomic_int_least8_t|atomic_uint_least8_t|atomic_int_least16_t|atomic_uint_least16_t|atomic_int_least32_t|atomic_uint_least32_t|atomic_int_least64_t|atomic_uint_least64_t|atomic_int_fast8_t|atomic_uint_fast8_t|atomic_int_fast16_t|atomic_uint_fast16_t|atomic_int_fast32_t|atomic_uint_fast32_t|atomic_int_fast64_t|atomic_uint_fast64_t|atomic_intptr_t|atomic_uintptr_t|atomic_size_t|atomic_ptrdiff_t|atomic_intmax_t|atomic_uintmax_t))[a-zA-Z_]\\w*\\b(?!\\())","captures":{"1":{"name":"variable.other.object.access.c"},"2":{"name":"punctuation.separator.dot-access.c"},"3":{"name":"punctuation.separator.pointer-access.c"},"4":{"patterns":[{"include":"#member_access"},{"include":"#method_access"},{"match":"((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))","captures":{"1":{"name":"variable.other.object.access.c"},"2":{"name":"punctuation.separator.dot-access.c"},"3":{"name":"punctuation.separator.pointer-access.c"}}}]},"5":{"name":"variable.other.member.c"}}},"method_access":{"contentName":"meta.function-call.member","begin":"((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*([a-zA-Z_]\\w*)(\\()","beginCaptures":{"1":{"name":"variable.other.object.access.c"},"2":{"name":"punctuation.separator.dot-access.c"},"3":{"name":"punctuation.separator.pointer-access.c"},"4":{"patterns":[{"include":"#member_access"},{"include":"#method_access"},{"match":"((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))","captures":{"1":{"name":"variable.other.object.access.c"},"2":{"name":"punctuation.separator.dot-access.c"},"3":{"name":"punctuation.separator.pointer-access.c"}}}]},"5":{"name":"entity.name.function.member.c"},"6":{"name":"punctuation.section.arguments.begin.bracket.round.function.member.c"}},"end":"(\\))","endCaptures":{"1":{"name":"punctuation.section.arguments.end.bracket.round.function.member.c"}},"patterns":[{"include":"#function-call-innards"}]}}} \ No newline at end of file diff --git a/syntaxes/c.tmLanguage.yaml b/syntaxes/c.tmLanguage.yaml index e16e1bfd..a981e16a 100644 --- a/syntaxes/c.tmLanguage.yaml +++ b/syntaxes/c.tmLanguage.yaml @@ -1222,6 +1222,28 @@ name: punctuation.section.parens.end.bracket.round.conditional.switch.cpp.c patterns: - include: "#conditional_context" + static_assert: + begin: "(static_assert|_Static_assert)\\s*(\\()" + beginCaptures: + '1': + name: keyword.static_assert.cpp.c + '2': + name: punctuation.section.arguments.begin.bracket.round.cpp.c + end: "(\\))" + endCaptures: + '1': + name: punctuation.section.arguments.end.bracket.round.cpp.c + patterns: + - name: meta.static_assert.message.cpp.c + begin: (,)\s*(?=(?:L|u8|u|U\s*\")?) + beginCaptures: + '1': + name: comma.cpp.c punctuation.separator.delimiter.cpp.c + end: "(?=\\))" + patterns: + - include: "#string_context" + - include: "#string_context_c" + - include: "#function_call_context_c" conditional_context: patterns: - include: "$base" diff --git a/syntaxes/cpp.tmLanguage.json b/syntaxes/cpp.tmLanguage.json index daade663..78c4aa8e 100644 --- a/syntaxes/cpp.tmLanguage.json +++ b/syntaxes/cpp.tmLanguage.json @@ -1 +1 @@ -{"name":"C++","scopeName":"source.cpp","version":"https://github.com/jeff-hykin/cpp-textmate-grammar/blob/master/syntaxes/cpp.tmLanguage.json","information_for_contributors":["This code was auto generated by a much-more-readble ruby file: https://github.com/jeff-hykin/cpp-textmate-grammar/blob/master/generate.rb","This file essentially an updated/improved fork of the atom syntax https://github.com/atom/language-c/blob/master/grammars/c%2B%2B.cson"],"patterns":[{"include":"#parameter_struct"},{"include":"#struct_declare"},{"include":"#special_block_context"},{"include":"#macro_argument"},{"include":"#string_context"},{"include":"#functional_specifiers_pre_parameters"},{"include":"#qualifiers_and_specifiers_post_parameters"},{"include":"#storage_specifiers"},{"include":"#access_control_keywords"},{"include":"#exception_keywords"},{"include":"#other_keywords"},{"include":"#memory_operators"},{"include":"#the_this_keyword"},{"include":"#language_constants"},{"include":"#template_isolated_definition"},{"include":"#template_definition"},{"include":"#scope_resolution"},{"include":"#misc_storage_modifiers_1"},{"include":"#destructor"},{"include":"#destructor_prototype"},{"include":"#lambdas"},{"include":"#preprocessor_context"},{"include":"#comments_context"},{"include":"#switch_statement"},{"include":"#control_flow_keywords"},{"include":"#storage_types"},{"include":"#assembly"},{"include":"#misc_storage_modifiers_2"},{"include":"#operator_overload"},{"include":"#number_literal"},{"include":"#string_context_c"},{"include":"#meta_preprocessor_macro"},{"include":"#meta_preprocessor_diagnostic"},{"include":"#meta_preprocessor_include"},{"include":"#pragma_mark"},{"include":"#meta_preprocessor_line"},{"include":"#meta_preprocessor_undef"},{"include":"#meta_preprocessor_pragma"},{"include":"#operators"},{"include":"#block"},{"include":"#parentheses"},{"include":"#function_definition"},{"include":"#line_continuation_character"},{"include":"#square_brackets"},{"include":"#empty_square_brackets"},{"include":"#semicolon"},{"include":"#comma"}],"repository":{"sizeof_operator":{"contentName":"meta.arguments.operator.sizeof","begin":"((?\\[\\]=]))","patterns":[{"include":"#switch_conditional_parentheses"},{"name":"meta.head.switch.cpp","begin":"\\G| ","end":"((?:\\{|(?=;)))","endCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.switch.cpp"}},"patterns":[{"include":"#switch_conditional_parentheses"},{"include":"$base"}]},{"name":"meta.body.switch.cpp","begin":"(?<=\\{)","end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.switch.cpp"}},"patterns":[{"include":"#default_statement"},{"include":"#case_statement"},{"include":"$base"}]},{"name":"meta.tail.switch.cpp","begin":"(?<=})[\\s\\n]*","end":"[\\s\\n]*(?=;)","patterns":[{"include":"$base"}]}]},"attributes":{"name":"support.other.attribute.cpp","begin":"((?:\\[\\[|__attribute\\(\\(|__attribute__\\(\\(|__declspec\\())","beginCaptures":{"1":{"name":"punctuation.section.attribute.begin.cpp"}},"end":"((?:\\]\\]|\\)\\)|\\)))","endCaptures":{"1":{"name":"punctuation.section.attribute.end.cpp"}},"patterns":[{"include":"#attributes"},{"begin":"\\(","end":"\\)","patterns":[{"include":"#attributes"},{"include":"#string_context_c"}]},{"match":"(using)\\s+((?:,\\w])*>\\s*","captures":{"0":{"name":"meta.template.call.cpp","patterns":[{"include":"#template_call_context"}]}}},"template_call_range":{"name":"meta.template.call.cpp","begin":"(<)","beginCaptures":{"1":{"name":"punctuation.section.angle-brackets.begin.template.call.cpp"}},"end":"(>)","endCaptures":{"1":{"name":"punctuation.section.angle-brackets.end.template.call.cpp"}},"patterns":[{"include":"#template_call_context"}]},"template_isolated_definition":{"match":"(?\\s*$)","captures":{"1":{"name":"storage.type.template.cpp"},"2":{"name":"punctuation.section.angle-brackets.start.template.definition.cpp"},"3":{"name":"meta.template.definition.cpp","patterns":[{"include":"#template_definition_context"}]},"4":{"name":"punctuation.section.angle-brackets.end.template.definition.cpp"}}},"template_definition":{"name":"meta.template.definition.cpp","begin":"(?)","endCaptures":{"1":{"name":"punctuation.section.angle-brackets.end.template.definition.cpp"}},"patterns":[{"begin":"((?<=\\w)\\s*<)","beginCaptures":{"1":{"name":"punctuation.section.angle-brackets.begin.template.call.cpp"}},"end":"(>)","endCaptures":{"1":{"name":"punctuation.section.angle-brackets.begin.template.call.cpp"}},"patterns":[{"include":"#template_call_context"}]},{"include":"#template_definition_context"}]},"template_argument_defaulted":{"match":"(?<=<|,)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s+)*)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)\\s*([=])","captures":{"1":{"name":"storage.type.template.cpp"},"2":{"name":"entity.name.type.template.cpp"},"3":{"name":"keyword.operator.assignment.cpp"}}},"template_definition_argument":{"match":"(?:(?:\\s*((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)|((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s+)+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*))|((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)\\s*(\\.\\.\\.)\\s*((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*))\\s*(?:(,)|(?=>|$))","captures":{"1":{"name":"storage.type.template.argument.$1.cpp"},"2":{"name":"storage.type.template.argument.$2.cpp"},"3":{"name":"entity.name.type.template.cpp"},"4":{"name":"storage.type.template.cpp"},"5":{"name":"ellipses.cpp punctuation.vararg-ellipses.template.definition.cpp"},"6":{"name":"entity.name.type.template.cpp"},"7":{"name":"comma.cpp punctuation.separator.template.argument.cpp"}}},"scope_resolution":{"match":"((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?:(?-mix:(?:<(?:[\\s<>:,\\w])*>\\s*)))?::)*\\s*)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)\\s*(?:(<(?:[\\s<>:,\\w])*>\\s*))?(::)","captures":{"1":{"patterns":[{"include":"#scope_resolution"}]},"2":{"name":"entity.name.type.namespace.scope-resolution.cpp"},"3":{"name":"meta.template.call.cpp","patterns":[{"include":"#template_call_context"}]},"4":{"name":"punctuation.separator.namespace.access.cpp"}},"name":"meta.scope-resolution.cpp"},"struct_declare":{"match":"(struct)\\s+((?:,\\w])*>\\s*)))?::)*\\s*)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)\\s*(?:(<(?:[\\s<>:,\\w])*>\\s*))?(\\()","beginCaptures":{"1":{"patterns":[{"include":"#scope_resolution"}]},"2":{"name":"entity.name.function.call.cpp"},"3":{"name":"meta.template.call.cpp","patterns":[{"include":"#template_call_context"}]},"4":{"name":"punctuation.section.arguments.begin.bracket.round.cpp"}},"end":"(\\))","endCaptures":{"1":{"name":"punctuation.section.arguments.end.bracket.round.cpp"}},"patterns":[{"include":"#function_call_context_c"}]},"operators":{"patterns":[{"include":"#sizeof_operator"},{"include":"#alignof_operator"},{"include":"#alignas_operator"},{"include":"#typeid_operator"},{"include":"#decltype_specifier"},{"match":"(?>=|\\|=","name":"keyword.operator.assignment.compound.bitwise.cpp"},{"match":"<<|>>","name":"keyword.operator.bitwise.shift.cpp"},{"match":"!=|<=|>=|==|<|>","name":"keyword.operator.comparison.cpp"},{"match":"&&|!|\\|\\|","name":"keyword.operator.logical.cpp"},{"match":"&|\\||\\^|~","name":"keyword.operator.cpp"},{"match":"=","name":"keyword.operator.assignment.cpp"},{"match":"%|\\*|/|-|\\+","name":"keyword.operator.cpp"},{"begin":"\\?","beginCaptures":{"0":{"name":"keyword.operator.ternary.cpp"}},"end":":","applyEndPatternLast":true,"endCaptures":{"0":{"name":"keyword.operator.ternary.cpp"}},"patterns":[{"include":"#method_access"},{"include":"#member_access"},{"include":"#function_call_c"},{"include":"$base"}]}]},"probably_a_parameter":{"match":"(?:((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?==))|((?<=\\w |\\*\\/|[&*>\\]\\)]|\\.\\.\\.)\\s*(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?=(?:\\[\\]\\s*)?(?:,|\\)))))","captures":{"1":{"name":"variable.parameter.defaulted.cpp"},"2":{"name":"variable.parameter.cpp"}}},"operator_overload":{"name":"meta.function.definition.parameters.operator-overload.cpp","begin":"(operator)((?:\\s*(?:\\+\\+|\\-\\-|\\(\\)|\\[\\]|\\->|\\+\\+|\\-\\-|\\+|\\-|!|~|\\*|&|\\->\\*|\\*|\\/|%|\\+|\\-|<<|>>|<=>|<|<=|>|>=|==|!=|&|\\^|\\||&&|\\|\\||=|\\+=|\\-=|\\*=|\\/=|%=|<<=|>>=|&=|\\^=|\\|=|,)|\\s+(?:(?:new|new\\[\\]|delete|delete\\[\\])|(?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?:(?-mix:(?:<(?:[\\s<>:,\\w])*>\\s*)))?::)*(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?:&)?)))\\s*(\\()","beginCaptures":{"1":{"name":"keyword.other.operator.overload.cpp"},"2":{"name":"entity.name.operator.overloadee.cpp","patterns":[{"include":"#scope_resolution"}]},"3":{"name":"punctuation.section.parameters.begin.bracket.round.operator-overload.cpp"}},"end":"(\\))","endCaptures":{"1":{"name":"punctuation.section.parameters.end.bracket.round.operator-overload.cpp"}},"patterns":[{"include":"#probably_a_parameter"},{"include":"#function_context_c"}]},"member_access":{"match":"(?:((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!auto[^(?-mix:\\w)]|void[^(?-mix:\\w)]|char[^(?-mix:\\w)]|short[^(?-mix:\\w)]|int[^(?-mix:\\w)]|signed[^(?-mix:\\w)]|unsigned[^(?-mix:\\w)]|long[^(?-mix:\\w)]|float[^(?-mix:\\w)]|double[^(?-mix:\\w)]|bool[^(?-mix:\\w)]|wchar_t[^(?-mix:\\w)]|u_char[^(?-mix:\\w)]|u_short[^(?-mix:\\w)]|u_int[^(?-mix:\\w)]|u_long[^(?-mix:\\w)]|ushort[^(?-mix:\\w)]|uint[^(?-mix:\\w)]|u_quad_t[^(?-mix:\\w)]|quad_t[^(?-mix:\\w)]|qaddr_t[^(?-mix:\\w)]|caddr_t[^(?-mix:\\w)]|daddr_t[^(?-mix:\\w)]|div_t[^(?-mix:\\w)]|dev_t[^(?-mix:\\w)]|fixpt_t[^(?-mix:\\w)]|blkcnt_t[^(?-mix:\\w)]|blksize_t[^(?-mix:\\w)]|gid_t[^(?-mix:\\w)]|in_addr_t[^(?-mix:\\w)]|in_port_t[^(?-mix:\\w)]|ino_t[^(?-mix:\\w)]|key_t[^(?-mix:\\w)]|mode_t[^(?-mix:\\w)]|nlink_t[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|pid_t[^(?-mix:\\w)]|off_t[^(?-mix:\\w)]|segsz_t[^(?-mix:\\w)]|swblk_t[^(?-mix:\\w)]|uid_t[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|clock_t[^(?-mix:\\w)]|size_t[^(?-mix:\\w)]|ssize_t[^(?-mix:\\w)]|time_t[^(?-mix:\\w)]|useconds_t[^(?-mix:\\w)]|suseconds_t[^(?-mix:\\w)]|int8_t[^(?-mix:\\w)]|int16_t[^(?-mix:\\w)]|int32_t[^(?-mix:\\w)]|int64_t[^(?-mix:\\w)]|uint8_t[^(?-mix:\\w)]|uint16_t[^(?-mix:\\w)]|uint32_t[^(?-mix:\\w)]|uint64_t[^(?-mix:\\w)]|int_least8_t[^(?-mix:\\w)]|int_least16_t[^(?-mix:\\w)]|int_least32_t[^(?-mix:\\w)]|int_least64_t[^(?-mix:\\w)]|uint_least8_t[^(?-mix:\\w)]|uint_least16_t[^(?-mix:\\w)]|uint_least32_t[^(?-mix:\\w)]|uint_least64_t[^(?-mix:\\w)]|int_fast8_t[^(?-mix:\\w)]|int_fast16_t[^(?-mix:\\w)]|int_fast32_t[^(?-mix:\\w)]|int_fast64_t[^(?-mix:\\w)]|uint_fast8_t[^(?-mix:\\w)]|uint_fast16_t[^(?-mix:\\w)]|uint_fast32_t[^(?-mix:\\w)]|uint_fast64_t[^(?-mix:\\w)]|intptr_t[^(?-mix:\\w)]|uintptr_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)])(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\b(?!\\())","captures":{"1":{"name":"variable.language.this.cpp"},"2":{"name":"variable.other.object.access.cpp"},"3":{"name":"punctuation.separator.dot-access.cpp"},"4":{"name":"punctuation.separator.pointer-access.cpp"},"5":{"patterns":[{"match":"(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?-mix:(?:(?:(?\\*|->))))","name":"variable.other.object.property.cpp"},{"match":"(?:((?\\*|->)))","captures":{"1":{"name":"variable.language.this.cpp"},"2":{"name":"variable.other.object.access.cpp"},"3":{"name":"punctuation.separator.dot-access.cpp"},"4":{"name":"punctuation.separator.pointer-access.cpp"}}},{"include":"#member_access"},{"include":"#method_access"}]},"6":{"name":"variable.other.property.cpp"}}},"method_access":{"contentName":"meta.function-call.member","begin":"(?:((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)(\\()","beginCaptures":{"1":{"name":"variable.language.this.cpp"},"2":{"name":"variable.other.object.access.cpp"},"3":{"name":"punctuation.separator.dot-access.cpp"},"4":{"name":"punctuation.separator.pointer-access.cpp"},"5":{"patterns":[{"match":"(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?-mix:(?:(?:(?\\*|->))))","name":"variable.other.object.property.cpp"},{"match":"(?:((?\\*|->)))","captures":{"1":{"name":"variable.language.this.cpp"},"2":{"name":"variable.other.object.access.cpp"},"3":{"name":"punctuation.separator.dot-access.cpp"},"4":{"name":"punctuation.separator.pointer-access.cpp"}}},{"include":"#member_access"},{"include":"#method_access"}]},"6":{"name":"entity.name.function.member.cpp"},"7":{"name":"punctuation.section.arguments.begin.bracket.round.function.member.cpp"}},"end":"(\\))","endCaptures":{"1":{"name":"punctuation.section.arguments.end.bracket.round.function.member.cpp"}},"patterns":[{"include":"#function_call_context_c"}]},"using_namespace":{"name":"meta.using-namespace.cpp","begin":"(?:,\\w])*>\\s*)))?::)*\\s*))?((?:,\\w])*>\\s*)))?::)*\\s*)\\s*(?:((?\\[\\]=]))","patterns":[{"name":"meta.head.namespace.cpp","begin":"\\G| ","end":"((?:\\{|(?=;)))","endCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.namespace.cpp"}}},{"name":"meta.body.namespace.cpp","begin":"(?<=\\{)","end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.namespace.cpp"}},"patterns":[{"include":"$base"}]},{"name":"meta.tail.namespace.cpp","begin":"(?<=})[\\s\\n]*","end":"[\\s\\n]*(?=;)","patterns":[{"include":"$base"}]}]},"macro_argument":{"match":"##(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*(?!\\w)","name":"variable.other.macro.argument.cpp"},"lambdas":{"begin":"((?:(?<=[^\\s]|^)(?)(.+?(?=\\{|$))?","captures":{"1":{"name":"punctuation.definition.lambda.return-type.cpp"},"2":{"name":"storage.type.return-type.lambda.cpp"}}},{"name":"meta.function.definition.body.lambda.cpp","begin":"(\\{)","beginCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.lambda.cpp"}},"end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.lambda.cpp"}},"patterns":[{"include":"$base"}]}]},"pthread_types":{"match":"(?:,\\w])*>\\s*)))?::)*\\s*)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)\\s*(?:(<(?:[\\s<>:,\\w])*>\\s*))?(::)))?\\s*((?\\[\\]=]))","endCaptures":{"1":{"name":"punctuation.terminator.statement.cpp"},"2":{"name":"punctuation.terminator.statement.cpp"}},"patterns":[{"name":"meta.head.enum.cpp","begin":"\\G| ","end":"((?:\\{|(?=;)))","endCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.enum.cpp"}},"patterns":[{"include":"$base"}]},{"name":"meta.body.enum.cpp","begin":"(?<=\\{)","end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.enum.cpp"}},"patterns":[{"include":"$base"}]},{"name":"meta.tail.enum.cpp","begin":"(?<=})[\\s\\n]*","end":"[\\s\\n]*(?=;)","patterns":[{"include":"$base"}]}]},"inhertance_context":{"patterns":[{"match":",","name":"comma.cpp punctuation.separator.delimiter.inhertance.cpp"},{"match":"(?\\[\\]=]))","endCaptures":{"1":{"name":"punctuation.terminator.statement.cpp"},"2":{"name":"punctuation.terminator.statement.cpp"}},"patterns":[{"name":"meta.head.class.cpp","begin":"\\G| ","end":"((?:\\{|(?=;)))","endCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.class.cpp"}},"patterns":[{"include":"#preprocessor_context"},{"include":"#inhertance_context"},{"include":"#template_call_range"},{"include":"#comments_context"}]},{"name":"meta.body.class.cpp","begin":"(?<=\\{)","end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.class.cpp"}},"patterns":[{"include":"#constructor_context"},{"include":"$base"}]},{"name":"meta.tail.class.cpp","begin":"(?<=})[\\s\\n]*","end":"[\\s\\n]*(?=;)","patterns":[{"include":"$base"}]}]},"struct_block":{"name":"meta.block.struct.cpp","begin":"((((?\\[\\]=]))","endCaptures":{"1":{"name":"punctuation.terminator.statement.cpp"},"2":{"name":"punctuation.terminator.statement.cpp"}},"patterns":[{"name":"meta.head.struct.cpp","begin":"\\G| ","end":"((?:\\{|(?=;)))","endCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.struct.cpp"}},"patterns":[{"include":"#preprocessor_context"},{"include":"#inhertance_context"},{"include":"#template_call_range"},{"include":"#comments_context"}]},{"name":"meta.body.struct.cpp","begin":"(?<=\\{)","end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.struct.cpp"}},"patterns":[{"include":"#constructor_context"},{"include":"$base"}]},{"name":"meta.tail.struct.cpp","begin":"(?<=})[\\s\\n]*","end":"[\\s\\n]*(?=;)","patterns":[{"include":"$base"}]}]},"union_block":{"name":"meta.block.union.cpp","begin":"((((?\\[\\]=]))","endCaptures":{"1":{"name":"punctuation.terminator.statement.cpp"},"2":{"name":"punctuation.terminator.statement.cpp"}},"patterns":[{"name":"meta.head.union.cpp","begin":"\\G| ","end":"((?:\\{|(?=;)))","endCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.union.cpp"}},"patterns":[{"include":"#preprocessor_context"},{"include":"#inhertance_context"},{"include":"#template_call_range"},{"include":"#comments_context"}]},{"name":"meta.body.union.cpp","begin":"(?<=\\{)","end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.union.cpp"}},"patterns":[{"include":"#constructor_context"},{"include":"$base"}]},{"name":"meta.tail.union.cpp","begin":"(?<=})[\\s\\n]*","end":"[\\s\\n]*(?=;)","patterns":[{"include":"$base"}]}]},"extern_block":{"name":"meta.block.extern.cpp","begin":"((\\bextern)(?=\\s*\\\"))","beginCaptures":{"1":{"name":"meta.head.extern.cpp"},"2":{"name":"storage.type.extern.cpp"}},"end":"(?:(?:(?<=})\\s*(;)|(;))|(?=[;>\\[\\]=]))","endCaptures":{"1":{"name":"punctuation.terminator.statement.cpp"},"2":{"name":"punctuation.terminator.statement.cpp"}},"patterns":[{"name":"meta.head.extern.cpp","begin":"\\G| ","end":"((?:\\{|(?=;)))","endCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.extern.cpp"}},"patterns":[{"include":"$base"}]},{"name":"meta.body.extern.cpp","begin":"(?<=\\{)","end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.extern.cpp"}},"patterns":[{"include":"$base"}]},{"name":"meta.tail.extern.cpp","begin":"(?<=})[\\s\\n]*","end":"[\\s\\n]*(?=;)","patterns":[{"include":"$base"}]},{"include":"$base"}]},"hacky_fix_for_stray_directive":{"match":"(?(?-mix:[a-zA-Z_$][\\w$]*)))\t # macro name\n(?:\n (\\()\n\t(\n\t \\s* \\g \\s*\t\t # first argument\n\t ((,) \\s* \\g \\s*)* # additional arguments\n\t (?:\\.\\.\\.)?\t\t\t# varargs ellipsis?\n\t)\n (\\))\n)?","beginCaptures":{"1":{"name":"keyword.control.directive.define.cpp"},"2":{"name":"punctuation.definition.directive.cpp"},"3":{"name":"entity.name.function.preprocessor.cpp"},"5":{"name":"punctuation.definition.parameters.begin.cpp"},"6":{"name":"variable.parameter.preprocessor.cpp"},"8":{"name":"punctuation.separator.parameters.cpp"},"9":{"name":"punctuation.definition.parameters.end.cpp"}},"end":"(?=(?://|/\\*))|(?","endCaptures":{"0":{"name":"punctuation.definition.string.end.cpp"}},"name":"string.quoted.other.lt-gt.include.cpp"}]},"meta_preprocessor_line":{"name":"meta.preprocessor.cpp","begin":"^\\s*((#)\\s*line)\\b","beginCaptures":{"1":{"name":"keyword.control.directive.line.cpp"},"2":{"name":"punctuation.definition.directive.cpp"}},"end":"(?=(?://|/\\*))|(?=+!]+ | \\(\\) | \\[\\]))\n)\n\\s*(\\() # opening bracket","beginCaptures":{"1":{"name":"variable.other.cpp"},"2":{"name":"punctuation.section.parens.begin.bracket.round.initialization.cpp"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.initialization.cpp"}},"patterns":[{"include":"#function_call_context_c"}]},{"begin":"{","beginCaptures":{"0":{"name":"punctuation.section.block.begin.bracket.curly.cpp"}},"end":"}|(?=\\s*#\\s*(?:elif|else|endif)\\b)","endCaptures":{"0":{"name":"punctuation.section.block.end.bracket.curly.cpp"}},"patterns":[{"include":"#block_context"}]},{"include":"#parentheses_block"},{"include":"$base"}]},"function_call_c":{"begin":"(?x)\n(?!(?:while|for|do|if|else|switch|catch|return|typeid|alignof|alignas|sizeof|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas|constexpr|volatile|operator|(?:::)?new|(?:::)?delete)\\s*\\()\n(?=\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*(?-mix:(?:(?-mix:(?:<(?:[\\s<>:,\\w])*>\\s*)))?)\\( # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)","end":"(?<=\\))(?!\\w)","name":"meta.function-call.cpp","patterns":[{"include":"#function_call_context_c"}]},"comments_context":{"patterns":[{"captures":{"1":{"name":"meta.toc-list.banner.block.cpp"}},"match":"^/\\* =(\\s*.*?)\\s*= \\*/$\\n?","name":"comment.block.cpp"},{"begin":"/\\*","beginCaptures":{"0":{"name":"punctuation.definition.comment.begin.cpp"}},"end":"\\*/","endCaptures":{"0":{"name":"punctuation.definition.comment.end.cpp"}},"name":"comment.block.cpp"},{"captures":{"1":{"name":"meta.toc-list.banner.line.cpp"}},"match":"^// =(\\s*.*?)\\s*=\\s*$\\n?","name":"comment.line.banner.cpp"},{"begin":"(^[ \\t]+)?(?=//)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.cpp"}},"end":"(?!\\G)","patterns":[{"begin":"//","beginCaptures":{"0":{"name":"punctuation.definition.comment.cpp"}},"end":"(?=\\n)","name":"comment.line.double-slash.cpp","patterns":[{"include":"#line_continuation_character"}]}]}]},"disabled":{"begin":"^\\s*#\\s*if(n?def)?\\b.*$","end":"^\\s*#\\s*endif\\b","patterns":[{"include":"#disabled"},{"include":"#pragma_mark"}]},"line_continuation_character":{"match":"(\\\\)\\n","captures":{"1":{"name":"constant.character.escape.line-continuation.cpp"}}},"parentheses":{"name":"meta.parens.cpp","begin":"\\(","beginCaptures":{"0":{"name":"punctuation.section.parens.begin.bracket.round.cpp"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.cpp"}},"patterns":[{"include":"$base"}]},"parentheses_block":{"name":"meta.parens.block.cpp","begin":"\\(","beginCaptures":{"0":{"name":"punctuation.section.parens.begin.bracket.round.cpp"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.cpp"}},"patterns":[{"include":"#block_context"},{"match":"(?-mix:(?=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)","end":"(?<=\\))(?!\\w)|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()","beginCaptures":{"1":{"name":"entity.name.function.cpp"},"2":{"name":"punctuation.section.arguments.begin.bracket.round.cpp"}},"end":"(\\))|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()","beginCaptures":{"1":{"name":"entity.name.function.cpp"},"2":{"name":"punctuation.section.parameters.begin.bracket.round.cpp"}},"end":"(?-mix:\\)|:)","endCaptures":{"0":{"name":"punctuation.section.parameters.end.bracket.round.cpp"}},"patterns":[{"include":"#probably_a_parameter"},{"include":"#function_context_c"}]},{"begin":"\\(","beginCaptures":{"0":{"name":"punctuation.section.parens.begin.bracket.round.cpp"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.cpp"}},"patterns":[{"include":"#function_context_c"}]},{"include":"$base"}]},"function_call_context_c":{"patterns":[{"include":"#attributes"},{"include":"#comments_context"},{"include":"#storage_types"},{"include":"#method_access"},{"include":"#member_access"},{"include":"#operators"},{"begin":"(?x)\n(?!(?:while|for|do|if|else|switch|catch|return|typeid|alignof|alignas|sizeof|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:new)\\s*((?-mix:(?:(?-mix:(?:<(?:[\\s<>:,\\w])*>\\s*)))?)) # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()","beginCaptures":{"1":{"name":"keyword.operator.wordlike.cpp memory.cpp keyword.operator.new.cpp"},"2":{"patterns":[{"include":"#template_call_innards"}]},"3":{"name":"punctuation.section.arguments.begin.bracket.round.cpp"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.arguments.end.bracket.round.cpp"}},"patterns":[{"include":"#function_call_context_c"}]},{"include":"#function_call"},{"begin":"\\(","beginCaptures":{"0":{"name":"punctuation.section.parens.begin.bracket.round.cpp"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.cpp"}},"patterns":[{"include":"#function_call_context_c"}]},{"include":"#block_context"}]}}} \ No newline at end of file +{"name":"C++","scopeName":"source.cpp","version":"https://github.com/jeff-hykin/cpp-textmate-grammar/blob/master/syntaxes/cpp.tmLanguage.json","information_for_contributors":["This code was auto generated by a much-more-readble ruby file: https://github.com/jeff-hykin/cpp-textmate-grammar/blob/master/generate.rb","This file essentially an updated/improved fork of the atom syntax https://github.com/atom/language-c/blob/master/grammars/c%2B%2B.cson"],"patterns":[{"include":"#parameter_struct"},{"include":"#struct_declare"},{"include":"#special_block_context"},{"include":"#macro_argument"},{"include":"#string_context"},{"include":"#functional_specifiers_pre_parameters"},{"include":"#qualifiers_and_specifiers_post_parameters"},{"include":"#storage_specifiers"},{"include":"#access_control_keywords"},{"include":"#exception_keywords"},{"include":"#static_assert"},{"include":"#other_keywords"},{"include":"#memory_operators"},{"include":"#the_this_keyword"},{"include":"#language_constants"},{"include":"#template_isolated_definition"},{"include":"#template_definition"},{"include":"#scope_resolution"},{"include":"#misc_storage_modifiers_1"},{"include":"#destructor"},{"include":"#destructor_prototype"},{"include":"#lambdas"},{"include":"#preprocessor_context"},{"include":"#comments_context"},{"include":"#switch_statement"},{"include":"#control_flow_keywords"},{"include":"#storage_types"},{"include":"#assembly"},{"include":"#misc_storage_modifiers_2"},{"include":"#operator_overload"},{"include":"#number_literal"},{"include":"#string_context_c"},{"include":"#meta_preprocessor_macro"},{"include":"#meta_preprocessor_diagnostic"},{"include":"#meta_preprocessor_include"},{"include":"#pragma_mark"},{"include":"#meta_preprocessor_line"},{"include":"#meta_preprocessor_undef"},{"include":"#meta_preprocessor_pragma"},{"include":"#operators"},{"include":"#block"},{"include":"#parentheses"},{"include":"#function_definition"},{"include":"#line_continuation_character"},{"include":"#square_brackets"},{"include":"#empty_square_brackets"},{"include":"#semicolon"},{"include":"#comma"}],"repository":{"sizeof_operator":{"contentName":"meta.arguments.operator.sizeof","begin":"((?\\[\\]=]))","patterns":[{"include":"#switch_conditional_parentheses"},{"name":"meta.head.switch.cpp","begin":"\\G| ","end":"((?:\\{|(?=;)))","endCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.switch.cpp"}},"patterns":[{"include":"#switch_conditional_parentheses"},{"include":"$base"}]},{"name":"meta.body.switch.cpp","begin":"(?<=\\{)","end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.switch.cpp"}},"patterns":[{"include":"#default_statement"},{"include":"#case_statement"},{"include":"$base"}]},{"name":"meta.tail.switch.cpp","begin":"(?<=})[\\s\\n]*","end":"[\\s\\n]*(?=;)","patterns":[{"include":"$base"}]}]},"attributes":{"name":"support.other.attribute.cpp","begin":"((?:\\[\\[|__attribute\\(\\(|__attribute__\\(\\(|__declspec\\())","beginCaptures":{"1":{"name":"punctuation.section.attribute.begin.cpp"}},"end":"((?:\\]\\]|\\)\\)|\\)))","endCaptures":{"1":{"name":"punctuation.section.attribute.end.cpp"}},"patterns":[{"include":"#attributes"},{"begin":"\\(","end":"\\)","patterns":[{"include":"#attributes"},{"include":"#string_context_c"}]},{"match":"(using)\\s+((?:,\\w])*>\\s*","captures":{"0":{"name":"meta.template.call.cpp","patterns":[{"include":"#template_call_context"}]}}},"template_call_range":{"name":"meta.template.call.cpp","begin":"(<)","beginCaptures":{"1":{"name":"punctuation.section.angle-brackets.begin.template.call.cpp"}},"end":"(>)","endCaptures":{"1":{"name":"punctuation.section.angle-brackets.end.template.call.cpp"}},"patterns":[{"include":"#template_call_context"}]},"template_isolated_definition":{"match":"(?\\s*$)","captures":{"1":{"name":"storage.type.template.cpp"},"2":{"name":"punctuation.section.angle-brackets.start.template.definition.cpp"},"3":{"name":"meta.template.definition.cpp","patterns":[{"include":"#template_definition_context"}]},"4":{"name":"punctuation.section.angle-brackets.end.template.definition.cpp"}}},"template_definition":{"name":"meta.template.definition.cpp","begin":"(?)","endCaptures":{"1":{"name":"punctuation.section.angle-brackets.end.template.definition.cpp"}},"patterns":[{"begin":"((?<=\\w)\\s*<)","beginCaptures":{"1":{"name":"punctuation.section.angle-brackets.begin.template.call.cpp"}},"end":"(>)","endCaptures":{"1":{"name":"punctuation.section.angle-brackets.begin.template.call.cpp"}},"patterns":[{"include":"#template_call_context"}]},{"include":"#template_definition_context"}]},"template_argument_defaulted":{"match":"(?<=<|,)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s+)*)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)\\s*([=])","captures":{"1":{"name":"storage.type.template.cpp"},"2":{"name":"entity.name.type.template.cpp"},"3":{"name":"keyword.operator.assignment.cpp"}}},"template_definition_argument":{"match":"(?:(?:\\s*((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)|((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s+)+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*))|((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)\\s*(\\.\\.\\.)\\s*((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*))\\s*(?:(,)|(?=>|$))","captures":{"1":{"name":"storage.type.template.argument.$1.cpp"},"2":{"name":"storage.type.template.argument.$2.cpp"},"3":{"name":"entity.name.type.template.cpp"},"4":{"name":"storage.type.template.cpp"},"5":{"name":"ellipses.cpp punctuation.vararg-ellipses.template.definition.cpp"},"6":{"name":"entity.name.type.template.cpp"},"7":{"name":"comma.cpp punctuation.separator.template.argument.cpp"}}},"scope_resolution":{"match":"((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?:(?-mix:(?:<(?:[\\s<>:,\\w])*>\\s*)))?::)*\\s*)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)\\s*(?:(<(?:[\\s<>:,\\w])*>\\s*))?(::)","captures":{"1":{"patterns":[{"include":"#scope_resolution"}]},"2":{"name":"entity.name.type.namespace.scope-resolution.cpp"},"3":{"name":"meta.template.call.cpp","patterns":[{"include":"#template_call_context"}]},"4":{"name":"punctuation.separator.namespace.access.cpp"}},"name":"meta.scope-resolution.cpp"},"struct_declare":{"match":"(struct)\\s+((?:,\\w])*>\\s*)))?::)*\\s*)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)\\s*(?:(<(?:[\\s<>:,\\w])*>\\s*))?(\\()","beginCaptures":{"1":{"patterns":[{"include":"#scope_resolution"}]},"2":{"name":"entity.name.function.call.cpp"},"3":{"name":"meta.template.call.cpp","patterns":[{"include":"#template_call_context"}]},"4":{"name":"punctuation.section.arguments.begin.bracket.round.cpp"}},"end":"(\\))","endCaptures":{"1":{"name":"punctuation.section.arguments.end.bracket.round.cpp"}},"patterns":[{"include":"#function_call_context_c"}]},"operators":{"patterns":[{"include":"#sizeof_operator"},{"include":"#alignof_operator"},{"include":"#alignas_operator"},{"include":"#typeid_operator"},{"include":"#decltype_specifier"},{"match":"(?>=|\\|=","name":"keyword.operator.assignment.compound.bitwise.cpp"},{"match":"<<|>>","name":"keyword.operator.bitwise.shift.cpp"},{"match":"!=|<=|>=|==|<|>","name":"keyword.operator.comparison.cpp"},{"match":"&&|!|\\|\\|","name":"keyword.operator.logical.cpp"},{"match":"&|\\||\\^|~","name":"keyword.operator.cpp"},{"match":"=","name":"keyword.operator.assignment.cpp"},{"match":"%|\\*|/|-|\\+","name":"keyword.operator.cpp"},{"begin":"\\?","beginCaptures":{"0":{"name":"keyword.operator.ternary.cpp"}},"end":":","applyEndPatternLast":true,"endCaptures":{"0":{"name":"keyword.operator.ternary.cpp"}},"patterns":[{"include":"#method_access"},{"include":"#member_access"},{"include":"#function_call_c"},{"include":"$base"}]}]},"probably_a_parameter":{"match":"(?:((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?==))|((?<=\\w |\\*\\/|[&*>\\]\\)]|\\.\\.\\.)\\s*(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?=(?:\\[\\]\\s*)?(?:,|\\)))))","captures":{"1":{"name":"variable.parameter.defaulted.cpp"},"2":{"name":"variable.parameter.cpp"}}},"operator_overload":{"name":"meta.function.definition.parameters.operator-overload.cpp","begin":"(operator)((?:\\s*(?:\\+\\+|\\-\\-|\\(\\)|\\[\\]|\\->|\\+\\+|\\-\\-|\\+|\\-|!|~|\\*|&|\\->\\*|\\*|\\/|%|\\+|\\-|<<|>>|<=>|<|<=|>|>=|==|!=|&|\\^|\\||&&|\\|\\||=|\\+=|\\-=|\\*=|\\/=|%=|<<=|>>=|&=|\\^=|\\|=|,)|\\s+(?:(?:new|new\\[\\]|delete|delete\\[\\])|(?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?:(?-mix:(?:<(?:[\\s<>:,\\w])*>\\s*)))?::)*(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?:&)?)))\\s*(\\()","beginCaptures":{"1":{"name":"keyword.other.operator.overload.cpp"},"2":{"name":"entity.name.operator.overloadee.cpp","patterns":[{"include":"#scope_resolution"}]},"3":{"name":"punctuation.section.parameters.begin.bracket.round.operator-overload.cpp"}},"end":"(\\))","endCaptures":{"1":{"name":"punctuation.section.parameters.end.bracket.round.operator-overload.cpp"}},"patterns":[{"include":"#probably_a_parameter"},{"include":"#function_context_c"}]},"member_access":{"match":"(?:((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!auto[^(?-mix:\\w)]|void[^(?-mix:\\w)]|char[^(?-mix:\\w)]|short[^(?-mix:\\w)]|int[^(?-mix:\\w)]|signed[^(?-mix:\\w)]|unsigned[^(?-mix:\\w)]|long[^(?-mix:\\w)]|float[^(?-mix:\\w)]|double[^(?-mix:\\w)]|bool[^(?-mix:\\w)]|wchar_t[^(?-mix:\\w)]|u_char[^(?-mix:\\w)]|u_short[^(?-mix:\\w)]|u_int[^(?-mix:\\w)]|u_long[^(?-mix:\\w)]|ushort[^(?-mix:\\w)]|uint[^(?-mix:\\w)]|u_quad_t[^(?-mix:\\w)]|quad_t[^(?-mix:\\w)]|qaddr_t[^(?-mix:\\w)]|caddr_t[^(?-mix:\\w)]|daddr_t[^(?-mix:\\w)]|div_t[^(?-mix:\\w)]|dev_t[^(?-mix:\\w)]|fixpt_t[^(?-mix:\\w)]|blkcnt_t[^(?-mix:\\w)]|blksize_t[^(?-mix:\\w)]|gid_t[^(?-mix:\\w)]|in_addr_t[^(?-mix:\\w)]|in_port_t[^(?-mix:\\w)]|ino_t[^(?-mix:\\w)]|key_t[^(?-mix:\\w)]|mode_t[^(?-mix:\\w)]|nlink_t[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|pid_t[^(?-mix:\\w)]|off_t[^(?-mix:\\w)]|segsz_t[^(?-mix:\\w)]|swblk_t[^(?-mix:\\w)]|uid_t[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|clock_t[^(?-mix:\\w)]|size_t[^(?-mix:\\w)]|ssize_t[^(?-mix:\\w)]|time_t[^(?-mix:\\w)]|useconds_t[^(?-mix:\\w)]|suseconds_t[^(?-mix:\\w)]|int8_t[^(?-mix:\\w)]|int16_t[^(?-mix:\\w)]|int32_t[^(?-mix:\\w)]|int64_t[^(?-mix:\\w)]|uint8_t[^(?-mix:\\w)]|uint16_t[^(?-mix:\\w)]|uint32_t[^(?-mix:\\w)]|uint64_t[^(?-mix:\\w)]|int_least8_t[^(?-mix:\\w)]|int_least16_t[^(?-mix:\\w)]|int_least32_t[^(?-mix:\\w)]|int_least64_t[^(?-mix:\\w)]|uint_least8_t[^(?-mix:\\w)]|uint_least16_t[^(?-mix:\\w)]|uint_least32_t[^(?-mix:\\w)]|uint_least64_t[^(?-mix:\\w)]|int_fast8_t[^(?-mix:\\w)]|int_fast16_t[^(?-mix:\\w)]|int_fast32_t[^(?-mix:\\w)]|int_fast64_t[^(?-mix:\\w)]|uint_fast8_t[^(?-mix:\\w)]|uint_fast16_t[^(?-mix:\\w)]|uint_fast32_t[^(?-mix:\\w)]|uint_fast64_t[^(?-mix:\\w)]|intptr_t[^(?-mix:\\w)]|uintptr_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)])(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\b(?!\\())","captures":{"1":{"name":"variable.language.this.cpp"},"2":{"name":"variable.other.object.access.cpp"},"3":{"name":"punctuation.separator.dot-access.cpp"},"4":{"name":"punctuation.separator.pointer-access.cpp"},"5":{"patterns":[{"match":"(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?-mix:(?:(?:(?\\*|->))))","name":"variable.other.object.property.cpp"},{"match":"(?:((?\\*|->)))","captures":{"1":{"name":"variable.language.this.cpp"},"2":{"name":"variable.other.object.access.cpp"},"3":{"name":"punctuation.separator.dot-access.cpp"},"4":{"name":"punctuation.separator.pointer-access.cpp"}}},{"include":"#member_access"},{"include":"#method_access"}]},"6":{"name":"variable.other.property.cpp"}}},"method_access":{"contentName":"meta.function-call.member","begin":"(?:((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)(\\()","beginCaptures":{"1":{"name":"variable.language.this.cpp"},"2":{"name":"variable.other.object.access.cpp"},"3":{"name":"punctuation.separator.dot-access.cpp"},"4":{"name":"punctuation.separator.pointer-access.cpp"},"5":{"patterns":[{"match":"(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?-mix:(?:(?:(?\\*|->))))","name":"variable.other.object.property.cpp"},{"match":"(?:((?\\*|->)))","captures":{"1":{"name":"variable.language.this.cpp"},"2":{"name":"variable.other.object.access.cpp"},"3":{"name":"punctuation.separator.dot-access.cpp"},"4":{"name":"punctuation.separator.pointer-access.cpp"}}},{"include":"#member_access"},{"include":"#method_access"}]},"6":{"name":"entity.name.function.member.cpp"},"7":{"name":"punctuation.section.arguments.begin.bracket.round.function.member.cpp"}},"end":"(\\))","endCaptures":{"1":{"name":"punctuation.section.arguments.end.bracket.round.function.member.cpp"}},"patterns":[{"include":"#function_call_context_c"}]},"using_namespace":{"name":"meta.using-namespace.cpp","begin":"(?:,\\w])*>\\s*)))?::)*\\s*))?((?:,\\w])*>\\s*)))?::)*\\s*)\\s*(?:((?\\[\\]=]))","patterns":[{"name":"meta.head.namespace.cpp","begin":"\\G| ","end":"((?:\\{|(?=;)))","endCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.namespace.cpp"}}},{"name":"meta.body.namespace.cpp","begin":"(?<=\\{)","end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.namespace.cpp"}},"patterns":[{"include":"$base"}]},{"name":"meta.tail.namespace.cpp","begin":"(?<=})[\\s\\n]*","end":"[\\s\\n]*(?=;)","patterns":[{"include":"$base"}]}]},"macro_argument":{"match":"##(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*(?!\\w)","name":"variable.other.macro.argument.cpp"},"lambdas":{"begin":"((?:(?<=[^\\s]|^)(?)(.+?(?=\\{|$))?","captures":{"1":{"name":"punctuation.definition.lambda.return-type.cpp"},"2":{"name":"storage.type.return-type.lambda.cpp"}}},{"name":"meta.function.definition.body.lambda.cpp","begin":"(\\{)","beginCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.lambda.cpp"}},"end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.lambda.cpp"}},"patterns":[{"include":"$base"}]}]},"pthread_types":{"match":"(?:,\\w])*>\\s*)))?::)*\\s*)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)\\s*(?:(<(?:[\\s<>:,\\w])*>\\s*))?(::)))?\\s*((?\\[\\]=]))","endCaptures":{"1":{"name":"punctuation.terminator.statement.cpp"},"2":{"name":"punctuation.terminator.statement.cpp"}},"patterns":[{"name":"meta.head.enum.cpp","begin":"\\G| ","end":"((?:\\{|(?=;)))","endCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.enum.cpp"}},"patterns":[{"include":"$base"}]},{"name":"meta.body.enum.cpp","begin":"(?<=\\{)","end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.enum.cpp"}},"patterns":[{"include":"$base"}]},{"name":"meta.tail.enum.cpp","begin":"(?<=})[\\s\\n]*","end":"[\\s\\n]*(?=;)","patterns":[{"include":"$base"}]}]},"inhertance_context":{"patterns":[{"match":",","name":"comma.cpp punctuation.separator.delimiter.inhertance.cpp"},{"match":"(?\\[\\]=]))","endCaptures":{"1":{"name":"punctuation.terminator.statement.cpp"},"2":{"name":"punctuation.terminator.statement.cpp"}},"patterns":[{"name":"meta.head.class.cpp","begin":"\\G| ","end":"((?:\\{|(?=;)))","endCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.class.cpp"}},"patterns":[{"include":"#preprocessor_context"},{"include":"#inhertance_context"},{"include":"#template_call_range"},{"include":"#comments_context"}]},{"name":"meta.body.class.cpp","begin":"(?<=\\{)","end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.class.cpp"}},"patterns":[{"include":"#constructor_context"},{"include":"$base"}]},{"name":"meta.tail.class.cpp","begin":"(?<=})[\\s\\n]*","end":"[\\s\\n]*(?=;)","patterns":[{"include":"$base"}]}]},"struct_block":{"name":"meta.block.struct.cpp","begin":"((((?\\[\\]=]))","endCaptures":{"1":{"name":"punctuation.terminator.statement.cpp"},"2":{"name":"punctuation.terminator.statement.cpp"}},"patterns":[{"name":"meta.head.struct.cpp","begin":"\\G| ","end":"((?:\\{|(?=;)))","endCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.struct.cpp"}},"patterns":[{"include":"#preprocessor_context"},{"include":"#inhertance_context"},{"include":"#template_call_range"},{"include":"#comments_context"}]},{"name":"meta.body.struct.cpp","begin":"(?<=\\{)","end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.struct.cpp"}},"patterns":[{"include":"#constructor_context"},{"include":"$base"}]},{"name":"meta.tail.struct.cpp","begin":"(?<=})[\\s\\n]*","end":"[\\s\\n]*(?=;)","patterns":[{"include":"$base"}]}]},"union_block":{"name":"meta.block.union.cpp","begin":"((((?\\[\\]=]))","endCaptures":{"1":{"name":"punctuation.terminator.statement.cpp"},"2":{"name":"punctuation.terminator.statement.cpp"}},"patterns":[{"name":"meta.head.union.cpp","begin":"\\G| ","end":"((?:\\{|(?=;)))","endCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.union.cpp"}},"patterns":[{"include":"#preprocessor_context"},{"include":"#inhertance_context"},{"include":"#template_call_range"},{"include":"#comments_context"}]},{"name":"meta.body.union.cpp","begin":"(?<=\\{)","end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.union.cpp"}},"patterns":[{"include":"#constructor_context"},{"include":"$base"}]},{"name":"meta.tail.union.cpp","begin":"(?<=})[\\s\\n]*","end":"[\\s\\n]*(?=;)","patterns":[{"include":"$base"}]}]},"extern_block":{"name":"meta.block.extern.cpp","begin":"((\\bextern)(?=\\s*\\\"))","beginCaptures":{"1":{"name":"meta.head.extern.cpp"},"2":{"name":"storage.type.extern.cpp"}},"end":"(?:(?:(?<=})\\s*(;)|(;))|(?=[;>\\[\\]=]))","endCaptures":{"1":{"name":"punctuation.terminator.statement.cpp"},"2":{"name":"punctuation.terminator.statement.cpp"}},"patterns":[{"name":"meta.head.extern.cpp","begin":"\\G| ","end":"((?:\\{|(?=;)))","endCaptures":{"1":{"name":"punctuation.section.block.begin.bracket.curly.extern.cpp"}},"patterns":[{"include":"$base"}]},{"name":"meta.body.extern.cpp","begin":"(?<=\\{)","end":"(\\})","endCaptures":{"1":{"name":"punctuation.section.block.end.bracket.curly.extern.cpp"}},"patterns":[{"include":"$base"}]},{"name":"meta.tail.extern.cpp","begin":"(?<=})[\\s\\n]*","end":"[\\s\\n]*(?=;)","patterns":[{"include":"$base"}]},{"include":"$base"}]},"hacky_fix_for_stray_directive":{"match":"(?(?-mix:[a-zA-Z_$][\\w$]*)))\t # macro name\n(?:\n (\\()\n\t(\n\t \\s* \\g \\s*\t\t # first argument\n\t ((,) \\s* \\g \\s*)* # additional arguments\n\t (?:\\.\\.\\.)?\t\t\t# varargs ellipsis?\n\t)\n (\\))\n)?","beginCaptures":{"1":{"name":"keyword.control.directive.define.cpp"},"2":{"name":"punctuation.definition.directive.cpp"},"3":{"name":"entity.name.function.preprocessor.cpp"},"5":{"name":"punctuation.definition.parameters.begin.cpp"},"6":{"name":"variable.parameter.preprocessor.cpp"},"8":{"name":"punctuation.separator.parameters.cpp"},"9":{"name":"punctuation.definition.parameters.end.cpp"}},"end":"(?=(?://|/\\*))|(?","endCaptures":{"0":{"name":"punctuation.definition.string.end.cpp"}},"name":"string.quoted.other.lt-gt.include.cpp"}]},"meta_preprocessor_line":{"name":"meta.preprocessor.cpp","begin":"^\\s*((#)\\s*line)\\b","beginCaptures":{"1":{"name":"keyword.control.directive.line.cpp"},"2":{"name":"punctuation.definition.directive.cpp"}},"end":"(?=(?://|/\\*))|(?=+!]+ | \\(\\) | \\[\\]))\n)\n\\s*(\\() # opening bracket","beginCaptures":{"1":{"name":"variable.other.cpp"},"2":{"name":"punctuation.section.parens.begin.bracket.round.initialization.cpp"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.initialization.cpp"}},"patterns":[{"include":"#function_call_context_c"}]},{"begin":"{","beginCaptures":{"0":{"name":"punctuation.section.block.begin.bracket.curly.cpp"}},"end":"}|(?=\\s*#\\s*(?:elif|else|endif)\\b)","endCaptures":{"0":{"name":"punctuation.section.block.end.bracket.curly.cpp"}},"patterns":[{"include":"#block_context"}]},{"include":"#parentheses_block"},{"include":"$base"}]},"function_call_c":{"begin":"(?x)\n(?!(?:while|for|do|if|else|switch|catch|return|typeid|alignof|alignas|sizeof|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas|constexpr|volatile|operator|(?:::)?new|(?:::)?delete)\\s*\\()\n(?=\n(?:[A-Za-z_][A-Za-z0-9_]*+|::)++\\s*(?-mix:(?:(?-mix:(?:<(?:[\\s<>:,\\w])*>\\s*)))?)\\( # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)","end":"(?<=\\))(?!\\w)","name":"meta.function-call.cpp","patterns":[{"include":"#function_call_context_c"}]},"comments_context":{"patterns":[{"captures":{"1":{"name":"meta.toc-list.banner.block.cpp"}},"match":"^/\\* =(\\s*.*?)\\s*= \\*/$\\n?","name":"comment.block.cpp"},{"begin":"/\\*","beginCaptures":{"0":{"name":"punctuation.definition.comment.begin.cpp"}},"end":"\\*/","endCaptures":{"0":{"name":"punctuation.definition.comment.end.cpp"}},"name":"comment.block.cpp"},{"captures":{"1":{"name":"meta.toc-list.banner.line.cpp"}},"match":"^// =(\\s*.*?)\\s*=\\s*$\\n?","name":"comment.line.banner.cpp"},{"begin":"(^[ \\t]+)?(?=//)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.cpp"}},"end":"(?!\\G)","patterns":[{"begin":"//","beginCaptures":{"0":{"name":"punctuation.definition.comment.cpp"}},"end":"(?=\\n)","name":"comment.line.double-slash.cpp","patterns":[{"include":"#line_continuation_character"}]}]}]},"disabled":{"begin":"^\\s*#\\s*if(n?def)?\\b.*$","end":"^\\s*#\\s*endif\\b","patterns":[{"include":"#disabled"},{"include":"#pragma_mark"}]},"line_continuation_character":{"match":"(\\\\)\\n","captures":{"1":{"name":"constant.character.escape.line-continuation.cpp"}}},"parentheses":{"name":"meta.parens.cpp","begin":"\\(","beginCaptures":{"0":{"name":"punctuation.section.parens.begin.bracket.round.cpp"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.cpp"}},"patterns":[{"include":"$base"}]},"parentheses_block":{"name":"meta.parens.block.cpp","begin":"\\(","beginCaptures":{"0":{"name":"punctuation.section.parens.begin.bracket.round.cpp"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.cpp"}},"patterns":[{"include":"#block_context"},{"match":"(?-mix:(?=+!]+|\\(\\)|\\[\\]))\\s*\\(\n)","end":"(?<=\\))(?!\\w)|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()","beginCaptures":{"1":{"name":"entity.name.function.cpp"},"2":{"name":"punctuation.section.arguments.begin.bracket.round.cpp"}},"end":"(\\))|(?=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()","beginCaptures":{"1":{"name":"entity.name.function.cpp"},"2":{"name":"punctuation.section.parameters.begin.bracket.round.cpp"}},"end":"(?-mix:\\)|:)","endCaptures":{"0":{"name":"punctuation.section.parameters.end.bracket.round.cpp"}},"patterns":[{"include":"#probably_a_parameter"},{"include":"#function_context_c"}]},{"begin":"\\(","beginCaptures":{"0":{"name":"punctuation.section.parens.begin.bracket.round.cpp"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.cpp"}},"patterns":[{"include":"#function_context_c"}]},{"include":"$base"}]},"function_call_context_c":{"patterns":[{"include":"#attributes"},{"include":"#comments_context"},{"include":"#storage_types"},{"include":"#method_access"},{"include":"#member_access"},{"include":"#operators"},{"begin":"(?x)\n(?!(?:while|for|do|if|else|switch|catch|return|typeid|alignof|alignas|sizeof|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\s*\\()\n(\n(?:new)\\s*((?-mix:(?:(?-mix:(?:<(?:[\\s<>:,\\w])*>\\s*)))?)) # actual name\n|\n(?:(?<=operator)(?:[-*&<>=+!]+|\\(\\)|\\[\\]))\n)\n\\s*(\\()","beginCaptures":{"1":{"name":"keyword.operator.wordlike.cpp memory.cpp keyword.operator.new.cpp"},"2":{"patterns":[{"include":"#template_call_innards"}]},"3":{"name":"punctuation.section.arguments.begin.bracket.round.cpp"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.arguments.end.bracket.round.cpp"}},"patterns":[{"include":"#function_call_context_c"}]},{"include":"#function_call"},{"begin":"\\(","beginCaptures":{"0":{"name":"punctuation.section.parens.begin.bracket.round.cpp"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.section.parens.end.bracket.round.cpp"}},"patterns":[{"include":"#function_call_context_c"}]},{"include":"#block_context"}]}}} \ No newline at end of file diff --git a/syntaxes/cpp.tmLanguage.yaml b/syntaxes/cpp.tmLanguage.yaml index 69d2f21c..84af2f3c 100644 --- a/syntaxes/cpp.tmLanguage.yaml +++ b/syntaxes/cpp.tmLanguage.yaml @@ -16,6 +16,7 @@ - include: "#storage_specifiers" - include: "#access_control_keywords" - include: "#exception_keywords" +- include: "#static_assert" - include: "#other_keywords" - include: "#memory_operators" - include: "#the_this_keyword" @@ -564,6 +565,28 @@ patterns: - include: "#parameter_struct" - include: "#function_context_c" + static_assert: + begin: "(static_assert|_Static_assert)\\s*(\\()" + beginCaptures: + '1': + name: keyword.static_assert.cpp + '2': + name: punctuation.section.arguments.begin.bracket.round.cpp + end: "(\\))" + endCaptures: + '1': + name: punctuation.section.arguments.end.bracket.round.cpp + patterns: + - name: meta.static_assert.message.cpp + begin: (,)\s*(?=(?:L|u8|u|U\s*\")?) + beginCaptures: + '1': + name: comma.cpp punctuation.separator.delimiter.cpp + end: "(?=\\))" + patterns: + - include: "#string_context" + - include: "#string_context_c" + - include: "#function_call_context_c" function_call: begin: "(?:,\\w])*>\\s*)))?::)*\\s*)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F]))(?:(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U000[0-9a-fA-F])))*)\\s*(?:(<(?:[\\s<>:,\\w])*>\\s*))?(\\()" beginCaptures: