From 228a10cfa51e225b0606be99776e9cfa362184c9 Mon Sep 17 00:00:00 2001 From: Eldar Abusalimov Date: Tue, 2 Feb 2016 18:13:49 +0300 Subject: [PATCH 1/4] Prettify tmLanguage file using standard formatting Also change the indentation to 2-space. --- C Improved.tmLanguage | 4313 +++++++++++++++++++++++++---------------- 1 file changed, 2681 insertions(+), 1632 deletions(-) diff --git a/C Improved.tmLanguage b/C Improved.tmLanguage index bf81819..eab669a 100644 --- a/C Improved.tmLanguage +++ b/C Improved.tmLanguage @@ -1,1636 +1,2685 @@ - - comment - - https://github.com/abusalimov/SublimeCImproved - - Derived from C.tmLanguage - the original TextMate and Sublime Text - syntax definition. - - - fileTypes - - c - h - - firstLineMatch - -[*]-( Mode:)? C -[*]- - foldingStartMarker - (?x) - /\*\*(?!\*) - |^(?![^{]*?//|[^{]*?/\*(?!.*?\*/.*?\{)).*?\{\s*($|//|/\*(?!.*?\*/.*\S)) - - foldingStopMarker - (?<!\*)\*\*/|^\s*\} - keyEquivalent - ^~C - name - C Improved - - patterns - - include #translation_unit - - - repository - - translation_unit - - patterns - - include #special_block - - include #typedef - include #type - - include #lex - - include #support-macro - include #function - include #support - - include #block - include #parens - - - special_block - - begin (?x) - (?= \s* - (?: - (?: \b extern \b - (?: "(\\.|[^"])*" | '(\\.|[^'])*' | /\*.*?\*/ | \s)* ) | - (?: \b namespace \b - (?: (?: /\*.*?\*/ | \s)* \b [A-Za-z_]\w*+ \b)? - (?: /\*.*?\*/ | \s)* ) ) - \{ ) - - end \} - patterns - - include #lex - - begin \{ - end (?=\}) - name meta.block.special.c - patterns - - include $base - - - - - - block - - begin (?=\{) - end \} - patterns - - include #block-lookahead-end - - - block-lookahead-end - - begin \{ - end (?=\}) - name meta.block.c - patterns - - include #typedef - include #type - - include #lex - - include #call - include #support - - include #function - - include $base - - - parens - - begin (?=\() - end \) - patterns - - include #parens-lookahead-end - - - parens-lookahead-end - - begin \( - end (?=\)) - name meta.parens.c - patterns - - include #type - - include #lex - - include #call - include #support - - include $base - - - - typedef - - begin (?x) (?<= \A typedef | \W typedef ) \b - end ; - name meta.typedef.c - patterns - - include #lex - include #type-definition - include #block - - match \s*\b([A-Za-z_]\w*+)(?=\s*[\[;]) - captures - - 1 name entity.name.type.typedef.c - - - - - type - - patterns - - include #type-declaration - include #type-definition - - - type-declaration - - begin (?x) - (?<= \A enum | \A (?:class|union) | \A struct | - \W enum | \W (?:class|union) | \W struct ) \b - (?= (?:\s|/\*.*?\*/)*+ - ([A-Za-z_]\w*+) - (?:\s|/\*.*?\*/)*+; ) - - end - (?<=;) - name meta.compound.c - patterns - - include #lex - - match \s*\b([A-Za-z_]\w*+)\b - captures - - 1 name entity.name.type.declaration.c - - - - - type-definition - - begin (?x) - (?<= \A enum | \A (?:class|union) | \A struct | - \W enum | \W (?:class|union) | \W struct ) \b - - # Negation of zero-length parts of the end pattern - # to prevent entering the rule if it's gonna exit immediately. - # (workaround ST2 bugs, see issue #10) - (?=\s*(?:[A-Za-z_({]|/[/*]|$)) - (?! \s*\b(?: [A-Za-z_]\w*+ ) (?= \s* [\[;] ) ) - - end - (?x) - (?: (?!\s*(?:[A-Za-z_({]|/[/*]|$)) - | (?= \s*\b(?: [A-Za-z_]\w*+ ) (?= \s* [\[;] ) ) - | (?<!\})(?= - # Prefer function definition over an attribute defined - # through a macro, unless a block has been seen. That is: - # struct __packed __aligned(16) foo {...}; - function __aligned - # struct foo {...} __packed __aligned(16); - structure foo - (?! \s* \b__attribute__\b ) - - (?: ^ - | (?<! (?<!\w) new - | (?<!\w) (?:else|enum) | (?<!\w) (?:class|union) - | (?<!\w) (?:struct|return|sizeof|typeof) - | (?<!\w) __typeof | (?<!\w) __typeof__ ) - (?<= \w ) \s - - | # or type modifier / closing bracket before name - (?<= [^&]& | [*>)}\]] ) ) \s* - - (?: [A-Za-z_]\w*+ | ::[^:] )++ - (?: (?<= ^ operator | \W operator ) # C++ operator? - (?: [-*&<>=+!]+ | \(\) | \[\] ) )? - (?:\s|/\*.*?\*/)*+ \( ) ) - - name meta.compound.c - patterns - - - begin (?<=\}) - end (?!\s*(?:[A-Za-z_({]|/[/*]|$)) - patterns - - include #lex - include #block - include #parens - - - include #lex - include #block - include #parens - - match \b([A-Za-z_]\w*+)(?=(?:\s|/\*.*?\*/)*+(?:\{|(//.*)?\\?$)) - captures - - 1 name entity.name.type.class.c entity.name.class.c - - - - - - function - - patterns - - include #function-fixup-macro - include #function-declaration - include #function-definition - - - function-fixup-macro - - begin - (?x) - ^ # Begin of line, capital letters: most probably it is a macro - \s*\b - ([A-Z0-9_]++) - \b - (?= (?:\s|/\*.*?\*/)*+ \( ) - - end \) - patterns - - include #lex - include #parens-lookahead-end - - - function-declaration - - name meta.function.c - begin - (?x) - (?: ^ - | (?<! (?<!\w) new - | (?<!\w) (?:else|enum) | (?<!\w) (?:class|union) - | (?<!\w) (?:struct|return|sizeof|typeof) - | (?<!\w) __typeof | (?<!\w) __typeof__ ) - (?<= \w ) \s - - | # or type modifier / closing bracket before name - (?<= [^&]& | [*>)}\]] ) ) \s* - - ( (?: [A-Za-z_]\w*+ | ::[^:] )++ - (?: (?<= ^ operator | \W operator ) # C++ operator? - (?: [-*&<>=+!]+ | \(\) | \[\] ) )? ) - - (?= (?:\s|/\*.*?\*/)*+ (?'parens' \( - (?> \g'parens' | - "(\\.|[^"])*" | '(\\.|[^'])*' | /\*.*?\*/ | - (?! /[/*] | [()] ) . )* - \) ) \s* ; ) - - beginCaptures - - 1 name entity.name.function.declaration.c - - end ; - patterns - - include #lex - include #parens - - - function-definition - - name meta.function.c - begin - (?x) - (?: ^ - | (?<! (?<!\w) new - | (?<!\w) (?:else|enum) | (?<!\w) (?:class|union) - | (?<!\w) (?:struct|return|sizeof|typeof) - | (?<!\w) __typeof | (?<!\w) __typeof__ ) - (?<= \w ) \s - - | # or type modifier / closing bracket before name - (?<= [^&]& | [*>)}\]] ) ) \s* - - ( (?: [A-Za-z_]\w*+ | ::[^:] )++ - (?: (?<= ^ operator | \W operator ) # C++ operator? - (?: [-*&<>=+!]+ | \(\) | \[\] ) )? ) - - (?= (?:\s|/\*.*?\*/)*+ \( ) - - beginCaptures - - 1 name entity.name.function.definition.c - - end \}|; - patterns - - include #lex - include #parens - - match \s*\b(const|override)\b - name storage.modifier.c - - include #block-lookahead-end - - - - call - - name meta.function-call.c - begin - (?x) - \s* - (?= # don't consume to recognize support functions - (?: [A-Za-z_]\w*+ | ::[^:] )++ - (?:\s|/\*.*?\*/)*+ \( ) - - end \) - patterns - - include #lex - include #support-function - - match (?:(?<=\.)|(?<=->))\b([A-Za-z_]\w*+)\b - name variable.other.dot-access.c support.function.any-method.c - - - match (?:[A-Za-z_]\w*+|::[^:])++ - name support.function.any-method.c - - include #parens-lookahead-end - - - - preprocessor - - begin (?=^\s*(#)) - end (?!^\s*(#)) - patterns - - include #preprocessor-disabled - include #ppline-directive-invalid-usage - include #ppline-macro - include #ppline-undef - include #ppline-pragma-mark - include #ppline-include - include #ppline-directive - include #ppline-directive-obsolete - include #ppline-invalid - include #ppline-any - - - preprocessor-lex - - patterns - - include #comments - include #lex-continuation - include #lex-newline - - - preprocessor-disabled - - begin ^\s*(#)(?=\s*(if)\b(?=(?:\s|/\*.*?\*/)*+(0[xX])?0++\b(?:\s|/\*.*?\*/)*+(//.*)?\\?$)) - beginCaptures - - 0 name meta.preprocessor.directive.c keyword.other.preprocessor.c - - end (?=^\s*(#)\s*(endif|else|elif)\b) - patterns - - - begin ^ - end $\n? - name comment.other.preprocessor-disabled.c - patterns - - include #preprocessor-disabled-conditional - include #preprocessor-disabled-directive - - - - begin (?<!##)(?<=#)\s*(if)\b(?=(?:\s|/\*.*?\*/)*+(0[xX])?0++\b(?:\s|/\*.*?\*/)*+(//.*)?\\?$) - beginCaptures - - 1 name keyword.other.preprocessor.define.c - - end (?<=$\n)(?<!\\$\n) - name meta.preprocessor.directive.c - patterns - - include #lex-core - - - - - preprocessor-disabled-conditional - - begin ^\s*(#)\s*if(n?def)?\b - end ^\s*(#)\s*endif\b.*$\n? - patterns - - include #preprocessor-disabled-conditional - include #preprocessor-disabled-directive - - - preprocessor-disabled-directive - - begin ^\s*(#) - end (?<=$\n)(?<!\\$\n) - - - ppline-macro - - begin ^\s*(#)(?=\s*(define)\s+[a-zA-Z_]\w*+) - beginCaptures - - 0 name keyword.other.preprocessor.c - - end (?<=$\n)(?<!\\$\n) - name meta.preprocessor.macro.c - patterns - - - match \s*(##) - captures - - 1 name keyword.other.preprocessor.c - - - - match \s*(#)\s*([a-zA-Z_]\w*+) - captures - - 1 name keyword.other.preprocessor.c - 2 name string.macro.stringify.c - - - include #ppline-macro-head-function - include #ppline-macro-head-object - include #lex-in-preprocessor - - include #support - - - ppline-macro-head-object - - match (?<!##)(?<=#)(\s*define)\s+([a-zA-Z_]\w*+)(?!\()[\s&&[^\n]]* - captures - - 1 name keyword.other.preprocessor.define.c - 2 name entity.name.constant.preprocessor.c - - - ppline-macro-head-function - - begin (?<!##)(?<=#)(\s*define)\s+([a-zA-Z_]\w*+)(\() - beginCaptures - - 1 name keyword.other.preprocessor.define.c - 2 name entity.name.function.preprocessor.c - 3 name meta.preprocessor.macro.parameters.c - - end (?<=\))|(?<=^|[^\\])\s*(\n) - endCaptures - - 1 name invalid.illegal.unexpected-end-of-line.c - - contentName meta.preprocessor.macro.parameters.c - patterns - - - match \) - - - begin \b([a-zA-Z_]\w*+)\b - beginCaptures - - 1 name variable.parameter.c - - end (?<=\))|(?=(?<=^|[^\\])\s*(\n)) - patterns - - - match \) - - include #ppline-macro-param-next - include #ppline-macro-param-vararg - include #ppline-macro-param-lex - include #ppline-macro-param-lex-invalid - - - include #ppline-macro-param-vararg - include #ppline-macro-param-lex - include #ppline-macro-param-lex-invalid - - - ppline-macro-param-next - - begin (,) - beginCaptures - - 1 name punctuation.separator.parameter.c - - end \b([a-zA-Z_]\w*+)\b|(?=\.\.\.)|(\))|(?=(?<=^|[^\\])\s*(\n)) - endCaptures - - 1 name variable.parameter.c - 2 name invalid.illegal.unexpected-closing-paren.c - - patterns - - include #ppline-macro-param-lex - - match - (?x) - (?: (?! (?:\s|/\*.*?\*/)*+ - (?: \b([a-zA-Z_]\w*+)\b | \.\.\. | \) | (?>(?:\\\s*)?$\n?) | /[/*] ) ) - .)* - - name invalid.illegal.unexpected-character.c - - - - ppline-macro-param-vararg - - begin - (\.\.\.) - beginCaptures - - 1 name punctuation.definition.ellipsis.c - - end (\))|(?=(?<=^|[^\\])\s*(\n)) - patterns - - include #ppline-macro-param-lex - - match - (?x) - (?: (?! (?:\s|/\*.*?\*/)*+ - (?: \) | (?>(?:\\\s*)?$\n?) | /[/*] ) ) - .)* - - name invalid.illegal.unexpected-character.c - - - - ppline-macro-param-lex - - patterns - - match \s* - - begin \s*// - beginCaptures - - 0 name punctuation.definition.comment.c - - end (?<=^|[^\\])\s*(?=\n)$ - name invalid.illegal.unexpected-end-of-line.c - patterns - - include #lex-continuation - - - include #preprocessor-lex - - - ppline-macro-param-lex-invalid - - patterns - - - match - (?x) - (?: (?! (?:\s|/\*.*?\*/)*+ - (?: \) | (?>(?:\\\s*)?$\n?) | /[/*] ) ) - .) # no star unlike its friends in arg/vararg - - name invalid.illegal.unexpected-character.c - - - - - ppline-undef - - begin (^\s*(#)\s*(undef))\s+([a-zA-Z_]\w*+) - beginCaptures - - 1 name keyword.other.preprocessor.c - 4 name variable.macro.undef.c - - end (?<=$\n)(?<!\\$\n) - name meta.preprocessor.undef.c - patterns - - - - - ppline-include - - begin ^\s*(#)\s*(include|include_next|import)\b - beginCaptures - - 0 name keyword.other.preprocessor.include.c - - end (?:("[^"]*?)|(<[^>]*?))(\n)|(?<=$\n)(?<!\\$\n) - endCaptures - - 1 name string.quoted.double.include.c - 2 name string.quoted.other.lt-gt.include.c - 3 name invalid.illegal.unexpected-end-of-line.c - - name meta.preprocessor.include.c meta.preprocessor.c.include - patterns - - include #ppline-include-innards - - - ppline-include-innards - - patterns - - include #preprocessor-lex - - begin "|(?=.*?") - beginCaptures - - 0 name punctuation.definition.string.begin.c - - end "|(?<=^|[^\\])(?=\s*\n) - endCaptures - - 0 name punctuation.definition.string.end.c - - name string.quoted.double.include.c - - - begin <(?=.*?>) - beginCaptures - - 0 name punctuation.definition.string.begin.c - - end >|(?<=^|[^\\])(?=\s*\n) - endCaptures - - 0 name punctuation.definition.string.end.c - - name string.quoted.other.lt-gt.include.c - - - begin \( - end \)|(?<=^|[^\\])(?=\s*\n) - name meta.parens.c - patterns - - include #ppline-include-innards - - - - - ppline-pragma-mark - - begin (^\s*(#)\s*(pragma\s+mark)\b)[\s&&[^\n]]* - beginCaptures - - 1 name keyword.other.preprocessor.pragma.c - - end (?<=$\n)(?<!\\$\n) - name meta.preprocessor.directive.pragma-mark.c - contentName meta.toc-list.pragma-mark.c - patterns - - include #preprocessor-lex - - match . - name string.other.pragma-mark.c - - - - ppline-directive - - begin ^\s*(#)\s*(if|ifdef|ifndef|elif|else|endif|pragma|line|define|undef|error|warning)\b - beginCaptures - - 0 name keyword.other.preprocessor.c - - end (?<=$\n)(?<!\\$\n) - name meta.preprocessor.directive.c - patterns - - include #lex-core - - - - ppline-directive-invalid-usage - - match (^\s*(#)\s*(if|ifdef|ifndef|elif|pragma|define|undef|include|include_next|import)\b)\s*?(\n|$) - captures - - 1 name keyword.other.preprocessor.c - 4 name invalid.illegal.invalid-usage-of-preprocessor-directive.c - - name meta.preprocessor.directive.c - - - ppline-directive-obsolete - - begin ^\s*(#)\s*(assert|unassert|ident|sccs)\b - end (?<=$\n)(?<!\\$\n) - beginCaptures - - 1 name keyword.other.preprocessor.c - 2 name invalid.deprecated.preprocessor.c - - name meta.preprocessor.directive.deprecated.c - patterns - - include #lex-core - - - - ppline-invalid - - begin ^\s*(#)(?!\s*(?=/[/*]|(?>\\\s*\n)|\n|$))\s*(\w*) - end (?<=$\n)(?<!\\$\n) - beginCaptures - - 1 name keyword.other.preprocessor.c - 2 name invalid.illegal.preprocessor.c - - name meta.preprocessor.directive.illegal.c - - - ppline-any - - begin ^\s*(#) - beginCaptures - - 0 name keyword.other.preprocessor.c - - end (?<=$\n)(?<!\\$\n) - name meta.preprocessor.directive.null-directive.c - patterns - - include #lex-core - - - - support - - patterns - - include #support-type - include #support-macro - include #support-function - - - support-type - - patterns - - - match \s*\b(u_char|u_short|u_int|u_long|ushort|uint|(?:u_quad|quad|qaddr|caddr|daddr|dev|fixpt|blkcnt|blksize|gid|in_addr|in_port|ino|key|mode|nlink|id|pid|off|segsz|swblk|uid|id|clock|size|ssize|time|useconds|suseconds)_t)\b - captures - - 1 name support.type.sys-types.c - - - - match \s*\b(pthread_(?:t|attr_t|once_t|key_t|(?:cond|mutex|rwlock)(?:attr)?_t))\b - captures - - 1 name support.type.pthread.c - - - - match \s*\b(u?int(?:(?:_least|_fast)?(?:8|16|32|64)_t|ptr_t|max_t))\b - captures - - 1 name support.type.stdint.c - - - - match \s*\b(noErr|kNilOptions|kInvalidID|kVariableLengthArray)\b - captures - - 1 name support.constant.mac-classic.c - - - - match \s*\b(AbsoluteTime|Boolean|Byte|ByteCount|ByteOffset|BytePtr|CompTimeValue|ConstLogicalAddress|ConstStrFileNameParam|ConstStringPtr|Duration|Fixed|FixedPtr|Float32|Float32Point|Float64|Float80|Float96|FourCharCode|Fract|FractPtr|Handle|ItemCount|LogicalAddress|OptionBits|OSErr|OSStatus|OSType|OSTypePtr|PhysicalAddress|ProcessSerialNumber|ProcessSerialNumberPtr|ProcHandle|Ptr|ResType|ResTypePtr|ShortFixed|ShortFixedPtr|SignedByte|SInt16|SInt32|SInt64|SInt8|Size|StrFileName|StringHandle|StringPtr|TimeBase|TimeRecord|TimeScale|TimeValue|TimeValue64|UInt16|UInt32|UInt64|UInt8|UniChar|UniCharCount|UniCharCountPtr|UniCharPtr|UnicodeScalarValue|UniversalProcHandle|UniversalProcPtr|UnsignedFixed|UnsignedFixedPtr|UnsignedWide|UTF16Char|UTF32Char|UTF8Char)\b - captures - - 1 name support.type.mac-classic.c - - - - match - (?x) - \s*\b - ( Py(?:Var|Type|HeapType|Dict|Set|List|Tuple|BaseException)?Object - | PyType_(?:Spec|Slot) ) - \b - - captures - - 1 name support.type.cpython.c - - - - match - (?x) - \s*\b - ( Py(?:BaseObject|Type|Super|Bool|Dict - |DictIter(?:Key|Value|Item) - |Dict(?:Key|Value|Item)s - |(?:Set|List|Tuple)(?:Iter)? - |FrozenSet|ListRevIter)_Type - | _?PyExc_\w++ - | Py_(?:False|True|None|NotImplemented) ) - \b - - captures - - 1 name support.constant.cpython.c - - - - - support-macro - - patterns - - - match \s*\b(__builtin_\w++)\b - captures - - 1 name support.function.intrinsic.c - - - - match - (?x) - \s*\b - ( (?:__)?(?:DECL(?:ARE)?|DEF(?:INE)?)_[A-Z0-9_]+ - | (?:__)?[A-Z_][A-Z0-9_]*_(?:DECL(?:ARE)?|DEF(?:INE)?) - | EXPORT(?:_UNUSED)?(?:_PER_CPU)?_SYMBOL(?:_GPL(?:_FUTURE)?)? - | MODULE_(?:INFO|ALIAS|LICENSE|AUTHOR|DESCRIPTION|DEVICE_TABLE|VERSION|FIRMWARE) - | (?:__)?MODULE_PARM_(?:TYPE|DESC) - | module_param(?:(?:_array)?(?:_named)?|_call) - | (?:module|core|postcore|arch|subsys|fs|device|late)_param_cb - | [HL]?LIST_HEAD - | (?:_|__BIN|BIN|BUS|DRIVER|CLASS|DEVICE)_ATTR(?:_R[OW])? ) - \b - - captures - - 1 name support.function.linux-kernel.macro.c - - - - match - (?x) - \s*\b - ( _(?:IRQL|Kernel)_\w+_ - | _Interlocked_operand_ - | _Dispatch_type_ - | _Flt_CompletionContext_Outptr_ ) - \b - - captures - - 1 name support.function.windows-sal2.annotation.c - - - - match - (?x) - \s*\b - ( PyAPI_(?:FUNC|DATA) - | PyMODINIT_FUNC - | Py_LOCAL(?:_INLINE)? - | PyDoc_(?:STR(?:VAR)?|VAR) - | PyObject(?:_VAR)?_HEAD - | _PyObject_HEAD_EXTRA - | PyException_HEAD - | Py(?:Var)?Object_HEAD_INIT - | PyModuleDef_HEAD_INIT - | Py_(RETURN)_(?:FALSE|TRUE|NONE|NOTIMPLEMENTED|NAN|INF) ) - \b - - captures - - 1 name support.function.cpython.macro.c - 2 name keyword.control.c - - - - match - \s*\b(_Py_IDENTIFIER)\b\s*\(\s*([A-Za-z_]\w*+)\s*\) - captures - - 1 name support.function.cpython.macro.c - 2 name string.support.cpython.identifier.c - - - - match - \s*\bPyId_([A-Za-z_]\w*+)\b - captures - - 1 name string.support.cpython.identifier.c - - - - match - \s*\b((?:CONFIG|HAVE)_[A-Z0-9_]++)\b - captures - - 1 name support.constant.config.c - - - - - support-function - - patterns - - - match \s*\b(hypot(f|l)?|s(scanf|ystem|nprintf|ca(nf|lb(n(f|l)?|ln(f|l)?))|i(n(h(f|l)?|f|l)?|gn(al|bit))|tr(s(tr|pn)|nc(py|at|mp)|c(spn|hr|oll|py|at|mp)|to(imax|d|u(l(l)?|max)|k|f|l(d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(jmp|vbuf|locale|buf)|qrt(f|l)?|w(scanf|printf)|rand)|n(e(arbyint(f|l)?|xt(toward(f|l)?|after(f|l)?))|an(f|l)?)|c(s(in(h(f|l)?|f|l)?|qrt(f|l)?)|cos(h(f)?|f|l)?|imag(f|l)?|t(ime|an(h(f|l)?|f|l)?)|o(s(h(f|l)?|f|l)?|nj(f|l)?|pysign(f|l)?)|p(ow(f|l)?|roj(f|l)?)|e(il(f|l)?|xp(f|l)?)|l(o(ck|g(f|l)?)|earerr)|a(sin(h(f|l)?|f|l)?|cos(h(f|l)?|f|l)?|tan(h(f|l)?|f|l)?|lloc|rg(f|l)?|bs(f|l)?)|real(f|l)?|brt(f|l)?)|t(ime|o(upper|lower)|an(h(f|l)?|f|l)?|runc(f|l)?|gamma(f|l)?|mp(nam|file))|i(s(space|n(ormal|an)|cntrl|inf|digit|u(nordered|pper)|p(unct|rint)|finite|w(space|c(ntrl|type)|digit|upper|p(unct|rint)|lower|al(num|pha)|graph|xdigit|blank)|l(ower|ess(equal|greater)?)|al(num|pha)|gr(eater(equal)?|aph)|xdigit|blank)|logb(f|l)?|max(div|abs))|di(v|fftime)|_Exit|unget(c|wc)|p(ow(f|l)?|ut(s|c(har)?|wc(har)?)|error|rintf)|e(rf(c(f|l)?|f|l)?|x(it|p(2(f|l)?|f|l|m1(f|l)?)?))|v(s(scanf|nprintf|canf|printf|w(scanf|printf))|printf|f(scanf|printf|w(scanf|printf))|w(scanf|printf)|a_(start|copy|end|arg))|qsort|f(s(canf|e(tpos|ek))|close|tell|open|dim(f|l)?|p(classify|ut(s|c|w(s|c))|rintf)|e(holdexcept|set(e(nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(aiseexcept|ror)|get(e(nv|xceptflag)|round))|flush|w(scanf|ide|printf|rite)|loor(f|l)?|abs(f|l)?|get(s|c|pos|w(s|c))|re(open|e|ad|xp(f|l)?)|m(in(f|l)?|od(f|l)?|a(f|l|x(f|l)?)?))|l(d(iv|exp(f|l)?)|o(ngjmp|cal(time|econv)|g(1(p(f|l)?|0(f|l)?)|2(f|l)?|f|l|b(f|l)?)?)|abs|l(div|abs|r(int(f|l)?|ound(f|l)?))|r(int(f|l)?|ound(f|l)?)|gamma(f|l)?)|w(scanf|c(s(s(tr|pn)|nc(py|at|mp)|c(spn|hr|oll|py|at|mp)|to(imax|d|u(l(l)?|max)|k|f|l(d|l)?|mbs)|pbrk|ftime|len|r(chr|tombs)|xfrm)|to(b|mb)|rtomb)|printf|mem(set|c(hr|py|mp)|move))|a(s(sert|ctime|in(h(f|l)?|f|l)?)|cos(h(f|l)?|f|l)?|t(o(i|f|l(l)?)|exit|an(h(f|l)?|2(f|l)?|f|l)?)|b(s|ort))|g(et(s|c(har)?|env|wc(har)?)|mtime)|r(int(f|l)?|ound(f|l)?|e(name|alloc|wind|m(ove|quo(f|l)?|ainder(f|l)?))|a(nd|ise))|b(search|towc)|m(odf(f|l)?|em(set|c(hr|py|mp)|move)|ktime|alloc|b(s(init|towcs|rtowcs)|towc|len|r(towc|len))))\b - captures - - 1 name support.function.C99.c - - - - match - (?x) - \s*\b - ( Py_REFCNT | Py_TYPE | Py_SIZE - | Py_X?(?:INC|DEC)REF | Py_CLEAR - | _?Py(?:Object|Type|HeapType|Dict|Set|List|Tuple|Long|Exception|Err)_\w++ ) - \b - - captures - - 1 name support.function.cpython.c - - - - - - comments - - patterns - - - begin \s*(/\*) - captures - - 1 name punctuation.definition.comment.block.c - - end (\*/)(\n?) - endCaptures - - 2 name punctuation.whitespace.newline.c - - name comment.block.c - patterns - - include #comment-innards - - - - match \*/(?![/*]) - name invalid.illegal.stray-comment-end.c - - - begin \s*(//) - beginCaptures - - 1 name punctuation.definition.comment.line.double-slash.c++ - - end (?<=$\n)(?<!\\$\n) - name comment.line.double-slash.c++ - patterns - - include #comment-innards - - - - - - comment-innards - - patterns - - include #comment-banner-line - include #comment-task-tag-line - include #lex-continuation - include #lex-newline - - - - comment-banner-line - - match (?:(?<=//)|(?<=/\*)|^)[\s/*]*(=+\s*(.*?)\s*=+(?:(?=[\s/*+\-]*\*/)|$(\n?))) - captures - - 1 name meta.toc-list.banner.c - 3 name punctuation.whitespace.newline.c - - - - comment-task-tag-line - - patterns - - - begin (?ix) - (?= (?-i: @[a-zA-Z_]++ | \b [A-Z_]++) \b) @? \b (?: - (FIXME) | (XXX) | (WTF) - ) \b - - beginCaptures - - 0 name keyword.other.task-tag.prio-high.c - 1 name storage.type.class.fixme.c - 2 name storage.type.class.xxx.c - 3 name storage.type.class.wtf.c - - end (?=[\s/*]*\*/)|(?<=$\n) - name meta.toc-list.task-tag.prio-high.c - patterns - - include #comment-task-tag-line-innards - - - - begin (?ix) - (?= (?-i: @[a-zA-Z_]++ | \b [A-Z_]++) \b) @? \b (?: - (TODO) - ) \b - - beginCaptures - - 0 name keyword.other.task-tag.prio-normal.c - 1 name storage.type.class.todo.c - - end (?=[\s/*]*\*/)|(?<=$\n) - name meta.toc-list.task-tag.prio-normal.c - patterns - - include #comment-task-tag-line-innards - - - - begin (?ix) - (?= (?-i: @[a-zA-Z_]++ | \b [A-Z_]++) \b) @? \b (?: - (TBD) | (REVIEW) - ) \b - - beginCaptures - - 0 name keyword.other.task-tag.prio-low.c - 1 name storage.type.class.tbd.c - 2 name storage.type.class.review.c - - end (?=[\s/*]*\*/)|(?<=$\n) - name meta.toc-list.task-tag.prio-low.c - patterns - - include #comment-task-tag-line-innards - - - - begin (?ix) - (?= (?-i: @[a-zA-Z_]++ | \b [A-Z_]++) \b) @? \b (?: - (NOTE) | (NB) | (CHANGED) | (IDEA) | (IMPORTANT) | (HACK) | (BUG) - ) \b - - beginCaptures - - 0 name keyword.other.task-tag.note.c - 1 name storage.type.class.note.c - 2 name storage.type.class.nb.c - 3 name storage.type.class.changed.c - 4 name storage.type.class.idea.c - 5 name storage.type.class.important.c - 6 name storage.type.class.hack.c - 7 name storage.type.class.bug.c - - end (?=[\s/*]*\*/)|(?<=$\n) - name meta.toc-list.task-tag.note.c - patterns - - include #comment-task-tag-line-innards - - - - - - comment-task-tag-line-innards - - patterns - - include #comment-task-tag-line - include #lex-continuation - include #lex-newline - - - - lex - - patterns - - include #lex-in-preprocessor - include #preprocessor - - - lex-in-preprocessor - - patterns - - include #lex-core - include #lex-keyword - include #lex-constant - - - lex-core - - patterns - - include #comments - include #lex-access - include #lex-continuation - include #lex-newline - include #lex-number - include #lex-string - - - lex-access - - match - (?:(?<=\.)|(?<=->))\b([a-zA-Z_]\w*+)\b(?!(?:\s|/\*.*?\*/)*+\() - name - variable.other.dot-access.c - - lex-continuation - - patterns - - - match (\\)$(\n?) - name punctuation.separator.continuation.c - captures - - 1 name keyword.other.line-continuation.c - 2 name punctuation.whitespace.newline.c - - - - match \\(\s+?)(?=\n)$ - captures - - 1 name invalid.deprecated.space-after-continuation.c - - - - - lex-newline - - match $\n - name punctuation.whitespace.newline.c - - - lex-keyword - - patterns - - - match \s*\b(sizeof|(?:__|(?!\w+__))typeof(?:__)?)\b - captures - - 1 name keyword.operator.c - - - - match \s*\b((?:__|(?!\w+__))asm(?:__)?|break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while|__extension__)\b - captures - - 1 name keyword.control.c - - - - match \s*\b(auto|bool|_Bool|char|_Complex|double|float|_Imaginary|int|long|short|signed|unsigned|void)\b - captures - - 1 name storage.type.c - - - - match \s*\b(extern|static|register|__attribute__|(?:__|(?!\w+__))(?:const|restrict|volatile|inline)(?:__)?)\b - captures - - 1 name storage.modifier.c - - - - match \s*\b(class|struct|union|enum|typedef)\b - captures - - 1 name storage.type.c - - - - - match - (\-|\+|\*|\/|%|&|\||\^|<<|>>)?= - name - keyword.operator.assignment.c - - - match - (==|!=|<=|>=|<>|<|>) - name - keyword.operator.comparison.c - - - match - (\-\-|\+\+) - name - keyword.operator.increment-decrement.c - - - match - (\?|:) - name - keyword.operator.ternary.c - - - match - (\-|\+|\*|\/|%) - name - keyword.operator.arithmetic.c - - - match - (!|&&|\|\|) - name - keyword.operator.logical.c - - - match - (~|&|\||\^|<<|>>) - name - keyword.operator.bitwise.c - - - match - (\.|->)(?=(?:\s|/\*.*?\*/)*+[A-Za-z_]\w*+) - name - keyword.operator.dereference.c - - - - lex-constant - - patterns - - - match \s*\b(NULL|true|false|TRUE|FALSE)\b - captures - - 1 name constant.language.c - - - - - lex-number - - patterns - - - match (?ix) # hexadecimal float - (?<!\.) \b - - (0x) - - # significand - (?: (\.) (?=p) # invalid - | [0-9a-f]*+ ([0-9a-z]*?) [0-9a-f]*+ - (?: \. [0-9a-f]*+ ([0-9a-z.]*?) [0-9a-f]*+ )? ) - - # exponent (required) - (?: (p) (?: [+\-] [0-9]++ ([0-9a-z]*?) - | (?=[0-9a-z.]) [0-9]*+ ([0-9a-z.]*?) ) - | (p) ) - - # remaining valid chars and type - [0-9]*+ ([fl]?) - - \b (?!\.) - - name constant.numeric.float.hexadecimal.c - captures - - 1 name storage.type.number.prefix.hexadecimal.c - 2 name invalid.illegal.number.missing-fragment.significand.c - 3 name invalid.illegal.numeric-literal-character.float.whole-number.c - 4 name invalid.illegal.numeric-literal-character.float.fraction.c - 5 name keyword.other.exponent.hexadecimal.c - 6 name invalid.illegal.numeric-literal-character.float.exponent.c - 7 name invalid.illegal.numeric-literal-character.float.exponent.c - 8 name invalid.illegal.number.missing-fragment.exponent.c - 9 name storage.type.number.suffix.float.c - - - - match (?ix) # hexadecimal float without required exponent - (?<!\.) \b - - (0x) - - # significand (at least a period) - [0-9a-f]*+ ([0-9a-z&&[^p]]*?) [0-9a-f]*+ - (\.) [0-9a-f]*+ ([0-9a-z.&&[^p]]*?) [0-9a-f]*+ - - # type - (l?) - - (?:(?<=\.)|\b) (?!\.) - - name constant.numeric.float.hexadecimal.c - captures - - 1 name storage.type.number.prefix.hexadecimal.c - 2 name invalid.illegal.numeric-literal-character.float.whole-number.c - 3 name invalid.illegal.number.hexadecimal-float-requires-exponent.c - 4 name invalid.illegal.numeric-literal-character.float.fraction.c - 5 name storage.type.number.suffix.float.c - - - - match (?ix) # decimal float literal - (?<!\.) (?:(?=\.)|\b) - - (?!0x) - # significand - (?: (?: [0-9]++ ([0-9a-z&&[^e]]*?) [0-9]*+ )? - \. [0-9]++ ([0-9a-z.&&[^e]]*?) [0-9]*+ - - | [0-9]++ ([0-9a-z&&[^e]]*?) [0-9]*+ (?: \. | (?=e)) ) - - # exponent (optional) - (?: (e) (?: [+\-] [0-9]++ ([0-9a-z]*?) - | [0-9]++ ([0-9a-z.]*?) ) - | ( p [+\-]? [0-9]++ - | [ep] [0-9a-z.]*?) )? - - # any invalid chars and type - ([0-9a-z]*?) [0-9]*+ ([fl]?) - - (?:(?<=\.)|\b) (?!\.) - - name constant.numeric.float.c - captures - - 1 name invalid.illegal.numeric-literal-character.float.whole-number.c - 2 name invalid.illegal.numeric-literal-character.float.fraction.c - 3 name invalid.illegal.numeric-literal-character.float.whole-number.c - 4 name keyword.other.exponent.decimal.c - 5 name invalid.illegal.numeric-literal-character.float.exponent.c - 6 name invalid.illegal.numeric-literal-character.float.exponent.c - 7 name invalid.illegal.numeric-literal-character.float.exponent.c - 8 name invalid.illegal.numeric-literal-character.float.exponent.c - 9 name storage.type.number.suffix.float.c - - - - match (?ix) - (?<!\.) \b - (0x)? 0++ - (u?l{0,2}|lul?|llu) - \b (?!\.) - - name constant.numeric.integer.zero.c - captures - - 1 name storage.type.number.prefix.hexadecimal.c - 2 name storage.type.number.suffix.c - - - - match (?ix) - (?<!\.) \b - - (?: (0x) | (0b) ) - (u?l{0,2}|lul?|llu) - - \b (?!\.) - - name invalid.illegal.invalid-number-literal.c - - - match (?ix) - (?<!\.) \b - - (0x) [0-9a-f]++ - - # any invalid chars - ([0-9a-z]*?) - - # the remainder (after invalid chars, if any) and a type - [0-9a-f]* (u?l{0,2}|lul?|llu) - - \b (?!\.) - - name constant.numeric.integer.hexadecimal.c - captures - - 1 name storage.type.number.prefix.hexadecimal.c - 2 name invalid.illegal.numeric-literal-character.integer.c - 3 name storage.type.number.suffix.c - - - - match (?ix) - (?<!\.) \b - - (0b) [01]++ - - # any invalid chars - ([0-9a-z]*?) - - # the remainder (after invalid chars, if any) and a type - [01]* (u?l{0,2}|lul?|llu) - - \b (?!\.) - - name constant.numeric.integer.binary.c - captures - - 1 name storage.type.number.prefix.binary.c - 2 name invalid.illegal.numeric-literal-character.integer.c - 3 name storage.type.number.suffix.c - - - - match (?ix) - (?<!\.) \b - - (0) [0-7]++ - - # any invalid chars - ([0-9a-z]*?) - - # the remainder (after invalid chars, if any) and a type - [0-7]* (u?l{0,2}|lul?|llu) - - \b (?!\.) - - name constant.numeric.integer.octal.c - captures - - 1 name storage.type.number.prefix.octal.c - 2 name invalid.illegal.numeric-literal-character.integer.c - 3 name storage.type.number.suffix.c - - - - match (?ix) - (?<!\.) \b - - [0-9]++ - - # any invalid chars - ([0-9a-z]*?) - - # the remainder (after invalid chars, if any) and a type - [0-9]* (u?l{0,2}|lul?|llu) - - \b (?!\.) - - name constant.numeric.integer.decimal.c - captures - - 1 name invalid.illegal.numeric-literal-character.integer.c - 2 name storage.type.number.suffix.c - - - - - lex-string - - patterns - - - begin " - beginCaptures - - 0 name punctuation.definition.string.begin.c - - end (")|(?<=^|[^\\])\s*(\n) - endCaptures - - 1 name punctuation.definition.string.end.c - 2 name invalid.illegal.unexpected-end-of-line.c - - name string.quoted.double.c - patterns - - include #lex-continuation - include #string_escaped_char - include #string_placeholder - - - - begin ' - beginCaptures - - 0 name punctuation.definition.string.begin.c - - end (')|(?<=^|[^\\])\s*(\n) - endCaptures - - 1 name punctuation.definition.string.end.c - 2 name invalid.illegal.unexpected-end-of-line.c - - name string.quoted.single.c - patterns - - include #lex-continuation - include #string_escaped_char - - - - - string_escaped_char - - patterns - - - match \\(\\|[abefnprtv'"?]|[0-3]\d{,2}|[4-7]\d?|x[a-fA-F0-9]{,2}|u[a-fA-F0-9]{,4}|U[a-fA-F0-9]{,8}) - name constant.character.escape.c - - - match \\. - name invalid.illegal.unknown-escape.c - - - - string_placeholder - - patterns - - - match - (?x)% - (\d+\$)? # field (argument #) - [#0\- +']* # flags - [,;:_]? # separator character (AltiVec) - ((-?\d+)|\*(-?\d+\$)?)? # minimum field width - (\.((-?\d+)|\*(-?\d+\$)?)?)? # precision - (hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier - [diouxXDOUeEfFgGaACcSspn%] # conversion type - - name constant.other.placeholder.c - - - match % - name invalid.illegal.placeholder.c - - - - - - scopeName - source.c - uuid - 24242A3A-CC4A-414D-B1FA-18D2BABB6754 - + + comment + + https://github.com/abusalimov/SublimeCImproved + + Derived from C.tmLanguage - the original TextMate and Sublime Text + syntax definition. + + + fileTypes + + c + h + + firstLineMatch + -[*]-( Mode:)? C -[*]- + foldingStartMarker + (?x) + /\*\*(?!\*) + |^(?![^{]*?//|[^{]*?/\*(?!.*?\*/.*?\{)).*?\{\s*($|//|/\*(?!.*?\*/.*\S)) + + foldingStopMarker + (?<!\*)\*\*/|^\s*\} + keyEquivalent + ^~C + name + C Improved + patterns + + + include + #translation_unit + + + repository + + translation_unit + + patterns + + + include + #special_block + + + include + #typedef + + + include + #type + + + include + #lex + + + include + #support-macro + + + include + #function + + + include + #support + + + include + #block + + + include + #parens + + + + special_block + + begin + (?x) + (?= \s* + (?: + (?: \b extern \b + (?: "(\\.|[^"])*" | '(\\.|[^'])*' | /\*.*?\*/ | \s)* ) | + (?: \b namespace \b + (?: (?: /\*.*?\*/ | \s)* \b [A-Za-z_]\w*+ \b)? + (?: /\*.*?\*/ | \s)* ) ) + \{ ) + + end + \} + patterns + + + include + #lex + + + begin + \{ + end + (?=\}) + name + meta.block.special.c + patterns + + + include + $base + + + + + + + block + + begin + (?=\{) + end + \} + patterns + + + include + #block-lookahead-end + + + + block-lookahead-end + + begin + \{ + end + (?=\}) + name + meta.block.c + patterns + + + include + #typedef + + + include + #type + + + include + #lex + + + include + #call + + + include + #support + + + include + #function + + + include + $base + + + + parens + + begin + (?=\() + end + \) + patterns + + + include + #parens-lookahead-end + + + + parens-lookahead-end + + begin + \( + end + (?=\)) + name + meta.parens.c + patterns + + + include + #type + + + include + #lex + + + include + #call + + + include + #support + + + include + $base + + + + typedef + + begin + (?x) (?<= \A typedef | \W typedef ) \b + end + ; + name + meta.typedef.c + patterns + + + include + #lex + + + include + #type-definition + + + include + #block + + + match + \s*\b([A-Za-z_]\w*+)(?=\s*[\[;]) + captures + + 1 + + name + entity.name.type.typedef.c + + + + + + type + + patterns + + + include + #type-declaration + + + include + #type-definition + + + + type-declaration + + begin + (?x) + (?<= \A enum | \A (?:class|union) | \A struct | + \W enum | \W (?:class|union) | \W struct ) \b + (?= (?:\s|/\*.*?\*/)*+ + ([A-Za-z_]\w*+) + (?:\s|/\*.*?\*/)*+; ) + + end + (?<=;) + name + meta.compound.c + patterns + + + include + #lex + + + match + \s*\b([A-Za-z_]\w*+)\b + captures + + 1 + + name + entity.name.type.declaration.c + + + + + + type-definition + + begin + (?x) + (?<= \A enum | \A (?:class|union) | \A struct | + \W enum | \W (?:class|union) | \W struct ) \b + + # Negation of zero-length parts of the end pattern + # to prevent entering the rule if it's gonna exit immediately. + # (workaround ST2 bugs, see issue #10) + (?=\s*(?:[A-Za-z_({]|/[/*]|$)) + (?! \s*\b(?: [A-Za-z_]\w*+ ) (?= \s* [\[;] ) ) + + end + (?x) + (?: (?!\s*(?:[A-Za-z_({]|/[/*]|$)) + | (?= \s*\b(?: [A-Za-z_]\w*+ ) (?= \s* [\[;] ) ) + | (?<!\})(?= + # Prefer function definition over an attribute defined + # through a macro, unless a block has been seen. That is: + # struct __packed __aligned(16) foo {...}; - function __aligned + # struct foo {...} __packed __aligned(16); - structure foo + (?! \s* \b__attribute__\b ) + + (?: ^ + | (?<! (?<!\w) new + | (?<!\w) (?:else|enum) | (?<!\w) (?:class|union) + | (?<!\w) (?:struct|return|sizeof|typeof) + | (?<!\w) __typeof | (?<!\w) __typeof__ ) + (?<= \w ) \s + + | # or type modifier / closing bracket before name + (?<= [^&]& | [*>)}\]] ) ) \s* + + (?: [A-Za-z_]\w*+ | ::[^:] )++ + (?: (?<= ^ operator | \W operator ) # C++ operator? + (?: [-*&<>=+!]+ | \(\) | \[\] ) )? + (?:\s|/\*.*?\*/)*+ \( ) ) + + name + meta.compound.c + patterns + + + begin + (?<=\}) + end + (?!\s*(?:[A-Za-z_({]|/[/*]|$)) + patterns + + + include + #lex + + + include + #block + + + include + #parens + + + + + include + #lex + + + include + #block + + + include + #parens + + + match + \b([A-Za-z_]\w*+)(?=(?:\s|/\*.*?\*/)*+(?:\{|(//.*)?\\?$)) + captures + + 1 + + name + entity.name.type.class.c entity.name.class.c + + + + + + function + + patterns + + + include + #function-fixup-macro + + + include + #function-declaration + + + include + #function-definition + + + + function-fixup-macro + + begin + (?x) + ^ # Begin of line, capital letters: most probably it is a macro + \s*\b + ([A-Z0-9_]++) + \b + (?= (?:\s|/\*.*?\*/)*+ \( ) + + end + \) + patterns + + + include + #lex + + + include + #parens-lookahead-end + + + + function-declaration + + name + meta.function.c + begin + (?x) + (?: ^ + | (?<! (?<!\w) new + | (?<!\w) (?:else|enum) | (?<!\w) (?:class|union) + | (?<!\w) (?:struct|return|sizeof|typeof) + | (?<!\w) __typeof | (?<!\w) __typeof__ ) + (?<= \w ) \s + + | # or type modifier / closing bracket before name + (?<= [^&]& | [*>)}\]] ) ) \s* + + ( (?: [A-Za-z_]\w*+ | ::[^:] )++ + (?: (?<= ^ operator | \W operator ) # C++ operator? + (?: [-*&<>=+!]+ | \(\) | \[\] ) )? ) + + (?= (?:\s|/\*.*?\*/)*+ (?'parens' \( + (?> \g'parens' | + "(\\.|[^"])*" | '(\\.|[^'])*' | /\*.*?\*/ | + (?! /[/*] | [()] ) . )* + \) ) \s* ; ) + + beginCaptures + + 1 + + name + entity.name.function.declaration.c + + + end + ; + patterns + + + include + #lex + + + include + #parens + + + + function-definition + + name + meta.function.c + begin + (?x) + (?: ^ + | (?<! (?<!\w) new + | (?<!\w) (?:else|enum) | (?<!\w) (?:class|union) + | (?<!\w) (?:struct|return|sizeof|typeof) + | (?<!\w) __typeof | (?<!\w) __typeof__ ) + (?<= \w ) \s + + | # or type modifier / closing bracket before name + (?<= [^&]& | [*>)}\]] ) ) \s* + + ( (?: [A-Za-z_]\w*+ | ::[^:] )++ + (?: (?<= ^ operator | \W operator ) # C++ operator? + (?: [-*&<>=+!]+ | \(\) | \[\] ) )? ) + + (?= (?:\s|/\*.*?\*/)*+ \( ) + + beginCaptures + + 1 + + name + entity.name.function.definition.c + + + end + \}|; + patterns + + + include + #lex + + + include + #parens + + + match + \s*\b(const|override)\b + name + storage.modifier.c + + + include + #block-lookahead-end + + + + call + + name + meta.function-call.c + begin + (?x) + \s* + (?= # don't consume to recognize support functions + (?: [A-Za-z_]\w*+ | ::[^:] )++ + (?:\s|/\*.*?\*/)*+ \( ) + + end + \) + patterns + + + include + #lex + + + include + #support-function + + + match + (?:(?<=\.)|(?<=->))\b([A-Za-z_]\w*+)\b + name + variable.other.dot-access.c support.function.any-method.c + + + match + (?:[A-Za-z_]\w*+|::[^:])++ + name + support.function.any-method.c + + + include + #parens-lookahead-end + + + + preprocessor + + begin + (?=^\s*(#)) + end + (?!^\s*(#)) + patterns + + + include + #preprocessor-disabled + + + include + #ppline-directive-invalid-usage + + + include + #ppline-macro + + + include + #ppline-undef + + + include + #ppline-pragma-mark + + + include + #ppline-include + + + include + #ppline-directive + + + include + #ppline-directive-obsolete + + + include + #ppline-invalid + + + include + #ppline-any + + + + preprocessor-lex + + patterns + + + include + #comments + + + include + #lex-continuation + + + include + #lex-newline + + + + preprocessor-disabled + + begin + ^\s*(#)(?=\s*(if)\b(?=(?:\s|/\*.*?\*/)*+(0[xX])?0++\b(?:\s|/\*.*?\*/)*+(//.*)?\\?$)) + beginCaptures + + 0 + + name + meta.preprocessor.directive.c keyword.other.preprocessor.c + + + end + (?=^\s*(#)\s*(endif|else|elif)\b) + patterns + + + begin + ^ + end + $\n? + name + comment.other.preprocessor-disabled.c + patterns + + + include + #preprocessor-disabled-conditional + + + include + #preprocessor-disabled-directive + + + + + begin + (?<!##)(?<=#)\s*(if)\b(?=(?:\s|/\*.*?\*/)*+(0[xX])?0++\b(?:\s|/\*.*?\*/)*+(//.*)?\\?$) + beginCaptures + + 1 + + name + keyword.other.preprocessor.define.c + + + end + (?<=$\n)(?<!\\$\n) + name + meta.preprocessor.directive.c + patterns + + + include + #lex-core + + + + + + preprocessor-disabled-conditional + + begin + ^\s*(#)\s*if(n?def)?\b + end + ^\s*(#)\s*endif\b.*$\n? + patterns + + + include + #preprocessor-disabled-conditional + + + include + #preprocessor-disabled-directive + + + + preprocessor-disabled-directive + + begin + ^\s*(#) + end + (?<=$\n)(?<!\\$\n) + + ppline-macro + + begin + ^\s*(#)(?=\s*(define)\s+[a-zA-Z_]\w*+) + beginCaptures + + 0 + + name + keyword.other.preprocessor.c + + + end + (?<=$\n)(?<!\\$\n) + name + meta.preprocessor.macro.c + patterns + + + match + \s*(##) + captures + + 1 + + name + keyword.other.preprocessor.c + + + + + match + \s*(#)\s*([a-zA-Z_]\w*+) + captures + + 1 + + name + keyword.other.preprocessor.c + + 2 + + name + string.macro.stringify.c + + + + + include + #ppline-macro-head-function + + + include + #ppline-macro-head-object + + + include + #lex-in-preprocessor + + + include + #support + + + + ppline-macro-head-object + + match + (?<!##)(?<=#)(\s*define)\s+([a-zA-Z_]\w*+)(?!\()[\s&&[^\n]]* + captures + + 1 + + name + keyword.other.preprocessor.define.c + + 2 + + name + entity.name.constant.preprocessor.c + + + + ppline-macro-head-function + + begin + (?<!##)(?<=#)(\s*define)\s+([a-zA-Z_]\w*+)(\() + beginCaptures + + 1 + + name + keyword.other.preprocessor.define.c + + 2 + + name + entity.name.function.preprocessor.c + + 3 + + name + meta.preprocessor.macro.parameters.c + + + end + (?<=\))|(?<=^|[^\\])\s*(\n) + endCaptures + + 1 + + name + invalid.illegal.unexpected-end-of-line.c + + + contentName + meta.preprocessor.macro.parameters.c + patterns + + + match + \) + + + begin + \b([a-zA-Z_]\w*+)\b + beginCaptures + + 1 + + name + variable.parameter.c + + + end + (?<=\))|(?=(?<=^|[^\\])\s*(\n)) + patterns + + + match + \) + + + include + #ppline-macro-param-next + + + include + #ppline-macro-param-vararg + + + include + #ppline-macro-param-lex + + + include + #ppline-macro-param-lex-invalid + + + + + include + #ppline-macro-param-vararg + + + include + #ppline-macro-param-lex + + + include + #ppline-macro-param-lex-invalid + + + + ppline-macro-param-next + + begin + (,) + beginCaptures + + 1 + + name + punctuation.separator.parameter.c + + + end + \b([a-zA-Z_]\w*+)\b|(?=\.\.\.)|(\))|(?=(?<=^|[^\\])\s*(\n)) + endCaptures + + 1 + + name + variable.parameter.c + + 2 + + name + invalid.illegal.unexpected-closing-paren.c + + + patterns + + + include + #ppline-macro-param-lex + + + match + (?x) + (?: (?! (?:\s|/\*.*?\*/)*+ + (?: \b([a-zA-Z_]\w*+)\b | \.\.\. | \) | (?>(?:\\\s*)?$\n?) | /[/*] ) ) + .)* + + name + invalid.illegal.unexpected-character.c + + + + ppline-macro-param-vararg + + begin + (\.\.\.) + beginCaptures + + 1 + + name + punctuation.definition.ellipsis.c + + + end + (\))|(?=(?<=^|[^\\])\s*(\n)) + patterns + + + include + #ppline-macro-param-lex + + + match + (?x) + (?: (?! (?:\s|/\*.*?\*/)*+ + (?: \) | (?>(?:\\\s*)?$\n?) | /[/*] ) ) + .)* + + name + invalid.illegal.unexpected-character.c + + + + ppline-macro-param-lex + + patterns + + + match + \s* + + + begin + \s*// + beginCaptures + + 0 + + name + punctuation.definition.comment.c + + + end + (?<=^|[^\\])\s*(?=\n)$ + name + invalid.illegal.unexpected-end-of-line.c + patterns + + + include + #lex-continuation + + + + + include + #preprocessor-lex + + + + ppline-macro-param-lex-invalid + + patterns + + + match + (?x) + (?: (?! (?:\s|/\*.*?\*/)*+ + (?: \) | (?>(?:\\\s*)?$\n?) | /[/*] ) ) + .) # no star unlike its friends in arg/vararg + + name + invalid.illegal.unexpected-character.c + + + + ppline-undef + + begin + (^\s*(#)\s*(undef))\s+([a-zA-Z_]\w*+) + beginCaptures + + 1 + + name + keyword.other.preprocessor.c + + 4 + + name + variable.macro.undef.c + + + end + (?<=$\n)(?<!\\$\n) + name + meta.preprocessor.undef.c + patterns + + + ppline-include + + begin + ^\s*(#)\s*(include|include_next|import)\b + beginCaptures + + 0 + + name + keyword.other.preprocessor.include.c + + + end + (?:("[^"]*?)|(<[^>]*?))(\n)|(?<=$\n)(?<!\\$\n) + endCaptures + + 1 + + name + string.quoted.double.include.c + + 2 + + name + string.quoted.other.lt-gt.include.c + + 3 + + name + invalid.illegal.unexpected-end-of-line.c + + + name + meta.preprocessor.include.c meta.preprocessor.c.include + patterns + + + include + #ppline-include-innards + + + + ppline-include-innards + + patterns + + + include + #preprocessor-lex + + + begin + "|(?=.*?") + beginCaptures + + 0 + + name + punctuation.definition.string.begin.c + + + end + "|(?<=^|[^\\])(?=\s*\n) + endCaptures + + 0 + + name + punctuation.definition.string.end.c + + + name + string.quoted.double.include.c + + + begin + <(?=.*?>) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.c + + + end + >|(?<=^|[^\\])(?=\s*\n) + endCaptures + + 0 + + name + punctuation.definition.string.end.c + + + name + string.quoted.other.lt-gt.include.c + + + begin + \( + end + \)|(?<=^|[^\\])(?=\s*\n) + name + meta.parens.c + patterns + + + include + #ppline-include-innards + + + + + + ppline-pragma-mark + + begin + (^\s*(#)\s*(pragma\s+mark)\b)[\s&&[^\n]]* + beginCaptures + + 1 + + name + keyword.other.preprocessor.pragma.c + + + end + (?<=$\n)(?<!\\$\n) + name + meta.preprocessor.directive.pragma-mark.c + contentName + meta.toc-list.pragma-mark.c + patterns + + + include + #preprocessor-lex + + + match + . + name + string.other.pragma-mark.c + + + + ppline-directive + + begin + ^\s*(#)\s*(if|ifdef|ifndef|elif|else|endif|pragma|line|define|undef|error|warning)\b + beginCaptures + + 0 + + name + keyword.other.preprocessor.c + + + end + (?<=$\n)(?<!\\$\n) + name + meta.preprocessor.directive.c + patterns + + + include + #lex-core + + + + ppline-directive-invalid-usage + + match + (^\s*(#)\s*(if|ifdef|ifndef|elif|pragma|define|undef|include|include_next|import)\b)\s*?(\n|$) + captures + + 1 + + name + keyword.other.preprocessor.c + + 4 + + name + invalid.illegal.invalid-usage-of-preprocessor-directive.c + + + name + meta.preprocessor.directive.c + + ppline-directive-obsolete + + begin + ^\s*(#)\s*(assert|unassert|ident|sccs)\b + end + (?<=$\n)(?<!\\$\n) + beginCaptures + + 1 + + name + keyword.other.preprocessor.c + + 2 + + name + invalid.deprecated.preprocessor.c + + + name + meta.preprocessor.directive.deprecated.c + patterns + + + include + #lex-core + + + + ppline-invalid + + begin + ^\s*(#)(?!\s*(?=/[/*]|(?>\\\s*\n)|\n|$))\s*(\w*) + end + (?<=$\n)(?<!\\$\n) + beginCaptures + + 1 + + name + keyword.other.preprocessor.c + + 2 + + name + invalid.illegal.preprocessor.c + + + name + meta.preprocessor.directive.illegal.c + + ppline-any + + begin + ^\s*(#) + beginCaptures + + 0 + + name + keyword.other.preprocessor.c + + + end + (?<=$\n)(?<!\\$\n) + name + meta.preprocessor.directive.null-directive.c + patterns + + + include + #lex-core + + + + support + + patterns + + + include + #support-type + + + include + #support-macro + + + include + #support-function + + + + support-type + + patterns + + + match + \s*\b(u_char|u_short|u_int|u_long|ushort|uint|(?:u_quad|quad|qaddr|caddr|daddr|dev|fixpt|blkcnt|blksize|gid|in_addr|in_port|ino|key|mode|nlink|id|pid|off|segsz|swblk|uid|id|clock|size|ssize|time|useconds|suseconds)_t)\b + captures + + 1 + + name + support.type.sys-types.c + + + + + match + \s*\b(pthread_(?:t|attr_t|once_t|key_t|(?:cond|mutex|rwlock)(?:attr)?_t))\b + captures + + 1 + + name + support.type.pthread.c + + + + + match + \s*\b(u?int(?:(?:_least|_fast)?(?:8|16|32|64)_t|ptr_t|max_t))\b + captures + + 1 + + name + support.type.stdint.c + + + + + match + \s*\b(noErr|kNilOptions|kInvalidID|kVariableLengthArray)\b + captures + + 1 + + name + support.constant.mac-classic.c + + + + + match + \s*\b(AbsoluteTime|Boolean|Byte|ByteCount|ByteOffset|BytePtr|CompTimeValue|ConstLogicalAddress|ConstStrFileNameParam|ConstStringPtr|Duration|Fixed|FixedPtr|Float32|Float32Point|Float64|Float80|Float96|FourCharCode|Fract|FractPtr|Handle|ItemCount|LogicalAddress|OptionBits|OSErr|OSStatus|OSType|OSTypePtr|PhysicalAddress|ProcessSerialNumber|ProcessSerialNumberPtr|ProcHandle|Ptr|ResType|ResTypePtr|ShortFixed|ShortFixedPtr|SignedByte|SInt16|SInt32|SInt64|SInt8|Size|StrFileName|StringHandle|StringPtr|TimeBase|TimeRecord|TimeScale|TimeValue|TimeValue64|UInt16|UInt32|UInt64|UInt8|UniChar|UniCharCount|UniCharCountPtr|UniCharPtr|UnicodeScalarValue|UniversalProcHandle|UniversalProcPtr|UnsignedFixed|UnsignedFixedPtr|UnsignedWide|UTF16Char|UTF32Char|UTF8Char)\b + captures + + 1 + + name + support.type.mac-classic.c + + + + + match + (?x) + \s*\b + ( Py(?:Var|Type|HeapType|Dict|Set|List|Tuple|BaseException)?Object + | PyType_(?:Spec|Slot) ) + \b + + captures + + 1 + + name + support.type.cpython.c + + + + + match + (?x) + \s*\b + ( Py(?:BaseObject|Type|Super|Bool|Dict + |DictIter(?:Key|Value|Item) + |Dict(?:Key|Value|Item)s + |(?:Set|List|Tuple)(?:Iter)? + |FrozenSet|ListRevIter)_Type + | _?PyExc_\w++ + | Py_(?:False|True|None|NotImplemented) ) + \b + + captures + + 1 + + name + support.constant.cpython.c + + + + + + support-macro + + patterns + + + match + \s*\b(__builtin_\w++)\b + captures + + 1 + + name + support.function.intrinsic.c + + + + + match + (?x) + \s*\b + ( (?:__)?(?:DECL(?:ARE)?|DEF(?:INE)?)_[A-Z0-9_]+ + | (?:__)?[A-Z_][A-Z0-9_]*_(?:DECL(?:ARE)?|DEF(?:INE)?) + | EXPORT(?:_UNUSED)?(?:_PER_CPU)?_SYMBOL(?:_GPL(?:_FUTURE)?)? + | MODULE_(?:INFO|ALIAS|LICENSE|AUTHOR|DESCRIPTION|DEVICE_TABLE|VERSION|FIRMWARE) + | (?:__)?MODULE_PARM_(?:TYPE|DESC) + | module_param(?:(?:_array)?(?:_named)?|_call) + | (?:module|core|postcore|arch|subsys|fs|device|late)_param_cb + | [HL]?LIST_HEAD + | (?:_|__BIN|BIN|BUS|DRIVER|CLASS|DEVICE)_ATTR(?:_R[OW])? ) + \b + + captures + + 1 + + name + support.function.linux-kernel.macro.c + + + + + match + (?x) + \s*\b + ( _(?:IRQL|Kernel)_\w+_ + | _Interlocked_operand_ + | _Dispatch_type_ + | _Flt_CompletionContext_Outptr_ ) + \b + + captures + + 1 + + name + support.function.windows-sal2.annotation.c + + + + + match + (?x) + \s*\b + ( PyAPI_(?:FUNC|DATA) + | PyMODINIT_FUNC + | Py_LOCAL(?:_INLINE)? + | PyDoc_(?:STR(?:VAR)?|VAR) + | PyObject(?:_VAR)?_HEAD + | _PyObject_HEAD_EXTRA + | PyException_HEAD + | Py(?:Var)?Object_HEAD_INIT + | PyModuleDef_HEAD_INIT + | Py_(RETURN)_(?:FALSE|TRUE|NONE|NOTIMPLEMENTED|NAN|INF) ) + \b + + captures + + 1 + + name + support.function.cpython.macro.c + + 2 + + name + keyword.control.c + + + + + match + \s*\b(_Py_IDENTIFIER)\b\s*\(\s*([A-Za-z_]\w*+)\s*\) + captures + + 1 + + name + support.function.cpython.macro.c + + 2 + + name + string.support.cpython.identifier.c + + + + + match + \s*\bPyId_([A-Za-z_]\w*+)\b + captures + + 1 + + name + string.support.cpython.identifier.c + + + + + match + \s*\b((?:CONFIG|HAVE)_[A-Z0-9_]++)\b + captures + + 1 + + name + support.constant.config.c + + + + + + support-function + + patterns + + + match + \s*\b(hypot(f|l)?|s(scanf|ystem|nprintf|ca(nf|lb(n(f|l)?|ln(f|l)?))|i(n(h(f|l)?|f|l)?|gn(al|bit))|tr(s(tr|pn)|nc(py|at|mp)|c(spn|hr|oll|py|at|mp)|to(imax|d|u(l(l)?|max)|k|f|l(d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(jmp|vbuf|locale|buf)|qrt(f|l)?|w(scanf|printf)|rand)|n(e(arbyint(f|l)?|xt(toward(f|l)?|after(f|l)?))|an(f|l)?)|c(s(in(h(f|l)?|f|l)?|qrt(f|l)?)|cos(h(f)?|f|l)?|imag(f|l)?|t(ime|an(h(f|l)?|f|l)?)|o(s(h(f|l)?|f|l)?|nj(f|l)?|pysign(f|l)?)|p(ow(f|l)?|roj(f|l)?)|e(il(f|l)?|xp(f|l)?)|l(o(ck|g(f|l)?)|earerr)|a(sin(h(f|l)?|f|l)?|cos(h(f|l)?|f|l)?|tan(h(f|l)?|f|l)?|lloc|rg(f|l)?|bs(f|l)?)|real(f|l)?|brt(f|l)?)|t(ime|o(upper|lower)|an(h(f|l)?|f|l)?|runc(f|l)?|gamma(f|l)?|mp(nam|file))|i(s(space|n(ormal|an)|cntrl|inf|digit|u(nordered|pper)|p(unct|rint)|finite|w(space|c(ntrl|type)|digit|upper|p(unct|rint)|lower|al(num|pha)|graph|xdigit|blank)|l(ower|ess(equal|greater)?)|al(num|pha)|gr(eater(equal)?|aph)|xdigit|blank)|logb(f|l)?|max(div|abs))|di(v|fftime)|_Exit|unget(c|wc)|p(ow(f|l)?|ut(s|c(har)?|wc(har)?)|error|rintf)|e(rf(c(f|l)?|f|l)?|x(it|p(2(f|l)?|f|l|m1(f|l)?)?))|v(s(scanf|nprintf|canf|printf|w(scanf|printf))|printf|f(scanf|printf|w(scanf|printf))|w(scanf|printf)|a_(start|copy|end|arg))|qsort|f(s(canf|e(tpos|ek))|close|tell|open|dim(f|l)?|p(classify|ut(s|c|w(s|c))|rintf)|e(holdexcept|set(e(nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(aiseexcept|ror)|get(e(nv|xceptflag)|round))|flush|w(scanf|ide|printf|rite)|loor(f|l)?|abs(f|l)?|get(s|c|pos|w(s|c))|re(open|e|ad|xp(f|l)?)|m(in(f|l)?|od(f|l)?|a(f|l|x(f|l)?)?))|l(d(iv|exp(f|l)?)|o(ngjmp|cal(time|econv)|g(1(p(f|l)?|0(f|l)?)|2(f|l)?|f|l|b(f|l)?)?)|abs|l(div|abs|r(int(f|l)?|ound(f|l)?))|r(int(f|l)?|ound(f|l)?)|gamma(f|l)?)|w(scanf|c(s(s(tr|pn)|nc(py|at|mp)|c(spn|hr|oll|py|at|mp)|to(imax|d|u(l(l)?|max)|k|f|l(d|l)?|mbs)|pbrk|ftime|len|r(chr|tombs)|xfrm)|to(b|mb)|rtomb)|printf|mem(set|c(hr|py|mp)|move))|a(s(sert|ctime|in(h(f|l)?|f|l)?)|cos(h(f|l)?|f|l)?|t(o(i|f|l(l)?)|exit|an(h(f|l)?|2(f|l)?|f|l)?)|b(s|ort))|g(et(s|c(har)?|env|wc(har)?)|mtime)|r(int(f|l)?|ound(f|l)?|e(name|alloc|wind|m(ove|quo(f|l)?|ainder(f|l)?))|a(nd|ise))|b(search|towc)|m(odf(f|l)?|em(set|c(hr|py|mp)|move)|ktime|alloc|b(s(init|towcs|rtowcs)|towc|len|r(towc|len))))\b + captures + + 1 + + name + support.function.C99.c + + + + + match + (?x) + \s*\b + ( Py_REFCNT | Py_TYPE | Py_SIZE + | Py_X?(?:INC|DEC)REF | Py_CLEAR + | _?Py(?:Object|Type|HeapType|Dict|Set|List|Tuple|Long|Exception|Err)_\w++ ) + \b + + captures + + 1 + + name + support.function.cpython.c + + + + + + comments + + patterns + + + begin + \s*(/\*) + captures + + 1 + + name + punctuation.definition.comment.block.c + + + end + (\*/)(\n?) + endCaptures + + 2 + + name + punctuation.whitespace.newline.c + + + name + comment.block.c + patterns + + + include + #comment-innards + + + + + match + \*/(?![/*]) + name + invalid.illegal.stray-comment-end.c + + + begin + \s*(//) + beginCaptures + + 1 + + name + punctuation.definition.comment.line.double-slash.c++ + + + end + (?<=$\n)(?<!\\$\n) + name + comment.line.double-slash.c++ + patterns + + + include + #comment-innards + + + + + + comment-innards + + patterns + + + include + #comment-banner-line + + + include + #comment-task-tag-line + + + include + #lex-continuation + + + include + #lex-newline + + + + comment-banner-line + + match + (?:(?<=//)|(?<=/\*)|^)[\s/*]*(=+\s*(.*?)\s*=+(?:(?=[\s/*+\-]*\*/)|$(\n?))) + captures + + 1 + + name + meta.toc-list.banner.c + + 3 + + name + punctuation.whitespace.newline.c + + + + comment-task-tag-line + + patterns + + + begin + (?ix) + (?= (?-i: @[a-zA-Z_]++ | \b [A-Z_]++) \b) @? \b (?: + (FIXME) | (XXX) | (WTF) + ) \b + + beginCaptures + + 0 + + name + keyword.other.task-tag.prio-high.c + + 1 + + name + storage.type.class.fixme.c + + 2 + + name + storage.type.class.xxx.c + + 3 + + name + storage.type.class.wtf.c + + + end + (?=[\s/*]*\*/)|(?<=$\n) + name + meta.toc-list.task-tag.prio-high.c + patterns + + + include + #comment-task-tag-line-innards + + + + + begin + (?ix) + (?= (?-i: @[a-zA-Z_]++ | \b [A-Z_]++) \b) @? \b (?: + (TODO) + ) \b + + beginCaptures + + 0 + + name + keyword.other.task-tag.prio-normal.c + + 1 + + name + storage.type.class.todo.c + + + end + (?=[\s/*]*\*/)|(?<=$\n) + name + meta.toc-list.task-tag.prio-normal.c + patterns + + + include + #comment-task-tag-line-innards + + + + + begin + (?ix) + (?= (?-i: @[a-zA-Z_]++ | \b [A-Z_]++) \b) @? \b (?: + (TBD) | (REVIEW) + ) \b + + beginCaptures + + 0 + + name + keyword.other.task-tag.prio-low.c + + 1 + + name + storage.type.class.tbd.c + + 2 + + name + storage.type.class.review.c + + + end + (?=[\s/*]*\*/)|(?<=$\n) + name + meta.toc-list.task-tag.prio-low.c + patterns + + + include + #comment-task-tag-line-innards + + + + + begin + (?ix) + (?= (?-i: @[a-zA-Z_]++ | \b [A-Z_]++) \b) @? \b (?: + (NOTE) | (NB) | (CHANGED) | (IDEA) | (IMPORTANT) | (HACK) | (BUG) + ) \b + + beginCaptures + + 0 + + name + keyword.other.task-tag.note.c + + 1 + + name + storage.type.class.note.c + + 2 + + name + storage.type.class.nb.c + + 3 + + name + storage.type.class.changed.c + + 4 + + name + storage.type.class.idea.c + + 5 + + name + storage.type.class.important.c + + 6 + + name + storage.type.class.hack.c + + 7 + + name + storage.type.class.bug.c + + + end + (?=[\s/*]*\*/)|(?<=$\n) + name + meta.toc-list.task-tag.note.c + patterns + + + include + #comment-task-tag-line-innards + + + + + + comment-task-tag-line-innards + + patterns + + + include + #comment-task-tag-line + + + include + #lex-continuation + + + include + #lex-newline + + + + lex + + patterns + + + include + #lex-in-preprocessor + + + include + #preprocessor + + + + lex-in-preprocessor + + patterns + + + include + #lex-core + + + include + #lex-keyword + + + include + #lex-constant + + + + lex-core + + patterns + + + include + #comments + + + include + #lex-access + + + include + #lex-continuation + + + include + #lex-newline + + + include + #lex-number + + + include + #lex-string + + + + lex-access + + match + (?:(?<=\.)|(?<=->))\b([a-zA-Z_]\w*+)\b(?!(?:\s|/\*.*?\*/)*+\() + name + variable.other.dot-access.c + + lex-continuation + + patterns + + + match + (\\)$(\n?) + name + punctuation.separator.continuation.c + captures + + 1 + + name + keyword.other.line-continuation.c + + 2 + + name + punctuation.whitespace.newline.c + + + + + match + \\(\s+?)(?=\n)$ + captures + + 1 + + name + invalid.deprecated.space-after-continuation.c + + + + + + lex-newline + + match + $\n + name + punctuation.whitespace.newline.c + + lex-keyword + + patterns + + + match + \s*\b(sizeof|(?:__|(?!\w+__))typeof(?:__)?)\b + captures + + 1 + + name + keyword.operator.c + + + + + match + \s*\b((?:__|(?!\w+__))asm(?:__)?|break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while|__extension__)\b + captures + + 1 + + name + keyword.control.c + + + + + match + \s*\b(auto|bool|_Bool|char|_Complex|double|float|_Imaginary|int|long|short|signed|unsigned|void)\b + captures + + 1 + + name + storage.type.c + + + + + match + \s*\b(extern|static|register|__attribute__|(?:__|(?!\w+__))(?:const|restrict|volatile|inline)(?:__)?)\b + captures + + 1 + + name + storage.modifier.c + + + + + match + \s*\b(class|struct|union|enum|typedef)\b + captures + + 1 + + name + storage.type.c + + + + + match + (\-|\+|\*|\/|%|&|\||\^|<<|>>)?= + name + keyword.operator.assignment.c + + + match + (==|!=|<=|>=|<>|<|>) + name + keyword.operator.comparison.c + + + match + (\-\-|\+\+) + name + keyword.operator.increment-decrement.c + + + match + (\?|:) + name + keyword.operator.ternary.c + + + match + (\-|\+|\*|\/|%) + name + keyword.operator.arithmetic.c + + + match + (!|&&|\|\|) + name + keyword.operator.logical.c + + + match + (~|&|\||\^|<<|>>) + name + keyword.operator.bitwise.c + + + match + (\.|->)(?=(?:\s|/\*.*?\*/)*+[A-Za-z_]\w*+) + name + keyword.operator.dereference.c + + + + lex-constant + + patterns + + + match + \s*\b(NULL|true|false|TRUE|FALSE)\b + captures + + 1 + + name + constant.language.c + + + + + + lex-number + + patterns + + + match + (?ix) # hexadecimal float + (?<!\.) \b + + (0x) + + # significand + (?: (\.) (?=p) # invalid + | [0-9a-f]*+ ([0-9a-z]*?) [0-9a-f]*+ + (?: \. [0-9a-f]*+ ([0-9a-z.]*?) [0-9a-f]*+ )? ) + + # exponent (required) + (?: (p) (?: [+\-] [0-9]++ ([0-9a-z]*?) + | (?=[0-9a-z.]) [0-9]*+ ([0-9a-z.]*?) ) + | (p) ) + + # remaining valid chars and type + [0-9]*+ ([fl]?) + + \b (?!\.) + + name + constant.numeric.float.hexadecimal.c + captures + + 1 + + name + storage.type.number.prefix.hexadecimal.c + + 2 + + name + invalid.illegal.number.missing-fragment.significand.c + + 3 + + name + invalid.illegal.numeric-literal-character.float.whole-number.c + + 4 + + name + invalid.illegal.numeric-literal-character.float.fraction.c + + 5 + + name + keyword.other.exponent.hexadecimal.c + + 6 + + name + invalid.illegal.numeric-literal-character.float.exponent.c + + 7 + + name + invalid.illegal.numeric-literal-character.float.exponent.c + + 8 + + name + invalid.illegal.number.missing-fragment.exponent.c + + 9 + + name + storage.type.number.suffix.float.c + + + + + match + (?ix) # hexadecimal float without required exponent + (?<!\.) \b + + (0x) + + # significand (at least a period) + [0-9a-f]*+ ([0-9a-z&&[^p]]*?) [0-9a-f]*+ + (\.) [0-9a-f]*+ ([0-9a-z.&&[^p]]*?) [0-9a-f]*+ + + # type + (l?) + + (?:(?<=\.)|\b) (?!\.) + + name + constant.numeric.float.hexadecimal.c + captures + + 1 + + name + storage.type.number.prefix.hexadecimal.c + + 2 + + name + invalid.illegal.numeric-literal-character.float.whole-number.c + + 3 + + name + invalid.illegal.number.hexadecimal-float-requires-exponent.c + + 4 + + name + invalid.illegal.numeric-literal-character.float.fraction.c + + 5 + + name + storage.type.number.suffix.float.c + + + + + match + (?ix) # decimal float literal + (?<!\.) (?:(?=\.)|\b) + + (?!0x) + # significand + (?: (?: [0-9]++ ([0-9a-z&&[^e]]*?) [0-9]*+ )? + \. [0-9]++ ([0-9a-z.&&[^e]]*?) [0-9]*+ + + | [0-9]++ ([0-9a-z&&[^e]]*?) [0-9]*+ (?: \. | (?=e)) ) + + # exponent (optional) + (?: (e) (?: [+\-] [0-9]++ ([0-9a-z]*?) + | [0-9]++ ([0-9a-z.]*?) ) + | ( p [+\-]? [0-9]++ + | [ep] [0-9a-z.]*?) )? + + # any invalid chars and type + ([0-9a-z]*?) [0-9]*+ ([fl]?) + + (?:(?<=\.)|\b) (?!\.) + + name + constant.numeric.float.c + captures + + 1 + + name + invalid.illegal.numeric-literal-character.float.whole-number.c + + 2 + + name + invalid.illegal.numeric-literal-character.float.fraction.c + + 3 + + name + invalid.illegal.numeric-literal-character.float.whole-number.c + + 4 + + name + keyword.other.exponent.decimal.c + + 5 + + name + invalid.illegal.numeric-literal-character.float.exponent.c + + 6 + + name + invalid.illegal.numeric-literal-character.float.exponent.c + + 7 + + name + invalid.illegal.numeric-literal-character.float.exponent.c + + 8 + + name + invalid.illegal.numeric-literal-character.float.exponent.c + + 9 + + name + storage.type.number.suffix.float.c + + + + + match + (?ix) + (?<!\.) \b + (0x)? 0++ + (u?l{0,2}|lul?|llu) + \b (?!\.) + + name + constant.numeric.integer.zero.c + captures + + 1 + + name + storage.type.number.prefix.hexadecimal.c + + 2 + + name + storage.type.number.suffix.c + + + + + match + (?ix) + (?<!\.) \b + + (?: (0x) | (0b) ) + (u?l{0,2}|lul?|llu) + + \b (?!\.) + + name + invalid.illegal.invalid-number-literal.c + + + match + (?ix) + (?<!\.) \b + + (0x) [0-9a-f]++ + + # any invalid chars + ([0-9a-z]*?) + + # the remainder (after invalid chars, if any) and a type + [0-9a-f]* (u?l{0,2}|lul?|llu) + + \b (?!\.) + + name + constant.numeric.integer.hexadecimal.c + captures + + 1 + + name + storage.type.number.prefix.hexadecimal.c + + 2 + + name + invalid.illegal.numeric-literal-character.integer.c + + 3 + + name + storage.type.number.suffix.c + + + + + match + (?ix) + (?<!\.) \b + + (0b) [01]++ + + # any invalid chars + ([0-9a-z]*?) + + # the remainder (after invalid chars, if any) and a type + [01]* (u?l{0,2}|lul?|llu) + + \b (?!\.) + + name + constant.numeric.integer.binary.c + captures + + 1 + + name + storage.type.number.prefix.binary.c + + 2 + + name + invalid.illegal.numeric-literal-character.integer.c + + 3 + + name + storage.type.number.suffix.c + + + + + match + (?ix) + (?<!\.) \b + + (0) [0-7]++ + + # any invalid chars + ([0-9a-z]*?) + + # the remainder (after invalid chars, if any) and a type + [0-7]* (u?l{0,2}|lul?|llu) + + \b (?!\.) + + name + constant.numeric.integer.octal.c + captures + + 1 + + name + storage.type.number.prefix.octal.c + + 2 + + name + invalid.illegal.numeric-literal-character.integer.c + + 3 + + name + storage.type.number.suffix.c + + + + + match + (?ix) + (?<!\.) \b + + [0-9]++ + + # any invalid chars + ([0-9a-z]*?) + + # the remainder (after invalid chars, if any) and a type + [0-9]* (u?l{0,2}|lul?|llu) + + \b (?!\.) + + name + constant.numeric.integer.decimal.c + captures + + 1 + + name + invalid.illegal.numeric-literal-character.integer.c + + 2 + + name + storage.type.number.suffix.c + + + + + + lex-string + + patterns + + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.c + + + end + (")|(?<=^|[^\\])\s*(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.c + + 2 + + name + invalid.illegal.unexpected-end-of-line.c + + + name + string.quoted.double.c + patterns + + + include + #lex-continuation + + + include + #string_escaped_char + + + include + #string_placeholder + + + + + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.c + + + end + (')|(?<=^|[^\\])\s*(\n) + endCaptures + + 1 + + name + punctuation.definition.string.end.c + + 2 + + name + invalid.illegal.unexpected-end-of-line.c + + + name + string.quoted.single.c + patterns + + + include + #lex-continuation + + + include + #string_escaped_char + + + + + + string_escaped_char + + patterns + + + match + \\(\\|[abefnprtv'"?]|[0-3]\d{,2}|[4-7]\d?|x[a-fA-F0-9]{,2}|u[a-fA-F0-9]{,4}|U[a-fA-F0-9]{,8}) + name + constant.character.escape.c + + + match + \\. + name + invalid.illegal.unknown-escape.c + + + + string_placeholder + + patterns + + + match + (?x)% + (\d+\$)? # field (argument #) + [#0\- +']* # flags + [,;:_]? # separator character (AltiVec) + ((-?\d+)|\*(-?\d+\$)?)? # minimum field width + (\.((-?\d+)|\*(-?\d+\$)?)?)? # precision + (hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier + [diouxXDOUeEfFgGaACcSspn%] # conversion type + + name + constant.other.placeholder.c + + + match + % + name + invalid.illegal.placeholder.c + + + + + scopeName + source.c + uuid + 24242A3A-CC4A-414D-B1FA-18D2BABB6754 + From 12e5843bbdb9f567466b50af26bc471ae2b2595e Mon Sep 17 00:00:00 2001 From: Eldar Abusalimov Date: Tue, 2 Feb 2016 23:18:20 +0300 Subject: [PATCH 2/4] dev: Use 'syntaxdev' Node module for grammar compilation Add a Makefile adopting a workflow of the MagicStack/MagicPython project. The tmLanguage file is regenerated; apart from whitespace changes the only change is the order of the 'name' key in grammar rules. --- .gitignore | 4 + C Improved.tmLanguage | 786 +++++++++--------- Makefile | 20 + .../c-improved.syntax.yaml | 0 4 files changed, 398 insertions(+), 412 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile rename c-improved.syntax.yaml => src/c-improved.syntax.yaml (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e724c71 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.sublime-workspace +*.cache + +node_modules diff --git a/C Improved.tmLanguage b/C Improved.tmLanguage index eab669a..132683e 100644 --- a/C Improved.tmLanguage +++ b/C Improved.tmLanguage @@ -1,33 +1,34 @@ + comment - - https://github.com/abusalimov/SublimeCImproved + https://github.com/abusalimov/SublimeCImproved - Derived from C.tmLanguage - the original TextMate and Sublime Text - syntax definition. - - +Derived from C.tmLanguage - the original TextMate and Sublime Text +syntax definition. + name + C Improved + scopeName + source.c fileTypes c h + uuid + 24242A3A-CC4A-414D-B1FA-18D2BABB6754 firstLineMatch -[*]-( Mode:)? C -[*]- foldingStartMarker (?x) - /\*\*(?!\*) - |^(?![^{]*?//|[^{]*?/\*(?!.*?\*/.*?\{)).*?\{\s*($|//|/\*(?!.*?\*/.*\S)) - + /\*\*(?!\*) +|^(?![^{]*?//|[^{]*?/\*(?!.*?\*/.*?\{)).*?\{\s*($|//|/\*(?!.*?\*/.*\S)) foldingStopMarker (?<!\*)\*\*/|^\s*\} keyEquivalent ^~C - name - C Improved patterns @@ -83,15 +84,14 @@ begin (?x) - (?= \s* - (?: - (?: \b extern \b - (?: "(\\.|[^"])*" | '(\\.|[^'])*' | /\*.*?\*/ | \s)* ) | - (?: \b namespace \b - (?: (?: /\*.*?\*/ | \s)* \b [A-Za-z_]\w*+ \b)? - (?: /\*.*?\*/ | \s)* ) ) - \{ ) - +(?= \s* + (?: + (?: \b extern \b + (?: "(\\.|[^"])*" | '(\\.|[^'])*' | /\*.*?\*/ | \s)* ) | + (?: \b namespace \b + (?: (?: /\*.*?\*/ | \s)* \b [A-Za-z_]\w*+ \b)? + (?: /\*.*?\*/ | \s)* ) ) + \{ ) end \} patterns @@ -101,12 +101,12 @@ #lex + name + meta.block.special.c begin \{ end (?=\}) - name - meta.block.special.c patterns @@ -117,10 +117,6 @@ - block begin @@ -137,12 +133,12 @@ block-lookahead-end + name + meta.block.c begin \{ end (?=\}) - name - meta.block.c patterns @@ -191,12 +187,12 @@ parens-lookahead-end + name + meta.parens.c begin \( end (?=\)) - name - meta.parens.c patterns @@ -223,12 +219,12 @@ typedef + name + meta.typedef.c begin (?x) (?<= \A typedef | \W typedef ) \b end ; - name - meta.typedef.c patterns @@ -273,18 +269,17 @@ type-declaration + name + meta.compound.c begin (?x) - (?<= \A enum | \A (?:class|union) | \A struct | - \W enum | \W (?:class|union) | \W struct ) \b - (?= (?:\s|/\*.*?\*/)*+ - ([A-Za-z_]\w*+) - (?:\s|/\*.*?\*/)*+; ) - +(?<= \A enum | \A (?:class|union) | \A struct | + \W enum | \W (?:class|union) | \W struct ) \b +(?= (?:\s|/\*.*?\*/)*+ + ([A-Za-z_]\w*+) + (?:\s|/\*.*?\*/)*+; ) end (?<=;) - name - meta.compound.c patterns @@ -307,45 +302,43 @@ type-definition + name + meta.compound.c begin (?x) - (?<= \A enum | \A (?:class|union) | \A struct | - \W enum | \W (?:class|union) | \W struct ) \b +(?<= \A enum | \A (?:class|union) | \A struct | + \W enum | \W (?:class|union) | \W struct ) \b - # Negation of zero-length parts of the end pattern - # to prevent entering the rule if it's gonna exit immediately. - # (workaround ST2 bugs, see issue #10) - (?=\s*(?:[A-Za-z_({]|/[/*]|$)) - (?! \s*\b(?: [A-Za-z_]\w*+ ) (?= \s* [\[;] ) ) - +# Negation of zero-length parts of the end pattern +# to prevent entering the rule if it's gonna exit immediately. +# (workaround ST2 bugs, see issue #10) +(?=\s*(?:[A-Za-z_({]|/[/*]|$)) +(?! \s*\b(?: [A-Za-z_]\w*+ ) (?= \s* [\[;] ) ) end (?x) - (?: (?!\s*(?:[A-Za-z_({]|/[/*]|$)) - | (?= \s*\b(?: [A-Za-z_]\w*+ ) (?= \s* [\[;] ) ) - | (?<!\})(?= - # Prefer function definition over an attribute defined - # through a macro, unless a block has been seen. That is: - # struct __packed __aligned(16) foo {...}; - function __aligned - # struct foo {...} __packed __aligned(16); - structure foo - (?! \s* \b__attribute__\b ) +(?: (?!\s*(?:[A-Za-z_({]|/[/*]|$)) + | (?= \s*\b(?: [A-Za-z_]\w*+ ) (?= \s* [\[;] ) ) + | (?<!\})(?= + # Prefer function definition over an attribute defined + # through a macro, unless a block has been seen. That is: + # struct __packed __aligned(16) foo {...}; - function __aligned + # struct foo {...} __packed __aligned(16); - structure foo + (?! \s* \b__attribute__\b ) - (?: ^ - | (?<! (?<!\w) new - | (?<!\w) (?:else|enum) | (?<!\w) (?:class|union) - | (?<!\w) (?:struct|return|sizeof|typeof) - | (?<!\w) __typeof | (?<!\w) __typeof__ ) - (?<= \w ) \s + (?: ^ + | (?<! (?<!\w) new + | (?<!\w) (?:else|enum) | (?<!\w) (?:class|union) + | (?<!\w) (?:struct|return|sizeof|typeof) + | (?<!\w) __typeof | (?<!\w) __typeof__ ) + (?<= \w ) \s - | # or type modifier / closing bracket before name - (?<= [^&]& | [*>)}\]] ) ) \s* + | # or type modifier / closing bracket before name + (?<= [^&]& | [*>)}\]] ) ) \s* - (?: [A-Za-z_]\w*+ | ::[^:] )++ - (?: (?<= ^ operator | \W operator ) # C++ operator? - (?: [-*&<>=+!]+ | \(\) | \[\] ) )? - (?:\s|/\*.*?\*/)*+ \( ) ) - - name - meta.compound.c + (?: [A-Za-z_]\w*+ | ::[^:] )++ + (?: (?<= ^ operator | \W operator ) # C++ operator? + (?: [-*&<>=+!]+ | \(\) | \[\] ) )? + (?:\s|/\*.*?\*/)*+ \( ) ) patterns @@ -417,12 +410,11 @@ begin (?x) - ^ # Begin of line, capital letters: most probably it is a macro - \s*\b - ([A-Z0-9_]++) - \b - (?= (?:\s|/\*.*?\*/)*+ \( ) - +^ # Begin of line, capital letters: most probably it is a macro +\s*\b +([A-Z0-9_]++) +\b +(?= (?:\s|/\*.*?\*/)*+ \( ) end \) patterns @@ -443,26 +435,25 @@ meta.function.c begin (?x) - (?: ^ - | (?<! (?<!\w) new - | (?<!\w) (?:else|enum) | (?<!\w) (?:class|union) - | (?<!\w) (?:struct|return|sizeof|typeof) - | (?<!\w) __typeof | (?<!\w) __typeof__ ) - (?<= \w ) \s +(?: ^ + | (?<! (?<!\w) new + | (?<!\w) (?:else|enum) | (?<!\w) (?:class|union) + | (?<!\w) (?:struct|return|sizeof|typeof) + | (?<!\w) __typeof | (?<!\w) __typeof__ ) + (?<= \w ) \s - | # or type modifier / closing bracket before name - (?<= [^&]& | [*>)}\]] ) ) \s* + | # or type modifier / closing bracket before name + (?<= [^&]& | [*>)}\]] ) ) \s* - ( (?: [A-Za-z_]\w*+ | ::[^:] )++ - (?: (?<= ^ operator | \W operator ) # C++ operator? - (?: [-*&<>=+!]+ | \(\) | \[\] ) )? ) +( (?: [A-Za-z_]\w*+ | ::[^:] )++ + (?: (?<= ^ operator | \W operator ) # C++ operator? + (?: [-*&<>=+!]+ | \(\) | \[\] ) )? ) - (?= (?:\s|/\*.*?\*/)*+ (?'parens' \( - (?> \g'parens' | - "(\\.|[^"])*" | '(\\.|[^'])*' | /\*.*?\*/ | - (?! /[/*] | [()] ) . )* - \) ) \s* ; ) - +(?= (?:\s|/\*.*?\*/)*+ (?'parens' \( + (?> \g'parens' | + "(\\.|[^"])*" | '(\\.|[^'])*' | /\*.*?\*/ | + (?! /[/*] | [()] ) . )* + \) ) \s* ; ) beginCaptures 1 @@ -491,22 +482,21 @@ meta.function.c begin (?x) - (?: ^ - | (?<! (?<!\w) new - | (?<!\w) (?:else|enum) | (?<!\w) (?:class|union) - | (?<!\w) (?:struct|return|sizeof|typeof) - | (?<!\w) __typeof | (?<!\w) __typeof__ ) - (?<= \w ) \s +(?: ^ + | (?<! (?<!\w) new + | (?<!\w) (?:else|enum) | (?<!\w) (?:class|union) + | (?<!\w) (?:struct|return|sizeof|typeof) + | (?<!\w) __typeof | (?<!\w) __typeof__ ) + (?<= \w ) \s - | # or type modifier / closing bracket before name - (?<= [^&]& | [*>)}\]] ) ) \s* + | # or type modifier / closing bracket before name + (?<= [^&]& | [*>)}\]] ) ) \s* - ( (?: [A-Za-z_]\w*+ | ::[^:] )++ - (?: (?<= ^ operator | \W operator ) # C++ operator? - (?: [-*&<>=+!]+ | \(\) | \[\] ) )? ) +( (?: [A-Za-z_]\w*+ | ::[^:] )++ + (?: (?<= ^ operator | \W operator ) # C++ operator? + (?: [-*&<>=+!]+ | \(\) | \[\] ) )? ) - (?= (?:\s|/\*.*?\*/)*+ \( ) - +(?= (?:\s|/\*.*?\*/)*+ \( ) beginCaptures 1 @@ -528,10 +518,10 @@ #parens - match - \s*\b(const|override)\b name storage.modifier.c + match + \s*\b(const|override)\b include @@ -545,11 +535,10 @@ meta.function-call.c begin (?x) - \s* - (?= # don't consume to recognize support functions - (?: [A-Za-z_]\w*+ | ::[^:] )++ - (?:\s|/\*.*?\*/)*+ \( ) - +\s* +(?= # don't consume to recognize support functions + (?: [A-Za-z_]\w*+ | ::[^:] )++ + (?:\s|/\*.*?\*/)*+ \( ) end \) patterns @@ -563,16 +552,16 @@ #support-function - match - (?:(?<=\.)|(?<=->))\b([A-Za-z_]\w*+)\b name variable.other.dot-access.c support.function.any-method.c + match + (?:(?<=\.)|(?<=->))\b([A-Za-z_]\w*+)\b - match - (?:[A-Za-z_]\w*+|::[^:])++ name support.function.any-method.c + match + (?:[A-Za-z_]\w*+|::[^:])++ include @@ -665,12 +654,12 @@ patterns + name + comment.other.preprocessor-disabled.c begin ^ end $\n? - name - comment.other.preprocessor-disabled.c patterns @@ -684,6 +673,8 @@ + name + meta.preprocessor.directive.c begin (?<!##)(?<=#)\s*(if)\b(?=(?:\s|/\*.*?\*/)*+(0[xX])?0++\b(?:\s|/\*.*?\*/)*+(//.*)?\\?$) beginCaptures @@ -696,8 +687,6 @@ end (?<=$\n)(?<!\\$\n) - name - meta.preprocessor.directive.c patterns @@ -735,6 +724,8 @@ ppline-macro + name + meta.preprocessor.macro.c begin ^\s*(#)(?=\s*(define)\s+[a-zA-Z_]\w*+) beginCaptures @@ -747,8 +738,6 @@ end (?<=$\n)(?<!\\$\n) - name - meta.preprocessor.macro.c patterns @@ -818,6 +807,8 @@ ppline-macro-head-function + contentName + meta.preprocessor.macro.parameters.c begin (?<!##)(?<=#)(\s*define)\s+([a-zA-Z_]\w*+)(\() beginCaptures @@ -848,8 +839,6 @@ invalid.illegal.unexpected-end-of-line.c - contentName - meta.preprocessor.macro.parameters.c patterns @@ -941,14 +930,13 @@ #ppline-macro-param-lex - match - (?x) - (?: (?! (?:\s|/\*.*?\*/)*+ - (?: \b([a-zA-Z_]\w*+)\b | \.\.\. | \) | (?>(?:\\\s*)?$\n?) | /[/*] ) ) - .)* - name invalid.illegal.unexpected-character.c + match + (?x) +(?: (?! (?:\s|/\*.*?\*/)*+ + (?: \b([a-zA-Z_]\w*+)\b | \.\.\. | \) | (?>(?:\\\s*)?$\n?) | /[/*] ) ) + .)* @@ -973,14 +961,13 @@ #ppline-macro-param-lex - match - (?x) - (?: (?! (?:\s|/\*.*?\*/)*+ - (?: \) | (?>(?:\\\s*)?$\n?) | /[/*] ) ) - .)* - name invalid.illegal.unexpected-character.c + match + (?x) +(?: (?! (?:\s|/\*.*?\*/)*+ + (?: \) | (?>(?:\\\s*)?$\n?) | /[/*] ) ) + .)* @@ -993,6 +980,8 @@ \s* + name + invalid.illegal.unexpected-end-of-line.c begin \s*// beginCaptures @@ -1005,8 +994,6 @@ end (?<=^|[^\\])\s*(?=\n)$ - name - invalid.illegal.unexpected-end-of-line.c patterns @@ -1026,19 +1013,20 @@ patterns - match - (?x) - (?: (?! (?:\s|/\*.*?\*/)*+ - (?: \) | (?>(?:\\\s*)?$\n?) | /[/*] ) ) - .) # no star unlike its friends in arg/vararg - name invalid.illegal.unexpected-character.c + match + (?x) +(?: (?! (?:\s|/\*.*?\*/)*+ + (?: \) | (?>(?:\\\s*)?$\n?) | /[/*] ) ) + .) # no star unlike its friends in arg/vararg ppline-undef + name + meta.preprocessor.undef.c begin (^\s*(#)\s*(undef))\s+([a-zA-Z_]\w*+) beginCaptures @@ -1056,13 +1044,13 @@ end (?<=$\n)(?<!\\$\n) - name - meta.preprocessor.undef.c patterns - + ppline-include + name + meta.preprocessor.include.c meta.preprocessor.c.include begin ^\s*(#)\s*(include|include_next|import)\b beginCaptures @@ -1093,8 +1081,6 @@ invalid.illegal.unexpected-end-of-line.c - name - meta.preprocessor.include.c meta.preprocessor.c.include patterns @@ -1112,6 +1098,8 @@ #preprocessor-lex + name + string.quoted.double.include.c begin "|(?=.*?") beginCaptures @@ -1132,10 +1120,10 @@ punctuation.definition.string.end.c - name - string.quoted.double.include.c + name + string.quoted.other.lt-gt.include.c begin <(?=.*?>) beginCaptures @@ -1156,16 +1144,14 @@ punctuation.definition.string.end.c - name - string.quoted.other.lt-gt.include.c + name + meta.parens.c begin \( end \)|(?<=^|[^\\])(?=\s*\n) - name - meta.parens.c patterns @@ -1178,6 +1164,10 @@ ppline-pragma-mark + name + meta.preprocessor.directive.pragma-mark.c + contentName + meta.toc-list.pragma-mark.c begin (^\s*(#)\s*(pragma\s+mark)\b)[\s&&[^\n]]* beginCaptures @@ -1190,10 +1180,6 @@ end (?<=$\n)(?<!\\$\n) - name - meta.preprocessor.directive.pragma-mark.c - contentName - meta.toc-list.pragma-mark.c patterns @@ -1201,15 +1187,17 @@ #preprocessor-lex - match - . name string.other.pragma-mark.c + match + . ppline-directive + name + meta.preprocessor.directive.c begin ^\s*(#)\s*(if|ifdef|ifndef|elif|else|endif|pragma|line|define|undef|error|warning)\b beginCaptures @@ -1222,8 +1210,6 @@ end (?<=$\n)(?<!\\$\n) - name - meta.preprocessor.directive.c patterns @@ -1234,6 +1220,8 @@ ppline-directive-invalid-usage + name + meta.preprocessor.directive.c match (^\s*(#)\s*(if|ifdef|ifndef|elif|pragma|define|undef|include|include_next|import)\b)\s*?(\n|$) captures @@ -1249,15 +1237,13 @@ invalid.illegal.invalid-usage-of-preprocessor-directive.c - name - meta.preprocessor.directive.c ppline-directive-obsolete + name + meta.preprocessor.directive.deprecated.c begin ^\s*(#)\s*(assert|unassert|ident|sccs)\b - end - (?<=$\n)(?<!\\$\n) beginCaptures 1 @@ -1271,8 +1257,8 @@ invalid.deprecated.preprocessor.c - name - meta.preprocessor.directive.deprecated.c + end + (?<=$\n)(?<!\\$\n) patterns @@ -1283,10 +1269,10 @@ ppline-invalid + name + meta.preprocessor.directive.illegal.c begin ^\s*(#)(?!\s*(?=/[/*]|(?>\\\s*\n)|\n|$))\s*(\w*) - end - (?<=$\n)(?<!\\$\n) beginCaptures 1 @@ -1300,11 +1286,13 @@ invalid.illegal.preprocessor.c - name - meta.preprocessor.directive.illegal.c + end + (?<=$\n)(?<!\\$\n) ppline-any + name + meta.preprocessor.directive.null-directive.c begin ^\s*(#) beginCaptures @@ -1317,8 +1305,6 @@ end (?<=$\n)(?<!\\$\n) - name - meta.preprocessor.directive.null-directive.c patterns @@ -1412,11 +1398,10 @@ match (?x) - \s*\b - ( Py(?:Var|Type|HeapType|Dict|Set|List|Tuple|BaseException)?Object - | PyType_(?:Spec|Slot) ) - \b - +\s*\b +( Py(?:Var|Type|HeapType|Dict|Set|List|Tuple|BaseException)?Object + | PyType_(?:Spec|Slot) ) +\b captures 1 @@ -1429,16 +1414,15 @@ match (?x) - \s*\b - ( Py(?:BaseObject|Type|Super|Bool|Dict - |DictIter(?:Key|Value|Item) - |Dict(?:Key|Value|Item)s - |(?:Set|List|Tuple)(?:Iter)? - |FrozenSet|ListRevIter)_Type - | _?PyExc_\w++ - | Py_(?:False|True|None|NotImplemented) ) - \b - +\s*\b +( Py(?:BaseObject|Type|Super|Bool|Dict + |DictIter(?:Key|Value|Item) + |Dict(?:Key|Value|Item)s + |(?:Set|List|Tuple)(?:Iter)? + |FrozenSet|ListRevIter)_Type + | _?PyExc_\w++ + | Py_(?:False|True|None|NotImplemented) ) +\b captures 1 @@ -1469,18 +1453,17 @@ match (?x) - \s*\b - ( (?:__)?(?:DECL(?:ARE)?|DEF(?:INE)?)_[A-Z0-9_]+ - | (?:__)?[A-Z_][A-Z0-9_]*_(?:DECL(?:ARE)?|DEF(?:INE)?) - | EXPORT(?:_UNUSED)?(?:_PER_CPU)?_SYMBOL(?:_GPL(?:_FUTURE)?)? - | MODULE_(?:INFO|ALIAS|LICENSE|AUTHOR|DESCRIPTION|DEVICE_TABLE|VERSION|FIRMWARE) - | (?:__)?MODULE_PARM_(?:TYPE|DESC) - | module_param(?:(?:_array)?(?:_named)?|_call) - | (?:module|core|postcore|arch|subsys|fs|device|late)_param_cb - | [HL]?LIST_HEAD - | (?:_|__BIN|BIN|BUS|DRIVER|CLASS|DEVICE)_ATTR(?:_R[OW])? ) - \b - +\s*\b +( (?:__)?(?:DECL(?:ARE)?|DEF(?:INE)?)_[A-Z0-9_]+ + | (?:__)?[A-Z_][A-Z0-9_]*_(?:DECL(?:ARE)?|DEF(?:INE)?) + | EXPORT(?:_UNUSED)?(?:_PER_CPU)?_SYMBOL(?:_GPL(?:_FUTURE)?)? + | MODULE_(?:INFO|ALIAS|LICENSE|AUTHOR|DESCRIPTION|DEVICE_TABLE|VERSION|FIRMWARE) + | (?:__)?MODULE_PARM_(?:TYPE|DESC) + | module_param(?:(?:_array)?(?:_named)?|_call) + | (?:module|core|postcore|arch|subsys|fs|device|late)_param_cb + | [HL]?LIST_HEAD + | (?:_|__BIN|BIN|BUS|DRIVER|CLASS|DEVICE)_ATTR(?:_R[OW])? ) +\b captures 1 @@ -1493,13 +1476,12 @@ match (?x) - \s*\b - ( _(?:IRQL|Kernel)_\w+_ - | _Interlocked_operand_ - | _Dispatch_type_ - | _Flt_CompletionContext_Outptr_ ) - \b - +\s*\b +( _(?:IRQL|Kernel)_\w+_ + | _Interlocked_operand_ + | _Dispatch_type_ + | _Flt_CompletionContext_Outptr_ ) +\b captures 1 @@ -1512,19 +1494,18 @@ match (?x) - \s*\b - ( PyAPI_(?:FUNC|DATA) - | PyMODINIT_FUNC - | Py_LOCAL(?:_INLINE)? - | PyDoc_(?:STR(?:VAR)?|VAR) - | PyObject(?:_VAR)?_HEAD - | _PyObject_HEAD_EXTRA - | PyException_HEAD - | Py(?:Var)?Object_HEAD_INIT - | PyModuleDef_HEAD_INIT - | Py_(RETURN)_(?:FALSE|TRUE|NONE|NOTIMPLEMENTED|NAN|INF) ) - \b - +\s*\b +( PyAPI_(?:FUNC|DATA) + | PyMODINIT_FUNC + | Py_LOCAL(?:_INLINE)? + | PyDoc_(?:STR(?:VAR)?|VAR) + | PyObject(?:_VAR)?_HEAD + | _PyObject_HEAD_EXTRA + | PyException_HEAD + | Py(?:Var)?Object_HEAD_INIT + | PyModuleDef_HEAD_INIT + | Py_(RETURN)_(?:FALSE|TRUE|NONE|NOTIMPLEMENTED|NAN|INF) ) +\b captures 1 @@ -1601,12 +1582,11 @@ match (?x) - \s*\b - ( Py_REFCNT | Py_TYPE | Py_SIZE - | Py_X?(?:INC|DEC)REF | Py_CLEAR - | _?Py(?:Object|Type|HeapType|Dict|Set|List|Tuple|Long|Exception|Err)_\w++ ) - \b - +\s*\b +( Py_REFCNT | Py_TYPE | Py_SIZE + | Py_X?(?:INC|DEC)REF | Py_CLEAR + | _?Py(?:Object|Type|HeapType|Dict|Set|List|Tuple|Long|Exception|Err)_\w++ ) +\b captures 1 @@ -1623,16 +1603,10 @@ patterns + name + comment.block.c begin \s*(/\*) - captures - - 1 - - name - punctuation.definition.comment.block.c - - end (\*/)(\n?) endCaptures @@ -1643,8 +1617,14 @@ punctuation.whitespace.newline.c - name - comment.block.c + captures + + 1 + + name + punctuation.definition.comment.block.c + + patterns @@ -1654,12 +1634,14 @@ - match - \*/(?![/*]) name invalid.illegal.stray-comment-end.c + match + \*/(?![/*]) + name + comment.line.double-slash.c++ begin \s*(//) beginCaptures @@ -1672,8 +1654,6 @@ end (?<=$\n)(?<!\\$\n) - name - comment.line.double-slash.c++ patterns @@ -1729,12 +1709,13 @@ patterns + name + meta.toc-list.task-tag.prio-high.c begin (?ix) - (?= (?-i: @[a-zA-Z_]++ | \b [A-Z_]++) \b) @? \b (?: - (FIXME) | (XXX) | (WTF) - ) \b - +(?= (?-i: @[a-zA-Z_]++ | \b [A-Z_]++) \b) @? \b (?: + (FIXME) | (XXX) | (WTF) +) \b beginCaptures 0 @@ -1760,8 +1741,6 @@ end (?=[\s/*]*\*/)|(?<=$\n) - name - meta.toc-list.task-tag.prio-high.c patterns @@ -1771,12 +1750,13 @@ + name + meta.toc-list.task-tag.prio-normal.c begin (?ix) - (?= (?-i: @[a-zA-Z_]++ | \b [A-Z_]++) \b) @? \b (?: - (TODO) - ) \b - +(?= (?-i: @[a-zA-Z_]++ | \b [A-Z_]++) \b) @? \b (?: + (TODO) +) \b beginCaptures 0 @@ -1792,8 +1772,6 @@ end (?=[\s/*]*\*/)|(?<=$\n) - name - meta.toc-list.task-tag.prio-normal.c patterns @@ -1803,12 +1781,13 @@ + name + meta.toc-list.task-tag.prio-low.c begin (?ix) - (?= (?-i: @[a-zA-Z_]++ | \b [A-Z_]++) \b) @? \b (?: - (TBD) | (REVIEW) - ) \b - +(?= (?-i: @[a-zA-Z_]++ | \b [A-Z_]++) \b) @? \b (?: + (TBD) | (REVIEW) +) \b beginCaptures 0 @@ -1829,8 +1808,6 @@ end (?=[\s/*]*\*/)|(?<=$\n) - name - meta.toc-list.task-tag.prio-low.c patterns @@ -1840,12 +1817,13 @@ + name + meta.toc-list.task-tag.note.c begin (?ix) - (?= (?-i: @[a-zA-Z_]++ | \b [A-Z_]++) \b) @? \b (?: - (NOTE) | (NB) | (CHANGED) | (IDEA) | (IMPORTANT) | (HACK) | (BUG) - ) \b - +(?= (?-i: @[a-zA-Z_]++ | \b [A-Z_]++) \b) @? \b (?: + (NOTE) | (NB) | (CHANGED) | (IDEA) | (IMPORTANT) | (HACK) | (BUG) +) \b beginCaptures 0 @@ -1891,8 +1869,6 @@ end (?=[\s/*]*\*/)|(?<=$\n) - name - meta.toc-list.task-tag.note.c patterns @@ -1985,20 +1961,20 @@ lex-access - match - (?:(?<=\.)|(?<=->))\b([a-zA-Z_]\w*+)\b(?!(?:\s|/\*.*?\*/)*+\() name variable.other.dot-access.c + match + (?:(?<=\.)|(?<=->))\b([a-zA-Z_]\w*+)\b(?!(?:\s|/\*.*?\*/)*+\() lex-continuation patterns - match - (\\)$(\n?) name punctuation.separator.continuation.c + match + (\\)$(\n?) captures 1 @@ -2029,10 +2005,10 @@ lex-newline - match - $\n name punctuation.whitespace.newline.c + match + $\n lex-keyword @@ -2099,52 +2075,52 @@ - match - (\-|\+|\*|\/|%|&|\||\^|<<|>>)?= name keyword.operator.assignment.c + match + (\-|\+|\*|\/|%|&|\||\^|<<|>>)?= - match - (==|!=|<=|>=|<>|<|>) name keyword.operator.comparison.c + match + (==|!=|<=|>=|<>|<|>) - match - (\-\-|\+\+) name keyword.operator.increment-decrement.c + match + (\-\-|\+\+) - match - (\?|:) name keyword.operator.ternary.c + match + (\?|:) - match - (\-|\+|\*|\/|%) name keyword.operator.arithmetic.c + match + (\-|\+|\*|\/|%) - match - (!|&&|\|\|) name keyword.operator.logical.c + match + (!|&&|\|\|) - match - (~|&|\||\^|<<|>>) name keyword.operator.bitwise.c + match + (~|&|\||\^|<<|>>) - match - (\.|->)(?=(?:\s|/\*.*?\*/)*+[A-Za-z_]\w*+) name keyword.operator.dereference.c + match + (\.|->)(?=(?:\s|/\*.*?\*/)*+[A-Za-z_]\w*+) @@ -2171,29 +2147,28 @@ patterns + name + constant.numeric.float.hexadecimal.c match (?ix) # hexadecimal float - (?<!\.) \b +(?<!\.) \b - (0x) +(0x) - # significand - (?: (\.) (?=p) # invalid - | [0-9a-f]*+ ([0-9a-z]*?) [0-9a-f]*+ - (?: \. [0-9a-f]*+ ([0-9a-z.]*?) [0-9a-f]*+ )? ) +# significand +(?: (\.) (?=p) # invalid + | [0-9a-f]*+ ([0-9a-z]*?) [0-9a-f]*+ + (?: \. [0-9a-f]*+ ([0-9a-z.]*?) [0-9a-f]*+ )? ) - # exponent (required) - (?: (p) (?: [+\-] [0-9]++ ([0-9a-z]*?) - | (?=[0-9a-z.]) [0-9]*+ ([0-9a-z.]*?) ) - | (p) ) +# exponent (required) +(?: (p) (?: [+\-] [0-9]++ ([0-9a-z]*?) + | (?=[0-9a-z.]) [0-9]*+ ([0-9a-z.]*?) ) + | (p) ) - # remaining valid chars and type - [0-9]*+ ([fl]?) +# remaining valid chars and type +[0-9]*+ ([fl]?) - \b (?!\.) - - name - constant.numeric.float.hexadecimal.c +\b (?!\.) captures 1 @@ -2244,23 +2219,22 @@ + name + constant.numeric.float.hexadecimal.c match (?ix) # hexadecimal float without required exponent - (?<!\.) \b +(?<!\.) \b - (0x) +(0x) - # significand (at least a period) - [0-9a-f]*+ ([0-9a-z&&[^p]]*?) [0-9a-f]*+ - (\.) [0-9a-f]*+ ([0-9a-z.&&[^p]]*?) [0-9a-f]*+ +# significand (at least a period) + [0-9a-f]*+ ([0-9a-z&&[^p]]*?) [0-9a-f]*+ +(\.) [0-9a-f]*+ ([0-9a-z.&&[^p]]*?) [0-9a-f]*+ - # type - (l?) +# type +(l?) - (?:(?<=\.)|\b) (?!\.) - - name - constant.numeric.float.hexadecimal.c +(?:(?<=\.)|\b) (?!\.) captures 1 @@ -2291,30 +2265,29 @@ + name + constant.numeric.float.c match (?ix) # decimal float literal - (?<!\.) (?:(?=\.)|\b) +(?<!\.) (?:(?=\.)|\b) - (?!0x) - # significand - (?: (?: [0-9]++ ([0-9a-z&&[^e]]*?) [0-9]*+ )? - \. [0-9]++ ([0-9a-z.&&[^e]]*?) [0-9]*+ +(?!0x) +# significand +(?: (?: [0-9]++ ([0-9a-z&&[^e]]*?) [0-9]*+ )? + \. [0-9]++ ([0-9a-z.&&[^e]]*?) [0-9]*+ - | [0-9]++ ([0-9a-z&&[^e]]*?) [0-9]*+ (?: \. | (?=e)) ) + | [0-9]++ ([0-9a-z&&[^e]]*?) [0-9]*+ (?: \. | (?=e)) ) - # exponent (optional) - (?: (e) (?: [+\-] [0-9]++ ([0-9a-z]*?) - | [0-9]++ ([0-9a-z.]*?) ) - | ( p [+\-]? [0-9]++ - | [ep] [0-9a-z.]*?) )? +# exponent (optional) +(?: (e) (?: [+\-] [0-9]++ ([0-9a-z]*?) + | [0-9]++ ([0-9a-z.]*?) ) + | ( p [+\-]? [0-9]++ + | [ep] [0-9a-z.]*?) )? - # any invalid chars and type - ([0-9a-z]*?) [0-9]*+ ([fl]?) +# any invalid chars and type +([0-9a-z]*?) [0-9]*+ ([fl]?) - (?:(?<=\.)|\b) (?!\.) - - name - constant.numeric.float.c +(?:(?<=\.)|\b) (?!\.) captures 1 @@ -2365,15 +2338,14 @@ - match - (?ix) - (?<!\.) \b - (0x)? 0++ - (u?l{0,2}|lul?|llu) - \b (?!\.) - name constant.numeric.integer.zero.c + match + (?ix) +(?<!\.) \b +(0x)? 0++ +(u?l{0,2}|lul?|llu) +\b (?!\.) captures 1 @@ -2389,35 +2361,33 @@ + name + invalid.illegal.invalid-number-literal.c match (?ix) - (?<!\.) \b +(?<!\.) \b - (?: (0x) | (0b) ) - (u?l{0,2}|lul?|llu) +(?: (0x) | (0b) ) +(u?l{0,2}|lul?|llu) - \b (?!\.) - - name - invalid.illegal.invalid-number-literal.c +\b (?!\.) + name + constant.numeric.integer.hexadecimal.c match (?ix) - (?<!\.) \b +(?<!\.) \b - (0x) [0-9a-f]++ +(0x) [0-9a-f]++ - # any invalid chars - ([0-9a-z]*?) +# any invalid chars +([0-9a-z]*?) - # the remainder (after invalid chars, if any) and a type - [0-9a-f]* (u?l{0,2}|lul?|llu) +# the remainder (after invalid chars, if any) and a type +[0-9a-f]* (u?l{0,2}|lul?|llu) - \b (?!\.) - - name - constant.numeric.integer.hexadecimal.c +\b (?!\.) captures 1 @@ -2438,22 +2408,21 @@ + name + constant.numeric.integer.binary.c match (?ix) - (?<!\.) \b +(?<!\.) \b - (0b) [01]++ +(0b) [01]++ - # any invalid chars - ([0-9a-z]*?) +# any invalid chars +([0-9a-z]*?) - # the remainder (after invalid chars, if any) and a type - [01]* (u?l{0,2}|lul?|llu) +# the remainder (after invalid chars, if any) and a type +[01]* (u?l{0,2}|lul?|llu) - \b (?!\.) - - name - constant.numeric.integer.binary.c +\b (?!\.) captures 1 @@ -2474,22 +2443,21 @@ + name + constant.numeric.integer.octal.c match (?ix) - (?<!\.) \b +(?<!\.) \b - (0) [0-7]++ +(0) [0-7]++ - # any invalid chars - ([0-9a-z]*?) +# any invalid chars +([0-9a-z]*?) - # the remainder (after invalid chars, if any) and a type - [0-7]* (u?l{0,2}|lul?|llu) +# the remainder (after invalid chars, if any) and a type +[0-7]* (u?l{0,2}|lul?|llu) - \b (?!\.) - - name - constant.numeric.integer.octal.c +\b (?!\.) captures 1 @@ -2510,22 +2478,21 @@ + name + constant.numeric.integer.decimal.c match (?ix) - (?<!\.) \b +(?<!\.) \b - [0-9]++ +[0-9]++ - # any invalid chars - ([0-9a-z]*?) +# any invalid chars +([0-9a-z]*?) - # the remainder (after invalid chars, if any) and a type - [0-9]* (u?l{0,2}|lul?|llu) +# the remainder (after invalid chars, if any) and a type +[0-9]* (u?l{0,2}|lul?|llu) - \b (?!\.) - - name - constant.numeric.integer.decimal.c +\b (?!\.) captures 1 @@ -2547,6 +2514,8 @@ patterns + name + string.quoted.double.c begin " beginCaptures @@ -2572,8 +2541,6 @@ invalid.illegal.unexpected-end-of-line.c - name - string.quoted.double.c patterns @@ -2591,6 +2558,8 @@ + name + string.quoted.single.c begin ' beginCaptures @@ -2616,8 +2585,6 @@ invalid.illegal.unexpected-end-of-line.c - name - string.quoted.single.c patterns @@ -2637,16 +2604,16 @@ patterns - match - \\(\\|[abefnprtv'"?]|[0-3]\d{,2}|[4-7]\d?|x[a-fA-F0-9]{,2}|u[a-fA-F0-9]{,4}|U[a-fA-F0-9]{,8}) name constant.character.escape.c + match + \\(\\|[abefnprtv'"?]|[0-3]\d{,2}|[4-7]\d?|x[a-fA-F0-9]{,2}|u[a-fA-F0-9]{,4}|U[a-fA-F0-9]{,8}) - match - \\. name invalid.illegal.unknown-escape.c + match + \\. @@ -2655,31 +2622,26 @@ patterns - match - (?x)% - (\d+\$)? # field (argument #) - [#0\- +']* # flags - [,;:_]? # separator character (AltiVec) - ((-?\d+)|\*(-?\d+\$)?)? # minimum field width - (\.((-?\d+)|\*(-?\d+\$)?)?)? # precision - (hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier - [diouxXDOUeEfFgGaACcSspn%] # conversion type - name constant.other.placeholder.c + match + (?x)% +(\d+\$)? # field (argument #) +[#0\- +']* # flags +[,;:_]? # separator character (AltiVec) +((-?\d+)|\*(-?\d+\$)?)? # minimum field width +(\.((-?\d+)|\*(-?\d+\$)?)?)? # precision +(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier +[diouxXDOUeEfFgGaACcSspn%] # conversion type - match - % name invalid.illegal.placeholder.c + match + % - scopeName - source.c - uuid - 24242A3A-CC4A-414D-B1FA-18D2BABB6754 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9fe8a14 --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +all: # the default Make task + + +SRC_YAML := src/c-improved.syntax.yaml +DEST_PLIST := C\ Improved.tmLanguage + +SYNTAXDEV := node_modules/.bin/syntaxdev + + +.PHONY: all release devenv + +all: release + +release .PHONY: $(DEST_PLIST) # .PHONY: rebuild unconditionally + +$(DEST_PLIST): $(SRC_YAML) $(SYNTAXDEV) + $(SYNTAXDEV) build-plist --in "$<" --out "$@" + +devenv $(SYNTAXDEV): + npm install syntaxdev@0.0.10 diff --git a/c-improved.syntax.yaml b/src/c-improved.syntax.yaml similarity index 100% rename from c-improved.syntax.yaml rename to src/c-improved.syntax.yaml From a37faa05aad9f2508c0aecb88d7cad3dcbd43e8f Mon Sep 17 00:00:00 2001 From: Eldar Abusalimov Date: Tue, 2 Feb 2016 23:21:19 +0300 Subject: [PATCH 3/4] dev: Generate scope list file as part of build process This file might be useful for theme developers. --- Makefile | 7 ++- misc/scopes | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 misc/scopes diff --git a/Makefile b/Makefile index 9fe8a14..122d099 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,9 @@ all: # the default Make task SRC_YAML := src/c-improved.syntax.yaml + DEST_PLIST := C\ Improved.tmLanguage +DEST_SCOPES := misc/scopes SYNTAXDEV := node_modules/.bin/syntaxdev @@ -11,10 +13,13 @@ SYNTAXDEV := node_modules/.bin/syntaxdev all: release -release .PHONY: $(DEST_PLIST) # .PHONY: rebuild unconditionally +release .PHONY: $(DEST_PLIST) $(DEST_SCOPES) # .PHONY: rebuild unconditionally $(DEST_PLIST): $(SRC_YAML) $(SYNTAXDEV) $(SYNTAXDEV) build-plist --in "$<" --out "$@" +$(DEST_SCOPES): $(SRC_YAML) $(SYNTAXDEV) + $(SYNTAXDEV) scopes --syntax "$<" > "$@" + devenv $(SYNTAXDEV): npm install syntaxdev@0.0.10 diff --git a/misc/scopes b/misc/scopes new file mode 100644 index 0000000..7ead240 --- /dev/null +++ b/misc/scopes @@ -0,0 +1,136 @@ +comment.block.c +comment.line.double-slash.c++ +comment.other.preprocessor-disabled.c +constant.character.escape.c +constant.language.c +constant.numeric.float.c +constant.numeric.float.hexadecimal.c +constant.numeric.integer.binary.c +constant.numeric.integer.decimal.c +constant.numeric.integer.hexadecimal.c +constant.numeric.integer.octal.c +constant.numeric.integer.zero.c +constant.other.placeholder.c +entity.name.class.c +entity.name.constant.preprocessor.c +entity.name.function.declaration.c +entity.name.function.definition.c +entity.name.function.preprocessor.c +entity.name.type.class.c +entity.name.type.declaration.c +entity.name.type.typedef.c +invalid.deprecated.preprocessor.c +invalid.deprecated.space-after-continuation.c +invalid.illegal.invalid-number-literal.c +invalid.illegal.invalid-usage-of-preprocessor-directive.c +invalid.illegal.number.hexadecimal-float-requires-exponent.c +invalid.illegal.number.missing-fragment.exponent.c +invalid.illegal.number.missing-fragment.significand.c +invalid.illegal.numeric-literal-character.float.exponent.c +invalid.illegal.numeric-literal-character.float.fraction.c +invalid.illegal.numeric-literal-character.float.whole-number.c +invalid.illegal.numeric-literal-character.integer.c +invalid.illegal.placeholder.c +invalid.illegal.preprocessor.c +invalid.illegal.stray-comment-end.c +invalid.illegal.unexpected-character.c +invalid.illegal.unexpected-closing-paren.c +invalid.illegal.unexpected-end-of-line.c +invalid.illegal.unknown-escape.c +keyword.control.c +keyword.operator.arithmetic.c +keyword.operator.assignment.c +keyword.operator.bitwise.c +keyword.operator.c +keyword.operator.comparison.c +keyword.operator.dereference.c +keyword.operator.increment-decrement.c +keyword.operator.logical.c +keyword.operator.ternary.c +keyword.other.exponent.decimal.c +keyword.other.exponent.hexadecimal.c +keyword.other.line-continuation.c +keyword.other.preprocessor.c +keyword.other.preprocessor.define.c +keyword.other.preprocessor.include.c +keyword.other.preprocessor.pragma.c +keyword.other.task-tag.note.c +keyword.other.task-tag.prio-high.c +keyword.other.task-tag.prio-low.c +keyword.other.task-tag.prio-normal.c +meta.block.c +meta.block.special.c +meta.compound.c +meta.function-call.c +meta.function.c +meta.parens.c +meta.preprocessor.c.include +meta.preprocessor.directive.c +meta.preprocessor.directive.deprecated.c +meta.preprocessor.directive.illegal.c +meta.preprocessor.directive.null-directive.c +meta.preprocessor.directive.pragma-mark.c +meta.preprocessor.include.c +meta.preprocessor.macro.c +meta.preprocessor.macro.parameters.c +meta.preprocessor.undef.c +meta.toc-list.banner.c +meta.toc-list.task-tag.note.c +meta.toc-list.task-tag.prio-high.c +meta.toc-list.task-tag.prio-low.c +meta.toc-list.task-tag.prio-normal.c +meta.typedef.c +punctuation.definition.comment.block.c +punctuation.definition.comment.c +punctuation.definition.comment.line.double-slash.c++ +punctuation.definition.ellipsis.c +punctuation.definition.string.begin.c +punctuation.definition.string.end.c +punctuation.separator.continuation.c +punctuation.separator.parameter.c +punctuation.whitespace.newline.c +storage.modifier.c +storage.type.c +storage.type.class.bug.c +storage.type.class.changed.c +storage.type.class.fixme.c +storage.type.class.hack.c +storage.type.class.idea.c +storage.type.class.important.c +storage.type.class.nb.c +storage.type.class.note.c +storage.type.class.review.c +storage.type.class.tbd.c +storage.type.class.todo.c +storage.type.class.wtf.c +storage.type.class.xxx.c +storage.type.number.prefix.binary.c +storage.type.number.prefix.hexadecimal.c +storage.type.number.prefix.octal.c +storage.type.number.suffix.c +storage.type.number.suffix.float.c +string.macro.stringify.c +string.other.pragma-mark.c +string.quoted.double.c +string.quoted.double.include.c +string.quoted.other.lt-gt.include.c +string.quoted.single.c +string.support.cpython.identifier.c +support.constant.config.c +support.constant.cpython.c +support.constant.mac-classic.c +support.function.C99.c +support.function.any-method.c +support.function.cpython.c +support.function.cpython.macro.c +support.function.intrinsic.c +support.function.linux-kernel.macro.c +support.function.windows-sal2.annotation.c +support.type.cpython.c +support.type.mac-classic.c +support.type.pthread.c +support.type.stdint.c +support.type.sys-types.c +variable.macro.undef.c +variable.other.dot-access.c +variable.parameter.c From 571e758fd058379493b60f913728d40c34188d20 Mon Sep 17 00:00:00 2001 From: Eldar Abusalimov Date: Wed, 3 Feb 2016 01:06:48 +0300 Subject: [PATCH 4/4] dev: Add 'check' target that ensures artifacts are up-to-date --- Makefile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 122d099..fbb5a28 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ DEST_SCOPES := misc/scopes SYNTAXDEV := node_modules/.bin/syntaxdev -.PHONY: all release devenv +.PHONY: all release check devenv all: release @@ -21,5 +21,17 @@ $(DEST_PLIST): $(SRC_YAML) $(SYNTAXDEV) $(DEST_SCOPES): $(SRC_YAML) $(SYNTAXDEV) $(SYNTAXDEV) scopes --syntax "$<" > "$@" + +do_check = \ + OUT=$$(mktemp) && trap "rm -r $$OUT" EXIT && \ + { $2; } && git --no-pager diff --no-index $1 $$OUT + +check: $(SRC_YAML) $(SYNTAXDEV) + @$(call do_check, $(DEST_PLIST), \ + $(SYNTAXDEV) build-plist --in "$<" --out "$$OUT") + @$(call do_check, $(DEST_SCOPES), \ + $(SYNTAXDEV) scopes --syntax "$<" > "$$OUT") + + devenv $(SYNTAXDEV): npm install syntaxdev@0.0.10