Added support for Web IDL (#3107)
This commit is contained in:
parent
3b2238fa8f
commit
ef53f0214c
File diff suppressed because one or more lines are too long
|
@ -1424,6 +1424,11 @@
|
|||
"title": "WebAssembly",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"web-idl": {
|
||||
"title": "Web IDL",
|
||||
"alias": "webidl",
|
||||
"owner": "RunDevelopment"
|
||||
},
|
||||
"wiki": {
|
||||
"title": "Wiki markup",
|
||||
"require": "markup",
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
(function (Prism) {
|
||||
|
||||
var id = /(?:\B-|\b_|\b)[A-Za-z][\w-]*(?![\w-])/.source;
|
||||
var type =
|
||||
'(?:' +
|
||||
/\b(?:unsigned\s+)?long\s+long(?![\w-])/.source +
|
||||
'|' +
|
||||
/\b(?:unrestricted|unsigned)\s+[a-z]+(?![\w-])/.source +
|
||||
'|' +
|
||||
/(?!(?:unrestricted|unsigned)\b)/.source + id + /(?:\s*<(?:[^<>]|<[^<>]*>)*>)?/.source +
|
||||
')' + /(?:\s*\?)?/.source;
|
||||
|
||||
var typeInside = {};
|
||||
|
||||
Prism.languages['web-idl'] = {
|
||||
'comment': {
|
||||
pattern: /\/\/.*|\/\*[\s\S]*?\*\//,
|
||||
greedy: true
|
||||
},
|
||||
'string': {
|
||||
pattern: /"[^"]*"/,
|
||||
greedy: true
|
||||
},
|
||||
|
||||
'namespace': {
|
||||
pattern: RegExp(/(\bnamespace\s+)/.source + id),
|
||||
lookbehind: true,
|
||||
},
|
||||
'class-name': [
|
||||
{
|
||||
pattern: /(^|[^\w-])(?:iterable|maplike|setlike)\s*<(?:[^<>]|<[^<>]*>)*>/,
|
||||
lookbehind: true,
|
||||
inside: typeInside
|
||||
},
|
||||
{
|
||||
pattern: RegExp(/(\b(?:attribute|const|deleter|getter|optional|setter)\s+)/.source + type),
|
||||
lookbehind: true,
|
||||
inside: typeInside
|
||||
},
|
||||
{
|
||||
// callback return type
|
||||
pattern: RegExp('(' + /\bcallback\s+/.source + id + /\s*=\s*/.source + ')' + type),
|
||||
lookbehind: true,
|
||||
inside: typeInside
|
||||
},
|
||||
{
|
||||
// typedef
|
||||
pattern: RegExp(/(\btypedef\b\s*)/.source + type),
|
||||
lookbehind: true,
|
||||
inside: typeInside
|
||||
},
|
||||
|
||||
{
|
||||
pattern: RegExp(/(\b(?:callback|dictionary|enum|interface(?:\s+mixin)?)\s+)(?!(?:interface|mixin)\b)/.source + id),
|
||||
lookbehind: true,
|
||||
},
|
||||
{
|
||||
// inheritance
|
||||
pattern: RegExp(/(:\s*)/.source + id),
|
||||
lookbehind: true,
|
||||
},
|
||||
|
||||
// includes and implements
|
||||
RegExp(id + /(?=\s+(?:implements|includes)\b)/.source),
|
||||
{
|
||||
pattern: RegExp(/(\b(?:implements|includes)\s+)/.source + id),
|
||||
lookbehind: true,
|
||||
},
|
||||
|
||||
{
|
||||
// function return type, parameter types, and dictionary members
|
||||
pattern: RegExp(type + '(?=' + /\s*(?:\.{3}\s*)?/.source + id + /\s*[(),;=]/.source + ')'),
|
||||
inside: typeInside
|
||||
},
|
||||
],
|
||||
|
||||
'builtin': /\b(?:ArrayBuffer|BigInt64Array|BigUint64Array|ByteString|DOMString|DataView|Float32Array|Float64Array|FrozenArray|Int16Array|Int32Array|Int8Array|ObservableArray|Promise|USVString|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray)\b/,
|
||||
'keyword': [
|
||||
/\b(?:async|attribute|callback|const|constructor|deleter|dictionary|enum|getter|implements|includes|inherit|interface|mixin|namespace|null|optional|or|partial|readonly|required|setter|static|stringifier|typedef|unrestricted)\b/,
|
||||
// type keywords
|
||||
/\b(?:any|bigint|boolean|byte|double|float|iterable|long|maplike|object|octet|record|sequence|setlike|short|symbol|undefined|unsigned|void)\b/
|
||||
],
|
||||
'boolean': /\b(?:false|true)\b/,
|
||||
|
||||
'number': {
|
||||
pattern: /(^|[^\w-])-?(?:0x[0-9a-f]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|NaN|Infinity)(?![\w-])/i,
|
||||
lookbehind: true
|
||||
},
|
||||
'operator': /\.{3}|[=:?<>-]/,
|
||||
'punctuation': /[(){}[\].,;]/
|
||||
};
|
||||
|
||||
for (var key in Prism.languages['web-idl']) {
|
||||
if (key !== 'class-name') {
|
||||
typeInside[key] = Prism.languages['web-idl'][key];
|
||||
}
|
||||
}
|
||||
|
||||
Prism.languages['webidl'] = Prism.languages['web-idl'];
|
||||
|
||||
}(Prism));
|
|
@ -0,0 +1 @@
|
|||
!function(e){var n="(?:\\B-|\\b_|\\b)[A-Za-z][\\w-]*(?![\\w-])",t="(?:\\b(?:unsigned\\s+)?long\\s+long(?![\\w-])|\\b(?:unrestricted|unsigned)\\s+[a-z]+(?![\\w-])|(?!(?:unrestricted|unsigned)\\b)"+n+"(?:\\s*<(?:[^<>]|<[^<>]*>)*>)?)(?:\\s*\\?)?",i={};for(var r in e.languages["web-idl"]={comment:{pattern:/\/\/.*|\/\*[\s\S]*?\*\//,greedy:!0},string:{pattern:/"[^"]*"/,greedy:!0},namespace:{pattern:RegExp("(\\bnamespace\\s+)"+n),lookbehind:!0},"class-name":[{pattern:/(^|[^\w-])(?:iterable|maplike|setlike)\s*<(?:[^<>]|<[^<>]*>)*>/,lookbehind:!0,inside:i},{pattern:RegExp("(\\b(?:attribute|const|deleter|getter|optional|setter)\\s+)"+t),lookbehind:!0,inside:i},{pattern:RegExp("(\\bcallback\\s+"+n+"\\s*=\\s*)"+t),lookbehind:!0,inside:i},{pattern:RegExp("(\\btypedef\\b\\s*)"+t),lookbehind:!0,inside:i},{pattern:RegExp("(\\b(?:callback|dictionary|enum|interface(?:\\s+mixin)?)\\s+)(?!(?:interface|mixin)\\b)"+n),lookbehind:!0},{pattern:RegExp("(:\\s*)"+n),lookbehind:!0},RegExp(n+"(?=\\s+(?:implements|includes)\\b)"),{pattern:RegExp("(\\b(?:implements|includes)\\s+)"+n),lookbehind:!0},{pattern:RegExp(t+"(?=\\s*(?:\\.{3}\\s*)?"+n+"\\s*[(),;=])"),inside:i}],builtin:/\b(?:ArrayBuffer|BigInt64Array|BigUint64Array|ByteString|DOMString|DataView|Float32Array|Float64Array|FrozenArray|Int16Array|Int32Array|Int8Array|ObservableArray|Promise|USVString|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray)\b/,keyword:[/\b(?:async|attribute|callback|const|constructor|deleter|dictionary|enum|getter|implements|includes|inherit|interface|mixin|namespace|null|optional|or|partial|readonly|required|setter|static|stringifier|typedef|unrestricted)\b/,/\b(?:any|bigint|boolean|byte|double|float|iterable|long|maplike|object|octet|record|sequence|setlike|short|symbol|undefined|unsigned|void)\b/],boolean:/\b(?:false|true)\b/,number:{pattern:/(^|[^\w-])-?(?:0x[0-9a-f]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|NaN|Infinity)(?![\w-])/i,lookbehind:!0},operator:/\.{3}|[=:?<>-]/,punctuation:/[(){}[\].,;]/},e.languages["web-idl"])"class-name"!==r&&(i[r]=e.languages["web-idl"][r]);e.languages.webidl=e.languages["web-idl"]}(Prism);
|
|
@ -0,0 +1,28 @@
|
|||
<h2>Full example</h2>
|
||||
<pre><code>[Exposed=Window]
|
||||
interface Paint { };
|
||||
|
||||
[Exposed=Window]
|
||||
interface SolidColor : Paint {
|
||||
attribute double red;
|
||||
attribute double green;
|
||||
attribute double blue;
|
||||
};
|
||||
|
||||
[Exposed=Window]
|
||||
interface Pattern : Paint {
|
||||
attribute DOMString imageURL;
|
||||
};
|
||||
|
||||
[Exposed=Window]
|
||||
interface GraphicalWindow {
|
||||
constructor();
|
||||
readonly attribute unsigned long width;
|
||||
readonly attribute unsigned long height;
|
||||
|
||||
attribute Paint currentPaint;
|
||||
|
||||
undefined drawRectangle(double x, double y, double width, double height);
|
||||
|
||||
undefined drawText(double x, double y, DOMString text);
|
||||
};</code></pre>
|
|
@ -250,6 +250,7 @@
|
|||
"url": "uri",
|
||||
"vb": "visual-basic",
|
||||
"vba": "visual-basic",
|
||||
"webidl": "web-idl",
|
||||
"mathematica": "wolfram",
|
||||
"nb": "wolfram",
|
||||
"wl": "wolfram",
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -246,6 +246,8 @@
|
|||
"vba": "VBA",
|
||||
"vb": "Visual Basic",
|
||||
"wasm": "WebAssembly",
|
||||
"web-idl": "Web IDL",
|
||||
"webidl": "Web IDL",
|
||||
"wiki": "Wiki markup",
|
||||
"wolfram": "Wolfram language",
|
||||
"nb": "Mathematica Notebook",
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,9 @@
|
|||
true
|
||||
false
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["boolean", "true"],
|
||||
["boolean", "false"]
|
||||
]
|
|
@ -0,0 +1,43 @@
|
|||
ArrayBuffer
|
||||
BigInt64Array
|
||||
BigUint64Array
|
||||
ByteString
|
||||
DOMString
|
||||
DataView
|
||||
Float32Array
|
||||
Float64Array
|
||||
FrozenArray
|
||||
Int16Array
|
||||
Int32Array
|
||||
Int8Array
|
||||
ObservableArray
|
||||
Promise
|
||||
USVString
|
||||
Uint16Array
|
||||
Uint32Array
|
||||
Uint8Array
|
||||
Uint8ClampedArray
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["builtin", "ArrayBuffer"],
|
||||
["builtin", "BigInt64Array"],
|
||||
["builtin", "BigUint64Array"],
|
||||
["builtin", "ByteString"],
|
||||
["builtin", "DOMString"],
|
||||
["builtin", "DataView"],
|
||||
["builtin", "Float32Array"],
|
||||
["builtin", "Float64Array"],
|
||||
["builtin", "FrozenArray"],
|
||||
["builtin", "Int16Array"],
|
||||
["builtin", "Int32Array"],
|
||||
["builtin", "Int8Array"],
|
||||
["builtin", "ObservableArray"],
|
||||
["builtin", "Promise"],
|
||||
["builtin", "USVString"],
|
||||
["builtin", "Uint16Array"],
|
||||
["builtin", "Uint32Array"],
|
||||
["builtin", "Uint8Array"],
|
||||
["builtin", "Uint8ClampedArray"]
|
||||
]
|
|
@ -0,0 +1,410 @@
|
|||
// names
|
||||
interface interface_identifier { /* interface_members... */ };
|
||||
partial interface interface_identifier { /* interface_members... */ };
|
||||
dictionary dictionary_identifier { /* dictionary_members... */ };
|
||||
partial dictionary dictionary_identifier { /* dictionary_members... */ };
|
||||
enum enumeration_identifier { "enum", "values" /* , ... */ };
|
||||
callback callback_identifier = return_type (/* arguments... */);
|
||||
callback interface callback_interface_identifier { /* interface_members... */ };
|
||||
|
||||
// interfaces
|
||||
|
||||
interface interface_identifier {
|
||||
return_type identifier([extended_attributes] type identifier, [extended_attributes] type identifier);
|
||||
};
|
||||
interface interface_identifier {
|
||||
return_type identifier(type... identifier);
|
||||
return_type identifier(type identifier, type... identifier);
|
||||
};
|
||||
interface SolidColor : Paint {
|
||||
constructor(double radius);
|
||||
attribute double red;
|
||||
readonly attribute unsigned long width;
|
||||
undefined drawText(double x, double y, DOMString text);
|
||||
getter DOMString (DOMString keyName);
|
||||
getter DOMString foo(DOMString keyName);
|
||||
boolean hasAddressForName(USVString name, optional LookupOptions options = {});
|
||||
const unsigned long BIT_MASK = 0x0000fc00;
|
||||
iterable<DOMString, Session>;
|
||||
};
|
||||
|
||||
// dictionary
|
||||
|
||||
dictionary identifier {
|
||||
type identifier;
|
||||
};
|
||||
dictionary identifier {
|
||||
type identifier = "value";
|
||||
};
|
||||
dictionary identifier {
|
||||
required type identifier;
|
||||
};
|
||||
dictionary B : A {
|
||||
long b;
|
||||
long a;
|
||||
};
|
||||
|
||||
// callback
|
||||
|
||||
callback AsyncOperationCallback = undefined (DOMString status);
|
||||
|
||||
// enum
|
||||
|
||||
enum MealType { "rice", "noodles", "other" };
|
||||
|
||||
// typedef
|
||||
|
||||
typedef sequence<Point> Points;
|
||||
|
||||
// includes and implements
|
||||
Foo includes Bar;
|
||||
Foo implements Bar;
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["comment", "// names"],
|
||||
|
||||
["keyword", "interface"],
|
||||
["class-name", "interface_identifier"],
|
||||
["punctuation", "{"],
|
||||
["comment", "/* interface_members... */"],
|
||||
["punctuation", "}"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "partial"],
|
||||
["keyword", "interface"],
|
||||
["class-name", "interface_identifier"],
|
||||
["punctuation", "{"],
|
||||
["comment", "/* interface_members... */"],
|
||||
["punctuation", "}"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "dictionary"],
|
||||
["class-name", "dictionary_identifier"],
|
||||
["punctuation", "{"],
|
||||
["comment", "/* dictionary_members... */"],
|
||||
["punctuation", "}"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "partial"],
|
||||
["keyword", "dictionary"],
|
||||
["class-name", "dictionary_identifier"],
|
||||
["punctuation", "{"],
|
||||
["comment", "/* dictionary_members... */"],
|
||||
["punctuation", "}"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "enum"],
|
||||
["class-name", "enumeration_identifier"],
|
||||
["punctuation", "{"],
|
||||
["string", "\"enum\""],
|
||||
["punctuation", ","],
|
||||
["string", "\"values\""],
|
||||
["comment", "/* , ... */"],
|
||||
["punctuation", "}"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "callback"],
|
||||
["class-name", "callback_identifier"],
|
||||
["operator", "="],
|
||||
["class-name", ["return_type"]],
|
||||
["punctuation", "("],
|
||||
["comment", "/* arguments... */"],
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "callback"],
|
||||
["keyword", "interface"],
|
||||
["class-name", "callback_interface_identifier"],
|
||||
["punctuation", "{"],
|
||||
["comment", "/* interface_members... */"],
|
||||
["punctuation", "}"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["comment", "// interfaces"],
|
||||
|
||||
["keyword", "interface"],
|
||||
["class-name", "interface_identifier"],
|
||||
["punctuation", "{"],
|
||||
|
||||
["class-name", ["return_type"]],
|
||||
" identifier",
|
||||
["punctuation", "("],
|
||||
["punctuation", "["],
|
||||
"extended_attributes",
|
||||
["punctuation", "]"],
|
||||
["class-name", ["type"]],
|
||||
" identifier",
|
||||
["punctuation", ","],
|
||||
["punctuation", "["],
|
||||
"extended_attributes",
|
||||
["punctuation", "]"],
|
||||
["class-name", ["type"]],
|
||||
" identifier",
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["punctuation", "}"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "interface"],
|
||||
["class-name", "interface_identifier"],
|
||||
["punctuation", "{"],
|
||||
|
||||
["class-name", ["return_type"]],
|
||||
" identifier",
|
||||
["punctuation", "("],
|
||||
["class-name", ["type"]],
|
||||
["operator", "..."],
|
||||
" identifier",
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["class-name", ["return_type"]],
|
||||
" identifier",
|
||||
["punctuation", "("],
|
||||
["class-name", ["type"]],
|
||||
" identifier",
|
||||
["punctuation", ","],
|
||||
["class-name", ["type"]],
|
||||
["operator", "..."],
|
||||
" identifier",
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["punctuation", "}"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "interface"],
|
||||
["class-name", "SolidColor"],
|
||||
["operator", ":"],
|
||||
["class-name", "Paint"],
|
||||
["punctuation", "{"],
|
||||
|
||||
["keyword", "constructor"],
|
||||
["punctuation", "("],
|
||||
["class-name", [
|
||||
["keyword", "double"]
|
||||
]],
|
||||
" radius",
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "attribute"],
|
||||
["class-name", [
|
||||
["keyword", "double"]
|
||||
]],
|
||||
" red",
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "readonly"],
|
||||
["keyword", "attribute"],
|
||||
["class-name", [
|
||||
["keyword", "unsigned"],
|
||||
["keyword", "long"]
|
||||
]],
|
||||
" width",
|
||||
["punctuation", ";"],
|
||||
|
||||
["class-name", [
|
||||
["keyword", "undefined"]
|
||||
]],
|
||||
" drawText",
|
||||
["punctuation", "("],
|
||||
["class-name", [
|
||||
["keyword", "double"]
|
||||
]],
|
||||
" x",
|
||||
["punctuation", ","],
|
||||
["class-name", [
|
||||
["keyword", "double"]
|
||||
]],
|
||||
" y",
|
||||
["punctuation", ","],
|
||||
["class-name", [
|
||||
["builtin", "DOMString"]
|
||||
]],
|
||||
" text",
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "getter"],
|
||||
["class-name", [
|
||||
["builtin", "DOMString"]
|
||||
]],
|
||||
["punctuation", "("],
|
||||
["class-name", [
|
||||
["builtin", "DOMString"]
|
||||
]],
|
||||
" keyName",
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "getter"],
|
||||
["class-name", [
|
||||
["builtin", "DOMString"]
|
||||
]],
|
||||
" foo",
|
||||
["punctuation", "("],
|
||||
["class-name", [
|
||||
["builtin", "DOMString"]
|
||||
]],
|
||||
" keyName",
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["class-name", [
|
||||
["keyword", "boolean"]
|
||||
]],
|
||||
" hasAddressForName",
|
||||
["punctuation", "("],
|
||||
["class-name", [
|
||||
["builtin", "USVString"]
|
||||
]],
|
||||
" name",
|
||||
["punctuation", ","],
|
||||
["keyword", "optional"],
|
||||
["class-name", ["LookupOptions"]],
|
||||
" options ",
|
||||
["operator", "="],
|
||||
["punctuation", "{"],
|
||||
["punctuation", "}"],
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "const"],
|
||||
["class-name", [
|
||||
["keyword", "unsigned"],
|
||||
["keyword", "long"]
|
||||
]],
|
||||
" BIT_MASK ",
|
||||
["operator", "="],
|
||||
["number", "0x0000fc00"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["class-name", [
|
||||
["keyword", "iterable"],
|
||||
["operator", "<"],
|
||||
["builtin", "DOMString"],
|
||||
["punctuation", ","],
|
||||
" Session",
|
||||
["operator", ">"]
|
||||
]],
|
||||
["punctuation", ";"],
|
||||
|
||||
["punctuation", "}"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["comment", "// dictionary"],
|
||||
|
||||
["keyword", "dictionary"],
|
||||
["class-name", "identifier"],
|
||||
["punctuation", "{"],
|
||||
|
||||
["class-name", ["type"]],
|
||||
" identifier",
|
||||
["punctuation", ";"],
|
||||
|
||||
["punctuation", "}"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "dictionary"],
|
||||
["class-name", "identifier"],
|
||||
["punctuation", "{"],
|
||||
|
||||
["class-name", ["type"]],
|
||||
" identifier ",
|
||||
["operator", "="],
|
||||
["string", "\"value\""],
|
||||
["punctuation", ";"],
|
||||
|
||||
["punctuation", "}"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "dictionary"],
|
||||
["class-name", "identifier"],
|
||||
["punctuation", "{"],
|
||||
|
||||
["keyword", "required"],
|
||||
["class-name", ["type"]],
|
||||
" identifier",
|
||||
["punctuation", ";"],
|
||||
|
||||
["punctuation", "}"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "dictionary"],
|
||||
["class-name", "B"],
|
||||
["operator", ":"],
|
||||
["class-name", "A"],
|
||||
["punctuation", "{"],
|
||||
|
||||
["class-name", [
|
||||
["keyword", "long"]
|
||||
]],
|
||||
" b",
|
||||
["punctuation", ";"],
|
||||
|
||||
["class-name", [
|
||||
["keyword", "long"]
|
||||
]],
|
||||
" a",
|
||||
["punctuation", ";"],
|
||||
|
||||
["punctuation", "}"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["comment", "// callback"],
|
||||
|
||||
["keyword", "callback"],
|
||||
["class-name", "AsyncOperationCallback"],
|
||||
["operator", "="],
|
||||
["class-name", [
|
||||
["keyword", "undefined"]
|
||||
]],
|
||||
["punctuation", "("],
|
||||
["class-name", [
|
||||
["builtin", "DOMString"]
|
||||
]],
|
||||
" status",
|
||||
["punctuation", ")"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["comment", "// enum"],
|
||||
|
||||
["keyword", "enum"],
|
||||
["class-name", "MealType"],
|
||||
["punctuation", "{"],
|
||||
["string", "\"rice\""],
|
||||
["punctuation", ","],
|
||||
["string", "\"noodles\""],
|
||||
["punctuation", ","],
|
||||
["string", "\"other\""],
|
||||
["punctuation", "}"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["comment", "// typedef"],
|
||||
|
||||
["keyword", "typedef"],
|
||||
["class-name", [
|
||||
["keyword", "sequence"],
|
||||
["operator", "<"],
|
||||
"Point",
|
||||
["operator", ">"]
|
||||
]],
|
||||
" Points",
|
||||
["punctuation", ";"],
|
||||
|
||||
["comment", "// includes and implements"],
|
||||
|
||||
["class-name", "Foo"],
|
||||
["keyword", "includes"],
|
||||
["class-name", "Bar"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["class-name", "Foo"],
|
||||
["keyword", "implements"],
|
||||
["class-name", "Bar"],
|
||||
["punctuation", ";"]
|
||||
]
|
|
@ -0,0 +1,9 @@
|
|||
// comment
|
||||
/* comment */
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["comment", "// comment"],
|
||||
["comment", "/* comment */"]
|
||||
]
|
|
@ -0,0 +1,55 @@
|
|||
async;
|
||||
attribute;
|
||||
callback;
|
||||
const;
|
||||
constructor;
|
||||
deleter;
|
||||
dictionary;
|
||||
enum;
|
||||
getter;
|
||||
includes;
|
||||
inherit;
|
||||
interface;
|
||||
mixin;
|
||||
namespace;
|
||||
null;
|
||||
optional;
|
||||
or;
|
||||
partial;
|
||||
readonly;
|
||||
required;
|
||||
setter;
|
||||
static;
|
||||
stringifier;
|
||||
typedef;
|
||||
unrestricted;
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["keyword", "async"], ["punctuation", ";"],
|
||||
["keyword", "attribute"], ["punctuation", ";"],
|
||||
["keyword", "callback"], ["punctuation", ";"],
|
||||
["keyword", "const"], ["punctuation", ";"],
|
||||
["keyword", "constructor"], ["punctuation", ";"],
|
||||
["keyword", "deleter"], ["punctuation", ";"],
|
||||
["keyword", "dictionary"], ["punctuation", ";"],
|
||||
["keyword", "enum"], ["punctuation", ";"],
|
||||
["keyword", "getter"], ["punctuation", ";"],
|
||||
["keyword", "includes"], ["punctuation", ";"],
|
||||
["keyword", "inherit"], ["punctuation", ";"],
|
||||
["keyword", "interface"], ["punctuation", ";"],
|
||||
["keyword", "mixin"], ["punctuation", ";"],
|
||||
["keyword", "namespace"], ["punctuation", ";"],
|
||||
["keyword", "null"], ["punctuation", ";"],
|
||||
["keyword", "optional"], ["punctuation", ";"],
|
||||
["keyword", "or"], ["punctuation", ";"],
|
||||
["keyword", "partial"], ["punctuation", ";"],
|
||||
["keyword", "readonly"], ["punctuation", ";"],
|
||||
["keyword", "required"], ["punctuation", ";"],
|
||||
["keyword", "setter"], ["punctuation", ";"],
|
||||
["keyword", "static"], ["punctuation", ";"],
|
||||
["keyword", "stringifier"], ["punctuation", ";"],
|
||||
["keyword", "typedef"], ["punctuation", ";"],
|
||||
["keyword", "unrestricted"], ["punctuation", ";"]
|
||||
]
|
|
@ -0,0 +1,30 @@
|
|||
namespace SomeNamespace {
|
||||
/* namespace_members... */
|
||||
};
|
||||
|
||||
partial namespace SomeNamespace {
|
||||
/* namespace_members... */
|
||||
};
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["keyword", "namespace"],
|
||||
["namespace", "SomeNamespace"],
|
||||
["punctuation", "{"],
|
||||
|
||||
["comment", "/* namespace_members... */"],
|
||||
|
||||
["punctuation", "}"],
|
||||
["punctuation", ";"],
|
||||
|
||||
["keyword", "partial"],
|
||||
["keyword", "namespace"],
|
||||
["namespace", "SomeNamespace"],
|
||||
["punctuation", "{"],
|
||||
|
||||
["comment", "/* namespace_members... */"],
|
||||
|
||||
["punctuation", "}"],
|
||||
["punctuation", ";"]
|
||||
]
|
|
@ -0,0 +1,29 @@
|
|||
0xfff
|
||||
123423
|
||||
-123423
|
||||
|
||||
123.456
|
||||
123.e64
|
||||
123.324e-4
|
||||
.324e+4
|
||||
|
||||
NaN
|
||||
Infinity
|
||||
-Infinity
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["number", "0xfff"],
|
||||
["number", "123423"],
|
||||
["number", "-123423"],
|
||||
|
||||
["number", "123.456"],
|
||||
["number", "123.e64"],
|
||||
["number", "123.324e-4"],
|
||||
["number", ".324e+4"],
|
||||
|
||||
["number", "NaN"],
|
||||
["number", "Infinity"],
|
||||
["number", "-Infinity"]
|
||||
]
|
|
@ -0,0 +1,14 @@
|
|||
...
|
||||
= : ? < >
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["operator", "..."],
|
||||
|
||||
["operator", "="],
|
||||
["operator", ":"],
|
||||
["operator", "?"],
|
||||
["operator", "<"],
|
||||
["operator", ">"]
|
||||
]
|
|
@ -0,0 +1,43 @@
|
|||
any
|
||||
bigint
|
||||
boolean
|
||||
byte
|
||||
double
|
||||
float
|
||||
iterable
|
||||
long
|
||||
maplike
|
||||
object
|
||||
octet
|
||||
record
|
||||
sequence
|
||||
setlike
|
||||
short
|
||||
symbol
|
||||
undefined
|
||||
unsigned
|
||||
void
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["keyword", "any"],
|
||||
["keyword", "bigint"],
|
||||
["keyword", "boolean"],
|
||||
["keyword", "byte"],
|
||||
["keyword", "double"],
|
||||
["keyword", "float"],
|
||||
["keyword", "iterable"],
|
||||
["keyword", "long"],
|
||||
["keyword", "maplike"],
|
||||
["keyword", "object"],
|
||||
["keyword", "octet"],
|
||||
["keyword", "record"],
|
||||
["keyword", "sequence"],
|
||||
["keyword", "setlike"],
|
||||
["keyword", "short"],
|
||||
["keyword", "symbol"],
|
||||
["keyword", "undefined"],
|
||||
["keyword", "unsigned"],
|
||||
["keyword", "void"]
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
( ) [ ] { }
|
||||
. , ;
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["punctuation", "("],
|
||||
["punctuation", ")"],
|
||||
["punctuation", "["],
|
||||
["punctuation", "]"],
|
||||
["punctuation", "{"],
|
||||
["punctuation", "}"],
|
||||
|
||||
["punctuation", "."],
|
||||
["punctuation", ","],
|
||||
["punctuation", ";"]
|
||||
]
|
|
@ -0,0 +1,11 @@
|
|||
""
|
||||
"foo"
|
||||
"\"
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["string", "\"\""],
|
||||
["string", "\"foo\""],
|
||||
["string", "\"\\\""]
|
||||
]
|
Loading…
Reference in New Issue