{ "name": "Pawn", "scopeName": "source.pawn", "patterns": [ { "include": "#translation_unit" } ], "repository": { "block": { "begin": "(?=\\{)", "end": "\\}", "patterns": [ { "include": "#block-lookahead-end" } ] }, "block-lookahead-end": { "name": "meta.block.c", "begin": "\\{", "end": "(?=\\})", "patterns": [ { "include": "#lex" }, { "include": "#call" }, { "include": "#support" }, { "include": "#function" }, { "include": "$base" } ] }, "call": { "name": "meta.function-call.c", "begin": "(?x)\n\t\t\t\t\\s*\n\t\t\t\t(?= # don't consume to recognize support functions\n\t\t\t\t (?: [A-Za-z_@]\\w*+ | ::[^:] )++\n\t\t\t\t (?:\\s|/\\*.*?\\*/)*+ \\( )\n\t\t\t", "end": "\\)", "patterns": [ { "include": "#lex" }, { "name": "variable.other.dot-access.c support.function.any-method.c", "match": "(?:(?\u003c=\\.)|(?\u003c=-\u003e))\\b([A-Za-z_@]\\w*+)\\b" }, { "name": "support.function.any-method.c", "match": "(?:[A-Za-z_@]\\w*+|::[^:])++" }, { "include": "#parens-lookahead-end" } ] }, "comment-banner-line": { "match": "(?:(?\u003c=//)|(?\u003c=/\\*)|^)[\\s/*]*(=+\\s*(.*?)\\s*=+(?:(?=[\\s/*+\\-]*\\*/)|$(\\n?)))", "captures": { "1": { "name": "meta.toc-list.banner.c" }, "3": { "name": "punctuation.whitespace.newline.c" } } }, "comment-innards": { "patterns": [ { "include": "#comment-banner-line" }, { "include": "#comment-task-tag-line" }, { "include": "#lex-continuation" }, { "include": "#lex-newline" } ] }, "comment-task-tag-line": { "patterns": [ { "name": "meta.toc-list.task-tag.prio-high.c", "begin": "(?ix)\n\t\t\t\t\t (?= (?-i: @[a-zA-Z_]++ | \\b [A-Z_]++) \\b) @? \\b (?:\n\t\t\t\t\t (FIXME) | (XXX) | (WTF)\n\t\t\t\t\t ) \\b\n\t\t\t\t\t", "end": "(?=[\\s/*]*\\*/)|(?\u003c=$\\n)", "patterns": [ { "include": "#comment-task-tag-line-innards" } ], "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" } } }, { "name": "meta.toc-list.task-tag.prio-normal.c", "begin": "(?ix)\n\t\t\t\t\t (?= (?-i: @[a-zA-Z_]++ | \\b [A-Z_]++) \\b) @? \\b (?:\n\t\t\t\t\t (TODO)\n\t\t\t\t\t ) \\b\n\t\t\t\t\t", "end": "(?=[\\s/*]*\\*/)|(?\u003c=$\\n)", "patterns": [ { "include": "#comment-task-tag-line-innards" } ], "beginCaptures": { "0": { "name": "keyword.other.task-tag.prio-normal.c" }, "1": { "name": "storage.type.class.todo.c" } } }, { "name": "meta.toc-list.task-tag.prio-low.c", "begin": "(?ix)\n\t\t\t\t\t (?= (?-i: @[a-zA-Z_]++ | \\b [A-Z_]++) \\b) @? \\b (?:\n\t\t\t\t\t (TBD) | (REVIEW)\n\t\t\t\t\t ) \\b\n\t\t\t\t\t", "end": "(?=[\\s/*]*\\*/)|(?\u003c=$\\n)", "patterns": [ { "include": "#comment-task-tag-line-innards" } ], "beginCaptures": { "0": { "name": "keyword.other.task-tag.prio-low.c" }, "1": { "name": "storage.type.class.tbd.c" }, "2": { "name": "storage.type.class.review.c" } } }, { "name": "meta.toc-list.task-tag.note.c", "begin": "(?ix)\n\t\t\t\t\t (?= (?-i: @[a-zA-Z_]++ | \\b [A-Z_]++) \\b) @? \\b (?:\n\t\t\t\t\t (NOTE) | (NB) | (CHANGED) | (IDEA) | (IMPORTANT) | (HACK) | (BUG)\n\t\t\t\t\t ) \\b\n\t\t\t\t\t", "end": "(?=[\\s/*]*\\*/)|(?\u003c=$\\n)", "patterns": [ { "include": "#comment-task-tag-line-innards" } ], "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" } } } ] }, "comment-task-tag-line-innards": { "patterns": [ { "include": "#comment-task-tag-line" }, { "include": "#lex-continuation" }, { "include": "#lex-newline" } ] }, "comments": { "patterns": [ { "name": "comment.block.c", "begin": "\\s*(/\\*)", "end": "(\\*/)(\\n?)", "patterns": [ { "include": "#comment-innards" } ], "captures": { "1": { "name": "punctuation.definition.comment.block.c" } }, "endCaptures": { "2": { "name": "punctuation.whitespace.newline.c" } } }, { "name": "invalid.illegal.stray-comment-end.c", "match": "\\*/(?![/*])" }, { "name": "comment.line.double-slash.c++", "begin": "\\s*(//)", "end": "(?\u003c=$\\n)(?\u003c!\\\\$\\n)", "patterns": [ { "include": "#comment-innards" } ], "beginCaptures": { "1": { "name": "punctuation.definition.comment.line.double-slash.c++" } } } ] }, "function": { "patterns": [ { "include": "#function-fixup-macro" }, { "include": "#function-declaration" }, { "include": "#function-definition" } ] }, "function-declaration": { "name": "meta.function.c", "begin": "(?x)\n\t\t\t\t(?: ^\n\t\t\t\t | (?\u003c! (?\u003c!\\w) new\n\t\t\t\t | (?\u003c!\\w) (?:else|enum) | (?\u003c!\\w) (?:class|union)\n\t\t\t\t | (?\u003c!\\w) (?:struct|return|sizeof|typeof)\n\t\t\t\t | (?\u003c!\\w) __typeof | (?\u003c!\\w) __typeof__ )\n\t\t\t\t (?\u003c= \\w ) \\s\n\n\t\t\t\t | # or type modifier / closing bracket before name\n\t\t\t\t (?\u003c= [^\u0026]\u0026 | [*\u003e)}\\]] ) ) \\s*\n\n\t\t\t\t( (?: [A-Za-z_@]\\w*+ | ::[^:] )++\n\t\t\t\t (?: (?\u003c= ^ operator | \\W operator ) # C++ operator?\n\t\t\t\t (?: [-*\u0026\u003c\u003e=+!]+ | \\(\\) | \\[\\] ) )? )\n\n\t\t\t\t(?= (?:\\s|/\\*.*?\\*/)*+ (?'parens' \\(\n\t\t\t\t (?\u003e \\g'parens' |\n\t\t\t\t \t\"(\\\\.|[^\"])*\" | '(\\\\.|[^'])*' | /\\*.*?\\*/ |\n\t\t\t\t \t(?! /[/*] | [()] ) . )*\n\t\t\t\t \\) ) \\s* ; )\n\t\t\t", "end": ";", "patterns": [ { "include": "#lex" }, { "include": "#parens" } ], "beginCaptures": { "1": { "name": "entity.name.function.declaration.c" } } }, "function-definition": { "name": "meta.function.c", "begin": "(?x)\n\t\t\t\t(?: ^\n\t\t\t\t | (?\u003c! (?\u003c!\\w) new\n\t\t\t\t | (?\u003c!\\w) (?:else|enum) | (?\u003c!\\w) (?:class|union)\n\t\t\t\t | (?\u003c!\\w) (?:struct|return|sizeof|typeof)\n\t\t\t\t | (?\u003c!\\w) __typeof | (?\u003c!\\w) __typeof__ )\n\t\t\t\t (?\u003c= \\w ) \\s\n\n\t\t\t\t | # or type modifier / closing bracket before name\n\t\t\t\t (?\u003c= [^\u0026]\u0026 | [*\u003e)}\\]\\:] ) ) \\s*\n\n\t\t\t\t( (?: [A-Za-z_@]\\w*+ | ::[^:] )++\n\t\t\t\t (?: (?\u003c= ^ operator | \\W operator ) # C++ operator?\n\t\t\t\t (?: [-*\u0026\u003c\u003e=+!]+ | \\(\\) | \\[\\] ) )? )\n\n\t\t\t\t(?= (?:\\s|/\\*.*?\\*/)*+ \\( )\n\t\t\t", "end": "\\}|;", "patterns": [ { "include": "#lex" }, { "include": "#parens" }, { "name": "storage.modifier.c", "match": "\\s*\\b(const|override)\\b" }, { "include": "#block-lookahead-end" } ], "beginCaptures": { "1": { "name": "entity.name.function.definition.c" } } }, "function-fixup-macro": { "begin": "(?x)\n\t\t\t\t^ # Begin of line, capital letters: most probably it is a macro\n\t\t\t\t\\s*\\b\n\t\t\t\t([A-Z0-9_]++)\n\t\t\t\t\\b\n\t\t\t\t(?= (?:\\s|/\\*.*?\\*/)*+ \\( )\n\t\t\t", "end": "\\)", "patterns": [ { "include": "#lex" }, { "include": "#parens-lookahead-end" } ] }, "lex": { "patterns": [ { "include": "#lex-in-preprocessor" }, { "include": "#preprocessor" } ] }, "lex-constant": { "patterns": [ { "match": "\\s*\\b(true|false|TRUE|FALSE)\\b", "captures": { "1": { "name": "constant.language.c" } } } ] }, "lex-continuation": { "patterns": [ { "name": "punctuation.separator.continuation.c", "match": "(\\\\)$(\\n?)", "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-core": { "patterns": [ { "include": "#comments" }, { "include": "#lex-continuation" }, { "include": "#lex-newline" }, { "include": "#lex-number" }, { "include": "#lex-string" } ] }, "lex-in-preprocessor": { "patterns": [ { "include": "#lex-core" }, { "include": "#lex-keyword" }, { "include": "#support-keyword" }, { "include": "#lex-constant" } ] }, "lex-keyword": { "patterns": [ { "match": "\\s*\\b(defined)\\b", "captures": { "1": { "name": "keyword.other.preprocessor.c" } } }, { "match": "\\s*\\b(sizeof|tagof)\\b", "captures": { "1": { "name": "keyword.operator.c" } } }, { "match": "(Iterator:)(\\t)", "captures": { "2": { "name": "invalid.illegal.invalid-indentation" } } }, { "begin": "^\\s*(case)\\s+", "end": "(:)|(?\u003c=^|[^\\\\])\\s*(\\n)", "patterns": [ { "include": "#lex-core" } ], "beginCaptures": { "1": { "name": "keyword.control.c" } }, "endCaptures": { "1": { "name": "keyword.operator.ternary.c" } } }, { "match": "\\s*\\b(assert|break|case|continue|default|do|else|exit|for|goto|if|return|sleep|state|switch|while)\\b", "captures": { "1": { "name": "keyword.control.c" } } }, { "match": "\\s*\\b(new|enum)\\b", "captures": { "1": { "name": "storage.type.c" } } }, { "match": "\\s*\\b(public|forward|native|char|const|static|stock|hook|task|ptask)\\b", "captures": { "1": { "name": "storage.modifier.c" } } }, { "name": "storage.modifier.c", "match": "([A-Za-z_]\\w*)\\:" }, { "name": "keyword.operator.assignment.c", "match": "(\\-|\\+|\\*|\\/|%|\u0026|\\||\\^|\u003c\u003c|\u003e\u003e)?=" }, { "name": "keyword.operator.comparison.c", "match": "(==|!=|\u003c=|\u003e=|\u003c\u003e|\u003c|\u003e)" }, { "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": "(!|\u0026\u0026|\\|\\|)" }, { "name": "keyword.operator.bitwise.c", "match": "(~|\u0026|\\||\\^|\u003c\u003c|\u003e\u003e)" } ] }, "lex-newline": { "name": "punctuation.whitespace.newline.c", "match": "$\\n" }, "lex-number": { "patterns": [ { "match": "([0-9]+)(\\.{2})([0-9]+)", "captures": { "1": { "name": "constant.numeric.integer.decimal.c" }, "2": { "name": "keyword.operator.switch-range.c" }, "3": { "name": "constant.numeric.integer.decimal.c" } } }, { "name": "constant.numeric.float.hexadecimal.c", "match": "(?ix) # hexadecimal float\n\t\t\t\t\t\t(?\u003c!\\.) \\b\n\n\t\t\t\t\t\t(0x)\n\n\t\t\t\t\t\t# significand\n\t\t\t\t\t\t(?: (\\.) (?=p) # invalid\n\t\t\t\t\t\t | [0-9a-f]*+ ([0-9a-z]*?) [0-9a-f]*+\n\t\t\t\t\t\t (?: \\. [0-9a-f]*+ ([0-9a-z.]*?) [0-9a-f]*+ )? )\n\n\t\t\t\t\t\t# exponent (required)\n\t\t\t\t\t\t(?: (p) (?: [+\\-] [0-9]++ ([0-9a-z]*?)\n\t\t\t\t\t\t | (?=[0-9a-z.]) [0-9]*+ ([0-9a-z.]*?) )\n\t\t\t\t\t\t | (p) )\n\n\t\t\t\t\t\t# remaining valid chars and type\n\t\t\t\t\t\t[0-9]*+ ([fl]?)\n\n\t\t\t\t\t\t\\b (?!\\.)\n\t\t\t\t\t", "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" } } }, { "name": "constant.numeric.float.hexadecimal.c", "match": "(?ix) # hexadecimal float without required exponent\n\t\t\t\t\t\t(?\u003c!\\.) \\b\n\n\t\t\t\t\t\t(0x)\n\n\t\t\t\t\t\t# significand (at least a period)\n\t\t\t\t\t\t [0-9a-f]*+ ([0-9a-z\u0026\u0026[^p]]*?) [0-9a-f]*+\n\t\t\t\t\t\t(\\.) [0-9a-f]*+ ([0-9a-z.\u0026\u0026[^p]]*?) [0-9a-f]*+\n\n\t\t\t\t\t\t# type\n\t\t\t\t\t\t(l?)\n\n\t\t\t\t\t\t(?:(?\u003c=\\.)|\\b) (?!\\.)\n\t\t\t\t\t", "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" } } }, { "name": "constant.numeric.float.c", "match": "(?ix) # decimal float literal\n\t\t\t\t\t\t(?\u003c!\\.) (?:(?=\\.)|\\b)\n\n\t\t\t\t\t\t(?!0x)\n\t\t\t\t\t\t# significand\n\t\t\t\t\t\t(?: (?: [0-9]++ ([0-9a-z\u0026\u0026[^e]]*?) [0-9]*+ )?\n\t\t\t\t\t\t \\. [0-9]++ ([0-9a-z.\u0026\u0026[^e]]*?) [0-9]*+\n\n\t\t\t\t\t\t | [0-9]++ ([0-9a-z\u0026\u0026[^e]]*?) [0-9]*+ (?: \\. | (?=e)) )\n\n\t\t\t\t\t\t# exponent (optional)\n\t\t\t\t\t\t(?: (e) (?: [+\\-] [0-9]++ ([0-9a-z]*?)\n\t\t\t\t\t\t | [0-9]++ ([0-9a-z.]*?) )\n\t\t\t\t\t\t | ( p [+\\-]? [0-9]++\n\t\t\t\t\t\t | [ep] [0-9a-z.]*?) )?\n\n\t\t\t\t\t\t# any invalid chars and type\n\t\t\t\t\t\t([0-9a-z]*?) [0-9]*+ ([fl]?)\n\n\t\t\t\t\t\t(?:(?\u003c=\\.)|\\b) (?!\\.)\n\t\t\t\t\t", "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" } } }, { "name": "constant.numeric.integer.zero.c", "match": "(?ix)\n\t\t\t\t\t\t(?\u003c!\\.) \\b\n\t\t\t\t\t\t(0x)? 0++\n\t\t\t\t\t\t(u?l{0,2}|lul?|llu)\n\t\t\t\t\t\t\\b (?!\\.)\n\t\t\t\t\t", "captures": { "1": { "name": "storage.type.number.prefix.hexadecimal.c" }, "2": { "name": "storage.type.number.suffix.c" } } }, { "name": "invalid.illegal.invalid-number-literal.c", "match": "(?ix)\n\t\t\t\t\t\t(?\u003c!\\.) \\b\n\n\t\t\t\t\t\t(?: (0x) | (0b) )\n\t\t\t\t\t\t(u?l{0,2}|lul?|llu)\n\n\t\t\t\t\t\t\\b (?!\\.)\n\t\t\t\t\t" }, { "name": "constant.numeric.integer.hexadecimal.c", "match": "(?ix)\n\t\t\t\t\t\t(?\u003c!\\.) \\b\n\n\t\t\t\t\t\t(0x) [0-9a-f]++\n\n\t\t\t\t\t\t# any invalid chars\n\t\t\t\t\t\t([0-9a-z]*?)\n\n\t\t\t\t\t\t# the remainder (after invalid chars, if any) and a type\n\t\t\t\t\t\t[0-9a-f]* (u?l{0,2}|lul?|llu)\n\n\t\t\t\t\t\t\\b (?!\\.)\n\t\t\t\t\t", "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" } } }, { "name": "constant.numeric.integer.binary.c", "match": "(?ix)\n\t\t\t\t\t\t(?\u003c!\\.) \\b\n\n\t\t\t\t\t\t(0b) [01]++\n\n\t\t\t\t\t\t# any invalid chars\n\t\t\t\t\t\t([0-9a-z]*?)\n\n\t\t\t\t\t\t# the remainder (after invalid chars, if any) and a type\n\t\t\t\t\t\t[01]* (u?l{0,2}|lul?|llu)\n\n\t\t\t\t\t\t\\b (?!\\.)\n\t\t\t\t\t", "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" } } }, { "name": "constant.numeric.integer.octal.c", "match": "(?ix)\n\t\t\t\t\t\t(?\u003c!\\.) \\b\n\n\t\t\t\t\t\t(0) [0-7]++\n\n\t\t\t\t\t\t# any invalid chars\n\t\t\t\t\t\t([0-9a-z]*?)\n\n\t\t\t\t\t\t# the remainder (after invalid chars, if any) and a type\n\t\t\t\t\t\t[0-7]* (u?l{0,2}|lul?|llu)\n\n\t\t\t\t\t\t\\b (?!\\.)\n\t\t\t\t\t", "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" } } }, { "name": "constant.numeric.integer.decimal.c", "match": "(?ix)\n\t\t\t\t\t\t\\b\n\n\t\t\t\t\t\t[0-9][0-9_]*\n\n\t\t\t\t\t\t# any invalid chars\n\t\t\t\t\t\t([0-9a-z]*?)\n\n\t\t\t\t\t\t# the remainder (after invalid chars, if any) and a type\n\t\t\t\t\t\t[0-9]* (u?l{0,2}|lul?|llu)\n\n\t\t\t\t\t\t\\b\n\t\t\t\t\t", "captures": { "1": { "name": "invalid.illegal.numeric-literal-character.integer.c" }, "2": { "name": "storage.type.number.suffix.c" } } } ] }, "lex-string": { "patterns": [ { "name": "string.quoted.double.c", "begin": "\"", "end": "(\")|(?\u003c=^|[^\\\\])\\s*(\\n)", "patterns": [ { "include": "#lex-continuation" }, { "include": "#string_escaped_char" }, { "include": "#string_placeholder" } ], "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.c" } }, "endCaptures": { "1": { "name": "punctuation.definition.string.end.c" }, "2": { "name": "invalid.illegal.unexpected-end-of-line.c" } } }, { "name": "string.quoted.single.c", "begin": "'", "end": "(')|(?\u003c=^|[^\\\\])\\s*(\\n)", "patterns": [ { "include": "#lex-continuation" }, { "include": "#string_escaped_char" } ], "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.c" } }, "endCaptures": { "1": { "name": "punctuation.definition.string.end.c" }, "2": { "name": "invalid.illegal.unexpected-end-of-line.c" } } } ] }, "parens": { "begin": "(?=\\()", "end": "\\)", "patterns": [ { "include": "#parens-lookahead-end" } ] }, "parens-lookahead-end": { "name": "meta.parens.c", "begin": "\\(", "end": "(?=\\))", "patterns": [ { "include": "#lex" }, { "include": "#call" }, { "include": "#support" }, { "include": "$base" } ] }, "ppline-any": { "name": "meta.preprocessor.directive.null-directive.c", "begin": "^\\s*(#)", "end": "(?\u003c=$\\n)(?\u003c!\\\\$\\n)", "patterns": [ { "include": "#lex-core" } ], "beginCaptures": { "0": { "name": "keyword.other.preprocessor.c" } } }, "ppline-directive": { "name": "meta.preprocessor.directive.c", "begin": "^\\s*(#)\\s*(if|elseif|else|endif|pragma|line|define|undef|section|assert|file|endinput|endscript)\\b", "end": "(?\u003c=$\\n)(?\u003c!\\\\$\\n)", "patterns": [ { "include": "#lex-core" }, { "include": "#lex-in-preprocessor" } ], "beginCaptures": { "0": { "name": "keyword.other.preprocessor.c" } } }, "ppline-directive-emit": { "name": "meta.preprocessor.directive.emit.c", "begin": "(?x)\n\t\t\t\t^\\s*(\\#|@)\\s*(emit) #pre-processor directive\n\t\t\t\t(\\s+\n\t\t\t\t\t([A-Z0-9a-z]+)\n\t\t\t\t\t(\n\t\t\t\t\t\t(\\.)([A-Za-z]+)\n\t\t\t\t\t\t((\\.)([A-Za-z]+))?\n\t\t\t\t\t)?\n\t\t\t\t|\\s*)\n\t\t\t", "end": "(?\u003c=$\\n)(?\u003c!\\\\$\\n)", "patterns": [ { "include": "#lex-core" }, { "include": "#lex-in-preprocessor" } ], "beginCaptures": { "1": { "name": "keyword.other.preprocessor.c" }, "2": { "name": "keyword.control.import.c" }, "4": { "name": "entity.name.function.preprocessor.c" }, "6": { "name": "punctuation.separator.parameters.c" }, "7": { "name": "entity.name.function.preprocessor.c" } } }, "ppline-directive-invalid-usage": { "name": "meta.preprocessor.directive.c", "match": "(^\\s*(#)\\s*(if|elseif|pragma|define|undef|include|tryinclude)\\b)\\s*?(\\n|$)", "captures": { "1": { "name": "keyword.other.preprocessor.c" }, "4": { "name": "invalid.illegal.invalid-usage-of-preprocessor-directive.c" } } }, "ppline-error": { "name": "meta.preprocessor.include.c meta.preprocessor.c.include", "begin": "^\\s*(#)\\s*(error|warning)\\b", "end": "(.*)|(?\u003c=$\\n)(?\u003c!\\\\$\\n)", "beginCaptures": { "0": { "name": "keyword.other.preprocessor.include.c" } }, "endCaptures": { "1": { "name": "string.quoted.double.c" } } }, "ppline-include": { "name": "meta.preprocessor.include.c meta.preprocessor.c.include", "begin": "^\\s*(#)\\s*(include|tryinclude)\\b", "end": "(?:(\"[^\"]*?)|(\u003c[^\u003e]*?))(\\n)|(?\u003c=$\\n)(?\u003c!\\\\$\\n)", "patterns": [ { "include": "#ppline-include-innards" } ], "beginCaptures": { "0": { "name": "keyword.other.preprocessor.include.c" } }, "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" } } }, "ppline-include-innards": { "patterns": [ { "include": "#preprocessor-lex" }, { "name": "string.quoted.double.include.c", "begin": "\"|(?=.*?\")", "end": "\"|(?\u003c=^|[^\\\\])(?=\\s*\\n)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.c" } }, "endCaptures": { "0": { "name": "punctuation.definition.string.end.c" } } }, { "name": "string.quoted.other.lt-gt.include.c", "begin": "\u003c(?=.*?\u003e)", "end": "\u003e|(?\u003c=^|[^\\\\])(?=\\s*\\n)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.c" } }, "endCaptures": { "0": { "name": "punctuation.definition.string.end.c" } } }, { "name": "meta.parens.c", "begin": "\\(", "end": "\\)|(?\u003c=^|[^\\\\])(?=\\s*\\n)", "patterns": [ { "include": "#ppline-include-innards" } ] } ] }, "ppline-invalid": { "name": "meta.preprocessor.directive.illegal.c", "begin": "^\\s*(#)(?!\\s*(?=/[/*]|(?\u003e\\\\\\s*\\n)|\\n|$))\\s*(\\w*)", "end": "(?\u003c=$\\n)(?\u003c!\\\\$\\n)", "beginCaptures": { "1": { "name": "keyword.other.preprocessor.c" }, "2": { "name": "invalid.illegal.preprocessor.c" } } }, "ppline-macro": { "name": "meta.preprocessor.macro.c", "begin": "^\\s*(#)(?=\\s*(define)\\s+[a-zA-Z_]\\w*+)", "end": "(?\u003c=$\\n)(?\u003c!\\\\$\\n)", "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": "#ppline-macro-param" }, { "include": "#lex-in-preprocessor" }, { "include": "#support" } ], "beginCaptures": { "0": { "name": "keyword.other.preprocessor.c" } } }, "ppline-macro-head-function": { "contentName": "meta.preprocessor.macro.parameters.c", "begin": "(?\u003c!##)(?\u003c=#)(\\s*define)\\s+([a-zA-Z_]\\w*+)(\\()", "end": "(?\u003c=\\))|(?\u003c=^|[^\\\\])\\s*(\\n)?", "patterns": [ { "include": "#ppline-macro-param" } ], "beginCaptures": { "1": { "name": "keyword.other.preprocessor.define.c" }, "2": { "name": "entity.name.function.preprocessor.c" }, "3": { "name": "meta.preprocessor.macro.parameters.c" } }, "endCaptures": { "1": { "name": "invalid.illegal.unexpected-end-of-line.c" } } }, "ppline-macro-head-object": { "match": "(?\u003c!##)(?\u003c=#)(\\s*define)\\s+([a-zA-Z_]\\w*+)(?!\\()[\\s\u0026\u0026[^\\n]]*", "captures": { "1": { "name": "keyword.other.preprocessor.define.c" }, "2": { "name": "entity.name.constant.preprocessor.c" } } }, "ppline-macro-param": { "match": "(%[0-9]+)", "captures": { "1": { "name": "variable.parameter.c" } } }, "ppline-pragma-mark": { "name": "meta.preprocessor.directive.c", "begin": "(^\\s*(#)\\s*(pragma\\s+(align|amxlimit|amxram|codepage|compress|ctrlchar|deprecated|dynamic|library|overlay|pack|rational|semicolon|tabsize|unused))\\b)[\\s\u0026\u0026[^\\n]]*", "end": "(?\u003c=$\\n)(?\u003c!\\\\$\\n)", "patterns": [ { "include": "#lex-core" } ], "beginCaptures": { "1": { "name": "keyword.other.preprocessor.pragma.c" } } }, "ppline-undef": { "name": "meta.preprocessor.undef.c", "begin": "(^\\s*(#)\\s*(undef))\\s+([a-zA-Z_]\\w*+)", "end": "(?\u003c=$\\n)(?\u003c!\\\\$\\n)", "beginCaptures": { "1": { "name": "keyword.other.preprocessor.c" }, "4": { "name": "variable.macro.undef.c" } } }, "preprocessor": { "begin": "(?=^\\s*(#))", "end": "(?!^\\s*(#))", "patterns": [ { "include": "#ppline-directive-invalid-usage" }, { "include": "#ppline-macro" }, { "include": "#ppline-undef" }, { "include": "#ppline-pragma-mark" }, { "include": "#ppline-include" }, { "include": "#ppline-error" }, { "include": "#ppline-directive" }, { "include": "#ppline-directive-obsolete" }, { "include": "#ppline-directive-emit" }, { "include": "#ppline-invalid" }, { "include": "#ppline-any" } ] }, "preprocessor-lex": { "patterns": [ { "include": "#comments" }, { "include": "#lex-continuation" }, { "include": "#lex-newline" } ] }, "string_escaped_char": { "patterns": [ { "name": "constant.character.escape.c", "match": "\\\\(\\\\|[abefnprtv'\"?]|[0-3]\\d{0,2}|[4-7]\\d?|x[a-fA-F0-9]{0,2}|u[a-fA-F0-9]{0,4}|U[a-fA-F0-9]{0,8})" }, { "name": "invalid.illegal.unknown-escape.c", "match": "\\\\." } ] }, "string_placeholder": { "patterns": [ { "name": "constant.other.placeholder.c", "match": "(?x)%\n\t\t\t\t\t\t(\\d+\\$)? # field (argument #)\n\t\t\t\t\t\t[#0\\- +']* # flags\n\t\t\t\t\t\t[,;:_]? # separator character (AltiVec)\n\t\t\t\t\t\t((-?\\d+)|\\*(-?\\d+\\$)?)? # minimum field width\n\t\t\t\t\t\t(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)? # precision\n\t\t\t\t\t\t[diouxXDOUeEfFgGaACcSspnq%] # conversion type\n\t\t\t\t\t" }, { "name": "invalid.illegal.placeholder.c", "match": "%" } ] }, "support": { "patterns": [ { "include": "#support-modifier" }, { "include": "#support-keyword" } ] }, "support-keyword": { "patterns": [ { "match": "\\s*\\b(foreach)\\b", "captures": { "1": { "name": "keyword.control.c" } } } ] }, "support-modifier": { "patterns": [ { "match": "\\s*\\b(inline|using)\\b", "captures": { "1": { "name": "storage.modifier.c" } } } ] }, "translation_unit": { "patterns": [ { "include": "#lex" }, { "include": "#function" }, { "include": "#support" }, { "include": "#block" }, { "include": "#parens" } ] } } }