diff --git a/package.json b/package.json index 5c34b1d..356c286 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vscode-hack", - "version": "0.1.2", + "version": "0.2.1", "publisher": "pranayagarwal", "engines": { "vscode": "^1.5.0" diff --git a/syntaxes/hack.json b/syntaxes/hack.json index b2ccedf..5679d9f 100644 --- a/syntaxes/hack.json +++ b/syntaxes/hack.json @@ -191,7 +191,7 @@ "name": "punctuation.definition.comment.php" } }, - "comment": "This now only highlights a docblock if the first line contains only /**\n\t\t\t\t\t\t\t\t- this is to stop highlighting everything as invalid when people do comment banners with /******** ...\n\t\t\t\t\t\t\t\t- Now matches /**#@+ too - used for docblock templates: http://manual.phpdoc.org/HTMLframesConverter/default/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#basics.docblocktemplate", + "comment": "This now only highlights a docblock if the first line contains only /**\n- this is to stop highlighting everything as invalid when people do comment banners with /******** ...\n- Now matches /**#@+ too - used for docblock templates:\n http://manual.phpdoc.org/HTMLframesConverter/default/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#basics.docblocktemplate", "end": "\\*/", "name": "comment.block.documentation.phpdoc.php", "patterns": [ @@ -254,10 +254,41 @@ } ] }, + "generics": { + "patterns": [ + { + "begin": "(<)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.generics.php" + } + }, + "end": "(>)", + "endCaptures": { + "1": { + "name": "punctuation.definition.generics.php" + } + }, + "name": "meta.generics.php", + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#generics" + }, + { + "match": "([-+])?([A-Za-z_][A-Za-z0-9_]*)(?:\\s+(as|super)\\s+([A-Za-z_][A-Za-z0-9_]*))?", + "name": "storage.type.php" + } + ] + } + ] + }, "constants": { "patterns": [ { - "begin": "(?xi)(?=\n\t\t\t (\n\t\t\t (\\\\[a-z_][a-z_0-9]*\\\\[a-z_][a-z_0-9\\\\]*)|\n\t\t\t ([a-z_][a-z_0-9]*\\\\[a-z_][a-z_0-9\\\\]*)\n\t\t\t )\n\t\t\t [^a-z_0-9\\\\])", + "begin": "(?xi)\n(?=\n (\n (\\\\[a-z_][a-z_0-9]*\\\\[a-z_][a-z_0-9\\\\]*)\n |\n ([a-z_][a-z_0-9]*\\\\[a-z_][a-z_0-9\\\\]*)\n )\n [^a-z_0-9\\\\]\n)", "end": "(?i)([a-z_][a-z_0-9]*)?(?=[^a-z0-9_\\\\])", "endCaptures": { "1": { @@ -315,7 +346,7 @@ "name": "support.constant.parser-token.php" }, { - "comment": "In PHP, any identifier which is not a variable is taken to be a constant.\n \t\t\t\tHowever, if there is no constant defined with the given name then a notice\n \t\t\t\tis generated and the constant is assumed to have the value of its name.", + "comment": "In PHP, any identifier which is not a variable is taken to be a constant.\nHowever, if there is no constant defined with the given name then a notice\nis generated and the constant is assumed to have the value of its name.", "match": "[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*", "name": "constant.other.php" } @@ -350,7 +381,7 @@ "include": "#comments" }, { - "begin": "(?x)\n\t\t\t\t\t\t\t\\s*(array) # Typehint\n\t\t\t\t\t\t\t\\s*(&)? \t\t\t\t\t# Reference\n\t\t\t\t\t\t\t\\s*((\\$+)[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*) # The variable name\n\t\t\t\t\t\t\t\\s*(=)\t# A default value\n\t\t\t\t\t\t\t\\s*(array)\\s*(\\()\n\t\t\t\t\t\t\t", + "begin": "(?x)\n\\s*(array) # Typehint\n\\s*(&)? # Reference\n\\s*((\\$+)[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*) # The variable name\n\\s*(=) # A default value\n\\s*(array)\\s*(\\()", "beginCaptures": { "1": { "name": "storage.type.php" @@ -395,7 +426,7 @@ ] }, { - "begin": "(?x)\n\t\t\t\t\t\t\t\\s*(array) # Typehint\n\t\t\t\t\t\t\t\\s*(&)? \t\t\t\t\t# Reference\n\t\t\t\t\t\t\t\\s*((\\$+)[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*) # The variable name\n\t\t\t\t\t\t\t\\s*(=)\t# A default value\n\t\t\t\t\t\t\t\\s*()\\s*(\\[)\n\t\t\t\t\t\t\t", + "begin": "(?x)\n\\s*(array) # Typehint\n\\s*(&)? # Reference\n\\s*((\\$+)[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*) # The variable name\n\\s*(=) # A default value\n\\s*()\\s*(\\[)", "beginCaptures": { "1": { "name": "storage.type.php" @@ -463,7 +494,7 @@ "name": "invalid.illegal.non-null-typehinted.php" } }, - "match": "(?xi)\n\t\t\t\t\t\t\t\\s*(array) # Typehint\n\t\t\t\t\t\t\t\\s*(&)? \t\t\t\t\t# Reference\n\t\t\t\t\t\t\t\\s*((\\$+)[a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*) # The variable name\n\t\t\t\t\t\t\t(?:\n\t\t\t\t\t\t\t\t\\s*(?:(=)\\s*(?:(null)|((?:\\S*?\\(\\))|(?:\\S*?))))\t# A default value\n\t\t\t\t\t\t\t)?\n\t\t\t\t\t\t\t\\s*(?=,|\\)|/[/*]|\\#|$) # A closing parentheses (end of argument list) or a comma or a comment\n\t\t\t\t\t\t\t", + "match": "(?xi)\n\\s*(array) # Typehint\n\\s*(&)? # Reference\n\\s*((\\$+)[a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*) # The variable name\n(?: # A default value\n \\s*(?:(=)\\s*(?:(null|(?:\\S*?))|(\\S*?\\(\\))))\n)?\n\\s*(?=,|\\)|/[/*]|\\#|$) # A closing parentheses (end of argument list) or a comma or a comment", "name": "meta.function.argument.array.php" }, { @@ -498,7 +529,7 @@ "name": "invalid.illegal.non-null-typehinted.php" } }, - "match": "(?xi)\n \t\t\t\t\t\t\t\\s*([a-z_][a-z_0-9]*)? # Typehinted class name\n \t\t\t\t\t\t\t\\s*(&)? \t\t\t\t\t# Reference\n \t\t\t\t\t\t\t\\s*((\\$+)[a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*) # The variable name\n \t\t\t\t\t\t\t(?:\n \t\t\t\t\t\t\t\t\\s*(?:(=)\\s*(?:(null)|((?:\\S*?\\(\\))|(?:\\S*?))))\t# A default value\n \t\t\t\t\t\t\t)?\n \t\t\t\t\t\t\t\\s*(?=,|\\)|/[/*]|\\#|$) # A closing parentheses (end of argument list) or a comma\n\t\t\t\t\t " + "match": "(?xi)\n\\s*([a-z_][a-z_0-9]*)? # Typehinted class name\n\\s*(&)? # Reference\n\\s*((\\$+)[a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*) # The variable name\n(?:\n \\s*(?:(=)\\s*(?:(null|(?:\\S*?))|(\\S*?\\(\\)))) # A default value\n)?\n\\s*(?=,|\\)|/[/*]|\\#|$) # A closing parentheses (end of argument list) or a comma" } ] }, @@ -613,238 +644,41 @@ "heredoc": { "patterns": [ { - "begin": "(?=<<<\\s*(\"?)([a-zA-Z_]+[a-zA-Z0-9_]*)(\\1)\\s*$)", - "end": "(?!\\G)", - "injections": { - "*": { - "patterns": [ - { - "include": "#interpolation" - } - ] + "begin": "<<<\\s*(\"?)([a-zA-Z_]+[a-zA-Z0-9_]*)(\\1)\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.operator.heredoc.php" + } + }, + "end": "^(\\2)\\b", + "endCaptures": { + "1": { + "name": "keyword.operator.heredoc.php" } }, "name": "string.unquoted.heredoc.php", "patterns": [ { - "include": "#heredoc_interior" + "include": "#interpolation" } ] }, { - "begin": "(?=<<<\\s*('?)([a-zA-Z_]+[a-zA-Z0-9_]*)(\\1)\\s*$)", - "end": "(?!\\G)", - "name": "string.unquoted.heredoc.nowdoc.php", - "patterns": [ - { - "include": "#heredoc_interior" + "begin": "<<<\\s*('?)([a-zA-Z_]+[a-zA-Z0-9_]*)(\\1)\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.operator.heredoc.php" } - ] - } - ], - "repository": { - "heredoc_interior": { - "patterns": [ - { - "begin": "(<<<)\\s*(['\"]?)(HTML)(\\2)\\s*$\\n?", - "beginCaptures": { - "0": { - "name": "punctuation.section.embedded.begin.php" - }, - "1": { - "name": "punctuation.definition.string.php" - }, - "3": { - "name": "keyword.operator.heredoc.php" - } - }, - "contentName": "text.html", - "end": "^(\\3)\\b", - "endCaptures": { - "0": { - "name": "punctuation.section.embedded.end.php" - }, - "1": { - "name": "keyword.operator.heredoc.php" - } - }, - "name": "meta.embedded.html", - "patterns": [ - { - "include": "text.html.basic" - } - ] - }, - { - "begin": "(<<<)\\s*(['\"]?)(XML)(\\2)\\s*$\\n?", - "beginCaptures": { - "0": { - "name": "punctuation.section.embedded.begin.php" - }, - "1": { - "name": "punctuation.definition.string.php" - }, - "3": { - "name": "keyword.operator.heredoc.php" - } - }, - "contentName": "text.xml", - "end": "^(\\3)\\b", - "endCaptures": { - "0": { - "name": "punctuation.section.embedded.end.php" - }, - "1": { - "name": "keyword.operator.heredoc.php" - } - }, - "name": "meta.embedded.xml", - "patterns": [ - { - "include": "text.xml" - } - ] - }, - { - "begin": "(<<<)\\s*(['\"]?)(SQL)(\\2)\\s*$\\n?", - "beginCaptures": { - "0": { - "name": "punctuation.section.embedded.begin.php" - }, - "1": { - "name": "punctuation.definition.string.php" - }, - "3": { - "name": "keyword.operator.heredoc.php" - } - }, - "contentName": "source.sql", - "end": "^(\\3)\\b", - "endCaptures": { - "0": { - "name": "punctuation.section.embedded.end.php" - }, - "1": { - "name": "keyword.operator.heredoc.php" - } - }, - "name": "meta.embedded.sql", - "patterns": [ - { - "include": "source.sql" - } - ] - }, - { - "begin": "(<<<)\\s*(['\"]?)(JAVASCRIPT)(\\2)\\s*$\\n?", - "beginCaptures": { - "0": { - "name": "punctuation.section.embedded.begin.php" - }, - "1": { - "name": "punctuation.definition.string.php" - }, - "3": { - "name": "keyword.operator.heredoc.php" - } - }, - "contentName": "source.js", - "end": "^(\\3)\\b", - "endCaptures": { - "0": { - "name": "punctuation.section.embedded.end.php" - }, - "1": { - "name": "keyword.operator.heredoc.php" - } - }, - "name": "meta.embedded.js", - "patterns": [ - { - "include": "source.js" - } - ] - }, - { - "begin": "(<<<)\\s*(['\"]?)(JSON)(\\2)\\s*$\\n?", - "beginCaptures": { - "0": { - "name": "punctuation.section.embedded.begin.php" - }, - "1": { - "name": "punctuation.definition.string.php" - }, - "3": { - "name": "keyword.operator.heredoc.php" - } - }, - "contentName": "source.json", - "end": "^(\\3)\\b", - "endCaptures": { - "0": { - "name": "punctuation.section.embedded.end.php" - }, - "1": { - "name": "keyword.operator.heredoc.php" - } - }, - "name": "meta.embedded.json", - "patterns": [ - { - "include": "source.json" - } - ] - }, - { - "begin": "(<<<)\\s*(['\"]?)(CSS)(\\2)\\s*$\\n?", - "beginCaptures": { - "0": { - "name": "punctuation.section.embedded.begin.php" - }, - "1": { - "name": "punctuation.definition.string.php" - }, - "3": { - "name": "keyword.operator.heredoc.php" - } - }, - "contentName": "source.css", - "end": "^(\\3)\\b", - "endCaptures": { - "0": { - "name": "punctuation.section.embedded.end.php" - }, - "1": { - "name": "keyword.operator.heredoc.php" - } - }, - "name": "meta.embedded.css", - "patterns": [ - { - "include": "source.css" - } - ] - }, - { - "begin": "(<<<)\\s*(['\"]?)([a-zA-Z_]+[a-zA-Z0-9_]*)(\\2)", - "beginCaptures": { - "1": { - "name": "punctuation.definition.string.php" - }, - "3": { - "name": "keyword.operator.heredoc.php" - } - }, - "end": "^(\\3)\\b", - "endCaptures": { - "1": { - "name": "keyword.operator.heredoc.php" - } - } + }, + "end": "^(\\2)\\b", + "endCaptures": { + "1": { + "name": "keyword.operator.heredoc.php" } - ] + }, + "name": "string.unquoted.heredoc.nowdoc.php" } - } + ] }, "instantiation": { "begin": "(?i)(new)\\s+", @@ -918,6 +752,39 @@ "match": "(?i)(\\$+)([a-z_][a-z_0-9]*)(?=\\s*\\()", "name": "meta.function-call.invoke.php" }, + "interface": { + "begin": "^(?i)\\b(interface)\\b", + "beginCaptures": { + "1": { + "name": "storage.type.interface.php" + } + }, + "name": "meta.interface.php", + "end": "(?=[;{])", + "patterns": [ + { + "include": "#comments" + }, + { + "match": "\\b(extends)\\b", + "captures": { + "1": { + "name": "storage.modifier.extends.php" + } + } + }, + { + "include": "#generics" + }, + { + "include": "#namespace" + }, + { + "match": "(?i)[a-z0-9_]+", + "name": "entity.name.type.class.php" + } + ] + }, "language": { "patterns": [ { @@ -927,28 +794,35 @@ "include": "#xhp" }, { - "begin": "(?i)^\\s*(interface)\\s+([a-z0-9_]+)\\s*(extends)?\\s*", + "include": "#interface" + }, + { + "begin": "(?xi)\n^\\s*\n(type)\n\\s+\n([a-z0-9_]+)", "beginCaptures": { "1": { - "name": "storage.type.interface.php" + "name": "storage.type.typedecl.php" }, "2": { - "name": "entity.name.type.interface.php" - }, - "3": { - "name": "storage.modifier.extends.php" + "name": "entity.name.type.typedecl.php" } }, - "end": "([a-zA-Z0-9_]+)?\\s*(?:(?=\\{)|$)", + "end": "(;)", "endCaptures": { "1": { - "name": "entity.other.inherited-class.php" + "name": "punctuation.termination.expression.php" } }, - "name": "meta.interface.php", + "name": "meta.typedecl.php", "patterns": [ { - "include": "#namespace" + "include": "#comments" + }, + { + "include": "#generics" + }, + { + "match": "(=)", + "name": "keyword.operator.assignment.php" } ] }, @@ -967,6 +841,9 @@ "patterns": [ { "include": "#comments" + }, + { + "include": "#generics" } ] }, @@ -1002,7 +879,7 @@ }, { "begin": "(?i)\\s*(?=[a-z_0-9\\\\])", - "end": "(?xi)(?:\n \t\t\t (?:\\s*(as)\\b\\s*([a-z_0-9]*)\\s*(?=,|;|$))\n \t\t\t |(?=,|;|$)\n \t\t\t )", + "end": "(?xi)\n(?:\n (?:\\s*(as)\\b\\s*([a-z_0-9]*)\\s*(?=,|;|$))|\n (?=,|;|$)\n)", "endCaptures": { "1": { "name": "keyword.other.use-as.php" @@ -1052,6 +929,9 @@ { "include": "#comments" }, + { + "include": "#generics" + }, { "begin": "(?i)(extends)\\s+", "beginCaptures": { @@ -1258,7 +1138,7 @@ ] }, { - "begin": "(?x)\\s*\n\t\t\t\t\t ((?:(?:final|abstract|public|private|protected|static)\\s+)*)\n\t\t\t\t (function)\n\t\t\t\t (?:\\s+|(\\s*&\\s*))\n\t\t\t\t (?:\n\t\t\t\t (__(?:call|construct|destruct|get|set|isset|unset|tostring|clone|set_state|sleep|wakeup|autoload|invoke|callStatic))\n\t\t\t\t |([a-zA-Z0-9_]+)\n\t\t\t\t )\n\t\t\t\t \\s*\n\t\t\t\t (?=\\()", + "begin": "(?x)\n\\s*((?:(?:final|abstract|public|private|protected|static)\\s+)*)\n(function)\n(?:\\s+|(\\s*&\\s*))\n(?:\n (__(?:call|construct|destruct|get|set|isset|unset|tostring|clone|set_state|sleep|wakeup|autoload|invoke|callStatic))\n |\n ([a-zA-Z0-9_]+)\n)", "beginCaptures": { "1": { "patterns": [ @@ -1279,11 +1159,17 @@ }, "5": { "name": "entity.name.function.php" + }, + "6": { + "name": "meta.function.generics.php" } }, "end": "(?=[{;])", "name": "meta.function.php", "patterns": [ + { + "include": "#generics" + }, { "begin": "(\\()", "beginCaptures": { @@ -1319,8 +1205,8 @@ "include": "#invoke-call" }, { - "begin": "(?xi)\\s*(?=\n\t\t\t\t [a-z_0-9$\\\\]+(::)\n (?:\n \t\t\t\t ([a-z_][a-z_0-9]*)\\s*\\(\n \t\t\t\t |\n \t\t\t\t ((\\$+)[a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*)\n \t\t\t\t |\n \t\t\t\t ([a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*)\n \t\t\t\t)?\n\t\t\t\t )", - "end": "(?x)(::)\n (?:\n \t\t\t\t ([A-Za-z_][A-Za-z_0-9]*)\\s*\\(\n \t\t\t\t |\n \t\t\t\t ((\\$+)[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)\n \t\t\t\t |\n \t\t\t\t ([a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)\n \t\t\t\t)?", + "begin": "(?xi)\n\\s*\n (?=\n [a-z_0-9$\\\\]+(::)\n (?:\n ([a-z_][a-z_0-9]*)\\s*\\(\n |\n ((\\$+)[a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*)\n |\n ([a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*)\n )?\n )", + "end": "(?x)\n(::)\n(?:\n ([A-Za-z_][A-Za-z_0-9]*)\\s*\\(\n |\n ((\\$+)[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)\n |\n ([a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)\n)?", "endCaptures": { "1": { "name": "keyword.operator.class.php" @@ -1447,10 +1333,18 @@ "match": "(@)", "name": "keyword.operator.error-control.php" }, + { + "match": "(!==|!=|===|==)", + "name": "keyword.operator.comparison.php" + }, { "match": "=|\\+=|\\-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>=", "name": "keyword.operator.assignment.php" }, + { + "match": "(<=|>=|<>|<|>)", + "name": "keyword.operator.comparison.php" + }, { "match": "(\\-\\-|\\+\\+)", "name": "keyword.operator.increment-decrement.php" @@ -1470,10 +1364,6 @@ "match": "<<|>>|~|\\^|&|\\|", "name": "keyword.operator.bitwise.php" }, - { - "match": "(===|==|!==|!=|<=|>=|<>|<|>)", - "name": "keyword.operator.comparison.php" - }, { "begin": "(?i)\\b(instanceof)\\b\\s+(?=[\\\\$a-z_])", "beginCaptures": { @@ -1620,7 +1510,7 @@ "name": "punctuation.definition.variable.php" } }, - "match": "(?x)(->)\n \t\t\t\t(?:\n \t\t\t\t ([A-Za-z_][A-Za-z_0-9]*)\\s*\\(\n \t\t\t\t |\n \t\t\t\t ((\\$+)?[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)\n \t\t\t\t)?" + "match": "(?x)\n(->)\n (?:\n ([A-Za-z_][A-Za-z_0-9]*)\\s*\\(\n |\n ((\\$+)?[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)\n )?" } ] }, @@ -1677,7 +1567,7 @@ "include": "#instantiation" }, { - "begin": "(?xi)\\s*(?=\n\t\t\t\t [a-z_0-9\\\\]+(::)\n \t\t\t\t ([a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*)?\n\t\t\t\t )", + "begin": "(?xi)\n\\s*\n(?=\n [a-z_0-9\\\\]+(::)\n ([a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*)?\n)", "end": "(?i)(::)([a-z_\\x{7f}-\\x{ff}][a-z0-9_\\x{7f}-\\x{ff}]*)?", "endCaptures": { "1": { @@ -1746,7 +1636,7 @@ ] }, "regex-double-quoted": { - "begin": "(?x)\"/ (?= (\\\\.|[^\"/])++/[imsxeADSUXu]*\" )", + "begin": "(?x)\n\"/ (?=(\\\\.|[^\"/])++/[imsxeADSUXu]*\")", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.php" @@ -1802,7 +1692,7 @@ ] }, "regex-single-quoted": { - "begin": "(?x)'/ (?= (\\\\.|[^'/])++/[imsxeADSUXu]*' )", + "begin": "(?x)\n'/ (?=(\\\\.|[^'/])++/[imsxeADSUXu]*')", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.php" @@ -1889,12 +1779,12 @@ "name": "constant.character.escape.php" }, { - "comment": "Unclosed strings must be captured to avoid them eating the remainder of the PHP script\n\t\t\t\t\tSample case: $sql = \"SELECT * FROM bar WHERE foo = '\" . $variable . \"'\"", + "comment": "Unclosed strings must be captured to avoid them eating the remainder of the PHP script\nSample case: $sql = \"SELECT * FROM bar WHERE foo = '\" . $variable . \"'\"", "match": "'(?=((\\\\')|[^'\"])*(\"|$))", "name": "string.quoted.single.unclosed.sql" }, { - "comment": "Unclosed strings must be captured to avoid them eating the remainder of the PHP script\n\t\t\t\t\tSample case: $sql = \"SELECT * FROM bar WHERE foo = '\" . $variable . \"'\"", + "comment": "Unclosed strings must be captured to avoid them eating the remainder of the PHP script\nSample case: $sql = \"SELECT * FROM bar WHERE foo = '\" . $variable . \"'\"", "match": "`(?=((\\\\`)|[^`\"])*(\"|$))", "name": "string.quoted.other.backtick.unclosed.sql" }, @@ -1955,12 +1845,12 @@ "name": "constant.character.escape.php" }, { - "comment": "Unclosed strings must be captured to avoid them eating the remainder of the PHP script\n\t\t\t\t\tSample case: $sql = \"SELECT * FROM bar WHERE foo = '\" . $variable . \"'\"", + "comment": "Unclosed strings must be captured to avoid them eating the remainder of the PHP script\nSample case: $sql = \"SELECT * FROM bar WHERE foo = '\" . $variable . \"'\"", "match": "`(?=((\\\\`)|[^`'])*('|$))", "name": "string.quoted.other.backtick.unclosed.sql" }, { - "comment": "Unclosed strings must be captured to avoid them eating the remainder of the PHP script\n\t\t\t\t\tSample case: $sql = \"SELECT * FROM bar WHERE foo = '\" . $variable . \"'\"", + "comment": "Unclosed strings must be captured to avoid them eating the remainder of the PHP script\nSample case: $sql = \"SELECT * FROM bar WHERE foo = '\" . $variable . \"'\"", "match": "\"(?=((\\\\\")|[^\"'])*('|$))", "name": "string.quoted.double.unclosed.sql" }, @@ -2489,7 +2379,7 @@ "name": "punctuation.definition.variable.php" } }, - "match": "(?x)\n \t\t\t (\\$+)[a-zA-Z_\\x{7f}-\\x{ff}]\n \t\t\t [a-zA-Z0-9_\\x{7f}-\\x{ff}]*?\\b", + "match": "(?x)\n(\\$+)\n[a-zA-Z_\\x{7f}-\\x{ff}]\n[a-zA-Z0-9_\\x{7f}-\\x{ff}]*?\n\\b", "name": "variable.other.php" } ] @@ -2554,7 +2444,7 @@ } }, "comment": "Simple syntax: $foo, $foo[0], $foo[$bar], $foo->bar", - "match": "(?x)\n\t\t\t\t\t\t((\\$)(?[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*))\n\t\t\t\t\t\t(?:\n\t\t\t\t\t\t\t(->)(\\g)\n\t\t\t\t\t\t\t|\n\t\t\t\t\t\t\t(\\[)\n\t\t\t\t\t\t\t\t(?:(\\d+)|((\\$)\\g)|(\\w+))\n\t\t\t\t\t\t\t(\\])\n\t\t\t\t\t\t)?\n\t\t\t\t\t\t" + "match": "(?x)\n((\\$)(?[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*))\n(?:\n (->)(\\g)\n |\n (\\[)\n (?:(\\d+)|((\\$)\\g)|(\\w+))\n (\\])\n)?" }, { "captures": { @@ -2569,7 +2459,7 @@ } }, "comment": "Simple syntax with braces: \"foo${bar}baz\"", - "match": "(?x)\n\t\t\t\t\t\t((\\$\\{)(?[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)(\\}))\n\t\t\t\t\t\t" + "match": "(?x)\n((\\$\\{)(?[a-zA-Z_\\x{7f}-\\x{ff}][a-zA-Z0-9_\\x{7f}-\\x{ff}]*)(\\}))" } ] },