remove dependent lib code

This commit is contained in:
Tan, Kian-ting 2024-03-29 20:49:26 +08:00
parent 9c1bc24fc6
commit 83f67728ff
155 changed files with 0 additions and 638294 deletions

1
node_modules/.bin/tsc generated vendored
View file

@ -1 +0,0 @@
../typescript/bin/tsc

1
node_modules/.bin/tsserver generated vendored
View file

@ -1 +0,0 @@
../typescript/bin/tsserver

42
node_modules/.package-lock.json generated vendored
View file

@ -1,42 +0,0 @@
{
"name": "anothertypesetter",
"version": "0.0.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"node_modules/@lahmatiy/jison": {
"version": "0.4.18-remastered.7",
"resolved": "https://registry.npmjs.org/@lahmatiy/jison/-/jison-0.4.18-remastered.7.tgz",
"integrity": "sha512-eQdaFwBKwGNStpq+AxTlse4TKbPLpht/phbpXXNkF8YAncLLLmXYu78FaKdFOmTjB8MPHJvGYft4PUmoJdN9/Q==",
"dependencies": {
"ebnf-parser": "0.1.10",
"lex-parser": "~0.1.3"
},
"engines": {
"node": ">=10.10"
}
},
"node_modules/ebnf-parser": {
"version": "0.1.10",
"resolved": "https://registry.npmjs.org/ebnf-parser/-/ebnf-parser-0.1.10.tgz",
"integrity": "sha512-urvSxVQ6XJcoTpc+/x2pWhhuOX4aljCNQpwzw+ifZvV1andZkAmiJc3Rq1oGEAQmcjiLceyMXOy1l8ms8qs2fQ=="
},
"node_modules/lex-parser": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/lex-parser/-/lex-parser-0.1.4.tgz",
"integrity": "sha512-DuAEISsr1H4LOpmFLkyMc8YStiRWZCO8hMsoXAXSbgyfvs2WQhSt0+/FBv3ZU/JBFZMGcE+FWzEBSzwUU7U27w=="
},
"node_modules/typescript": {
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz",
"integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
}
}
}

View file

@ -1,130 +0,0 @@
Jison (remastered)
==================
[![NPM version](https://img.shields.io/npm/v/@lahmatiy/jison.svg)](https://www.npmjs.com/package/@lahmatiy/jison)
[![Build Status](https://github.com/lahmatiy/jison/actions/workflows/build.yml/badge.svg)](https://github.com/lahmatiy/jison/actions/workflows/build.yml)
This is a fork of [Jison](http://github.com/zaach/jison) parser generator by [Zach Carter](http://github.com/zaach/).
The difference:
- Removed web site sources
- Removed CLI & bundling. Those things may back in the future but in a brand new way
- Removed generator methods except `generateModule`
- Refactored to use ES6+ features, remove redundant abstractions, minor bug fixes
- Features:
- Added support for function patterns in lexer
- Added `packTable` option for parser `generateModule()` method (`parser.generateModule("esm", { packTable: "advanced" })`), to employ a more sophisticated approach for packing BNF table, this is useful for large tables to reduce tens of kilobytes down to just a few kilobytes
-------------
An API for creating parsers in JavaScript
-----------------------------------------
Jison generates bottom-up parsers in JavaScript. Its API is similar to Bison's, hence the name. It supports many of Bison's major features, plus some of its own. If you are new to parser generators such as Bison, and Context-free Grammars in general, a [good introduction][1] is found in the Bison manual. If you already know Bison, Jison should be easy to pickup.
Briefly, Jison takes a JSON encoded grammar or Bison style grammar and outputs a JavaScript file capable of parsing the language described by that grammar. You can then use the generated script to parse inputs and accept, reject, or perform actions based on the input.
## Installation
```
npm install @lahmatiy/jison
```
## Usage
```javascript
// mygenerator.js
const { Parser } = require('jison');
// a grammar in JSON
const grammar = {
lex: {
rules: [
['\\s+', '/* skip whitespace */'],
['[a-f0-9]+', 'return "HEX";']
]
},
bnf: {
hex_strings: [
'hex_strings HEX', 'HEX'
]
}
};
// `grammar` can also be a string that uses jison's grammar format
const parser = new Parser(grammar);
// now you can use the parser directly from memory
// returns true
parser.parse("adfe34bc e82a");
// throws lexical error
parser.parse("adfe34bc zxg");
// ... or generate source code of parser
const parserSource = parser.generateModule();
```
More Documentation
------------------
For more information on creating grammars and using the generated parsers, read the [documentation](http://jison.org/docs).
How to contribute
-----------------
See [CONTRIBUTING.md](https://github.com/zaach/jison/blob/master/CONTRIBUTING.md) for contribution guidelines, how to run the tests, etc.
Projects using Jison
------------------
View them on the [wiki](https://github.com/zaach/jison/wiki/ProjectsUsingJison), or add your own.
Contributors
------------
[Githubbers](http://github.com/zaach/jison/contributors)
Special thanks to Jarred Ligatti, Manuel E. Bermúdez
## License
> Copyright (c) 2009-2014 Zachary Carter
>
> Permission is hereby granted, free of
> charge, to any person obtaining a
> copy of this software and associated
> documentation files (the "Software"),
> to deal in the Software without
> restriction, including without
> limitation the rights to use, copy,
> modify, merge, publish, distribute,
> sublicense, and/or sell copies of the
> Software, and to permit persons to
> whom the Software is furnished to do
> so, subject to the following
> conditions:
>
> The above copyright notice and this
> permission notice shall be included
> in all copies or substantial portions
> of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS",
> WITHOUT WARRANTY OF ANY KIND, EXPRESS
> OR IMPLIED, INCLUDING BUT NOT LIMITED
> TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND
> NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE
> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF
> CONTRACT, TORT OR OTHERWISE, ARISING
> FROM, OUT OF OR IN CONNECTION WITH THE
> SOFTWARE OR THE USE OR OTHER DEALINGS
> IN THE SOFTWARE.
[1]: http://dinosaur.compilertools.net/bison/bison_4.html

File diff suppressed because it is too large Load diff

View file

@ -1,458 +0,0 @@
const { version } = require('../../package.json');
const { fnBody } = require('../utils');
module.exports = {
generateModuleBody,
generateModule
};
function generatePerformAction({ rules, tokens, actionInclude }) {
const code = [
'(yy,yy_,__lexelActionId,YY_START) {',
actionInclude || '',
'const YYSTATE=YY_START;'
];
const tokenNameToIndex = Object.create(null);
let hasTokens = false;
for (const key in tokens) {
tokenNameToIndex[tokens[key]] = key;
hasTokens = true;
}
code.push('switch (__lexelActionId) {');
rules.forEach((rule, i) => {
let action = typeof rule[1] === 'function'
? fnBody(rule[1])
: rule[1];
if (hasTokens) {
action = action.replace(/\breturn\s+('[^']+?'|"[^"]+?")/g, (m, s) =>
'return ' + (tokenNameToIndex[s.slice(1, -1)] || s)
);
}
code.push('case ' + i + ':{' +
action.replace(/\b(yytext|yyleng|yylineno|yylloc)\b/g, 'yy_.$1') +
'\nbreak;}');
});
code.push('}', '}');
return code.join('\n');
}
function generateModuleBody(opt) {
const options = opt.options || {};
const out = [
'yy:{}',
'options: ' + JSON.stringify(options),
'rules: [' + opt.patterns + ']',
'conditions: ' + JSON.stringify(opt.conditions),
'performAction' + generatePerformAction(opt)
];
for (const method of Object.values(lexerInterface)) {
out.push(' ' + method.toString().replace(
/this\.options\.([a-zA-Z$_][a-zA-Z0-9$_]*)/g,
(m, option) => option in options && typeof options[option] !== 'boolean'
? m
: Boolean(options[option])
));
}
return '{\n' + out.join(',\n') + '\n}';
}
function generateModule(options, format = 'iife') {
options = options || {};
let out = '';
const banner = '/* Lexer generated by jison ' + version + ' */\n';
const body = 'const lexer = ' + generateModuleBody(options) + ';\n' +
(options.moduleInclude
? options.moduleInclude + ';\n'
: '');
switch (format) {
case 'cjs':
out += banner;
out += body;
out += 'module.exports = lexer.lexer = lexer;';
break;
case 'esm':
out += banner;
out += 'export ' + body;
out += 'export default lexer;\n';
break;
case 'iife':
out += '(function(){\n';
out += banner;
out += body;
out += 'return lexer;\n';
out += '})();\n';
break;
default:
throw new Error(`Unknown module format "${format}"`);
}
return out;
}
const lexerInterface = {
// resets the lexer, sets new input
setInput(input, yy) {
this.yy = yy || this.yy || {};
this._input = input;
this._more = false;
this._backtrack = false;
this.done = false;
this.currentCondition = 'INITIAL';
this.conditionStack = ['INITIAL'];
this.offset = 0;
this.yytext = this.match = '';
this.yyleng = 0;
this.yylineno = 0;
this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
};
if (this.options.ranges) {
this.yylloc.range = [0, 0];
}
return this;
},
parseError(str, details) {
if (!this.yy.parser) {
throw new Error(str);
}
this.yy.parser.parseError(str, details);
},
// consumes and returns one char from the input
input() {
const ch = this._input[this.offset];
const newline = /\r\n?|\n/g.test(ch);
this.offset++;
this.yyleng++;
this.yytext = this.match = this.yytext + ch;
if (newline) {
this.yylineno++;
this.yylloc.last_line++;
this.yylloc.last_column = 0;
} else {
this.yylloc.last_column++;
}
if (this.options.ranges) {
this.yylloc.range[1]++;
}
return ch;
},
lineColumnForOffset(offset = this.offset, str = this._input, startLine = 1, startColumn = 0) {
const rx = /\r\n?|\n/g;
let line = startLine;
let column = startColumn;
let prevLastIndex = 0;
let match;
while ((match = rx.exec(str)) !== null) {
if (match.index < offset) {
line++;
column = 0;
prevLastIndex = match.index + match[0].length;
} else {
column += offset - prevLastIndex;
prevLastIndex = -1;
break;
}
}
if (prevLastIndex !== -1) {
column += offset - prevLastIndex;
}
return {
line,
column
};
},
setMatch(start, end) {
const newMatch = this._input.slice(start, end);
const firstLoc = start !== this.offset ? this.lineColumnForOffset(start) : {
line: this.yylloc.last_line,
column: this.yylloc.last_column
};
const lastLoc = start !== end
? this.lineColumnForOffset(end - start, newMatch, firstLoc.line, firstLoc.column)
: firstLoc;
this.yytext = this.match = newMatch;
this.yyleng = end - start;
this.offset = end;
this.yylineno = lastLoc.line - 1;
this.yylloc = {
first_line: firstLoc.line,
first_column: firstLoc.column,
last_line: lastLoc.line,
last_column: lastLoc.column
};
if (this.options.ranges) {
this.yylloc.range = [start, end];
}
},
// retain first n characters of the match
less(n) {
const start = this.offset - this.match.length;
this.setMatch(start, start + n);
},
// unshifts part of matched text
unput(chunk) {
const newMatchLength = this.match.length - chunk.length;
if (!this.match.startsWith(chunk, newMatchLength)) {
throw new Error('Lexer#unput() should receive a part of matched text only');
}
this.less(newMatchLength);
},
// When called from action, caches matched text and appends it on next action
more() {
this._more = true;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject() {
if (this.options.backtrack_lexer) {
this._backtrack = true;
return;
}
// FIXME: remove method when options.backtrack_lexer is false
throw new Error('reject() is allowed only when options.backtrack_lexer = true');
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition(offset = this.offset - this.match.length) {
const input = this._input;
const start = Math.max(offset - 20, 0);
const end = Math.min(offset + 20, input.length);
const pre = (start === 0 ? '' : '...') + input.slice(start, offset).replace(/\r\n?|\n/g, '\\n');
const post = input.slice(offset, end).replace(/\r\n?|\n/g, '\\n') + (end === input.length ? '' : '...');
return (
pre +
post +
`\n${'-'.repeat(pre.length)}^`
);
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match(match, rule) {
let backup;
if (this.options.backtrack_lexer) {
// save context
backup = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.yylloc.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
};
if (this.options.ranges) {
backup.yylloc.range = this.yylloc.range.slice(0);
}
}
this._more = false;
this._backtrack = false;
this.setMatch(this.offset, this.offset + match[0].length);
this.matches = match;
// perform action
const token = this.performAction.call(
this,
this.yy,
this,
rule,
this.conditionStack[this.conditionStack.length - 1]
);
if (!token && this._backtrack) {
// recover context
Object.assign(this, backup);
return false; // rule action called reject() implying the next rule should be tested instead.
}
if (!this.eof()) {
this.done = false;
}
if (typeof token === 'number' && this.yy.parser) {
return this.yy.parser.terminals_[token];
}
return token || false;
},
eof() {
return this.offset === this._input.length;
},
// return next match in input
next() {
if (this.done) {
return 1; // EOF
}
if (this.eof()) {
this.done = true;
}
if (!this._more) {
this.yytext = '';
this.match = '';
}
let match;
let matchRuleId;
for (const ruleId of this.conditions[this.currentCondition].rules) {
const rule = this.rules[ruleId];
const ruleInput = this._input.slice(this.offset);
let tempMatch;
if (typeof rule === 'function') {
const ret = rule(ruleInput, this.currentCondition);
switch (typeof ret) {
case 'string': tempMatch = [ret]; break;
case 'number': tempMatch = [ruleInput.slice(0, ret)]; break;
default: tempMatch = ret;
}
} else {
tempMatch = ruleInput.match(rule);
}
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
match = tempMatch;
matchRuleId = ruleId;
if (this.options.backtrack_lexer) {
const token = this.test_match(tempMatch, matchRuleId);
if (token === false && this._backtrack) {
match = false;
continue; // rule action called reject() implying a rule MISmatch.
}
// when token is false this is a lexer rule which consumes
// input without producing a token (e.g. whitespace)
return token;
}
if (!this.options.flex) {
break;
}
}
}
if (match) {
// when token is false this is a lexer rule which consumes
// input without producing a token (e.g. whitespace)
return this.test_match(match, matchRuleId);
}
if (this.eof()) {
return 1; // EOF
}
this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
text: '',
token: null,
line: this.yylineno
});
},
// return next match that has a token
lex() {
let token;
while (!token) {
token = this.next();
}
return token;
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin(condition) {
this.currentCondition = condition;
this.conditionStack.push(condition);
},
// alias for begin(condition)
pushState(condition) {
this.begin(condition);
},
// pop the previously active lexer condition state off the condition stack
popState() {
this.conditionStack.pop();
return this.currentCondition = (this.conditionStack.length
? this.conditionStack[this.conditionStack.length - 1]
: 'INITIAL'
);
},
// return the currently active lexer condition state;
// when an index argument is provided it produces the N-th previous condition state, if available
topState(n) {
n = this.conditionStack.length - 1 - Math.abs(n || 0);
return n >= 0
? this.conditionStack[n]
: 'INITIAL';
},
// return the number of states pushed
stateStackSize() {
return this.conditionStack.length;
}
};

View file

@ -1,21 +0,0 @@
const { generateModuleBody, generateModule } = require('./generate');
const { processGrammar } = require('./process-grammar');
function Lexer(dict, tokens) {
const grammar = processGrammar(dict, tokens);
const source = generateModuleBody(grammar);
const lexer = Function('return' + source)();
lexer.generateModule = format => generateModule(grammar, format);
return lexer;
}
// generate lexer source from a grammar
Lexer.generateModule = function generate(dict, tokens, format) {
const grammar = processGrammar(dict, tokens);
return generateModule(grammar, format);
};
module.exports = Lexer;

View file

@ -1,127 +0,0 @@
const lexParser = require('lex-parser');
module.exports = {
processGrammar
};
function prepareRules(rules, startConditions, flex) {
if (flex) {
rules = rules.concat([['.', '']]);
}
return rules.map((rule, i) => {
rule = rule.slice();
if (!Array.isArray(rule[0])) {
// implicit add to all inclusive start conditions
for (const k in startConditions) {
if (startConditions[k].inclusive) {
startConditions[k].rules.push(i);
}
}
} else if (rule[0][0] === '*') {
// Add to ALL start conditions
for (const k in startConditions) {
startConditions[k].rules.push(i);
}
rule.shift();
} else {
// Add to explicit start conditions
for (const condition of rule.shift()) {
startConditions[condition].rules.push(i);
}
}
return rule;
});
}
// expand macros within macros and produce a substitute function
// FIXME: infinite loop is possible
function buildMacrosSubstituteFn(macros) {
const macrosNoParentsRx = new RegExp('\\{(' + Object.keys(macros).join('|') + ')\\}(?![?+*{])', 'g');
const macrosRx = new RegExp('\\{(' + Object.keys(macros).join('|') + ')\\}', 'g');
let cont = true;
while (cont) {
cont = false;
for (const [name, value] of Object.entries(macros)) {
macros[name] = value.replace(macrosRx, (m, ref) => {
cont = true;
return '(' + macros[ref] + ')';
});
}
}
return pattern => pattern
.replace(macrosNoParentsRx, (_, ref) => macros[ref])
.replace(macrosRx, (_, ref) => '(' + macros[ref] + ')');
}
function preparePatterns(rules, macros, caseless) {
const substituteMacros = macros ? buildMacrosSubstituteFn(macros) : pattern => pattern;
return rules.map(rule => {
let pattern = rule[0];
if (typeof pattern === 'string') {
pattern = substituteMacros(pattern);
pattern = new RegExp(
pattern.includes('|') ? '^(?:' + pattern + ')' : '^' + pattern,
caseless ? 'i' : ''
);
}
return pattern;
});
}
function prepareStartConditions(conditions) {
const result = {};
for (const [key, value] of Object.entries(conditions || {})) {
result[key] = {
rules: [],
inclusive: !value
};
}
return result;
}
// process the grammar and build final data structures and functions
function processGrammar(dict, tokens) {
if (typeof dict === 'string') {
dict = lexParser.parse(dict);
}
dict = dict || {};
const options = dict.options || {};
const opts = {};
opts.options = options;
opts.moduleType = options.moduleType;
opts.moduleName = options.moduleName;
opts.moduleInclude = (dict.moduleInclude || '').trim();
opts.tokens = tokens;
opts.conditions = prepareStartConditions(dict.startConditions);
opts.conditions.INITIAL = { rules: [], inclusive: true };
opts.conditionStack = ['INITIAL'];
opts.actionInclude = dict.actionInclude;
opts.rules = prepareRules(
dict.rules,
opts.conditions,
dict.options && dict.options.flex
);
opts.patterns = preparePatterns(
opts.rules,
dict.macros,
opts.options['case-insensitive']
);
return opts;
}

View file

@ -1,177 +0,0 @@
exports.packTable = function packTable(table) {
function encodeNum(num) {
return num < 32
? e64[num]
: e64[(num & 0b11111) | 0b100000] + e64[num >> 5];
}
function packSubtable(table) {
// reduce consequence repetitions
table = table.replace(/(.+?)\1+/g, (m, p) => {
const t = encodeNum(m.length / p.length);
return t.length + 2 + p.length < m.length
? '<' + t + p + '>'
: m;
});
// reduce repetitions by back ref
const rx = /([^<>]{6,})(.*?)\1/;
let match = null;
let round = 0;
while (round < 16 && (match = table.match(rx))) {
const idx = String.fromCharCode(32 + round); // 0x20-0x2f
const pattern = match[1];
const parts = table.split(pattern);
table = '';
for (let i = 0; i < parts.length; i++) {
if (i === 1) {
table += '[' + idx + pattern + ']';
} else if (i !== 0) {
table += idx;
}
table += parts[i];
}
round++;
}
return table;
}
const e64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~|=';
const indexTable = [];
const indexRowMap = new Map();
const stateTables = [
'',
'',
'',
''
];
for (let i = 0; i < table.length; i++) {
const row = table[i];
const maxIndex = Math.max(...Object.keys(row).map(Number));
let encodedRow = '';
for (let j = 0; j <= maxIndex; j += 3) {
let chunk = 0;
for (let k = 0; k < 3; k++) {
const index = j + k;
if (index in row) {
const [state, ref] = Array.isArray(row[index]) ? row[index] : [0, row[index]];
if (state !== 3) {
chunk |= (state + 1) << (k * 2);
stateTables[state] += encodeNum(ref);
} else {
stateTables[state] += encodeNum(i) + encodeNum(index);
}
}
}
encodedRow += e64[chunk];
}
if (!indexRowMap.has(encodedRow)) {
indexRowMap.set(encodedRow, indexRowMap.size);
}
indexTable.push(encodeNum(indexRowMap.get(encodedRow)));
}
return [
indexTable.join(''),
[...indexRowMap.keys()].join(';'),
...stateTables
].map(packSubtable).join('=');
};
exports.unpackTable = function unpackTable(tables) {
function unpackSubtable(table) {
// restore repetitions by ref
const refs = table.match(/[\x20-\x2f]/g);
const last = refs ? Math.max(...refs.map(ref => ref.charCodeAt() - 32)) : -1;
for (let i = last; i >= 0; i--) {
const idx = (32 + i).toString(16);
let pattern;
table = table
.replace(new RegExp('\\[\\x' + idx + '(.+?)\\]'), (_, repl) => (pattern = repl))
.replace(new RegExp('\\x' + idx, 'g'), pattern);
}
// restore repetitions
table = table.replace(/<([^>]+?)>/g, (_, p) => {
let n = d64[p[0]];
let offset = 1;
if (n >> 5 === 1) {
n = (n & 0b11111) | (d64[p[1]] << 5);
offset = 2;
}
return p.slice(offset).repeat(n);
});
return table;
}
function decodeNums(encoded) {
const nums = [];
for (let j = 0; j < encoded.length; j++) {
const b1 = d64[encoded[j]];
if (b1 & 0b100000) {
const b2 = d64[encoded[++j]];
nums.push((b1 & 0b11111) | (b2 << 5));
} else {
nums.push(b1);
}
}
return nums;
}
const e64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~|=';
const d64 = e64.split('').reduce((map, ch, idx) => (map[ch] = idx, map), Object.create(null));
const [indexTable, indexRows, ...stateTables] = tables.split('=').map(unpackSubtable);
const decodedIndexRows = indexRows.split(';').map(row => {
const states = [];
for (let i = 0; i < row.length; i++) {
for (let j = 0, chunk = d64[row[i]]; j < 3; j++) {
states.push((chunk >> (j * 2)) & 0b11);
}
}
return states;
});
const decodedStateTables = stateTables.map(decodeNums);
const result = decodeNums(indexTable).map(rowIdx => {
const rowIndexes = decodedIndexRows[rowIdx];
const row = Object.create(null);
for (let i = 0; i < rowIndexes.length; i++) {
const state = rowIndexes[i];
if (state !== 0) {
const ref = decodedStateTables[state - 1].shift();
row[i] = state === 1 ? ref : [state - 1, ref];
}
}
return row;
});
for (let i = 0; i < decodedStateTables[3].length; i += 2) {
result[decodedStateTables[3][i]][decodedStateTables[3][i + 1]] = [3];
}
return result;
};

View file

@ -1,244 +0,0 @@
module.exports = function parse(input, ...parseArgs) {
// use own constants for source generation reasons
const SHIFT = 1;
const REDUCE = 2;
const ACCEPT = 3;
const TERROR = 2;
const EOF = 1;
const popStack = n => {
stack.length -= 2 * n;
vstack.length -= n;
lstack.length -= n;
};
const lex = /** @replace token stack */ () => {
let token = lexer.lex() || EOF;
// if token isn't its numeric value, convert
if (typeof token !== 'number') {
token = this.symbols_[token] || token;
}
return token;
}; /** @replace */
const lexer = Object.create(this.lexer);
const ranges = lexer.options && lexer.options.ranges;
const sharedYY = { // shared state
...this.yy,
parser: this,
lexer
};
lexer.setInput(input, sharedYY);
if (typeof sharedYY.parseError === 'function') {
this.parseError = sharedYY.parseError;
}
if (typeof lexer.yylloc == 'undefined') {
lexer.yylloc = {};
}
const table = this.table;
const yyval = {};
let yylloc = lexer.yylloc;
const stack = [0];
const vstack = [null]; // semantic value stack
const lstack = [yylloc]; // location stack
// eslint-disable-next-line no-unused-vars
let tstack = []; // token stack, used when lex supports token stacks
let yytext = '';
let yylineno = 0;
let yyleng = 0;
let recovering = 0;
let symbol;
let preErrorSymbol;
while (true) {
// retreive state number from top of stack
let state = stack[stack.length - 1];
let action;
// use default actions if available
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol === null || typeof symbol == 'undefined') {
symbol = lex();
}
// read action for current state and first input
action = table[state] && table[state][symbol];
}
// handle parse error
if (!action || !action[0]) {
let errorRuleDepth;
let errStr = '';
// Return the rule stack depth where the nearest error rule can be found.
// Return FALSE when no error recovery rule was found.
function locateNearestErrorRecoveryRule(state) {
let stackProbe = stack.length - 1;
let depth = 0;
// try to recover from error
while (true) {
// check for error recovery rule in this state
if (TERROR.toString() in table[state]) {
return depth;
}
if (state === 0 || stackProbe < 2) {
return false; // No suitable error recovery rule available.
}
stackProbe -= 2; // popStack(1): [symbol, action]
state = stack[stackProbe];
++depth;
}
}
if (!recovering) {
// first see if there's any chance at hitting an error recovery rule:
/** @cut recovery */errorRuleDepth = locateNearestErrorRecoveryRule(state);
// Report error
const expected = [];
for (const p in table[state]) {
if (p in this.terminals_ && p > TERROR) {
expected.push('\'' + this.terminals_[p] + '\'');
}
}
errStr = lexer.showPosition
? 'Parse error on line ' + (yylineno + 1) + ':\n' +
lexer.showPosition() + '\n' +
'Expecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''
: 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' +
(symbol === EOF ? 'end of input' : "'" + (this.terminals_[symbol] || symbol) + "'");
this.parseError(errStr, {
text: lexer.match,
token: this.terminals_[symbol] || symbol,
line: lexer.yylineno,
loc: yylloc,
/** @cut recovery */recoverable: errorRuleDepth !== false,
expected
});
} else if (preErrorSymbol !== EOF) {
/** @cut recovery */errorRuleDepth = locateNearestErrorRecoveryRule(state);
}
// just recovered from another error
if (recovering === 3) {
if (symbol === EOF || preErrorSymbol === EOF) {
throw new Error(errStr || 'Parsing halted while starting to recover from another error.');
}
// discard current lookahead and grab another
yyleng = lexer.yyleng;
yytext = lexer.yytext;
yylineno = lexer.yylineno;
yylloc = lexer.yylloc;
symbol = lex();
}
// try to recover from error
if (errorRuleDepth === false) {
throw new Error(errStr || 'Parsing halted. No suitable error recovery rule available.');
}
popStack(errorRuleDepth);
preErrorSymbol = symbol == TERROR ? null : symbol; // save the lookahead token
symbol = TERROR; // insert generic error symbol as new lookahead
state = stack[stack.length - 1];
action = table[state] && table[state][TERROR];
recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
}
// this shouldn't happen, unless resolve defaults are off
if (Array.isArray(action[0]) && action.length > 1) {
throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
}
switch (action[0]) {
case SHIFT:
stack.push(symbol);
vstack.push(lexer.yytext);
lstack.push(lexer.yylloc);
stack.push(action[1]); // push state
symbol = null;
if (!preErrorSymbol) { // normal execution/no error
yyleng = lexer.yyleng;
yytext = lexer.yytext;
yylineno = lexer.yylineno;
yylloc = lexer.yylloc;
if (recovering > 0) {
recovering--;
}
} else {
// error just occurred, resume old lookahead f/ before error
symbol = preErrorSymbol;
preErrorSymbol = null;
}
break;
case REDUCE: {
const len = this.productions_[action[1]][1];
const first = lstack[lstack.length - (len || 1)];
const last = lstack[lstack.length - 1];
// perform semantic action
yyval.$ = vstack[vstack.length - len]; // default to $$ = $1
// default location, uses first token for firsts, last for lasts
yyval._$ = {
first_line: first.first_line,
last_line: last.last_line,
first_column: first.first_column,
last_column: last.last_column
};
if (ranges) {
yyval._$.range = [
first.range[0],
last.range[1]
];
}
const actionResult = this.performAction.call(
yyval,
yytext,
yyleng,
yylineno,
sharedYY,
action[1],
vstack,
lstack,
...parseArgs
);
if (typeof actionResult !== 'undefined') {
return actionResult;
}
// pop off stack
if (len) {
popStack(len);
}
stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
vstack.push(yyval.$);
lstack.push(yyval._$);
// goto new state = table[STATE][NONTERMINAL]
stack.push(table[stack[stack.length - 2]][stack[stack.length - 1]]);
break;
}
case ACCEPT:
return true;
}
}
};

View file

@ -1,5 +0,0 @@
module.exports.fnBody = function(fn) {
return String(fn)
.replace(/^\s*(?:function\s*\([^)]*\)\s*\{\s*(?:\n|\r\n?)?|(?:\([^)]*\)|\S+)\s*=>\s*\{?\s*(?:\n|\r\n?)?)/, '')
.replace(/\s*\}\s*$/, '');
};

View file

@ -1,40 +0,0 @@
{
"name": "@lahmatiy/jison",
"version": "0.4.18-remastered.7",
"description": "A parser generator with Bison's API",
"author": "Zach Carter <zach@carter.name> (http://zaa.ch)",
"license": "MIT",
"keywords": [
"jison",
"bison",
"yacc",
"parser",
"generator",
"lexer",
"flex",
"tokenizer",
"compiler"
],
"homepage": "http://jison.org",
"repository": "lahmatiy/jison",
"main": "lib/jison",
"files": [
"lib"
],
"engines": {
"node": ">=10.10"
},
"dependencies": {
"ebnf-parser": "0.1.10",
"lex-parser": "~0.1.3"
},
"devDependencies": {
"eslint": "^8.45.0",
"mocha": "^9.2.2"
},
"scripts": {
"lint": "eslint lib tests",
"test": "mocha --reporter ${REPORTER:-progress} tests/lexer tests/parser",
"prepublishOnly": "npm run lint && npm run test"
}
}

View file

24
node_modules/ebnf-parser/Makefile generated vendored
View file

@ -1,24 +0,0 @@
all: install build test
install:
npm install
build:
node ./node_modules/.bin/jison bnf.y bnf.l
mv bnf.js parser.js
node ./node_modules/.bin/jison ebnf.y
mv ebnf.js transform-parser.js
test:
node tests/all-tests.js
clean:
superclean: clean
-find . -type d -name 'node_modules' -exec rm -rf "{}" \;

218
node_modules/ebnf-parser/README.md generated vendored
View file

@ -1,218 +0,0 @@
# ebnf-parser
A parser for BNF and EBNF grammars used by jison.
## install
npm install ebnf-parser
## build
To build the parser yourself, clone the git repo then run:
make
This will generate `parser.js`, which is required by `ebnf-parser.js`.
## usage
The parser translates a string grammar or JSON grammar into a JSON grammar that jison can use (ENBF is transformed into BNF).
var ebnfParser = require('ebnf-parser');
// parse a bnf or ebnf string grammar
ebnfParser.parse("%start ... %");
// transform an ebnf JSON gramamr
ebnfParser.transform({"ebnf": ...});
## example grammar
The parser can parse its own BNF grammar, shown below:
%start spec
/* grammar for parsing jison grammar files */
%{
var transform = require('./ebnf-transform').transform;
var ebnf = false;
%}
%%
spec
: declaration_list '%%' grammar optional_end_block EOF
{$$ = $1; return extend($$, $3);}
| declaration_list '%%' grammar '%%' CODE EOF
{$$ = $1; yy.addDeclaration($$,{include:$5}); return extend($$, $3);}
;
optional_end_block
:
| '%%'
;
declaration_list
: declaration_list declaration
{$$ = $1; yy.addDeclaration($$, $2);}
|
{$$ = {};}
;
declaration
: START id
{$$ = {start: $2};}
| LEX_BLOCK
{$$ = {lex: $1};}
| operator
{$$ = {operator: $1};}
| ACTION
{$$ = {include: $1};}
;
operator
: associativity token_list
{$$ = [$1]; $$.push.apply($$, $2);}
;
associativity
: LEFT
{$$ = 'left';}
| RIGHT
{$$ = 'right';}
| NONASSOC
{$$ = 'nonassoc';}
;
token_list
: token_list symbol
{$$ = $1; $$.push($2);}
| symbol
{$$ = [$1];}
;
grammar
: production_list
{$$ = $1;}
;
production_list
: production_list production
{$$ = $1;
if($2[0] in $$) $$[$2[0]] = $$[$2[0]].concat($2[1]);
else $$[$2[0]] = $2[1];}
| production
{$$ = {}; $$[$1[0]] = $1[1];}
;
production
: id ':' handle_list ';'
{$$ = [$1, $3];}
;
handle_list
: handle_list '|' handle_action
{$$ = $1; $$.push($3);}
| handle_action
{$$ = [$1];}
;
handle_action
: handle prec action
{$$ = [($1.length ? $1.join(' ') : '')];
if($3) $$.push($3);
if($2) $$.push($2);
if ($$.length === 1) $$ = $$[0];
}
;
handle
: handle expression_suffix
{$$ = $1; $$.push($2)}
|
{$$ = [];}
;
handle_sublist
: handle_sublist '|' handle
{$$ = $1; $$.push($3.join(' '));}
| handle
{$$ = [$1.join(' ')];}
;
expression_suffix
: expression suffix
{$$ = $expression + $suffix; }
;
expression
: ID
{$$ = $1; }
| STRING
{$$ = ebnf ? "'"+$1+"'" : $1; }
| '(' handle_sublist ')'
{$$ = '(' + $handle_sublist.join(' | ') + ')'; }
;
suffix
: {$$ = ''}
| '*'
| '?'
| '+'
;
prec
: PREC symbol
{$$ = {prec: $2};}
|
{$$ = null;}
;
symbol
: id
{$$ = $1;}
| STRING
{$$ = yytext;}
;
id
: ID
{$$ = yytext;}
;
action
: '{' action_body '}'
{$$ = $2;}
| ACTION
{$$ = $1;}
| ARROW_ACTION
{$$ = '$$ ='+$1+';';}
|
{$$ = '';}
;
action_body
:
{$$ = '';}
| ACTION_BODY
{$$ = yytext;}
| action_body '{' action_body '}' ACTION_BODY
{$$ = $1+$2+$3+$4+$5;}
| action_body '{' action_body '}'
{$$ = $1+$2+$3+$4;}
;
%%
// transform ebnf to bnf if necessary
function extend (json, grammar) {
json.bnf = ebnf ? transform(grammar) : grammar;
return json;
}
## license
MIT

58
node_modules/ebnf-parser/bnf.l generated vendored
View file

@ -1,58 +0,0 @@
id [a-zA-Z][a-zA-Z0-9_-]*
%x action code
%s bnf ebnf
%%
<bnf,ebnf>"%%" this.pushState('code');return '%%';
<ebnf>"(" return '(';
<ebnf>")" return ')';
<ebnf>"*" return '*';
<ebnf>"?" return '?';
<ebnf>"+" return '+';
\s+ /* skip whitespace */
"//".* /* skip comment */
"/*"(.|\n|\r)*?"*/" /* skip comment */
"["{id}"]" yytext = yytext.substr(1, yyleng-2); return 'ALIAS';
{id} return 'ID';
'"'[^"]+'"' yytext = yytext.substr(1, yyleng-2); return 'STRING';
"'"[^']+"'" yytext = yytext.substr(1, yyleng-2); return 'STRING';
":" return ':';
";" return ';';
"|" return '|';
"%%" this.pushState(ebnf ? 'ebnf' : 'bnf'); return '%%';
"%ebnf" if (!yy.options) yy.options = {}; ebnf = yy.options.ebnf = true;
"%prec" return 'PREC';
"%start" return 'START';
"%left" return 'LEFT';
"%right" return 'RIGHT';
"%nonassoc" return 'NONASSOC';
"%parse-param" return 'PARSE_PARAM';
"%options" return 'OPTIONS';
"%lex"[\w\W]*?"/lex" return 'LEX_BLOCK';
"%"[a-zA-Z]+[^\r\n]* /* ignore unrecognized decl */
"<"[a-zA-Z]*">" /* ignore type */
"{{"[\w\W]*?"}}" yytext = yytext.substr(2, yyleng-4); return 'ACTION';
"%{"(.|\r|\n)*?"%}" yytext = yytext.substr(2, yytext.length-4); return 'ACTION';
"{" yy.depth = 0; this.pushState('action'); return '{';
"->".* yytext = yytext.substr(2, yyleng-2); return 'ARROW_ACTION';
. /* ignore bad characters */
<*><<EOF>> return 'EOF';
<action>"/*"(.|\n|\r)*?"*/" return 'ACTION_BODY';
<action>"//".* return 'ACTION_BODY';
<action>"/"[^ /]*?['"{}'][^ ]*?"/" return 'ACTION_BODY'; // regexp with braces or quotes (and no spaces)
<action>\"("\\\\"|'\"'|[^"])*\" return 'ACTION_BODY';
<action>"'"("\\\\"|"\'"|[^'])*"'" return 'ACTION_BODY';
<action>[/"'][^{}/"']+ return 'ACTION_BODY';
<action>[^{}/"']+ return 'ACTION_BODY';
<action>"{" yy.depth++; return '{';
<action>"}" if (yy.depth==0) this.begin(ebnf ? 'ebnf' : 'bnf'); else yy.depth--; return '}';
<code>(.|\n|\r)+ return 'CODE';
%%

216
node_modules/ebnf-parser/bnf.y generated vendored
View file

@ -1,216 +0,0 @@
%start spec
/* grammar for parsing jison grammar files */
%{
var transform = require('./ebnf-transform').transform;
var ebnf = false;
%}
%%
spec
: declaration_list '%%' grammar optional_end_block EOF
{
$$ = $1;
return extend($$, $3);
}
| declaration_list '%%' grammar '%%' CODE EOF
{
$$ = $1;
yy.addDeclaration($$, { include: $5 });
return extend($$, $3);
}
;
optional_end_block
:
| '%%'
;
declaration_list
: declaration_list declaration
{$$ = $1; yy.addDeclaration($$, $2);}
|
{$$ = {};}
;
declaration
: START id
{$$ = {start: $2};}
| LEX_BLOCK
{$$ = {lex: $1};}
| operator
{$$ = {operator: $1};}
| ACTION
{$$ = {include: $1};}
| parse_param
{$$ = {parseParam: $1};}
| options
{$$ = {options: $1};}
;
options
: OPTIONS token_list
{$$ = $2;}
;
parse_param
: PARSE_PARAM token_list
{$$ = $2;}
;
operator
: associativity token_list
{$$ = [$1]; $$.push.apply($$, $2);}
;
associativity
: LEFT
{$$ = 'left';}
| RIGHT
{$$ = 'right';}
| NONASSOC
{$$ = 'nonassoc';}
;
token_list
: token_list symbol
{$$ = $1; $$.push($2);}
| symbol
{$$ = [$1];}
;
grammar
: production_list
{$$ = $1;}
;
production_list
: production_list production
{
$$ = $1;
if ($2[0] in $$)
$$[$2[0]] = $$[$2[0]].concat($2[1]);
else
$$[$2[0]] = $2[1];
}
| production
{$$ = {}; $$[$1[0]] = $1[1];}
;
production
: id ':' handle_list ';'
{$$ = [$1, $3];}
;
handle_list
: handle_list '|' handle_action
{$$ = $1; $$.push($3);}
| handle_action
{$$ = [$1];}
;
handle_action
: handle prec action
{
$$ = [($1.length ? $1.join(' ') : '')];
if($3) $$.push($3);
if($2) $$.push($2);
if ($$.length === 1) $$ = $$[0];
}
;
handle
: handle expression_suffix
{$$ = $1; $$.push($2)}
|
{$$ = [];}
;
handle_sublist
: handle_sublist '|' handle
{$$ = $1; $$.push($3.join(' '));}
| handle
{$$ = [$1.join(' ')];}
;
expression_suffix
: expression suffix ALIAS
{$$ = $expression + $suffix + "[" + $ALIAS + "]"; }
| expression suffix
{$$ = $expression + $suffix; }
;
expression
: ID
{$$ = $1; }
| STRING
{$$ = ebnf ? "'" + $1 + "'" : $1; }
| '(' handle_sublist ')'
{$$ = '(' + $handle_sublist.join(' | ') + ')'; }
;
suffix
: {$$ = ''}
| '*'
| '?'
| '+'
;
prec
: PREC symbol
{$$ = {prec: $2};}
|
{$$ = null;}
;
symbol
: id
{$$ = $1;}
| STRING
{$$ = yytext;}
;
id
: ID
{$$ = yytext;}
;
action
: '{' action_body '}'
{$$ = $2;}
| ACTION
{$$ = $1;}
| ARROW_ACTION
{$$ = '$$ =' + $1 + ';';}
|
{$$ = '';}
;
action_body
:
{$$ = '';}
| action_comments_body
{$$ = $1;}
| action_body '{' action_body '}' action_comments_body
{$$ = $1 + $2 + $3 + $4 + $5;}
| action_body '{' action_body '}'
{$$ = $1 + $2 + $3 + $4;}
;
action_comments_body
: ACTION_BODY
{ $$ = yytext; }
| action_comments_body ACTION_BODY
{ $$ = $1+$2; }
;
%%
// transform ebnf to bnf if necessary
function extend (json, grammar) {
json.bnf = ebnf ? transform(grammar) : grammar;
return json;
}

View file

@ -1,41 +0,0 @@
var bnf = require("./parser").parser,
ebnf = require("./ebnf-transform"),
jisonlex = require("lex-parser");
exports.parse = function parse (grammar) { return bnf.parse(grammar); };
exports.transform = ebnf.transform;
// adds a declaration to the grammar
bnf.yy.addDeclaration = function (grammar, decl) {
if (decl.start) {
grammar.start = decl.start;
} else if (decl.lex) {
grammar.lex = parseLex(decl.lex);
} else if (decl.operator) {
if (!grammar.operators) grammar.operators = [];
grammar.operators.push(decl.operator);
} else if (decl.parseParam) {
if (!grammar.parseParams) grammar.parseParams = [];
grammar.parseParams = grammar.parseParams.concat(decl.parseParam);
} else if (decl.include) {
if (!grammar.moduleInclude) grammar.moduleInclude = '';
grammar.moduleInclude += decl.include;
} else if (decl.options) {
if (!grammar.options) grammar.options = {};
for (var i=0; i < decl.options.length; i++) {
grammar.options[decl.options[i]] = true;
}
}
};
// parse an embedded lex section
var parseLex = function (text) {
return jisonlex.parse(text.replace(/(?:^%lex)|(?:\/lex$)/g, ''));
};

View file

@ -1,135 +0,0 @@
var EBNF = (function(){
var parser = require('./transform-parser.js');
var transformExpression = function(e, opts, emit) {
var type = e[0], value = e[1], name = false;
if (type === 'xalias') {
type = e[1];
value = e[2]
name = e[3];
if (type) {
e = e.slice(1,2);
} else {
e = value;
type = e[0];
value = e[1];
}
}
if (type === 'symbol') {
var n;
if (e[1][0] === '\\') n = e[1][1];
else if (e[1][0] === '\'') n = e[1].substring(1, e[1].length-1);
else n = e[1];
emit(n + (name ? "["+name+"]" : ""));
} else if (type === "+") {
if (!name) {
name = opts.production + "_repetition_plus" + opts.repid++;
}
emit(name);
opts = optsForProduction(name, opts.grammar);
var list = transformExpressionList([value], opts);
opts.grammar[name] = [
[list, "$$ = [$1];"],
[
name + " " + list,
"$1.push($2);"
]
];
} else if (type === "*") {
if (!name) {
name = opts.production + "_repetition" + opts.repid++;
}
emit(name);
opts = optsForProduction(name, opts.grammar);
opts.grammar[name] = [
["", "$$ = [];"],
[
name + " " + transformExpressionList([value], opts),
"$1.push($2);"
]
];
} else if (type ==="?") {
if (!name) {
name = opts.production + "_option" + opts.optid++;
}
emit(name);
opts = optsForProduction(name, opts.grammar);
opts.grammar[name] = [
"", transformExpressionList([value], opts)
];
} else if (type === "()") {
if (value.length == 1) {
emit(transformExpressionList(value[0], opts));
} else {
if (!name) {
name = opts.production + "_group" + opts.groupid++;
}
emit(name);
opts = optsForProduction(name, opts.grammar);
opts.grammar[name] = value.map(function(handle) {
return transformExpressionList(handle, opts);
});
}
}
};
var transformExpressionList = function(list, opts) {
return list.reduce (function (tot, e) {
transformExpression (e, opts, function (i) { tot.push(i); });
return tot;
}, []).
join(" ");
};
var optsForProduction = function(id, grammar) {
return {
production: id,
repid: 0,
groupid: 0,
optid: 0,
grammar: grammar
};
};
var transformProduction = function(id, production, grammar) {
var transform_opts = optsForProduction(id, grammar);
return production.map(function (handle) {
var action = null, opts = null;
if (typeof(handle) !== 'string')
action = handle[1],
opts = handle[2],
handle = handle[0];
var expressions = parser.parse(handle);
handle = transformExpressionList(expressions, transform_opts);
var ret = [handle];
if (action) ret.push(action);
if (opts) ret.push(opts);
if (ret.length == 1) return ret[0];
else return ret;
});
};
var transformGrammar = function(grammar) {
Object.keys(grammar).forEach(function(id) {
grammar[id] = transformProduction(id, grammar[id], grammar);
});
};
return {
transform: function (ebnf) {
transformGrammar(ebnf);
return ebnf;
}
};
})();
exports.transform = EBNF.transform;

66
node_modules/ebnf-parser/ebnf.y generated vendored
View file

@ -1,66 +0,0 @@
/* EBNF grammar spec */
%lex
id [a-zA-Z][a-zA-Z0-9_-]*
%%
\s+ /* skip whitespace */
{id} return 'symbol';
"["{id}"]" yytext = yytext.substr(1, yyleng-2); return 'ALIAS';
"'"[^']*"'" return 'symbol';
"." return 'symbol';
bar return 'bar';
"(" return '(';
")" return ')';
"*" return '*';
"?" return '?';
"|" return '|';
"+" return '+';
<<EOF>> return 'EOF';
/lex
%start production
%%
production
: handle EOF
{ return $handle; }
;
handle_list
: handle
{ $$ = [$handle]; }
| handle_list '|' handle
{ $handle_list.push($handle); }
;
handle
:
{ $$ = []; }
| handle expression_suffix
{ $handle.push($expression_suffix); }
;
expression_suffix
: expression suffix ALIAS
{ $$ = ['xalias', $suffix, $expression, $ALIAS]; }
| expression suffix
{ if ($suffix) $$ = [$suffix, $expression]; else $$ = $expression; }
;
expression
: symbol
{ $$ = ['symbol', $symbol]; }
| '(' handle_list ')'
{ $$ = ['()', $handle_list]; }
;
suffix
:
| '*'
| '?'
| '+'
;

View file

@ -1,27 +0,0 @@
{
"name": "ebnf-parser",
"version": "0.1.10",
"description": "A parser for BNF and EBNF grammars used by jison",
"main": "ebnf-parser.js",
"scripts": {
"test": "make test"
},
"repository": {
"type": "git",
"url": "https://github.com/zaach/ebnf-parser.git"
},
"keywords": [
"bnf",
"ebnf",
"grammar",
"parser",
"jison"
],
"author": "Zach Carter",
"license": "MIT",
"devDependencies": {
"jison": "git://github.com/zaach/jison.git#ef2647",
"lex-parser": "0.1.0",
"test": "*"
}
}

802
node_modules/ebnf-parser/parser.js generated vendored
View file

@ -1,802 +0,0 @@
/* parser generated by jison 0.4.11 */
/*
Returns a Parser object of the following structure:
Parser: {
yy: {}
}
Parser.prototype: {
yy: {},
trace: function(),
symbols_: {associative list: name ==> number},
terminals_: {associative list: number ==> name},
productions_: [...],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
table: [...],
defaultActions: {...},
parseError: function(str, hash),
parse: function(input),
lexer: {
EOF: 1,
parseError: function(str, hash),
setInput: function(input),
input: function(),
unput: function(str),
more: function(),
less: function(n),
pastInput: function(),
upcomingInput: function(),
showPosition: function(),
test_match: function(regex_match_array, rule_index),
next: function(),
lex: function(),
begin: function(condition),
popState: function(),
_currentRules: function(),
topState: function(),
pushState: function(condition),
options: {
ranges: boolean (optional: true ==> token location info will include a .range[] member)
flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
},
performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
rules: [...],
conditions: {associative list: name ==> set},
}
}
token location info (@$, _$, etc.): {
first_line: n,
last_line: n,
first_column: n,
last_column: n,
range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
}
the parseError function receives a 'hash' object with these members for lexer and parser errors: {
text: (matched text)
token: (the produced terminal token, if any)
line: (yylineno)
}
while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
loc: (yylloc)
expected: (string describing the set of expected tokens)
recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
}
*/
var bnf = (function(){
var parser = {trace: function trace() { },
yy: {},
symbols_: {"error":2,"spec":3,"declaration_list":4,"%%":5,"grammar":6,"optional_end_block":7,"EOF":8,"CODE":9,"declaration":10,"START":11,"id":12,"LEX_BLOCK":13,"operator":14,"ACTION":15,"parse_param":16,"options":17,"OPTIONS":18,"token_list":19,"PARSE_PARAM":20,"associativity":21,"LEFT":22,"RIGHT":23,"NONASSOC":24,"symbol":25,"production_list":26,"production":27,":":28,"handle_list":29,";":30,"|":31,"handle_action":32,"handle":33,"prec":34,"action":35,"expression_suffix":36,"handle_sublist":37,"expression":38,"suffix":39,"ALIAS":40,"ID":41,"STRING":42,"(":43,")":44,"*":45,"?":46,"+":47,"PREC":48,"{":49,"action_body":50,"}":51,"ARROW_ACTION":52,"action_comments_body":53,"ACTION_BODY":54,"$accept":0,"$end":1},
terminals_: {2:"error",5:"%%",8:"EOF",9:"CODE",11:"START",13:"LEX_BLOCK",15:"ACTION",18:"OPTIONS",20:"PARSE_PARAM",22:"LEFT",23:"RIGHT",24:"NONASSOC",28:":",30:";",31:"|",40:"ALIAS",41:"ID",42:"STRING",43:"(",44:")",45:"*",46:"?",47:"+",48:"PREC",49:"{",51:"}",52:"ARROW_ACTION",54:"ACTION_BODY"},
productions_: [0,[3,5],[3,6],[7,0],[7,1],[4,2],[4,0],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[17,2],[16,2],[14,2],[21,1],[21,1],[21,1],[19,2],[19,1],[6,1],[26,2],[26,1],[27,4],[29,3],[29,1],[32,3],[33,2],[33,0],[37,3],[37,1],[36,3],[36,2],[38,1],[38,1],[38,3],[39,0],[39,1],[39,1],[39,1],[34,2],[34,0],[25,1],[25,1],[12,1],[35,3],[35,1],[35,1],[35,0],[50,0],[50,1],[50,5],[50,4],[53,1],[53,2]],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
/* this == yyval */
var $0 = $$.length - 1;
switch (yystate) {
case 1:
this.$ = $$[$0-4];
return extend(this.$, $$[$0-2]);
break;
case 2:
this.$ = $$[$0-5];
yy.addDeclaration(this.$, { include: $$[$0-1] });
return extend(this.$, $$[$0-3]);
break;
case 5:this.$ = $$[$0-1]; yy.addDeclaration(this.$, $$[$0]);
break;
case 6:this.$ = {};
break;
case 7:this.$ = {start: $$[$0]};
break;
case 8:this.$ = {lex: $$[$0]};
break;
case 9:this.$ = {operator: $$[$0]};
break;
case 10:this.$ = {include: $$[$0]};
break;
case 11:this.$ = {parseParam: $$[$0]};
break;
case 12:this.$ = {options: $$[$0]};
break;
case 13:this.$ = $$[$0];
break;
case 14:this.$ = $$[$0];
break;
case 15:this.$ = [$$[$0-1]]; this.$.push.apply(this.$, $$[$0]);
break;
case 16:this.$ = 'left';
break;
case 17:this.$ = 'right';
break;
case 18:this.$ = 'nonassoc';
break;
case 19:this.$ = $$[$0-1]; this.$.push($$[$0]);
break;
case 20:this.$ = [$$[$0]];
break;
case 21:this.$ = $$[$0];
break;
case 22:
this.$ = $$[$0-1];
if ($$[$0][0] in this.$)
this.$[$$[$0][0]] = this.$[$$[$0][0]].concat($$[$0][1]);
else
this.$[$$[$0][0]] = $$[$0][1];
break;
case 23:this.$ = {}; this.$[$$[$0][0]] = $$[$0][1];
break;
case 24:this.$ = [$$[$0-3], $$[$0-1]];
break;
case 25:this.$ = $$[$0-2]; this.$.push($$[$0]);
break;
case 26:this.$ = [$$[$0]];
break;
case 27:
this.$ = [($$[$0-2].length ? $$[$0-2].join(' ') : '')];
if($$[$0]) this.$.push($$[$0]);
if($$[$0-1]) this.$.push($$[$0-1]);
if (this.$.length === 1) this.$ = this.$[0];
break;
case 28:this.$ = $$[$0-1]; this.$.push($$[$0])
break;
case 29:this.$ = [];
break;
case 30:this.$ = $$[$0-2]; this.$.push($$[$0].join(' '));
break;
case 31:this.$ = [$$[$0].join(' ')];
break;
case 32:this.$ = $$[$0-2] + $$[$0-1] + "[" + $$[$0] + "]";
break;
case 33:this.$ = $$[$0-1] + $$[$0];
break;
case 34:this.$ = $$[$0];
break;
case 35:this.$ = ebnf ? "'" + $$[$0] + "'" : $$[$0];
break;
case 36:this.$ = '(' + $$[$0-1].join(' | ') + ')';
break;
case 37:this.$ = ''
break;
case 41:this.$ = {prec: $$[$0]};
break;
case 42:this.$ = null;
break;
case 43:this.$ = $$[$0];
break;
case 44:this.$ = yytext;
break;
case 45:this.$ = yytext;
break;
case 46:this.$ = $$[$0-1];
break;
case 47:this.$ = $$[$0];
break;
case 48:this.$ = '$$ =' + $$[$0] + ';';
break;
case 49:this.$ = '';
break;
case 50:this.$ = '';
break;
case 51:this.$ = $$[$0];
break;
case 52:this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0];
break;
case 53:this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0];
break;
case 54: this.$ = yytext;
break;
case 55: this.$ = $$[$0-1]+$$[$0];
break;
}
},
table: [{3:1,4:2,5:[2,6],11:[2,6],13:[2,6],15:[2,6],18:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{1:[3]},{5:[1,3],10:4,11:[1,5],13:[1,6],14:7,15:[1,8],16:9,17:10,18:[1,13],20:[1,12],21:11,22:[1,14],23:[1,15],24:[1,16]},{6:17,12:20,26:18,27:19,41:[1,21]},{5:[2,5],11:[2,5],13:[2,5],15:[2,5],18:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{12:22,41:[1,21]},{5:[2,8],11:[2,8],13:[2,8],15:[2,8],18:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{5:[2,9],11:[2,9],13:[2,9],15:[2,9],18:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],11:[2,10],13:[2,10],15:[2,10],18:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],11:[2,11],13:[2,11],15:[2,11],18:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],11:[2,12],13:[2,12],15:[2,12],18:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{12:25,19:23,25:24,41:[1,21],42:[1,26]},{12:25,19:27,25:24,41:[1,21],42:[1,26]},{12:25,19:28,25:24,41:[1,21],42:[1,26]},{41:[2,16],42:[2,16]},{41:[2,17],42:[2,17]},{41:[2,18],42:[2,18]},{5:[1,30],7:29,8:[2,3]},{5:[2,21],8:[2,21],12:20,27:31,41:[1,21]},{5:[2,23],8:[2,23],41:[2,23]},{28:[1,32]},{5:[2,45],11:[2,45],13:[2,45],15:[2,45],18:[2,45],20:[2,45],22:[2,45],23:[2,45],24:[2,45],28:[2,45],30:[2,45],31:[2,45],41:[2,45],42:[2,45],49:[2,45],52:[2,45]},{5:[2,7],11:[2,7],13:[2,7],15:[2,7],18:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{5:[2,15],11:[2,15],12:25,13:[2,15],15:[2,15],18:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15],25:33,41:[1,21],42:[1,26]},{5:[2,20],11:[2,20],13:[2,20],15:[2,20],18:[2,20],20:[2,20],22:[2,20],23:[2,20],24:[2,20],41:[2,20],42:[2,20]},{5:[2,43],11:[2,43],13:[2,43],15:[2,43],18:[2,43],20:[2,43],22:[2,43],23:[2,43],24:[2,43],30:[2,43],31:[2,43],41:[2,43],42:[2,43],49:[2,43],52:[2,43]},{5:[2,44],11:[2,44],13:[2,44],15:[2,44],18:[2,44],20:[2,44],22:[2,44],23:[2,44],24:[2,44],30:[2,44],31:[2,44],41:[2,44],42:[2,44],49:[2,44],52:[2,44]},{5:[2,14],11:[2,14],12:25,13:[2,14],15:[2,14],18:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14],25:33,41:[1,21],42:[1,26]},{5:[2,13],11:[2,13],12:25,13:[2,13],15:[2,13],18:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13],25:33,41:[1,21],42:[1,26]},{8:[1,34]},{8:[2,4],9:[1,35]},{5:[2,22],8:[2,22],41:[2,22]},{15:[2,29],29:36,30:[2,29],31:[2,29],32:37,33:38,41:[2,29],42:[2,29],43:[2,29],48:[2,29],49:[2,29],52:[2,29]},{5:[2,19],11:[2,19],13:[2,19],15:[2,19],18:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19],41:[2,19],42:[2,19]},{1:[2,1]},{8:[1,39]},{30:[1,40],31:[1,41]},{30:[2,26],31:[2,26]},{15:[2,42],30:[2,42],31:[2,42],34:42,36:43,38:45,41:[1,46],42:[1,47],43:[1,48],48:[1,44],49:[2,42],52:[2,42]},{1:[2,2]},{5:[2,24],8:[2,24],41:[2,24]},{15:[2,29],30:[2,29],31:[2,29],32:49,33:38,41:[2,29],42:[2,29],43:[2,29],48:[2,29],49:[2,29],52:[2,29]},{15:[1,52],30:[2,49],31:[2,49],35:50,49:[1,51],52:[1,53]},{15:[2,28],30:[2,28],31:[2,28],41:[2,28],42:[2,28],43:[2,28],44:[2,28],48:[2,28],49:[2,28],52:[2,28]},{12:25,25:54,41:[1,21],42:[1,26]},{15:[2,37],30:[2,37],31:[2,37],39:55,40:[2,37],41:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[1,56],46:[1,57],47:[1,58],48:[2,37],49:[2,37],52:[2,37]},{15:[2,34],30:[2,34],31:[2,34],40:[2,34],41:[2,34],42:[2,34],43:[2,34],44:[2,34],45:[2,34],46:[2,34],47:[2,34],48:[2,34],49:[2,34],52:[2,34]},{15:[2,35],30:[2,35],31:[2,35],40:[2,35],41:[2,35],42:[2,35],43:[2,35],44:[2,35],45:[2,35],46:[2,35],47:[2,35],48:[2,35],49:[2,35],52:[2,35]},{31:[2,29],33:60,37:59,41:[2,29],42:[2,29],43:[2,29],44:[2,29]},{30:[2,25],31:[2,25]},{30:[2,27],31:[2,27]},{49:[2,50],50:61,51:[2,50],53:62,54:[1,63]},{30:[2,47],31:[2,47]},{30:[2,48],31:[2,48]},{15:[2,41],30:[2,41],31:[2,41],49:[2,41],52:[2,41]},{15:[2,33],30:[2,33],31:[2,33],40:[1,64],41:[2,33],42:[2,33],43:[2,33],44:[2,33],48:[2,33],49:[2,33],52:[2,33]},{15:[2,38],30:[2,38],31:[2,38],40:[2,38],41:[2,38],42:[2,38],43:[2,38],44:[2,38],48:[2,38],49:[2,38],52:[2,38]},{15:[2,39],30:[2,39],31:[2,39],40:[2,39],41:[2,39],42:[2,39],43:[2,39],44:[2,39],48:[2,39],49:[2,39],52:[2,39]},{15:[2,40],30:[2,40],31:[2,40],40:[2,40],41:[2,40],42:[2,40],43:[2,40],44:[2,40],48:[2,40],49:[2,40],52:[2,40]},{31:[1,66],44:[1,65]},{31:[2,31],36:43,38:45,41:[1,46],42:[1,47],43:[1,48],44:[2,31]},{49:[1,68],51:[1,67]},{49:[2,51],51:[2,51],54:[1,69]},{49:[2,54],51:[2,54],54:[2,54]},{15:[2,32],30:[2,32],31:[2,32],41:[2,32],42:[2,32],43:[2,32],44:[2,32],48:[2,32],49:[2,32],52:[2,32]},{15:[2,36],30:[2,36],31:[2,36],40:[2,36],41:[2,36],42:[2,36],43:[2,36],44:[2,36],45:[2,36],46:[2,36],47:[2,36],48:[2,36],49:[2,36],52:[2,36]},{31:[2,29],33:70,41:[2,29],42:[2,29],43:[2,29],44:[2,29]},{30:[2,46],31:[2,46]},{49:[2,50],50:71,51:[2,50],53:62,54:[1,63]},{49:[2,55],51:[2,55],54:[2,55]},{31:[2,30],36:43,38:45,41:[1,46],42:[1,47],43:[1,48],44:[2,30]},{49:[1,68],51:[1,72]},{49:[2,53],51:[2,53],53:73,54:[1,63]},{49:[2,52],51:[2,52],54:[1,69]}],
defaultActions: {34:[2,1],39:[2,2]},
parseError: function parseError(str, hash) {
if (hash.recoverable) {
this.trace(str);
} else {
throw new Error(str);
}
},
parse: function parse(input) {
var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
var args = lstack.slice.call(arguments, 1);
this.lexer.setInput(input);
this.lexer.yy = this.yy;
this.yy.lexer = this.lexer;
this.yy.parser = this;
if (typeof this.lexer.yylloc == 'undefined') {
this.lexer.yylloc = {};
}
var yyloc = this.lexer.yylloc;
lstack.push(yyloc);
var ranges = this.lexer.options && this.lexer.options.ranges;
if (typeof this.yy.parseError === 'function') {
this.parseError = this.yy.parseError;
} else {
this.parseError = Object.getPrototypeOf(this).parseError;
}
function popStack(n) {
stack.length = stack.length - 2 * n;
vstack.length = vstack.length - n;
lstack.length = lstack.length - n;
}
function lex() {
var token;
token = self.lexer.lex() || EOF;
if (typeof token !== 'number') {
token = self.symbols_[token] || token;
}
return token;
}
var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
while (true) {
state = stack[stack.length - 1];
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol === null || typeof symbol == 'undefined') {
symbol = lex();
}
action = table[state] && table[state][symbol];
}
if (typeof action === 'undefined' || !action.length || !action[0]) {
var errStr = '';
expected = [];
for (p in table[state]) {
if (this.terminals_[p] && p > TERROR) {
expected.push('\'' + this.terminals_[p] + '\'');
}
}
if (this.lexer.showPosition) {
errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + this.lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
} else {
errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
}
this.parseError(errStr, {
text: this.lexer.match,
token: this.terminals_[symbol] || symbol,
line: this.lexer.yylineno,
loc: yyloc,
expected: expected
});
}
if (action[0] instanceof Array && action.length > 1) {
throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
}
switch (action[0]) {
case 1:
stack.push(symbol);
vstack.push(this.lexer.yytext);
lstack.push(this.lexer.yylloc);
stack.push(action[1]);
symbol = null;
if (!preErrorSymbol) {
yyleng = this.lexer.yyleng;
yytext = this.lexer.yytext;
yylineno = this.lexer.yylineno;
yyloc = this.lexer.yylloc;
if (recovering > 0) {
recovering--;
}
} else {
symbol = preErrorSymbol;
preErrorSymbol = null;
}
break;
case 2:
len = this.productions_[action[1]][1];
yyval.$ = vstack[vstack.length - len];
yyval._$ = {
first_line: lstack[lstack.length - (len || 1)].first_line,
last_line: lstack[lstack.length - 1].last_line,
first_column: lstack[lstack.length - (len || 1)].first_column,
last_column: lstack[lstack.length - 1].last_column
};
if (ranges) {
yyval._$.range = [
lstack[lstack.length - (len || 1)].range[0],
lstack[lstack.length - 1].range[1]
];
}
r = this.performAction.apply(yyval, [
yytext,
yyleng,
yylineno,
this.yy,
action[1],
vstack,
lstack
].concat(args));
if (typeof r !== 'undefined') {
return r;
}
if (len) {
stack = stack.slice(0, -1 * len * 2);
vstack = vstack.slice(0, -1 * len);
lstack = lstack.slice(0, -1 * len);
}
stack.push(this.productions_[action[1]][0]);
vstack.push(yyval.$);
lstack.push(yyval._$);
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
stack.push(newState);
break;
case 3:
return true;
}
}
return true;
}};
var transform = require('./ebnf-transform').transform;
var ebnf = false;
// transform ebnf to bnf if necessary
function extend (json, grammar) {
json.bnf = ebnf ? transform(grammar) : grammar;
return json;
}
/* generated by jison-lex 0.2.1 */
var lexer = (function(){
var lexer = {
EOF:1,
parseError:function parseError(str, hash) {
if (this.yy.parser) {
this.yy.parser.parseError(str, hash);
} else {
throw new Error(str);
}
},
// resets the lexer, sets new input
setInput:function (input) {
this._input = input;
this._more = this._backtrack = this.done = false;
this.yylineno = this.yyleng = 0;
this.yytext = this.matched = this.match = '';
this.conditionStack = ['INITIAL'];
this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
};
if (this.options.ranges) {
this.yylloc.range = [0,0];
}
this.offset = 0;
return this;
},
// consumes and returns one char from the input
input:function () {
var ch = this._input[0];
this.yytext += ch;
this.yyleng++;
this.offset++;
this.match += ch;
this.matched += ch;
var lines = ch.match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno++;
this.yylloc.last_line++;
} else {
this.yylloc.last_column++;
}
if (this.options.ranges) {
this.yylloc.range[1]++;
}
this._input = this._input.slice(1);
return ch;
},
// unshifts one char (or a string) into the input
unput:function (ch) {
var len = ch.length;
var lines = ch.split(/(?:\r\n?|\n)/g);
this._input = ch + this._input;
this.yytext = this.yytext.substr(0, this.yytext.length - len - 1);
//this.yyleng -= len;
this.offset -= len;
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1);
this.matched = this.matched.substr(0, this.matched.length - 1);
if (lines.length - 1) {
this.yylineno -= lines.length - 1;
}
var r = this.yylloc.range;
this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: lines ?
(lines.length === oldLines.length ? this.yylloc.first_column : 0)
+ oldLines[oldLines.length - lines.length].length - lines[0].length :
this.yylloc.first_column - len
};
if (this.options.ranges) {
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
}
this.yyleng = this.yytext.length;
return this;
},
// When called from action, caches matched text and appends it on next action
more:function () {
this._more = true;
return this;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject:function () {
if (this.options.backtrack_lexer) {
this._backtrack = true;
} else {
return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
return this;
},
// retain first n characters of the match
less:function (n) {
this.unput(this.match.slice(n));
},
// displays already matched input, i.e. for error messages
pastInput:function () {
var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
},
// displays upcoming input, i.e. for error messages
upcomingInput:function () {
var next = this.match;
if (next.length < 20) {
next += this._input.substr(0, 20-next.length);
}
return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition:function () {
var pre = this.pastInput();
var c = new Array(pre.length + 1).join("-");
return pre + this.upcomingInput() + "\n" + c + "^";
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match:function (match, indexed_rule) {
var token,
lines,
backup;
if (this.options.backtrack_lexer) {
// save context
backup = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
};
if (this.options.ranges) {
backup.yylloc.range = this.yylloc.range.slice(0);
}
}
lines = match[0].match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno += lines.length;
}
this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: lines ?
lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
this.yylloc.last_column + match[0].length
};
this.yytext += match[0];
this.match += match[0];
this.matches = match;
this.yyleng = this.yytext.length;
if (this.options.ranges) {
this.yylloc.range = [this.offset, this.offset += this.yyleng];
}
this._more = false;
this._backtrack = false;
this._input = this._input.slice(match[0].length);
this.matched += match[0];
token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
if (this.done && this._input) {
this.done = false;
}
if (token) {
return token;
} else if (this._backtrack) {
// recover context
for (var k in backup) {
this[k] = backup[k];
}
return false; // rule action called reject() implying the next rule should be tested instead.
}
return false;
},
// return next match in input
next:function () {
if (this.done) {
return this.EOF;
}
if (!this._input) {
this.done = true;
}
var token,
match,
tempMatch,
index;
if (!this._more) {
this.yytext = '';
this.match = '';
}
var rules = this._currentRules();
for (var i = 0; i < rules.length; i++) {
tempMatch = this._input.match(this.rules[rules[i]]);
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
match = tempMatch;
index = i;
if (this.options.backtrack_lexer) {
token = this.test_match(tempMatch, rules[i]);
if (token !== false) {
return token;
} else if (this._backtrack) {
match = false;
continue; // rule action called reject() implying a rule MISmatch.
} else {
// else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
return false;
}
} else if (!this.options.flex) {
break;
}
}
}
if (match) {
token = this.test_match(match, rules[index]);
if (token !== false) {
return token;
}
// else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
return false;
}
if (this._input === "") {
return this.EOF;
} else {
return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
},
// return next match that has a token
lex:function lex() {
var r = this.next();
if (r) {
return r;
} else {
return this.lex();
}
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin:function begin(condition) {
this.conditionStack.push(condition);
},
// pop the previously active lexer condition state off the condition stack
popState:function popState() {
var n = this.conditionStack.length - 1;
if (n > 0) {
return this.conditionStack.pop();
} else {
return this.conditionStack[0];
}
},
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules:function _currentRules() {
if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
} else {
return this.conditions["INITIAL"].rules;
}
},
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState:function topState(n) {
n = this.conditionStack.length - 1 - Math.abs(n || 0);
if (n >= 0) {
return this.conditionStack[n];
} else {
return "INITIAL";
}
},
// alias for begin(condition)
pushState:function pushState(condition) {
this.begin(condition);
},
// return the number of states currently on the stack
stateStackSize:function stateStackSize() {
return this.conditionStack.length;
},
options: {},
performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
var YYSTATE=YY_START;
switch($avoiding_name_collisions) {
case 0:this.pushState('code');return 5;
break;
case 1:return 43;
break;
case 2:return 44;
break;
case 3:return 45;
break;
case 4:return 46;
break;
case 5:return 47;
break;
case 6:/* skip whitespace */
break;
case 7:/* skip comment */
break;
case 8:/* skip comment */
break;
case 9:yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 40;
break;
case 10:return 41;
break;
case 11:yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 42;
break;
case 12:yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 42;
break;
case 13:return 28;
break;
case 14:return 30;
break;
case 15:return 31;
break;
case 16:this.pushState(ebnf ? 'ebnf' : 'bnf'); return 5;
break;
case 17:if (!yy.options) yy.options = {}; ebnf = yy.options.ebnf = true;
break;
case 18:return 48;
break;
case 19:return 11;
break;
case 20:return 22;
break;
case 21:return 23;
break;
case 22:return 24;
break;
case 23:return 20;
break;
case 24:return 18;
break;
case 25:return 13;
break;
case 26:/* ignore unrecognized decl */
break;
case 27:/* ignore type */
break;
case 28:yy_.yytext = yy_.yytext.substr(2, yy_.yyleng-4); return 15;
break;
case 29:yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length-4); return 15;
break;
case 30:yy.depth = 0; this.pushState('action'); return 49;
break;
case 31:yy_.yytext = yy_.yytext.substr(2, yy_.yyleng-2); return 52;
break;
case 32:/* ignore bad characters */
break;
case 33:return 8;
break;
case 34:return 54;
break;
case 35:return 54;
break;
case 36:return 54; // regexp with braces or quotes (and no spaces)
break;
case 37:return 54;
break;
case 38:return 54;
break;
case 39:return 54;
break;
case 40:return 54;
break;
case 41:yy.depth++; return 49;
break;
case 42:if (yy.depth==0) this.begin(ebnf ? 'ebnf' : 'bnf'); else yy.depth--; return 51;
break;
case 43:return 9;
break;
}
},
rules: [/^(?:%%)/,/^(?:\()/,/^(?:\))/,/^(?:\*)/,/^(?:\?)/,/^(?:\+)/,/^(?:\s+)/,/^(?:\/\/.*)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\[([a-zA-Z][a-zA-Z0-9_-]*)\])/,/^(?:([a-zA-Z][a-zA-Z0-9_-]*))/,/^(?:"[^"]+")/,/^(?:'[^']+')/,/^(?::)/,/^(?:;)/,/^(?:\|)/,/^(?:%%)/,/^(?:%ebnf\b)/,/^(?:%prec\b)/,/^(?:%start\b)/,/^(?:%left\b)/,/^(?:%right\b)/,/^(?:%nonassoc\b)/,/^(?:%parse-param\b)/,/^(?:%options\b)/,/^(?:%lex[\w\W]*?\/lex\b)/,/^(?:%[a-zA-Z]+[^\r\n]*)/,/^(?:<[a-zA-Z]*>)/,/^(?:\{\{[\w\W]*?\}\})/,/^(?:%\{(.|\r|\n)*?%\})/,/^(?:\{)/,/^(?:->.*)/,/^(?:.)/,/^(?:$)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:(.|\n|\r)+)/],
conditions: {"bnf":{"rules":[0,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33],"inclusive":true},"ebnf":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33],"inclusive":true},"action":{"rules":[33,34,35,36,37,38,39,40,41,42],"inclusive":false},"code":{"rules":[33,43],"inclusive":false},"INITIAL":{"rules":[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33],"inclusive":true}}
};
return lexer;
})();
parser.lexer = lexer;
function Parser () {
this.yy = {};
}
Parser.prototype = parser;parser.Parser = Parser;
return new Parser;
})();
if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
exports.parser = bnf;
exports.Parser = bnf.Parser;
exports.parse = function () { return bnf.parse.apply(bnf, arguments); };
exports.main = function commonjsMain(args) {
if (!args[1]) {
console.log('Usage: '+args[0]+' FILE');
process.exit(1);
}
var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8");
return exports.parser.parse(source);
};
if (typeof module !== 'undefined' && require.main === module) {
exports.main(process.argv.slice(1));
}
}

View file

@ -1,9 +0,0 @@
#!/usr/bin/env narwhal
//exports.testBNF = require("./bnf");
exports.testBNFParse = require("./bnf_parse");
exports.testEBNF = require("./ebnf");
exports.testEBNFParse = require("./ebnf_parse");
if (require.main === module)
require("test").run(exports);

View file

@ -1,91 +0,0 @@
var Jison = require("../setup").Jison,
Lexer = require("../setup").Lexer,
assert = require("assert");
exports["test BNF parser"] = function () {
var grammar = {
"lex": {
"rules": [
["\\s+", "/* skip whitespace */"],
["[a-zA-Z][a-zA-Z0-9_-]*", "return 'ID';"],
["\"[^\"]+\"", "yytext = yytext.substr(1, yyleng-2); return 'STRING';"],
["'[^']+'", "yytext = yytext.substr(1, yyleng-2); return 'STRING';"],
[":", "return ':';"],
[";", "return ';';"],
["\\|", "return '|';"],
["%%", "return '%%';"],
["%prec", "return 'PREC';"],
["%start", "return 'START';"],
["%left", "return 'LEFT';"],
["%right", "return 'RIGHT';"],
["%nonassoc", "return 'NONASSOC';"],
["\\{[^}]*\\}", "yytext = yytext.substr(1, yyleng-2); return 'ACTION';"],
[".", "/* ignore bad characters */"],
["$", "return 'EOF';"]
]
},
"bnf": {
"spec" :[[ "declaration_list %% grammar EOF", "$$ = $1; $$.bnf = $3; return $$;" ]],
"declaration_list" :[[ "declaration_list declaration", "$$ = $1; yy.addDeclaration($$, $2);" ],
[ "", "$$ = {};" ]],
"declaration" :[[ "START id", "$$ = {start: $2};" ],
[ "operator", "$$ = {operator: $1};" ]],
"operator" :[[ "associativity token_list", "$$ = [$1]; $$.push.apply($$, $2);" ]],
"associativity" :[[ "LEFT", "$$ = 'left';" ],
[ "RIGHT", "$$ = 'right';" ],
[ "NONASSOC", "$$ = 'nonassoc';" ]],
"token_list" :[[ "token_list symbol", "$$ = $1; $$.push($2);" ],
[ "symbol", "$$ = [$1];" ]],
"grammar" :[[ "production_list", "$$ = $1;" ]],
"production_list" :[[ "production_list production", "$$ = $1; $$[$2[0]] = $2[1];" ],
[ "production", "$$ = {}; $$[$1[0]] = $1[1];" ]],
"production" :[[ "id : handle_list ;", "$$ = [$1, $3];" ]],
"handle_list" :[[ "handle_list | handle_action", "$$ = $1; $$.push($3);" ],
[ "handle_action", "$$ = [$1];" ]],
"handle_action" :[[ "handle action prec", "$$ = [($1.length ? $1.join(' ') : '')]; if($2) $$.push($2); if($3) $$.push($3); if ($$.length === 1) $$ = $$[0];" ]],
"handle" :[[ "handle symbol", "$$ = $1; $$.push($2)" ],
[ "", "$$ = [];" ]],
"prec" :[[ "PREC symbol", "$$ = {prec: $2};" ],
[ "", "$$ = null;" ]],
"symbol" :[[ "id", "$$ = $1;" ],
[ "STRING", "$$ = yytext;" ]],
"id" :[[ "ID", "$$ = yytext;" ]],
"action" :[[ "ACTION", "$$ = yytext;" ],
[ "", "$$ = '';" ]]
}
};
var parser = new Jison.Parser(grammar);
parser.yy.addDeclaration = function (grammar, decl) {
if (decl.start) {
grammar.start = decl.start
}
if (decl.operator) {
if (!grammar.operators) {
grammar.operators = [];
}
grammar.operators.push(decl.operator);
}
};
var result = parser.parse('%start foo %left "+" "-" %right "*" "/" %nonassoc "=" STUFF %left UMINUS %% foo : bar baz blitz { stuff } %prec GEMINI | bar %prec UMINUS | ;\nbar: { things };\nbaz: | foo ;');
assert.ok(result, "parse bnf production");
};

View file

@ -1,221 +0,0 @@
var assert = require("assert"),
bnf = require("../ebnf-parser");
exports["test basic grammar"] = function () {
var grammar = "%% test: foo bar | baz ; hello: world ;";
var expected = {bnf: {test: ["foo bar", "baz"], hello: ["world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test multiple same rule"] = function () {
var grammar = "%% test: foo bar | baz ; test: world ;";
var expected = {bnf: {test: ["foo bar", "baz", "world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test classy grammar"] = function () {
var grammar = "%%\n\npgm \n: cdl MAIN LBRACE vdl el RBRACE ENDOFFILE \n; cdl \n: c cdl \n| \n;";
var expected = {bnf: {pgm: ["cdl MAIN LBRACE vdl el RBRACE ENDOFFILE"], cdl: ["c cdl", ""]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test advanced grammar"] = function () {
var grammar = "%% test: foo bar {action} | baz ; hello: world %prec UMINUS ;extra: foo %prec '-' {action} ;";
var expected = {bnf: {test: [["foo bar", "action" ], "baz"], hello: [[ "world", {prec:"UMINUS"} ]], extra: [[ "foo", "action", {prec: "-"} ]]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test nullable rule"] = function () {
var grammar = "%% test: foo bar | ; hello: world ;";
var expected = {bnf: {test: ["foo bar", ""], hello: ["world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test nullable rule with action"] = function () {
var grammar = "%% test: foo bar | {action}; hello: world ;";
var expected = {bnf: {test: ["foo bar", [ "", "action" ]], hello: ["world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test nullable rule with %{ %} delimited action"] = function () {
var grammar = "%% test: foo bar | %{action{}%}; hello: world ;";
var expected = {bnf: {test: ["foo bar", [ "", "action{}" ]], hello: ["world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test nullable rule with {{ }} delimited action"] = function () {
var grammar = "%% test: foo bar | {{action{};}}; hello: world ;";
var expected = {bnf: {test: ["foo bar", [ "", "action{};" ]], hello: ["world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test rule with {{ }} delimited action"] = function () {
var grammar = "%% test: foo bar {{ node({}, node({})); }}; hello: world ;";
var expected = {bnf: {test: [["foo bar"," node({}, node({})); " ]], hello: ["world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test comment"] = function () {
var grammar = "/* comment */ %% hello: world ;";
var expected = {bnf: {hello: ["world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test single line comment"] = function () {
var grammar = "//comment \n %% hello: world ;";
var expected = {bnf: {hello: ["world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parse comment");
};
exports["test comment with nested *"] = function () {
var grammar = "/* comment * not done */ %% hello: /* oh hai */ world ;";
var expected = {bnf: {hello: ["world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test token"] = function () {
var grammar = "%token blah\n%% test: foo bar | baz ; hello: world ;";
var expected = {bnf: {test: ["foo bar", "baz"], hello: ["world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test token with type"] = function () {
var grammar = "%type <type> blah\n%% test: foo bar | baz ; hello: world ;";
var expected = {bnf: {test: ["foo bar", "baz"], hello: ["world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test embedded lexical block"] = function () {
var grammar = "%lex \n%%\n'foo' return 'foo';\n'bar' {return 'bar';}\n'baz' {return 'baz';}\n'world' {return 'world';}\n/lex\
%% test: foo bar | baz ; hello: world ;";
var expected = {
lex: {
rules: [
["foo\\b", "return 'foo';"],
["bar\\b", "return 'bar';"],
["baz\\b", "return 'baz';"],
["world\\b", "return 'world';"]
]
},
bnf: {test: ["foo bar", "baz"], hello: ["world"]}
};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test balanced braces"] = function () {
var grammar = "%% test: foo bar { node({}, node({foo:'bar'})); }; hello: world ;";
var expected = {bnf: {test: [["foo bar"," node({}, node({foo:'bar'})); " ]], hello: ["world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test brace within a multi-line comment"] = function () {
var grammar = "%% test: foo bar { node({}, 3 / 4); /* { */ }; hello: world ;";
var expected = {bnf: {test: [["foo bar"," node({}, 3 / 4); /* { */ " ]], hello: ["world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test brace within a single-line comment"] = function () {
var grammar = "%% test: foo bar { node({}); // {\n }; hello: world ;";
var expected = {bnf: {test: [["foo bar"," node({}); // {\n " ]], hello: ["world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test brace within a string"] = function () {
var grammar = "%% test: foo bar { node({}, 3 / 4, '{'); /* { */ }; hello: world ;";
var expected = {bnf: {test: [["foo bar"," node({}, 3 / 4, '{'); /* { */ " ]], hello: ["world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test brace within a string with double quotes"] = function () {
var grammar = "%% test: foo bar { node({}, 3 / 4, \"{\"); /* { */ }; hello: world ;";
var expected = {bnf: {test: [["foo bar"," node({}, 3 / 4, \"{\"); /* { */ " ]], hello: ["world"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test uneven braces and quotes within regex"] = function () {
var grammar = "%% test: foo bar { node({}, 3 / 4, \"{\"); /{'\"/g; 1 / 2; }; hello: world { blah / bah };";
var expected = {bnf: {test: [["foo bar"," node({}, 3 / 4, \"{\"); /{'\"/g; 1 / 2; " ]], hello: [["world", " blah / bah "]]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test code declaration"] = function () {
var grammar = "%{var foo = 'bar';%}\n%%hello: world;";
var expected = {bnf: {hello: ["world"]}, moduleInclude: "var foo = 'bar';"};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test remainder code"] = function () {
var grammar = "%%hello: world;%%var foo = 'bar';";
var expected = {bnf: {hello: ["world"]}, moduleInclude: "var foo = 'bar';"};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test remainder and declarations code"] = function () {
var grammar = "%{test;%}\n%%hello: world;%%var foo = 'bar';";
var expected = {bnf: {hello: ["world"]}, moduleInclude: "test;var foo = 'bar';"};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test expression action"] = function () {
var grammar = "%% test: foo bar -> $foo\n;";
var expected = {bnf: {test: [["foo bar","$$ = $foo;"]]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test quote in rule"] = function () {
var grammar = "%lex\n%%\n\\' return \"'\"\n/lex\n%% test: foo bar \"'\";";
var expected = {lex: {
rules: [
["'", "return \"'\""]
]
},
bnf: {test: ["foo bar '"]}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test windows line endings"] = function () {
var grammar = "%{baz\r\n%}%% test: foo bar | {\r\naction;\r\nhi};\r\nhello: world ;%%foo;\r\nbar;";
var expected = {bnf: {test: ["foo bar", [ "", "\r\naction;\r\nhi" ]], hello: ["world"]}, moduleInclude: 'baz\r\nfoo;\r\nbar;'};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test parse params"] = function () {
var grammar = "%parse-param first second\n%%hello: world;%%";
var expected = {bnf: {hello: ["world"]}, parseParams: ["first", "second"]};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};
exports["test options"] = function () {
var grammar = "%options one two\n%%hello: world;%%";
var expected = {bnf: {hello: ["world"]}, options: {one: true, two: true}};
assert.deepEqual(bnf.parse(grammar), expected, "grammar should be parsed correctly");
};

View file

@ -1,105 +0,0 @@
var assert = require("assert"),
ebnf = require("../ebnf-transform");
var Parser = require('jison').Parser;
function testParse(top, strings) {
return function() {
var grammar = {
"lex": {
"rules": [
["\\s+", ''],
["[A-Za-z]+", "return 'word';"],
[",", "return ',';"],
["$", "return 'EOF';"]
]
},
"start": "top",
"bnf": ebnf.transform({"top": [top]})
};
strings = (typeof(strings) === 'string' ? [strings] : strings);
strings.forEach(function(string) {
assert.ok(new Parser(grammar).parse(string));
});
};
}
function testBadParse(top, strings) {
return function() {
var grammar = {
"lex": {
"rules": [
["\\s+", ''],
["[A-Za-z]+", "return 'word';"],
[",", "return ',';"],
["$", "return 'EOF';"]
]
},
"start": "top",
"ebnf": {"top": [top]}
};
strings = (typeof(strings) === 'string' ? [strings] : strings);
strings.forEach(function(string) {
assert.throws(function () {new Parser(grammar).parse(string);})
});
};
}
function testAlias(top, obj, str) {
return function() {
var grammar = {
"lex": {
"rules": [
["\\s+", ''],
["[A-Za-z]+", "return 'word';"],
[",", "return ',';"],
["$", "return 'EOF';"]
]
},
"start": "top",
"bnf": ebnf.transform({"top": [top]})
};
assert.deepEqual(grammar['bnf'], obj);
assert.ok(new Parser(grammar).parse(str));
};
}
var tests = {
"test idempotent transform": function() {
var first = {
"nodelist": [["", "$$ = [];"], ["nodelist node", "$1.push($2);"]]
};
var second = ebnf.transform(JSON.parse(JSON.stringify(first)));
assert.deepEqual(second, first);
},
"test repeat (*) on empty string": testParse("word* EOF", ""),
"test repeat (*) on single word": testParse("word* EOF", "oneword"),
"test repeat (*) on multiple words": testParse("word* EOF", "multiple words"),
"test repeat (+) on empty string": testBadParse("word+ EOF", ""),
"test repeat (+) on single word": testParse("word+ EOF", "oneword"),
"test repeat (+) on multiple words": testParse("word+ EOF", "multiple words"),
"test option (?) on empty string": testParse("word? EOF", ""),
"test option (?) on single word": testParse("word? EOF", "oneword"),
"test group () on simple phrase": testParse("(word word) EOF", "two words"),
"test group () with multiple options on first option": testParse("((word word) | word) EOF", "hi there"),
"test group () with multiple options on second option": testParse("((word word) | word) EOF", "hi"),
"test complex expression ( *, ?, () )": testParse("(word (',' word)*)? EOF ", ["", "hi", "hi, there"]),
"test named repeat (*)": testAlias("word*[bob] EOF",
{ top: [ 'bob EOF' ],
bob: [ [ '', '$$ = [];' ], [ 'bob word', '$1.push($2);' ] ] }, "word"),
"test named repeat (+)": testAlias("word+[bob] EOF",
{ top: [ 'bob EOF' ],
bob: [ [ 'word', '$$ = [$1];' ], [ 'bob word', '$1.push($2);' ] ] }, "wordy word"),
"test named group ()": testAlias("word[alice] (',' word)*[bob] EOF",
{"top":["word[alice] bob EOF"],"bob":[["","$$ = [];"],["bob , word","$1.push($2);"]]},
"one, two"),
"test named option (?)": testAlias("word[alex] word?[bob] EOF", { top: [ 'word[alex] bob EOF' ], bob: [ '', 'word' ] }, "oneor two"),
"test named complex expression (())": testAlias("word[alpha] (word[alex] (word[bob] word[carol] ',')+[david] word ',')*[enoch] EOF",
{"top":["word[alpha] enoch EOF"],"david":[["word[bob] word[carol] ,","$$ = [$1];"],["david word[bob] word[carol] ,","$1.push($2);"]],
"enoch":[["","$$ = [];"],["enoch word[alex] david word ,","$1.push($2);"]]},
"one two three four, five,"
)
};
for (var test in tests) {
exports[test] = tests[test];
}

View file

@ -1,38 +0,0 @@
var assert = require("assert"),
bnf = require("../ebnf-parser"),
ebnf = require("../ebnf-transform");
function testParse(top, strings) {
return function() {
var expected = {
"bnf": ebnf.transform({"top": [top]})
};
var grammar = "%ebnf\n%%\ntop : "+top+";";
assert.deepEqual(bnf.parse(grammar), expected);
};
}
var tests = {
"test idempotent transform": function() {
var first = {
"nodelist": [["", "$$ = [];"], ["nodelist node", "$1.push($2);"]]
};
var second = ebnf.transform(JSON.parse(JSON.stringify(first)));
assert.deepEqual(second, first);
},
"test repeat (*) on empty string": testParse("word* EOF", ""),
"test repeat (*) on single word": testParse("word* EOF", "oneword"),
"test repeat (*) on multiple words": testParse("word* EOF", "multiple words"),
"test repeat (+) on single word": testParse("word+ EOF", "oneword"),
"test repeat (+) on multiple words": testParse("word+ EOF", "multiple words"),
"test option (?) on empty string": testParse("word? EOF", ""),
"test option (?) on single word": testParse("word? EOF", "oneword"),
"test group () on simple phrase": testParse("(word word) EOF", "two words"),
"test group () with multiple options on first option": testParse("((word word) | word) EOF", "hi there"),
"test group () with multiple options on second option": testParse("((word word) | word) EOF", "hi"),
"test complex expression ( *, ?, () )": testParse("(word (',' word)*)? EOF", ["", "hi", "hi, there"])
};
for (var test in tests) {
exports[test] = tests[test];
}

View file

@ -1,629 +0,0 @@
/* parser generated by jison 0.4.11 */
/*
Returns a Parser object of the following structure:
Parser: {
yy: {}
}
Parser.prototype: {
yy: {},
trace: function(),
symbols_: {associative list: name ==> number},
terminals_: {associative list: number ==> name},
productions_: [...],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
table: [...],
defaultActions: {...},
parseError: function(str, hash),
parse: function(input),
lexer: {
EOF: 1,
parseError: function(str, hash),
setInput: function(input),
input: function(),
unput: function(str),
more: function(),
less: function(n),
pastInput: function(),
upcomingInput: function(),
showPosition: function(),
test_match: function(regex_match_array, rule_index),
next: function(),
lex: function(),
begin: function(condition),
popState: function(),
_currentRules: function(),
topState: function(),
pushState: function(condition),
options: {
ranges: boolean (optional: true ==> token location info will include a .range[] member)
flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
},
performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
rules: [...],
conditions: {associative list: name ==> set},
}
}
token location info (@$, _$, etc.): {
first_line: n,
last_line: n,
first_column: n,
last_column: n,
range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
}
the parseError function receives a 'hash' object with these members for lexer and parser errors: {
text: (matched text)
token: (the produced terminal token, if any)
line: (yylineno)
}
while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
loc: (yylloc)
expected: (string describing the set of expected tokens)
recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
}
*/
var ebnf = (function(){
var parser = {trace: function trace() { },
yy: {},
symbols_: {"error":2,"production":3,"handle":4,"EOF":5,"handle_list":6,"|":7,"expression_suffix":8,"expression":9,"suffix":10,"ALIAS":11,"symbol":12,"(":13,")":14,"*":15,"?":16,"+":17,"$accept":0,"$end":1},
terminals_: {2:"error",5:"EOF",7:"|",11:"ALIAS",12:"symbol",13:"(",14:")",15:"*",16:"?",17:"+"},
productions_: [0,[3,2],[6,1],[6,3],[4,0],[4,2],[8,3],[8,2],[9,1],[9,3],[10,0],[10,1],[10,1],[10,1]],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
/* this == yyval */
var $0 = $$.length - 1;
switch (yystate) {
case 1: return $$[$0-1];
break;
case 2: this.$ = [$$[$0]];
break;
case 3: $$[$0-2].push($$[$0]);
break;
case 4: this.$ = [];
break;
case 5: $$[$0-1].push($$[$0]);
break;
case 6: this.$ = ['xalias', $$[$0-1], $$[$0-2], $$[$0]];
break;
case 7: if ($$[$0]) this.$ = [$$[$0], $$[$0-1]]; else this.$ = $$[$0-1];
break;
case 8: this.$ = ['symbol', $$[$0]];
break;
case 9: this.$ = ['()', $$[$0-1]];
break;
}
},
table: [{3:1,4:2,5:[2,4],12:[2,4],13:[2,4]},{1:[3]},{5:[1,3],8:4,9:5,12:[1,6],13:[1,7]},{1:[2,1]},{5:[2,5],7:[2,5],12:[2,5],13:[2,5],14:[2,5]},{5:[2,10],7:[2,10],10:8,11:[2,10],12:[2,10],13:[2,10],14:[2,10],15:[1,9],16:[1,10],17:[1,11]},{5:[2,8],7:[2,8],11:[2,8],12:[2,8],13:[2,8],14:[2,8],15:[2,8],16:[2,8],17:[2,8]},{4:13,6:12,7:[2,4],12:[2,4],13:[2,4],14:[2,4]},{5:[2,7],7:[2,7],11:[1,14],12:[2,7],13:[2,7],14:[2,7]},{5:[2,11],7:[2,11],11:[2,11],12:[2,11],13:[2,11],14:[2,11]},{5:[2,12],7:[2,12],11:[2,12],12:[2,12],13:[2,12],14:[2,12]},{5:[2,13],7:[2,13],11:[2,13],12:[2,13],13:[2,13],14:[2,13]},{7:[1,16],14:[1,15]},{7:[2,2],8:4,9:5,12:[1,6],13:[1,7],14:[2,2]},{5:[2,6],7:[2,6],12:[2,6],13:[2,6],14:[2,6]},{5:[2,9],7:[2,9],11:[2,9],12:[2,9],13:[2,9],14:[2,9],15:[2,9],16:[2,9],17:[2,9]},{4:17,7:[2,4],12:[2,4],13:[2,4],14:[2,4]},{7:[2,3],8:4,9:5,12:[1,6],13:[1,7],14:[2,3]}],
defaultActions: {3:[2,1]},
parseError: function parseError(str, hash) {
if (hash.recoverable) {
this.trace(str);
} else {
throw new Error(str);
}
},
parse: function parse(input) {
var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
var args = lstack.slice.call(arguments, 1);
this.lexer.setInput(input);
this.lexer.yy = this.yy;
this.yy.lexer = this.lexer;
this.yy.parser = this;
if (typeof this.lexer.yylloc == 'undefined') {
this.lexer.yylloc = {};
}
var yyloc = this.lexer.yylloc;
lstack.push(yyloc);
var ranges = this.lexer.options && this.lexer.options.ranges;
if (typeof this.yy.parseError === 'function') {
this.parseError = this.yy.parseError;
} else {
this.parseError = Object.getPrototypeOf(this).parseError;
}
function popStack(n) {
stack.length = stack.length - 2 * n;
vstack.length = vstack.length - n;
lstack.length = lstack.length - n;
}
function lex() {
var token;
token = self.lexer.lex() || EOF;
if (typeof token !== 'number') {
token = self.symbols_[token] || token;
}
return token;
}
var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
while (true) {
state = stack[stack.length - 1];
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol === null || typeof symbol == 'undefined') {
symbol = lex();
}
action = table[state] && table[state][symbol];
}
if (typeof action === 'undefined' || !action.length || !action[0]) {
var errStr = '';
expected = [];
for (p in table[state]) {
if (this.terminals_[p] && p > TERROR) {
expected.push('\'' + this.terminals_[p] + '\'');
}
}
if (this.lexer.showPosition) {
errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + this.lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
} else {
errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
}
this.parseError(errStr, {
text: this.lexer.match,
token: this.terminals_[symbol] || symbol,
line: this.lexer.yylineno,
loc: yyloc,
expected: expected
});
}
if (action[0] instanceof Array && action.length > 1) {
throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
}
switch (action[0]) {
case 1:
stack.push(symbol);
vstack.push(this.lexer.yytext);
lstack.push(this.lexer.yylloc);
stack.push(action[1]);
symbol = null;
if (!preErrorSymbol) {
yyleng = this.lexer.yyleng;
yytext = this.lexer.yytext;
yylineno = this.lexer.yylineno;
yyloc = this.lexer.yylloc;
if (recovering > 0) {
recovering--;
}
} else {
symbol = preErrorSymbol;
preErrorSymbol = null;
}
break;
case 2:
len = this.productions_[action[1]][1];
yyval.$ = vstack[vstack.length - len];
yyval._$ = {
first_line: lstack[lstack.length - (len || 1)].first_line,
last_line: lstack[lstack.length - 1].last_line,
first_column: lstack[lstack.length - (len || 1)].first_column,
last_column: lstack[lstack.length - 1].last_column
};
if (ranges) {
yyval._$.range = [
lstack[lstack.length - (len || 1)].range[0],
lstack[lstack.length - 1].range[1]
];
}
r = this.performAction.apply(yyval, [
yytext,
yyleng,
yylineno,
this.yy,
action[1],
vstack,
lstack
].concat(args));
if (typeof r !== 'undefined') {
return r;
}
if (len) {
stack = stack.slice(0, -1 * len * 2);
vstack = vstack.slice(0, -1 * len);
lstack = lstack.slice(0, -1 * len);
}
stack.push(this.productions_[action[1]][0]);
vstack.push(yyval.$);
lstack.push(yyval._$);
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
stack.push(newState);
break;
case 3:
return true;
}
}
return true;
}};
/* generated by jison-lex 0.2.1 */
var lexer = (function(){
var lexer = {
EOF:1,
parseError:function parseError(str, hash) {
if (this.yy.parser) {
this.yy.parser.parseError(str, hash);
} else {
throw new Error(str);
}
},
// resets the lexer, sets new input
setInput:function (input) {
this._input = input;
this._more = this._backtrack = this.done = false;
this.yylineno = this.yyleng = 0;
this.yytext = this.matched = this.match = '';
this.conditionStack = ['INITIAL'];
this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
};
if (this.options.ranges) {
this.yylloc.range = [0,0];
}
this.offset = 0;
return this;
},
// consumes and returns one char from the input
input:function () {
var ch = this._input[0];
this.yytext += ch;
this.yyleng++;
this.offset++;
this.match += ch;
this.matched += ch;
var lines = ch.match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno++;
this.yylloc.last_line++;
} else {
this.yylloc.last_column++;
}
if (this.options.ranges) {
this.yylloc.range[1]++;
}
this._input = this._input.slice(1);
return ch;
},
// unshifts one char (or a string) into the input
unput:function (ch) {
var len = ch.length;
var lines = ch.split(/(?:\r\n?|\n)/g);
this._input = ch + this._input;
this.yytext = this.yytext.substr(0, this.yytext.length - len - 1);
//this.yyleng -= len;
this.offset -= len;
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1);
this.matched = this.matched.substr(0, this.matched.length - 1);
if (lines.length - 1) {
this.yylineno -= lines.length - 1;
}
var r = this.yylloc.range;
this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: lines ?
(lines.length === oldLines.length ? this.yylloc.first_column : 0)
+ oldLines[oldLines.length - lines.length].length - lines[0].length :
this.yylloc.first_column - len
};
if (this.options.ranges) {
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
}
this.yyleng = this.yytext.length;
return this;
},
// When called from action, caches matched text and appends it on next action
more:function () {
this._more = true;
return this;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject:function () {
if (this.options.backtrack_lexer) {
this._backtrack = true;
} else {
return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
return this;
},
// retain first n characters of the match
less:function (n) {
this.unput(this.match.slice(n));
},
// displays already matched input, i.e. for error messages
pastInput:function () {
var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
},
// displays upcoming input, i.e. for error messages
upcomingInput:function () {
var next = this.match;
if (next.length < 20) {
next += this._input.substr(0, 20-next.length);
}
return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition:function () {
var pre = this.pastInput();
var c = new Array(pre.length + 1).join("-");
return pre + this.upcomingInput() + "\n" + c + "^";
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match:function (match, indexed_rule) {
var token,
lines,
backup;
if (this.options.backtrack_lexer) {
// save context
backup = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
};
if (this.options.ranges) {
backup.yylloc.range = this.yylloc.range.slice(0);
}
}
lines = match[0].match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno += lines.length;
}
this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: lines ?
lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
this.yylloc.last_column + match[0].length
};
this.yytext += match[0];
this.match += match[0];
this.matches = match;
this.yyleng = this.yytext.length;
if (this.options.ranges) {
this.yylloc.range = [this.offset, this.offset += this.yyleng];
}
this._more = false;
this._backtrack = false;
this._input = this._input.slice(match[0].length);
this.matched += match[0];
token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
if (this.done && this._input) {
this.done = false;
}
if (token) {
return token;
} else if (this._backtrack) {
// recover context
for (var k in backup) {
this[k] = backup[k];
}
return false; // rule action called reject() implying the next rule should be tested instead.
}
return false;
},
// return next match in input
next:function () {
if (this.done) {
return this.EOF;
}
if (!this._input) {
this.done = true;
}
var token,
match,
tempMatch,
index;
if (!this._more) {
this.yytext = '';
this.match = '';
}
var rules = this._currentRules();
for (var i = 0; i < rules.length; i++) {
tempMatch = this._input.match(this.rules[rules[i]]);
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
match = tempMatch;
index = i;
if (this.options.backtrack_lexer) {
token = this.test_match(tempMatch, rules[i]);
if (token !== false) {
return token;
} else if (this._backtrack) {
match = false;
continue; // rule action called reject() implying a rule MISmatch.
} else {
// else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
return false;
}
} else if (!this.options.flex) {
break;
}
}
}
if (match) {
token = this.test_match(match, rules[index]);
if (token !== false) {
return token;
}
// else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
return false;
}
if (this._input === "") {
return this.EOF;
} else {
return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
},
// return next match that has a token
lex:function lex() {
var r = this.next();
if (r) {
return r;
} else {
return this.lex();
}
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin:function begin(condition) {
this.conditionStack.push(condition);
},
// pop the previously active lexer condition state off the condition stack
popState:function popState() {
var n = this.conditionStack.length - 1;
if (n > 0) {
return this.conditionStack.pop();
} else {
return this.conditionStack[0];
}
},
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules:function _currentRules() {
if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
} else {
return this.conditions["INITIAL"].rules;
}
},
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState:function topState(n) {
n = this.conditionStack.length - 1 - Math.abs(n || 0);
if (n >= 0) {
return this.conditionStack[n];
} else {
return "INITIAL";
}
},
// alias for begin(condition)
pushState:function pushState(condition) {
this.begin(condition);
},
// return the number of states currently on the stack
stateStackSize:function stateStackSize() {
return this.conditionStack.length;
},
options: {},
performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
var YYSTATE=YY_START;
switch($avoiding_name_collisions) {
case 0:/* skip whitespace */
break;
case 1:return 12;
break;
case 2:yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 11;
break;
case 3:return 12;
break;
case 4:return 12;
break;
case 5:return 'bar';
break;
case 6:return 13;
break;
case 7:return 14;
break;
case 8:return 15;
break;
case 9:return 16;
break;
case 10:return 7;
break;
case 11:return 17;
break;
case 12:return 5;
break;
}
},
rules: [/^(?:\s+)/,/^(?:([a-zA-Z][a-zA-Z0-9_-]*))/,/^(?:\[([a-zA-Z][a-zA-Z0-9_-]*)\])/,/^(?:'[^']*')/,/^(?:\.)/,/^(?:bar\b)/,/^(?:\()/,/^(?:\))/,/^(?:\*)/,/^(?:\?)/,/^(?:\|)/,/^(?:\+)/,/^(?:$)/],
conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12],"inclusive":true}}
};
return lexer;
})();
parser.lexer = lexer;
function Parser () {
this.yy = {};
}
Parser.prototype = parser;parser.Parser = Parser;
return new Parser;
})();
if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
exports.parser = ebnf;
exports.Parser = ebnf.Parser;
exports.parse = function () { return ebnf.parse.apply(ebnf, arguments); };
exports.main = function commonjsMain(args) {
if (!args[1]) {
console.log('Usage: '+args[0]+' FILE');
process.exit(1);
}
var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8");
return exports.parser.parse(source);
};
if (typeof module !== 'undefined' && require.main === module) {
exports.main(process.argv.slice(1));
}
}

2
node_modules/lex-parser/.npmignore generated vendored
View file

@ -1,2 +0,0 @@
lex.y
lex.l

22
node_modules/lex-parser/Makefile generated vendored
View file

@ -1,22 +0,0 @@
all: install build test
install:
npm install
build:
node ./node_modules/.bin/jison lex.y lex.l
mv lex.js lex-parser.js
test:
node tests/all-tests.js
clean:
superclean: clean
-find . -type d -name 'node_modules' -exec rm -rf "{}" \;

111
node_modules/lex-parser/README.md generated vendored
View file

@ -1,111 +0,0 @@
# lex-parser
A parser for lexical grammars used by [jison](http://jison.org) and jison-lex.
## install
npm install lex-parser
## build
To build the parser yourself, clone the git repo then run:
make
This will generate `lex-parser.js`.
## usage
var lexParser = require("lex-parser");
// parse a lexical grammar and return JSON
lexParser.parse("%% ... ");
## example
The parser can parse its own lexical grammar, shown below:
NAME [a-zA-Z_][a-zA-Z0-9_-]*
%s indented trail rules
%x code start_condition options conditions action
%%
<action>[^{}]+ return 'ACTION_BODY'
<action>"{" yy.depth++; return '{'
<action>"}" yy.depth == 0 ? this.begin('trail') : yy.depth--; return '}'
<conditions>{NAME} return 'NAME'
<conditions>">" this.popState(); return '>'
<conditions>"," return ','
<conditions>"*" return '*'
<rules>\n+ /* */
<rules>\s+ this.begin('indented')
<rules>"%%" this.begin('code'); return '%%'
<rules>[a-zA-Z0-9_]+ return 'CHARACTER_LIT'
<options>{NAME} yy.options[yytext] = true
<options>\n+ this.begin('INITIAL')
<options>\s+\n+ this.begin('INITIAL')
<options>\s+ /* empty */
<start_condition>{NAME} return 'START_COND'
<start_condition>\n+ this.begin('INITIAL')
<start_condition>\s+\n+ this.begin('INITIAL')
<start_condition>\s+ /* empty */
<trail>.*\n+ this.begin('rules')
<indented>"{" yy.depth = 0; this.begin('action'); return '{'
<indented>"%{"(.|\n)*?"%}" this.begin('trail'); yytext = yytext.substr(2, yytext.length-4);return 'ACTION'
"%{"(.|\n)*?"%}" yytext = yytext.substr(2, yytext.length-4); return 'ACTION'
<indented>.+ this.begin('rules'); return 'ACTION'
"/*"(.|\n|\r)*?"*/" /* ignore */
"//".* /* ignore */
\n+ /* */
\s+ /* */
{NAME} return 'NAME'
\"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"');return 'STRING_LIT'
"'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'");return 'STRING_LIT'
"|" return '|'
"["("\\\\"|"\]"|[^\]])*"]" return 'ANY_GROUP_REGEX'
"(?:" return 'SPECIAL_GROUP'
"(?=" return 'SPECIAL_GROUP'
"(?!" return 'SPECIAL_GROUP'
"(" return '('
")" return ')'
"+" return '+'
"*" return '*'
"?" return '?'
"^" return '^'
"," return ','
"<<EOF>>" return '$'
"<" this.begin('conditions'); return '<'
"/!" return '/!'
"/" return '/'
"\\"([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|"c"[A-Z]|"x"[0-9A-F]{2}|"u"[a-fA-F0-9]{4}) return 'ESCAPE_CHAR'
"\\". yytext = yytext.replace(/^\\/g,''); return 'ESCAPE_CHAR'
"$" return '$'
"." return '.'
"%options" yy.options = {}; this.begin('options')
"%s" this.begin('start_condition');return 'START_INC'
"%x" this.begin('start_condition');return 'START_EXC'
"%%" this.begin('rules'); return '%%'
"{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX'
"{"{NAME}"}" return 'NAME_BRACE'
"{" return '{'
"}" return '}'
. /* ignore bad characters */
<*><<EOF>> return 'EOF'
<code>(.|\n)+ return 'CODE'
%%
## license
MIT

851
node_modules/lex-parser/lex-parser.js generated vendored

File diff suppressed because one or more lines are too long

25
node_modules/lex-parser/package.json generated vendored
View file

@ -1,25 +0,0 @@
{
"name": "lex-parser",
"version": "0.1.4",
"description": "A parser for lexical grammars used by jison",
"main": "lex-parser.js",
"scripts": {
"test": "make test"
},
"repository": {
"type": "git",
"repository": "https://github.com/zaach/lex-parser.git"
},
"keywords": [
"lexical",
"grammar",
"parser",
"jison"
],
"author": "Zach Carter",
"license": "MIT",
"devDependencies": {
"jison": "0.4.x",
"test": "*"
}
}

View file

@ -1,396 +0,0 @@
var assert = require("assert"),
lex = require("../lex-parser"),
fs = require('fs'),
path = require('path');
function read (p, file) {
return fs.readFileSync(path.join(__dirname, p, file), "utf8");
}
exports["test lex grammar with macros"] = function () {
var lexgrammar = 'D [0-9]\nID [a-zA-Z][a-zA-Z0-9]+\n%%\n\n{D}"ohhai" {print(9);}\n"{" return \'{\';';
var expected = {
macros: {"D": "[0-9]", "ID": "[a-zA-Z][a-zA-Z0-9]+"},
rules: [
["{D}ohhai\\b", "print(9);"],
["\\{", "return '{';"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test escaped chars"] = function () {
var lexgrammar = '%%\n"\\n"+ {return \'NL\';}\n\\n+ {return \'NL2\';}\n\\s+ {/* skip */}';
var expected = {
rules: [
["\\\\n+", "return 'NL';"],
["\\n+", "return 'NL2';"],
["\\s+", "/* skip */"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test advanced"] = function () {
var lexgrammar = '%%\n$ {return \'EOF\';}\n. {/* skip */}\n"stuff"*/("{"|";") {/* ok */}\n(.+)[a-z]{1,2}"hi"*? {/* skip */}\n';
var expected = {
rules: [
["$", "return 'EOF';"],
[".", "/* skip */"],
["stuff*(?=(\\{|;))", "/* ok */"],
["(.+)[a-z]{1,2}hi*?", "/* skip */"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test [^\\]]"] = function () {
var lexgrammar = '%%\n"["[^\\]]"]" {return true;}\n\'f"oo\\\'bar\' {return \'baz2\';}\n"fo\\"obar" {return \'baz\';}\n';
var expected = {
rules: [
["\\[[^\\]]\\]", "return true;"],
["f\"oo'bar\\b", "return 'baz2';"],
['fo"obar\\b', "return 'baz';"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test multiline action"] = function () {
var lexgrammar = '%%\n"["[^\\]]"]" %{\nreturn true;\n%}\n';
var expected = {
rules: [
["\\[[^\\]]\\]", "\nreturn true;\n"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test multiline action with single braces"] = function () {
var lexgrammar = '%%\n"["[^\\]]"]" {\nvar b={};return true;\n}\n';
var expected = {
rules: [
["\\[[^\\]]\\]", "\nvar b={};return true;\n"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test multiline action with brace in a multi-line-comment"] = function () {
var lexgrammar = '%%\n"["[^\\]]"]" {\nvar b={}; /* { */ return true;\n}\n';
var expected = {
rules: [
["\\[[^\\]]\\]", "\nvar b={}; /* { */ return true;\n"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test multiline action with brace in a single-line-comment"] = function () {
var lexgrammar = '%%\n"["[^\\]]"]" {\nvar b={}; // { \nreturn 2 / 3;\n}\n';
var expected = {
rules: [
["\\[[^\\]]\\]", "\nvar b={}; // { \nreturn 2 / 3;\n"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test multiline action with braces in strings"] = function () {
var lexgrammar = '%%\n"["[^\\]]"]" {\nvar b=\'{\' + "{"; // { \nreturn 2 / 3;\n}\n';
var expected = {
rules: [
["\\[[^\\]]\\]", "\nvar b='{' + \"{\"; // { \nreturn 2 / 3;\n"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test multiline action with braces in regexp"] = function () {
var lexgrammar = '%%\n"["[^\\]]"]" {\nvar b=/{/; // { \nreturn 2 / 3;\n}\n';
var expected = {
rules: [
["\\[[^\\]]\\]", "\nvar b=/{/; // { \nreturn 2 / 3;\n"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test include"] = function () {
var lexgrammar = '\nRULE [0-9]\n\n%{\n hi <stuff> \n%}\n%%\n"["[^\\]]"]" %{\nreturn true;\n%}\n';
var expected = {
macros: {"RULE": "[0-9]"},
actionInclude: "\n hi <stuff> \n",
rules: [
["\\[[^\\]]\\]", "\nreturn true;\n"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test bnf lex grammar"] = function () {
var lexgrammar = lex.parse(read('lex', 'bnf.jisonlex'));
var expected = JSON.parse(read('lex', 'bnf.lex.json'));
assert.deepEqual(lexgrammar, expected, "grammar should be parsed correctly");
};
exports["test lex grammar bootstrap"] = function () {
var lexgrammar = lex.parse(read('lex', 'lex_grammar.jisonlex'));
var expected = JSON.parse(read('lex', 'lex_grammar.lex.json'));
assert.deepEqual(lexgrammar, expected, "grammar should be parsed correctly");
};
exports["test ANSI C lexical grammar"] = function () {
var lexgrammar = lex.parse(read('lex','ansic.jisonlex'));
assert.ok(lexgrammar, "grammar should be parsed correctly");
};
exports["test advanced"] = function () {
var lexgrammar = '%%\n"stuff"*/!("{"|";") {/* ok */}\n';
var expected = {
rules: [
["stuff*(?!(\\{|;))", "/* ok */"],
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test start conditions"] = function () {
var lexgrammar = '%s TEST TEST2\n%x EAT\n%%\n'+
'"enter-test" {this.begin(\'TEST\');}\n'+
'<TEST,EAT>"x" {return \'T\';}\n'+
'<*>"z" {return \'Z\';}\n'+
'<TEST>"y" {this.begin(\'INITIAL\'); return \'TY\';}';
var expected = {
startConditions: {
"TEST": 0,
"TEST2": 0,
"EAT": 1,
},
rules: [
["enter-test\\b", "this.begin('TEST');" ],
[["TEST","EAT"], "x\\b", "return 'T';" ],
[["*"], "z\\b", "return 'Z';" ],
[["TEST"], "y\\b", "this.begin('INITIAL'); return 'TY';" ]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test no brace action"] = function () {
var lexgrammar = '%%\n"["[^\\]]"]" return true;\n"x" return 1;';
var expected = {
rules: [
["\\[[^\\]]\\]", "return true;"],
["x\\b", "return 1;"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test quote escape"] = function () {
var lexgrammar = '%%\n\\"\\\'"x" return 1;';
var expected = {
rules: [
["\"'x\\b", "return 1;"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test escape things"] = function () {
var lexgrammar = '%%\n\\"\\\'\\\\\\*\\i return 1;\n"a"\\b return 2;\n\\cA {}\n\\012 {}\n\\xFF {}';
var expected = {
rules: [
["\"'\\\\\\*i\\b", "return 1;"],
["a\\b", "return 2;"],
["\\cA", ""],
["\\012", ""],
["\\xFF", ""]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test unicode encoding"] = function () {
var lexgrammar = '%%\n"\\u03c0" return 1;';
var expected = {
rules: [
["\\u03c0", "return 1;"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test unicode"] = function () {
var lexgrammar = '%%\n"π" return 1;';
var expected = {
rules: [
["π", "return 1;"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test bugs"] = function () {
var lexgrammar = '%%\n\\\'([^\\\\\']+|\\\\(\\n|.))*?\\\' return 1;';
var expected = {
rules: [
["'([^\\\\']+|\\\\(\\n|.))*?'", "return 1;"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test special groupings"] = function () {
var lexgrammar = '%%\n(?:"foo"|"bar")\\(\\) return 1;';
var expected = {
rules: [
["(?:foo|bar)\\(\\)", "return 1;"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test trailing code include"] = function () {
var lexgrammar = '%%"foo" {return bar;}\n%% var bar = 1;';
var expected = {
rules: [
['foo\\b', "return bar;"]
],
moduleInclude: " var bar = 1;"
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test empty or regex"] = function () {
var lexgrammar = '%%\n(|"bar")("foo"|)(|) return 1;';
var expected = {
rules: [
["(|bar)(foo|)(|)", "return 1;"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test options"] = function () {
var lexgrammar = '%options flex\n%%\n"foo" return 1;';
var expected = {
rules: [
["foo", "return 1;"]
],
options: {flex: true}
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test unquoted string rules"] = function () {
var lexgrammar = "%%\nfoo* return 1";
var expected = {
rules: [
["foo*", "return 1"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test [^\\\\]"] = function () {
var lexgrammar = '%%\n"["[^\\\\]"]" {return true;}\n\'f"oo\\\'bar\' {return \'baz2\';}\n"fo\\"obar" {return \'baz\';}\n';
var expected = {
rules: [
["\\[[^\\\\]\\]", "return true;"],
["f\"oo'bar\\b", "return 'baz2';"],
['fo"obar\\b', "return 'baz';"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test comments"] = function () {
var lexgrammar = "/* */ // foo\n%%\nfoo* return 1";
var expected = {
rules: [
["foo*", "return 1"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test rules with trailing escapes"] = function () {
var lexgrammar = '%%\n\\#[^\\n]*\\n {/* ok */}\n';
var expected = {
rules: [
["#[^\\n]*\\n", "/* ok */"],
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test no brace action with surplus whitespace between rules"] = function () {
var lexgrammar = '%%\n"a" return true;\n \n"b" return 1;\n \n';
var expected = {
rules: [
["a\\b", "return true;"],
["b\\b", "return 1;"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test windows line endings"] = function () {
var lexgrammar = '%%\r\n"["[^\\]]"]" %{\r\nreturn true;\r\n%}\r\n';
var expected = {
rules: [
["\\[[^\\]]\\]", "\r\nreturn true;\r\n"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
exports["test braced action with surplus whitespace between rules"] = function () {
var lexgrammar = '%%\n"a" %{ \nreturn true;\n%} \n \n"b" %{ return 1;\n%} \n \n';
var expected = {
rules: [
["a\\b", " \nreturn true;\n"],
["b\\b", " return 1;\n"]
]
};
assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly");
};
if (require.main === module)
require("test").run(exports);

View file

@ -1,115 +0,0 @@
D [0-9]
L [a-zA-Z_]
H [a-fA-F0-9]
E [Ee][+-]?{D}+
FS [fFlL]
IS [uUlL]*
%{
#include <stdio.h>
#include "y.tab.h"
void count();
%}
%%
"/*" { comment(); }
"auto" { count(); return(AUTO); }
"break" { count(); return(BREAK); }
"case" { count(); return(CASE); }
"char" { count(); return(CHAR); }
"const" { count(); return(CONST); }
"continue" { count(); return(CONTINUE); }
"default" { count(); return(DEFAULT); }
"do" { count(); return(DO); }
"double" { count(); return(DOUBLE); }
"else" { count(); return(ELSE); }
"enum" { count(); return(ENUM); }
"extern" { count(); return(EXTERN); }
"float" { count(); return(FLOAT); }
"for" { count(); return(FOR); }
"goto" { count(); return(GOTO); }
"if" { count(); return(IF); }
"int" { count(); return(INT); }
"long" { count(); return(LONG); }
"register" { count(); return(REGISTER); }
"return" { count(); return(RETURN); }
"short" { count(); return(SHORT); }
"signed" { count(); return(SIGNED); }
"sizeof" { count(); return(SIZEOF); }
"static" { count(); return(STATIC); }
"struct" { count(); return(STRUCT); }
"switch" { count(); return(SWITCH); }
"typedef" { count(); return(TYPEDEF); }
"union" { count(); return(UNION); }
"unsigned" { count(); return(UNSIGNED); }
"void" { count(); return(VOID); }
"volatile" { count(); return(VOLATILE); }
"while" { count(); return(WHILE); }
{L}({L}|{D})* { count(); return(check_type()); }
"0"[xX]{H}+{IS}? { count(); return(CONSTANT); }
"0"{D}+{IS}? { count(); return(CONSTANT); }
{D}+{IS}? { count(); return(CONSTANT); }
"L"?"'"("\'"|[^'])+"'" { count(); return(CONSTANT); }
{D}+{E}{FS}? { count(); return(CONSTANT); }
{D}*"."{D}+({E})?{FS}? { count(); return(CONSTANT); }
{D}+"."{D}*({E})?{FS}? { count(); return(CONSTANT); }
"L"?'"'('\"'|[^"])*'"' { count(); return(STRING_LITERAL); }
"..." { count(); return(ELLIPSIS); }
">>=" { count(); return(RIGHT_ASSIGN); }
"<<=" { count(); return(LEFT_ASSIGN); }
"+=" { count(); return(ADD_ASSIGN); }
"-=" { count(); return(SUB_ASSIGN); }
"*=" { count(); return(MUL_ASSIGN); }
"/=" { count(); return(DIV_ASSIGN); }
"%=" { count(); return(MOD_ASSIGN); }
"&=" { count(); return(AND_ASSIGN); }
"^=" { count(); return(XOR_ASSIGN); }
"|=" { count(); return(OR_ASSIGN); }
">>" { count(); return(RIGHT_OP); }
"<<" { count(); return(LEFT_OP); }
"++" { count(); return(INC_OP); }
"--" { count(); return(DEC_OP); }
"->" { count(); return(PTR_OP); }
"&&" { count(); return(AND_OP); }
"||" { count(); return(OR_OP); }
"<=" { count(); return(LE_OP); }
">=" { count(); return(GE_OP); }
"==" { count(); return(EQ_OP); }
"!=" { count(); return(NE_OP); }
";" { count(); return(';'); }
("{"|"<%") { count(); return('{'); }
("}"|"%>") %{ count(); return('}'); %}
"," { count(); return(','); }
":" { count(); return(':'); }
"=" { count(); return('='); }
"(" { count(); return('('); }
")" { count(); return(')'); }
("["|"<:") { count(); return('['); }
("]"|":>") { count(); return(']'); }
"." { count(); return('.'); }
"&" { count(); return('&'); }
"!" { count(); return('!'); }
"~" { count(); return('~'); }
"-" { count(); return('-'); }
"+" { count(); return('+'); }
"*" { count(); return('*'); }
"/" { count(); return('/'); }
"%" { count(); return('%'); }
"<" { count(); return('<'); }
">" { count(); return('>'); }
"^" { count(); return('^'); }
"|" { count(); return('|'); }
"?" { count(); return('?'); }
[ \t\v\n\f] { count(); }
. { /* ignore bad characters */ }
%%

View file

@ -1,23 +0,0 @@
%%
\s+ {/* skip whitespace */}
"/*"[^*]*"*" {return yy.lexComment(this);}
[a-zA-Z][a-zA-Z0-9_-]* {return 'ID';}
'"'[^"]+'"' {yytext = yytext.substr(1, yyleng-2); return 'STRING';}
"'"[^']+"'" {yytext = yytext.substr(1, yyleng-2); return 'STRING';}
":" {return ':';}
";" {return ';';}
"|" {return '|';}
"%%" {return '%%';}
"%prec" {return 'PREC';}
"%start" {return 'START';}
"%left" {return 'LEFT';}
"%right" {return 'RIGHT';}
"%nonassoc" {return 'NONASSOC';}
"%"[a-zA-Z]+[^\n]* {/* ignore unrecognized decl */}
"{{"[^}]*"}" {return yy.lexAction(this);}
"{"[^}]*"}" {yytext = yytext.substr(1, yyleng-2); return 'ACTION';}
"<"[^>]*">" {yytext = yytext.substr(1, yyleng-2); return 'ACTION';}
. {/* ignore bad characters */}
<<EOF>> {return 'EOF';}

View file

@ -1,24 +0,0 @@
{
"rules": [
["\\s+", "/* skip whitespace */"],
["\\/\\*[^*]*\\*", "return yy.lexComment(this);"],
["[a-zA-Z][a-zA-Z0-9_-]*", "return 'ID';"],
["\"[^\"]+\"", "yytext = yytext.substr(1, yyleng-2); return 'STRING';"],
["'[^']+'", "yytext = yytext.substr(1, yyleng-2); return 'STRING';"],
[":", "return ':';"],
[";", "return ';';"],
["\\|", "return '|';"],
["%%", "return '%%';"],
["%prec\\b", "return 'PREC';"],
["%start\\b", "return 'START';"],
["%left\\b", "return 'LEFT';"],
["%right\\b", "return 'RIGHT';"],
["%nonassoc\\b", "return 'NONASSOC';"],
["%[a-zA-Z]+[^\\n]*", "/* ignore unrecognized decl */"],
["\\{\\{[^}]*\\}", "return yy.lexAction(this);"],
["\\{[^}]*\\}", "yytext = yytext.substr(1, yyleng-2); return 'ACTION';"],
["<[^>]*>", "yytext = yytext.substr(1, yyleng-2); return 'ACTION';"],
[".", "/* ignore bad characters */"],
["$", "return 'EOF';"]
]
}

View file

@ -1,29 +0,0 @@
%%
\n+ {yy.freshLine = true;}
\s+ {yy.freshLine = false;}
"y{"[^}]*"}" {yytext = yytext.substr(2, yytext.length-3);return 'ACTION';}
[a-zA-Z_][a-zA-Z0-9_-]* {return 'NAME';}
'"'([^"]|'\"')*'"' {return 'STRING_LIT';}
"'"([^']|"\'")*"'" {return 'STRING_LIT';}
"|" {return '|';}
"["("\]"|[^\]])*"]" {return 'ANY_GROUP_REGEX';}
"(" {return '(';}
")" {return ')';}
"+" {return '+';}
"*" {return '*';}
"?" {return '?';}
"^" {return '^';}
"/" {return '/';}
"\\"[a-zA-Z0] {return 'ESCAPE_CHAR';}
"$" {return '$';}
"<<EOF>>" {return '$';}
"." {return '.';}
"%%" {return '%%';}
"{"\d+(","\s?\d+|",")?"}" {return 'RANGE_REGEX';}
/"{" %{if(yy.freshLine){this.input('{');return '{';} else this.unput('y');%}
"}" %{return '}';%}
"%{"(.|\n)*?"}%" {yytext = yytext.substr(2, yytext.length-4);return 'ACTION';}
. {/* ignore bad characters */}
<<EOF>> {return 'EOF';}

View file

@ -1,30 +0,0 @@
{
"rules": [
["\\n+", "yy.freshLine = true;"],
["\\s+", "yy.freshLine = false;"],
["y\\{[^}]*\\}", "yytext = yytext.substr(2, yytext.length-3);return 'ACTION';"],
["[a-zA-Z_][a-zA-Z0-9_-]*", "return 'NAME';"],
["\"([^\"]|\\\\\")*\"", "return 'STRING_LIT';"],
["'([^']|\\\\')*'", "return 'STRING_LIT';"],
["\\|", "return '|';"],
["\\[(\\\\\\]|[^\\]])*\\]", "return 'ANY_GROUP_REGEX';"],
["\\(", "return '(';"],
["\\)", "return ')';"],
["\\+", "return '+';"],
["\\*", "return '*';"],
["\\?", "return '?';"],
["\\^", "return '^';"],
["\\/", "return '/';"],
["\\\\[a-zA-Z0]", "return 'ESCAPE_CHAR';"],
["\\$", "return '$';"],
["<<EOF>>", "return '$';"],
["\\.", "return '.';"],
["%%", "return '%%';"],
["\\{\\d+(,\\s?\\d+|,)?\\}", "return 'RANGE_REGEX';"],
["(?=\\{)", "if(yy.freshLine){this.input('{');return '{';} else this.unput('y');"],
["\\}", "return '}';"],
["%\\{(.|\\n)*?\\}%", "yytext = yytext.substr(2, yytext.length-4);return 'ACTION';"],
[".", "/* ignore bad characters */"],
["$", "return 'EOF';"]
]
}

55
node_modules/typescript/LICENSE.txt generated vendored
View file

@ -1,55 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
You must give any other recipients of the Work or Derivative Works a copy of this License; and
You must cause any modified files to carry prominent notices stating that You changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

50
node_modules/typescript/README.md generated vendored
View file

@ -1,50 +0,0 @@
# TypeScript
[![GitHub Actions CI](https://github.com/microsoft/TypeScript/workflows/CI/badge.svg)](https://github.com/microsoft/TypeScript/actions?query=workflow%3ACI)
[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/microsoft/TypeScript/badge)](https://api.securityscorecards.dev/projects/github.com/microsoft/TypeScript)
[TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescript).
Find others who are using TypeScript at [our community page](https://www.typescriptlang.org/community/).
## Installing
For the latest stable version:
```bash
npm install -D typescript
```
For our nightly builds:
```bash
npm install -D typescript@next
```
## Contribute
There are many ways to [contribute](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md) to TypeScript.
* [Submit bugs](https://github.com/microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
* Review the [source code changes](https://github.com/microsoft/TypeScript/pulls).
* Engage with other TypeScript users and developers on [StackOverflow](https://stackoverflow.com/questions/tagged/typescript).
* Help each other in the [TypeScript Community Discord](https://discord.gg/typescript).
* Join the [#typescript](https://twitter.com/search?q=%23TypeScript) discussion on Twitter.
* [Contribute bug fixes](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md).
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see
the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com)
with any additional questions or comments.
## Documentation
* [TypeScript in 5 minutes](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html)
* [Programming handbook](https://www.typescriptlang.org/docs/handbook/intro.html)
* [Homepage](https://www.typescriptlang.org/)
## Roadmap
For details on our planned features and future direction, please refer to our [roadmap](https://github.com/microsoft/TypeScript/wiki/Roadmap).

41
node_modules/typescript/SECURITY.md generated vendored
View file

@ -1,41 +0,0 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK -->
## Security
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin).
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below.
## Reporting Security Issues
**Please do not report security vulnerabilities through public GitHub issues.**
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue
This information will help us triage your report more quickly.
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs.
## Preferred Languages
We prefer all communications to be in English.
## Policy
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).
<!-- END MICROSOFT SECURITY.MD BLOCK -->

File diff suppressed because one or more lines are too long

2
node_modules/typescript/bin/tsc generated vendored
View file

@ -1,2 +0,0 @@
#!/usr/bin/env node
require('../lib/tsc.js')

View file

@ -1,2 +0,0 @@
#!/usr/bin/env node
require('../lib/tsserver.js')

View file

@ -1,90 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
// src/cancellationToken/cancellationToken.ts
var fs = __toESM(require("fs"));
function pipeExists(name) {
return fs.existsSync(name);
}
function createCancellationToken(args) {
let cancellationPipeName;
for (let i = 0; i < args.length - 1; i++) {
if (args[i] === "--cancellationPipeName") {
cancellationPipeName = args[i + 1];
break;
}
}
if (!cancellationPipeName) {
return {
isCancellationRequested: () => false,
setRequest: (_requestId) => void 0,
resetRequest: (_requestId) => void 0
};
}
if (cancellationPipeName.charAt(cancellationPipeName.length - 1) === "*") {
const namePrefix = cancellationPipeName.slice(0, -1);
if (namePrefix.length === 0 || namePrefix.includes("*")) {
throw new Error("Invalid name for template cancellation pipe: it should have length greater than 2 characters and contain only one '*'.");
}
let perRequestPipeName;
let currentRequestId;
return {
isCancellationRequested: () => perRequestPipeName !== void 0 && pipeExists(perRequestPipeName),
setRequest(requestId) {
currentRequestId = requestId;
perRequestPipeName = namePrefix + requestId;
},
resetRequest(requestId) {
if (currentRequestId !== requestId) {
throw new Error(`Mismatched request id, expected ${currentRequestId}, actual ${requestId}`);
}
perRequestPipeName = void 0;
}
};
} else {
return {
isCancellationRequested: () => pipeExists(cancellationPipeName),
setRequest: (_requestId) => void 0,
resetRequest: (_requestId) => void 0
};
}
}
module.exports = createCancellationToken;
//# sourceMappingURL=cancellationToken.js.map

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

22
node_modules/typescript/lib/lib.d.ts generated vendored
View file

@ -1,22 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es5" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />

View file

@ -1,386 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/**
* The decorator context types provided to class element decorators.
*/
type ClassMemberDecoratorContext =
| ClassMethodDecoratorContext
| ClassGetterDecoratorContext
| ClassSetterDecoratorContext
| ClassFieldDecoratorContext
| ClassAccessorDecoratorContext;
/**
* The decorator context types provided to any decorator.
*/
type DecoratorContext =
| ClassDecoratorContext
| ClassMemberDecoratorContext;
type DecoratorMetadataObject = Record<PropertyKey, unknown> & object;
type DecoratorMetadata = typeof globalThis extends { Symbol: { readonly metadata: symbol; }; } ? DecoratorMetadataObject : DecoratorMetadataObject | undefined;
/**
* Context provided to a class decorator.
* @template Class The type of the decorated class associated with this context.
*/
interface ClassDecoratorContext<
Class extends abstract new (...args: any) => any = abstract new (...args: any) => any,
> {
/** The kind of element that was decorated. */
readonly kind: "class";
/** The name of the decorated class. */
readonly name: string | undefined;
/**
* Adds a callback to be invoked after the class definition has been finalized.
*
* @example
* ```ts
* function customElement(name: string): ClassDecoratorFunction {
* return (target, context) => {
* context.addInitializer(function () {
* customElements.define(name, this);
* });
* }
* }
*
* @customElement("my-element")
* class MyElement {}
* ```
*/
addInitializer(initializer: (this: Class) => void): void;
readonly metadata: DecoratorMetadata;
}
/**
* Context provided to a class method decorator.
* @template This The type on which the class element will be defined. For a static class element, this will be
* the type of the constructor. For a non-static class element, this will be the type of the instance.
* @template Value The type of the decorated class method.
*/
interface ClassMethodDecoratorContext<
This = unknown,
Value extends (this: This, ...args: any) => any = (this: This, ...args: any) => any,
> {
/** The kind of class element that was decorated. */
readonly kind: "method";
/** The name of the decorated class element. */
readonly name: string | symbol;
/** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
readonly static: boolean;
/** A value indicating whether the class element has a private name. */
readonly private: boolean;
/** An object that can be used to access the current value of the class element at runtime. */
readonly access: {
/**
* Determines whether an object has a property with the same name as the decorated element.
*/
has(object: This): boolean;
/**
* Gets the current value of the method from the provided object.
*
* @example
* let fn = context.access.get(instance);
*/
get(object: This): Value;
};
/**
* Adds a callback to be invoked either before static initializers are run (when
* decorating a `static` element), or before instance initializers are run (when
* decorating a non-`static` element).
*
* @example
* ```ts
* const bound: ClassMethodDecoratorFunction = (value, context) {
* if (context.private) throw new TypeError("Not supported on private methods.");
* context.addInitializer(function () {
* this[context.name] = this[context.name].bind(this);
* });
* }
*
* class C {
* message = "Hello";
*
* @bound
* m() {
* console.log(this.message);
* }
* }
* ```
*/
addInitializer(initializer: (this: This) => void): void;
readonly metadata: DecoratorMetadata;
}
/**
* Context provided to a class getter decorator.
* @template This The type on which the class element will be defined. For a static class element, this will be
* the type of the constructor. For a non-static class element, this will be the type of the instance.
* @template Value The property type of the decorated class getter.
*/
interface ClassGetterDecoratorContext<
This = unknown,
Value = unknown,
> {
/** The kind of class element that was decorated. */
readonly kind: "getter";
/** The name of the decorated class element. */
readonly name: string | symbol;
/** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
readonly static: boolean;
/** A value indicating whether the class element has a private name. */
readonly private: boolean;
/** An object that can be used to access the current value of the class element at runtime. */
readonly access: {
/**
* Determines whether an object has a property with the same name as the decorated element.
*/
has(object: This): boolean;
/**
* Invokes the getter on the provided object.
*
* @example
* let value = context.access.get(instance);
*/
get(object: This): Value;
};
/**
* Adds a callback to be invoked either before static initializers are run (when
* decorating a `static` element), or before instance initializers are run (when
* decorating a non-`static` element).
*/
addInitializer(initializer: (this: This) => void): void;
readonly metadata: DecoratorMetadata;
}
/**
* Context provided to a class setter decorator.
* @template This The type on which the class element will be defined. For a static class element, this will be
* the type of the constructor. For a non-static class element, this will be the type of the instance.
* @template Value The type of the decorated class setter.
*/
interface ClassSetterDecoratorContext<
This = unknown,
Value = unknown,
> {
/** The kind of class element that was decorated. */
readonly kind: "setter";
/** The name of the decorated class element. */
readonly name: string | symbol;
/** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
readonly static: boolean;
/** A value indicating whether the class element has a private name. */
readonly private: boolean;
/** An object that can be used to access the current value of the class element at runtime. */
readonly access: {
/**
* Determines whether an object has a property with the same name as the decorated element.
*/
has(object: This): boolean;
/**
* Invokes the setter on the provided object.
*
* @example
* context.access.set(instance, value);
*/
set(object: This, value: Value): void;
};
/**
* Adds a callback to be invoked either before static initializers are run (when
* decorating a `static` element), or before instance initializers are run (when
* decorating a non-`static` element).
*/
addInitializer(initializer: (this: This) => void): void;
readonly metadata: DecoratorMetadata;
}
/**
* Context provided to a class `accessor` field decorator.
* @template This The type on which the class element will be defined. For a static class element, this will be
* the type of the constructor. For a non-static class element, this will be the type of the instance.
* @template Value The type of decorated class field.
*/
interface ClassAccessorDecoratorContext<
This = unknown,
Value = unknown,
> {
/** The kind of class element that was decorated. */
readonly kind: "accessor";
/** The name of the decorated class element. */
readonly name: string | symbol;
/** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
readonly static: boolean;
/** A value indicating whether the class element has a private name. */
readonly private: boolean;
/** An object that can be used to access the current value of the class element at runtime. */
readonly access: {
/**
* Determines whether an object has a property with the same name as the decorated element.
*/
has(object: This): boolean;
/**
* Invokes the getter on the provided object.
*
* @example
* let value = context.access.get(instance);
*/
get(object: This): Value;
/**
* Invokes the setter on the provided object.
*
* @example
* context.access.set(instance, value);
*/
set(object: This, value: Value): void;
};
/**
* Adds a callback to be invoked either before static initializers are run (when
* decorating a `static` element), or before instance initializers are run (when
* decorating a non-`static` element).
*/
addInitializer(initializer: (this: This) => void): void;
readonly metadata: DecoratorMetadata;
}
/**
* Describes the target provided to class `accessor` field decorators.
* @template This The `this` type to which the target applies.
* @template Value The property type for the class `accessor` field.
*/
interface ClassAccessorDecoratorTarget<This, Value> {
/**
* Invokes the getter that was defined prior to decorator application.
*
* @example
* let value = target.get.call(instance);
*/
get(this: This): Value;
/**
* Invokes the setter that was defined prior to decorator application.
*
* @example
* target.set.call(instance, value);
*/
set(this: This, value: Value): void;
}
/**
* Describes the allowed return value from a class `accessor` field decorator.
* @template This The `this` type to which the target applies.
* @template Value The property type for the class `accessor` field.
*/
interface ClassAccessorDecoratorResult<This, Value> {
/**
* An optional replacement getter function. If not provided, the existing getter function is used instead.
*/
get?(this: This): Value;
/**
* An optional replacement setter function. If not provided, the existing setter function is used instead.
*/
set?(this: This, value: Value): void;
/**
* An optional initializer mutator that is invoked when the underlying field initializer is evaluated.
* @param value The incoming initializer value.
* @returns The replacement initializer value.
*/
init?(this: This, value: Value): Value;
}
/**
* Context provided to a class field decorator.
* @template This The type on which the class element will be defined. For a static class element, this will be
* the type of the constructor. For a non-static class element, this will be the type of the instance.
* @template Value The type of the decorated class field.
*/
interface ClassFieldDecoratorContext<
This = unknown,
Value = unknown,
> {
/** The kind of class element that was decorated. */
readonly kind: "field";
/** The name of the decorated class element. */
readonly name: string | symbol;
/** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
readonly static: boolean;
/** A value indicating whether the class element has a private name. */
readonly private: boolean;
/** An object that can be used to access the current value of the class element at runtime. */
readonly access: {
/**
* Determines whether an object has a property with the same name as the decorated element.
*/
has(object: This): boolean;
/**
* Gets the value of the field on the provided object.
*/
get(object: This): Value;
/**
* Sets the value of the field on the provided object.
*/
set(object: This, value: Value): void;
};
/**
* Adds a callback to be invoked either before static initializers are run (when
* decorating a `static` element), or before instance initializers are run (when
* decorating a non-`static` element).
*/
addInitializer(initializer: (this: This) => void): void;
readonly metadata: DecoratorMetadata;
}

View file

@ -1,22 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol | undefined, parameterIndex: number) => void;

View file

@ -1,28 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/////////////////////////////
/// Window Async Iterable APIs
/////////////////////////////
interface FileSystemDirectoryHandle {
[Symbol.asyncIterator](): AsyncIterableIterator<[string, FileSystemHandle]>;
entries(): AsyncIterableIterator<[string, FileSystemHandle]>;
keys(): AsyncIterableIterator<string>;
values(): AsyncIterableIterator<FileSystemHandle>;
}

28418
node_modules/typescript/lib/lib.dom.d.ts generated vendored

File diff suppressed because it is too large Load diff

View file

@ -1,467 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/////////////////////////////
/// Window Iterable APIs
/////////////////////////////
interface AudioParam {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/setValueCurveAtTime) */
setValueCurveAtTime(values: Iterable<number>, startTime: number, duration: number): AudioParam;
}
interface AudioParamMap extends ReadonlyMap<string, AudioParam> {
}
interface BaseAudioContext {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createIIRFilter) */
createIIRFilter(feedforward: Iterable<number>, feedback: Iterable<number>): IIRFilterNode;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createPeriodicWave) */
createPeriodicWave(real: Iterable<number>, imag: Iterable<number>, constraints?: PeriodicWaveConstraints): PeriodicWave;
}
interface CSSKeyframesRule {
[Symbol.iterator](): IterableIterator<CSSKeyframeRule>;
}
interface CSSNumericArray {
[Symbol.iterator](): IterableIterator<CSSNumericValue>;
entries(): IterableIterator<[number, CSSNumericValue]>;
keys(): IterableIterator<number>;
values(): IterableIterator<CSSNumericValue>;
}
interface CSSRuleList {
[Symbol.iterator](): IterableIterator<CSSRule>;
}
interface CSSStyleDeclaration {
[Symbol.iterator](): IterableIterator<string>;
}
interface CSSTransformValue {
[Symbol.iterator](): IterableIterator<CSSTransformComponent>;
entries(): IterableIterator<[number, CSSTransformComponent]>;
keys(): IterableIterator<number>;
values(): IterableIterator<CSSTransformComponent>;
}
interface CSSUnparsedValue {
[Symbol.iterator](): IterableIterator<CSSUnparsedSegment>;
entries(): IterableIterator<[number, CSSUnparsedSegment]>;
keys(): IterableIterator<number>;
values(): IterableIterator<CSSUnparsedSegment>;
}
interface Cache {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/addAll) */
addAll(requests: Iterable<RequestInfo>): Promise<void>;
}
interface CanvasPath {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/roundRect) */
roundRect(x: number, y: number, w: number, h: number, radii?: number | DOMPointInit | Iterable<number | DOMPointInit>): void;
}
interface CanvasPathDrawingStyles {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash) */
setLineDash(segments: Iterable<number>): void;
}
interface DOMRectList {
[Symbol.iterator](): IterableIterator<DOMRect>;
}
interface DOMStringList {
[Symbol.iterator](): IterableIterator<string>;
}
interface DOMTokenList {
[Symbol.iterator](): IterableIterator<string>;
entries(): IterableIterator<[number, string]>;
keys(): IterableIterator<number>;
values(): IterableIterator<string>;
}
interface DataTransferItemList {
[Symbol.iterator](): IterableIterator<DataTransferItem>;
}
interface EventCounts extends ReadonlyMap<string, number> {
}
interface FileList {
[Symbol.iterator](): IterableIterator<File>;
}
interface FontFaceSet extends Set<FontFace> {
}
interface FormData {
[Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]>;
/** Returns an array of key, value pairs for every entry in the list. */
entries(): IterableIterator<[string, FormDataEntryValue]>;
/** Returns a list of keys in the list. */
keys(): IterableIterator<string>;
/** Returns a list of values in the list. */
values(): IterableIterator<FormDataEntryValue>;
}
interface HTMLAllCollection {
[Symbol.iterator](): IterableIterator<Element>;
}
interface HTMLCollectionBase {
[Symbol.iterator](): IterableIterator<Element>;
}
interface HTMLCollectionOf<T extends Element> {
[Symbol.iterator](): IterableIterator<T>;
}
interface HTMLFormElement {
[Symbol.iterator](): IterableIterator<Element>;
}
interface HTMLSelectElement {
[Symbol.iterator](): IterableIterator<HTMLOptionElement>;
}
interface Headers {
[Symbol.iterator](): IterableIterator<[string, string]>;
/** Returns an iterator allowing to go through all key/value pairs contained in this object. */
entries(): IterableIterator<[string, string]>;
/** Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
keys(): IterableIterator<string>;
/** Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
values(): IterableIterator<string>;
}
interface Highlight extends Set<AbstractRange> {
}
interface HighlightRegistry extends Map<string, Highlight> {
}
interface IDBDatabase {
/**
* Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBDatabase/transaction)
*/
transaction(storeNames: string | Iterable<string>, mode?: IDBTransactionMode, options?: IDBTransactionOptions): IDBTransaction;
}
interface IDBObjectStore {
/**
* Creates a new index in store with the given name, keyPath and options and returns a new IDBIndex. If the keyPath and options define constraints that cannot be satisfied with the data already in store the upgrade transaction will abort with a "ConstraintError" DOMException.
*
* Throws an "InvalidStateError" DOMException if not called within an upgrade transaction.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/createIndex)
*/
createIndex(name: string, keyPath: string | Iterable<string>, options?: IDBIndexParameters): IDBIndex;
}
interface MIDIInputMap extends ReadonlyMap<string, MIDIInput> {
}
interface MIDIOutput {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/MIDIOutput/send) */
send(data: Iterable<number>, timestamp?: DOMHighResTimeStamp): void;
}
interface MIDIOutputMap extends ReadonlyMap<string, MIDIOutput> {
}
interface MediaKeyStatusMap {
[Symbol.iterator](): IterableIterator<[BufferSource, MediaKeyStatus]>;
entries(): IterableIterator<[BufferSource, MediaKeyStatus]>;
keys(): IterableIterator<BufferSource>;
values(): IterableIterator<MediaKeyStatus>;
}
interface MediaList {
[Symbol.iterator](): IterableIterator<string>;
}
interface MessageEvent<T = any> {
/**
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/initMessageEvent)
*/
initMessageEvent(type: string, bubbles?: boolean, cancelable?: boolean, data?: any, origin?: string, lastEventId?: string, source?: MessageEventSource | null, ports?: Iterable<MessagePort>): void;
}
interface MimeTypeArray {
[Symbol.iterator](): IterableIterator<MimeType>;
}
interface NamedNodeMap {
[Symbol.iterator](): IterableIterator<Attr>;
}
interface Navigator {
/**
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Navigator/requestMediaKeySystemAccess)
*/
requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: Iterable<MediaKeySystemConfiguration>): Promise<MediaKeySystemAccess>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Navigator/vibrate) */
vibrate(pattern: Iterable<number>): boolean;
}
interface NodeList {
[Symbol.iterator](): IterableIterator<Node>;
/** Returns an array of key, value pairs for every entry in the list. */
entries(): IterableIterator<[number, Node]>;
/** Returns an list of keys in the list. */
keys(): IterableIterator<number>;
/** Returns an list of values in the list. */
values(): IterableIterator<Node>;
}
interface NodeListOf<TNode extends Node> {
[Symbol.iterator](): IterableIterator<TNode>;
/** Returns an array of key, value pairs for every entry in the list. */
entries(): IterableIterator<[number, TNode]>;
/** Returns an list of keys in the list. */
keys(): IterableIterator<number>;
/** Returns an list of values in the list. */
values(): IterableIterator<TNode>;
}
interface Plugin {
[Symbol.iterator](): IterableIterator<MimeType>;
}
interface PluginArray {
[Symbol.iterator](): IterableIterator<Plugin>;
}
interface RTCRtpTransceiver {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCRtpTransceiver/setCodecPreferences) */
setCodecPreferences(codecs: Iterable<RTCRtpCodecCapability>): void;
}
interface RTCStatsReport extends ReadonlyMap<string, any> {
}
interface SVGLengthList {
[Symbol.iterator](): IterableIterator<SVGLength>;
}
interface SVGNumberList {
[Symbol.iterator](): IterableIterator<SVGNumber>;
}
interface SVGPointList {
[Symbol.iterator](): IterableIterator<DOMPoint>;
}
interface SVGStringList {
[Symbol.iterator](): IterableIterator<string>;
}
interface SVGTransformList {
[Symbol.iterator](): IterableIterator<SVGTransform>;
}
interface SourceBufferList {
[Symbol.iterator](): IterableIterator<SourceBuffer>;
}
interface SpeechRecognitionResult {
[Symbol.iterator](): IterableIterator<SpeechRecognitionAlternative>;
}
interface SpeechRecognitionResultList {
[Symbol.iterator](): IterableIterator<SpeechRecognitionResult>;
}
interface StylePropertyMapReadOnly {
[Symbol.iterator](): IterableIterator<[string, Iterable<CSSStyleValue>]>;
entries(): IterableIterator<[string, Iterable<CSSStyleValue>]>;
keys(): IterableIterator<string>;
values(): IterableIterator<Iterable<CSSStyleValue>>;
}
interface StyleSheetList {
[Symbol.iterator](): IterableIterator<CSSStyleSheet>;
}
interface SubtleCrypto {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) */
deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */
generateKey(algorithm: "Ed25519", extractable: boolean, keyUsages: ReadonlyArray<"sign" | "verify">): Promise<CryptoKeyPair>;
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKeyPair>;
generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKeyPair | CryptoKey>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) */
importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
importKey(format: Exclude<KeyFormat, "jwk">, keyData: BufferSource, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */
unwrapKey(format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
}
interface TextTrackCueList {
[Symbol.iterator](): IterableIterator<TextTrackCue>;
}
interface TextTrackList {
[Symbol.iterator](): IterableIterator<TextTrack>;
}
interface TouchList {
[Symbol.iterator](): IterableIterator<Touch>;
}
interface URLSearchParams {
[Symbol.iterator](): IterableIterator<[string, string]>;
/** Returns an array of key, value pairs for every entry in the search params. */
entries(): IterableIterator<[string, string]>;
/** Returns a list of keys in the search params. */
keys(): IterableIterator<string>;
/** Returns a list of values in the search params. */
values(): IterableIterator<string>;
}
interface WEBGL_draw_buffers {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WEBGL_draw_buffers/drawBuffersWEBGL) */
drawBuffersWEBGL(buffers: Iterable<GLenum>): void;
}
interface WEBGL_multi_draw {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WEBGL_multi_draw/multiDrawArraysInstancedWEBGL) */
multiDrawArraysInstancedWEBGL(mode: GLenum, firstsList: Int32Array | Iterable<GLint>, firstsOffset: number, countsList: Int32Array | Iterable<GLsizei>, countsOffset: number, instanceCountsList: Int32Array | Iterable<GLsizei>, instanceCountsOffset: number, drawcount: GLsizei): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WEBGL_multi_draw/multiDrawArraysWEBGL) */
multiDrawArraysWEBGL(mode: GLenum, firstsList: Int32Array | Iterable<GLint>, firstsOffset: number, countsList: Int32Array | Iterable<GLsizei>, countsOffset: number, drawcount: GLsizei): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WEBGL_multi_draw/multiDrawElementsInstancedWEBGL) */
multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | Iterable<GLsizei>, countsOffset: number, type: GLenum, offsetsList: Int32Array | Iterable<GLsizei>, offsetsOffset: number, instanceCountsList: Int32Array | Iterable<GLsizei>, instanceCountsOffset: number, drawcount: GLsizei): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WEBGL_multi_draw/multiDrawElementsWEBGL) */
multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | Iterable<GLsizei>, countsOffset: number, type: GLenum, offsetsList: Int32Array | Iterable<GLsizei>, offsetsOffset: number, drawcount: GLsizei): void;
}
interface WebGL2RenderingContextBase {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/clearBuffer) */
clearBufferfv(buffer: GLenum, drawbuffer: GLint, values: Iterable<GLfloat>, srcOffset?: number): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/clearBuffer) */
clearBufferiv(buffer: GLenum, drawbuffer: GLint, values: Iterable<GLint>, srcOffset?: number): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/clearBuffer) */
clearBufferuiv(buffer: GLenum, drawbuffer: GLint, values: Iterable<GLuint>, srcOffset?: number): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/drawBuffers) */
drawBuffers(buffers: Iterable<GLenum>): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/getActiveUniforms) */
getActiveUniforms(program: WebGLProgram, uniformIndices: Iterable<GLuint>, pname: GLenum): any;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/getUniformIndices) */
getUniformIndices(program: WebGLProgram, uniformNames: Iterable<string>): Iterable<GLuint> | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/invalidateFramebuffer) */
invalidateFramebuffer(target: GLenum, attachments: Iterable<GLenum>): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/invalidateSubFramebuffer) */
invalidateSubFramebuffer(target: GLenum, attachments: Iterable<GLenum>, x: GLint, y: GLint, width: GLsizei, height: GLsizei): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/transformFeedbackVaryings) */
transformFeedbackVaryings(program: WebGLProgram, varyings: Iterable<string>, bufferMode: GLenum): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniform) */
uniform1uiv(location: WebGLUniformLocation | null, data: Iterable<GLuint>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniform) */
uniform2uiv(location: WebGLUniformLocation | null, data: Iterable<GLuint>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniform) */
uniform3uiv(location: WebGLUniformLocation | null, data: Iterable<GLuint>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniform) */
uniform4uiv(location: WebGLUniformLocation | null, data: Iterable<GLuint>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniformMatrix) */
uniformMatrix2x3fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniformMatrix) */
uniformMatrix2x4fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniformMatrix) */
uniformMatrix3x2fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniformMatrix) */
uniformMatrix3x4fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniformMatrix) */
uniformMatrix4x2fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/uniformMatrix) */
uniformMatrix4x3fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/vertexAttribI) */
vertexAttribI4iv(index: GLuint, values: Iterable<GLint>): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/vertexAttribI) */
vertexAttribI4uiv(index: GLuint, values: Iterable<GLuint>): void;
}
interface WebGL2RenderingContextOverloads {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
uniform1fv(location: WebGLUniformLocation | null, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
uniform1iv(location: WebGLUniformLocation | null, data: Iterable<GLint>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
uniform2fv(location: WebGLUniformLocation | null, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
uniform2iv(location: WebGLUniformLocation | null, data: Iterable<GLint>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
uniform3fv(location: WebGLUniformLocation | null, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
uniform3iv(location: WebGLUniformLocation | null, data: Iterable<GLint>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
uniform4fv(location: WebGLUniformLocation | null, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
uniform4iv(location: WebGLUniformLocation | null, data: Iterable<GLint>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniformMatrix) */
uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniformMatrix) */
uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniformMatrix) */
uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Iterable<GLfloat>, srcOffset?: number, srcLength?: GLuint): void;
}
interface WebGLRenderingContextBase {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/vertexAttrib) */
vertexAttrib1fv(index: GLuint, values: Iterable<GLfloat>): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/vertexAttrib) */
vertexAttrib2fv(index: GLuint, values: Iterable<GLfloat>): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/vertexAttrib) */
vertexAttrib3fv(index: GLuint, values: Iterable<GLfloat>): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/vertexAttrib) */
vertexAttrib4fv(index: GLuint, values: Iterable<GLfloat>): void;
}
interface WebGLRenderingContextOverloads {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
uniform1fv(location: WebGLUniformLocation | null, v: Iterable<GLfloat>): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
uniform1iv(location: WebGLUniformLocation | null, v: Iterable<GLint>): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
uniform2fv(location: WebGLUniformLocation | null, v: Iterable<GLfloat>): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
uniform2iv(location: WebGLUniformLocation | null, v: Iterable<GLint>): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
uniform3fv(location: WebGLUniformLocation | null, v: Iterable<GLfloat>): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
uniform3iv(location: WebGLUniformLocation | null, v: Iterable<GLint>): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
uniform4fv(location: WebGLUniformLocation | null, v: Iterable<GLfloat>): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniform) */
uniform4iv(location: WebGLUniformLocation | null, v: Iterable<GLint>): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniformMatrix) */
uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: GLboolean, value: Iterable<GLfloat>): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniformMatrix) */
uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: GLboolean, value: Iterable<GLfloat>): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/uniformMatrix) */
uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: GLboolean, value: Iterable<GLfloat>): void;
}

View file

@ -1,147 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Map<K, V> {
clear(): void;
/**
* @returns true if an element in the Map existed and has been removed, or false if the element does not exist.
*/
delete(key: K): boolean;
/**
* Executes a provided function once per each key/value pair in the Map, in insertion order.
*/
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
/**
* Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
* @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
*/
get(key: K): V | undefined;
/**
* @returns boolean indicating whether an element with the specified key exists or not.
*/
has(key: K): boolean;
/**
* Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.
*/
set(key: K, value: V): this;
/**
* @returns the number of elements in the Map.
*/
readonly size: number;
}
interface MapConstructor {
new (): Map<any, any>;
new <K, V>(entries?: readonly (readonly [K, V])[] | null): Map<K, V>;
readonly prototype: Map<any, any>;
}
declare var Map: MapConstructor;
interface ReadonlyMap<K, V> {
forEach(callbackfn: (value: V, key: K, map: ReadonlyMap<K, V>) => void, thisArg?: any): void;
get(key: K): V | undefined;
has(key: K): boolean;
readonly size: number;
}
interface WeakMap<K extends WeakKey, V> {
/**
* Removes the specified element from the WeakMap.
* @returns true if the element was successfully removed, or false if it was not present.
*/
delete(key: K): boolean;
/**
* @returns a specified element.
*/
get(key: K): V | undefined;
/**
* @returns a boolean indicating whether an element with the specified key exists or not.
*/
has(key: K): boolean;
/**
* Adds a new element with a specified key and value.
* @param key Must be an object or symbol.
*/
set(key: K, value: V): this;
}
interface WeakMapConstructor {
new <K extends WeakKey = WeakKey, V = any>(entries?: readonly (readonly [K, V])[] | null): WeakMap<K, V>;
readonly prototype: WeakMap<WeakKey, any>;
}
declare var WeakMap: WeakMapConstructor;
interface Set<T> {
/**
* Appends a new element with a specified value to the end of the Set.
*/
add(value: T): this;
clear(): void;
/**
* Removes a specified value from the Set.
* @returns Returns true if an element in the Set existed and has been removed, or false if the element does not exist.
*/
delete(value: T): boolean;
/**
* Executes a provided function once per each value in the Set object, in insertion order.
*/
forEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void;
/**
* @returns a boolean indicating whether an element with the specified value exists in the Set or not.
*/
has(value: T): boolean;
/**
* @returns the number of (unique) elements in Set.
*/
readonly size: number;
}
interface SetConstructor {
new <T = any>(values?: readonly T[] | null): Set<T>;
readonly prototype: Set<any>;
}
declare var Set: SetConstructor;
interface ReadonlySet<T> {
forEach(callbackfn: (value: T, value2: T, set: ReadonlySet<T>) => void, thisArg?: any): void;
has(value: T): boolean;
readonly size: number;
}
interface WeakSet<T extends WeakKey> {
/**
* Appends a new value to the end of the WeakSet.
*/
add(value: T): this;
/**
* Removes the specified element from the WeakSet.
* @returns Returns true if the element existed and has been removed, or false if the element does not exist.
*/
delete(value: T): boolean;
/**
* @returns a boolean indicating whether a value exists in the WeakSet or not.
*/
has(value: T): boolean;
}
interface WeakSetConstructor {
new <T extends WeakKey = WeakKey>(values?: readonly T[] | null): WeakSet<T>;
readonly prototype: WeakSet<WeakKey>;
}
declare var WeakSet: WeakSetConstructor;

View file

@ -1,557 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Array<T> {
/**
* Returns the value of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
find<S extends T>(predicate: (value: T, index: number, obj: T[]) => value is S, thisArg?: any): S | undefined;
find(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T | undefined;
/**
* Returns the index of the first element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndex(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): number;
/**
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: T, start?: number, end?: number): this;
/**
* Returns the this object after copying a section of the array identified by start and end
* to the same array starting at position target
* @param target If target is negative, it is treated as length+target where length is the
* length of the array.
* @param start If start is negative, it is treated as length+start. If end is negative, it
* is treated as length+end.
* @param end If not specified, length of the this object is used as its default value.
*/
copyWithin(target: number, start: number, end?: number): this;
}
interface ArrayConstructor {
/**
* Creates an array from an array-like object.
* @param arrayLike An array-like object to convert to an array.
*/
from<T>(arrayLike: ArrayLike<T>): T[];
/**
* Creates an array from an iterable object.
* @param arrayLike An array-like object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
/**
* Returns a new array from a set of elements.
* @param items A set of elements to include in the new array object.
*/
of<T>(...items: T[]): T[];
}
interface DateConstructor {
new (value: number | string | Date): Date;
}
interface Function {
/**
* Returns the name of the function. Function names are read-only and can not be changed.
*/
readonly name: string;
}
interface Math {
/**
* Returns the number of leading zero bits in the 32-bit binary representation of a number.
* @param x A numeric expression.
*/
clz32(x: number): number;
/**
* Returns the result of 32-bit multiplication of two numbers.
* @param x First number
* @param y Second number
*/
imul(x: number, y: number): number;
/**
* Returns the sign of the x, indicating whether x is positive, negative or zero.
* @param x The numeric expression to test
*/
sign(x: number): number;
/**
* Returns the base 10 logarithm of a number.
* @param x A numeric expression.
*/
log10(x: number): number;
/**
* Returns the base 2 logarithm of a number.
* @param x A numeric expression.
*/
log2(x: number): number;
/**
* Returns the natural logarithm of 1 + x.
* @param x A numeric expression.
*/
log1p(x: number): number;
/**
* Returns the result of (e^x - 1), which is an implementation-dependent approximation to
* subtracting 1 from the exponential function of x (e raised to the power of x, where e
* is the base of the natural logarithms).
* @param x A numeric expression.
*/
expm1(x: number): number;
/**
* Returns the hyperbolic cosine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
cosh(x: number): number;
/**
* Returns the hyperbolic sine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
sinh(x: number): number;
/**
* Returns the hyperbolic tangent of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
tanh(x: number): number;
/**
* Returns the inverse hyperbolic cosine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
acosh(x: number): number;
/**
* Returns the inverse hyperbolic sine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
asinh(x: number): number;
/**
* Returns the inverse hyperbolic tangent of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
atanh(x: number): number;
/**
* Returns the square root of the sum of squares of its arguments.
* @param values Values to compute the square root for.
* If no arguments are passed, the result is +0.
* If there is only one argument, the result is the absolute value.
* If any argument is +Infinity or -Infinity, the result is +Infinity.
* If any argument is NaN, the result is NaN.
* If all arguments are either +0 or 0, the result is +0.
*/
hypot(...values: number[]): number;
/**
* Returns the integral part of the a numeric expression, x, removing any fractional digits.
* If x is already an integer, the result is x.
* @param x A numeric expression.
*/
trunc(x: number): number;
/**
* Returns the nearest single precision float representation of a number.
* @param x A numeric expression.
*/
fround(x: number): number;
/**
* Returns an implementation-dependent approximation to the cube root of number.
* @param x A numeric expression.
*/
cbrt(x: number): number;
}
interface NumberConstructor {
/**
* The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
* that is representable as a Number value, which is approximately:
* 2.2204460492503130808472633361816 x 1016.
*/
readonly EPSILON: number;
/**
* Returns true if passed value is finite.
* Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a
* number. Only finite values of the type number, result in true.
* @param number A numeric value.
*/
isFinite(number: unknown): boolean;
/**
* Returns true if the value passed is an integer, false otherwise.
* @param number A numeric value.
*/
isInteger(number: unknown): boolean;
/**
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
* number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter
* to a number. Only values of the type number, that are also NaN, result in true.
* @param number A numeric value.
*/
isNaN(number: unknown): boolean;
/**
* Returns true if the value passed is a safe integer.
* @param number A numeric value.
*/
isSafeInteger(number: unknown): boolean;
/**
* The value of the largest integer n such that n and n + 1 are both exactly representable as
* a Number value.
* The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 1.
*/
readonly MAX_SAFE_INTEGER: number;
/**
* The value of the smallest integer n such that n and n 1 are both exactly representable as
* a Number value.
* The value of Number.MIN_SAFE_INTEGER is 9007199254740991 ((2^53 1)).
*/
readonly MIN_SAFE_INTEGER: number;
/**
* Converts a string to a floating-point number.
* @param string A string that contains a floating-point number.
*/
parseFloat(string: string): number;
/**
* Converts A string to an integer.
* @param string A string to convert into a number.
* @param radix A value between 2 and 36 that specifies the base of the number in `string`.
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
* All other strings are considered decimal.
*/
parseInt(string: string, radix?: number): number;
}
interface ObjectConstructor {
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param source The source object from which to copy properties.
*/
assign<T extends {}, U>(target: T, source: U): T & U;
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param source1 The first source object from which to copy properties.
* @param source2 The second source object from which to copy properties.
*/
assign<T extends {}, U, V>(target: T, source1: U, source2: V): T & U & V;
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param source1 The first source object from which to copy properties.
* @param source2 The second source object from which to copy properties.
* @param source3 The third source object from which to copy properties.
*/
assign<T extends {}, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param sources One or more source objects from which to copy properties
*/
assign(target: object, ...sources: any[]): any;
/**
* Returns an array of all symbol properties found directly on object o.
* @param o Object to retrieve the symbols from.
*/
getOwnPropertySymbols(o: any): symbol[];
/**
* Returns the names of the enumerable string properties and methods of an object.
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
keys(o: {}): string[];
/**
* Returns true if the values are the same value, false otherwise.
* @param value1 The first value.
* @param value2 The second value.
*/
is(value1: any, value2: any): boolean;
/**
* Sets the prototype of a specified object o to object proto or null. Returns the object o.
* @param o The object to change its prototype.
* @param proto The value of the new prototype or null.
*/
setPrototypeOf(o: any, proto: object | null): any;
}
interface ReadonlyArray<T> {
/**
* Returns the value of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
find<S extends T>(predicate: (value: T, index: number, obj: readonly T[]) => value is S, thisArg?: any): S | undefined;
find(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): T | undefined;
/**
* Returns the index of the first element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndex(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): number;
}
interface RegExp {
/**
* Returns a string indicating the flags of the regular expression in question. This field is read-only.
* The characters in this string are sequenced and concatenated in the following order:
*
* - "g" for global
* - "i" for ignoreCase
* - "m" for multiline
* - "u" for unicode
* - "y" for sticky
*
* If no flags are set, the value is the empty string.
*/
readonly flags: string;
/**
* Returns a Boolean value indicating the state of the sticky flag (y) used with a regular
* expression. Default is false. Read-only.
*/
readonly sticky: boolean;
/**
* Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular
* expression. Default is false. Read-only.
*/
readonly unicode: boolean;
}
interface RegExpConstructor {
new (pattern: RegExp | string, flags?: string): RegExp;
(pattern: RegExp | string, flags?: string): RegExp;
}
interface String {
/**
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
* value of the UTF-16 encoded code point starting at the string element at position pos in
* the String resulting from converting this object to a String.
* If there is no element at that position, the result is undefined.
* If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
*/
codePointAt(pos: number): number | undefined;
/**
* Returns true if searchString appears as a substring of the result of converting this
* object to a String, at one or more positions that are
* greater than or equal to position; otherwise, returns false.
* @param searchString search string
* @param position If position is undefined, 0 is assumed, so as to search all of the String.
*/
includes(searchString: string, position?: number): boolean;
/**
* Returns true if the sequence of elements of searchString converted to a String is the
* same as the corresponding elements of this object (converted to a String) starting at
* endPosition length(this). Otherwise returns false.
*/
endsWith(searchString: string, endPosition?: number): boolean;
/**
* Returns the String value result of normalizing the string into the normalization form
* named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
* @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default
* is "NFC"
*/
normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string;
/**
* Returns the String value result of normalizing the string into the normalization form
* named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
* @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default
* is "NFC"
*/
normalize(form?: string): string;
/**
* Returns a String value that is made from count copies appended together. If count is 0,
* the empty string is returned.
* @param count number of copies to append
*/
repeat(count: number): string;
/**
* Returns true if the sequence of elements of searchString converted to a String is the
* same as the corresponding elements of this object (converted to a String) starting at
* position. Otherwise returns false.
*/
startsWith(searchString: string, position?: number): boolean;
/**
* Returns an `<a>` HTML anchor element and sets the name attribute to the text value
* @deprecated A legacy feature for browser compatibility
* @param name
*/
anchor(name: string): string;
/**
* Returns a `<big>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
big(): string;
/**
* Returns a `<blink>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
blink(): string;
/**
* Returns a `<b>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
bold(): string;
/**
* Returns a `<tt>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
fixed(): string;
/**
* Returns a `<font>` HTML element and sets the color attribute value
* @deprecated A legacy feature for browser compatibility
*/
fontcolor(color: string): string;
/**
* Returns a `<font>` HTML element and sets the size attribute value
* @deprecated A legacy feature for browser compatibility
*/
fontsize(size: number): string;
/**
* Returns a `<font>` HTML element and sets the size attribute value
* @deprecated A legacy feature for browser compatibility
*/
fontsize(size: string): string;
/**
* Returns an `<i>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
italics(): string;
/**
* Returns an `<a>` HTML element and sets the href attribute value
* @deprecated A legacy feature for browser compatibility
*/
link(url: string): string;
/**
* Returns a `<small>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
small(): string;
/**
* Returns a `<strike>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
strike(): string;
/**
* Returns a `<sub>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
sub(): string;
/**
* Returns a `<sup>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
sup(): string;
}
interface StringConstructor {
/**
* Return the String value whose elements are, in order, the elements in the List elements.
* If length is 0, the empty string is returned.
*/
fromCodePoint(...codePoints: number[]): string;
/**
* String.raw is usually used as a tag function of a Tagged Template String. When called as
* such, the first argument will be a well formed template call site object and the rest
* parameter will contain the substitution values. It can also be called directly, for example,
* to interleave strings and values from your own tag function, and in this case the only thing
* it needs from the first argument is the raw property.
* @param template A well-formed template string call site representation.
* @param substitutions A set of substitution values.
*/
raw(template: { raw: readonly string[] | ArrayLike<string>; }, ...substitutions: any[]): string;
}

View file

@ -1,28 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es5" />
/// <reference lib="es2015.core" />
/// <reference lib="es2015.collection" />
/// <reference lib="es2015.iterable" />
/// <reference lib="es2015.generator" />
/// <reference lib="es2015.promise" />
/// <reference lib="es2015.proxy" />
/// <reference lib="es2015.reflect" />
/// <reference lib="es2015.symbol" />
/// <reference lib="es2015.symbol.wellknown" />

View file

@ -1,77 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.iterable" />
interface Generator<T = unknown, TReturn = any, TNext = unknown> extends Iterator<T, TReturn, TNext> {
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
return(value: TReturn): IteratorResult<T, TReturn>;
throw(e: any): IteratorResult<T, TReturn>;
[Symbol.iterator](): Generator<T, TReturn, TNext>;
}
interface GeneratorFunction {
/**
* Creates a new Generator object.
* @param args A list of arguments the function accepts.
*/
new (...args: any[]): Generator;
/**
* Creates a new Generator object.
* @param args A list of arguments the function accepts.
*/
(...args: any[]): Generator;
/**
* The length of the arguments.
*/
readonly length: number;
/**
* Returns the name of the function.
*/
readonly name: string;
/**
* A reference to the prototype.
*/
readonly prototype: Generator;
}
interface GeneratorFunctionConstructor {
/**
* Creates a new Generator function.
* @param args A list of arguments the function accepts.
*/
new (...args: string[]): GeneratorFunction;
/**
* Creates a new Generator function.
* @param args A list of arguments the function accepts.
*/
(...args: string[]): GeneratorFunction;
/**
* The length of the arguments.
*/
readonly length: number;
/**
* Returns the name of the function.
*/
readonly name: string;
/**
* A reference to the prototype.
*/
readonly prototype: GeneratorFunction;
}

View file

@ -1,495 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.symbol" />
interface SymbolConstructor {
/**
* A method that returns the default iterator for an object. Called by the semantics of the
* for-of statement.
*/
readonly iterator: unique symbol;
}
interface IteratorYieldResult<TYield> {
done?: false;
value: TYield;
}
interface IteratorReturnResult<TReturn> {
done: true;
value: TReturn;
}
type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
interface Iterator<T, TReturn = any, TNext = undefined> {
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
return?(value?: TReturn): IteratorResult<T, TReturn>;
throw?(e?: any): IteratorResult<T, TReturn>;
}
interface Iterable<T> {
[Symbol.iterator](): Iterator<T>;
}
interface IterableIterator<T> extends Iterator<T> {
[Symbol.iterator](): IterableIterator<T>;
}
interface Array<T> {
/** Iterator */
[Symbol.iterator](): IterableIterator<T>;
/**
* Returns an iterable of key, value pairs for every entry in the array
*/
entries(): IterableIterator<[number, T]>;
/**
* Returns an iterable of keys in the array
*/
keys(): IterableIterator<number>;
/**
* Returns an iterable of values in the array
*/
values(): IterableIterator<T>;
}
interface ArrayConstructor {
/**
* Creates an array from an iterable object.
* @param iterable An iterable object to convert to an array.
*/
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
/**
* Creates an array from an iterable object.
* @param iterable An iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
}
interface ReadonlyArray<T> {
/** Iterator of values in the array. */
[Symbol.iterator](): IterableIterator<T>;
/**
* Returns an iterable of key, value pairs for every entry in the array
*/
entries(): IterableIterator<[number, T]>;
/**
* Returns an iterable of keys in the array
*/
keys(): IterableIterator<number>;
/**
* Returns an iterable of values in the array
*/
values(): IterableIterator<T>;
}
interface IArguments {
/** Iterator */
[Symbol.iterator](): IterableIterator<any>;
}
interface Map<K, V> {
/** Returns an iterable of entries in the map. */
[Symbol.iterator](): IterableIterator<[K, V]>;
/**
* Returns an iterable of key, value pairs for every entry in the map.
*/
entries(): IterableIterator<[K, V]>;
/**
* Returns an iterable of keys in the map
*/
keys(): IterableIterator<K>;
/**
* Returns an iterable of values in the map
*/
values(): IterableIterator<V>;
}
interface ReadonlyMap<K, V> {
/** Returns an iterable of entries in the map. */
[Symbol.iterator](): IterableIterator<[K, V]>;
/**
* Returns an iterable of key, value pairs for every entry in the map.
*/
entries(): IterableIterator<[K, V]>;
/**
* Returns an iterable of keys in the map
*/
keys(): IterableIterator<K>;
/**
* Returns an iterable of values in the map
*/
values(): IterableIterator<V>;
}
interface MapConstructor {
new (): Map<any, any>;
new <K, V>(iterable?: Iterable<readonly [K, V]> | null): Map<K, V>;
}
interface WeakMap<K extends WeakKey, V> {}
interface WeakMapConstructor {
new <K extends WeakKey, V>(iterable: Iterable<readonly [K, V]>): WeakMap<K, V>;
}
interface Set<T> {
/** Iterates over values in the set. */
[Symbol.iterator](): IterableIterator<T>;
/**
* Returns an iterable of [v,v] pairs for every value `v` in the set.
*/
entries(): IterableIterator<[T, T]>;
/**
* Despite its name, returns an iterable of the values in the set.
*/
keys(): IterableIterator<T>;
/**
* Returns an iterable of values in the set.
*/
values(): IterableIterator<T>;
}
interface ReadonlySet<T> {
/** Iterates over values in the set. */
[Symbol.iterator](): IterableIterator<T>;
/**
* Returns an iterable of [v,v] pairs for every value `v` in the set.
*/
entries(): IterableIterator<[T, T]>;
/**
* Despite its name, returns an iterable of the values in the set.
*/
keys(): IterableIterator<T>;
/**
* Returns an iterable of values in the set.
*/
values(): IterableIterator<T>;
}
interface SetConstructor {
new <T>(iterable?: Iterable<T> | null): Set<T>;
}
interface WeakSet<T extends WeakKey> {}
interface WeakSetConstructor {
new <T extends WeakKey = WeakKey>(iterable: Iterable<T>): WeakSet<T>;
}
interface Promise<T> {}
interface PromiseConstructor {
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An iterable of Promises.
* @returns A new Promise.
*/
all<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]>;
/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An iterable of Promises.
* @returns A new Promise.
*/
race<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>>;
}
interface String {
/** Iterator */
[Symbol.iterator](): IterableIterator<string>;
}
interface Int8Array {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
*/
entries(): IterableIterator<[number, number]>;
/**
* Returns an list of keys in the array
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
*/
values(): IterableIterator<number>;
}
interface Int8ArrayConstructor {
new (elements: Iterable<number>): Int8Array;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;
}
interface Uint8Array {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
*/
entries(): IterableIterator<[number, number]>;
/**
* Returns an list of keys in the array
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
*/
values(): IterableIterator<number>;
}
interface Uint8ArrayConstructor {
new (elements: Iterable<number>): Uint8Array;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;
}
interface Uint8ClampedArray {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
*/
entries(): IterableIterator<[number, number]>;
/**
* Returns an list of keys in the array
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
*/
values(): IterableIterator<number>;
}
interface Uint8ClampedArrayConstructor {
new (elements: Iterable<number>): Uint8ClampedArray;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;
}
interface Int16Array {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
*/
entries(): IterableIterator<[number, number]>;
/**
* Returns an list of keys in the array
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
*/
values(): IterableIterator<number>;
}
interface Int16ArrayConstructor {
new (elements: Iterable<number>): Int16Array;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;
}
interface Uint16Array {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
*/
entries(): IterableIterator<[number, number]>;
/**
* Returns an list of keys in the array
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
*/
values(): IterableIterator<number>;
}
interface Uint16ArrayConstructor {
new (elements: Iterable<number>): Uint16Array;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;
}
interface Int32Array {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
*/
entries(): IterableIterator<[number, number]>;
/**
* Returns an list of keys in the array
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
*/
values(): IterableIterator<number>;
}
interface Int32ArrayConstructor {
new (elements: Iterable<number>): Int32Array;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;
}
interface Uint32Array {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
*/
entries(): IterableIterator<[number, number]>;
/**
* Returns an list of keys in the array
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
*/
values(): IterableIterator<number>;
}
interface Uint32ArrayConstructor {
new (elements: Iterable<number>): Uint32Array;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;
}
interface Float32Array {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
*/
entries(): IterableIterator<[number, number]>;
/**
* Returns an list of keys in the array
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
*/
values(): IterableIterator<number>;
}
interface Float32ArrayConstructor {
new (elements: Iterable<number>): Float32Array;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;
}
interface Float64Array {
[Symbol.iterator](): IterableIterator<number>;
/**
* Returns an array of key, value pairs for every entry in the array
*/
entries(): IterableIterator<[number, number]>;
/**
* Returns an list of keys in the array
*/
keys(): IterableIterator<number>;
/**
* Returns an list of values in the array
*/
values(): IterableIterator<number>;
}
interface Float64ArrayConstructor {
new (elements: Iterable<number>): Float64Array;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;
}

View file

@ -1,81 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface PromiseConstructor {
/**
* A reference to the prototype.
*/
readonly prototype: Promise<any>;
/**
* Creates a new Promise.
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
* a resolve callback used to resolve the promise with a value or the result of another promise,
* and a reject callback used to reject the promise with a provided reason or error.
*/
new <T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: Awaited<T[P]>; }>;
// see: lib.es2015.iterable.d.ts
// all<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]>;
/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;
// see: lib.es2015.iterable.d.ts
// race<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>>;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject<T = never>(reason?: any): Promise<T>;
/**
* Creates a new resolved promise.
* @returns A resolved promise.
*/
resolve(): Promise<void>;
/**
* Creates a new resolved promise for the provided value.
* @param value A promise.
* @returns A promise whose internal state matches the provided promise.
*/
resolve<T>(value: T): Promise<Awaited<T>>;
/**
* Creates a new resolved promise for the provided value.
* @param value A promise.
* @returns A promise whose internal state matches the provided promise.
*/
resolve<T>(value: T | PromiseLike<T>): Promise<Awaited<T>>;
}
declare var Promise: PromiseConstructor;

View file

@ -1,128 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface ProxyHandler<T extends object> {
/**
* A trap method for a function call.
* @param target The original callable object which is being proxied.
*/
apply?(target: T, thisArg: any, argArray: any[]): any;
/**
* A trap for the `new` operator.
* @param target The original object which is being proxied.
* @param newTarget The constructor that was originally called.
*/
construct?(target: T, argArray: any[], newTarget: Function): object;
/**
* A trap for `Object.defineProperty()`.
* @param target The original object which is being proxied.
* @returns A `Boolean` indicating whether or not the property has been defined.
*/
defineProperty?(target: T, property: string | symbol, attributes: PropertyDescriptor): boolean;
/**
* A trap for the `delete` operator.
* @param target The original object which is being proxied.
* @param p The name or `Symbol` of the property to delete.
* @returns A `Boolean` indicating whether or not the property was deleted.
*/
deleteProperty?(target: T, p: string | symbol): boolean;
/**
* A trap for getting a property value.
* @param target The original object which is being proxied.
* @param p The name or `Symbol` of the property to get.
* @param receiver The proxy or an object that inherits from the proxy.
*/
get?(target: T, p: string | symbol, receiver: any): any;
/**
* A trap for `Object.getOwnPropertyDescriptor()`.
* @param target The original object which is being proxied.
* @param p The name of the property whose description should be retrieved.
*/
getOwnPropertyDescriptor?(target: T, p: string | symbol): PropertyDescriptor | undefined;
/**
* A trap for the `[[GetPrototypeOf]]` internal method.
* @param target The original object which is being proxied.
*/
getPrototypeOf?(target: T): object | null;
/**
* A trap for the `in` operator.
* @param target The original object which is being proxied.
* @param p The name or `Symbol` of the property to check for existence.
*/
has?(target: T, p: string | symbol): boolean;
/**
* A trap for `Object.isExtensible()`.
* @param target The original object which is being proxied.
*/
isExtensible?(target: T): boolean;
/**
* A trap for `Reflect.ownKeys()`.
* @param target The original object which is being proxied.
*/
ownKeys?(target: T): ArrayLike<string | symbol>;
/**
* A trap for `Object.preventExtensions()`.
* @param target The original object which is being proxied.
*/
preventExtensions?(target: T): boolean;
/**
* A trap for setting a property value.
* @param target The original object which is being proxied.
* @param p The name or `Symbol` of the property to set.
* @param receiver The object to which the assignment was originally directed.
* @returns A `Boolean` indicating whether or not the property was set.
*/
set?(target: T, p: string | symbol, newValue: any, receiver: any): boolean;
/**
* A trap for `Object.setPrototypeOf()`.
* @param target The original object which is being proxied.
* @param newPrototype The object's new prototype or `null`.
*/
setPrototypeOf?(target: T, v: object | null): boolean;
}
interface ProxyConstructor {
/**
* Creates a revocable Proxy object.
* @param target A target object to wrap with Proxy.
* @param handler An object whose properties define the behavior of Proxy when an operation is attempted on it.
*/
revocable<T extends object>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
/**
* Creates a Proxy object. The Proxy object allows you to create an object that can be used in place of the
* original object, but which may redefine fundamental Object operations like getting, setting, and defining
* properties. Proxy objects are commonly used to log property accesses, validate, format, or sanitize inputs.
* @param target A target object to wrap with Proxy.
* @param handler An object whose properties define the behavior of Proxy when an operation is attempted on it.
*/
new <T extends object>(target: T, handler: ProxyHandler<T>): T;
}
declare var Proxy: ProxyConstructor;

View file

@ -1,144 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare namespace Reflect {
/**
* Calls the function with the specified object as the this value
* and the elements of specified array as the arguments.
* @param target The function to call.
* @param thisArgument The object to be used as the this object.
* @param argumentsList An array of argument values to be passed to the function.
*/
function apply<T, A extends readonly any[], R>(
target: (this: T, ...args: A) => R,
thisArgument: T,
argumentsList: Readonly<A>,
): R;
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
/**
* Constructs the target with the elements of specified array as the arguments
* and the specified constructor as the `new.target` value.
* @param target The constructor to invoke.
* @param argumentsList An array of argument values to be passed to the constructor.
* @param newTarget The constructor to be used as the `new.target` object.
*/
function construct<A extends readonly any[], R>(
target: new (...args: A) => R,
argumentsList: Readonly<A>,
newTarget?: new (...args: any) => any,
): R;
function construct(target: Function, argumentsList: ArrayLike<any>, newTarget?: Function): any;
/**
* Adds a property to an object, or modifies attributes of an existing property.
* @param target Object on which to add or modify the property. This can be a native JavaScript object
* (that is, a user-defined object or a built in object) or a DOM object.
* @param propertyKey The property name.
* @param attributes Descriptor for the property. It can be for a data property or an accessor property.
*/
function defineProperty(target: object, propertyKey: PropertyKey, attributes: PropertyDescriptor & ThisType<any>): boolean;
/**
* Removes a property from an object, equivalent to `delete target[propertyKey]`,
* except it won't throw if `target[propertyKey]` is non-configurable.
* @param target Object from which to remove the own property.
* @param propertyKey The property name.
*/
function deleteProperty(target: object, propertyKey: PropertyKey): boolean;
/**
* Gets the property of target, equivalent to `target[propertyKey]` when `receiver === target`.
* @param target Object that contains the property on itself or in its prototype chain.
* @param propertyKey The property name.
* @param receiver The reference to use as the `this` value in the getter function,
* if `target[propertyKey]` is an accessor property.
*/
function get<T extends object, P extends PropertyKey>(
target: T,
propertyKey: P,
receiver?: unknown,
): P extends keyof T ? T[P] : any;
/**
* Gets the own property descriptor of the specified object.
* An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype.
* @param target Object that contains the property.
* @param propertyKey The property name.
*/
function getOwnPropertyDescriptor<T extends object, P extends PropertyKey>(
target: T,
propertyKey: P,
): TypedPropertyDescriptor<P extends keyof T ? T[P] : any> | undefined;
/**
* Returns the prototype of an object.
* @param target The object that references the prototype.
*/
function getPrototypeOf(target: object): object | null;
/**
* Equivalent to `propertyKey in target`.
* @param target Object that contains the property on itself or in its prototype chain.
* @param propertyKey Name of the property.
*/
function has(target: object, propertyKey: PropertyKey): boolean;
/**
* Returns a value that indicates whether new properties can be added to an object.
* @param target Object to test.
*/
function isExtensible(target: object): boolean;
/**
* Returns the string and symbol keys of the own properties of an object. The own properties of an object
* are those that are defined directly on that object, and are not inherited from the object's prototype.
* @param target Object that contains the own properties.
*/
function ownKeys(target: object): (string | symbol)[];
/**
* Prevents the addition of new properties to an object.
* @param target Object to make non-extensible.
* @return Whether the object has been made non-extensible.
*/
function preventExtensions(target: object): boolean;
/**
* Sets the property of target, equivalent to `target[propertyKey] = value` when `receiver === target`.
* @param target Object that contains the property on itself or in its prototype chain.
* @param propertyKey Name of the property.
* @param receiver The reference to use as the `this` value in the setter function,
* if `target[propertyKey]` is an accessor property.
*/
function set<T extends object, P extends PropertyKey>(
target: T,
propertyKey: P,
value: P extends keyof T ? T[P] : any,
receiver?: any,
): boolean;
function set(target: object, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
/**
* Sets the prototype of a specified object o to object proto or null.
* @param target The object to change its prototype.
* @param proto The value of the new prototype or null.
* @return Whether setting the prototype was successful.
*/
function setPrototypeOf(target: object, proto: object | null): boolean;
}

View file

@ -1,46 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface SymbolConstructor {
/**
* A reference to the prototype.
*/
readonly prototype: Symbol;
/**
* Returns a new unique Symbol value.
* @param description Description of the new Symbol object.
*/
(description?: string | number): symbol;
/**
* Returns a Symbol object from the global symbol registry matching the given key if found.
* Otherwise, returns a new symbol with this key.
* @param key key to search for.
*/
for(key: string): symbol;
/**
* Returns a key from the global symbol registry matching the given Symbol if found.
* Otherwise, returns a undefined.
* @param sym Symbol to find the key for.
*/
keyFor(sym: symbol): string | undefined;
}
declare var Symbol: SymbolConstructor;

View file

@ -1,326 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.symbol" />
interface SymbolConstructor {
/**
* A method that determines if a constructor object recognizes an object as one of the
* constructors instances. Called by the semantics of the instanceof operator.
*/
readonly hasInstance: unique symbol;
/**
* A Boolean value that if true indicates that an object should flatten to its array elements
* by Array.prototype.concat.
*/
readonly isConcatSpreadable: unique symbol;
/**
* A regular expression method that matches the regular expression against a string. Called
* by the String.prototype.match method.
*/
readonly match: unique symbol;
/**
* A regular expression method that replaces matched substrings of a string. Called by the
* String.prototype.replace method.
*/
readonly replace: unique symbol;
/**
* A regular expression method that returns the index within a string that matches the
* regular expression. Called by the String.prototype.search method.
*/
readonly search: unique symbol;
/**
* A function valued property that is the constructor function that is used to create
* derived objects.
*/
readonly species: unique symbol;
/**
* A regular expression method that splits a string at the indices that match the regular
* expression. Called by the String.prototype.split method.
*/
readonly split: unique symbol;
/**
* A method that converts an object to a corresponding primitive value.
* Called by the ToPrimitive abstract operation.
*/
readonly toPrimitive: unique symbol;
/**
* A String value that is used in the creation of the default string description of an object.
* Called by the built-in method Object.prototype.toString.
*/
readonly toStringTag: unique symbol;
/**
* An Object whose truthy properties are properties that are excluded from the 'with'
* environment bindings of the associated objects.
*/
readonly unscopables: unique symbol;
}
interface Symbol {
/**
* Converts a Symbol object to a symbol.
*/
[Symbol.toPrimitive](hint: string): symbol;
readonly [Symbol.toStringTag]: string;
}
interface Array<T> {
/**
* Is an object whose properties have the value 'true'
* when they will be absent when used in a 'with' statement.
*/
readonly [Symbol.unscopables]: {
[K in keyof any[]]?: boolean;
};
}
interface ReadonlyArray<T> {
/**
* Is an object whose properties have the value 'true'
* when they will be absent when used in a 'with' statement.
*/
readonly [Symbol.unscopables]: {
[K in keyof readonly any[]]?: boolean;
};
}
interface Date {
/**
* Converts a Date object to a string.
*/
[Symbol.toPrimitive](hint: "default"): string;
/**
* Converts a Date object to a string.
*/
[Symbol.toPrimitive](hint: "string"): string;
/**
* Converts a Date object to a number.
*/
[Symbol.toPrimitive](hint: "number"): number;
/**
* Converts a Date object to a string or number.
*
* @param hint The strings "number", "string", or "default" to specify what primitive to return.
*
* @throws {TypeError} If 'hint' was given something other than "number", "string", or "default".
* @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default".
*/
[Symbol.toPrimitive](hint: string): string | number;
}
interface Map<K, V> {
readonly [Symbol.toStringTag]: string;
}
interface WeakMap<K extends WeakKey, V> {
readonly [Symbol.toStringTag]: string;
}
interface Set<T> {
readonly [Symbol.toStringTag]: string;
}
interface WeakSet<T extends WeakKey> {
readonly [Symbol.toStringTag]: string;
}
interface JSON {
readonly [Symbol.toStringTag]: string;
}
interface Function {
/**
* Determines whether the given value inherits from this function if this function was used
* as a constructor function.
*
* A constructor function can control which objects are recognized as its instances by
* 'instanceof' by overriding this method.
*/
[Symbol.hasInstance](value: any): boolean;
}
interface GeneratorFunction {
readonly [Symbol.toStringTag]: string;
}
interface Math {
readonly [Symbol.toStringTag]: string;
}
interface Promise<T> {
readonly [Symbol.toStringTag]: string;
}
interface PromiseConstructor {
readonly [Symbol.species]: PromiseConstructor;
}
interface RegExp {
/**
* Matches a string with this regular expression, and returns an array containing the results of
* that search.
* @param string A string to search within.
*/
[Symbol.match](string: string): RegExpMatchArray | null;
/**
* Replaces text in a string, using this regular expression.
* @param string A String object or string literal whose contents matching against
* this regular expression will be replaced
* @param replaceValue A String object or string literal containing the text to replace for every
* successful match of this regular expression.
*/
[Symbol.replace](string: string, replaceValue: string): string;
/**
* Replaces text in a string, using this regular expression.
* @param string A String object or string literal whose contents matching against
* this regular expression will be replaced
* @param replacer A function that returns the replacement text.
*/
[Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string;
/**
* Finds the position beginning first substring match in a regular expression search
* using this regular expression.
*
* @param string The string to search within.
*/
[Symbol.search](string: string): number;
/**
* Returns an array of substrings that were delimited by strings in the original input that
* match against this regular expression.
*
* If the regular expression contains capturing parentheses, then each time this
* regular expression matches, the results (including any undefined results) of the
* capturing parentheses are spliced.
*
* @param string string value to split
* @param limit if not undefined, the output array is truncated so that it contains no more
* than 'limit' elements.
*/
[Symbol.split](string: string, limit?: number): string[];
}
interface RegExpConstructor {
readonly [Symbol.species]: RegExpConstructor;
}
interface String {
/**
* Matches a string or an object that supports being matched against, and returns an array
* containing the results of that search, or null if no matches are found.
* @param matcher An object that supports being matched against.
*/
match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null;
/**
* Passes a string and {@linkcode replaceValue} to the `[Symbol.replace]` method on {@linkcode searchValue}. This method is expected to implement its own replacement algorithm.
* @param searchValue An object that supports searching for and replacing matches within a string.
* @param replaceValue The replacement text.
*/
replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string;
/**
* Replaces text in a string, using an object that supports replacement within a string.
* @param searchValue A object can search for and replace matches within a string.
* @param replacer A function that returns the replacement text.
*/
replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string;
/**
* Finds the first substring match in a regular expression search.
* @param searcher An object which supports searching within a string.
*/
search(searcher: { [Symbol.search](string: string): number; }): number;
/**
* Split a string into substrings using the specified separator and return them as an array.
* @param splitter An object that can split a string.
* @param limit A value used to limit the number of elements returned in the array.
*/
split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[];
}
interface ArrayBuffer {
readonly [Symbol.toStringTag]: string;
}
interface DataView {
readonly [Symbol.toStringTag]: string;
}
interface Int8Array {
readonly [Symbol.toStringTag]: "Int8Array";
}
interface Uint8Array {
readonly [Symbol.toStringTag]: "Uint8Array";
}
interface Uint8ClampedArray {
readonly [Symbol.toStringTag]: "Uint8ClampedArray";
}
interface Int16Array {
readonly [Symbol.toStringTag]: "Int16Array";
}
interface Uint16Array {
readonly [Symbol.toStringTag]: "Uint16Array";
}
interface Int32Array {
readonly [Symbol.toStringTag]: "Int32Array";
}
interface Uint32Array {
readonly [Symbol.toStringTag]: "Uint32Array";
}
interface Float32Array {
readonly [Symbol.toStringTag]: "Float32Array";
}
interface Float64Array {
readonly [Symbol.toStringTag]: "Float64Array";
}
interface ArrayConstructor {
readonly [Symbol.species]: ArrayConstructor;
}
interface MapConstructor {
readonly [Symbol.species]: MapConstructor;
}
interface SetConstructor {
readonly [Symbol.species]: SetConstructor;
}
interface ArrayBufferConstructor {
readonly [Symbol.species]: ArrayBufferConstructor;
}

View file

@ -1,116 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Array<T> {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
* @param fromIndex The position in this array at which to begin searching for searchElement.
*/
includes(searchElement: T, fromIndex?: number): boolean;
}
interface ReadonlyArray<T> {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
* @param fromIndex The position in this array at which to begin searching for searchElement.
*/
includes(searchElement: T, fromIndex?: number): boolean;
}
interface Int8Array {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
* @param fromIndex The position in this array at which to begin searching for searchElement.
*/
includes(searchElement: number, fromIndex?: number): boolean;
}
interface Uint8Array {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
* @param fromIndex The position in this array at which to begin searching for searchElement.
*/
includes(searchElement: number, fromIndex?: number): boolean;
}
interface Uint8ClampedArray {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
* @param fromIndex The position in this array at which to begin searching for searchElement.
*/
includes(searchElement: number, fromIndex?: number): boolean;
}
interface Int16Array {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
* @param fromIndex The position in this array at which to begin searching for searchElement.
*/
includes(searchElement: number, fromIndex?: number): boolean;
}
interface Uint16Array {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
* @param fromIndex The position in this array at which to begin searching for searchElement.
*/
includes(searchElement: number, fromIndex?: number): boolean;
}
interface Int32Array {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
* @param fromIndex The position in this array at which to begin searching for searchElement.
*/
includes(searchElement: number, fromIndex?: number): boolean;
}
interface Uint32Array {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
* @param fromIndex The position in this array at which to begin searching for searchElement.
*/
includes(searchElement: number, fromIndex?: number): boolean;
}
interface Float32Array {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
* @param fromIndex The position in this array at which to begin searching for searchElement.
*/
includes(searchElement: number, fromIndex?: number): boolean;
}
interface Float64Array {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
* @param fromIndex The position in this array at which to begin searching for searchElement.
*/
includes(searchElement: number, fromIndex?: number): boolean;
}

View file

@ -1,21 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015" />
/// <reference lib="es2016.array.include" />
/// <reference lib="es2016.intl" />

View file

@ -1,23 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2016" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />

View file

@ -1,31 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare namespace Intl {
/**
* The `Intl.getCanonicalLocales()` method returns an array containing
* the canonical locale names. Duplicates will be omitted and elements
* will be validated as structurally valid language tags.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/getCanonicalLocales)
*
* @param locale A list of String values for which to get the canonical locale names
* @returns An array containing the canonical and validated locale names.
*/
function getCanonicalLocales(locale?: string | readonly string[]): string[];
}

View file

@ -1,25 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2016" />
/// <reference lib="es2017.object" />
/// <reference lib="es2017.sharedmemory" />
/// <reference lib="es2017.string" />
/// <reference lib="es2017.intl" />
/// <reference lib="es2017.typedarrays" />
/// <reference lib="es2017.date" />

View file

@ -1,31 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface DateConstructor {
/**
* Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.
* @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.
* @param monthIndex The month as a number between 0 and 11 (January to December).
* @param date The date as a number between 1 and 31.
* @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour.
* @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes.
* @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds.
* @param ms A number from 0 to 999 that specifies the milliseconds.
*/
UTC(year: number, monthIndex?: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;
}

View file

@ -1,23 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2017" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />

View file

@ -1,44 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare namespace Intl {
interface DateTimeFormatPartTypesRegistry {
day: any;
dayPeriod: any;
era: any;
hour: any;
literal: any;
minute: any;
month: any;
second: any;
timeZoneName: any;
weekday: any;
year: any;
}
type DateTimeFormatPartTypes = keyof DateTimeFormatPartTypesRegistry;
interface DateTimeFormatPart {
type: DateTimeFormatPartTypes;
value: string;
}
interface DateTimeFormat {
formatToParts(date?: Date | number): DateTimeFormatPart[];
}
}

View file

@ -1,49 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface ObjectConstructor {
/**
* Returns an array of values of the enumerable properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
values<T>(o: { [s: string]: T; } | ArrayLike<T>): T[];
/**
* Returns an array of values of the enumerable properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
values(o: {}): any[];
/**
* Returns an array of key/values of the enumerable properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
entries<T>(o: { [s: string]: T; } | ArrayLike<T>): [string, T][];
/**
* Returns an array of key/values of the enumerable properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
entries(o: {}): [string, any][];
/**
* Returns an object containing all own property descriptors of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
getOwnPropertyDescriptors<T>(o: T): { [P in keyof T]: TypedPropertyDescriptor<T[P]>; } & { [x: string]: PropertyDescriptor; };
}

View file

@ -1,135 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.symbol" />
/// <reference lib="es2015.symbol.wellknown" />
interface SharedArrayBuffer {
/**
* Read-only. The length of the ArrayBuffer (in bytes).
*/
readonly byteLength: number;
/**
* Returns a section of an SharedArrayBuffer.
*/
slice(begin: number, end?: number): SharedArrayBuffer;
readonly [Symbol.species]: SharedArrayBuffer;
readonly [Symbol.toStringTag]: "SharedArrayBuffer";
}
interface SharedArrayBufferConstructor {
readonly prototype: SharedArrayBuffer;
new (byteLength: number): SharedArrayBuffer;
}
declare var SharedArrayBuffer: SharedArrayBufferConstructor;
interface ArrayBufferTypes {
SharedArrayBuffer: SharedArrayBuffer;
}
interface Atomics {
/**
* Adds a value to the value at the given position in the array, returning the original value.
* Until this atomic operation completes, any other read or write operation against the array
* will block.
*/
add(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
/**
* Stores the bitwise AND of a value with the value at the given position in the array,
* returning the original value. Until this atomic operation completes, any other read or
* write operation against the array will block.
*/
and(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
/**
* Replaces the value at the given position in the array if the original value equals the given
* expected value, returning the original value. Until this atomic operation completes, any
* other read or write operation against the array will block.
*/
compareExchange(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, expectedValue: number, replacementValue: number): number;
/**
* Replaces the value at the given position in the array, returning the original value. Until
* this atomic operation completes, any other read or write operation against the array will
* block.
*/
exchange(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
/**
* Returns a value indicating whether high-performance algorithms can use atomic operations
* (`true`) or must use locks (`false`) for the given number of bytes-per-element of a typed
* array.
*/
isLockFree(size: number): boolean;
/**
* Returns the value at the given position in the array. Until this atomic operation completes,
* any other read or write operation against the array will block.
*/
load(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number): number;
/**
* Stores the bitwise OR of a value with the value at the given position in the array,
* returning the original value. Until this atomic operation completes, any other read or write
* operation against the array will block.
*/
or(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
/**
* Stores a value at the given position in the array, returning the new value. Until this
* atomic operation completes, any other read or write operation against the array will block.
*/
store(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
/**
* Subtracts a value from the value at the given position in the array, returning the original
* value. Until this atomic operation completes, any other read or write operation against the
* array will block.
*/
sub(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
/**
* If the value at the given position in the array is equal to the provided value, the current
* agent is put to sleep causing execution to suspend until the timeout expires (returning
* `"timed-out"`) or until the agent is awoken (returning `"ok"`); otherwise, returns
* `"not-equal"`.
*/
wait(typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out";
/**
* Wakes up sleeping agents that are waiting on the given index of the array, returning the
* number of agents that were awoken.
* @param typedArray A shared Int32Array.
* @param index The position in the typedArray to wake up on.
* @param count The number of sleeping agents to notify. Defaults to +Infinity.
*/
notify(typedArray: Int32Array, index: number, count?: number): number;
/**
* Stores the bitwise XOR of a value with the value at the given position in the array,
* returning the original value. Until this atomic operation completes, any other read or write
* operation against the array will block.
*/
xor(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
readonly [Symbol.toStringTag]: "Atomics";
}
declare var Atomics: Atomics;

View file

@ -1,45 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface String {
/**
* Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
* The padding is applied from the start (left) of the current string.
*
* @param maxLength The length of the resulting string once the current string has been padded.
* If this parameter is smaller than the current string's length, the current string will be returned as it is.
*
* @param fillString The string to pad the current string with.
* If this string is too long, it will be truncated and the left-most part will be applied.
* The default value for this parameter is " " (U+0020).
*/
padStart(maxLength: number, fillString?: string): string;
/**
* Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
* The padding is applied from the end (right) of the current string.
*
* @param maxLength The length of the resulting string once the current string has been padded.
* If this parameter is smaller than the current string's length, the current string will be returned as it is.
*
* @param fillString The string to pad the current string with.
* If this string is too long, it will be truncated and the left-most part will be applied.
* The default value for this parameter is " " (U+0020).
*/
padEnd(maxLength: number, fillString?: string): string;
}

View file

@ -1,53 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Int8ArrayConstructor {
new (): Int8Array;
}
interface Uint8ArrayConstructor {
new (): Uint8Array;
}
interface Uint8ClampedArrayConstructor {
new (): Uint8ClampedArray;
}
interface Int16ArrayConstructor {
new (): Int16Array;
}
interface Uint16ArrayConstructor {
new (): Uint16Array;
}
interface Int32ArrayConstructor {
new (): Int32Array;
}
interface Uint32ArrayConstructor {
new (): Uint32Array;
}
interface Float32ArrayConstructor {
new (): Float32Array;
}
interface Float64ArrayConstructor {
new (): Float64Array;
}

View file

@ -1,77 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2018.asynciterable" />
interface AsyncGenerator<T = unknown, TReturn = any, TNext = unknown> extends AsyncIterator<T, TReturn, TNext> {
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
next(...args: [] | [TNext]): Promise<IteratorResult<T, TReturn>>;
return(value: TReturn | PromiseLike<TReturn>): Promise<IteratorResult<T, TReturn>>;
throw(e: any): Promise<IteratorResult<T, TReturn>>;
[Symbol.asyncIterator](): AsyncGenerator<T, TReturn, TNext>;
}
interface AsyncGeneratorFunction {
/**
* Creates a new AsyncGenerator object.
* @param args A list of arguments the function accepts.
*/
new (...args: any[]): AsyncGenerator;
/**
* Creates a new AsyncGenerator object.
* @param args A list of arguments the function accepts.
*/
(...args: any[]): AsyncGenerator;
/**
* The length of the arguments.
*/
readonly length: number;
/**
* Returns the name of the function.
*/
readonly name: string;
/**
* A reference to the prototype.
*/
readonly prototype: AsyncGenerator;
}
interface AsyncGeneratorFunctionConstructor {
/**
* Creates a new AsyncGenerator function.
* @param args A list of arguments the function accepts.
*/
new (...args: string[]): AsyncGeneratorFunction;
/**
* Creates a new AsyncGenerator function.
* @param args A list of arguments the function accepts.
*/
(...args: string[]): AsyncGeneratorFunction;
/**
* The length of the arguments.
*/
readonly length: number;
/**
* Returns the name of the function.
*/
readonly name: string;
/**
* A reference to the prototype.
*/
readonly prototype: AsyncGeneratorFunction;
}

View file

@ -1,43 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.symbol" />
/// <reference lib="es2015.iterable" />
interface SymbolConstructor {
/**
* A method that returns the default async iterator for an object. Called by the semantics of
* the for-await-of statement.
*/
readonly asyncIterator: unique symbol;
}
interface AsyncIterator<T, TReturn = any, TNext = undefined> {
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
next(...args: [] | [TNext]): Promise<IteratorResult<T, TReturn>>;
return?(value?: TReturn | PromiseLike<TReturn>): Promise<IteratorResult<T, TReturn>>;
throw?(e?: any): Promise<IteratorResult<T, TReturn>>;
}
interface AsyncIterable<T> {
[Symbol.asyncIterator](): AsyncIterator<T>;
}
interface AsyncIterableIterator<T> extends AsyncIterator<T> {
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
}

View file

@ -1,24 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2017" />
/// <reference lib="es2018.asynciterable" />
/// <reference lib="es2018.asyncgenerator" />
/// <reference lib="es2018.promise" />
/// <reference lib="es2018.regexp" />
/// <reference lib="es2018.intl" />

View file

@ -1,24 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2018" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />
/// <reference lib="dom.asynciterable" />

View file

@ -1,71 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare namespace Intl {
// http://cldr.unicode.org/index/cldr-spec/plural-rules#TOC-Determining-Plural-Categories
type LDMLPluralRule = "zero" | "one" | "two" | "few" | "many" | "other";
type PluralRuleType = "cardinal" | "ordinal";
interface PluralRulesOptions {
localeMatcher?: "lookup" | "best fit" | undefined;
type?: PluralRuleType | undefined;
minimumIntegerDigits?: number | undefined;
minimumFractionDigits?: number | undefined;
maximumFractionDigits?: number | undefined;
minimumSignificantDigits?: number | undefined;
maximumSignificantDigits?: number | undefined;
}
interface ResolvedPluralRulesOptions {
locale: string;
pluralCategories: LDMLPluralRule[];
type: PluralRuleType;
minimumIntegerDigits: number;
minimumFractionDigits: number;
maximumFractionDigits: number;
minimumSignificantDigits?: number;
maximumSignificantDigits?: number;
}
interface PluralRules {
resolvedOptions(): ResolvedPluralRulesOptions;
select(n: number): LDMLPluralRule;
}
interface PluralRulesConstructor {
new (locales?: string | readonly string[], options?: PluralRulesOptions): PluralRules;
(locales?: string | readonly string[], options?: PluralRulesOptions): PluralRules;
supportedLocalesOf(locales: string | readonly string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[];
}
const PluralRules: PluralRulesConstructor;
// We can only have one definition for 'type' in TypeScript, and so you can learn where the keys come from here:
type ES2018NumberFormatPartType = "literal" | "nan" | "infinity" | "percent" | "integer" | "group" | "decimal" | "fraction" | "plusSign" | "minusSign" | "percentSign" | "currency" | "code" | "symbol" | "name";
type ES2020NumberFormatPartType = "compact" | "exponentInteger" | "exponentMinusSign" | "exponentSeparator" | "unit" | "unknown";
type NumberFormatPartTypes = ES2018NumberFormatPartType | ES2020NumberFormatPartType;
interface NumberFormatPart {
type: NumberFormatPartTypes;
value: string;
}
interface NumberFormat {
formatToParts(number?: number | bigint): NumberFormatPart[];
}
}

View file

@ -1,30 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/**
* Represents the completion of an asynchronous operation
*/
interface Promise<T> {
/**
* Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
* resolved value cannot be modified from the callback.
* @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
* @returns A Promise for the completion of the callback.
*/
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
}

View file

@ -1,37 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface RegExpMatchArray {
groups?: {
[key: string]: string;
};
}
interface RegExpExecArray {
groups?: {
[key: string]: string;
};
}
interface RegExp {
/**
* Returns a Boolean value indicating the state of the dotAll flag (s) used with a regular expression.
* Default is false. Read-only.
*/
readonly dotAll: boolean;
}

View file

@ -1,79 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
type FlatArray<Arr, Depth extends number> = {
done: Arr;
recur: Arr extends ReadonlyArray<infer InnerArr> ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][Depth]>
: Arr;
}[Depth extends -1 ? "done" : "recur"];
interface ReadonlyArray<T> {
/**
* Calls a defined callback function on each element of an array. Then, flattens the result into
* a new array.
* This is identical to a map followed by flat with depth 1.
*
* @param callback A function that accepts up to three arguments. The flatMap method calls the
* callback function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callback function. If
* thisArg is omitted, undefined is used as the this value.
*/
flatMap<U, This = undefined>(
callback: (this: This, value: T, index: number, array: T[]) => U | ReadonlyArray<U>,
thisArg?: This,
): U[];
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flat<A, D extends number = 1>(
this: A,
depth?: D,
): FlatArray<A, D>[];
}
interface Array<T> {
/**
* Calls a defined callback function on each element of an array. Then, flattens the result into
* a new array.
* This is identical to a map followed by flat with depth 1.
*
* @param callback A function that accepts up to three arguments. The flatMap method calls the
* callback function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callback function. If
* thisArg is omitted, undefined is used as the this value.
*/
flatMap<U, This = undefined>(
callback: (this: This, value: T, index: number, array: T[]) => U | ReadonlyArray<U>,
thisArg?: This,
): U[];
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flat<A, D extends number = 1>(
this: A,
depth?: D,
): FlatArray<A, D>[];
}

View file

@ -1,24 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2018" />
/// <reference lib="es2019.array" />
/// <reference lib="es2019.object" />
/// <reference lib="es2019.string" />
/// <reference lib="es2019.symbol" />
/// <reference lib="es2019.intl" />

View file

@ -1,24 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2019" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />
/// <reference lib="dom.asynciterable" />

View file

@ -1,23 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare namespace Intl {
interface DateTimeFormatPartTypesRegistry {
unknown: any;
}
}

View file

@ -1,33 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.iterable" />
interface ObjectConstructor {
/**
* Returns an object created by key-value entries for properties and methods
* @param entries An iterable object that contains key-value entries for properties and methods.
*/
fromEntries<T = any>(entries: Iterable<readonly [PropertyKey, T]>): { [k: string]: T; };
/**
* Returns an object created by key-value entries for properties and methods
* @param entries An iterable object that contains key-value entries for properties and methods.
*/
fromEntries(entries: Iterable<readonly any[]>): any;
}

View file

@ -1,37 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface String {
/** Removes the trailing white space and line terminator characters from a string. */
trimEnd(): string;
/** Removes the leading white space and line terminator characters from a string. */
trimStart(): string;
/**
* Removes the leading white space and line terminator characters from a string.
* @deprecated A legacy feature for browser compatibility. Use `trimStart` instead
*/
trimLeft(): string;
/**
* Removes the trailing white space and line terminator characters from a string.
* @deprecated A legacy feature for browser compatibility. Use `trimEnd` instead
*/
trimRight(): string;
}

View file

@ -1,24 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Symbol {
/**
* Expose the [[Description]] internal slot of a symbol directly.
*/
readonly description: string | undefined;
}

View file

@ -1,728 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2020.intl" />
interface BigIntToLocaleStringOptions {
/**
* The locale matching algorithm to use.The default is "best fit". For information about this option, see the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation Intl page}.
*/
localeMatcher?: string;
/**
* The formatting style to use , the default is "decimal".
*/
style?: string;
numberingSystem?: string;
/**
* The unit to use in unit formatting, Possible values are core unit identifiers, defined in UTS #35, Part 2, Section 6. A subset of units from the full list was selected for use in ECMAScript. Pairs of simple units can be concatenated with "-per-" to make a compound unit. There is no default value; if the style is "unit", the unit property must be provided.
*/
unit?: string;
/**
* The unit formatting style to use in unit formatting, the defaults is "short".
*/
unitDisplay?: string;
/**
* The currency to use in currency formatting. Possible values are the ISO 4217 currency codes, such as "USD" for the US dollar, "EUR" for the euro, or "CNY" for the Chinese RMB see the Current currency & funds code list. There is no default value; if the style is "currency", the currency property must be provided. It is only used when [[Style]] has the value "currency".
*/
currency?: string;
/**
* How to display the currency in currency formatting. It is only used when [[Style]] has the value "currency". The default is "symbol".
*
* "symbol" to use a localized currency symbol such as ,
*
* "code" to use the ISO currency code,
*
* "name" to use a localized currency name such as "dollar"
*/
currencyDisplay?: string;
/**
* Whether to use grouping separators, such as thousands separators or thousand/lakh/crore separators. The default is true.
*/
useGrouping?: boolean;
/**
* The minimum number of integer digits to use. Possible values are from 1 to 21; the default is 1.
*/
minimumIntegerDigits?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21;
/**
* The minimum number of fraction digits to use. Possible values are from 0 to 20; the default for plain number and percent formatting is 0; the default for currency formatting is the number of minor unit digits provided by the {@link http://www.currency-iso.org/en/home/tables/table-a1.html ISO 4217 currency codes list} (2 if the list doesn't provide that information).
*/
minimumFractionDigits?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
/**
* The maximum number of fraction digits to use. Possible values are from 0 to 20; the default for plain number formatting is the larger of minimumFractionDigits and 3; the default for currency formatting is the larger of minimumFractionDigits and the number of minor unit digits provided by the {@link http://www.currency-iso.org/en/home/tables/table-a1.html ISO 4217 currency codes list} (2 if the list doesn't provide that information); the default for percent formatting is the larger of minimumFractionDigits and 0.
*/
maximumFractionDigits?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
/**
* The minimum number of significant digits to use. Possible values are from 1 to 21; the default is 1.
*/
minimumSignificantDigits?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21;
/**
* The maximum number of significant digits to use. Possible values are from 1 to 21; the default is 21.
*/
maximumSignificantDigits?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21;
/**
* The formatting that should be displayed for the number, the defaults is "standard"
*
* "standard" plain number formatting
*
* "scientific" return the order-of-magnitude for formatted number.
*
* "engineering" return the exponent of ten when divisible by three
*
* "compact" string representing exponent, defaults is using the "short" form
*/
notation?: string;
/**
* used only when notation is "compact"
*/
compactDisplay?: string;
}
interface BigInt {
/**
* Returns a string representation of an object.
* @param radix Specifies a radix for converting numeric values to strings.
*/
toString(radix?: number): string;
/** Returns a string representation appropriate to the host environment's current locale. */
toLocaleString(locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions): string;
/** Returns the primitive value of the specified object. */
valueOf(): bigint;
readonly [Symbol.toStringTag]: "BigInt";
}
interface BigIntConstructor {
(value: bigint | boolean | number | string): bigint;
readonly prototype: BigInt;
/**
* Interprets the low bits of a BigInt as a 2's-complement signed integer.
* All higher bits are discarded.
* @param bits The number of low bits to use
* @param int The BigInt whose bits to extract
*/
asIntN(bits: number, int: bigint): bigint;
/**
* Interprets the low bits of a BigInt as an unsigned integer.
* All higher bits are discarded.
* @param bits The number of low bits to use
* @param int The BigInt whose bits to extract
*/
asUintN(bits: number, int: bigint): bigint;
}
declare var BigInt: BigIntConstructor;
/**
* A typed array of 64-bit signed integer values. The contents are initialized to 0. If the
* requested number of bytes could not be allocated, an exception is raised.
*/
interface BigInt64Array {
/** The size in bytes of each element in the array. */
readonly BYTES_PER_ELEMENT: number;
/** The ArrayBuffer instance referenced by the array. */
readonly buffer: ArrayBufferLike;
/** The length in bytes of the array. */
readonly byteLength: number;
/** The offset in bytes of the array. */
readonly byteOffset: number;
/**
* Returns the this object after copying a section of the array identified by start and end
* to the same array starting at position target
* @param target If target is negative, it is treated as length+target where length is the
* length of the array.
* @param start If start is negative, it is treated as length+start. If end is negative, it
* is treated as length+end.
* @param end If not specified, length of the this object is used as its default value.
*/
copyWithin(target: number, start: number, end?: number): this;
/** Yields index, value pairs for every entry in the array. */
entries(): IterableIterator<[number, bigint]>;
/**
* Determines whether all the members of an array satisfy the specified test.
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns false,
* or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean;
/**
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: bigint, start?: number, end?: number): this;
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param predicate A function that accepts up to three arguments. The filter method calls
* the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(predicate: (value: bigint, index: number, array: BigInt64Array) => any, thisArg?: any): BigInt64Array;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
find(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): bigint | undefined;
/**
* Returns the index of the first element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndex(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): number;
/**
* Performs the specified action for each element in an array.
* @param callbackfn A function that accepts up to three arguments. forEach calls the
* callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
forEach(callbackfn: (value: bigint, index: number, array: BigInt64Array) => void, thisArg?: any): void;
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
* @param fromIndex The position in this array at which to begin searching for searchElement.
*/
includes(searchElement: bigint, fromIndex?: number): boolean;
/**
* Returns the index of the first occurrence of a value in an array.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
*/
indexOf(searchElement: bigint, fromIndex?: number): number;
/**
* Adds all the elements of an array separated by the specified separator string.
* @param separator A string used to separate one element of an array from the next in the
* resulting String. If omitted, the array elements are separated with a comma.
*/
join(separator?: string): string;
/** Yields each index in the array. */
keys(): IterableIterator<number>;
/**
* Returns the index of the last occurrence of a value in an array.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
*/
lastIndexOf(searchElement: bigint, fromIndex?: number): number;
/** The length of the array. */
readonly length: number;
/**
* Calls a defined callback function on each element of an array, and returns an array that
* contains the results.
* @param callbackfn A function that accepts up to three arguments. The map method calls the
* callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
map(callbackfn: (value: bigint, index: number, array: BigInt64Array) => bigint, thisArg?: any): BigInt64Array;
/**
* Calls the specified callback function for all the elements in an array. The return value of
* the callback function is the accumulated result, and is provided as an argument in the next
* call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
* callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array) => bigint): bigint;
/**
* Calls the specified callback function for all the elements in an array. The return value of
* the callback function is the accumulated result, and is provided as an argument in the next
* call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
* callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduce<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigInt64Array) => U, initialValue: U): U;
/**
* Calls the specified callback function for all the elements in an array, in descending order.
* The return value of the callback function is the accumulated result, and is provided as an
* argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
* the callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start
* the accumulation. The first call to the callbackfn function provides this value as an
* argument instead of an array value.
*/
reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array) => bigint): bigint;
/**
* Calls the specified callback function for all the elements in an array, in descending order.
* The return value of the callback function is the accumulated result, and is provided as an
* argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
* the callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduceRight<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigInt64Array) => U, initialValue: U): U;
/** Reverses the elements in the array. */
reverse(): this;
/**
* Sets a value or an array of values.
* @param array A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: ArrayLike<bigint>, offset?: number): void;
/**
* Returns a section of an array.
* @param start The beginning of the specified portion of the array.
* @param end The end of the specified portion of the array.
*/
slice(start?: number, end?: number): BigInt64Array;
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param predicate A function that accepts up to three arguments. The some method calls the
* predicate function for each element in the array until the predicate returns true, or until
* the end of the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean;
/**
* Sorts the array.
* @param compareFn The function used to determine the order of the elements. If omitted, the elements are sorted in ascending order.
*/
sort(compareFn?: (a: bigint, b: bigint) => number | bigint): this;
/**
* Gets a new BigInt64Array view of the ArrayBuffer store for this array, referencing the elements
* at begin, inclusive, up to end, exclusive.
* @param begin The index of the beginning of the array.
* @param end The index of the end of the array.
*/
subarray(begin?: number, end?: number): BigInt64Array;
/** Converts the array to a string by using the current locale. */
toLocaleString(): string;
/** Returns a string representation of the array. */
toString(): string;
/** Returns the primitive value of the specified object. */
valueOf(): BigInt64Array;
/** Yields each value in the array. */
values(): IterableIterator<bigint>;
[Symbol.iterator](): IterableIterator<bigint>;
readonly [Symbol.toStringTag]: "BigInt64Array";
[index: number]: bigint;
}
interface BigInt64ArrayConstructor {
readonly prototype: BigInt64Array;
new (length?: number): BigInt64Array;
new (array: Iterable<bigint>): BigInt64Array;
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigInt64Array;
/** The size in bytes of each element in the array. */
readonly BYTES_PER_ELEMENT: number;
/**
* Returns a new array from a set of elements.
* @param items A set of elements to include in the new array object.
*/
of(...items: bigint[]): BigInt64Array;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: ArrayLike<bigint>): BigInt64Array;
from<U>(arrayLike: ArrayLike<U>, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigInt64Array;
}
declare var BigInt64Array: BigInt64ArrayConstructor;
/**
* A typed array of 64-bit unsigned integer values. The contents are initialized to 0. If the
* requested number of bytes could not be allocated, an exception is raised.
*/
interface BigUint64Array {
/** The size in bytes of each element in the array. */
readonly BYTES_PER_ELEMENT: number;
/** The ArrayBuffer instance referenced by the array. */
readonly buffer: ArrayBufferLike;
/** The length in bytes of the array. */
readonly byteLength: number;
/** The offset in bytes of the array. */
readonly byteOffset: number;
/**
* Returns the this object after copying a section of the array identified by start and end
* to the same array starting at position target
* @param target If target is negative, it is treated as length+target where length is the
* length of the array.
* @param start If start is negative, it is treated as length+start. If end is negative, it
* is treated as length+end.
* @param end If not specified, length of the this object is used as its default value.
*/
copyWithin(target: number, start: number, end?: number): this;
/** Yields index, value pairs for every entry in the array. */
entries(): IterableIterator<[number, bigint]>;
/**
* Determines whether all the members of an array satisfy the specified test.
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns false,
* or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean;
/**
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: bigint, start?: number, end?: number): this;
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param predicate A function that accepts up to three arguments. The filter method calls
* the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(predicate: (value: bigint, index: number, array: BigUint64Array) => any, thisArg?: any): BigUint64Array;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
find(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): bigint | undefined;
/**
* Returns the index of the first element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndex(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): number;
/**
* Performs the specified action for each element in an array.
* @param callbackfn A function that accepts up to three arguments. forEach calls the
* callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
forEach(callbackfn: (value: bigint, index: number, array: BigUint64Array) => void, thisArg?: any): void;
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
* @param fromIndex The position in this array at which to begin searching for searchElement.
*/
includes(searchElement: bigint, fromIndex?: number): boolean;
/**
* Returns the index of the first occurrence of a value in an array.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
*/
indexOf(searchElement: bigint, fromIndex?: number): number;
/**
* Adds all the elements of an array separated by the specified separator string.
* @param separator A string used to separate one element of an array from the next in the
* resulting String. If omitted, the array elements are separated with a comma.
*/
join(separator?: string): string;
/** Yields each index in the array. */
keys(): IterableIterator<number>;
/**
* Returns the index of the last occurrence of a value in an array.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
*/
lastIndexOf(searchElement: bigint, fromIndex?: number): number;
/** The length of the array. */
readonly length: number;
/**
* Calls a defined callback function on each element of an array, and returns an array that
* contains the results.
* @param callbackfn A function that accepts up to three arguments. The map method calls the
* callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
map(callbackfn: (value: bigint, index: number, array: BigUint64Array) => bigint, thisArg?: any): BigUint64Array;
/**
* Calls the specified callback function for all the elements in an array. The return value of
* the callback function is the accumulated result, and is provided as an argument in the next
* call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
* callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array) => bigint): bigint;
/**
* Calls the specified callback function for all the elements in an array. The return value of
* the callback function is the accumulated result, and is provided as an argument in the next
* call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
* callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduce<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array) => U, initialValue: U): U;
/**
* Calls the specified callback function for all the elements in an array, in descending order.
* The return value of the callback function is the accumulated result, and is provided as an
* argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
* the callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start
* the accumulation. The first call to the callbackfn function provides this value as an
* argument instead of an array value.
*/
reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array) => bigint): bigint;
/**
* Calls the specified callback function for all the elements in an array, in descending order.
* The return value of the callback function is the accumulated result, and is provided as an
* argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
* the callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduceRight<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array) => U, initialValue: U): U;
/** Reverses the elements in the array. */
reverse(): this;
/**
* Sets a value or an array of values.
* @param array A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: ArrayLike<bigint>, offset?: number): void;
/**
* Returns a section of an array.
* @param start The beginning of the specified portion of the array.
* @param end The end of the specified portion of the array.
*/
slice(start?: number, end?: number): BigUint64Array;
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param predicate A function that accepts up to three arguments. The some method calls the
* predicate function for each element in the array until the predicate returns true, or until
* the end of the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean;
/**
* Sorts the array.
* @param compareFn The function used to determine the order of the elements. If omitted, the elements are sorted in ascending order.
*/
sort(compareFn?: (a: bigint, b: bigint) => number | bigint): this;
/**
* Gets a new BigUint64Array view of the ArrayBuffer store for this array, referencing the elements
* at begin, inclusive, up to end, exclusive.
* @param begin The index of the beginning of the array.
* @param end The index of the end of the array.
*/
subarray(begin?: number, end?: number): BigUint64Array;
/** Converts the array to a string by using the current locale. */
toLocaleString(): string;
/** Returns a string representation of the array. */
toString(): string;
/** Returns the primitive value of the specified object. */
valueOf(): BigUint64Array;
/** Yields each value in the array. */
values(): IterableIterator<bigint>;
[Symbol.iterator](): IterableIterator<bigint>;
readonly [Symbol.toStringTag]: "BigUint64Array";
[index: number]: bigint;
}
interface BigUint64ArrayConstructor {
readonly prototype: BigUint64Array;
new (length?: number): BigUint64Array;
new (array: Iterable<bigint>): BigUint64Array;
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigUint64Array;
/** The size in bytes of each element in the array. */
readonly BYTES_PER_ELEMENT: number;
/**
* Returns a new array from a set of elements.
* @param items A set of elements to include in the new array object.
*/
of(...items: bigint[]): BigUint64Array;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: ArrayLike<bigint>): BigUint64Array;
from<U>(arrayLike: ArrayLike<U>, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigUint64Array;
}
declare var BigUint64Array: BigUint64ArrayConstructor;
interface DataView {
/**
* Gets the BigInt64 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read.
*/
getBigInt64(byteOffset: number, littleEndian?: boolean): bigint;
/**
* Gets the BigUint64 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read.
*/
getBigUint64(byteOffset: number, littleEndian?: boolean): bigint;
/**
* Stores a BigInt64 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written.
*/
setBigInt64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
/**
* Stores a BigUint64 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written.
*/
setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
}
declare namespace Intl {
interface NumberFormat {
format(value: number | bigint): string;
resolvedOptions(): ResolvedNumberFormatOptions;
}
}

View file

@ -1,27 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2019" />
/// <reference lib="es2020.bigint" />
/// <reference lib="es2020.date" />
/// <reference lib="es2020.number" />
/// <reference lib="es2020.promise" />
/// <reference lib="es2020.sharedmemory" />
/// <reference lib="es2020.string" />
/// <reference lib="es2020.symbol.wellknown" />
/// <reference lib="es2020.intl" />

View file

@ -1,42 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2020.intl" />
interface Date {
/**
* Converts a date and time to a string by using the current or specified locale.
* @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date to a string by using the current or specified locale.
* @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleDateString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a time to a string by using the current or specified locale.
* @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleTimeString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
}

View file

@ -1,24 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2020" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />
/// <reference lib="dom.asynciterable" />

View file

@ -1,449 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2018.intl" />
declare namespace Intl {
/**
* A string that is a valid [Unicode BCP 47 Locale Identifier](https://unicode.org/reports/tr35/#Unicode_locale_identifier).
*
* For example: "fa", "es-MX", "zh-Hant-TW".
*
* See [MDN - Intl - locales argument](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
*/
type UnicodeBCP47LocaleIdentifier = string;
/**
* Unit to use in the relative time internationalized message.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/format#Parameters).
*/
type RelativeTimeFormatUnit =
| "year"
| "years"
| "quarter"
| "quarters"
| "month"
| "months"
| "week"
| "weeks"
| "day"
| "days"
| "hour"
| "hours"
| "minute"
| "minutes"
| "second"
| "seconds";
/**
* Value of the `unit` property in objects returned by
* `Intl.RelativeTimeFormat.prototype.formatToParts()`. `formatToParts` and
* `format` methods accept either singular or plural unit names as input,
* but `formatToParts` only outputs singular (e.g. "day") not plural (e.g.
* "days").
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts#Using_formatToParts).
*/
type RelativeTimeFormatUnitSingular =
| "year"
| "quarter"
| "month"
| "week"
| "day"
| "hour"
| "minute"
| "second";
/**
* The locale matching algorithm to use.
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
*/
type RelativeTimeFormatLocaleMatcher = "lookup" | "best fit";
/**
* The format of output message.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).
*/
type RelativeTimeFormatNumeric = "always" | "auto";
/**
* The length of the internationalized message.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).
*/
type RelativeTimeFormatStyle = "long" | "short" | "narrow";
/**
* The locale or locales to use
*
* See [MDN - Intl - locales argument](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
*/
type LocalesArgument = UnicodeBCP47LocaleIdentifier | Locale | readonly (UnicodeBCP47LocaleIdentifier | Locale)[] | undefined;
/**
* An object with some or all of properties of `options` parameter
* of `Intl.RelativeTimeFormat` constructor.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).
*/
interface RelativeTimeFormatOptions {
/** The locale matching algorithm to use. For information about this option, see [Intl page](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation). */
localeMatcher?: RelativeTimeFormatLocaleMatcher;
/** The format of output message. */
numeric?: RelativeTimeFormatNumeric;
/** The length of the internationalized message. */
style?: RelativeTimeFormatStyle;
}
/**
* An object with properties reflecting the locale
* and formatting options computed during initialization
* of the `Intl.RelativeTimeFormat` object
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/resolvedOptions#Description).
*/
interface ResolvedRelativeTimeFormatOptions {
locale: UnicodeBCP47LocaleIdentifier;
style: RelativeTimeFormatStyle;
numeric: RelativeTimeFormatNumeric;
numberingSystem: string;
}
/**
* An object representing the relative time format in parts
* that can be used for custom locale-aware formatting.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts#Using_formatToParts).
*/
type RelativeTimeFormatPart =
| {
type: "literal";
value: string;
}
| {
type: Exclude<NumberFormatPartTypes, "literal">;
value: string;
unit: RelativeTimeFormatUnitSingular;
};
interface RelativeTimeFormat {
/**
* Formats a value and a unit according to the locale
* and formatting options of the given
* [`Intl.RelativeTimeFormat`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)
* object.
*
* While this method automatically provides the correct plural forms,
* the grammatical form is otherwise as neutral as possible.
*
* It is the caller's responsibility to handle cut-off logic
* such as deciding between displaying "in 7 days" or "in 1 week".
* This API does not support relative dates involving compound units.
* e.g "in 5 days and 4 hours".
*
* @param value - Numeric value to use in the internationalized relative time message
*
* @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit) to use in the relative time internationalized message.
*
* @throws `RangeError` if `unit` was given something other than `unit` possible values
*
* @returns {string} Internationalized relative time message as string
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/format).
*/
format(value: number, unit: RelativeTimeFormatUnit): string;
/**
* Returns an array of objects representing the relative time format in parts that can be used for custom locale-aware formatting.
*
* @param value - Numeric value to use in the internationalized relative time message
*
* @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit) to use in the relative time internationalized message.
*
* @throws `RangeError` if `unit` was given something other than `unit` possible values
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts).
*/
formatToParts(value: number, unit: RelativeTimeFormatUnit): RelativeTimeFormatPart[];
/**
* Provides access to the locale and options computed during initialization of this `Intl.RelativeTimeFormat` object.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/resolvedOptions).
*/
resolvedOptions(): ResolvedRelativeTimeFormatOptions;
}
/**
* The [`Intl.RelativeTimeFormat`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)
* object is a constructor for objects that enable language-sensitive relative time formatting.
*
* [Compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat#Browser_compatibility).
*/
const RelativeTimeFormat: {
/**
* Creates [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) objects
*
* @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
* For the general form and interpretation of the locales argument,
* see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
*
* @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters)
* with some or all of options of `RelativeTimeFormatOptions`.
*
* @returns [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) object.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat).
*/
new (
locales?: LocalesArgument,
options?: RelativeTimeFormatOptions,
): RelativeTimeFormat;
/**
* Returns an array containing those of the provided locales
* that are supported in date and time formatting
* without having to fall back to the runtime's default locale.
*
* @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
* For the general form and interpretation of the locales argument,
* see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
*
* @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters)
* with some or all of options of the formatting.
*
* @returns An array containing those of the provided locales
* that are supported in date and time formatting
* without having to fall back to the runtime's default locale.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/supportedLocalesOf).
*/
supportedLocalesOf(
locales?: LocalesArgument,
options?: RelativeTimeFormatOptions,
): UnicodeBCP47LocaleIdentifier[];
};
interface NumberFormatOptions {
compactDisplay?: "short" | "long" | undefined;
notation?: "standard" | "scientific" | "engineering" | "compact" | undefined;
signDisplay?: "auto" | "never" | "always" | "exceptZero" | undefined;
unit?: string | undefined;
unitDisplay?: "short" | "long" | "narrow" | undefined;
currencyDisplay?: string | undefined;
currencySign?: string | undefined;
}
interface ResolvedNumberFormatOptions {
compactDisplay?: "short" | "long";
notation?: "standard" | "scientific" | "engineering" | "compact";
signDisplay?: "auto" | "never" | "always" | "exceptZero";
unit?: string;
unitDisplay?: "short" | "long" | "narrow";
currencyDisplay?: string;
currencySign?: string;
}
interface DateTimeFormatOptions {
calendar?: string | undefined;
dayPeriod?: "narrow" | "short" | "long" | undefined;
numberingSystem?: string | undefined;
dateStyle?: "full" | "long" | "medium" | "short" | undefined;
timeStyle?: "full" | "long" | "medium" | "short" | undefined;
hourCycle?: "h11" | "h12" | "h23" | "h24" | undefined;
}
type LocaleHourCycleKey = "h12" | "h23" | "h11" | "h24";
type LocaleCollationCaseFirst = "upper" | "lower" | "false";
interface LocaleOptions {
/** A string containing the language, and the script and region if available. */
baseName?: string;
/** The part of the Locale that indicates the locale's calendar era. */
calendar?: string;
/** Flag that defines whether case is taken into account for the locale's collation rules. */
caseFirst?: LocaleCollationCaseFirst;
/** The collation type used for sorting */
collation?: string;
/** The time keeping format convention used by the locale. */
hourCycle?: LocaleHourCycleKey;
/** The primary language subtag associated with the locale. */
language?: string;
/** The numeral system used by the locale. */
numberingSystem?: string;
/** Flag that defines whether the locale has special collation handling for numeric characters. */
numeric?: boolean;
/** The region of the world (usually a country) associated with the locale. Possible values are region codes as defined by ISO 3166-1. */
region?: string;
/** The script used for writing the particular language used in the locale. Possible values are script codes as defined by ISO 15924. */
script?: string;
}
interface Locale extends LocaleOptions {
/** A string containing the language, and the script and region if available. */
baseName: string;
/** The primary language subtag associated with the locale. */
language: string;
/** Gets the most likely values for the language, script, and region of the locale based on existing values. */
maximize(): Locale;
/** Attempts to remove information about the locale that would be added by calling `Locale.maximize()`. */
minimize(): Locale;
/** Returns the locale's full locale identifier string. */
toString(): UnicodeBCP47LocaleIdentifier;
}
/**
* Constructor creates [Intl.Locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale)
* objects
*
* @param tag - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646).
* For the general form and interpretation of the locales argument,
* see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
*
* @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/Locale#Parameters) with some or all of options of the locale.
*
* @returns [Intl.Locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale) object.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale).
*/
const Locale: {
new (tag: UnicodeBCP47LocaleIdentifier | Locale, options?: LocaleOptions): Locale;
};
type DisplayNamesFallback =
| "code"
| "none";
type DisplayNamesType =
| "language"
| "region"
| "script"
| "calendar"
| "dateTimeField"
| "currency";
type DisplayNamesLanguageDisplay =
| "dialect"
| "standard";
interface DisplayNamesOptions {
localeMatcher?: RelativeTimeFormatLocaleMatcher;
style?: RelativeTimeFormatStyle;
type: DisplayNamesType;
languageDisplay?: DisplayNamesLanguageDisplay;
fallback?: DisplayNamesFallback;
}
interface ResolvedDisplayNamesOptions {
locale: UnicodeBCP47LocaleIdentifier;
style: RelativeTimeFormatStyle;
type: DisplayNamesType;
fallback: DisplayNamesFallback;
languageDisplay?: DisplayNamesLanguageDisplay;
}
interface DisplayNames {
/**
* Receives a code and returns a string based on the locale and options provided when instantiating
* [`Intl.DisplayNames()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames)
*
* @param code The `code` to provide depends on the `type` passed to display name during creation:
* - If the type is `"region"`, code should be either an [ISO-3166 two letters region code](https://www.iso.org/iso-3166-country-codes.html),
* or a [three digits UN M49 Geographic Regions](https://unstats.un.org/unsd/methodology/m49/).
* - If the type is `"script"`, code should be an [ISO-15924 four letters script code](https://unicode.org/iso15924/iso15924-codes.html).
* - If the type is `"language"`, code should be a `languageCode` ["-" `scriptCode`] ["-" `regionCode` ] *("-" `variant` )
* subsequence of the unicode_language_id grammar in [UTS 35's Unicode Language and Locale Identifiers grammar](https://unicode.org/reports/tr35/#Unicode_language_identifier).
* `languageCode` is either a two letters ISO 639-1 language code or a three letters ISO 639-2 language code.
* - If the type is `"currency"`, code should be a [3-letter ISO 4217 currency code](https://www.iso.org/iso-4217-currency-codes.html).
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/of).
*/
of(code: string): string | undefined;
/**
* Returns a new object with properties reflecting the locale and style formatting options computed during the construction of the current
* [`Intl/DisplayNames`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames) object.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions).
*/
resolvedOptions(): ResolvedDisplayNamesOptions;
}
/**
* The [`Intl.DisplayNames()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames)
* object enables the consistent translation of language, region and script display names.
*
* [Compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames#browser_compatibility).
*/
const DisplayNames: {
prototype: DisplayNames;
/**
* @param locales A string with a BCP 47 language tag, or an array of such strings.
* For the general form and interpretation of the `locales` argument, see the [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation)
* page.
*
* @param options An object for setting up a display name.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/DisplayNames).
*/
new (locales: LocalesArgument, options: DisplayNamesOptions): DisplayNames;
/**
* Returns an array containing those of the provided locales that are supported in display names without having to fall back to the runtime's default locale.
*
* @param locales A string with a BCP 47 language tag, or an array of such strings.
* For the general form and interpretation of the `locales` argument, see the [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation)
* page.
*
* @param options An object with a locale matcher.
*
* @returns An array of strings representing a subset of the given locale tags that are supported in display names without having to fall back to the runtime's default locale.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf).
*/
supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: RelativeTimeFormatLocaleMatcher; }): UnicodeBCP47LocaleIdentifier[];
};
interface CollatorConstructor {
new (locales?: LocalesArgument, options?: CollatorOptions): Collator;
(locales?: LocalesArgument, options?: CollatorOptions): Collator;
supportedLocalesOf(locales: LocalesArgument, options?: CollatorOptions): string[];
}
interface DateTimeFormatConstructor {
new (locales?: LocalesArgument, options?: DateTimeFormatOptions): DateTimeFormat;
(locales?: LocalesArgument, options?: DateTimeFormatOptions): DateTimeFormat;
supportedLocalesOf(locales: LocalesArgument, options?: DateTimeFormatOptions): string[];
}
interface NumberFormatConstructor {
new (locales?: LocalesArgument, options?: NumberFormatOptions): NumberFormat;
(locales?: LocalesArgument, options?: NumberFormatOptions): NumberFormat;
supportedLocalesOf(locales: LocalesArgument, options?: NumberFormatOptions): string[];
}
interface PluralRulesConstructor {
new (locales?: LocalesArgument, options?: PluralRulesOptions): PluralRules;
(locales?: LocalesArgument, options?: PluralRulesOptions): PluralRules;
supportedLocalesOf(locales: LocalesArgument, options?: { localeMatcher?: "lookup" | "best fit"; }): string[];
}
}

Some files were not shown because too many files have changed in this diff Show more