use prism-tomorrow.css
This commit is contained in:
@ -0,0 +1,13 @@
|
||||
true
|
||||
false
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["boolean", "true"],
|
||||
["boolean", "false"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for booleans.
|
@ -0,0 +1,59 @@
|
||||
class Test {
|
||||
foo( x, y = 0) {}
|
||||
async bar(x, y = 0 ) {}
|
||||
$ ( ) {}
|
||||
awaitFoo(){}
|
||||
}
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["keyword", "class"],
|
||||
["class-name", ["Test"]],
|
||||
["punctuation", "{"],
|
||||
|
||||
["function", "foo"],
|
||||
["punctuation", "("],
|
||||
["parameter", [
|
||||
"x",
|
||||
["punctuation", ","],
|
||||
" y ",
|
||||
["operator", "="],
|
||||
["number", "0"]
|
||||
]],
|
||||
["punctuation", ")"],
|
||||
["punctuation", "{"],
|
||||
["punctuation", "}"],
|
||||
|
||||
["keyword", "async"],
|
||||
["function", "bar"],
|
||||
["punctuation", "("],
|
||||
["parameter", [
|
||||
"x",
|
||||
["punctuation", ","],
|
||||
" y ",
|
||||
["operator", "="],
|
||||
["number", "0"]
|
||||
]],
|
||||
["punctuation", ")"],
|
||||
["punctuation", "{"],
|
||||
["punctuation", "}"],
|
||||
|
||||
["function", "$"],
|
||||
["punctuation", "("],
|
||||
["punctuation", ")"],
|
||||
["punctuation", "{"],
|
||||
["punctuation", "}"],
|
||||
|
||||
["function", "awaitFoo"],
|
||||
["punctuation", "("],
|
||||
["punctuation", ")"],
|
||||
["punctuation", "{"],
|
||||
["punctuation", "}"],
|
||||
|
||||
["punctuation", "}"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for class methods.
|
@ -0,0 +1,21 @@
|
||||
var FOO;
|
||||
const FOO_BAR;
|
||||
const BAZ42;
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["keyword", "var"],
|
||||
["constant", "FOO"],
|
||||
["punctuation", ";"],
|
||||
["keyword", "const"],
|
||||
["constant", "FOO_BAR"],
|
||||
["punctuation", ";"],
|
||||
["keyword", "const"],
|
||||
["constant", "BAZ42"],
|
||||
["punctuation", ";"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for constants.
|
@ -0,0 +1,104 @@
|
||||
foo = function ( x, y) {}
|
||||
{foo: function () {}}
|
||||
bar = async function baz (x ) {}
|
||||
baz = async(x) => x
|
||||
fooBar = x => x
|
||||
fooBar = ( x, y ) => x
|
||||
ಠ_ಠ = () => {}
|
||||
Ƞȡ_҇ = async (ಠ, Ƞ = 2) => {}
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["function-variable", "foo"],
|
||||
["operator", "="],
|
||||
["keyword", "function"],
|
||||
["punctuation", "("],
|
||||
["parameter", [
|
||||
"x",
|
||||
["punctuation", ","],
|
||||
" y"
|
||||
]],
|
||||
["punctuation", ")"],
|
||||
["punctuation", "{"],
|
||||
["punctuation", "}"],
|
||||
|
||||
["punctuation", "{"],
|
||||
["function-variable", "foo"],
|
||||
["punctuation", ":"],
|
||||
["keyword", "function"],
|
||||
["punctuation", "("],
|
||||
["punctuation", ")"],
|
||||
["punctuation", "{"],
|
||||
["punctuation","}"],
|
||||
["punctuation","}"],
|
||||
|
||||
["function-variable", "bar"],
|
||||
["operator", "="],
|
||||
["keyword", "async"],
|
||||
["keyword", "function"],
|
||||
["function", "baz"],
|
||||
["punctuation", "("],
|
||||
["parameter", [
|
||||
"x"
|
||||
]],
|
||||
["punctuation", ")"],
|
||||
["punctuation", "{"],
|
||||
["punctuation", "}"],
|
||||
|
||||
["function-variable", "baz"],
|
||||
["operator", "="],
|
||||
["keyword", "async"],
|
||||
["punctuation", "("],
|
||||
["parameter", [
|
||||
"x"
|
||||
]],
|
||||
["punctuation", ")"],
|
||||
["operator", "=>"], " x\r\n",
|
||||
|
||||
["function-variable", "fooBar"],
|
||||
["operator", "="],
|
||||
["parameter", [
|
||||
"x"
|
||||
]],
|
||||
["operator", "=>"], " x\r\n",
|
||||
|
||||
["function-variable", "fooBar"],
|
||||
["operator", "="],
|
||||
["punctuation", "("],
|
||||
["parameter", [
|
||||
"x",
|
||||
["punctuation", ","],
|
||||
" y"
|
||||
]],
|
||||
["punctuation", ")"],
|
||||
["operator", "=>"], " x\r\n",
|
||||
|
||||
["function-variable", "ಠ_ಠ"],
|
||||
["operator", "="],
|
||||
["punctuation", "("],
|
||||
["punctuation", ")"],
|
||||
["operator", "=>"],
|
||||
["punctuation", "{"],
|
||||
["punctuation", "}"],
|
||||
|
||||
["function-variable", "Ƞȡ_҇"],
|
||||
["operator", "="],
|
||||
["keyword", "async"],
|
||||
["punctuation", "("],
|
||||
["parameter", [
|
||||
"ಠ",
|
||||
["punctuation", ","],
|
||||
" Ƞ ",
|
||||
["operator", "="],
|
||||
["number", "2"]
|
||||
]],
|
||||
["punctuation", ")"],
|
||||
["operator", "=>"],
|
||||
["punctuation", "{"],
|
||||
["punctuation", "}"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for variables obviously containing functions.
|
@ -0,0 +1,29 @@
|
||||
foo()
|
||||
foo ()
|
||||
foo_bar()
|
||||
foo_bar ( )
|
||||
f42()
|
||||
_()
|
||||
$()
|
||||
ಠ_ಠ()
|
||||
Ƞȡ_҇()
|
||||
if(notAFunction)
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["function", "foo"], ["punctuation", "("], ["punctuation", ")"],
|
||||
["function", "foo"], ["punctuation", "("], ["punctuation", ")"],
|
||||
["function", "foo_bar"], ["punctuation", "("], ["punctuation", ")"],
|
||||
["function", "foo_bar"], ["punctuation", "("], ["punctuation", ")"],
|
||||
["function", "f42"], ["punctuation", "("], ["punctuation", ")"],
|
||||
["function", "_"], ["punctuation", "("], ["punctuation", ")"],
|
||||
["function", "$"], ["punctuation", "("], ["punctuation", ")"],
|
||||
["function", "ಠ_ಠ"], ["punctuation", "("], ["punctuation", ")"],
|
||||
["function", "Ƞȡ_҇"], ["punctuation", "("], ["punctuation", ")"],
|
||||
["keyword", "if"], ["punctuation", "("], "notAFunction", ["punctuation", ")"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for functions. Also checks for unicode characters in identifiers.
|
@ -0,0 +1,11 @@
|
||||
// gulp.watch('./src/**/*.js', ['move']);
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["comment", "// gulp.watch('./src/**/*.js', ['move']);"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for multi-line comment inside single-line comment. See #1337
|
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* ([{}])
|
||||
* // <= double slash comment
|
||||
* ([{}]) <= punctuation
|
||||
*/
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["comment", "/*\r\n * ([{}])\r\n * // <= double slash comment\r\n * ([{}]) <= punctuation\r\n */"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for single-line comment inside multi-line comment. See #1340
|
@ -0,0 +1,21 @@
|
||||
`${`a string`}`
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["template-string", [
|
||||
["string", "`"],
|
||||
["interpolation", [
|
||||
["interpolation-punctuation", "${"],
|
||||
["template-string", [
|
||||
["string", "`a string`"]
|
||||
]],
|
||||
["interpolation-punctuation", "}"]
|
||||
]],
|
||||
["string", "`"]
|
||||
]]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for nested template strings. See #1397
|
@ -0,0 +1,35 @@
|
||||
fetch('some-resource.json')
|
||||
.then(response => response.json())
|
||||
.catch(console.error);
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["function", "fetch"],
|
||||
["punctuation", "("],
|
||||
["string", "'some-resource.json'"],
|
||||
["punctuation", ")"],
|
||||
["punctuation", "."],
|
||||
["function", "then"],
|
||||
["punctuation", "("],
|
||||
["parameter", ["response"]],
|
||||
["operator", "=>"],
|
||||
" response",
|
||||
["punctuation", "."],
|
||||
["function", "json"],
|
||||
["punctuation", "("],
|
||||
["punctuation", ")"],
|
||||
["punctuation", ")"],
|
||||
["punctuation", "."],
|
||||
["function", "catch"],
|
||||
["punctuation", "("],
|
||||
"console",
|
||||
["punctuation", "."],
|
||||
"error",
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for catch function which is not a keyword. See #1526
|
@ -0,0 +1,73 @@
|
||||
catch finally;
|
||||
|
||||
as; async; await; break; case;
|
||||
class; const; continue; debugger;
|
||||
default; delete; do; else; enum;
|
||||
export; extends; for;
|
||||
from; function; get; if; implements;
|
||||
import; in; instanceof; interface; let;
|
||||
new; null; of; package; private;
|
||||
protected; public; return; set; static;
|
||||
super; switch; this; throw; try;
|
||||
typeof; var; void; while;
|
||||
with; yield;
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["keyword", "catch"],
|
||||
["keyword", "finally"], ["punctuation", ";"],
|
||||
|
||||
["keyword", "as"], ["punctuation", ";"],
|
||||
["keyword", "async"], ["punctuation", ";"],
|
||||
["keyword", "await"], ["punctuation", ";"],
|
||||
["keyword", "break"], ["punctuation", ";"],
|
||||
["keyword", "case"], ["punctuation", ";"],
|
||||
["keyword", "class"], ["punctuation", ";"],
|
||||
["keyword", "const"], ["punctuation", ";"],
|
||||
["keyword", "continue"], ["punctuation", ";"],
|
||||
["keyword", "debugger"], ["punctuation", ";"],
|
||||
["keyword", "default"], ["punctuation", ";"],
|
||||
["keyword", "delete"], ["punctuation", ";"],
|
||||
["keyword", "do"], ["punctuation", ";"],
|
||||
["keyword", "else"], ["punctuation", ";"],
|
||||
["keyword", "enum"], ["punctuation", ";"],
|
||||
["keyword", "export"], ["punctuation", ";"],
|
||||
["keyword", "extends"], ["punctuation", ";"],
|
||||
["keyword", "for"], ["punctuation", ";"],
|
||||
["keyword", "from"], ["punctuation", ";"],
|
||||
["keyword", "function"], ["punctuation", ";"],
|
||||
["keyword", "get"], ["punctuation", ";"],
|
||||
["keyword", "if"], ["punctuation", ";"],
|
||||
["keyword", "implements"], ["punctuation", ";"],
|
||||
["keyword", "import"], ["punctuation", ";"],
|
||||
["keyword", "in"], ["punctuation", ";"],
|
||||
["keyword", "instanceof"], ["punctuation", ";"],
|
||||
["keyword", "interface"], ["punctuation", ";"],
|
||||
["keyword", "let"], ["punctuation", ";"],
|
||||
["keyword", "new"], ["punctuation", ";"],
|
||||
["keyword", "null"], ["punctuation", ";"],
|
||||
["keyword", "of"], ["punctuation", ";"],
|
||||
["keyword", "package"], ["punctuation", ";"],
|
||||
["keyword", "private"], ["punctuation", ";"],
|
||||
["keyword", "protected"], ["punctuation", ";"],
|
||||
["keyword", "public"], ["punctuation", ";"],
|
||||
["keyword", "return"], ["punctuation", ";"],
|
||||
["keyword", "set"], ["punctuation", ";"],
|
||||
["keyword", "static"], ["punctuation", ";"],
|
||||
["keyword", "super"], ["punctuation", ";"],
|
||||
["keyword", "switch"], ["punctuation", ";"],
|
||||
["keyword", "this"], ["punctuation", ";"],
|
||||
["keyword", "throw"], ["punctuation", ";"],
|
||||
["keyword", "try"], ["punctuation", ";"],
|
||||
["keyword", "typeof"], ["punctuation", ";"],
|
||||
["keyword", "var"], ["punctuation", ";"],
|
||||
["keyword", "void"], ["punctuation", ";"],
|
||||
["keyword", "while"], ["punctuation", ";"],
|
||||
["keyword", "with"], ["punctuation", ";"],
|
||||
["keyword", "yield"], ["punctuation", ";"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for all keywords.
|
@ -0,0 +1,36 @@
|
||||
42
|
||||
3.14159
|
||||
4e10
|
||||
3.2E+6
|
||||
2.1e-10
|
||||
0b1101
|
||||
0o571
|
||||
0xbabe
|
||||
0xBABE
|
||||
NaN
|
||||
Infinity
|
||||
123n
|
||||
0x123n
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["number", "42"],
|
||||
["number", "3.14159"],
|
||||
["number", "4e10"],
|
||||
["number", "3.2E+6"],
|
||||
["number", "2.1e-10"],
|
||||
["number", "0b1101"],
|
||||
["number", "0o571"],
|
||||
["number", "0xbabe"],
|
||||
["number", "0xBABE"],
|
||||
["number", "NaN"],
|
||||
["number", "Infinity"],
|
||||
["number", "123n"],
|
||||
["number", "0x123n"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for decimal numbers, binary numbers, octal numbers, hexadecimal numbers.
|
||||
Also checks for keywords representing numbers.
|
@ -0,0 +1,33 @@
|
||||
- -- -=
|
||||
+ ++ +=
|
||||
< <= << <<=
|
||||
> >= >> >>= >>> >>>=
|
||||
= == === =>
|
||||
! != !==
|
||||
& && &=
|
||||
| || |=
|
||||
* ** *= **=
|
||||
/ /= ~
|
||||
^ ^= % %=
|
||||
? ...
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["operator", "-"], ["operator", "--"], ["operator", "-="],
|
||||
["operator", "+"], ["operator", "++"], ["operator", "+="],
|
||||
["operator", "<"], ["operator", "<="], ["operator", "<<"], ["operator", "<<="],
|
||||
["operator", ">"], ["operator", ">="], ["operator", ">>"], ["operator", ">>="], ["operator", ">>>"], ["operator", ">>>="],
|
||||
["operator", "="], ["operator", "=="], ["operator", "==="], ["operator", "=>"],
|
||||
["operator", "!"], ["operator", "!="], ["operator", "!=="],
|
||||
["operator", "&"], ["operator", "&&"], ["operator", "&="],
|
||||
["operator", "|"], ["operator", "||"], ["operator", "|="],
|
||||
["operator", "*"], ["operator", "**"], ["operator", "*="], ["operator", "**="],
|
||||
["operator", "/"], ["operator", "/="], ["operator", "~"],
|
||||
["operator", "^"], ["operator", "^="], ["operator", "%"], ["operator", "%="],
|
||||
["operator", "?"], ["operator", "..."]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for all operators.
|
@ -0,0 +1,29 @@
|
||||
/foo bar/;
|
||||
/foo/gimyu,
|
||||
/[\[\]]{2,4}(?:foo)*/;
|
||||
/foo"test"bar/;
|
||||
/foo\//;
|
||||
/[]/;
|
||||
/[\]/]/;
|
||||
1 / 4 + "/, not a regex";
|
||||
/ '1' '2' '3' '4' '5' /
|
||||
[/foo/]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["regex", "/foo bar/"], ["punctuation", ";"],
|
||||
["regex", "/foo/gimyu"], ["punctuation", ","],
|
||||
["regex", "/[\\[\\]]{2,4}(?:foo)*/"], ["punctuation", ";"],
|
||||
["regex", "/foo\"test\"bar/"], ["punctuation", ";"],
|
||||
["regex", "/foo\\//"], ["punctuation", ";"],
|
||||
["regex", "/[]/"], ["punctuation", ";"],
|
||||
["regex", "/[\\]/]/"], ["punctuation", ";"],
|
||||
["number", "1"], ["operator", "/"], ["number", "4"], ["operator", "+"], ["string", "\"/, not a regex\""], ["punctuation", ";"],
|
||||
["regex", "/ '1' '2' '3' '4' '5' /"],
|
||||
["punctuation", "["], ["regex", "/foo/"], ["punctuation", "]"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for regex.
|
@ -0,0 +1,30 @@
|
||||
Foo.prototype.bar;
|
||||
Bar.constructor;
|
||||
fooBar.prototype.bar;
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["class-name", "Foo"],
|
||||
["punctuation", "."],
|
||||
"prototype",
|
||||
["punctuation", "."],
|
||||
"bar",
|
||||
["punctuation", ";"],
|
||||
|
||||
["class-name", "Bar"],
|
||||
["punctuation", "."],
|
||||
"constructor",
|
||||
["punctuation", ";"],
|
||||
|
||||
"\nfooBar",
|
||||
["punctuation", "."],
|
||||
"prototype",
|
||||
["punctuation", "."],
|
||||
"bar",
|
||||
["punctuation", ";"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for supposed function variables based on standard function invocations or modifications.
|
@ -0,0 +1,38 @@
|
||||
foo.apply(thisArg, args);
|
||||
bar.call(...args);
|
||||
fooBar.bind(thisArg);
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["function", "foo"],
|
||||
["punctuation", "."],
|
||||
["function", "apply"],
|
||||
["punctuation", "("],
|
||||
"thisArg",
|
||||
["punctuation", ","],
|
||||
" args",
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["function", "bar"],
|
||||
["punctuation", "."],
|
||||
["function", "call"],
|
||||
["punctuation", "("],
|
||||
["operator", "..."],
|
||||
"args",
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["function", "fooBar"],
|
||||
["punctuation", "."],
|
||||
["function", "bind"],
|
||||
["punctuation", "("],
|
||||
"thisArg",
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for supposed function variables based on standard function invocations or modifications.
|
@ -0,0 +1,49 @@
|
||||
`foo bar`
|
||||
`foo
|
||||
bar`
|
||||
`40+2=${40+2}`
|
||||
`${foo()}`
|
||||
"foo `a` `b` `c` `d` bar"
|
||||
"test // test" `template`
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["template-string", [
|
||||
["string", "`foo bar`"]
|
||||
]],
|
||||
["template-string", [
|
||||
["string", "`foo\r\nbar`"]
|
||||
]],
|
||||
["template-string", [
|
||||
["string", "`40+2="],
|
||||
["interpolation", [
|
||||
["interpolation-punctuation", "${"],
|
||||
["number", "40"],
|
||||
["operator", "+"],
|
||||
["number", "2"],
|
||||
["interpolation-punctuation", "}"]
|
||||
]],
|
||||
["string", "`"]
|
||||
]],
|
||||
["template-string", [
|
||||
["string", "`"],
|
||||
["interpolation", [
|
||||
["interpolation-punctuation", "${"],
|
||||
["function", "foo"],
|
||||
["punctuation", "("],
|
||||
["punctuation", ")"],
|
||||
["interpolation-punctuation", "}"]
|
||||
]],
|
||||
["string", "`"]
|
||||
]],
|
||||
["string", "\"foo `a` `b` `c` `d` bar\""],
|
||||
["string", "\"test // test\""],
|
||||
["template-string", [
|
||||
["string", "`template`"]
|
||||
]]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for single-line and multi-line template strings.
|
@ -0,0 +1,22 @@
|
||||
try { } catch (e) { } finally { }
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["keyword", "try"],
|
||||
["punctuation", "{"],
|
||||
["punctuation", "}"],
|
||||
["keyword", "catch"],
|
||||
["punctuation", "("],
|
||||
"e",
|
||||
["punctuation", ")"],
|
||||
["punctuation", "{"],
|
||||
["punctuation", "}"],
|
||||
["keyword", "finally"],
|
||||
["punctuation", "{"],
|
||||
["punctuation", "}"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Checks for try statements.
|
Reference in New Issue
Block a user