Premier commit déjà bien avancé

This commit is contained in:
2025-11-10 18:33:24 +01:00
commit db4f0508cb
652 changed files with 440521 additions and 0 deletions

21
frontend/node_modules/@lezer/common/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
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.

14
frontend/node_modules/@lezer/common/README.md generated vendored Normal file
View File

@ -0,0 +1,14 @@
# @lezer/common
[ [**WEBSITE**](http://lezer.codemirror.net) | [**ISSUES**](https://github.com/lezer-parser/lezer/issues) | [**FORUM**](https://discuss.codemirror.net/c/lezer) | [**CHANGELOG**](https://github.com/lezer-parser/common/blob/master/CHANGELOG.md) ]
[Lezer](https://lezer.codemirror.net/) is an incremental parser system
intended for use in an editor or similar system.
@lezer/common provides the syntax tree data structure and parser
abstractions for Lezer parsers.
Its programming interface is documented on [the
website](https://lezer.codemirror.net/docs/ref/#common).
This code is licensed under an MIT license.

2192
frontend/node_modules/@lezer/common/dist/index.cjs generated vendored Normal file

File diff suppressed because it is too large Load Diff

1144
frontend/node_modules/@lezer/common/dist/index.d.cts generated vendored Normal file

File diff suppressed because it is too large Load Diff

1144
frontend/node_modules/@lezer/common/dist/index.d.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

2179
frontend/node_modules/@lezer/common/dist/index.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

32
frontend/node_modules/@lezer/common/package.json generated vendored Normal file
View File

@ -0,0 +1,32 @@
{
"name": "@lezer/common",
"version": "1.3.0",
"description": "Syntax tree data structure and parser interfaces for the lezer parser",
"main": "dist/index.cjs",
"type": "module",
"exports": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"module": "dist/index.js",
"types": "dist/index.d.ts",
"author": "Marijn Haverbeke <marijn@haverbeke.berlin>",
"license": "MIT",
"devDependencies": {
"ist": "^1.1.1",
"@marijn/buildtool": "^0.1.5",
"@types/mocha": "^5.2.6",
"mocha": "^10.2.0",
"ts-node": "^10.9.2"
},
"files": ["dist"],
"repository": {
"type" : "git",
"url" : "https://github.com/lezer-parser/common.git"
},
"scripts": {
"watch": "node build.js --watch",
"prepare": "node build.js",
"test": "mocha"
}
}

277
frontend/node_modules/@lezer/css/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,277 @@
## 1.3.0 (2025-07-07)
### Bug fixes
Values wrapped in brackets can now contain more types of tokens.
Properly support hex escapes in identifiers.
Support variable names as callees in call expressions.
### New features
Add support for `@scope` syntax.
Add support for `if` notation.
## 1.2.1 (2025-05-15)
### Bug fixes
Fix parsing of `*` selectors in descendant positions.
## 1.2.0 (2025-05-12)
### Bug fixes
Allow @ keywords to start with a dash, since prefixed ones exist.
Bump the dependency on @lezer/lr to a version that supports local token groups. Also bump @lezer/generator dependency
### New features
Add support for range queries.
`@import` statements now support `layer` syntax.
Support relative versions of the `+`, `>`, and `~` selectors, which omit the left-hand selector. Allow @-keywords to start with a dash
## 1.1.11 (2025-03-24)
### Bug fixes
Accept trailing commas in argument lists.
## 1.1.10 (2025-01-24)
### Bug fixes
Emit a node for class selector dots.
## 1.1.9 (2024-09-10)
### Bug fixes
Allow `url()` values to be empty.
Don't generate a parse error when declarations don't have a value.
## 1.1.8 (2024-02-19)
### Bug fixes
Follow the standard, allowing digits in unit identifiers.
## 1.1.7 (2024-01-08)
### Bug fixes
Correctly parse properties with a space before the colon.
## 1.1.6 (2024-01-01)
### Bug fixes
Add support for bracketed grid line names.
## 1.1.5 (2023-12-28)
### Bug fixes
Tag comments and strings as isolating for the purpose of bidirectional text.
## 1.1.4 (2023-11-09)
### Bug fixes
Fix parsing of `&` selectors in descendant selectors.
Allow identifiers to contain backslash escapes.
## 1.1.3 (2023-07-03)
### Bug fixes
Comments are now parsed to end of file if no closing `*/` is found.
Make the package work with new TS resolution styles.
## 1.1.2 (2023-05-15)
### Bug fixes
Make keyframe selector parsing more flexible to support timeline ranges.
Allow multiple comma-separated keyframe selectors per keyframe.
## 1.1.1 (2022-12-02)
### Bug fixes
The `Styles` top rule now also recognizes nested rules.
## 1.1.0 (2022-11-25)
### Bug fixes
Don't emit an error node when the input is empty. Export a Styles top-level rule for parsing lists of properties
### New features
The new `Styles` top-level rule can be used to parse semicolon-separated lists of properties.
## 1.0.1 (2022-10-10)
### Bug fixes
Add support for the `is`, `where`, `host-context`, `nth-last-of-type`, and `nth-of-type` pseudo classes.
Apply a consistent highlighting tag (`definitionKeyword`) to all @ keywords.
## 1.0.0 (2022-06-06)
### New features
First stable version.
## 0.16.0 (2022-04-20)
### Breaking changes
Move to 0.16 serialized parser format.
### New features
The parser now includes syntax highlighting information in its node types.
## 0.15.2 (2021-09-24)
### Bug fixes
Distinguish between variable names and other names.
Fix the name of nodes for the `selector` keyword (which by accident was `callee` before).
## 0.15.1 (2021-08-31)
### Bug fixes
Fix parsing of selector arguments to pseudo selectors.
## 0.15.0 (2021-08-11)
### Breaking changes
The module's name changed from `lezer-css` to `@lezer/css`.
Upgrade to the 0.15.0 lezer interfaces.
## 0.13.1 (2020-12-04)
### Bug fixes
Fix versions of lezer packages depended on.
## 0.13.0 (2020-12-04)
## 0.12.0 (2020-10-23)
### Breaking changes
Adjust to changed serialized parser format.
## 0.11.1 (2020-09-26)
### Bug fixes
Fix lezer depencency versions
## 0.11.0 (2020-09-26)
### Breaking changes
Follow change in serialized parser format.
## 0.10.1 (2020-09-02)
### Bug fixes
Fix a conflicting pair of tokens that the generator previously didn't catch.
## 0.10.0 (2020-08-07)
### Breaking changes
Upgrade to 0.10 parser serialization
## 0.9.0 (2020-06-08)
### Breaking changes
Upgrade to 0.9 parser serialization
## 0.8.3 (2020-04-09)
### Bug fixes
Regenerate parser with a fix in lezer-generator so that the top node prop is properly assigned.
## 0.8.2 (2020-04-01)
### Bug fixes
Make the package load as an ES module on node
## 0.8.1 (2020-02-28)
### New features
Provide an ES module file.
## 0.8.0 (2020-02-03)
### New features
Follow 0.8.0 release of the library.
## 0.7.0 (2020-01-20)
### Breaking changes
Use the lezer 0.7.0 parser format.
## 0.5.2 (2020-01-15)
### Bug fixes
Regenerate with lezer-generator 0.5.2 to avoid cyclic forced reductions.
## 0.5.1 (2019-10-22)
### Bug fixes
Fix top prop missing from build output.
## 0.5.0 (2019-10-22)
### Breaking changes
Move from `lang` to `top` prop on document node.
## 0.4.0 (2019-09-10)
### Breaking changes
Adjust to 0.4.0 parse table format.
## 0.3.0 (2019-08-22)
### New features
Go back to node names, add props, follow changes in grammar syntax.
## 0.2.0 (2019-08-02)
### New Features
First documented release.

21
frontend/node_modules/@lezer/css/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
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.

6
frontend/node_modules/@lezer/css/README.md generated vendored Normal file
View File

@ -0,0 +1,6 @@
# @lezer/css
This is a CSS grammar for the
[lezer](https://lezer.codemirror.net/) parser system.
The code is licensed under an MIT license.

148
frontend/node_modules/@lezer/css/dist/index.cjs generated vendored Normal file
View File

@ -0,0 +1,148 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var lr = require('@lezer/lr');
var highlight = require('@lezer/highlight');
// This file was generated by lezer-generator. You probably shouldn't edit it.
const descendantOp = 122,
Unit = 1,
identifier = 123,
callee = 124,
VariableName = 2,
queryIdentifier = 125,
queryVariableName = 3,
QueryCallee = 4;
/* Hand-written tokenizers for CSS tokens that can't be
expressed by Lezer's built-in tokenizer. */
const space = [9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197,
8198, 8199, 8200, 8201, 8202, 8232, 8233, 8239, 8287, 12288];
const colon = 58, parenL = 40, underscore = 95, bracketL = 91, dash = 45, period = 46,
hash = 35, percent = 37, ampersand = 38, backslash = 92, newline = 10, asterisk = 42;
function isAlpha(ch) { return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 161 }
function isDigit(ch) { return ch >= 48 && ch <= 57 }
function isHex(ch) { return isDigit(ch) || ch >= 97 && ch <= 102 || ch >= 65 && ch <= 70 }
const identifierTokens = (id, varName, callee) => (input, stack) => {
for (let inside = false, dashes = 0, i = 0;; i++) {
let {next} = input;
if (isAlpha(next) || next == dash || next == underscore || (inside && isDigit(next))) {
if (!inside && (next != dash || i > 0)) inside = true;
if (dashes === i && next == dash) dashes++;
input.advance();
} else if (next == backslash && input.peek(1) != newline) {
input.advance();
if (isHex(input.next)) {
do { input.advance(); } while (isHex(input.next))
if (input.next == 32) input.advance();
} else if (input.next > -1) {
input.advance();
}
inside = true;
} else {
if (inside) input.acceptToken(
dashes == 2 && stack.canShift(VariableName) ? varName : next == parenL ? callee : id
);
break
}
}
};
const identifiers = new lr.ExternalTokenizer(
identifierTokens(identifier, VariableName, callee)
);
const queryIdentifiers = new lr.ExternalTokenizer(
identifierTokens(queryIdentifier, queryVariableName, QueryCallee)
);
const descendant = new lr.ExternalTokenizer(input => {
if (space.includes(input.peek(-1))) {
let {next} = input;
if (isAlpha(next) || next == underscore || next == hash || next == period ||
next == asterisk || next == bracketL || next == colon && isAlpha(input.peek(1)) ||
next == dash || next == ampersand)
input.acceptToken(descendantOp);
}
});
const unitToken = new lr.ExternalTokenizer(input => {
if (!space.includes(input.peek(-1))) {
let {next} = input;
if (next == percent) { input.advance(); input.acceptToken(Unit); }
if (isAlpha(next)) {
do { input.advance(); } while (isAlpha(input.next) || isDigit(input.next))
input.acceptToken(Unit);
}
}
});
const cssHighlighting = highlight.styleTags({
"AtKeyword import charset namespace keyframes media supports": highlight.tags.definitionKeyword,
"from to selector": highlight.tags.keyword,
NamespaceName: highlight.tags.namespace,
KeyframeName: highlight.tags.labelName,
KeyframeRangeName: highlight.tags.operatorKeyword,
TagName: highlight.tags.tagName,
ClassName: highlight.tags.className,
PseudoClassName: highlight.tags.constant(highlight.tags.className),
IdName: highlight.tags.labelName,
"FeatureName PropertyName": highlight.tags.propertyName,
AttributeName: highlight.tags.attributeName,
NumberLiteral: highlight.tags.number,
KeywordQuery: highlight.tags.keyword,
UnaryQueryOp: highlight.tags.operatorKeyword,
"CallTag ValueName": highlight.tags.atom,
VariableName: highlight.tags.variableName,
Callee: highlight.tags.operatorKeyword,
Unit: highlight.tags.unit,
"UniversalSelector NestingSelector": highlight.tags.definitionOperator,
"MatchOp CompareOp": highlight.tags.compareOperator,
"ChildOp SiblingOp, LogicOp": highlight.tags.logicOperator,
BinOp: highlight.tags.arithmeticOperator,
Important: highlight.tags.modifier,
Comment: highlight.tags.blockComment,
ColorLiteral: highlight.tags.color,
"ParenthesizedContent StringLiteral": highlight.tags.string,
":": highlight.tags.punctuation,
"PseudoOp #": highlight.tags.derefOperator,
"; ,": highlight.tags.separator,
"( )": highlight.tags.paren,
"[ ]": highlight.tags.squareBracket,
"{ }": highlight.tags.brace
});
// This file was generated by lezer-generator. You probably shouldn't edit it.
const spec_callee = {__proto__:null,lang:38, "nth-child":38, "nth-last-child":38, "nth-of-type":38, "nth-last-of-type":38, dir:38, "host-context":38, if:84, url:124, "url-prefix":124, domain:124, regexp:124};
const spec_queryIdentifier = {__proto__:null,or:98, and:98, not:106, only:106, layer:170};
const spec_QueryCallee = {__proto__:null,selector:112, layer:166};
const spec_AtKeyword = {__proto__:null,"@import":162, "@media":174, "@charset":178, "@namespace":182, "@keyframes":188, "@supports":200, "@scope":204};
const spec_identifier = {__proto__:null,to:207};
const parser = lr.LRParser.deserialize({
version: 14,
states: "EbQYQdOOO#qQdOOP#xO`OOOOQP'#Cf'#CfOOQP'#Ce'#CeO#}QdO'#ChO$nQaO'#CcO$xQdO'#CkO%TQdO'#DpO%YQdO'#DrO%_QdO'#DuO%_QdO'#DxOOQP'#FV'#FVO&eQhO'#EhOOQS'#FU'#FUOOQS'#Ek'#EkQYQdOOO&lQdO'#EOO&PQhO'#EUO&lQdO'#EWO'aQdO'#EYO'lQdO'#E]O'tQhO'#EcO(VQdO'#EeO(bQaO'#CfO)VQ`O'#D{O)[Q`O'#F`O)gQdO'#F`QOQ`OOP)qO&jO'#CaPOOO)C@t)C@tOOQP'#Cj'#CjOOQP,59S,59SO#}QdO,59SO)|QdO,59VO%TQdO,5:[O%YQdO,5:^O%_QdO,5:aO%_QdO,5:cO%_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%e$^Q&Y%aQ&]%fR&v&XSjPzQ!}kQ$c!{R%k$dZiPkz!{$dR$P!gQ%}%SR&z&mR!rdR!teR$Z!tS%a$Y%bR&t&WV%_$Y%b&WQ#PmR$g#PQ`OSkPzU!a`k$dR$d!{Q$p#aY%p$p%u&d&l'QQ%u$sQ&d%qQ&l%zR'Q&xQ#t!cQ#v!dQ#x!eV$}#t#v#xQ%X$RR&T%XQ%y$zS&k%y&yR&y&lQ%r$pR&e%rQ%n$mR&c%nQyUR#]yQ%i$aR&_%iQ!|jS$e!|$fR$f!}Q&n%}R&{&nQ#k!ZR$x#kQ%b$YR&Z%bQ&X%aR&u&X__OP`kz!{$d^UOP`kz!{$dQ!VYQ!WZQ#XuQ#YvQ#ZwQ#[xQ$]!vQ$m#`R&b%mR$q#aQ!gaQ!oc[#q!c!d!e#t#v#xQ$a!zd$o#a$p$s%q%u%z&d&l&x'QQ$r#cQ%R#{S%g$a%iQ%l$kQ&^%hR&p&P]#s!c!d!e#t#v#xW!Z]b!g$PQ!ufQ#f!YQ#l![Q$v#iQ$w#jQ$z#mS%V$R%XR&i%xQ#h!YQ%w$tR&w&hR$|#mR$n#`QlPR#_zQ!_]Q!nbQ$O!gR%U$P",
nodeNames: "⚠ Unit VariableName VariableName QueryCallee Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NestingSelector ClassSelector . ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue AtKeyword # ; ] [ BracketedValue } { BracedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee IfExpression if ArgList IfBranch KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp ComparisonQuery CompareOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector ParenthesizedSelector CallQuery ArgList , CallLiteral CallTag ParenthesizedContent PseudoClassName ArgList IdSelector IdName AttributeSelector AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp Block Declaration PropertyName Important ImportStatement import Layer layer LayerName layer MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports ScopeStatement scope to AtRule Styles",
maxTerm: 143,
nodeProps: [
["isolate", -2,5,36,""],
["openedBy", 20,"(",28,"[",31,"{"],
["closedBy", 21,")",29,"]",32,"}"]
],
propSources: [cssHighlighting],
skippedNodes: [0,5,106],
repeatNodeCount: 15,
tokenData: "JQ~R!YOX$qX^%i^p$qpq%iqr({rs-ust/itu6Wuv$qvw7Qwx7cxy9Qyz9cz{9h{|:R|}>t}!O?V!O!P?t!P!Q@]!Q![AU![!]BP!]!^B{!^!_C^!_!`DY!`!aDm!a!b$q!b!cEn!c!}$q!}#OG{#O#P$q#P#QH^#Q#R6W#R#o$q#o#pHo#p#q6W#q#rIQ#r#sIc#s#y$q#y#z%i#z$f$q$f$g%i$g#BY$q#BY#BZ%i#BZ$IS$q$IS$I_%i$I_$I|$q$I|$JO%i$JO$JT$q$JT$JU%i$JU$KV$q$KV$KW%i$KW&FU$q&FU&FV%i&FV;'S$q;'S;=`Iz<%lO$q`$tSOy%Qz;'S%Q;'S;=`%c<%lO%Q`%VS!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Q`%fP;=`<%l%Q~%nh#s~OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$JO$JT%Q$JT$JU'Y$JU$KV%Q$KV$KW'Y$KW&FU%Q&FU&FV'Y&FV;'S%Q;'S;=`%c<%lO%Q~'ah#s~!a`OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$JO$JT%Q$JT$JU'Y$JU$KV%Q$KV$KW'Y$KW&FU%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%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Q`I}P;=`<%l$q",
tokenizers: [descendant, unitToken, identifiers, queryIdentifiers, 1, 2, 3, 4, new lr.LocalTokenGroup("m~RRYZ[z{a~~g~aO#v~~dP!P!Qg~lO#w~~", 28, 129)],
topRules: {"StyleSheet":[0,6],"Styles":[1,105]},
specialized: [{term: 124, get: (value) => spec_callee[value] || -1},{term: 125, get: (value) => spec_queryIdentifier[value] || -1},{term: 4, get: (value) => spec_QueryCallee[value] || -1},{term: 25, get: (value) => spec_AtKeyword[value] || -1},{term: 123, get: (value) => spec_identifier[value] || -1}],
tokenPrec: 1963
});
exports.parser = parser;

3
frontend/node_modules/@lezer/css/dist/index.d.cts generated vendored Normal file
View File

@ -0,0 +1,3 @@
import {LRParser} from "@lezer/lr"
export const parser: LRParser

3
frontend/node_modules/@lezer/css/dist/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,3 @@
import {LRParser} from "@lezer/lr"
export const parser: LRParser

144
frontend/node_modules/@lezer/css/dist/index.js generated vendored Normal file
View File

@ -0,0 +1,144 @@
import { ExternalTokenizer, LRParser, LocalTokenGroup } from '@lezer/lr';
import { styleTags, tags } from '@lezer/highlight';
// This file was generated by lezer-generator. You probably shouldn't edit it.
const descendantOp = 122,
Unit = 1,
identifier = 123,
callee = 124,
VariableName = 2,
queryIdentifier = 125,
queryVariableName = 3,
QueryCallee = 4;
/* Hand-written tokenizers for CSS tokens that can't be
expressed by Lezer's built-in tokenizer. */
const space = [9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197,
8198, 8199, 8200, 8201, 8202, 8232, 8233, 8239, 8287, 12288];
const colon = 58, parenL = 40, underscore = 95, bracketL = 91, dash = 45, period = 46,
hash = 35, percent = 37, ampersand = 38, backslash = 92, newline = 10, asterisk = 42;
function isAlpha(ch) { return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 161 }
function isDigit(ch) { return ch >= 48 && ch <= 57 }
function isHex(ch) { return isDigit(ch) || ch >= 97 && ch <= 102 || ch >= 65 && ch <= 70 }
const identifierTokens = (id, varName, callee) => (input, stack) => {
for (let inside = false, dashes = 0, i = 0;; i++) {
let {next} = input;
if (isAlpha(next) || next == dash || next == underscore || (inside && isDigit(next))) {
if (!inside && (next != dash || i > 0)) inside = true;
if (dashes === i && next == dash) dashes++;
input.advance();
} else if (next == backslash && input.peek(1) != newline) {
input.advance();
if (isHex(input.next)) {
do { input.advance(); } while (isHex(input.next))
if (input.next == 32) input.advance();
} else if (input.next > -1) {
input.advance();
}
inside = true;
} else {
if (inside) input.acceptToken(
dashes == 2 && stack.canShift(VariableName) ? varName : next == parenL ? callee : id
);
break
}
}
};
const identifiers = new ExternalTokenizer(
identifierTokens(identifier, VariableName, callee)
);
const queryIdentifiers = new ExternalTokenizer(
identifierTokens(queryIdentifier, queryVariableName, QueryCallee)
);
const descendant = new ExternalTokenizer(input => {
if (space.includes(input.peek(-1))) {
let {next} = input;
if (isAlpha(next) || next == underscore || next == hash || next == period ||
next == asterisk || next == bracketL || next == colon && isAlpha(input.peek(1)) ||
next == dash || next == ampersand)
input.acceptToken(descendantOp);
}
});
const unitToken = new ExternalTokenizer(input => {
if (!space.includes(input.peek(-1))) {
let {next} = input;
if (next == percent) { input.advance(); input.acceptToken(Unit); }
if (isAlpha(next)) {
do { input.advance(); } while (isAlpha(input.next) || isDigit(input.next))
input.acceptToken(Unit);
}
}
});
const cssHighlighting = styleTags({
"AtKeyword import charset namespace keyframes media supports": tags.definitionKeyword,
"from to selector": tags.keyword,
NamespaceName: tags.namespace,
KeyframeName: tags.labelName,
KeyframeRangeName: tags.operatorKeyword,
TagName: tags.tagName,
ClassName: tags.className,
PseudoClassName: tags.constant(tags.className),
IdName: tags.labelName,
"FeatureName PropertyName": tags.propertyName,
AttributeName: tags.attributeName,
NumberLiteral: tags.number,
KeywordQuery: tags.keyword,
UnaryQueryOp: tags.operatorKeyword,
"CallTag ValueName": tags.atom,
VariableName: tags.variableName,
Callee: tags.operatorKeyword,
Unit: tags.unit,
"UniversalSelector NestingSelector": tags.definitionOperator,
"MatchOp CompareOp": tags.compareOperator,
"ChildOp SiblingOp, LogicOp": tags.logicOperator,
BinOp: tags.arithmeticOperator,
Important: tags.modifier,
Comment: tags.blockComment,
ColorLiteral: tags.color,
"ParenthesizedContent StringLiteral": tags.string,
":": tags.punctuation,
"PseudoOp #": tags.derefOperator,
"; ,": tags.separator,
"( )": tags.paren,
"[ ]": tags.squareBracket,
"{ }": tags.brace
});
// This file was generated by lezer-generator. You probably shouldn't edit it.
const spec_callee = {__proto__:null,lang:38, "nth-child":38, "nth-last-child":38, "nth-of-type":38, "nth-last-of-type":38, dir:38, "host-context":38, if:84, url:124, "url-prefix":124, domain:124, regexp:124};
const spec_queryIdentifier = {__proto__:null,or:98, and:98, not:106, only:106, layer:170};
const spec_QueryCallee = {__proto__:null,selector:112, layer:166};
const spec_AtKeyword = {__proto__:null,"@import":162, "@media":174, "@charset":178, "@namespace":182, "@keyframes":188, "@supports":200, "@scope":204};
const spec_identifier = {__proto__:null,to:207};
const parser = LRParser.deserialize({
version: 14,
states: "EbQYQdOOO#qQdOOP#xO`OOOOQP'#Cf'#CfOOQP'#Ce'#CeO#}QdO'#ChO$nQaO'#CcO$xQdO'#CkO%TQdO'#DpO%YQdO'#DrO%_QdO'#DuO%_QdO'#DxOOQP'#FV'#FVO&eQhO'#EhOOQS'#FU'#FUOOQS'#Ek'#EkQYQdOOO&lQdO'#EOO&PQhO'#EUO&lQdO'#EWO'aQdO'#EYO'lQdO'#E]O'tQhO'#EcO(VQdO'#EeO(bQaO'#CfO)VQ`O'#D{O)[Q`O'#F`O)gQdO'#F`QOQ`OOP)qO&jO'#CaPOOO)C@t)C@tOOQP'#Cj'#CjOOQP,59S,59SO#}QdO,59SO)|QdO,59VO%TQdO,5:[O%YQdO,5:^O%_QdO,5:aO%_QdO,5:cO%_QdO,5:dO%_QdO'#ErO*XQ`O,58}O*aQd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$c!{R%k$dZiPkz!{$dR$P!gQ%}%SR&z&mR!rdR!teR$Z!tS%a$Y%bR&t&WV%_$Y%b&WQ#PmR$g#PQ`OSkPzU!a`k$dR$d!{Q$p#aY%p$p%u&d&l'QQ%u$sQ&d%qQ&l%zR'Q&xQ#t!cQ#v!dQ#x!eV$}#t#v#xQ%X$RR&T%XQ%y$zS&k%y&yR&y&lQ%r$pR&e%rQ%n$mR&c%nQyUR#]yQ%i$aR&_%iQ!|jS$e!|$fR$f!}Q&n%}R&{&nQ#k!ZR$x#kQ%b$YR&Z%bQ&X%aR&u&X__OP`kz!{$d^UOP`kz!{$dQ!VYQ!WZQ#XuQ#YvQ#ZwQ#[xQ$]!vQ$m#`R&b%mR$q#aQ!gaQ!oc[#q!c!d!e#t#v#xQ$a!zd$o#a$p$s%q%u%z&d&l&x'QQ$r#cQ%R#{S%g$a%iQ%l$kQ&^%hR&p&P]#s!c!d!e#t#v#xW!Z]b!g$PQ!ufQ#f!YQ#l![Q$v#iQ$w#jQ$z#mS%V$R%XR&i%xQ#h!YQ%w$tR&w&hR$|#mR$n#`QlPR#_zQ!_]Q!nbQ$O!gR%U$P",
nodeNames: "⚠ Unit VariableName VariableName QueryCallee Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NestingSelector ClassSelector . ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue AtKeyword # ; ] [ BracketedValue } { BracedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee IfExpression if ArgList IfBranch KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp ComparisonQuery CompareOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector ParenthesizedSelector CallQuery ArgList , CallLiteral CallTag ParenthesizedContent PseudoClassName ArgList IdSelector IdName AttributeSelector AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp Block Declaration PropertyName Important ImportStatement import Layer layer LayerName layer MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports ScopeStatement scope to AtRule Styles",
maxTerm: 143,
nodeProps: [
["isolate", -2,5,36,""],
["openedBy", 20,"(",28,"[",31,"{"],
["closedBy", 21,")",29,"]",32,"}"]
],
propSources: [cssHighlighting],
skippedNodes: [0,5,106],
repeatNodeCount: 15,
tokenData: "JQ~R!YOX$qX^%i^p$qpq%iqr({rs-ust/itu6Wuv$qvw7Qwx7cxy9Qyz9cz{9h{|:R|}>t}!O?V!O!P?t!P!Q@]!Q![AU![!]BP!]!^B{!^!_C^!_!`DY!`!aDm!a!b$q!b!cEn!c!}$q!}#OG{#O#P$q#P#QH^#Q#R6W#R#o$q#o#pHo#p#q6W#q#rIQ#r#sIc#s#y$q#y#z%i#z$f$q$f$g%i$g#BY$q#BY#BZ%i#BZ$IS$q$IS$I_%i$I_$I|$q$I|$JO%i$JO$JT$q$JT$JU%i$JU$KV$q$KV$KW%i$KW&FU$q&FU&FV%i&FV;'S$q;'S;=`Iz<%lO$q`$tSOy%Qz;'S%Q;'S;=`%c<%lO%Q`%VS!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Q`%fP;=`<%l%Q~%nh#s~OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$JO$JT%Q$JT$JU'Y$JU$KV%Q$KV$KW'Y$KW&FU%Q&FU&FV'Y&FV;'S%Q;'S;=`%c<%lO%Q~'ah#s~!a`OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$JO$JT%Q$JT$JU'Y$JU$KV%Q$KV$KW'Y$KW&FU%Q&FU&FV'Y&FV;'S%Q;'S;=`%c<%lO%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%lO%Q`I}P;=`<%l$q",
tokenizers: [descendant, unitToken, identifiers, queryIdentifiers, 1, 2, 3, 4, new LocalTokenGroup("m~RRYZ[z{a~~g~aO#v~~dP!P!Qg~lO#w~~", 28, 129)],
topRules: {"StyleSheet":[0,6],"Styles":[1,105]},
specialized: [{term: 124, get: (value) => spec_callee[value] || -1},{term: 125, get: (value) => spec_queryIdentifier[value] || -1},{term: 4, get: (value) => spec_QueryCallee[value] || -1},{term: 25, get: (value) => spec_AtKeyword[value] || -1},{term: 123, get: (value) => spec_identifier[value] || -1}],
tokenPrec: 1963
});
export { parser };

36
frontend/node_modules/@lezer/css/package.json generated vendored Normal file
View File

@ -0,0 +1,36 @@
{
"name": "@lezer/css",
"version": "1.3.0",
"description": "lezer-based CSS grammar",
"main": "dist/index.cjs",
"type": "module",
"exports": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"module": "dist/index.js",
"types": "dist/index.d.ts",
"author": "Marijn Haverbeke <marijn@haverbeke.berlin>",
"license": "MIT",
"devDependencies": {
"@lezer/generator": "^1.8.0",
"mocha": "^10.2.0",
"rollup": "^2.52.2",
"@rollup/plugin-node-resolve": "^9.0.0"
},
"dependencies": {
"@lezer/common": "^1.2.0",
"@lezer/lr": "^1.3.0",
"@lezer/highlight": "^1.0.0"
},
"repository": {
"type" : "git",
"url" : "https://github.com/lezer-parser/css.git"
},
"scripts": {
"build": "lezer-generator src/css.grammar -o src/parser && rollup -c",
"build-debug": "lezer-generator src/css.grammar --names -o src/parser && rollup -c",
"prepare": "npm run build",
"test": "mocha test/test-*.js"
}
}

16
frontend/node_modules/@lezer/css/rollup.config.js generated vendored Normal file
View File

@ -0,0 +1,16 @@
import {nodeResolve} from "@rollup/plugin-node-resolve"
export default {
input: "./src/parser.js",
output: [{
format: "cjs",
file: "./dist/index.cjs"
}, {
format: "es",
file: "./dist/index.js"
}],
external(id) { return !/^[\.\/]/.test(id) },
plugins: [
nodeResolve()
]
}

274
frontend/node_modules/@lezer/css/src/css.grammar generated vendored Normal file
View File

@ -0,0 +1,274 @@
@precedence {
attribute @left,
structure @left,
call,
valueCompareOp,
valueOp @left,
layerName
}
@skip { whitespace | Comment }
@top StyleSheet { item* }
@top Styles { blockContent }
item {
RuleSet |
ImportStatement |
MediaStatement |
CharsetStatement |
NamespaceStatement |
KeyframesStatement |
SupportsStatement |
ScopeStatement |
AtRule
}
RuleSet {
selector ("," selector)* Block
}
ImportStatement {
atKw<"import">
value
Layer {
queryCalleeKw<"layer"> (!layerName "(" LayerName ("." LayerName)* ")")? |
queryKw<"layer">
}?
commaSep<query> ";"
}
LayerName { identifier }
MediaStatement {
atKw<"media"> commaSep<query> Block
}
CharsetStatement {
atKw<"charset"> value ";"
}
NamespaceStatement {
atKw<"namespace">
NamespaceName { identifier }?
(StringLiteral | CallLiteral) ";"
}
KeyframesStatement {
atKw<"keyframes">
KeyframeName { identifier | StringLiteral }
KeyframeList
}
KeyframeSelector {
KeyframeRangeName { identifier } NumberLiteral? |
NumberLiteral
}
KeyframeList {
"{" (KeyframeSelector ("," KeyframeSelector)* Block)* "}"
}
SupportsStatement {
atKw<"supports"> query Block
}
ScopeStatement {
atKw<"scope">
ParenthesizedSelector?
(@extend[@name=to]<identifier, "to"> ParenthesizedSelector)?
Block
}
AtRule { AtKeyword commaSep<query> (";" | Block) }
Block { "{" blockContent "}" }
blockContent { ~item item* (Declaration (";" ~item item* Declaration?)*)? }
selector {
UniversalSelector |
TagSelector { ~item TagName { identifier ~item } } |
NestingSelector |
ClassSelector { selector? !attribute "." ClassName { identifier } } |
PseudoClassSelector {
selector? !attribute (":" | "::") (
PseudoClassName { identifier } |
pseudoClassWithArg ArgList<value+> |
PseudoClassName { callee } ArgList<selector>)
} |
IdSelector { selector? !attribute "#" IdName { identifier } } |
AttributeSelector { selector? !attribute "[" AttributeName { identifier } (MatchOp value)? "]" } |
ChildSelector { selector? !structure ChildOp selector } |
DescendantSelector { selector !structure descendantOp selector } |
SiblingSelector { selector? !structure SiblingOp selector }
}
pseudoClassWithArg {
@specialize[@name=PseudoClassName]<callee, "lang" | "nth-child" | "nth-last-child" | "nth-of-type" | "nth-last-of-type" | "nth-of-type" | "dir" | "host-context">
}
NumberLiteral {
numberLiteralInner Unit?
}
ArgList<content> { "(" commaSep<content> ")" }
Declaration {
(PropertyName { identifier ~item } | VariableName)
":" (value (","? value)*)? Important?
}
query {
KeywordQuery { queryIdentifier } |
FeatureQuery { "(" FeatureName ":" value+ ")" } |
BinaryQuery { query !valueOp @specialize[@name=LogicOp]<queryIdentifier, "or" | "and"> query } |
ComparisonQuery {
"("
(queryValue | FeatureName) !valueCompareOp CompareOp (queryValue | FeatureName)
(!valueCompareOp CompareOp (queryValue | FeatureName))?
")"
} |
UnaryQuery { @specialize[@name=UnaryQueryOp]<queryIdentifier, "not" | "only"> query } |
ParenthesizedQuery { "(" query ")" } |
SelectorQuery { queryCalleeKw<"selector"> ParenthesizedSelector } |
CallQuery { QueryCallee ArgList<FeatureName ":" value+ | query> }
}
ParenthesizedSelector { "(" selector ")" }
FeatureName { queryIdentifier }
value {
VariableName |
ValueName { identifier } |
ParenthesizedValue { "(" token* ")" } |
BracketedValue { "[" token* "]" } |
BracedValue { "{" token* "}" } |
ColorLiteral |
NumberLiteral |
StringLiteral |
BinaryExpression { value !valueOp BinOp value } |
CallExpression |
IfExpression |
CallLiteral
}
token {
value |
AtKeyword |
"#" | ";" | "." | ":"
}
queryValue {
queryVariableName |
ColorLiteral |
NumberLiteral |
StringLiteral
}
IfExpression {
@specialize[@name=if]<callee, "if"> ArgList {
"(" (IfBranch ";")* IfBranch ";"? ")"
}
}
IfBranch { query ":" value }
CallLiteral {
@specialize[@name=CallTag]<callee, "url" | "url-prefix" | "domain" | "regexp">
"(" (ParenthesizedContent | StringLiteral)? ")"
}
CallExpression {
(Callee { callee } | VariableName) !call ArgList<value+>
}
@skip {} {
Comment[isolate] { "/*" (commentContent | commentLineBreak)* commentEnd }
}
@local tokens {
commentEnd { "*/" | @eof }
commentLineBreak { "\n" }
@else commentContent
}
commaSep<value> { "" | value ("," value?)* }
queryKw<name> { @specialize[@name={name}]<queryIdentifier, name> }
queryCalleeKw<name> { @specialize[@name={name}]<QueryCallee, name> }
atKw<name> { @specialize[@name={name}]<AtKeyword, "@" name> }
@external tokens descendant from "./tokens" {
descendantOp
}
@external tokens unitToken from "./tokens" {
Unit
}
@external tokens identifiers from "./tokens" {
identifier,
callee,
VariableName
}
@external tokens queryIdentifiers from "./tokens" {
@conflict { identifier, VariableName, callee }
queryIdentifier,
queryVariableName[@name=VariableName],
QueryCallee
}
@tokens {
UniversalSelector { "*" }
NestingSelector { "&" }
AtKeyword { "@" "-"? @asciiLetter (@asciiLetter | @digit | "-")* }
MatchOp { $[~^|*$]? "=" }
ChildOp { ">" ">"? }
CompareOp { $[<>] "="? | "=" }
SiblingOp { "~" | "+" }
BinOp { $[+\-*/] }
Important { "!important" }
whitespace { @whitespace+ }
hexDigit { @digit | $[a-fA-F] }
ParenthesizedContent { !['")] ![)]+ }
@precedence { whitespace, ParenthesizedContent, "/*" }
ColorLiteral {
"#" hexDigit hexDigit hexDigit (hexDigit (hexDigit hexDigit (hexDigit hexDigit)?)?)?
}
numberLiteralInner { ("+" | "-")? (@digit+ ("." @digit*)? | "." @digit+) (("e" | "E") ("+" | "-")? @digit+)? }
@precedence { numberLiteralInner, BinOp, SiblingOp }
@precedence { numberLiteralInner, "." }
StringLiteral[isolate] { "\"" (!["\n\\] | "\\" _)* "\"" | "'" (!['\n\\] | "\\" _)* "'" }
"#" "."
":" "::" ";" ","
"(" ")" "[" "]" "{" "}"
}
@external propSource cssHighlighting from "./highlight"
@detectDelim

36
frontend/node_modules/@lezer/css/src/highlight.js generated vendored Normal file
View File

@ -0,0 +1,36 @@
import {styleTags, tags as t} from "@lezer/highlight"
export const cssHighlighting = styleTags({
"AtKeyword import charset namespace keyframes media supports": t.definitionKeyword,
"from to selector": t.keyword,
NamespaceName: t.namespace,
KeyframeName: t.labelName,
KeyframeRangeName: t.operatorKeyword,
TagName: t.tagName,
ClassName: t.className,
PseudoClassName: t.constant(t.className),
IdName: t.labelName,
"FeatureName PropertyName": t.propertyName,
AttributeName: t.attributeName,
NumberLiteral: t.number,
KeywordQuery: t.keyword,
UnaryQueryOp: t.operatorKeyword,
"CallTag ValueName": t.atom,
VariableName: t.variableName,
Callee: t.operatorKeyword,
Unit: t.unit,
"UniversalSelector NestingSelector": t.definitionOperator,
"MatchOp CompareOp": t.compareOperator,
"ChildOp SiblingOp, LogicOp": t.logicOperator,
BinOp: t.arithmeticOperator,
Important: t.modifier,
Comment: t.blockComment,
ColorLiteral: t.color,
"ParenthesizedContent StringLiteral": t.string,
":": t.punctuation,
"PseudoOp #": t.derefOperator,
"; ,": t.separator,
"( )": t.paren,
"[ ]": t.squareBracket,
"{ }": t.brace
})

30
frontend/node_modules/@lezer/css/src/parser.js generated vendored Normal file
View File

@ -0,0 +1,30 @@
// This file was generated by lezer-generator. You probably shouldn't edit it.
import {LRParser, LocalTokenGroup} from "@lezer/lr"
import {descendant, unitToken, identifiers, queryIdentifiers} from "./tokens"
import {cssHighlighting} from "./highlight"
const spec_callee = {__proto__:null,lang:38, "nth-child":38, "nth-last-child":38, "nth-of-type":38, "nth-last-of-type":38, dir:38, "host-context":38, if:84, url:124, "url-prefix":124, domain:124, regexp:124}
const spec_queryIdentifier = {__proto__:null,or:98, and:98, not:106, only:106, layer:170}
const spec_QueryCallee = {__proto__:null,selector:112, layer:166}
const spec_AtKeyword = {__proto__:null,"@import":162, "@media":174, "@charset":178, "@namespace":182, "@keyframes":188, "@supports":200, "@scope":204}
const spec_identifier = {__proto__:null,to:207}
export const parser = LRParser.deserialize({
version: 14,
states: "EbQYQdOOO#qQdOOP#xO`OOOOQP'#Cf'#CfOOQP'#Ce'#CeO#}QdO'#ChO$nQaO'#CcO$xQdO'#CkO%TQdO'#DpO%YQdO'#DrO%_QdO'#DuO%_QdO'#DxOOQP'#FV'#FVO&eQhO'#EhOOQS'#FU'#FUOOQS'#Ek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!kQ%W$RR&S%Xk!^]bf!Y![!g#i#j#m$P$R%X%xQ#e!YQ${#mQ%w$tQ&j%xR&w&hQ!ygQ#p!`Q$^!xR%f$`R#n!]!U!mac!c!d!e!z#a#c#t#v#x#{$a$k$p$s%h%i%q%u%z&P&d&l&x'QQ!qdR$X!rQ!PVR#TrQ#S!PR$i#TQ!SWR#VsQ!UXR#WtQ{UQ!wgQ#^yQ#o!_Q$U!nQ$[!uQ$_!yQ%e$^Q&Y%aQ&]%fR&v&XSjPzQ!}kQ$c!{R%k$dZiPkz!{$dR$P!gQ%}%SR&z&mR!rdR!teR$Z!tS%a$Y%bR&t&WV%_$Y%b&WQ#PmR$g#PQ`OSkPzU!a`k$dR$d!{Q$p#aY%p$p%u&d&l'QQ%u$sQ&d%qQ&l%zR'Q&xQ#t!cQ#v!dQ#x!eV$}#t#v#xQ%X$RR&T%XQ%y$zS&k%y&yR&y&lQ%r$pR&e%rQ%n$mR&c%nQyUR#]yQ%i$aR&_%iQ!|jS$e!|$fR$f!}Q&n%}R&{&nQ#k!ZR$x#kQ%b$YR&Z%bQ&X%aR&u&X__OP`kz!{$d^UOP`kz!{$dQ!VYQ!WZQ#XuQ#YvQ#ZwQ#[xQ$]!vQ$m#`R&b%mR$q#aQ!gaQ!oc[#q!c!d!e#t#v#xQ$a!zd$o#a$p$s%q%u%z&d&l&x'QQ$r#cQ%R#{S%g$a%iQ%l$kQ&^%hR&p&P]#s!c!d!e#t#v#xW!Z]b!g$PQ!ufQ#f!YQ#l![Q$v#iQ$w#jQ$z#mS%V$R%XR&i%xQ#h!YQ%w$tR&w&hR$|#mR$n#`QlPR#_zQ!_]Q!nbQ$O!gR%U$P",
nodeNames: "⚠ Unit VariableName VariableName QueryCallee Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NestingSelector ClassSelector . ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue AtKeyword # ; ] [ BracketedValue } { BracedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee IfExpression if ArgList IfBranch KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp ComparisonQuery CompareOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector ParenthesizedSelector CallQuery ArgList , CallLiteral CallTag ParenthesizedContent PseudoClassName ArgList IdSelector IdName AttributeSelector AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp Block Declaration PropertyName Important ImportStatement import Layer layer LayerName layer MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports ScopeStatement scope to AtRule Styles",
maxTerm: 143,
nodeProps: [
["isolate", -2,5,36,""],
["openedBy", 20,"(",28,"[",31,"{"],
["closedBy", 21,")",29,"]",32,"}"]
],
propSources: [cssHighlighting],
skippedNodes: [0,5,106],
repeatNodeCount: 15,
tokenData: "JQ~R!YOX$qX^%i^p$qpq%iqr({rs-ust/itu6Wuv$qvw7Qwx7cxy9Qyz9cz{9h{|:R|}>t}!O?V!O!P?t!P!Q@]!Q![AU![!]BP!]!^B{!^!_C^!_!`DY!`!aDm!a!b$q!b!cEn!c!}$q!}#OG{#O#P$q#P#QH^#Q#R6W#R#o$q#o#pHo#p#q6W#q#rIQ#r#sIc#s#y$q#y#z%i#z$f$q$f$g%i$g#BY$q#BY#BZ%i#BZ$IS$q$IS$I_%i$I_$I|$q$I|$JO%i$JO$JT$q$JT$JU%i$JU$KV$q$KV$KW%i$KW&FU$q&FU&FV%i&FV;'S$q;'S;=`Iz<%lO$q`$tSOy%Qz;'S%Q;'S;=`%c<%lO%Q`%VS!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Q`%fP;=`<%l%Q~%nh#s~OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$J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S;=`%c<%lO%QjGV[iY!a`Oy%Qz}%Q}!OGO!O!Q%Q!Q![GO![!c%Q!c!}GO!}#T%Q#T#oGO#o;'S%Q;'S;=`%c<%lO%QjHQSmYOy%Qz;'S%Q;'S;=`%c<%lO%QnHcSl^Oy%Qz;'S%Q;'S;=`%c<%lO%QjHtSpYOy%Qz;'S%Q;'S;=`%c<%lO%QjIVSoYOy%Qz;'S%Q;'S;=`%c<%lO%QfIhU!mQOy%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Q`I}P;=`<%l$q",
tokenizers: [descendant, unitToken, identifiers, queryIdentifiers, 1, 2, 3, 4, new LocalTokenGroup("m~RRYZ[z{a~~g~aO#v~~dP!P!Qg~lO#w~~", 28, 129)],
topRules: {"StyleSheet":[0,6],"Styles":[1,105]},
specialized: [{term: 124, get: (value) => spec_callee[value] || -1},{term: 125, get: (value) => spec_queryIdentifier[value] || -1},{term: 4, get: (value) => spec_QueryCallee[value] || -1},{term: 25, get: (value) => spec_AtKeyword[value] || -1},{term: 123, get: (value) => spec_identifier[value] || -1}],
tokenPrec: 1963
})

61
frontend/node_modules/@lezer/css/src/parser.terms.js generated vendored Normal file
View File

@ -0,0 +1,61 @@
// This file was generated by lezer-generator. You probably shouldn't edit it.
export const
descendantOp = 122,
Unit = 1,
identifier = 123,
callee = 124,
VariableName = 2,
queryIdentifier = 125,
queryVariableName = 3,
QueryCallee = 4,
Comment = 5,
StyleSheet = 6,
RuleSet = 7,
UniversalSelector = 8,
NestingSelector = 11,
PseudoClassName = 19,
AtKeyword = 25,
ColorLiteral = 34,
NumberLiteral = 35,
StringLiteral = 36,
BinOp = 38,
CallExpression = 39,
IfExpression = 41,
_if = 42,
IfBranch = 44,
FeatureName = 47,
LogicOp = 49,
CompareOp = 51,
UnaryQueryOp = 53,
selector = 56,
ParenthesizedSelector = 57,
CallLiteral = 61,
CallTag = 62,
ParenthesizedContent = 63,
MatchOp = 70,
ChildOp = 72,
SiblingOp = 75,
Block = 76,
Declaration = 77,
Important = 79,
ImportStatement = 80,
_import = 81,
layer = 85,
LayerName = 84,
MediaStatement = 86,
media = 87,
CharsetStatement = 88,
charset = 89,
NamespaceStatement = 90,
namespace = 91,
KeyframesStatement = 93,
keyframes = 94,
KeyframeList = 96,
KeyframeSelector = 97,
SupportsStatement = 99,
supports = 100,
ScopeStatement = 101,
scope = 102,
to = 103,
AtRule = 104,
Styles = 105

73
frontend/node_modules/@lezer/css/src/tokens.js generated vendored Normal file
View File

@ -0,0 +1,73 @@
/* Hand-written tokenizers for CSS tokens that can't be
expressed by Lezer's built-in tokenizer. */
import {ExternalTokenizer} from "@lezer/lr"
import {
identifier, callee, VariableName,
queryIdentifier, queryVariableName, QueryCallee,
descendantOp, Unit
} from "./parser.terms.js"
const space = [9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197,
8198, 8199, 8200, 8201, 8202, 8232, 8233, 8239, 8287, 12288]
const colon = 58, parenL = 40, underscore = 95, bracketL = 91, dash = 45, period = 46,
hash = 35, percent = 37, ampersand = 38, backslash = 92, newline = 10, asterisk = 42
function isAlpha(ch) { return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 161 }
function isDigit(ch) { return ch >= 48 && ch <= 57 }
function isHex(ch) { return isDigit(ch) || ch >= 97 && ch <= 102 || ch >= 65 && ch <= 70 }
const identifierTokens = (id, varName, callee) => (input, stack) => {
for (let inside = false, dashes = 0, i = 0;; i++) {
let {next} = input
if (isAlpha(next) || next == dash || next == underscore || (inside && isDigit(next))) {
if (!inside && (next != dash || i > 0)) inside = true
if (dashes === i && next == dash) dashes++
input.advance()
} else if (next == backslash && input.peek(1) != newline) {
input.advance()
if (isHex(input.next)) {
do { input.advance() } while (isHex(input.next))
if (input.next == 32) input.advance()
} else if (input.next > -1) {
input.advance()
}
inside = true
} else {
if (inside) input.acceptToken(
dashes == 2 && stack.canShift(VariableName) ? varName : next == parenL ? callee : id
)
break
}
}
}
export const identifiers = new ExternalTokenizer(
identifierTokens(identifier, VariableName, callee)
)
export const queryIdentifiers = new ExternalTokenizer(
identifierTokens(queryIdentifier, queryVariableName, QueryCallee)
)
export const descendant = new ExternalTokenizer(input => {
if (space.includes(input.peek(-1))) {
let {next} = input
if (isAlpha(next) || next == underscore || next == hash || next == period ||
next == asterisk || next == bracketL || next == colon && isAlpha(input.peek(1)) ||
next == dash || next == ampersand)
input.acceptToken(descendantOp)
}
})
export const unitToken = new ExternalTokenizer(input => {
if (!space.includes(input.peek(-1))) {
let {next} = input
if (next == percent) { input.advance(); input.acceptToken(Unit) }
if (isAlpha(next)) {
do { input.advance() } while (isAlpha(input.next) || isDigit(input.next))
input.acceptToken(Unit)
}
}
})

204
frontend/node_modules/@lezer/css/test/declarations.txt generated vendored Normal file
View File

@ -0,0 +1,204 @@
# Function calls
a {
color: rgba(0, 255, 0, 0.5);
}
==>
StyleSheet(
RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,CallExpression(Callee,ArgList(NumberLiteral,NumberLiteral,NumberLiteral,NumberLiteral))))))
# Calls where each argument has multiple values
div {
background: repeating-linear-gradient(red, orange 50px);
clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%)
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,CallExpression(Callee,ArgList(ValueName,ValueName,NumberLiteral(Unit)))),
Declaration(PropertyName,CallExpression(Callee,ArgList(
NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),
NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),
NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),
NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit)))))))
# Color literals
a {
b: #fafd04;
c: #fafd0401;
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,ColorLiteral),
Declaration(PropertyName,ColorLiteral))))
# Numbers
a {
b: 0.5%;
c: 5em;
margin: 10E3px;
margin: -456.8px;
margin: -0.0px;
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,NumberLiteral(Unit)),
Declaration(PropertyName,NumberLiteral(Unit)),
Declaration(PropertyName,NumberLiteral(Unit)),
Declaration(PropertyName,NumberLiteral(Unit)),
Declaration(PropertyName,NumberLiteral(Unit)))))
# Binary arithmetic operators
a {
width: calc(100% - 80px);
aspect-ratio: 1/2;
font-size: calc(10px + (56 - 10) * ((100vw - 320px) / (1920 - 320)));
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,CallExpression(Callee,ArgList(BinaryExpression(NumberLiteral(Unit),BinOp,NumberLiteral(Unit))))),
Declaration(PropertyName,BinaryExpression(NumberLiteral,BinOp,NumberLiteral)),
Declaration(PropertyName,CallExpression(Callee,ArgList(
BinaryExpression(BinaryExpression(NumberLiteral(Unit),BinOp,ParenthesizedValue(
BinaryExpression(NumberLiteral,BinOp,NumberLiteral))),BinOp,ParenthesizedValue(
BinaryExpression(ParenthesizedValue(BinaryExpression(NumberLiteral(Unit),BinOp,NumberLiteral(Unit))),BinOp,
ParenthesizedValue(BinaryExpression(NumberLiteral,BinOp,NumberLiteral)))))))))))
# Strings
a {
b: '';
c: '\'hi\'';
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(Declaration(PropertyName,StringLiteral),Declaration(PropertyName,StringLiteral))))
# URLs
a {
b: url(http://something-else?foo=bar);
c: url();
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,CallLiteral(CallTag,ParenthesizedContent)),
Declaration(PropertyName,CallLiteral(CallTag)))))
# Important declarations
a {
b: c !important;
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(Declaration(PropertyName,ValueName,Important))))
# Comments right after numbers
a {
shape-outside: circle(20em/*=*/at 50% 50%);
shape-outside: inset(1em, 1em, 1em, 1em);
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,CallExpression(Callee,ArgList(NumberLiteral(Unit),Comment,ValueName,NumberLiteral(Unit),NumberLiteral(Unit)))),
Declaration(PropertyName,CallExpression(Callee,ArgList(NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit)))))))
# Unfinished rule
a { foo: 2
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(Declaration(PropertyName,NumberLiteral),⚠)))
# Variable names
foo {
--my-variable: white;
color: var(--my-variable);
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(VariableName,ValueName),
Declaration(PropertyName,CallExpression(Callee,ArgList(VariableName))))))
# Trailing comma
div { color: var(--c,) }
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,CallExpression(Callee,ArgList(VariableName))))))
# Space before colon
div {
color : red;
.x :active {
color : blue;
}
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,ValueName),
RuleSet(DescendantSelector(ClassSelector(ClassName),PseudoClassSelector(PseudoClassName)),Block(
Declaration(PropertyName,ValueName))))))
# Empty value
p {
--var-name: ;
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(Declaration(VariableName))))
# Bracketed values
div {
--myvar: [ some: value; ]
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(VariableName,BracketedValue("[", ValueName, ":", ValueName, ";", "]")))))
# Call to variables
.foo {
box-shadow: --shadow(blue);
}
==>
StyleSheet(RuleSet(ClassSelector(ClassName),Block(
Declaration(PropertyName,CallExpression(VariableName,ArgList(ValueName))))))

150
frontend/node_modules/@lezer/css/test/selector.txt generated vendored Normal file
View File

@ -0,0 +1,150 @@
# Universal selectors
* {}
div * {}
==>
StyleSheet(
RuleSet(UniversalSelector,Block),
RuleSet(DescendantSelector(TagSelector(TagName),UniversalSelector),Block))
# Type selectors
div, span {}
h1, h2, h3, h4 {}
==>
StyleSheet(
RuleSet(TagSelector(TagName),TagSelector(TagName),Block),
RuleSet(TagSelector(TagName),TagSelector(TagName),TagSelector(TagName),TagSelector(TagName),Block))
# Class selectors
.class-a {}
div.class-b, .class-c.class-d {}
==>
StyleSheet(
RuleSet(ClassSelector(ClassName),Block),
RuleSet(ClassSelector(TagSelector(TagName),ClassName),ClassSelector(ClassSelector(ClassName),ClassName),Block))
# Id selectors
#some-id, a#another-id {}
==>
StyleSheet(RuleSet(IdSelector(IdName),IdSelector(TagSelector(TagName),IdName),Block))
# Attribute selectors
[a] {}
[b=c] {}
[d~=e] {}
a[b] {}
==>
StyleSheet(
RuleSet(AttributeSelector(AttributeName),Block),
RuleSet(AttributeSelector(AttributeName,MatchOp,ValueName),Block),
RuleSet(AttributeSelector(AttributeName,MatchOp,ValueName),Block),
RuleSet(AttributeSelector(TagSelector(TagName),AttributeName),Block))
# Pseudo-class selectors
a:hover {}
:nth-child(2) {}
==>
StyleSheet(
RuleSet(PseudoClassSelector(TagSelector(TagName),":",PseudoClassName),Block),
RuleSet(PseudoClassSelector(":",PseudoClassName,ArgList(NumberLiteral)),Block))
# Pseudo-element selectors
a::first-line {}
==>
StyleSheet(RuleSet(PseudoClassSelector(TagSelector(TagName),"::",PseudoClassName),Block))
# Child selectors
a > b {}
c > d > e {}
==>
StyleSheet(
RuleSet(ChildSelector(TagSelector(TagName),ChildOp,TagSelector(TagName)),Block),
RuleSet(ChildSelector(ChildSelector(TagSelector(TagName),ChildOp,TagSelector(TagName)),ChildOp,TagSelector(TagName)),Block))
# Descendant selectors
a b {}
c d e {}
==>
StyleSheet(
RuleSet(DescendantSelector(TagSelector(TagName),TagSelector(TagName)),Block),
RuleSet(DescendantSelector(DescendantSelector(TagSelector(TagName),TagSelector(TagName)),TagSelector(TagName)),Block))
# Nesting selectors
a {
&.b {}
& c {}
c & {}
& > d {}
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
RuleSet(ClassSelector(NestingSelector,ClassName),Block),
RuleSet(DescendantSelector(NestingSelector,TagSelector(TagName)),Block),
RuleSet(DescendantSelector(TagSelector(TagName), NestingSelector),Block),
RuleSet(ChildSelector(NestingSelector,ChildOp,TagSelector(TagName)),Block))))
# Relative selectors
a {
p {}
> f {}
+ g {}
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
RuleSet(TagSelector(TagName),Block),
RuleSet(ChildSelector(ChildOp,TagSelector(TagName)),Block),
RuleSet(SiblingSelector(SiblingOp,TagSelector(TagName)),Block))))
# Sibling selectors
a.b ~ c.d {}
.e.f + .g.h {}
==>
StyleSheet(
RuleSet(SiblingSelector(ClassSelector(TagSelector(TagName),ClassName),SiblingOp,ClassSelector(TagSelector(TagName),ClassName)),Block),
RuleSet(SiblingSelector(ClassSelector(ClassSelector(ClassName),ClassName),SiblingOp,ClassSelector(ClassSelector(ClassName),ClassName)),Block))
# The :not selector
a:not(:hover) {}
.b:not(c > .d) {}
==>
StyleSheet(
RuleSet(PseudoClassSelector(TagSelector(TagName),":",PseudoClassName,ArgList(PseudoClassSelector(":",PseudoClassName))),Block),
RuleSet(PseudoClassSelector(ClassSelector(ClassName),":",PseudoClassName,ArgList(ChildSelector(TagSelector(TagName),ChildOp,ClassSelector(ClassName)))),Block))

214
frontend/node_modules/@lezer/css/test/statements.txt generated vendored Normal file
View File

@ -0,0 +1,214 @@
# Empty stylesheets
/* Just a comment */
==>
StyleSheet(Comment)
# Import statements
@import url("fineprint.css") print;
@import url("bluish.css") speech;
@import 'custom.css';
@import url("chrome://communicator/skin/");
@import "common.css" screen;
@import "reset.css" layer(framework.component);
@import "components.css" layer screen;
==>
StyleSheet(
ImportStatement(import,CallLiteral(CallTag,StringLiteral),KeywordQuery),
ImportStatement(import,CallLiteral(CallTag,StringLiteral),KeywordQuery),
ImportStatement(import,StringLiteral),
ImportStatement(import,CallLiteral(CallTag,StringLiteral)),
ImportStatement(import,StringLiteral,KeywordQuery),
ImportStatement(import,StringLiteral,Layer(layer,LayerName,LayerName)),
ImportStatement(import,StringLiteral,Layer(layer),KeywordQuery))
# Namespace statements
/* Default namespace */
@namespace url(XML-namespace-URL);
@namespace "XML-namespace-URL";
@namespace url(http://www.w3.org/1999/xhtml);
@namespace svg url(http://www.w3.org/2000/svg);
/* Prefixed namespace */
@namespace prefix url(XML-namespace-URL);
@namespace prefix "XML-namespace-URL";
==>
StyleSheet(
Comment,
NamespaceStatement(namespace,CallLiteral(CallTag,ParenthesizedContent)),
NamespaceStatement(namespace,StringLiteral),
NamespaceStatement(namespace,CallLiteral(CallTag,ParenthesizedContent)),
NamespaceStatement(namespace,NamespaceName,CallLiteral(CallTag,ParenthesizedContent)),
Comment,
NamespaceStatement(namespace,NamespaceName,CallLiteral(CallTag,ParenthesizedContent)),
NamespaceStatement(namespace,NamespaceName,StringLiteral))
# Keyframes statements
@keyframes important1 {
from { margin-top: 50px; }
50%, 60% { margin-top: 150px !important; } /* ignored */
to { margin-top: 100px; }
}
==>
StyleSheet(KeyframesStatement(keyframes,KeyframeName,KeyframeList(
KeyframeSelector(KeyframeRangeName),Block(Declaration(PropertyName,NumberLiteral(Unit))),
KeyframeSelector(NumberLiteral(Unit)),KeyframeSelector(NumberLiteral(Unit)),Block(
Declaration(PropertyName,NumberLiteral(Unit),Important)),
Comment,
KeyframeSelector(KeyframeRangeName),Block(Declaration(PropertyName,NumberLiteral(Unit))))))
# Keyframes statements with range
@keyframes anim-1 {
entry 0% { margin-top: 50px; }
entry 100% { margin-top: 50px; }
exit 0% { margin-top: 50px; }
exit 100% { margin-top: 50px; }
}
==>
StyleSheet(KeyframesStatement(keyframes,KeyframeName,KeyframeList(
KeyframeSelector(KeyframeRangeName,NumberLiteral(Unit)),Block(Declaration(PropertyName,NumberLiteral(Unit))),
KeyframeSelector(KeyframeRangeName,NumberLiteral(Unit)),Block(Declaration(PropertyName,NumberLiteral(Unit))),
KeyframeSelector(KeyframeRangeName,NumberLiteral(Unit)),Block(Declaration(PropertyName,NumberLiteral(Unit))),
KeyframeSelector(KeyframeRangeName,NumberLiteral(Unit)),Block(Declaration(PropertyName,NumberLiteral(Unit))))))
# Keyframes statements with range and multiple keyframe selectors
@keyframes fade-in-out-animation {
entry 0%, exit 100% { opacity: 0 }
entry 100%, exit 0% { opacity: 1 }
}
==>
StyleSheet(KeyframesStatement(keyframes,KeyframeName,KeyframeList(
KeyframeSelector(KeyframeRangeName,NumberLiteral(Unit)),KeyframeSelector(KeyframeRangeName,NumberLiteral(Unit)),Block(
Declaration(PropertyName,NumberLiteral)),
KeyframeSelector(KeyframeRangeName,NumberLiteral(Unit)),KeyframeSelector(KeyframeRangeName,NumberLiteral(Unit)),Block(
Declaration(PropertyName,NumberLiteral)))))
# Media statements
@media screen and (min-width: 30em) and (orientation: landscape) {}
@media (min-height: 680px), screen and (orientation: portrait) {}
@media not all and (monochrome) {}
@media only screen {}
@media (10em <= width < 30em) {}
==>
StyleSheet(
MediaStatement(media,BinaryQuery(BinaryQuery(KeywordQuery,LogicOp,FeatureQuery(FeatureName,NumberLiteral(Unit))),LogicOp,
FeatureQuery(FeatureName,ValueName)),Block),
MediaStatement(media,FeatureQuery(FeatureName,NumberLiteral(Unit)),BinaryQuery(KeywordQuery,LogicOp,FeatureQuery(FeatureName,ValueName)),Block),
MediaStatement(media,UnaryQuery(UnaryQueryOp,BinaryQuery(KeywordQuery,LogicOp,ParenthesizedQuery(KeywordQuery))),Block),
MediaStatement(media,UnaryQuery(UnaryQueryOp,KeywordQuery),Block),
MediaStatement(media,ComparisonQuery(NumberLiteral(Unit),CompareOp,FeatureName,CompareOp,NumberLiteral(Unit)),Block))
# Supports statements
@supports (animation-name: test) {
div { animation-name: test; }
}
@supports (transform-style: preserve) or (-moz-transform-style: preserve) {}
@supports not ((text-align-last: justify) or (-moz-text-align-last: justify)) {}
@supports not selector(:matches(a, b)) {}
==>
StyleSheet(
SupportsStatement(supports,FeatureQuery(FeatureName,ValueName),Block(RuleSet(TagSelector(TagName),Block(Declaration(PropertyName,ValueName))))),
SupportsStatement(supports,BinaryQuery(FeatureQuery(FeatureName,ValueName),LogicOp,FeatureQuery(FeatureName,ValueName)),Block),
SupportsStatement(supports,UnaryQuery(UnaryQueryOp,ParenthesizedQuery(
BinaryQuery(FeatureQuery(FeatureName,ValueName),LogicOp,FeatureQuery(FeatureName,ValueName)))),Block),
SupportsStatement(supports,UnaryQuery(UnaryQueryOp,SelectorQuery(selector,ParenthesizedSelector(PseudoClassSelector(PseudoClassName,ArgList(TagSelector(TagName),TagSelector(TagName)))))),Block))
# Charset statements
@charset "utf-8";
==>
StyleSheet(CharsetStatement(charset,StringLiteral))
# Other at-statements
@font-face {
font-family: "Open Sans";
src: url("/a") format("woff2"), url("/b/c") format("woff");
}
==>
StyleSheet(AtRule(AtKeyword,Block(
Declaration(PropertyName,StringLiteral),
Declaration(PropertyName,CallLiteral(CallTag,StringLiteral),CallExpression(Callee,ArgList(StringLiteral)),
CallLiteral(CallTag,StringLiteral),CallExpression(Callee,ArgList(StringLiteral))))))
# Unterminated Comment
p {}
/*
div {}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block),Comment)
# Escaped identifiers
#foo\ bar {
--weird\\var: 5px;
width: var(--weird\\var);
c\6f lor: b\6c ue;
}
==>
StyleSheet(RuleSet(IdSelector(IdName),Block(
Declaration(VariableName,NumberLiteral(Unit)),
Declaration(PropertyName,CallExpression(Callee,ArgList(VariableName))),
Declaration(PropertyName, ValueName))))
# Scope
@scope { .x {} }
@scope (div) {}
@scope (.a) to (.b) {}
==>
StyleSheet(
ScopeStatement(scope,Block(RuleSet(ClassSelector(ClassName),Block))),
ScopeStatement(scope,ParenthesizedSelector(TagSelector(TagName)),Block),
ScopeStatement(scope,ParenthesizedSelector(ClassSelector(ClassName)),to,ParenthesizedSelector(ClassSelector(ClassName)),Block))
# If Expressions
p {
background-color: if(
style(--color: white): black;
supports(foo: bar): red;
else: pink
);
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,IfExpression(if,ArgList(
IfBranch(CallQuery(QueryCallee,ArgList(FeatureName,ValueName)),ValueName),
IfBranch(CallQuery(QueryCallee,ArgList(FeatureName,ValueName)),ValueName),
IfBranch(KeywordQuery,ValueName)))))))

16
frontend/node_modules/@lezer/css/test/test-css.js generated vendored Normal file
View File

@ -0,0 +1,16 @@
import {parser} from "../dist/index.js"
import {fileTests} from "@lezer/generator/dist/test"
import * as fs from "fs"
import * as path from "path"
import {fileURLToPath} from "url"
let caseDir = path.dirname(fileURLToPath(import.meta.url))
for (let file of fs.readdirSync(caseDir)) {
if (!/\.txt$/.test(file)) continue
let name = /^[^\.]*/.exec(file)[0]
describe(name, () => {
for (let {name, run} of fileTests(fs.readFileSync(path.join(caseDir, file), "utf8"), file))
it(name, () => run(parser))
})
}

21
frontend/node_modules/@lezer/highlight/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
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.

14
frontend/node_modules/@lezer/highlight/README.md generated vendored Normal file
View File

@ -0,0 +1,14 @@
# @lezer/highlight
[ [**WEBSITE**](http://lezer.codemirror.net) | [**ISSUES**](https://github.com/lezer-parser/lezer/issues) | [**FORUM**](https://discuss.codemirror.net/c/lezer) | [**CHANGELOG**](https://github.com/lezer-parser/highlight/blob/master/CHANGELOG.md) ]
[Lezer](https://lezer.codemirror.net/) is an incremental parser system
intended for use in an editor or similar system.
@lezer/highlight provides a syntax highlighting framework for Lezer
parse trees.
Its programming interface is documented on [the
website](https://lezer.codemirror.net/docs/ref/#highlight).
This code is licensed under an MIT license.

936
frontend/node_modules/@lezer/highlight/dist/index.cjs generated vendored Normal file
View File

@ -0,0 +1,936 @@
'use strict';
var common = require('@lezer/common');
let nextTagID = 0;
/**
Highlighting tags are markers that denote a highlighting category.
They are [associated](#highlight.styleTags) with parts of a syntax
tree by a language mode, and then mapped to an actual CSS style by
a [highlighter](#highlight.Highlighter).
Because syntax tree node types and highlight styles have to be
able to talk the same language, CodeMirror uses a mostly _closed_
[vocabulary](#highlight.tags) of syntax tags (as opposed to
traditional open string-based systems, which make it hard for
highlighting themes to cover all the tokens produced by the
various languages).
It _is_ possible to [define](#highlight.Tag^define) your own
highlighting tags for system-internal use (where you control both
the language package and the highlighter), but such tags will not
be picked up by regular highlighters (though you can derive them
from standard tags to allow highlighters to fall back to those).
*/
class Tag {
/**
@internal
*/
constructor(
/**
The optional name of the base tag @internal
*/
name,
/**
The set of this tag and all its parent tags, starting with
this one itself and sorted in order of decreasing specificity.
*/
set,
/**
The base unmodified tag that this one is based on, if it's
modified @internal
*/
base,
/**
The modifiers applied to this.base @internal
*/
modified) {
this.name = name;
this.set = set;
this.base = base;
this.modified = modified;
/**
@internal
*/
this.id = nextTagID++;
}
toString() {
let { name } = this;
for (let mod of this.modified)
if (mod.name)
name = `${mod.name}(${name})`;
return name;
}
static define(nameOrParent, parent) {
let name = typeof nameOrParent == "string" ? nameOrParent : "?";
if (nameOrParent instanceof Tag)
parent = nameOrParent;
if (parent === null || parent === void 0 ? void 0 : parent.base)
throw new Error("Can not derive from a modified tag");
let tag = new Tag(name, [], null, []);
tag.set.push(tag);
if (parent)
for (let t of parent.set)
tag.set.push(t);
return tag;
}
/**
Define a tag _modifier_, which is a function that, given a tag,
will return a tag that is a subtag of the original. Applying the
same modifier to a twice tag will return the same value (`m1(t1)
== m1(t1)`) and applying multiple modifiers will, regardless or
order, produce the same tag (`m1(m2(t1)) == m2(m1(t1))`).
When multiple modifiers are applied to a given base tag, each
smaller set of modifiers is registered as a parent, so that for
example `m1(m2(m3(t1)))` is a subtype of `m1(m2(t1))`,
`m1(m3(t1)`, and so on.
*/
static defineModifier(name) {
let mod = new Modifier(name);
return (tag) => {
if (tag.modified.indexOf(mod) > -1)
return tag;
return Modifier.get(tag.base || tag, tag.modified.concat(mod).sort((a, b) => a.id - b.id));
};
}
}
let nextModifierID = 0;
class Modifier {
constructor(name) {
this.name = name;
this.instances = [];
this.id = nextModifierID++;
}
static get(base, mods) {
if (!mods.length)
return base;
let exists = mods[0].instances.find(t => t.base == base && sameArray(mods, t.modified));
if (exists)
return exists;
let set = [], tag = new Tag(base.name, set, base, mods);
for (let m of mods)
m.instances.push(tag);
let configs = powerSet(mods);
for (let parent of base.set)
if (!parent.modified.length)
for (let config of configs)
set.push(Modifier.get(parent, config));
return tag;
}
}
function sameArray(a, b) {
return a.length == b.length && a.every((x, i) => x == b[i]);
}
function powerSet(array) {
let sets = [[]];
for (let i = 0; i < array.length; i++) {
for (let j = 0, e = sets.length; j < e; j++) {
sets.push(sets[j].concat(array[i]));
}
}
return sets.sort((a, b) => b.length - a.length);
}
/**
This function is used to add a set of tags to a language syntax
via [`NodeSet.extend`](#common.NodeSet.extend) or
[`LRParser.configure`](#lr.LRParser.configure).
The argument object maps node selectors to [highlighting
tags](#highlight.Tag) or arrays of tags.
Node selectors may hold one or more (space-separated) node paths.
Such a path can be a [node name](#common.NodeType.name), or
multiple node names (or `*` wildcards) separated by slash
characters, as in `"Block/Declaration/VariableName"`. Such a path
matches the final node but only if its direct parent nodes are the
other nodes mentioned. A `*` in such a path matches any parent,
but only a single level—wildcards that match multiple parents
aren't supported, both for efficiency reasons and because Lezer
trees make it rather hard to reason about what they would match.)
A path can be ended with `/...` to indicate that the tag assigned
to the node should also apply to all child nodes, even if they
match their own style (by default, only the innermost style is
used).
When a path ends in `!`, as in `Attribute!`, no further matching
happens for the node's child nodes, and the entire node gets the
given style.
In this notation, node names that contain `/`, `!`, `*`, or `...`
must be quoted as JSON strings.
For example:
```javascript
parser.configure({props: [
styleTags({
// Style Number and BigNumber nodes
"Number BigNumber": tags.number,
// Style Escape nodes whose parent is String
"String/Escape": tags.escape,
// Style anything inside Attributes nodes
"Attributes!": tags.meta,
// Add a style to all content inside Italic nodes
"Italic/...": tags.emphasis,
// Style InvalidString nodes as both `string` and `invalid`
"InvalidString": [tags.string, tags.invalid],
// Style the node named "/" as punctuation
'"/"': tags.punctuation
})
]})
```
*/
function styleTags(spec) {
let byName = Object.create(null);
for (let prop in spec) {
let tags = spec[prop];
if (!Array.isArray(tags))
tags = [tags];
for (let part of prop.split(" "))
if (part) {
let pieces = [], mode = 2 /* Mode.Normal */, rest = part;
for (let pos = 0;;) {
if (rest == "..." && pos > 0 && pos + 3 == part.length) {
mode = 1 /* Mode.Inherit */;
break;
}
let m = /^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(rest);
if (!m)
throw new RangeError("Invalid path: " + part);
pieces.push(m[0] == "*" ? "" : m[0][0] == '"' ? JSON.parse(m[0]) : m[0]);
pos += m[0].length;
if (pos == part.length)
break;
let next = part[pos++];
if (pos == part.length && next == "!") {
mode = 0 /* Mode.Opaque */;
break;
}
if (next != "/")
throw new RangeError("Invalid path: " + part);
rest = part.slice(pos);
}
let last = pieces.length - 1, inner = pieces[last];
if (!inner)
throw new RangeError("Invalid path: " + part);
let rule = new Rule(tags, mode, last > 0 ? pieces.slice(0, last) : null);
byName[inner] = rule.sort(byName[inner]);
}
}
return ruleNodeProp.add(byName);
}
const ruleNodeProp = new common.NodeProp({
combine(a, b) {
let cur, root, take;
while (a || b) {
if (!a || b && a.depth >= b.depth) {
take = b;
b = b.next;
}
else {
take = a;
a = a.next;
}
if (cur && cur.mode == take.mode && !take.context && !cur.context)
continue;
let copy = new Rule(take.tags, take.mode, take.context);
if (cur)
cur.next = copy;
else
root = copy;
cur = copy;
}
return root;
}
});
class Rule {
constructor(tags, mode, context, next) {
this.tags = tags;
this.mode = mode;
this.context = context;
this.next = next;
}
get opaque() { return this.mode == 0 /* Mode.Opaque */; }
get inherit() { return this.mode == 1 /* Mode.Inherit */; }
sort(other) {
if (!other || other.depth < this.depth) {
this.next = other;
return this;
}
other.next = this.sort(other.next);
return other;
}
get depth() { return this.context ? this.context.length : 0; }
}
Rule.empty = new Rule([], 2 /* Mode.Normal */, null);
/**
Define a [highlighter](#highlight.Highlighter) from an array of
tag/class pairs. Classes associated with more specific tags will
take precedence.
*/
function tagHighlighter(tags, options) {
let map = Object.create(null);
for (let style of tags) {
if (!Array.isArray(style.tag))
map[style.tag.id] = style.class;
else
for (let tag of style.tag)
map[tag.id] = style.class;
}
let { scope, all = null } = options || {};
return {
style: (tags) => {
let cls = all;
for (let tag of tags) {
for (let sub of tag.set) {
let tagClass = map[sub.id];
if (tagClass) {
cls = cls ? cls + " " + tagClass : tagClass;
break;
}
}
}
return cls;
},
scope
};
}
function highlightTags(highlighters, tags) {
let result = null;
for (let highlighter of highlighters) {
let value = highlighter.style(tags);
if (value)
result = result ? result + " " + value : value;
}
return result;
}
/**
Highlight the given [tree](#common.Tree) with the given
[highlighter](#highlight.Highlighter). Often, the higher-level
[`highlightCode`](#highlight.highlightCode) function is easier to
use.
*/
function highlightTree(tree, highlighter,
/**
Assign styling to a region of the text. Will be called, in order
of position, for any ranges where more than zero classes apply.
`classes` is a space separated string of CSS classes.
*/
putStyle,
/**
The start of the range to highlight.
*/
from = 0,
/**
The end of the range.
*/
to = tree.length) {
let builder = new HighlightBuilder(from, Array.isArray(highlighter) ? highlighter : [highlighter], putStyle);
builder.highlightRange(tree.cursor(), from, to, "", builder.highlighters);
builder.flush(to);
}
/**
Highlight the given tree with the given highlighter, calling
`putText` for every piece of text, either with a set of classes or
with the empty string when unstyled, and `putBreak` for every line
break.
*/
function highlightCode(code, tree, highlighter, putText, putBreak, from = 0, to = code.length) {
let pos = from;
function writeTo(p, classes) {
if (p <= pos)
return;
for (let text = code.slice(pos, p), i = 0;;) {
let nextBreak = text.indexOf("\n", i);
let upto = nextBreak < 0 ? text.length : nextBreak;
if (upto > i)
putText(text.slice(i, upto), classes);
if (nextBreak < 0)
break;
putBreak();
i = nextBreak + 1;
}
pos = p;
}
highlightTree(tree, highlighter, (from, to, classes) => {
writeTo(from, "");
writeTo(to, classes);
}, from, to);
writeTo(to, "");
}
class HighlightBuilder {
constructor(at, highlighters, span) {
this.at = at;
this.highlighters = highlighters;
this.span = span;
this.class = "";
}
startSpan(at, cls) {
if (cls != this.class) {
this.flush(at);
if (at > this.at)
this.at = at;
this.class = cls;
}
}
flush(to) {
if (to > this.at && this.class)
this.span(this.at, to, this.class);
}
highlightRange(cursor, from, to, inheritedClass, highlighters) {
let { type, from: start, to: end } = cursor;
if (start >= to || end <= from)
return;
if (type.isTop)
highlighters = this.highlighters.filter(h => !h.scope || h.scope(type));
let cls = inheritedClass;
let rule = getStyleTags(cursor) || Rule.empty;
let tagCls = highlightTags(highlighters, rule.tags);
if (tagCls) {
if (cls)
cls += " ";
cls += tagCls;
if (rule.mode == 1 /* Mode.Inherit */)
inheritedClass += (inheritedClass ? " " : "") + tagCls;
}
this.startSpan(Math.max(from, start), cls);
if (rule.opaque)
return;
let mounted = cursor.tree && cursor.tree.prop(common.NodeProp.mounted);
if (mounted && mounted.overlay) {
let inner = cursor.node.enter(mounted.overlay[0].from + start, 1);
let innerHighlighters = this.highlighters.filter(h => !h.scope || h.scope(mounted.tree.type));
let hasChild = cursor.firstChild();
for (let i = 0, pos = start;; i++) {
let next = i < mounted.overlay.length ? mounted.overlay[i] : null;
let nextPos = next ? next.from + start : end;
let rangeFrom = Math.max(from, pos), rangeTo = Math.min(to, nextPos);
if (rangeFrom < rangeTo && hasChild) {
while (cursor.from < rangeTo) {
this.highlightRange(cursor, rangeFrom, rangeTo, inheritedClass, highlighters);
this.startSpan(Math.min(rangeTo, cursor.to), cls);
if (cursor.to >= nextPos || !cursor.nextSibling())
break;
}
}
if (!next || nextPos > to)
break;
pos = next.to + start;
if (pos > from) {
this.highlightRange(inner.cursor(), Math.max(from, next.from + start), Math.min(to, pos), "", innerHighlighters);
this.startSpan(Math.min(to, pos), cls);
}
}
if (hasChild)
cursor.parent();
}
else if (cursor.firstChild()) {
if (mounted)
inheritedClass = "";
do {
if (cursor.to <= from)
continue;
if (cursor.from >= to)
break;
this.highlightRange(cursor, from, to, inheritedClass, highlighters);
this.startSpan(Math.min(to, cursor.to), cls);
} while (cursor.nextSibling());
cursor.parent();
}
}
}
/**
Match a syntax node's [highlight rules](#highlight.styleTags). If
there's a match, return its set of tags, and whether it is
opaque (uses a `!`) or applies to all child nodes (`/...`).
*/
function getStyleTags(node) {
let rule = node.type.prop(ruleNodeProp);
while (rule && rule.context && !node.matchContext(rule.context))
rule = rule.next;
return rule || null;
}
const t = Tag.define;
const comment = t(), name = t(), typeName = t(name), propertyName = t(name), literal = t(), string = t(literal), number = t(literal), content = t(), heading = t(content), keyword = t(), operator = t(), punctuation = t(), bracket = t(punctuation), meta = t();
/**
The default set of highlighting [tags](#highlight.Tag).
This collection is heavily biased towards programming languages,
and necessarily incomplete. A full ontology of syntactic
constructs would fill a stack of books, and be impractical to
write themes for. So try to make do with this set. If all else
fails, [open an
issue](https://github.com/codemirror/codemirror.next) to propose a
new tag, or [define](#highlight.Tag^define) a local custom tag for
your use case.
Note that it is not obligatory to always attach the most specific
tag possible to an element—if your grammar can't easily
distinguish a certain type of element (such as a local variable),
it is okay to style it as its more general variant (a variable).
For tags that extend some parent tag, the documentation links to
the parent.
*/
const tags = {
/**
A comment.
*/
comment,
/**
A line [comment](#highlight.tags.comment).
*/
lineComment: t(comment),
/**
A block [comment](#highlight.tags.comment).
*/
blockComment: t(comment),
/**
A documentation [comment](#highlight.tags.comment).
*/
docComment: t(comment),
/**
Any kind of identifier.
*/
name,
/**
The [name](#highlight.tags.name) of a variable.
*/
variableName: t(name),
/**
A type [name](#highlight.tags.name).
*/
typeName: typeName,
/**
A tag name (subtag of [`typeName`](#highlight.tags.typeName)).
*/
tagName: t(typeName),
/**
A property or field [name](#highlight.tags.name).
*/
propertyName: propertyName,
/**
An attribute name (subtag of [`propertyName`](#highlight.tags.propertyName)).
*/
attributeName: t(propertyName),
/**
The [name](#highlight.tags.name) of a class.
*/
className: t(name),
/**
A label [name](#highlight.tags.name).
*/
labelName: t(name),
/**
A namespace [name](#highlight.tags.name).
*/
namespace: t(name),
/**
The [name](#highlight.tags.name) of a macro.
*/
macroName: t(name),
/**
A literal value.
*/
literal,
/**
A string [literal](#highlight.tags.literal).
*/
string,
/**
A documentation [string](#highlight.tags.string).
*/
docString: t(string),
/**
A character literal (subtag of [string](#highlight.tags.string)).
*/
character: t(string),
/**
An attribute value (subtag of [string](#highlight.tags.string)).
*/
attributeValue: t(string),
/**
A number [literal](#highlight.tags.literal).
*/
number,
/**
An integer [number](#highlight.tags.number) literal.
*/
integer: t(number),
/**
A floating-point [number](#highlight.tags.number) literal.
*/
float: t(number),
/**
A boolean [literal](#highlight.tags.literal).
*/
bool: t(literal),
/**
Regular expression [literal](#highlight.tags.literal).
*/
regexp: t(literal),
/**
An escape [literal](#highlight.tags.literal), for example a
backslash escape in a string.
*/
escape: t(literal),
/**
A color [literal](#highlight.tags.literal).
*/
color: t(literal),
/**
A URL [literal](#highlight.tags.literal).
*/
url: t(literal),
/**
A language keyword.
*/
keyword,
/**
The [keyword](#highlight.tags.keyword) for the self or this
object.
*/
self: t(keyword),
/**
The [keyword](#highlight.tags.keyword) for null.
*/
null: t(keyword),
/**
A [keyword](#highlight.tags.keyword) denoting some atomic value.
*/
atom: t(keyword),
/**
A [keyword](#highlight.tags.keyword) that represents a unit.
*/
unit: t(keyword),
/**
A modifier [keyword](#highlight.tags.keyword).
*/
modifier: t(keyword),
/**
A [keyword](#highlight.tags.keyword) that acts as an operator.
*/
operatorKeyword: t(keyword),
/**
A control-flow related [keyword](#highlight.tags.keyword).
*/
controlKeyword: t(keyword),
/**
A [keyword](#highlight.tags.keyword) that defines something.
*/
definitionKeyword: t(keyword),
/**
A [keyword](#highlight.tags.keyword) related to defining or
interfacing with modules.
*/
moduleKeyword: t(keyword),
/**
An operator.
*/
operator,
/**
An [operator](#highlight.tags.operator) that dereferences something.
*/
derefOperator: t(operator),
/**
Arithmetic-related [operator](#highlight.tags.operator).
*/
arithmeticOperator: t(operator),
/**
Logical [operator](#highlight.tags.operator).
*/
logicOperator: t(operator),
/**
Bit [operator](#highlight.tags.operator).
*/
bitwiseOperator: t(operator),
/**
Comparison [operator](#highlight.tags.operator).
*/
compareOperator: t(operator),
/**
[Operator](#highlight.tags.operator) that updates its operand.
*/
updateOperator: t(operator),
/**
[Operator](#highlight.tags.operator) that defines something.
*/
definitionOperator: t(operator),
/**
Type-related [operator](#highlight.tags.operator).
*/
typeOperator: t(operator),
/**
Control-flow [operator](#highlight.tags.operator).
*/
controlOperator: t(operator),
/**
Program or markup punctuation.
*/
punctuation,
/**
[Punctuation](#highlight.tags.punctuation) that separates
things.
*/
separator: t(punctuation),
/**
Bracket-style [punctuation](#highlight.tags.punctuation).
*/
bracket,
/**
Angle [brackets](#highlight.tags.bracket) (usually `<` and `>`
tokens).
*/
angleBracket: t(bracket),
/**
Square [brackets](#highlight.tags.bracket) (usually `[` and `]`
tokens).
*/
squareBracket: t(bracket),
/**
Parentheses (usually `(` and `)` tokens). Subtag of
[bracket](#highlight.tags.bracket).
*/
paren: t(bracket),
/**
Braces (usually `{` and `}` tokens). Subtag of
[bracket](#highlight.tags.bracket).
*/
brace: t(bracket),
/**
Content, for example plain text in XML or markup documents.
*/
content,
/**
[Content](#highlight.tags.content) that represents a heading.
*/
heading,
/**
A level 1 [heading](#highlight.tags.heading).
*/
heading1: t(heading),
/**
A level 2 [heading](#highlight.tags.heading).
*/
heading2: t(heading),
/**
A level 3 [heading](#highlight.tags.heading).
*/
heading3: t(heading),
/**
A level 4 [heading](#highlight.tags.heading).
*/
heading4: t(heading),
/**
A level 5 [heading](#highlight.tags.heading).
*/
heading5: t(heading),
/**
A level 6 [heading](#highlight.tags.heading).
*/
heading6: t(heading),
/**
A prose [content](#highlight.tags.content) separator (such as a horizontal rule).
*/
contentSeparator: t(content),
/**
[Content](#highlight.tags.content) that represents a list.
*/
list: t(content),
/**
[Content](#highlight.tags.content) that represents a quote.
*/
quote: t(content),
/**
[Content](#highlight.tags.content) that is emphasized.
*/
emphasis: t(content),
/**
[Content](#highlight.tags.content) that is styled strong.
*/
strong: t(content),
/**
[Content](#highlight.tags.content) that is part of a link.
*/
link: t(content),
/**
[Content](#highlight.tags.content) that is styled as code or
monospace.
*/
monospace: t(content),
/**
[Content](#highlight.tags.content) that has a strike-through
style.
*/
strikethrough: t(content),
/**
Inserted text in a change-tracking format.
*/
inserted: t(),
/**
Deleted text.
*/
deleted: t(),
/**
Changed text.
*/
changed: t(),
/**
An invalid or unsyntactic element.
*/
invalid: t(),
/**
Metadata or meta-instruction.
*/
meta,
/**
[Metadata](#highlight.tags.meta) that applies to the entire
document.
*/
documentMeta: t(meta),
/**
[Metadata](#highlight.tags.meta) that annotates or adds
attributes to a given syntactic element.
*/
annotation: t(meta),
/**
Processing instruction or preprocessor directive. Subtag of
[meta](#highlight.tags.meta).
*/
processingInstruction: t(meta),
/**
[Modifier](#highlight.Tag^defineModifier) that indicates that a
given element is being defined. Expected to be used with the
various [name](#highlight.tags.name) tags.
*/
definition: Tag.defineModifier("definition"),
/**
[Modifier](#highlight.Tag^defineModifier) that indicates that
something is constant. Mostly expected to be used with
[variable names](#highlight.tags.variableName).
*/
constant: Tag.defineModifier("constant"),
/**
[Modifier](#highlight.Tag^defineModifier) used to indicate that
a [variable](#highlight.tags.variableName) or [property
name](#highlight.tags.propertyName) is being called or defined
as a function.
*/
function: Tag.defineModifier("function"),
/**
[Modifier](#highlight.Tag^defineModifier) that can be applied to
[names](#highlight.tags.name) to indicate that they belong to
the language's standard environment.
*/
standard: Tag.defineModifier("standard"),
/**
[Modifier](#highlight.Tag^defineModifier) that indicates a given
[names](#highlight.tags.name) is local to some scope.
*/
local: Tag.defineModifier("local"),
/**
A generic variant [modifier](#highlight.Tag^defineModifier) that
can be used to tag language-specific alternative variants of
some common tag. It is recommended for themes to define special
forms of at least the [string](#highlight.tags.string) and
[variable name](#highlight.tags.variableName) tags, since those
come up a lot.
*/
special: Tag.defineModifier("special")
};
for (let name in tags) {
let val = tags[name];
if (val instanceof Tag)
val.name = name;
}
/**
This is a highlighter that adds stable, predictable classes to
tokens, for styling with external CSS.
The following tags are mapped to their name prefixed with `"tok-"`
(for example `"tok-comment"`):
* [`link`](#highlight.tags.link)
* [`heading`](#highlight.tags.heading)
* [`emphasis`](#highlight.tags.emphasis)
* [`strong`](#highlight.tags.strong)
* [`keyword`](#highlight.tags.keyword)
* [`atom`](#highlight.tags.atom)
* [`bool`](#highlight.tags.bool)
* [`url`](#highlight.tags.url)
* [`labelName`](#highlight.tags.labelName)
* [`inserted`](#highlight.tags.inserted)
* [`deleted`](#highlight.tags.deleted)
* [`literal`](#highlight.tags.literal)
* [`string`](#highlight.tags.string)
* [`number`](#highlight.tags.number)
* [`variableName`](#highlight.tags.variableName)
* [`typeName`](#highlight.tags.typeName)
* [`namespace`](#highlight.tags.namespace)
* [`className`](#highlight.tags.className)
* [`macroName`](#highlight.tags.macroName)
* [`propertyName`](#highlight.tags.propertyName)
* [`operator`](#highlight.tags.operator)
* [`comment`](#highlight.tags.comment)
* [`meta`](#highlight.tags.meta)
* [`punctuation`](#highlight.tags.punctuation)
* [`invalid`](#highlight.tags.invalid)
In addition, these mappings are provided:
* [`regexp`](#highlight.tags.regexp),
[`escape`](#highlight.tags.escape), and
[`special`](#highlight.tags.special)[`(string)`](#highlight.tags.string)
are mapped to `"tok-string2"`
* [`special`](#highlight.tags.special)[`(variableName)`](#highlight.tags.variableName)
to `"tok-variableName2"`
* [`local`](#highlight.tags.local)[`(variableName)`](#highlight.tags.variableName)
to `"tok-variableName tok-local"`
* [`definition`](#highlight.tags.definition)[`(variableName)`](#highlight.tags.variableName)
to `"tok-variableName tok-definition"`
* [`definition`](#highlight.tags.definition)[`(propertyName)`](#highlight.tags.propertyName)
to `"tok-propertyName tok-definition"`
*/
const classHighlighter = tagHighlighter([
{ tag: tags.link, class: "tok-link" },
{ tag: tags.heading, class: "tok-heading" },
{ tag: tags.emphasis, class: "tok-emphasis" },
{ tag: tags.strong, class: "tok-strong" },
{ tag: tags.keyword, class: "tok-keyword" },
{ tag: tags.atom, class: "tok-atom" },
{ tag: tags.bool, class: "tok-bool" },
{ tag: tags.url, class: "tok-url" },
{ tag: tags.labelName, class: "tok-labelName" },
{ tag: tags.inserted, class: "tok-inserted" },
{ tag: tags.deleted, class: "tok-deleted" },
{ tag: tags.literal, class: "tok-literal" },
{ tag: tags.string, class: "tok-string" },
{ tag: tags.number, class: "tok-number" },
{ tag: [tags.regexp, tags.escape, tags.special(tags.string)], class: "tok-string2" },
{ tag: tags.variableName, class: "tok-variableName" },
{ tag: tags.local(tags.variableName), class: "tok-variableName tok-local" },
{ tag: tags.definition(tags.variableName), class: "tok-variableName tok-definition" },
{ tag: tags.special(tags.variableName), class: "tok-variableName2" },
{ tag: tags.definition(tags.propertyName), class: "tok-propertyName tok-definition" },
{ tag: tags.typeName, class: "tok-typeName" },
{ tag: tags.namespace, class: "tok-namespace" },
{ tag: tags.className, class: "tok-className" },
{ tag: tags.macroName, class: "tok-macroName" },
{ tag: tags.propertyName, class: "tok-propertyName" },
{ tag: tags.operator, class: "tok-operator" },
{ tag: tags.comment, class: "tok-comment" },
{ tag: tags.meta, class: "tok-meta" },
{ tag: tags.invalid, class: "tok-invalid" },
{ tag: tags.punctuation, class: "tok-punctuation" }
]);
exports.Tag = Tag;
exports.classHighlighter = classHighlighter;
exports.getStyleTags = getStyleTags;
exports.highlightCode = highlightCode;
exports.highlightTree = highlightTree;
exports.styleTags = styleTags;
exports.tagHighlighter = tagHighlighter;
exports.tags = tags;

623
frontend/node_modules/@lezer/highlight/dist/index.d.cts generated vendored Normal file
View File

@ -0,0 +1,623 @@
import * as _lezer_common from '@lezer/common';
import { NodeType, Tree, SyntaxNodeRef } from '@lezer/common';
/**
Highlighting tags are markers that denote a highlighting category.
They are [associated](#highlight.styleTags) with parts of a syntax
tree by a language mode, and then mapped to an actual CSS style by
a [highlighter](#highlight.Highlighter).
Because syntax tree node types and highlight styles have to be
able to talk the same language, CodeMirror uses a mostly _closed_
[vocabulary](#highlight.tags) of syntax tags (as opposed to
traditional open string-based systems, which make it hard for
highlighting themes to cover all the tokens produced by the
various languages).
It _is_ possible to [define](#highlight.Tag^define) your own
highlighting tags for system-internal use (where you control both
the language package and the highlighter), but such tags will not
be picked up by regular highlighters (though you can derive them
from standard tags to allow highlighters to fall back to those).
*/
declare class Tag {
/**
The set of this tag and all its parent tags, starting with
this one itself and sorted in order of decreasing specificity.
*/
readonly set: Tag[];
toString(): string;
/**
Define a new tag. If `parent` is given, the tag is treated as a
sub-tag of that parent, and
[highlighters](#highlight.tagHighlighter) that don't mention
this tag will try to fall back to the parent tag (or grandparent
tag, etc).
*/
static define(name?: string, parent?: Tag): Tag;
static define(parent?: Tag): Tag;
/**
Define a tag _modifier_, which is a function that, given a tag,
will return a tag that is a subtag of the original. Applying the
same modifier to a twice tag will return the same value (`m1(t1)
== m1(t1)`) and applying multiple modifiers will, regardless or
order, produce the same tag (`m1(m2(t1)) == m2(m1(t1))`).
When multiple modifiers are applied to a given base tag, each
smaller set of modifiers is registered as a parent, so that for
example `m1(m2(m3(t1)))` is a subtype of `m1(m2(t1))`,
`m1(m3(t1)`, and so on.
*/
static defineModifier(name?: string): (tag: Tag) => Tag;
}
/**
This function is used to add a set of tags to a language syntax
via [`NodeSet.extend`](#common.NodeSet.extend) or
[`LRParser.configure`](#lr.LRParser.configure).
The argument object maps node selectors to [highlighting
tags](#highlight.Tag) or arrays of tags.
Node selectors may hold one or more (space-separated) node paths.
Such a path can be a [node name](#common.NodeType.name), or
multiple node names (or `*` wildcards) separated by slash
characters, as in `"Block/Declaration/VariableName"`. Such a path
matches the final node but only if its direct parent nodes are the
other nodes mentioned. A `*` in such a path matches any parent,
but only a single level—wildcards that match multiple parents
aren't supported, both for efficiency reasons and because Lezer
trees make it rather hard to reason about what they would match.)
A path can be ended with `/...` to indicate that the tag assigned
to the node should also apply to all child nodes, even if they
match their own style (by default, only the innermost style is
used).
When a path ends in `!`, as in `Attribute!`, no further matching
happens for the node's child nodes, and the entire node gets the
given style.
In this notation, node names that contain `/`, `!`, `*`, or `...`
must be quoted as JSON strings.
For example:
```javascript
parser.configure({props: [
styleTags({
// Style Number and BigNumber nodes
"Number BigNumber": tags.number,
// Style Escape nodes whose parent is String
"String/Escape": tags.escape,
// Style anything inside Attributes nodes
"Attributes!": tags.meta,
// Add a style to all content inside Italic nodes
"Italic/...": tags.emphasis,
// Style InvalidString nodes as both `string` and `invalid`
"InvalidString": [tags.string, tags.invalid],
// Style the node named "/" as punctuation
'"/"': tags.punctuation
})
]})
```
*/
declare function styleTags(spec: {
[selector: string]: Tag | readonly Tag[];
}): _lezer_common.NodePropSource;
/**
A highlighter defines a mapping from highlighting tags and
language scopes to CSS class names. They are usually defined via
[`tagHighlighter`](#highlight.tagHighlighter) or some wrapper
around that, but it is also possible to implement them from
scratch.
*/
interface Highlighter {
/**
Get the set of classes that should be applied to the given set
of highlighting tags, or null if this highlighter doesn't assign
a style to the tags.
*/
style(tags: readonly Tag[]): string | null;
/**
When given, the highlighter will only be applied to trees on
whose [top](#common.NodeType.isTop) node this predicate returns
true.
*/
scope?(node: NodeType): boolean;
}
/**
Define a [highlighter](#highlight.Highlighter) from an array of
tag/class pairs. Classes associated with more specific tags will
take precedence.
*/
declare function tagHighlighter(tags: readonly {
tag: Tag | readonly Tag[];
class: string;
}[], options?: {
/**
By default, highlighters apply to the entire document. You can
scope them to a single language by providing the tree's
[top](#common.NodeType.isTop) node type here.
*/
scope?: (node: NodeType) => boolean;
/**
Add a style to _all_ tokens. Probably only useful in combination
with `scope`.
*/
all?: string;
}): Highlighter;
/**
Highlight the given [tree](#common.Tree) with the given
[highlighter](#highlight.Highlighter). Often, the higher-level
[`highlightCode`](#highlight.highlightCode) function is easier to
use.
*/
declare function highlightTree(tree: Tree, highlighter: Highlighter | readonly Highlighter[],
/**
Assign styling to a region of the text. Will be called, in order
of position, for any ranges where more than zero classes apply.
`classes` is a space separated string of CSS classes.
*/
putStyle: (from: number, to: number, classes: string) => void,
/**
The start of the range to highlight.
*/
from?: number,
/**
The end of the range.
*/
to?: number): void;
/**
Highlight the given tree with the given highlighter, calling
`putText` for every piece of text, either with a set of classes or
with the empty string when unstyled, and `putBreak` for every line
break.
*/
declare function highlightCode(code: string, tree: Tree, highlighter: Highlighter | readonly Highlighter[], putText: (code: string, classes: string) => void, putBreak: () => void, from?: number, to?: number): void;
/**
Match a syntax node's [highlight rules](#highlight.styleTags). If
there's a match, return its set of tags, and whether it is
opaque (uses a `!`) or applies to all child nodes (`/...`).
*/
declare function getStyleTags(node: SyntaxNodeRef): {
tags: readonly Tag[];
opaque: boolean;
inherit: boolean;
} | null;
/**
The default set of highlighting [tags](#highlight.Tag).
This collection is heavily biased towards programming languages,
and necessarily incomplete. A full ontology of syntactic
constructs would fill a stack of books, and be impractical to
write themes for. So try to make do with this set. If all else
fails, [open an
issue](https://github.com/codemirror/codemirror.next) to propose a
new tag, or [define](#highlight.Tag^define) a local custom tag for
your use case.
Note that it is not obligatory to always attach the most specific
tag possible to an element—if your grammar can't easily
distinguish a certain type of element (such as a local variable),
it is okay to style it as its more general variant (a variable).
For tags that extend some parent tag, the documentation links to
the parent.
*/
declare const tags: {
/**
A comment.
*/
comment: Tag;
/**
A line [comment](#highlight.tags.comment).
*/
lineComment: Tag;
/**
A block [comment](#highlight.tags.comment).
*/
blockComment: Tag;
/**
A documentation [comment](#highlight.tags.comment).
*/
docComment: Tag;
/**
Any kind of identifier.
*/
name: Tag;
/**
The [name](#highlight.tags.name) of a variable.
*/
variableName: Tag;
/**
A type [name](#highlight.tags.name).
*/
typeName: Tag;
/**
A tag name (subtag of [`typeName`](#highlight.tags.typeName)).
*/
tagName: Tag;
/**
A property or field [name](#highlight.tags.name).
*/
propertyName: Tag;
/**
An attribute name (subtag of [`propertyName`](#highlight.tags.propertyName)).
*/
attributeName: Tag;
/**
The [name](#highlight.tags.name) of a class.
*/
className: Tag;
/**
A label [name](#highlight.tags.name).
*/
labelName: Tag;
/**
A namespace [name](#highlight.tags.name).
*/
namespace: Tag;
/**
The [name](#highlight.tags.name) of a macro.
*/
macroName: Tag;
/**
A literal value.
*/
literal: Tag;
/**
A string [literal](#highlight.tags.literal).
*/
string: Tag;
/**
A documentation [string](#highlight.tags.string).
*/
docString: Tag;
/**
A character literal (subtag of [string](#highlight.tags.string)).
*/
character: Tag;
/**
An attribute value (subtag of [string](#highlight.tags.string)).
*/
attributeValue: Tag;
/**
A number [literal](#highlight.tags.literal).
*/
number: Tag;
/**
An integer [number](#highlight.tags.number) literal.
*/
integer: Tag;
/**
A floating-point [number](#highlight.tags.number) literal.
*/
float: Tag;
/**
A boolean [literal](#highlight.tags.literal).
*/
bool: Tag;
/**
Regular expression [literal](#highlight.tags.literal).
*/
regexp: Tag;
/**
An escape [literal](#highlight.tags.literal), for example a
backslash escape in a string.
*/
escape: Tag;
/**
A color [literal](#highlight.tags.literal).
*/
color: Tag;
/**
A URL [literal](#highlight.tags.literal).
*/
url: Tag;
/**
A language keyword.
*/
keyword: Tag;
/**
The [keyword](#highlight.tags.keyword) for the self or this
object.
*/
self: Tag;
/**
The [keyword](#highlight.tags.keyword) for null.
*/
null: Tag;
/**
A [keyword](#highlight.tags.keyword) denoting some atomic value.
*/
atom: Tag;
/**
A [keyword](#highlight.tags.keyword) that represents a unit.
*/
unit: Tag;
/**
A modifier [keyword](#highlight.tags.keyword).
*/
modifier: Tag;
/**
A [keyword](#highlight.tags.keyword) that acts as an operator.
*/
operatorKeyword: Tag;
/**
A control-flow related [keyword](#highlight.tags.keyword).
*/
controlKeyword: Tag;
/**
A [keyword](#highlight.tags.keyword) that defines something.
*/
definitionKeyword: Tag;
/**
A [keyword](#highlight.tags.keyword) related to defining or
interfacing with modules.
*/
moduleKeyword: Tag;
/**
An operator.
*/
operator: Tag;
/**
An [operator](#highlight.tags.operator) that dereferences something.
*/
derefOperator: Tag;
/**
Arithmetic-related [operator](#highlight.tags.operator).
*/
arithmeticOperator: Tag;
/**
Logical [operator](#highlight.tags.operator).
*/
logicOperator: Tag;
/**
Bit [operator](#highlight.tags.operator).
*/
bitwiseOperator: Tag;
/**
Comparison [operator](#highlight.tags.operator).
*/
compareOperator: Tag;
/**
[Operator](#highlight.tags.operator) that updates its operand.
*/
updateOperator: Tag;
/**
[Operator](#highlight.tags.operator) that defines something.
*/
definitionOperator: Tag;
/**
Type-related [operator](#highlight.tags.operator).
*/
typeOperator: Tag;
/**
Control-flow [operator](#highlight.tags.operator).
*/
controlOperator: Tag;
/**
Program or markup punctuation.
*/
punctuation: Tag;
/**
[Punctuation](#highlight.tags.punctuation) that separates
things.
*/
separator: Tag;
/**
Bracket-style [punctuation](#highlight.tags.punctuation).
*/
bracket: Tag;
/**
Angle [brackets](#highlight.tags.bracket) (usually `<` and `>`
tokens).
*/
angleBracket: Tag;
/**
Square [brackets](#highlight.tags.bracket) (usually `[` and `]`
tokens).
*/
squareBracket: Tag;
/**
Parentheses (usually `(` and `)` tokens). Subtag of
[bracket](#highlight.tags.bracket).
*/
paren: Tag;
/**
Braces (usually `{` and `}` tokens). Subtag of
[bracket](#highlight.tags.bracket).
*/
brace: Tag;
/**
Content, for example plain text in XML or markup documents.
*/
content: Tag;
/**
[Content](#highlight.tags.content) that represents a heading.
*/
heading: Tag;
/**
A level 1 [heading](#highlight.tags.heading).
*/
heading1: Tag;
/**
A level 2 [heading](#highlight.tags.heading).
*/
heading2: Tag;
/**
A level 3 [heading](#highlight.tags.heading).
*/
heading3: Tag;
/**
A level 4 [heading](#highlight.tags.heading).
*/
heading4: Tag;
/**
A level 5 [heading](#highlight.tags.heading).
*/
heading5: Tag;
/**
A level 6 [heading](#highlight.tags.heading).
*/
heading6: Tag;
/**
A prose [content](#highlight.tags.content) separator (such as a horizontal rule).
*/
contentSeparator: Tag;
/**
[Content](#highlight.tags.content) that represents a list.
*/
list: Tag;
/**
[Content](#highlight.tags.content) that represents a quote.
*/
quote: Tag;
/**
[Content](#highlight.tags.content) that is emphasized.
*/
emphasis: Tag;
/**
[Content](#highlight.tags.content) that is styled strong.
*/
strong: Tag;
/**
[Content](#highlight.tags.content) that is part of a link.
*/
link: Tag;
/**
[Content](#highlight.tags.content) that is styled as code or
monospace.
*/
monospace: Tag;
/**
[Content](#highlight.tags.content) that has a strike-through
style.
*/
strikethrough: Tag;
/**
Inserted text in a change-tracking format.
*/
inserted: Tag;
/**
Deleted text.
*/
deleted: Tag;
/**
Changed text.
*/
changed: Tag;
/**
An invalid or unsyntactic element.
*/
invalid: Tag;
/**
Metadata or meta-instruction.
*/
meta: Tag;
/**
[Metadata](#highlight.tags.meta) that applies to the entire
document.
*/
documentMeta: Tag;
/**
[Metadata](#highlight.tags.meta) that annotates or adds
attributes to a given syntactic element.
*/
annotation: Tag;
/**
Processing instruction or preprocessor directive. Subtag of
[meta](#highlight.tags.meta).
*/
processingInstruction: Tag;
/**
[Modifier](#highlight.Tag^defineModifier) that indicates that a
given element is being defined. Expected to be used with the
various [name](#highlight.tags.name) tags.
*/
definition: (tag: Tag) => Tag;
/**
[Modifier](#highlight.Tag^defineModifier) that indicates that
something is constant. Mostly expected to be used with
[variable names](#highlight.tags.variableName).
*/
constant: (tag: Tag) => Tag;
/**
[Modifier](#highlight.Tag^defineModifier) used to indicate that
a [variable](#highlight.tags.variableName) or [property
name](#highlight.tags.propertyName) is being called or defined
as a function.
*/
function: (tag: Tag) => Tag;
/**
[Modifier](#highlight.Tag^defineModifier) that can be applied to
[names](#highlight.tags.name) to indicate that they belong to
the language's standard environment.
*/
standard: (tag: Tag) => Tag;
/**
[Modifier](#highlight.Tag^defineModifier) that indicates a given
[names](#highlight.tags.name) is local to some scope.
*/
local: (tag: Tag) => Tag;
/**
A generic variant [modifier](#highlight.Tag^defineModifier) that
can be used to tag language-specific alternative variants of
some common tag. It is recommended for themes to define special
forms of at least the [string](#highlight.tags.string) and
[variable name](#highlight.tags.variableName) tags, since those
come up a lot.
*/
special: (tag: Tag) => Tag;
};
/**
This is a highlighter that adds stable, predictable classes to
tokens, for styling with external CSS.
The following tags are mapped to their name prefixed with `"tok-"`
(for example `"tok-comment"`):
* [`link`](#highlight.tags.link)
* [`heading`](#highlight.tags.heading)
* [`emphasis`](#highlight.tags.emphasis)
* [`strong`](#highlight.tags.strong)
* [`keyword`](#highlight.tags.keyword)
* [`atom`](#highlight.tags.atom)
* [`bool`](#highlight.tags.bool)
* [`url`](#highlight.tags.url)
* [`labelName`](#highlight.tags.labelName)
* [`inserted`](#highlight.tags.inserted)
* [`deleted`](#highlight.tags.deleted)
* [`literal`](#highlight.tags.literal)
* [`string`](#highlight.tags.string)
* [`number`](#highlight.tags.number)
* [`variableName`](#highlight.tags.variableName)
* [`typeName`](#highlight.tags.typeName)
* [`namespace`](#highlight.tags.namespace)
* [`className`](#highlight.tags.className)
* [`macroName`](#highlight.tags.macroName)
* [`propertyName`](#highlight.tags.propertyName)
* [`operator`](#highlight.tags.operator)
* [`comment`](#highlight.tags.comment)
* [`meta`](#highlight.tags.meta)
* [`punctuation`](#highlight.tags.punctuation)
* [`invalid`](#highlight.tags.invalid)
In addition, these mappings are provided:
* [`regexp`](#highlight.tags.regexp),
[`escape`](#highlight.tags.escape), and
[`special`](#highlight.tags.special)[`(string)`](#highlight.tags.string)
are mapped to `"tok-string2"`
* [`special`](#highlight.tags.special)[`(variableName)`](#highlight.tags.variableName)
to `"tok-variableName2"`
* [`local`](#highlight.tags.local)[`(variableName)`](#highlight.tags.variableName)
to `"tok-variableName tok-local"`
* [`definition`](#highlight.tags.definition)[`(variableName)`](#highlight.tags.variableName)
to `"tok-variableName tok-definition"`
* [`definition`](#highlight.tags.definition)[`(propertyName)`](#highlight.tags.propertyName)
to `"tok-propertyName tok-definition"`
*/
declare const classHighlighter: Highlighter;
export { type Highlighter, Tag, classHighlighter, getStyleTags, highlightCode, highlightTree, styleTags, tagHighlighter, tags };

623
frontend/node_modules/@lezer/highlight/dist/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,623 @@
import * as _lezer_common from '@lezer/common';
import { NodeType, Tree, SyntaxNodeRef } from '@lezer/common';
/**
Highlighting tags are markers that denote a highlighting category.
They are [associated](#highlight.styleTags) with parts of a syntax
tree by a language mode, and then mapped to an actual CSS style by
a [highlighter](#highlight.Highlighter).
Because syntax tree node types and highlight styles have to be
able to talk the same language, CodeMirror uses a mostly _closed_
[vocabulary](#highlight.tags) of syntax tags (as opposed to
traditional open string-based systems, which make it hard for
highlighting themes to cover all the tokens produced by the
various languages).
It _is_ possible to [define](#highlight.Tag^define) your own
highlighting tags for system-internal use (where you control both
the language package and the highlighter), but such tags will not
be picked up by regular highlighters (though you can derive them
from standard tags to allow highlighters to fall back to those).
*/
declare class Tag {
/**
The set of this tag and all its parent tags, starting with
this one itself and sorted in order of decreasing specificity.
*/
readonly set: Tag[];
toString(): string;
/**
Define a new tag. If `parent` is given, the tag is treated as a
sub-tag of that parent, and
[highlighters](#highlight.tagHighlighter) that don't mention
this tag will try to fall back to the parent tag (or grandparent
tag, etc).
*/
static define(name?: string, parent?: Tag): Tag;
static define(parent?: Tag): Tag;
/**
Define a tag _modifier_, which is a function that, given a tag,
will return a tag that is a subtag of the original. Applying the
same modifier to a twice tag will return the same value (`m1(t1)
== m1(t1)`) and applying multiple modifiers will, regardless or
order, produce the same tag (`m1(m2(t1)) == m2(m1(t1))`).
When multiple modifiers are applied to a given base tag, each
smaller set of modifiers is registered as a parent, so that for
example `m1(m2(m3(t1)))` is a subtype of `m1(m2(t1))`,
`m1(m3(t1)`, and so on.
*/
static defineModifier(name?: string): (tag: Tag) => Tag;
}
/**
This function is used to add a set of tags to a language syntax
via [`NodeSet.extend`](#common.NodeSet.extend) or
[`LRParser.configure`](#lr.LRParser.configure).
The argument object maps node selectors to [highlighting
tags](#highlight.Tag) or arrays of tags.
Node selectors may hold one or more (space-separated) node paths.
Such a path can be a [node name](#common.NodeType.name), or
multiple node names (or `*` wildcards) separated by slash
characters, as in `"Block/Declaration/VariableName"`. Such a path
matches the final node but only if its direct parent nodes are the
other nodes mentioned. A `*` in such a path matches any parent,
but only a single level—wildcards that match multiple parents
aren't supported, both for efficiency reasons and because Lezer
trees make it rather hard to reason about what they would match.)
A path can be ended with `/...` to indicate that the tag assigned
to the node should also apply to all child nodes, even if they
match their own style (by default, only the innermost style is
used).
When a path ends in `!`, as in `Attribute!`, no further matching
happens for the node's child nodes, and the entire node gets the
given style.
In this notation, node names that contain `/`, `!`, `*`, or `...`
must be quoted as JSON strings.
For example:
```javascript
parser.configure({props: [
styleTags({
// Style Number and BigNumber nodes
"Number BigNumber": tags.number,
// Style Escape nodes whose parent is String
"String/Escape": tags.escape,
// Style anything inside Attributes nodes
"Attributes!": tags.meta,
// Add a style to all content inside Italic nodes
"Italic/...": tags.emphasis,
// Style InvalidString nodes as both `string` and `invalid`
"InvalidString": [tags.string, tags.invalid],
// Style the node named "/" as punctuation
'"/"': tags.punctuation
})
]})
```
*/
declare function styleTags(spec: {
[selector: string]: Tag | readonly Tag[];
}): _lezer_common.NodePropSource;
/**
A highlighter defines a mapping from highlighting tags and
language scopes to CSS class names. They are usually defined via
[`tagHighlighter`](#highlight.tagHighlighter) or some wrapper
around that, but it is also possible to implement them from
scratch.
*/
interface Highlighter {
/**
Get the set of classes that should be applied to the given set
of highlighting tags, or null if this highlighter doesn't assign
a style to the tags.
*/
style(tags: readonly Tag[]): string | null;
/**
When given, the highlighter will only be applied to trees on
whose [top](#common.NodeType.isTop) node this predicate returns
true.
*/
scope?(node: NodeType): boolean;
}
/**
Define a [highlighter](#highlight.Highlighter) from an array of
tag/class pairs. Classes associated with more specific tags will
take precedence.
*/
declare function tagHighlighter(tags: readonly {
tag: Tag | readonly Tag[];
class: string;
}[], options?: {
/**
By default, highlighters apply to the entire document. You can
scope them to a single language by providing the tree's
[top](#common.NodeType.isTop) node type here.
*/
scope?: (node: NodeType) => boolean;
/**
Add a style to _all_ tokens. Probably only useful in combination
with `scope`.
*/
all?: string;
}): Highlighter;
/**
Highlight the given [tree](#common.Tree) with the given
[highlighter](#highlight.Highlighter). Often, the higher-level
[`highlightCode`](#highlight.highlightCode) function is easier to
use.
*/
declare function highlightTree(tree: Tree, highlighter: Highlighter | readonly Highlighter[],
/**
Assign styling to a region of the text. Will be called, in order
of position, for any ranges where more than zero classes apply.
`classes` is a space separated string of CSS classes.
*/
putStyle: (from: number, to: number, classes: string) => void,
/**
The start of the range to highlight.
*/
from?: number,
/**
The end of the range.
*/
to?: number): void;
/**
Highlight the given tree with the given highlighter, calling
`putText` for every piece of text, either with a set of classes or
with the empty string when unstyled, and `putBreak` for every line
break.
*/
declare function highlightCode(code: string, tree: Tree, highlighter: Highlighter | readonly Highlighter[], putText: (code: string, classes: string) => void, putBreak: () => void, from?: number, to?: number): void;
/**
Match a syntax node's [highlight rules](#highlight.styleTags). If
there's a match, return its set of tags, and whether it is
opaque (uses a `!`) or applies to all child nodes (`/...`).
*/
declare function getStyleTags(node: SyntaxNodeRef): {
tags: readonly Tag[];
opaque: boolean;
inherit: boolean;
} | null;
/**
The default set of highlighting [tags](#highlight.Tag).
This collection is heavily biased towards programming languages,
and necessarily incomplete. A full ontology of syntactic
constructs would fill a stack of books, and be impractical to
write themes for. So try to make do with this set. If all else
fails, [open an
issue](https://github.com/codemirror/codemirror.next) to propose a
new tag, or [define](#highlight.Tag^define) a local custom tag for
your use case.
Note that it is not obligatory to always attach the most specific
tag possible to an element—if your grammar can't easily
distinguish a certain type of element (such as a local variable),
it is okay to style it as its more general variant (a variable).
For tags that extend some parent tag, the documentation links to
the parent.
*/
declare const tags: {
/**
A comment.
*/
comment: Tag;
/**
A line [comment](#highlight.tags.comment).
*/
lineComment: Tag;
/**
A block [comment](#highlight.tags.comment).
*/
blockComment: Tag;
/**
A documentation [comment](#highlight.tags.comment).
*/
docComment: Tag;
/**
Any kind of identifier.
*/
name: Tag;
/**
The [name](#highlight.tags.name) of a variable.
*/
variableName: Tag;
/**
A type [name](#highlight.tags.name).
*/
typeName: Tag;
/**
A tag name (subtag of [`typeName`](#highlight.tags.typeName)).
*/
tagName: Tag;
/**
A property or field [name](#highlight.tags.name).
*/
propertyName: Tag;
/**
An attribute name (subtag of [`propertyName`](#highlight.tags.propertyName)).
*/
attributeName: Tag;
/**
The [name](#highlight.tags.name) of a class.
*/
className: Tag;
/**
A label [name](#highlight.tags.name).
*/
labelName: Tag;
/**
A namespace [name](#highlight.tags.name).
*/
namespace: Tag;
/**
The [name](#highlight.tags.name) of a macro.
*/
macroName: Tag;
/**
A literal value.
*/
literal: Tag;
/**
A string [literal](#highlight.tags.literal).
*/
string: Tag;
/**
A documentation [string](#highlight.tags.string).
*/
docString: Tag;
/**
A character literal (subtag of [string](#highlight.tags.string)).
*/
character: Tag;
/**
An attribute value (subtag of [string](#highlight.tags.string)).
*/
attributeValue: Tag;
/**
A number [literal](#highlight.tags.literal).
*/
number: Tag;
/**
An integer [number](#highlight.tags.number) literal.
*/
integer: Tag;
/**
A floating-point [number](#highlight.tags.number) literal.
*/
float: Tag;
/**
A boolean [literal](#highlight.tags.literal).
*/
bool: Tag;
/**
Regular expression [literal](#highlight.tags.literal).
*/
regexp: Tag;
/**
An escape [literal](#highlight.tags.literal), for example a
backslash escape in a string.
*/
escape: Tag;
/**
A color [literal](#highlight.tags.literal).
*/
color: Tag;
/**
A URL [literal](#highlight.tags.literal).
*/
url: Tag;
/**
A language keyword.
*/
keyword: Tag;
/**
The [keyword](#highlight.tags.keyword) for the self or this
object.
*/
self: Tag;
/**
The [keyword](#highlight.tags.keyword) for null.
*/
null: Tag;
/**
A [keyword](#highlight.tags.keyword) denoting some atomic value.
*/
atom: Tag;
/**
A [keyword](#highlight.tags.keyword) that represents a unit.
*/
unit: Tag;
/**
A modifier [keyword](#highlight.tags.keyword).
*/
modifier: Tag;
/**
A [keyword](#highlight.tags.keyword) that acts as an operator.
*/
operatorKeyword: Tag;
/**
A control-flow related [keyword](#highlight.tags.keyword).
*/
controlKeyword: Tag;
/**
A [keyword](#highlight.tags.keyword) that defines something.
*/
definitionKeyword: Tag;
/**
A [keyword](#highlight.tags.keyword) related to defining or
interfacing with modules.
*/
moduleKeyword: Tag;
/**
An operator.
*/
operator: Tag;
/**
An [operator](#highlight.tags.operator) that dereferences something.
*/
derefOperator: Tag;
/**
Arithmetic-related [operator](#highlight.tags.operator).
*/
arithmeticOperator: Tag;
/**
Logical [operator](#highlight.tags.operator).
*/
logicOperator: Tag;
/**
Bit [operator](#highlight.tags.operator).
*/
bitwiseOperator: Tag;
/**
Comparison [operator](#highlight.tags.operator).
*/
compareOperator: Tag;
/**
[Operator](#highlight.tags.operator) that updates its operand.
*/
updateOperator: Tag;
/**
[Operator](#highlight.tags.operator) that defines something.
*/
definitionOperator: Tag;
/**
Type-related [operator](#highlight.tags.operator).
*/
typeOperator: Tag;
/**
Control-flow [operator](#highlight.tags.operator).
*/
controlOperator: Tag;
/**
Program or markup punctuation.
*/
punctuation: Tag;
/**
[Punctuation](#highlight.tags.punctuation) that separates
things.
*/
separator: Tag;
/**
Bracket-style [punctuation](#highlight.tags.punctuation).
*/
bracket: Tag;
/**
Angle [brackets](#highlight.tags.bracket) (usually `<` and `>`
tokens).
*/
angleBracket: Tag;
/**
Square [brackets](#highlight.tags.bracket) (usually `[` and `]`
tokens).
*/
squareBracket: Tag;
/**
Parentheses (usually `(` and `)` tokens). Subtag of
[bracket](#highlight.tags.bracket).
*/
paren: Tag;
/**
Braces (usually `{` and `}` tokens). Subtag of
[bracket](#highlight.tags.bracket).
*/
brace: Tag;
/**
Content, for example plain text in XML or markup documents.
*/
content: Tag;
/**
[Content](#highlight.tags.content) that represents a heading.
*/
heading: Tag;
/**
A level 1 [heading](#highlight.tags.heading).
*/
heading1: Tag;
/**
A level 2 [heading](#highlight.tags.heading).
*/
heading2: Tag;
/**
A level 3 [heading](#highlight.tags.heading).
*/
heading3: Tag;
/**
A level 4 [heading](#highlight.tags.heading).
*/
heading4: Tag;
/**
A level 5 [heading](#highlight.tags.heading).
*/
heading5: Tag;
/**
A level 6 [heading](#highlight.tags.heading).
*/
heading6: Tag;
/**
A prose [content](#highlight.tags.content) separator (such as a horizontal rule).
*/
contentSeparator: Tag;
/**
[Content](#highlight.tags.content) that represents a list.
*/
list: Tag;
/**
[Content](#highlight.tags.content) that represents a quote.
*/
quote: Tag;
/**
[Content](#highlight.tags.content) that is emphasized.
*/
emphasis: Tag;
/**
[Content](#highlight.tags.content) that is styled strong.
*/
strong: Tag;
/**
[Content](#highlight.tags.content) that is part of a link.
*/
link: Tag;
/**
[Content](#highlight.tags.content) that is styled as code or
monospace.
*/
monospace: Tag;
/**
[Content](#highlight.tags.content) that has a strike-through
style.
*/
strikethrough: Tag;
/**
Inserted text in a change-tracking format.
*/
inserted: Tag;
/**
Deleted text.
*/
deleted: Tag;
/**
Changed text.
*/
changed: Tag;
/**
An invalid or unsyntactic element.
*/
invalid: Tag;
/**
Metadata or meta-instruction.
*/
meta: Tag;
/**
[Metadata](#highlight.tags.meta) that applies to the entire
document.
*/
documentMeta: Tag;
/**
[Metadata](#highlight.tags.meta) that annotates or adds
attributes to a given syntactic element.
*/
annotation: Tag;
/**
Processing instruction or preprocessor directive. Subtag of
[meta](#highlight.tags.meta).
*/
processingInstruction: Tag;
/**
[Modifier](#highlight.Tag^defineModifier) that indicates that a
given element is being defined. Expected to be used with the
various [name](#highlight.tags.name) tags.
*/
definition: (tag: Tag) => Tag;
/**
[Modifier](#highlight.Tag^defineModifier) that indicates that
something is constant. Mostly expected to be used with
[variable names](#highlight.tags.variableName).
*/
constant: (tag: Tag) => Tag;
/**
[Modifier](#highlight.Tag^defineModifier) used to indicate that
a [variable](#highlight.tags.variableName) or [property
name](#highlight.tags.propertyName) is being called or defined
as a function.
*/
function: (tag: Tag) => Tag;
/**
[Modifier](#highlight.Tag^defineModifier) that can be applied to
[names](#highlight.tags.name) to indicate that they belong to
the language's standard environment.
*/
standard: (tag: Tag) => Tag;
/**
[Modifier](#highlight.Tag^defineModifier) that indicates a given
[names](#highlight.tags.name) is local to some scope.
*/
local: (tag: Tag) => Tag;
/**
A generic variant [modifier](#highlight.Tag^defineModifier) that
can be used to tag language-specific alternative variants of
some common tag. It is recommended for themes to define special
forms of at least the [string](#highlight.tags.string) and
[variable name](#highlight.tags.variableName) tags, since those
come up a lot.
*/
special: (tag: Tag) => Tag;
};
/**
This is a highlighter that adds stable, predictable classes to
tokens, for styling with external CSS.
The following tags are mapped to their name prefixed with `"tok-"`
(for example `"tok-comment"`):
* [`link`](#highlight.tags.link)
* [`heading`](#highlight.tags.heading)
* [`emphasis`](#highlight.tags.emphasis)
* [`strong`](#highlight.tags.strong)
* [`keyword`](#highlight.tags.keyword)
* [`atom`](#highlight.tags.atom)
* [`bool`](#highlight.tags.bool)
* [`url`](#highlight.tags.url)
* [`labelName`](#highlight.tags.labelName)
* [`inserted`](#highlight.tags.inserted)
* [`deleted`](#highlight.tags.deleted)
* [`literal`](#highlight.tags.literal)
* [`string`](#highlight.tags.string)
* [`number`](#highlight.tags.number)
* [`variableName`](#highlight.tags.variableName)
* [`typeName`](#highlight.tags.typeName)
* [`namespace`](#highlight.tags.namespace)
* [`className`](#highlight.tags.className)
* [`macroName`](#highlight.tags.macroName)
* [`propertyName`](#highlight.tags.propertyName)
* [`operator`](#highlight.tags.operator)
* [`comment`](#highlight.tags.comment)
* [`meta`](#highlight.tags.meta)
* [`punctuation`](#highlight.tags.punctuation)
* [`invalid`](#highlight.tags.invalid)
In addition, these mappings are provided:
* [`regexp`](#highlight.tags.regexp),
[`escape`](#highlight.tags.escape), and
[`special`](#highlight.tags.special)[`(string)`](#highlight.tags.string)
are mapped to `"tok-string2"`
* [`special`](#highlight.tags.special)[`(variableName)`](#highlight.tags.variableName)
to `"tok-variableName2"`
* [`local`](#highlight.tags.local)[`(variableName)`](#highlight.tags.variableName)
to `"tok-variableName tok-local"`
* [`definition`](#highlight.tags.definition)[`(variableName)`](#highlight.tags.variableName)
to `"tok-variableName tok-definition"`
* [`definition`](#highlight.tags.definition)[`(propertyName)`](#highlight.tags.propertyName)
to `"tok-propertyName tok-definition"`
*/
declare const classHighlighter: Highlighter;
export { type Highlighter, Tag, classHighlighter, getStyleTags, highlightCode, highlightTree, styleTags, tagHighlighter, tags };

927
frontend/node_modules/@lezer/highlight/dist/index.js generated vendored Normal file
View File

@ -0,0 +1,927 @@
import { NodeProp } from '@lezer/common';
let nextTagID = 0;
/**
Highlighting tags are markers that denote a highlighting category.
They are [associated](#highlight.styleTags) with parts of a syntax
tree by a language mode, and then mapped to an actual CSS style by
a [highlighter](#highlight.Highlighter).
Because syntax tree node types and highlight styles have to be
able to talk the same language, CodeMirror uses a mostly _closed_
[vocabulary](#highlight.tags) of syntax tags (as opposed to
traditional open string-based systems, which make it hard for
highlighting themes to cover all the tokens produced by the
various languages).
It _is_ possible to [define](#highlight.Tag^define) your own
highlighting tags for system-internal use (where you control both
the language package and the highlighter), but such tags will not
be picked up by regular highlighters (though you can derive them
from standard tags to allow highlighters to fall back to those).
*/
class Tag {
/**
@internal
*/
constructor(
/**
The optional name of the base tag @internal
*/
name,
/**
The set of this tag and all its parent tags, starting with
this one itself and sorted in order of decreasing specificity.
*/
set,
/**
The base unmodified tag that this one is based on, if it's
modified @internal
*/
base,
/**
The modifiers applied to this.base @internal
*/
modified) {
this.name = name;
this.set = set;
this.base = base;
this.modified = modified;
/**
@internal
*/
this.id = nextTagID++;
}
toString() {
let { name } = this;
for (let mod of this.modified)
if (mod.name)
name = `${mod.name}(${name})`;
return name;
}
static define(nameOrParent, parent) {
let name = typeof nameOrParent == "string" ? nameOrParent : "?";
if (nameOrParent instanceof Tag)
parent = nameOrParent;
if (parent === null || parent === void 0 ? void 0 : parent.base)
throw new Error("Can not derive from a modified tag");
let tag = new Tag(name, [], null, []);
tag.set.push(tag);
if (parent)
for (let t of parent.set)
tag.set.push(t);
return tag;
}
/**
Define a tag _modifier_, which is a function that, given a tag,
will return a tag that is a subtag of the original. Applying the
same modifier to a twice tag will return the same value (`m1(t1)
== m1(t1)`) and applying multiple modifiers will, regardless or
order, produce the same tag (`m1(m2(t1)) == m2(m1(t1))`).
When multiple modifiers are applied to a given base tag, each
smaller set of modifiers is registered as a parent, so that for
example `m1(m2(m3(t1)))` is a subtype of `m1(m2(t1))`,
`m1(m3(t1)`, and so on.
*/
static defineModifier(name) {
let mod = new Modifier(name);
return (tag) => {
if (tag.modified.indexOf(mod) > -1)
return tag;
return Modifier.get(tag.base || tag, tag.modified.concat(mod).sort((a, b) => a.id - b.id));
};
}
}
let nextModifierID = 0;
class Modifier {
constructor(name) {
this.name = name;
this.instances = [];
this.id = nextModifierID++;
}
static get(base, mods) {
if (!mods.length)
return base;
let exists = mods[0].instances.find(t => t.base == base && sameArray(mods, t.modified));
if (exists)
return exists;
let set = [], tag = new Tag(base.name, set, base, mods);
for (let m of mods)
m.instances.push(tag);
let configs = powerSet(mods);
for (let parent of base.set)
if (!parent.modified.length)
for (let config of configs)
set.push(Modifier.get(parent, config));
return tag;
}
}
function sameArray(a, b) {
return a.length == b.length && a.every((x, i) => x == b[i]);
}
function powerSet(array) {
let sets = [[]];
for (let i = 0; i < array.length; i++) {
for (let j = 0, e = sets.length; j < e; j++) {
sets.push(sets[j].concat(array[i]));
}
}
return sets.sort((a, b) => b.length - a.length);
}
/**
This function is used to add a set of tags to a language syntax
via [`NodeSet.extend`](#common.NodeSet.extend) or
[`LRParser.configure`](#lr.LRParser.configure).
The argument object maps node selectors to [highlighting
tags](#highlight.Tag) or arrays of tags.
Node selectors may hold one or more (space-separated) node paths.
Such a path can be a [node name](#common.NodeType.name), or
multiple node names (or `*` wildcards) separated by slash
characters, as in `"Block/Declaration/VariableName"`. Such a path
matches the final node but only if its direct parent nodes are the
other nodes mentioned. A `*` in such a path matches any parent,
but only a single level—wildcards that match multiple parents
aren't supported, both for efficiency reasons and because Lezer
trees make it rather hard to reason about what they would match.)
A path can be ended with `/...` to indicate that the tag assigned
to the node should also apply to all child nodes, even if they
match their own style (by default, only the innermost style is
used).
When a path ends in `!`, as in `Attribute!`, no further matching
happens for the node's child nodes, and the entire node gets the
given style.
In this notation, node names that contain `/`, `!`, `*`, or `...`
must be quoted as JSON strings.
For example:
```javascript
parser.configure({props: [
styleTags({
// Style Number and BigNumber nodes
"Number BigNumber": tags.number,
// Style Escape nodes whose parent is String
"String/Escape": tags.escape,
// Style anything inside Attributes nodes
"Attributes!": tags.meta,
// Add a style to all content inside Italic nodes
"Italic/...": tags.emphasis,
// Style InvalidString nodes as both `string` and `invalid`
"InvalidString": [tags.string, tags.invalid],
// Style the node named "/" as punctuation
'"/"': tags.punctuation
})
]})
```
*/
function styleTags(spec) {
let byName = Object.create(null);
for (let prop in spec) {
let tags = spec[prop];
if (!Array.isArray(tags))
tags = [tags];
for (let part of prop.split(" "))
if (part) {
let pieces = [], mode = 2 /* Mode.Normal */, rest = part;
for (let pos = 0;;) {
if (rest == "..." && pos > 0 && pos + 3 == part.length) {
mode = 1 /* Mode.Inherit */;
break;
}
let m = /^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(rest);
if (!m)
throw new RangeError("Invalid path: " + part);
pieces.push(m[0] == "*" ? "" : m[0][0] == '"' ? JSON.parse(m[0]) : m[0]);
pos += m[0].length;
if (pos == part.length)
break;
let next = part[pos++];
if (pos == part.length && next == "!") {
mode = 0 /* Mode.Opaque */;
break;
}
if (next != "/")
throw new RangeError("Invalid path: " + part);
rest = part.slice(pos);
}
let last = pieces.length - 1, inner = pieces[last];
if (!inner)
throw new RangeError("Invalid path: " + part);
let rule = new Rule(tags, mode, last > 0 ? pieces.slice(0, last) : null);
byName[inner] = rule.sort(byName[inner]);
}
}
return ruleNodeProp.add(byName);
}
const ruleNodeProp = new NodeProp({
combine(a, b) {
let cur, root, take;
while (a || b) {
if (!a || b && a.depth >= b.depth) {
take = b;
b = b.next;
}
else {
take = a;
a = a.next;
}
if (cur && cur.mode == take.mode && !take.context && !cur.context)
continue;
let copy = new Rule(take.tags, take.mode, take.context);
if (cur)
cur.next = copy;
else
root = copy;
cur = copy;
}
return root;
}
});
class Rule {
constructor(tags, mode, context, next) {
this.tags = tags;
this.mode = mode;
this.context = context;
this.next = next;
}
get opaque() { return this.mode == 0 /* Mode.Opaque */; }
get inherit() { return this.mode == 1 /* Mode.Inherit */; }
sort(other) {
if (!other || other.depth < this.depth) {
this.next = other;
return this;
}
other.next = this.sort(other.next);
return other;
}
get depth() { return this.context ? this.context.length : 0; }
}
Rule.empty = new Rule([], 2 /* Mode.Normal */, null);
/**
Define a [highlighter](#highlight.Highlighter) from an array of
tag/class pairs. Classes associated with more specific tags will
take precedence.
*/
function tagHighlighter(tags, options) {
let map = Object.create(null);
for (let style of tags) {
if (!Array.isArray(style.tag))
map[style.tag.id] = style.class;
else
for (let tag of style.tag)
map[tag.id] = style.class;
}
let { scope, all = null } = options || {};
return {
style: (tags) => {
let cls = all;
for (let tag of tags) {
for (let sub of tag.set) {
let tagClass = map[sub.id];
if (tagClass) {
cls = cls ? cls + " " + tagClass : tagClass;
break;
}
}
}
return cls;
},
scope
};
}
function highlightTags(highlighters, tags) {
let result = null;
for (let highlighter of highlighters) {
let value = highlighter.style(tags);
if (value)
result = result ? result + " " + value : value;
}
return result;
}
/**
Highlight the given [tree](#common.Tree) with the given
[highlighter](#highlight.Highlighter). Often, the higher-level
[`highlightCode`](#highlight.highlightCode) function is easier to
use.
*/
function highlightTree(tree, highlighter,
/**
Assign styling to a region of the text. Will be called, in order
of position, for any ranges where more than zero classes apply.
`classes` is a space separated string of CSS classes.
*/
putStyle,
/**
The start of the range to highlight.
*/
from = 0,
/**
The end of the range.
*/
to = tree.length) {
let builder = new HighlightBuilder(from, Array.isArray(highlighter) ? highlighter : [highlighter], putStyle);
builder.highlightRange(tree.cursor(), from, to, "", builder.highlighters);
builder.flush(to);
}
/**
Highlight the given tree with the given highlighter, calling
`putText` for every piece of text, either with a set of classes or
with the empty string when unstyled, and `putBreak` for every line
break.
*/
function highlightCode(code, tree, highlighter, putText, putBreak, from = 0, to = code.length) {
let pos = from;
function writeTo(p, classes) {
if (p <= pos)
return;
for (let text = code.slice(pos, p), i = 0;;) {
let nextBreak = text.indexOf("\n", i);
let upto = nextBreak < 0 ? text.length : nextBreak;
if (upto > i)
putText(text.slice(i, upto), classes);
if (nextBreak < 0)
break;
putBreak();
i = nextBreak + 1;
}
pos = p;
}
highlightTree(tree, highlighter, (from, to, classes) => {
writeTo(from, "");
writeTo(to, classes);
}, from, to);
writeTo(to, "");
}
class HighlightBuilder {
constructor(at, highlighters, span) {
this.at = at;
this.highlighters = highlighters;
this.span = span;
this.class = "";
}
startSpan(at, cls) {
if (cls != this.class) {
this.flush(at);
if (at > this.at)
this.at = at;
this.class = cls;
}
}
flush(to) {
if (to > this.at && this.class)
this.span(this.at, to, this.class);
}
highlightRange(cursor, from, to, inheritedClass, highlighters) {
let { type, from: start, to: end } = cursor;
if (start >= to || end <= from)
return;
if (type.isTop)
highlighters = this.highlighters.filter(h => !h.scope || h.scope(type));
let cls = inheritedClass;
let rule = getStyleTags(cursor) || Rule.empty;
let tagCls = highlightTags(highlighters, rule.tags);
if (tagCls) {
if (cls)
cls += " ";
cls += tagCls;
if (rule.mode == 1 /* Mode.Inherit */)
inheritedClass += (inheritedClass ? " " : "") + tagCls;
}
this.startSpan(Math.max(from, start), cls);
if (rule.opaque)
return;
let mounted = cursor.tree && cursor.tree.prop(NodeProp.mounted);
if (mounted && mounted.overlay) {
let inner = cursor.node.enter(mounted.overlay[0].from + start, 1);
let innerHighlighters = this.highlighters.filter(h => !h.scope || h.scope(mounted.tree.type));
let hasChild = cursor.firstChild();
for (let i = 0, pos = start;; i++) {
let next = i < mounted.overlay.length ? mounted.overlay[i] : null;
let nextPos = next ? next.from + start : end;
let rangeFrom = Math.max(from, pos), rangeTo = Math.min(to, nextPos);
if (rangeFrom < rangeTo && hasChild) {
while (cursor.from < rangeTo) {
this.highlightRange(cursor, rangeFrom, rangeTo, inheritedClass, highlighters);
this.startSpan(Math.min(rangeTo, cursor.to), cls);
if (cursor.to >= nextPos || !cursor.nextSibling())
break;
}
}
if (!next || nextPos > to)
break;
pos = next.to + start;
if (pos > from) {
this.highlightRange(inner.cursor(), Math.max(from, next.from + start), Math.min(to, pos), "", innerHighlighters);
this.startSpan(Math.min(to, pos), cls);
}
}
if (hasChild)
cursor.parent();
}
else if (cursor.firstChild()) {
if (mounted)
inheritedClass = "";
do {
if (cursor.to <= from)
continue;
if (cursor.from >= to)
break;
this.highlightRange(cursor, from, to, inheritedClass, highlighters);
this.startSpan(Math.min(to, cursor.to), cls);
} while (cursor.nextSibling());
cursor.parent();
}
}
}
/**
Match a syntax node's [highlight rules](#highlight.styleTags). If
there's a match, return its set of tags, and whether it is
opaque (uses a `!`) or applies to all child nodes (`/...`).
*/
function getStyleTags(node) {
let rule = node.type.prop(ruleNodeProp);
while (rule && rule.context && !node.matchContext(rule.context))
rule = rule.next;
return rule || null;
}
const t = Tag.define;
const comment = t(), name = t(), typeName = t(name), propertyName = t(name), literal = t(), string = t(literal), number = t(literal), content = t(), heading = t(content), keyword = t(), operator = t(), punctuation = t(), bracket = t(punctuation), meta = t();
/**
The default set of highlighting [tags](#highlight.Tag).
This collection is heavily biased towards programming languages,
and necessarily incomplete. A full ontology of syntactic
constructs would fill a stack of books, and be impractical to
write themes for. So try to make do with this set. If all else
fails, [open an
issue](https://github.com/codemirror/codemirror.next) to propose a
new tag, or [define](#highlight.Tag^define) a local custom tag for
your use case.
Note that it is not obligatory to always attach the most specific
tag possible to an element—if your grammar can't easily
distinguish a certain type of element (such as a local variable),
it is okay to style it as its more general variant (a variable).
For tags that extend some parent tag, the documentation links to
the parent.
*/
const tags = {
/**
A comment.
*/
comment,
/**
A line [comment](#highlight.tags.comment).
*/
lineComment: t(comment),
/**
A block [comment](#highlight.tags.comment).
*/
blockComment: t(comment),
/**
A documentation [comment](#highlight.tags.comment).
*/
docComment: t(comment),
/**
Any kind of identifier.
*/
name,
/**
The [name](#highlight.tags.name) of a variable.
*/
variableName: t(name),
/**
A type [name](#highlight.tags.name).
*/
typeName: typeName,
/**
A tag name (subtag of [`typeName`](#highlight.tags.typeName)).
*/
tagName: t(typeName),
/**
A property or field [name](#highlight.tags.name).
*/
propertyName: propertyName,
/**
An attribute name (subtag of [`propertyName`](#highlight.tags.propertyName)).
*/
attributeName: t(propertyName),
/**
The [name](#highlight.tags.name) of a class.
*/
className: t(name),
/**
A label [name](#highlight.tags.name).
*/
labelName: t(name),
/**
A namespace [name](#highlight.tags.name).
*/
namespace: t(name),
/**
The [name](#highlight.tags.name) of a macro.
*/
macroName: t(name),
/**
A literal value.
*/
literal,
/**
A string [literal](#highlight.tags.literal).
*/
string,
/**
A documentation [string](#highlight.tags.string).
*/
docString: t(string),
/**
A character literal (subtag of [string](#highlight.tags.string)).
*/
character: t(string),
/**
An attribute value (subtag of [string](#highlight.tags.string)).
*/
attributeValue: t(string),
/**
A number [literal](#highlight.tags.literal).
*/
number,
/**
An integer [number](#highlight.tags.number) literal.
*/
integer: t(number),
/**
A floating-point [number](#highlight.tags.number) literal.
*/
float: t(number),
/**
A boolean [literal](#highlight.tags.literal).
*/
bool: t(literal),
/**
Regular expression [literal](#highlight.tags.literal).
*/
regexp: t(literal),
/**
An escape [literal](#highlight.tags.literal), for example a
backslash escape in a string.
*/
escape: t(literal),
/**
A color [literal](#highlight.tags.literal).
*/
color: t(literal),
/**
A URL [literal](#highlight.tags.literal).
*/
url: t(literal),
/**
A language keyword.
*/
keyword,
/**
The [keyword](#highlight.tags.keyword) for the self or this
object.
*/
self: t(keyword),
/**
The [keyword](#highlight.tags.keyword) for null.
*/
null: t(keyword),
/**
A [keyword](#highlight.tags.keyword) denoting some atomic value.
*/
atom: t(keyword),
/**
A [keyword](#highlight.tags.keyword) that represents a unit.
*/
unit: t(keyword),
/**
A modifier [keyword](#highlight.tags.keyword).
*/
modifier: t(keyword),
/**
A [keyword](#highlight.tags.keyword) that acts as an operator.
*/
operatorKeyword: t(keyword),
/**
A control-flow related [keyword](#highlight.tags.keyword).
*/
controlKeyword: t(keyword),
/**
A [keyword](#highlight.tags.keyword) that defines something.
*/
definitionKeyword: t(keyword),
/**
A [keyword](#highlight.tags.keyword) related to defining or
interfacing with modules.
*/
moduleKeyword: t(keyword),
/**
An operator.
*/
operator,
/**
An [operator](#highlight.tags.operator) that dereferences something.
*/
derefOperator: t(operator),
/**
Arithmetic-related [operator](#highlight.tags.operator).
*/
arithmeticOperator: t(operator),
/**
Logical [operator](#highlight.tags.operator).
*/
logicOperator: t(operator),
/**
Bit [operator](#highlight.tags.operator).
*/
bitwiseOperator: t(operator),
/**
Comparison [operator](#highlight.tags.operator).
*/
compareOperator: t(operator),
/**
[Operator](#highlight.tags.operator) that updates its operand.
*/
updateOperator: t(operator),
/**
[Operator](#highlight.tags.operator) that defines something.
*/
definitionOperator: t(operator),
/**
Type-related [operator](#highlight.tags.operator).
*/
typeOperator: t(operator),
/**
Control-flow [operator](#highlight.tags.operator).
*/
controlOperator: t(operator),
/**
Program or markup punctuation.
*/
punctuation,
/**
[Punctuation](#highlight.tags.punctuation) that separates
things.
*/
separator: t(punctuation),
/**
Bracket-style [punctuation](#highlight.tags.punctuation).
*/
bracket,
/**
Angle [brackets](#highlight.tags.bracket) (usually `<` and `>`
tokens).
*/
angleBracket: t(bracket),
/**
Square [brackets](#highlight.tags.bracket) (usually `[` and `]`
tokens).
*/
squareBracket: t(bracket),
/**
Parentheses (usually `(` and `)` tokens). Subtag of
[bracket](#highlight.tags.bracket).
*/
paren: t(bracket),
/**
Braces (usually `{` and `}` tokens). Subtag of
[bracket](#highlight.tags.bracket).
*/
brace: t(bracket),
/**
Content, for example plain text in XML or markup documents.
*/
content,
/**
[Content](#highlight.tags.content) that represents a heading.
*/
heading,
/**
A level 1 [heading](#highlight.tags.heading).
*/
heading1: t(heading),
/**
A level 2 [heading](#highlight.tags.heading).
*/
heading2: t(heading),
/**
A level 3 [heading](#highlight.tags.heading).
*/
heading3: t(heading),
/**
A level 4 [heading](#highlight.tags.heading).
*/
heading4: t(heading),
/**
A level 5 [heading](#highlight.tags.heading).
*/
heading5: t(heading),
/**
A level 6 [heading](#highlight.tags.heading).
*/
heading6: t(heading),
/**
A prose [content](#highlight.tags.content) separator (such as a horizontal rule).
*/
contentSeparator: t(content),
/**
[Content](#highlight.tags.content) that represents a list.
*/
list: t(content),
/**
[Content](#highlight.tags.content) that represents a quote.
*/
quote: t(content),
/**
[Content](#highlight.tags.content) that is emphasized.
*/
emphasis: t(content),
/**
[Content](#highlight.tags.content) that is styled strong.
*/
strong: t(content),
/**
[Content](#highlight.tags.content) that is part of a link.
*/
link: t(content),
/**
[Content](#highlight.tags.content) that is styled as code or
monospace.
*/
monospace: t(content),
/**
[Content](#highlight.tags.content) that has a strike-through
style.
*/
strikethrough: t(content),
/**
Inserted text in a change-tracking format.
*/
inserted: t(),
/**
Deleted text.
*/
deleted: t(),
/**
Changed text.
*/
changed: t(),
/**
An invalid or unsyntactic element.
*/
invalid: t(),
/**
Metadata or meta-instruction.
*/
meta,
/**
[Metadata](#highlight.tags.meta) that applies to the entire
document.
*/
documentMeta: t(meta),
/**
[Metadata](#highlight.tags.meta) that annotates or adds
attributes to a given syntactic element.
*/
annotation: t(meta),
/**
Processing instruction or preprocessor directive. Subtag of
[meta](#highlight.tags.meta).
*/
processingInstruction: t(meta),
/**
[Modifier](#highlight.Tag^defineModifier) that indicates that a
given element is being defined. Expected to be used with the
various [name](#highlight.tags.name) tags.
*/
definition: Tag.defineModifier("definition"),
/**
[Modifier](#highlight.Tag^defineModifier) that indicates that
something is constant. Mostly expected to be used with
[variable names](#highlight.tags.variableName).
*/
constant: Tag.defineModifier("constant"),
/**
[Modifier](#highlight.Tag^defineModifier) used to indicate that
a [variable](#highlight.tags.variableName) or [property
name](#highlight.tags.propertyName) is being called or defined
as a function.
*/
function: Tag.defineModifier("function"),
/**
[Modifier](#highlight.Tag^defineModifier) that can be applied to
[names](#highlight.tags.name) to indicate that they belong to
the language's standard environment.
*/
standard: Tag.defineModifier("standard"),
/**
[Modifier](#highlight.Tag^defineModifier) that indicates a given
[names](#highlight.tags.name) is local to some scope.
*/
local: Tag.defineModifier("local"),
/**
A generic variant [modifier](#highlight.Tag^defineModifier) that
can be used to tag language-specific alternative variants of
some common tag. It is recommended for themes to define special
forms of at least the [string](#highlight.tags.string) and
[variable name](#highlight.tags.variableName) tags, since those
come up a lot.
*/
special: Tag.defineModifier("special")
};
for (let name in tags) {
let val = tags[name];
if (val instanceof Tag)
val.name = name;
}
/**
This is a highlighter that adds stable, predictable classes to
tokens, for styling with external CSS.
The following tags are mapped to their name prefixed with `"tok-"`
(for example `"tok-comment"`):
* [`link`](#highlight.tags.link)
* [`heading`](#highlight.tags.heading)
* [`emphasis`](#highlight.tags.emphasis)
* [`strong`](#highlight.tags.strong)
* [`keyword`](#highlight.tags.keyword)
* [`atom`](#highlight.tags.atom)
* [`bool`](#highlight.tags.bool)
* [`url`](#highlight.tags.url)
* [`labelName`](#highlight.tags.labelName)
* [`inserted`](#highlight.tags.inserted)
* [`deleted`](#highlight.tags.deleted)
* [`literal`](#highlight.tags.literal)
* [`string`](#highlight.tags.string)
* [`number`](#highlight.tags.number)
* [`variableName`](#highlight.tags.variableName)
* [`typeName`](#highlight.tags.typeName)
* [`namespace`](#highlight.tags.namespace)
* [`className`](#highlight.tags.className)
* [`macroName`](#highlight.tags.macroName)
* [`propertyName`](#highlight.tags.propertyName)
* [`operator`](#highlight.tags.operator)
* [`comment`](#highlight.tags.comment)
* [`meta`](#highlight.tags.meta)
* [`punctuation`](#highlight.tags.punctuation)
* [`invalid`](#highlight.tags.invalid)
In addition, these mappings are provided:
* [`regexp`](#highlight.tags.regexp),
[`escape`](#highlight.tags.escape), and
[`special`](#highlight.tags.special)[`(string)`](#highlight.tags.string)
are mapped to `"tok-string2"`
* [`special`](#highlight.tags.special)[`(variableName)`](#highlight.tags.variableName)
to `"tok-variableName2"`
* [`local`](#highlight.tags.local)[`(variableName)`](#highlight.tags.variableName)
to `"tok-variableName tok-local"`
* [`definition`](#highlight.tags.definition)[`(variableName)`](#highlight.tags.variableName)
to `"tok-variableName tok-definition"`
* [`definition`](#highlight.tags.definition)[`(propertyName)`](#highlight.tags.propertyName)
to `"tok-propertyName tok-definition"`
*/
const classHighlighter = tagHighlighter([
{ tag: tags.link, class: "tok-link" },
{ tag: tags.heading, class: "tok-heading" },
{ tag: tags.emphasis, class: "tok-emphasis" },
{ tag: tags.strong, class: "tok-strong" },
{ tag: tags.keyword, class: "tok-keyword" },
{ tag: tags.atom, class: "tok-atom" },
{ tag: tags.bool, class: "tok-bool" },
{ tag: tags.url, class: "tok-url" },
{ tag: tags.labelName, class: "tok-labelName" },
{ tag: tags.inserted, class: "tok-inserted" },
{ tag: tags.deleted, class: "tok-deleted" },
{ tag: tags.literal, class: "tok-literal" },
{ tag: tags.string, class: "tok-string" },
{ tag: tags.number, class: "tok-number" },
{ tag: [tags.regexp, tags.escape, tags.special(tags.string)], class: "tok-string2" },
{ tag: tags.variableName, class: "tok-variableName" },
{ tag: tags.local(tags.variableName), class: "tok-variableName tok-local" },
{ tag: tags.definition(tags.variableName), class: "tok-variableName tok-definition" },
{ tag: tags.special(tags.variableName), class: "tok-variableName2" },
{ tag: tags.definition(tags.propertyName), class: "tok-propertyName tok-definition" },
{ tag: tags.typeName, class: "tok-typeName" },
{ tag: tags.namespace, class: "tok-namespace" },
{ tag: tags.className, class: "tok-className" },
{ tag: tags.macroName, class: "tok-macroName" },
{ tag: tags.propertyName, class: "tok-propertyName" },
{ tag: tags.operator, class: "tok-operator" },
{ tag: tags.comment, class: "tok-comment" },
{ tag: tags.meta, class: "tok-meta" },
{ tag: tags.invalid, class: "tok-invalid" },
{ tag: tags.punctuation, class: "tok-punctuation" }
]);
export { Tag, classHighlighter, getStyleTags, highlightCode, highlightTree, styleTags, tagHighlighter, tags };

31
frontend/node_modules/@lezer/highlight/package.json generated vendored Normal file
View File

@ -0,0 +1,31 @@
{
"name": "@lezer/highlight",
"version": "1.2.3",
"description": "Highlighting system for Lezer parse trees",
"main": "dist/index.cjs",
"type": "module",
"exports": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"module": "dist/index.js",
"types": "dist/index.d.ts",
"author": "Marijn Haverbeke <marijn@haverbeke.berlin>",
"license": "MIT",
"devDependencies": {
"@marijn/buildtool": "0.1.3",
"typescript": "^5.0.0"
},
"dependencies": {
"@lezer/common": "^1.3.0"
},
"files": ["dist"],
"repository": {
"type" : "git",
"url" : "https://github.com/lezer-parser/highlight.git"
},
"scripts": {
"watch": "node build.js --watch",
"prepare": "node build.js"
}
}

297
frontend/node_modules/@lezer/html/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,297 @@
## 1.3.12 (2025-09-26)
### Bug fixes
Emit tokens for `<` characters without tag name, so that autocompletion can work with them.
## 1.3.11 (2025-09-25)
### Bug fixes
Don't parse `<` followed by whitespace as the start of a tag.
## 1.3.10 (2024-05-29)
### Bug fixes
Fix an issue that broke attribute reading when defining a nested language on a tag that isn't a `style`, `textearea`, or `script` tag.
## 1.3.9 (2024-02-21)
### Bug fixes
When using the "selfClosing" dialect, fix parse errors for `<br/>` (tags that implicitly self-close) and `<script/>` (special tags).
## 1.3.8 (2023-12-28)
### Bug fixes
Add `bidiIsolate` node props for tags, comments, and attributes.
Mark tags, attributes, and comments as isolating for bidirectional text.
## 1.3.7 (2023-11-23)
### Bug fixes
Fix a bug that caused the parser to not properly recognize empty HTML comments. Don't emit nested parses for empty elements in configureNesting
Fix an issue where `configureNesting` could emit empty overlay ranges for empty elements.
## 1.3.6 (2023-07-12)
### Bug fixes
Improve parsing of multiple unfinished opening tags by disallowing less-than characters in attribute names.
## 1.3.5 (2023-07-03)
### Bug fixes
Make the package work with new TS resolution styles.
## 1.3.4 (2023-03-27)
### Bug fixes
Fix a bug that caused mixed parsing of non-style/script elements to attach the nested parse tree to the incorrect node.
## 1.3.3 (2023-02-21)
### Bug fixes
Make sure build output is strictly ES6 again.
## 1.3.2 (2023-02-16)
### Bug fixes
Fix a crash caused by nexted parsing of attributes returning invalid ranges for attributes missing their closing quote.
## 1.3.1 (2023-02-11)
### Bug fixes
Always allow self-closing tags in `<svg>` and `<math>` tags.
## 1.3.0 (2022-12-16)
### New features
`configureNesting` now supports targeting tags other than `style`, `script`, and `textarea`.
## 1.2.0 (2022-11-25)
### New features
`configureNesting` now takes a second argument that can be used to specify that the value of some attributes should be parsed with an external parser.
## 1.1.1 (2022-11-18)
### Bug fixes
Align allowed characters in unquoted attribute values with the spec. Replace another unicode escape with a character
## 1.1.0 (2022-11-16)
### Bug fixes
Allow more characters in attribute names, following HTML spec.
### New features
The new `"selfClosing"` dialect allows `/>` syntax to be used to create self-closing tags.
## 1.0.1 (2022-07-27)
### Bug fixes
Continue parsing when an invalid entity reference appears in an attribute value.
## 1.0.0 (2022-06-06)
### New features
First stable version.
## 0.16.1 (2022-05-16)
### Bug fixes
Fix a bug where comment end tokens preceded by dashes were sometimes not recognized.
## 0.16.0 (2022-04-20)
### Breaking changes
Move to 0.16 serialized parser format.
### New features
The parser now includes syntax highlighting information in its node types.
## 0.15.1 (2022-02-16)
### Bug fixes
Make sure the tree for unfinished self-closing tags shows them as self-closing.
## 0.15.0 (2021-08-11)
### Breaking changes
The module's name changed from `lezer-html` to `@lezer/html`.
Upgrade to the 0.15.0 lezer interfaces.
## 0.13.6 (2021-06-16)
### Bug fixes
Add a rule for invalid `&` syntax to avoid error-recovery around stray ampersands.
## 0.13.5 (2021-05-05)
### Bug fixes
Fix a problem where like attributes inappropriately included trailing whitespace.
## 0.13.4 (2021-03-10)
### Bug fixes
Strip quotes from attribute values passed to `attrs` predicates in `configureNesting`.
## 0.13.3 (2021-02-17)
### Bug fixes
Optimize the tokenizer by using a context tracker.
## 0.13.2 (2021-01-22)
### Bug fixes
Make comments consist of multiple tokens, so that huge comments don't freeze the parser.
## 0.13.1 (2020-12-04)
### Bug fixes
Fix versions of lezer packages depended on.
## 0.13.0 (2020-12-04)
### Breaking changes
The nested parser configuration utility is now called `configureNesting`, and returns an object to pass to `Parser.configure`'s `nested` option instead of a new parser.
### New features
The parser can now be given a "noMatch" dialect to not mark mismatched tags.
## 0.12.0 (2020-10-23)
### Breaking changes
Adjust to changed serialized parser format.
### New features
The parser now more effectively matches close and open tags, even in the presence of mismatched tags.
## 0.11.1 (2020-09-26)
### Bug fixes
Fix lezer depencency versions
## 0.11.0 (2020-09-26)
### Breaking changes
Follow change in serialized parser format.
## 0.10.0 (2020-08-07)
### Breaking changes
Upgrade to 0.10 parser serialization
## 0.9.0 (2020-06-08)
### Breaking changes
Upgrade to 0.9 parser serialization
### New features
Tag start/end tokens now have `NodeProp.openedBy`/`closedBy` props.
## 0.8.4 (2020-04-09)
### Bug fixes
Regenerate parser with a fix in lezer-generator so that the top node prop is properly assigned.
## 0.8.3 (2020-04-01)
### Bug fixes
Make the package load as an ES module on node
## 0.8.2 (2020-02-28)
### New features
Provide an ES module file.
## 0.8.1 (2020-02-26)
### Bug fixes
Adds support for single-quoted attribute values.
Don't treat /> tag ends as self-closing, just ignore them instead.
## 0.8.0 (2020-02-03)
### New features
Follow 0.8.0 release of the library.
## 0.7.0 (2020-01-20)
### Breaking changes
Use the lezer 0.7.0 parser format.
## 0.5.2 (2020-01-15)
### Bug fixes
Allow whitespace between the `<` and `/` in a close tag.
## 0.5.1 (2019-10-22)
### Bug fixes
Fix top prop missing from build output.
## 0.5.0 (2019-10-22)
### Breaking changes
Move from `lang` to `top` prop on document node.
## 0.4.0 (2019-09-10)
### Breaking changes
Adjust to 0.4.0 parse table format.
## 0.3.0 (2019-08-22)
### New features
First numbered release.

21
frontend/node_modules/@lezer/html/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
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.

37
frontend/node_modules/@lezer/html/README.md generated vendored Normal file
View File

@ -0,0 +1,37 @@
# @lezer/html
This is an HTML grammar for the
[lezer](https://lezer.codemirror.net/) parser system.
The code is licensed under an MIT license.
## Interface
This package exports two bindings:
**`parser`**`: Parser`
The parser instance for the basic HTML grammar. Supports two dialects:
- `"noMatch"` turns off tag matching, creating regular syntax nodes
even for mismatched tags.
- `"selfClosing"` adds support for `/>` self-closing tag syntax.
**`configureNesting`**`(tags?: {`\
`  tag: string,`\
`  attrs?: (attrs: {[attr: string]: string}) => boolean,`\
`  parser: Parser,`\
`}[], attributes?: {`\
`  name: string,`\
`  tagName?: string,`\
`  parser: Parser,`\
`}[]): ParseWrapper`
Create a nested parser config object which overrides the way the
content of some tags or attributes is parsed. Each tag override is an
object with a `tag` property holding the (lower case) tag name to
override, and an optional `attrs` predicate that, if given, has to
return true for the tag's attributes for this override to apply.
The `parser` property describes the way the tag's content is parsed.

354
frontend/node_modules/@lezer/html/dist/index.cjs generated vendored Normal file

File diff suppressed because one or more lines are too long

14
frontend/node_modules/@lezer/html/dist/index.d.cts generated vendored Normal file
View File

@ -0,0 +1,14 @@
import {LRParser} from "@lezer/lr"
import {Input, PartialParse, Parser, TreeCursor, ParseWrapper} from "@lezer/common"
export const parser: LRParser
export function configureNesting(tags?: readonly {
tag: string,
attrs?: (attrs: {[attr: string]: string}) => boolean,
parser: Parser
}[], attributes?: {
name: string,
tagName?: string,
parser: Parser
}[]): ParseWrapper

14
frontend/node_modules/@lezer/html/dist/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,14 @@
import {LRParser} from "@lezer/lr"
import {Input, PartialParse, Parser, TreeCursor, ParseWrapper} from "@lezer/common"
export const parser: LRParser
export function configureNesting(tags?: readonly {
tag: string,
attrs?: (attrs: {[attr: string]: string}) => boolean,
parser: Parser
}[], attributes?: {
name: string,
tagName?: string,
parser: Parser
}[]): ParseWrapper

349
frontend/node_modules/@lezer/html/dist/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

37
frontend/node_modules/@lezer/html/package.json generated vendored Normal file
View File

@ -0,0 +1,37 @@
{
"name": "@lezer/html",
"version": "1.3.12",
"description": "lezer-based HTML grammar",
"main": "dist/index.cjs",
"type": "module",
"exports": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"module": "dist/index.js",
"types": "dist/index.d.ts",
"author": "Marijn Haverbeke <marijn@haverbeke.berlin>",
"license": "MIT",
"devDependencies": {
"@lezer/javascript": "^1.0.0",
"@lezer/generator": "^1.0.0",
"mocha": "^10.2.0",
"rollup": "^2.52.2",
"@rollup/plugin-node-resolve": "^9.0.0"
},
"dependencies": {
"@lezer/lr": "^1.0.0",
"@lezer/highlight": "^1.0.0",
"@lezer/common": "^1.2.0"
},
"repository": {
"type" : "git",
"url" : "https://github.com/lezer-parser/html.git"
},
"scripts": {
"build": "lezer-generator src/html.grammar -o src/parser && rollup -c",
"build-debug": "lezer-generator src/html.grammar --names -o src/parser && rollup -c",
"prepare": "npm run build",
"test": "mocha test/test-*.js"
}
}

16
frontend/node_modules/@lezer/html/rollup.config.js generated vendored Normal file
View File

@ -0,0 +1,16 @@
import {nodeResolve} from "@rollup/plugin-node-resolve"
export default {
input: "./src/index.js",
output: [{
format: "cjs",
file: "./dist/index.cjs"
}, {
format: "es",
file: "./dist/index.js"
}],
external(id) { return !/^[\.\/]/.test(id) },
plugins: [
nodeResolve()
]
}

87
frontend/node_modules/@lezer/html/src/content.js generated vendored Normal file
View File

@ -0,0 +1,87 @@
import {ScriptText, StyleText, TextareaText,
Element, TagName, Attribute, AttributeName, OpenTag, CloseTag,
AttributeValue, UnquotedAttributeValue} from "./parser.terms.js"
import {parseMixed} from "@lezer/common"
function getAttrs(openTag, input) {
let attrs = Object.create(null)
for (let att of openTag.getChildren(Attribute)) {
let name = att.getChild(AttributeName), value = att.getChild(AttributeValue) || att.getChild(UnquotedAttributeValue)
if (name) attrs[input.read(name.from, name.to)] =
!value ? "" : value.type.id == AttributeValue ? input.read(value.from + 1, value.to - 1) : input.read(value.from, value.to)
}
return attrs
}
function findTagName(openTag, input) {
let tagNameNode = openTag.getChild(TagName)
return tagNameNode ? input.read(tagNameNode.from, tagNameNode.to) : " "
}
function maybeNest(node, input, tags) {
let attrs
for (let tag of tags) {
if (!tag.attrs || tag.attrs(attrs || (attrs = getAttrs(node.node.parent.firstChild, input))))
return {parser: tag.parser}
}
return null
}
// tags?: {
// tag: string,
// attrs?: ({[attr: string]: string}) => boolean,
// parser: Parser
// }[]
// attributes?: {
// name: string,
// tagName?: string,
// parser: Parser
// }[]
export function configureNesting(tags = [], attributes = []) {
let script = [], style = [], textarea = [], other = []
for (let tag of tags) {
let array = tag.tag == "script" ? script : tag.tag == "style" ? style : tag.tag == "textarea" ? textarea : other
array.push(tag)
}
let attrs = attributes.length ? Object.create(null) : null
for (let attr of attributes) (attrs[attr.name] || (attrs[attr.name] = [])).push(attr)
return parseMixed((node, input) => {
let id = node.type.id
if (id == ScriptText) return maybeNest(node, input, script)
if (id == StyleText) return maybeNest(node, input, style)
if (id == TextareaText) return maybeNest(node, input, textarea)
if (id == Element && other.length) {
let n = node.node, open = n.firstChild, tagName = open && findTagName(open, input), attrs
if (tagName) for (let tag of other) {
if (tag.tag == tagName && (!tag.attrs || tag.attrs(attrs || (attrs = getAttrs(open, input))))) {
let close = n.lastChild
let to = close.type.id == CloseTag ? close.from : n.to
if (to > open.to)
return {parser: tag.parser, overlay: [{from: open.to, to}]}
}
}
}
if (attrs && id == Attribute) {
let n = node.node, nameNode
if (nameNode = n.firstChild) {
let matches = attrs[input.read(nameNode.from, nameNode.to)]
if (matches) for (let attr of matches) {
if (attr.tagName && attr.tagName != findTagName(n.parent, input)) continue
let value = n.lastChild
if (value.type.id == AttributeValue) {
let from = value.from + 1
let last = value.lastChild, to = value.to - (last && last.isError ? 0 : 1)
if (to > from) return {parser: attr.parser, overlay: [{from, to}]}
} else if (value.type.id == UnquotedAttributeValue) {
return {parser: attr.parser, overlay: [{from: value.from, to: value.to}]}
}
}
}
}
return null
})
}

15
frontend/node_modules/@lezer/html/src/highlight.js generated vendored Normal file
View File

@ -0,0 +1,15 @@
import {styleTags, tags as t} from "@lezer/highlight"
export const htmlHighlighting = styleTags({
"Text RawText IncompleteTag IncompleteCloseTag": t.content,
"StartTag StartCloseTag SelfClosingEndTag EndTag": t.angleBracket,
TagName: t.tagName,
"MismatchedCloseTag/TagName": [t.tagName, t.invalid],
AttributeName: t.attributeName,
"AttributeValue UnquotedAttributeValue": t.attributeValue,
Is: t.definitionOperator,
"EntityReference CharacterReference": t.character,
Comment: t.blockComment,
ProcessingInst: t.processingInstruction,
DoctypeDecl: t.documentMeta
})

181
frontend/node_modules/@lezer/html/src/html.grammar generated vendored Normal file
View File

@ -0,0 +1,181 @@
@top Document { (entity | DoctypeDecl)+ }
@dialects { noMatch, selfClosing }
entity[@isGroup=Entity] {
Text |
EntityReference |
CharacterReference |
InvalidEntity |
Element |
Comment |
ProcessingInst |
IncompleteTag |
IncompleteCloseTag |
MismatchedCloseTag |
NoMatchCloseTag
}
Element {
OpenScriptTag ScriptText (CloseScriptTag | missingCloseTag) |
OpenStyleTag StyleText (CloseStyleTag | missingCloseTag) |
OpenTextareaTag TextareaText (CloseTextareaTag | missingCloseTag) |
OpenTag entity* (CloseTag | missingCloseTag) |
SelfClosingTag
}
ScriptText[group="TextContent Entity"] { scriptText* }
StyleText[group="TextContent Entity"] { styleText* }
TextareaText[group="TextContent Entity"] { textareaText* }
@skip { space } {
OpenTag[closedBy=CloseTag,isolate=ltr] {
StartTag TagName Attribute* EndTag
}
SelfClosingTag[isolate=ltr] {
StartSelfClosingTag TagName Attribute* (EndTag | SelfClosingEndTag) |
(StartTag | StartScriptTag | StartStyleTag | StartTextareaTag) TagName Attribute* SelfClosingEndTag
}
MismatchedCloseTag[isolate=ltr] {
MismatchedStartCloseTag TagName EndTag
}
NoMatchCloseTag[@name=CloseTag,isolate=ltr] {
NoMatchStartCloseTag TagName EndTag
}
CloseTag[openedBy=OpenTag,isolate=ltr] {
StartCloseTag TagName EndTag
}
OpenScriptTag[@name=OpenTag,closedBy=CloseTag,isolate=ltr] {
StartScriptTag TagName Attribute* EndTag
}
CloseScriptTag[@name=CloseTag,openedBy=OpenTag,isolate=ltr] {
StartCloseScriptTag TagName EndTag
}
OpenStyleTag[@name=OpenTag,closedBy=CloseTag,isolate=ltr] {
StartStyleTag TagName Attribute* EndTag
}
CloseStyleTag[@name=CloseTag,openedBy=OpenTag,isolate=ltr] {
StartCloseStyleTag TagName EndTag
}
OpenTextareaTag[@name=OpenTag,closedBy=CloseTag,isolate=ltr] {
StartTextareaTag TagName Attribute* EndTag
}
CloseTextareaTag[@name=CloseTag,openedBy=OpenTag,isolate=ltr] {
StartCloseTextareaTag TagName EndTag
}
Attribute {
AttributeName (Is (AttributeValue | UnquotedAttributeValue))?
}
}
AttributeValue[isolate] {
"\"" (attributeContentDouble | EntityReference | CharacterReference | InvalidEntity)* "\"" |
"\'" (attributeContentSingle | EntityReference | CharacterReference | InvalidEntity)* "\'"
}
Comment[isolate] { commentStart commentContent* commentEnd }
@context elementContext from "./tokens.js"
@external tokens scriptTokens from "./tokens.js" {
scriptText
StartCloseScriptTag[@name=StartCloseTag,closedBy=EndTag]
}
@external tokens styleTokens from "./tokens.js" {
styleText
StartCloseStyleTag[@name=StartCloseTag,closedBy=EndTag]
}
@external tokens textareaTokens from "./tokens.js" {
textareaText
StartCloseTextareaTag[@name=StartCloseTag,closedBy=EndTag]
}
@external tokens endTag from "./tokens.js" {
EndTag[openedBy="StartTag StartCloseTag"]
SelfClosingEndTag[openedBy=StartTag,@dialect=selfClosing]
}
@external tokens tagStart from "./tokens.js" {
StartTag[closedBy="EndTag SelfClosingEndTag"],
StartScriptTag[@name=StartTag,closedBy=EndTag],
StartStyleTag[@name=StartTag,closedBy=EndTag],
StartTextareaTag[@name=StartTag,closedBy=EndTag],
StartSelfClosingTag[@name=StartTag,closedBy=EndTag],
StartCloseTag[closedBy=EndTag],
NoMatchStartCloseTag[@name=StartCloseTag,closedBy=EndTag]
MismatchedStartCloseTag[@name=StartCloseTag,closedBy=EndTag],
missingCloseTag,
IncompleteTag,
IncompleteCloseTag
}
@external tokens commentContent from "./tokens.js" {
commentContent
}
@tokens {
nameStart {
":" | @asciiLetter | "_" |
$[\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D] |
$[\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]
}
nameChar {
nameStart | "-" | "." | @digit | $[\u00B7\u0300-\u036F\u203F-\u2040]
}
identifier { nameStart nameChar* }
TagName { identifier }
AttributeName { ![\u0000-\u0020\u007F-\u009F"'<>/=\uFDD0-\uFDEF\uFFFE\uFFFF]+ }
UnquotedAttributeValue[isolate] { ![ \t\n\r\u000C=<>"'`]+ }
attributeContentDouble { !["&]+ }
attributeContentSingle { !['&]+ }
Is { "=" }
EntityReference { "&" ![#; ]+ ";" }
CharacterReference { "&#" ![; ]+ ";" }
InvalidEntity { "&" }
@precedence { CharacterReference, EntityReference, InvalidEntity }
Text[group=TextContent] { ![<&]+ }
commentStart { "<!--" }
commentEnd { "-->" }
ProcessingInst { "<?" piContent }
piContent { ![?] piContent | "?" piQuestion }
piQuestion { ![>] piContent | ">" }
DoctypeDecl { "<!" ("doctype" | "DOCTYPE") ![>]* ">" }
@precedence { commentStart, ProcessingInst, DoctypeDecl }
space { (" " | "\t" | "\r" | "\n")+ }
}
@external propSource htmlHighlighting from "./highlight"

2
frontend/node_modules/@lezer/html/src/index.js generated vendored Normal file
View File

@ -0,0 +1,2 @@
export {parser} from "./parser"
export {configureNesting} from "./content"

27
frontend/node_modules/@lezer/html/src/parser.js generated vendored Normal file

File diff suppressed because one or more lines are too long

53
frontend/node_modules/@lezer/html/src/parser.terms.js generated vendored Normal file
View File

@ -0,0 +1,53 @@
// This file was generated by lezer-generator. You probably shouldn't edit it.
export const
scriptText = 55,
StartCloseScriptTag = 1,
styleText = 56,
StartCloseStyleTag = 2,
textareaText = 57,
StartCloseTextareaTag = 3,
EndTag = 4,
SelfClosingEndTag = 5,
StartTag = 6,
StartScriptTag = 7,
StartStyleTag = 8,
StartTextareaTag = 9,
StartSelfClosingTag = 10,
StartCloseTag = 11,
NoMatchStartCloseTag = 12,
MismatchedStartCloseTag = 13,
missingCloseTag = 58,
IncompleteTag = 14,
IncompleteCloseTag = 15,
commentContent = 59,
Document = 16,
Text = 17,
EntityReference = 18,
CharacterReference = 19,
InvalidEntity = 20,
Element = 21,
OpenScriptTag = 22,
TagName = 23,
Attribute = 24,
AttributeName = 25,
Is = 26,
AttributeValue = 27,
UnquotedAttributeValue = 28,
ScriptText = 29,
CloseScriptTag = 30,
OpenStyleTag = 31,
StyleText = 32,
CloseStyleTag = 33,
OpenTextareaTag = 34,
TextareaText = 35,
CloseTextareaTag = 36,
OpenTag = 37,
CloseTag = 38,
SelfClosingTag = 39,
Comment = 40,
ProcessingInst = 41,
MismatchedCloseTag = 42,
NoMatchCloseTag = 43,
DoctypeDecl = 44,
Dialect_noMatch = 0,
Dialect_selfClosing = 1

199
frontend/node_modules/@lezer/html/src/tokens.js generated vendored Normal file
View File

@ -0,0 +1,199 @@
/* Hand-written tokenizers for HTML. */
import {ExternalTokenizer, ContextTracker} from "@lezer/lr"
import {StartTag, StartCloseTag, NoMatchStartCloseTag, MismatchedStartCloseTag, missingCloseTag,
StartSelfClosingTag, IncompleteCloseTag, Element, OpenTag, IncompleteTag,
StartScriptTag, scriptText, StartCloseScriptTag,
StartStyleTag, styleText, StartCloseStyleTag,
StartTextareaTag, textareaText, StartCloseTextareaTag,
Dialect_noMatch, Dialect_selfClosing, EndTag, SelfClosingEndTag,
commentContent as cmntContent} from "./parser.terms.js"
const selfClosers = {
area: true, base: true, br: true, col: true, command: true,
embed: true, frame: true, hr: true, img: true, input: true,
keygen: true, link: true, meta: true, param: true, source: true,
track: true, wbr: true, menuitem: true
}
const implicitlyClosed = {
dd: true, li: true, optgroup: true, option: true, p: true,
rp: true, rt: true, tbody: true, td: true, tfoot: true,
th: true, tr: true
}
const closeOnOpen = {
dd: {dd: true, dt: true},
dt: {dd: true, dt: true},
li: {li: true},
option: {option: true, optgroup: true},
optgroup: {optgroup: true},
p: {
address: true, article: true, aside: true, blockquote: true, dir: true,
div: true, dl: true, fieldset: true, footer: true, form: true,
h1: true, h2: true, h3: true, h4: true, h5: true, h6: true,
header: true, hgroup: true, hr: true, menu: true, nav: true, ol: true,
p: true, pre: true, section: true, table: true, ul: true
},
rp: {rp: true, rt: true},
rt: {rp: true, rt: true},
tbody: {tbody: true, tfoot: true},
td: {td: true, th: true},
tfoot: {tbody: true},
th: {td: true, th: true},
thead: {tbody: true, tfoot: true},
tr: {tr: true}
}
function nameChar(ch) {
return ch == 45 || ch == 46 || ch == 58 || ch >= 65 && ch <= 90 || ch == 95 || ch >= 97 && ch <= 122 || ch >= 161
}
function isSpace(ch) {
return ch == 9 || ch == 10 || ch == 13 || ch == 32
}
let cachedName = null, cachedInput = null, cachedPos = 0
function tagNameAfter(input, offset) {
let pos = input.pos + offset
if (cachedPos == pos && cachedInput == input) return cachedName
let next = input.peek(offset), name = ""
for (;;) {
if (!nameChar(next)) break
name += String.fromCharCode(next)
next = input.peek(++offset)
}
// Undefined to signal there's a <? or <!, null for just missing
cachedInput = input; cachedPos = pos
return cachedName = name ? name.toLowerCase() : next == question || next == bang ? undefined : null
}
const lessThan = 60, greaterThan = 62, slash = 47, question = 63, bang = 33, dash = 45
function ElementContext(name, parent) {
this.name = name
this.parent = parent
}
const startTagTerms = [StartTag, StartSelfClosingTag, StartScriptTag, StartStyleTag, StartTextareaTag]
export const elementContext = new ContextTracker({
start: null,
shift(context, term, stack, input) {
return startTagTerms.indexOf(term) > -1 ? new ElementContext(tagNameAfter(input, 1) || "", context) : context
},
reduce(context, term) {
return term == Element && context ? context.parent : context
},
reuse(context, node, stack, input) {
let type = node.type.id
return type == StartTag || type == OpenTag
? new ElementContext(tagNameAfter(input, 1) || "", context) : context
},
strict: false
})
export const tagStart = new ExternalTokenizer((input, stack) => {
if (input.next != lessThan) {
// End of file, close any open tags
if (input.next < 0 && stack.context) input.acceptToken(missingCloseTag)
return
}
input.advance()
let close = input.next == slash
if (close) input.advance()
let name = tagNameAfter(input, 0)
if (name === undefined) return
if (!name) return input.acceptToken(close ? IncompleteCloseTag : IncompleteTag)
let parent = stack.context ? stack.context.name : null
if (close) {
if (name == parent) return input.acceptToken(StartCloseTag)
if (parent && implicitlyClosed[parent]) return input.acceptToken(missingCloseTag, -2)
if (stack.dialectEnabled(Dialect_noMatch)) return input.acceptToken(NoMatchStartCloseTag)
for (let cx = stack.context; cx; cx = cx.parent) if (cx.name == name) return
input.acceptToken(MismatchedStartCloseTag)
} else {
if (name == "script") return input.acceptToken(StartScriptTag)
if (name == "style") return input.acceptToken(StartStyleTag)
if (name == "textarea") return input.acceptToken(StartTextareaTag)
if (selfClosers.hasOwnProperty(name)) return input.acceptToken(StartSelfClosingTag)
if (parent && closeOnOpen[parent] && closeOnOpen[parent][name]) input.acceptToken(missingCloseTag, -1)
else input.acceptToken(StartTag)
}
}, {contextual: true})
export const commentContent = new ExternalTokenizer(input => {
for (let dashes = 0, i = 0;; i++) {
if (input.next < 0) {
if (i) input.acceptToken(cmntContent)
break
}
if (input.next == dash) {
dashes++
} else if (input.next == greaterThan && dashes >= 2) {
if (i >= 3) input.acceptToken(cmntContent, -2)
break
} else {
dashes = 0
}
input.advance()
}
})
function inForeignElement(context) {
for (; context; context = context.parent)
if (context.name == "svg" || context.name == "math") return true
return false
}
export const endTag = new ExternalTokenizer((input, stack) => {
if (input.next == slash && input.peek(1) == greaterThan) {
let selfClosing = stack.dialectEnabled(Dialect_selfClosing) || inForeignElement(stack.context)
input.acceptToken(selfClosing ? SelfClosingEndTag : EndTag, 2)
} else if (input.next == greaterThan) {
input.acceptToken(EndTag, 1)
}
})
function contentTokenizer(tag, textToken, endToken) {
let lastState = 2 + tag.length
return new ExternalTokenizer(input => {
// state means:
// - 0 nothing matched
// - 1 '<' matched
// - 2 '</'
// - 3-(1+tag.length) part of the tag matched
// - lastState whole tag + possibly whitespace matched
for (let state = 0, matchedLen = 0, i = 0;; i++) {
if (input.next < 0) {
if (i) input.acceptToken(textToken)
break
}
if (state == 0 && input.next == lessThan ||
state == 1 && input.next == slash ||
state >= 2 && state < lastState && input.next == tag.charCodeAt(state - 2)) {
state++
matchedLen++
} else if (state == lastState && input.next == greaterThan) {
if (i > matchedLen)
input.acceptToken(textToken, -matchedLen)
else
input.acceptToken(endToken, -(matchedLen - 2))
break
} else if ((input.next == 10 /* '\n' */ || input.next == 13 /* '\r' */) && i) {
input.acceptToken(textToken, 1)
break
} else {
state = matchedLen = 0
}
input.advance()
}
})
}
export const scriptTokens = contentTokenizer("script", scriptText, StartCloseScriptTag)
export const styleTokens = contentTokenizer("style", styleText, StartCloseStyleTag)
export const textareaTokens = contentTokenizer("textarea", textareaText, StartCloseTextareaTag)

69
frontend/node_modules/@lezer/html/test/mixed.txt generated vendored Normal file
View File

@ -0,0 +1,69 @@
# Doesn't parse VB as JS
<script type="text/visualbasic">let something = 20</script>
==>
Document(Element(OpenTag(StartTag,TagName,Attribute(AttributeName,Is,AttributeValue),EndTag),
ScriptText,
CloseTag(StartCloseTag,TagName,EndTag)))
# Does parse type-less script tags as JS
<script>/foo/</script>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),
Script(ExpressionStatement(RegExp)),
CloseTag(StartCloseTag,TagName,EndTag)))
# Still doesn't end script tags on closing tags
<script type=something></foo></script>
==>
Document(Element(OpenTag(StartTag,TagName,Attribute(AttributeName,Is,UnquotedAttributeValue),EndTag),
ScriptText,
CloseTag(StartCloseTag,TagName,EndTag)))
# Missing end tag
<html><script>null
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),
Element(OpenTag(StartTag,TagName,EndTag),
Script(ExpressionStatement(null)))))
# JS with script type
<script type="text/javascript">console.log(2)</script>
==>
Document(Element(OpenTag(StartTag,TagName,Attribute(AttributeName,Is,AttributeValue),EndTag),
Script(...),
CloseTag(StartCloseTag,TagName,EndTag)))
# JS with unquoted script type
<script type=module>console.log(2)</script>
==>
Document(Element(OpenTag(StartTag,TagName,Attribute(AttributeName,Is,UnquotedAttributeValue),EndTag),
Script(...),
CloseTag(StartCloseTag,TagName,EndTag)))
# Error in JS
<script>a b</script>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),
Script(...),
CloseTag(StartCloseTag,TagName,EndTag)))

370
frontend/node_modules/@lezer/html/test/tags.txt generated vendored Normal file
View File

@ -0,0 +1,370 @@
# Regular tag
<foo>bar</foo>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),Text,CloseTag(StartCloseTag,TagName,EndTag)))
# Nested tag
<a><b>c</b><br></a>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),
Element(OpenTag(StartTag,TagName,EndTag),Text,CloseTag(StartCloseTag,TagName,EndTag)),
Element(SelfClosingTag(StartTag,TagName,EndTag)),
CloseTag(StartCloseTag,TagName,EndTag)))
# Attribute
<br foo="bar">
==>
Document(Element(SelfClosingTag(StartTag,TagName,Attribute(AttributeName,Is,AttributeValue),EndTag)))
# Multiple attributes
<a x="one" y="two" z="three"></a>
==>
Document(Element(OpenTag(StartTag,TagName,
Attribute(AttributeName,Is,AttributeValue),
Attribute(AttributeName,Is,AttributeValue),
Attribute(AttributeName,Is,AttributeValue),EndTag),
CloseTag(StartCloseTag,TagName,EndTag)))
# Value-less attributes
<a x y="one" z></a>
==>
Document(Element(OpenTag(StartTag,TagName,
Attribute(AttributeName),
Attribute(AttributeName,Is,AttributeValue),
Attribute(AttributeName),EndTag),
CloseTag(StartCloseTag,TagName,EndTag)))
# Unquoted attributes
<a x=one y z=two></a>
==>
Document(Element(OpenTag(StartTag,TagName,
Attribute(AttributeName,Is,UnquotedAttributeValue),
Attribute(AttributeName),
Attribute(AttributeName,Is,UnquotedAttributeValue),EndTag),
CloseTag(StartCloseTag,TagName,EndTag)))
# Unquoted attributes with slashes
<link as=font crossorigin=anonymous href=/fonts/google-sans/regular/latin.woff2 rel=preload>
==>
Document(Element(SelfClosingTag(StartTag,TagName,
Attribute(AttributeName,Is,UnquotedAttributeValue),
Attribute(AttributeName,Is,UnquotedAttributeValue),
Attribute(AttributeName,Is,UnquotedAttributeValue),
Attribute(AttributeName,Is,UnquotedAttributeValue),
EndTag)))
# Single-quoted attributes
<link x='one' z='two&amp;'>
==>
Document(Element(SelfClosingTag(StartTag, TagName,
Attribute(AttributeName, Is, AttributeValue),
Attribute(AttributeName, Is, AttributeValue(EntityReference)),
EndTag)))
# Entities
<a attr="one&amp;two">&amp;&#67;</a>
==>
Document(Element(OpenTag(StartTag,TagName,
Attribute(AttributeName,Is,AttributeValue(EntityReference)),EndTag),
EntityReference,CharacterReference,
CloseTag(StartCloseTag,TagName,EndTag)))
# Doctype
<!doctype html>
<doc></doc>
==>
Document(DoctypeDecl,Text,Element(OpenTag(StartTag,TagName,EndTag),CloseTag(StartCloseTag,TagName,EndTag)))
# Processing instructions
<?foo?><bar><?baz?></bar>
==>
Document(ProcessingInst,Element(OpenTag(StartTag,TagName,EndTag),ProcessingInst,CloseTag(StartCloseTag,TagName,EndTag)))
# Comments
<!-- top comment -->
<element><!-- inner comment --> text</element>
<!---->
<!--
-->
==>
Document(Comment,Text,Element(OpenTag(StartTag,TagName,EndTag),Comment,Text,CloseTag(StartCloseTag,TagName,EndTag)),Text,Comment,Text,Comment)
# Mismatched tag
<a></b>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),MismatchedCloseTag(StartCloseTag,TagName,EndTag)))
# Unclosed tag
<a>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag)))
# Ignore pseudo-xml self-closers
<br/>
==>
Document(Element(SelfClosingTag(StartTag,TagName,EndTag)))
# Unclosed implicitly closed tag
<p>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag)))
# Nested mismatched tag
<a><b><c></c></x></a>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),
Element(OpenTag(StartTag,TagName,EndTag),
Element(OpenTag(StartTag,TagName,EndTag),CloseTag(StartCloseTag,TagName,EndTag)),
MismatchedCloseTag(StartCloseTag,TagName,EndTag),
⚠),
CloseTag(StartCloseTag,TagName,EndTag)))
# Incomplete close tag
<html><body></</html>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),
Element(OpenTag(StartTag,TagName,EndTag), IncompleteCloseTag, ⚠),
CloseTag(StartCloseTag,TagName,EndTag)))
# Re-synchronize close tags
<a><b><c></x></c></a>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),
Element(OpenTag(StartTag,TagName,EndTag),
Element(OpenTag(StartTag,TagName,EndTag),
MismatchedCloseTag(StartCloseTag,TagName,EndTag),
CloseTag(StartCloseTag,TagName,EndTag)),
⚠),
CloseTag(StartCloseTag,TagName,EndTag)))
# Top-level mismatched close tag
<a></a></a>
==>
Document(
Element(OpenTag(StartTag,TagName,EndTag),CloseTag(StartCloseTag,TagName,EndTag)),
MismatchedCloseTag(StartCloseTag,TagName,EndTag))
# Self-closing tags
<a><img src=blah></a>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),
Element(SelfClosingTag(StartTag,TagName,Attribute(AttributeName,Is,UnquotedAttributeValue),EndTag)),
CloseTag(StartCloseTag,TagName,EndTag)))
# Implicitly closed
<dl><dd>Hello</dl>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),
Element(OpenTag(StartTag,TagName,EndTag),Text),
CloseTag(StartCloseTag,TagName,EndTag)))
# Closed by sibling
<div>
<p>Foo
<p>Bar
</div>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),
Text,
Element(OpenTag(StartTag,TagName,EndTag),Text),
Element(OpenTag(StartTag,TagName,EndTag),Text),
CloseTag(StartCloseTag,TagName,EndTag)))
# Closed by sibling at top
<p>Foo
<p>Bar
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),Text),Element(OpenTag(StartTag,TagName,EndTag),Text))
# Textarea
<p>Enter something: <textarea code-lang=javascript>function foo() {
return "</bar>"
}</textarea>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),
Text,
Element(OpenTag(StartTag,TagName,Attribute(AttributeName,Is,UnquotedAttributeValue),EndTag),
TextareaText,
CloseTag(StartCloseTag,TagName,EndTag))))
# Script
<script>This is not an entity: &lt;</script>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),ScriptText,CloseTag(StartCloseTag,TagName,EndTag)))
# Doesn't get confused by a stray ampersand
<html>a&b</html>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),Text,InvalidEntity,Text,CloseTag(StartCloseTag,TagName,EndTag)))
# Can ignore mismatches {"dialect": "noMatch"}
<div>foo</p>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),Text,CloseTag(StartCloseTag,TagName,EndTag)))
# Can handle lone close tags {"dialect": "noMatch"}
</strong>
==>
Document(CloseTag(StartCloseTag,TagName,EndTag))
# Parses ampersands in attributes
<img src="foo&bar">
==>
Document(Element(SelfClosingTag(StartTag, TagName, Attribute(AttributeName, Is, AttributeValue(InvalidEntity)), EndTag)))
# Supports self-closing dialect {"dialect": "selfClosing"}
<section><image id=i2 /></section>
==>
Document(Element(
OpenTag(StartTag,TagName,EndTag),
Element(SelfClosingTag(StartTag,TagName,Attribute(AttributeName,Is,UnquotedAttributeValue),SelfClosingEndTag)),
CloseTag(StartCloseTag,TagName,EndTag)))
# Allows self-closing in foreign elements
<div><svg><circle/></svg></div>
==>
Document(Element(OpenTag(StartTag,TagName,EndTag),
Element(OpenTag(StartTag,TagName,EndTag),
Element(SelfClosingTag(StartTag,TagName,SelfClosingEndTag)),
CloseTag(StartCloseTag,TagName,EndTag)),
CloseTag(StartCloseTag,TagName,EndTag)))
# Parses multiple unfinished tags in a row
<div
<div
<div
==>
Document(Element(OpenTag(StartTag,TagName,⚠),
Element(OpenTag(StartTag,TagName,⚠),
Element(OpenTag(StartTag,TagName,⚠),⚠),⚠),⚠))
# Allows self-closing on special tags {"dialect": "selfClosing"}
<body>
<br/>
<textarea/>
<script/>
<style/>
</body>
==>
Document(Element(
OpenTag(StartTag,TagName,EndTag),
Text,
Element(SelfClosingTag(StartTag,TagName,SelfClosingEndTag)),
Text,
Element(SelfClosingTag(StartTag,TagName,SelfClosingEndTag)),
Text,
Element(SelfClosingTag(StartTag,TagName,SelfClosingEndTag)),
Text,
Element(SelfClosingTag(StartTag,TagName,SelfClosingEndTag)),
Text,
CloseTag(StartCloseTag,TagName,EndTag)))
# Only treats less-than as opening a tag when followed by a name
< div>x
==>
Document(IncompleteTag,Text)

29
frontend/node_modules/@lezer/html/test/test-html.js generated vendored Normal file
View File

@ -0,0 +1,29 @@
import {parser, configureNesting} from "../dist/index.js"
import {parser as jsParser} from "@lezer/javascript"
import {fileTests} from "@lezer/generator/dist/test"
import * as fs from "fs"
import * as path from "path"
import {fileURLToPath} from "url"
let caseDir = path.dirname(fileURLToPath(import.meta.url))
let mixed = parser.configure({
wrap: configureNesting([{
tag: "script",
attrs(attrs) {
return !attrs.type || /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(attrs.type)
},
parser: jsParser
}])
})
for (let file of fs.readdirSync(caseDir)) {
if (!/\.txt$/.test(file)) continue
let name = /^[^\.]*/.exec(file)[0]
describe(name, () => {
let p = name == "mixed" ? mixed : parser
for (let {name, run} of fileTests(fs.readFileSync(path.join(caseDir, file), "utf8"), file))
it(name, () => run(p))
})
}

View File

@ -0,0 +1,97 @@
import {parser as baseParser} from "../dist/index.js"
import {TreeFragment} from "@lezer/common"
let parser = baseParser.configure({bufferLength: 2})
let r = n => Math.floor(Math.random() * n)
let tags = ["p", "ul", "li", "div", "span", "th", "tr", "body", "head", "title", "dd", "code", "em", "strong"]
function randomDoc(size) {
let doc = ""
if (!r(5)) doc += "<!doctype html>"
let scope = []
for (let i = 0; i < size; i++) {
let sel = r(20)
if (sel < 5) {
let tag = tags[r(tags.length)]
doc += `<${tag}${r(2) ? " a=b" : ""}>`
scope.push(tag)
} else if (sel < 10 && scope.length) {
let name = scope.pop()
doc += `</${r(5) ? name : "div"}>`
} else if (sel == 10) {
doc += `<img>`
} else if (sel == 11) {
doc += "<script>a()</script>"
} else if (sel == 12) {
doc += r(2) ? "&amp;" : "<!--@-->"
} else {
for (let i = r(6) + 1; i >= 0; i--)
doc += String.fromCharCode(97 + r(26))
}
}
while (scope.length) {
let name = scope.pop()
if (r(5)) doc += `</${name}>`
}
return doc
}
function check(doc, [tp, pos, txt], prevAST) {
let change = {fromA: pos, toA: pos, fromB: pos, toB: pos}, newDoc
if (tp == "insert") {
newDoc = doc.slice(0, pos) + txt + doc.slice(pos)
change.toA += txt.length
} else if (tp == "del") {
newDoc = doc.slice(0, pos) + doc.slice(pos + 1)
change.toB++
} else {
newDoc = doc.slice(0, pos) + txt + doc.slice(pos + 1)
change.toA += txt.length
change.toB++
}
let fragments = TreeFragment.applyChanges(TreeFragment.addTree(prevAST || parser.parse(doc)), [change], 2)
let ast = parser.parse(newDoc, fragments)
let orig = parser.parse(newDoc)
if (ast.toString() != orig.toString()) {
throw new Error(`Mismatch:\n ${ast}\nvs\n ${orig}\ndocument: ${
JSON.stringify(doc)}\naction: ${JSON.stringify([tp, pos, ch])}`)
}
return [newDoc, ast]
}
// Call this to just run random tests until a failing one is found.
// Not directly called in the tests because there's a bunch of
// circumstances in which uninteresting deviations in error recovery
// will create differing parses, so results have to be manually
// inspected.
function generate() {
for (let count = 0, size = 2;; size = Math.min(40, size + 1)) {
let doc = randomDoc(size), prev = null
for (let i = 0; i < 2; i++) {
console.log("Attempt", ++count)
let action = [["del", "insert", "replace"][r(3)], r(doc.length - 1), "<>/piabc "[r(9)]]
;([doc, prev] = check(doc, action, prev))
}
}
}
describe("Incremental parsing", () => {
it("doesn't get confused by reused opening tags", () => {
check("<code><code>mgnbni</code></code>", ["del", 29])
})
it("can handle a renamed opening tag after a self-closing", () => {
check("<p>one two three four five six seven<p>eight", ["replace", 37, "a"])
})
it("is okay with nameless elements", () => {
check("<body><code><img></code><>body>", ["replace", 14, ">"])
check("abcde<>fghij<", ["replace", 12, ">"])
})
it("doesn't get confused by an invalid close tag receiving a matching open tag", () => {
check("<div><p>foo</body>", ["insert", 0, "<body>"])
})
})

56
frontend/node_modules/@lezer/html/test/vue.txt generated vendored Normal file
View File

@ -0,0 +1,56 @@
# Parses Vue builtin directives
<span v-text="msg"></span>
==>
Document(
Element(
OpenTag(StartTag, TagName, Attribute(AttributeName, Is, AttributeValue), EndTag),
CloseTag(StartCloseTag, TagName, EndTag)))
# Parses Vue :is shorthand syntax
<Component :is="view"></Component>
==>
Document(
Element(
OpenTag(StartTag, TagName, Attribute(AttributeName, Is, AttributeValue),EndTag),
CloseTag(StartCloseTag, TagName, EndTag)))
# Parses Vue @click shorthand syntax
<button @click="handler()">Click me</button>
==>
Document(
Element(
OpenTag(StartTag, TagName, Attribute(AttributeName, Is, AttributeValue), EndTag),
Text,
CloseTag(StartCloseTag, TagName, EndTag)))
# Parses Vue @submit.prevent shorthand syntax
<form @submit.prevent="onSubmit"></form>
==>
Document(
Element(
OpenTag(StartTag, TagName, Attribute(AttributeName, Is, AttributeValue), EndTag),
CloseTag(StartCloseTag, TagName, EndTag)))
# Parses Vue Dynamic Arguments
<a v-bind:[attributeName]="url">Link</a>
==>
Document(
Element(
OpenTag(StartTag, TagName, Attribute(AttributeName, Is, AttributeValue), EndTag),
Text,
CloseTag(StartCloseTag, TagName, EndTag)))

485
frontend/node_modules/@lezer/javascript/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,485 @@
## 1.5.4 (2025-09-18)
### Bug fixes
Support `this` parameters in function types.
## 1.5.3 (2025-09-09)
### Bug fixes
Fix missing highlight tag for `defer` contextual keyword.
## 1.5.2 (2025-09-04)
### Bug fixes
Allow `const` casts with old angle-bracket cast syntax.
Add support for `import defer` syntax.
## 1.5.1 (2025-04-18)
### Bug fixes
Properly highlight `satisfies` as a keyword.
## 1.5.0 (2025-04-17)
### Bug fixes
Support `in`/`out` modifiers on TypeScript type parameters.
### New features
Support the TypeScript `satisfies` operator.
## 1.4.21 (2024-12-03)
### Bug fixes
Add support for `const` modifiers on TypeScript type parameters.
Allow TypeScript syntax, where the condition is just a variable.
Fix a bug where some TypeScript `<` tokens didn't appear in the syntax tree.
## 1.4.20 (2024-12-02)
### Bug fixes
Use the `className` style tag for variable names used as constructors with `new`.
Add support for `asserts` syntax in function return types.
## 1.4.19 (2024-10-08)
### Bug fixes
Support question marks after method names in TypeScript object type notation.
Support bracketed property names in TypeScript object types.
Allow TypeScript interface declarations to extend multiple types.
## 1.4.18 (2024-09-17)
### Bug fixes
Support `as` syntax in mapped object types.
Make sure the parser doesn't get confused when a template interpolation is missing its expression.
## 1.4.17 (2024-06-11)
### Bug fixes
Add support for `{-readonly [K in T]-?: U}` TypeScript syntax.
## 1.4.16 (2024-05-04)
### Bug fixes
Don't consume `?.` tokens when followed by a digit.
Support type arguments on non-call expressions.
## 1.4.15 (2024-04-23)
### Bug fixes
Add support for `new.target` syntax.
## 1.4.14 (2024-03-30)
### Bug fixes
Recognize the `d` and `v` RegExp flags. Support destructured parameters in function types
Allow destructured parameters in function signature types.
## 1.4.13 (2024-01-16)
### Bug fixes
Fix inverted relative precedence of `&`, `|`, and `^` bitwise operators.
Add an explicit dependency on @lezer/common ^1.2.0.
## 1.4.12 (2024-01-04)
### Bug fixes
Mark strings, comments, and interpolations as isolating for bidirectional text.
## 1.4.11 (2023-12-18)
### Bug fixes
In TSX mode, parse `<T,>` or `<T extends U>` as type parameters, not JSX tags.
## 1.4.10 (2023-12-06)
### Bug fixes
Support `|` and `&` as prefixes in TypeScript types.
## 1.4.9 (2023-10-30)
### Bug fixes
Allow `default` to be used in `import`/`export` binding sets.
## 1.4.8 (2023-10-05)
### Bug fixes
Properly highlight `using` as a keyword.
## 1.4.7 (2023-08-23)
### Bug fixes
Properly parse hashbang comments.
## 1.4.6 (2023-08-22)
### Bug fixes
Make sure that, in TypeScript, type argument lists are prefered over comparison operators when both produce valid parses.
## 1.4.5 (2023-07-25)
### Bug fixes
Allow the index in a TypeScript indexed type to be any kind of type.
## 1.4.4 (2023-07-03)
### Bug fixes
Add support for `using` syntax.
Make the package work with new TS resolution styles.
## 1.4.3 (2023-04-24)
### Bug fixes
Properly parse `this: Type` within parameter lists for TypeScript.
## 1.4.2 (2023-03-29)
### Bug fixes
Properly parse `declare` in front of class properties and methods in TypeScript.
## 1.4.1 (2023-01-09)
### Bug fixes
Fix a bug where something like `yield [1]` (or `await`) was parsed as a member expression.
Add support for `yield*` syntax.
Escapes in strings are now parsed as their own tokens (and styled with the `escape` tag).
## 1.4.0 (2022-12-19)
### New features
The new `"SingleClassItem"` top-level rule can be used to parse only a class item (method, property, or static block).
## 1.3.2 (2022-12-14)
### Bug fixes
Typescript allows `override` on all class elements, not just methods.
Allow expressions in class extends clauses in TypeScript.
## 1.3.1 (2022-11-29)
### Bug fixes
Actually emit a tree node for the `@` characters in decorators.
## 1.3.0 (2022-11-28)
### New features
Add support for decorator syntax.
## 1.2.0 (2022-11-24)
### New features
The grammar now supports `top: "SingleExpression"` to parse an expression rather than a script.
## 1.1.1 (2022-11-19)
### Bug fixes
Fix parsing of computed properties in class declarations.
## 1.1.0 (2022-11-17)
### Bug fixes
Fix parsing of 'null' as type in TypeScript.
Allow computed properties in object destructuring patterns.
Add TypeScript 4.9's `satisfies` operator.
Support `accessor` syntax on class properties.
### New features
Add support for optional call syntax.
Distinguish lower-case JSX element names syntactically, give them a `standard(tagName)` highlight tag.
## 1.0.2 (2022-07-21)
### Bug fixes
Properly assign a highlighting tag to the `super` keyword.
## 1.0.1 (2022-06-27)
### Bug fixes
Fix parsing of TypeScript conditional types.
Support type parameters in TypeScript function type syntax.
## 1.0.0 (2022-06-06)
### New features
First stable version.
## 0.16.0 (2022-04-20)
### Breaking changes
Move to 0.16 serialized parser format.
### Bug fixes
Allow commas as separators in TypeScript object type syntax.
### New features
Add `CatchClause` and `FinallyClause` nodes wrapping parts of `TryStatement`.
The parser now includes syntax highlighting information in its node types.
## 0.15.3 (2022-01-26)
### Bug fixes
Support missing values in array pattern syntax.
Support quoted module export names.
### New features
Template string interpolations now get their own nodes in the syntax tree.
## 0.15.2 (2021-12-08)
### Bug fixes
Fix a typo in the `TaggedTemplateExpression` node name. Support n suffixes after non-decimal integers
Add support for non-decimal bignum literals ().
Add support for static class initialization blocks.
## 0.15.1 (2021-11-12)
### Bug fixes
Add support for TypeScript `import {type X} from y` syntax.
Indexed TypeScript types can now take type parameters.
Add support for private field syntax.
Rename PropertyNameDefinition node to PropertyDefinition for consistency with other names.
### New features
Recognize TypeScript 4.3's `override` keyword.
## 0.15.0 (2021-08-11)
### Breaking changes
The module's name changed from `lezer-javascript` to `@lezer/javascript`.
Upgrade to the 0.15.0 lezer interfaces.
## 0.13.4 (2021-04-30)
### Bug fixes
Fixes a bug where arrow functions with expression bodies would include commas after the expression.
## 0.13.3 (2021-02-15)
### Bug fixes
Wrap escaped JSX attribute values in a `JSXEscape` node.
## 0.13.2 (2021-01-18)
### Bug fixes
Fix parsing of async function expressions.
## 0.13.1 (2020-12-04)
### Bug fixes
Fix versions of lezer packages depended on.
## 0.13.0 (2020-12-04)
## 0.12.0 (2020-10-23)
### Breaking changes
Adjust to changed serialized parser format.
## 0.11.1 (2020-09-26)
### Bug fixes
Fix lezer depencency versions
## 0.11.0 (2020-09-26)
### Breaking changes
Follow change in serialized parser format.
## 0.10.1 (2020-09-02)
### Bug fixes
Fix associativity of `else` and ternary operators.
Work around accidental ambiguity of TypeScript method and constructor signatures.
Properly parse `??=` as an update operator.
## 0.10.0 (2020-08-07)
### Breaking changes
Upgrade to 0.10 parser serialization
### New features
The gammar now supports TypeScript (use the `"ts"` dialect).
The grammar can now parse JSX syntax (use the `"jsx"` dialect).
## 0.9.1 (2020-06-29)
### Bug fixes
Fix accidental use of non-ES5 library methods.
## 0.9.0 (2020-06-08)
### Breaking changes
Upgrade to 0.9 parser serialization
## 0.8.4 (2020-05-30)
### Bug fixes
Fix the package.json `main` field pointing at the wrong file, breaking the library in node versions older than 13.
## 0.8.3 (2020-04-09)
### Bug fixes
Regenerate parser with a fix in lezer-generator so that the top node prop is properly assigned.
## 0.8.2 (2020-04-01)
### Bug fixes
Make the package load as an ES module on node
## 0.8.1 (2020-02-28)
### New features
Provide an ES module file.
## 0.8.0 (2020-02-03)
### Bug fixes
Add support for the spread ... operator in array literals.
### New features
Follow 0.8.0 release of the library.
Add support for nullish coalescing and optional chaining.
## 0.7.0 (2020-01-20)
### Breaking changes
Use the lezer 0.7.0 parser format.
## 0.5.2 (2020-01-15)
### Bug fixes
Regenerate with lezer-generator 0.5.2 to avoid cyclic forced reductions.
## 0.5.1 (2019-10-22)
### Bug fixes
Fix top prop missing from build output.
## 0.5.0 (2019-10-22)
### Breaking changes
Move from `lang` to `top` prop on document node.
## 0.4.0 (2019-09-10)
### Breaking changes
Adjust to 0.4.0 parse table format.
## 0.3.0 (2019-08-22)
### New features
Go back to node names, add props, follow changes in grammar syntax.
## 0.2.0 (2019-08-02)
### New features
Use tags rather than names.
## 0.1.0 (2019-07-09)
### New Features
First documented release.

21
frontend/node_modules/@lezer/javascript/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
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.

14
frontend/node_modules/@lezer/javascript/README.md generated vendored Normal file
View File

@ -0,0 +1,14 @@
# @lezer/javascript
This is a JavaScript grammar for the
[lezer](https://lezer.codemirror.net/) parser system.
It parses modern JavaScript, and supports a `"ts"`
[dialect](https://lezer.codemirror.net/docs/guide/#dialects) to parse
TypeScript, and a `"jsx"` dialect to parse JSX.
The `top` option can be set to `"SingleExpression"` or
`"SingleClassItem"` to parse an expression or class item instead of a
full program.
The code is licensed under an MIT license.

196
frontend/node_modules/@lezer/javascript/dist/index.cjs generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
import {LRParser} from "@lezer/lr"
export const parser: LRParser

View File

@ -0,0 +1,3 @@
import {LRParser} from "@lezer/lr"
export const parser: LRParser

192
frontend/node_modules/@lezer/javascript/dist/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

36
frontend/node_modules/@lezer/javascript/package.json generated vendored Normal file
View File

@ -0,0 +1,36 @@
{
"name": "@lezer/javascript",
"version": "1.5.4",
"description": "lezer-based JavaScript grammar",
"main": "dist/index.cjs",
"type": "module",
"exports": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"module": "dist/index.js",
"types": "dist/index.d.ts",
"author": "Marijn Haverbeke <marijn@haverbeke.berlin>",
"license": "MIT",
"devDependencies": {
"@lezer/generator": "^1.7.0",
"mocha": "^10.2.0",
"rollup": "^2.52.2",
"@rollup/plugin-node-resolve": "^9.0.0"
},
"dependencies": {
"@lezer/lr": "^1.3.0",
"@lezer/common": "^1.2.0",
"@lezer/highlight": "^1.1.3"
},
"repository": {
"type": "git",
"url": "https://github.com/lezer-parser/javascript.git"
},
"scripts": {
"build": "lezer-generator src/javascript.grammar -o src/parser && rollup -c",
"build-debug": "lezer-generator src/javascript.grammar --names -o src/parser && rollup -c",
"prepare": "npm run build",
"test": "mocha test/test-*.js"
}
}

View File

@ -0,0 +1,16 @@
import {nodeResolve} from "@rollup/plugin-node-resolve"
export default {
input: "./src/parser.js",
output: [{
format: "cjs",
file: "./dist/index.cjs"
}, {
format: "es",
file: "./dist/index.js"
}],
external(id) { return !/^[\.\/]/.test(id) },
plugins: [
nodeResolve()
]
}

View File

@ -0,0 +1,62 @@
import {styleTags, tags as t} from "@lezer/highlight"
export const jsHighlight = styleTags({
"get set async static": t.modifier,
"for while do if else switch try catch finally return throw break continue default case defer": t.controlKeyword,
"in of await yield void typeof delete instanceof as satisfies": t.operatorKeyword,
"let var const using function class extends": t.definitionKeyword,
"import export from": t.moduleKeyword,
"with debugger new": t.keyword,
TemplateString: t.special(t.string),
super: t.atom,
BooleanLiteral: t.bool,
this: t.self,
null: t.null,
Star: t.modifier,
VariableName: t.variableName,
"CallExpression/VariableName TaggedTemplateExpression/VariableName": t.function(t.variableName),
VariableDefinition: t.definition(t.variableName),
Label: t.labelName,
PropertyName: t.propertyName,
PrivatePropertyName: t.special(t.propertyName),
"CallExpression/MemberExpression/PropertyName": t.function(t.propertyName),
"FunctionDeclaration/VariableDefinition": t.function(t.definition(t.variableName)),
"ClassDeclaration/VariableDefinition": t.definition(t.className),
"NewExpression/VariableName": t.className,
PropertyDefinition: t.definition(t.propertyName),
PrivatePropertyDefinition: t.definition(t.special(t.propertyName)),
UpdateOp: t.updateOperator,
"LineComment Hashbang": t.lineComment,
BlockComment: t.blockComment,
Number: t.number,
String: t.string,
Escape: t.escape,
ArithOp: t.arithmeticOperator,
LogicOp: t.logicOperator,
BitOp: t.bitwiseOperator,
CompareOp: t.compareOperator,
RegExp: t.regexp,
Equals: t.definitionOperator,
Arrow: t.function(t.punctuation),
": Spread": t.punctuation,
"( )": t.paren,
"[ ]": t.squareBracket,
"{ }": t.brace,
"InterpolationStart InterpolationEnd": t.special(t.brace),
".": t.derefOperator,
", ;": t.separator,
"@": t.meta,
TypeName: t.typeName,
TypeDefinition: t.definition(t.typeName),
"type enum interface implements namespace module declare": t.definitionKeyword,
"abstract global Privacy readonly override": t.modifier,
"is keyof unique infer asserts": t.operatorKeyword,
JSXAttributeValue: t.attributeValue,
JSXText: t.content,
"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag": t.angleBracket,
"JSXIdentifier JSXNameSpacedName": t.tagName,
"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName": t.attributeName,
"JSXBuiltin/JSXIdentifier": t.standard(t.tagName)
})

View File

@ -0,0 +1,735 @@
@dialects { jsx, ts }
@precedence {
typeargs,
typeMember,
typePrefix,
intersectionPrefixed @left,
intersection @left,
unionPrefixed @left,
union @left,
typeExtends @right,
else @right,
member,
readonly,
newArgs,
call,
instantiate,
taggedTemplate,
prefix,
postfix,
typeof,
exp @left,
times @left,
plus @left,
shift @left,
loop,
rel @left,
satisfies,
equal @left,
bitAnd @left,
bitXor @left,
bitOr @left,
and @left,
or @left,
ternary @right,
assign @right,
comma @left,
statement @cut,
predicate
}
@top Script { Hashbang? statement* }
@top SingleExpression { expression }
@top SingleClassItem { classItem }
statement[@isGroup=Statement] {
ExportDeclaration |
ImportDeclaration |
ForStatement { kw<"for"> ckw<"await">? (ForSpec | ForInSpec | ForOfSpec) statement } |
WhileStatement { kw<"while"> ParenthesizedExpression statement } |
WithStatement { kw<"with"> ParenthesizedExpression statement } |
DoStatement { kw<"do"> statement kw<"while"> ParenthesizedExpression semi } |
IfStatement { kw<"if"> ParenthesizedExpression statement (!else kw<"else"> statement)? } |
SwitchStatement { kw<"switch"> ParenthesizedExpression SwitchBody { "{" switchItem* "}" } } |
TryStatement {
kw<"try"> Block
CatchClause { kw<"catch"> ("(" pattern ")")? Block }?
FinallyClause { kw<"finally"> Block }?
} |
ReturnStatement { kw<"return"> (noSemi expression)? semi } |
ThrowStatement { kw<"throw"> expression semi } |
BreakStatement { kw<"break"> (noSemi Label)? semi } |
ContinueStatement { kw<"continue"> (noSemi Label)? semi } |
DebuggerStatement { kw<"debugger"> semi } |
Block |
LabeledStatement { Label ":" statement } |
declaration |
ExpressionStatement { expression semi } |
";"
}
ExportDeclaration {
kw<"export"> Star (ckw<"as"> (VariableName | String))? ckw<"from"> String semi |
kw<"export"> kw<"default"> (FunctionDeclaration | ClassDeclaration | expression semi) |
kw<"export"> tskw<"type">? declaration |
kw<"export"> tskw<"type">? ExportGroup (ckw<"from"> String)? semi |
kw<"export"> "=" expression semi
}
ExportGroup {
"{" commaSep<(VariableName | String | kw<"default">) (ckw<"as"> (VariableName { word } | String))?> "}"
}
ImportDeclaration {
kw<"import"> ckw<"defer">? tskw<"type">? (Star ckw<"as"> VariableDefinition | commaSep<VariableDefinition | ImportGroup>)
ckw<"from"> String semi |
kw<"import"> ckw<"defer">? String semi
}
ImportGroup {
"{" commaSep<tskw<"type">? (VariableDefinition | (VariableName | String | kw<"default">) ckw<"as"> VariableDefinition)> "}"
}
ForSpec {
"("
(VariableDeclaration | expression ";" | ";") expression? ";" expression?
")"
}
forXSpec<op> {
"("
(variableDeclarationKeyword pattern | VariableName | MemberExpression | ArrayPattern | ObjectPattern)
!loop op expression
")"
}
ForInSpec { forXSpec<kw<"in">> }
ForOfSpec { forXSpec<ckw<"of">> }
declaration {
FunctionDeclaration |
ClassDeclaration |
VariableDeclaration |
TypeAliasDeclaration |
InterfaceDeclaration |
EnumDeclaration |
NamespaceDeclaration |
AmbientDeclaration
}
FunctionDeclaration {
async? !statement kw<"function"> Star? VariableDefinition? functionSignature (Block | semi)
}
ClassDeclaration {
!statement Decorator* tskw<"abstract">? kw<"class"> VariableDefinition TypeParamList?
(kw<"extends"> ((VariableName | MemberExpression) !typeargs TypeArgList | expression))?
(tskw<"implements"> commaSep1<type>)?
ClassBody
}
classItem { MethodDeclaration | PropertyDeclaration | StaticBlock | ";" }
ClassBody { "{" classItem* "}" }
privacy {
@extend[@name=Privacy,@dialect=ts]<word, "public" | "private" | "protected">
}
privacyArg {
@extend[@name=Privacy,@dialect=ts]<identifier, "public" | "private" | "protected">
}
propModifier {
Decorator |
tsPkwMod<"declare"> |
privacy |
pkwMod<"static"> |
tsPkwMod<"abstract"> |
tsPkwMod<"override">
}
classPropName { propName | PrivatePropertyDefinition }
MethodDeclaration[group=ClassItem] {
propModifier*
pkwMod<"async">?
(pkwMod<"get"> | pkwMod<"set"> | Star)?
classPropName
functionSignature
(Block | semi)
}
StaticBlock[group=ClassItem] {
pkwMod<"static"> Block
}
PropertyDeclaration[group=ClassItem] {
propModifier*
(tsPkwMod<"readonly"> | pkwMod<"accessor">)?
classPropName
(Optional | LogicOp<"!">)?
TypeAnnotation?
("=" expressionNoComma)?
semi
}
variableDeclarationKeyword {
kw<"let"> | kw<"var"> | kw<"const"> | ckw<"await">? ckw<"using">
}
VariableDeclaration {
variableDeclarationKeyword commaSep1<patternAssignTyped> semi
}
TypeAliasDeclaration {
tskw<"type"> TypeDefinition TypeParamList? "=" type semi
}
InterfaceDeclaration {
tskw<"interface"> TypeDefinition TypeParamList? (kw<"extends"> commaSep1<type>)? ObjectType
}
EnumDeclaration {
kw<"const">? tskw<"enum"> TypeDefinition EnumBody { "{" commaSep<PropertyName ("=" expressionNoComma)?> "}" }
}
NamespaceDeclaration {
(tskw<"namespace"> | tskw<"module">) VariableDefinition ("." PropertyDefinition)* Block
}
AmbientDeclaration {
tskw<"declare"> (
VariableDeclaration |
TypeAliasDeclaration |
EnumDeclaration |
InterfaceDeclaration |
NamespaceDeclaration |
GlobalDeclaration { tskw<"global"> Block } |
ClassDeclaration {
tskw<"abstract">? kw<"class"> VariableDefinition TypeParamList?
(kw<"extends"> expression)?
(tskw<"implements"> commaSep1<type>)?
ClassBody { "{" (
MethodDeclaration |
PropertyDeclaration |
IndexSignature semi
)* "}" }
} |
AmbientFunctionDeclaration {
async? kw<"function"> Star? VariableDefinition? TypeParamList? ParamList (TypeAnnotation | TypePredicate) semi
}
)
}
decoratorExpression {
VariableName |
MemberExpression { decoratorExpression !member ("." | questionDot) (PropertyName | PrivatePropertyName) } |
CallExpression { decoratorExpression !call TypeArgList? questionDot? ArgList } |
ParenthesizedExpression
}
Decorator { "@" decoratorExpression }
pattern { VariableDefinition | ArrayPattern | ObjectPattern }
ArrayPattern { "[" commaSep<("..."? patternAssign)?> ~destructure "]" }
ObjectPattern { "{" commaSep<PatternProperty> ~destructure "}" }
patternAssign {
pattern ("=" expressionNoComma)?
}
TypeAnnotation { ":" type }
TypePredicate {
":" (
tskw<"asserts"> (VariableName | kw<"this">) !predicate (tskw<"is"> type)? |
(VariableName | kw<"this">) !predicate tskw<"is"> type
)
}
patternAssignTyped {
pattern Optional? TypeAnnotation? ("=" expressionNoComma)?
}
ParamList {
"(" commaSep<"..." patternAssignTyped | Decorator* privacyArg? tskw<"readonly">? patternAssignTyped | kw<"this"> TypeAnnotation> ")"
}
Block {
!statement "{" statement* "}"
}
switchItem {
CaseLabel { kw<"case"> expression ":" } |
DefaultLabel { kw<"default"> ":" } |
statement
}
expression[@isGroup=Expression] {
expressionNoComma | SequenceExpression
}
SequenceExpression {
expressionNoComma !comma ("," expressionNoComma)+
}
expressionNoComma {
Number |
String |
TemplateString |
VariableName |
boolean |
kw<"this"> |
kw<"null"> |
kw<"super"> |
RegExp |
ArrayExpression |
ObjectExpression { "{" commaSep<Property> ~destructure "}" } |
NewTarget { kw<"new"> "." PropertyName } |
NewExpression { kw<"new"> expressionNoComma (!newArgs ArgList)? } |
UnaryExpression |
YieldExpression |
AwaitExpression |
ParenthesizedExpression |
ClassExpression |
FunctionExpression |
ArrowFunction |
MemberExpression |
BinaryExpression |
ConditionalExpression { expressionNoComma !ternary questionOp expressionNoComma LogicOp<":"> expressionNoComma } |
AssignmentExpression |
PostfixExpression { expressionNoComma !postfix (incdec | LogicOp<"!">) } |
CallExpression { expressionNoComma !call questionDot? ArgList } |
InstantiationExpression { (VariableName | MemberExpression) !instantiate TypeArgList } |
TaggedTemplateExpression { expressionNoComma !taggedTemplate TemplateString } |
DynamicImport { kw<"import"> "(" expressionNoComma ")" } |
ImportMeta { kw<"import"> "." PropertyName } |
JSXElement |
PrefixCast { tsAngleOpen (type | kw<"const">) ~tsAngle ">" expressionNoComma } |
ArrowFunction[@dynamicPrecedence=1] {
TypeParamList { tsAngleOpen commaSep<typeParam> ">" } ParamList TypeAnnotation? "=>" (Block | expressionNoComma)
}
}
ParenthesizedExpression { "(" expression ")" }
ArrayExpression {
"[" commaSep1<"..."? expressionNoComma | ""> ~destructure "]"
}
propName { PropertyDefinition | "[" expression "]" ~destructure | Number ~destructure | String ~destructure }
Property {
pkwMod<"async">? (pkwMod<"get"> | pkwMod<"set"> | Star)? propName functionSignature Block |
propName ~destructure (":" expressionNoComma)? |
"..." expressionNoComma
}
PatternProperty {
"..." patternAssign |
((PropertyName | Number | String) ~destructure (":" pattern)? |
("[" expression "]" ~destructure ":" pattern)) ("=" expressionNoComma)?
}
ClassExpression {
kw<"class"> VariableDefinition? (kw<"extends"> expression)? ClassBody
}
functionSignature { TypeParamList? ParamList (TypeAnnotation | TypePredicate)? }
FunctionExpression {
async? kw<"function"> Star? VariableDefinition? functionSignature Block
}
YieldExpression[@dynamicPrecedence=1] {
!prefix ckw<"yield"> Star? expressionNoComma
}
AwaitExpression[@dynamicPrecedence=1] {
!prefix ckw<"await"> expressionNoComma
}
UnaryExpression {
!prefix (kw<"void"> | kw<"typeof"> | kw<"delete"> |
LogicOp<"!"> | BitOp<"~"> | incdec | incdecPrefix | plusMin)
expressionNoComma
}
BinaryExpression {
expressionNoComma !exp ArithOp<"**"> expressionNoComma |
expressionNoComma !times (divide | ArithOp<"%"> | ArithOp<"*">) expressionNoComma |
expressionNoComma !plus plusMin expressionNoComma |
expressionNoComma !shift BitOp<">>" ">"? | "<<"> expressionNoComma |
expressionNoComma !rel (LessThan | CompareOp<"<=" | ">" "="?> | kw<"instanceof">) expressionNoComma |
expressionNoComma !satisfies tskw<"satisfies"> type |
(expressionNoComma | PrivatePropertyName) !rel ~tsIn kw<"in"> expressionNoComma |
expressionNoComma !rel ckw<"as"> (kw<"const"> | type) |
expressionNoComma !rel tskw<"satisfies"> type |
expressionNoComma !equal CompareOp<"==" "="? | "!=" "="?> expressionNoComma |
expressionNoComma !bitOr BitOp { "|" } expressionNoComma |
expressionNoComma !bitXor BitOp<"^"> expressionNoComma |
expressionNoComma !bitAnd BitOp { "&" } expressionNoComma |
expressionNoComma !and LogicOp<"&&"> expressionNoComma |
expressionNoComma !or LogicOp<"||" | "??"> expressionNoComma
}
AssignmentExpression {
(VariableName | MemberExpression) !assign UpdateOp<($[+\-/%^] | "*" "*"? | "|" "|"? | "&" "&"? | "<<" | ">>" ">"? | "??") "=">
expressionNoComma |
(VariableName | MemberExpression | ArrayPattern | ObjectPattern) !assign "=" expressionNoComma
}
MemberExpression {
expressionNoComma !member (("." | questionDot) (PropertyName | PrivatePropertyName) | questionDot? "[" expression "]")
}
ArgList {
"(" commaSep<"..."? expressionNoComma> ")"
}
ArrowFunction {
async? (ParamList { VariableDefinition } | ParamList TypeAnnotation?) "=>" (Block | expressionNoComma)
}
TypeArgList[@dynamicPrecedence=1] {
@extend[@dialect=ts,@name="<"]<LessThan, "<"> commaSep<type> ">"
}
TypeParamList {
"<" commaSep<typeParam> ">"
}
typeParam { (kw<"in"> | tskw<"out"> | kw<"const">)? TypeDefinition ~tsAngle (kw<"extends"> type)? ("=" type)? }
typeofExpression {
MemberExpression { typeofExpression !member (("." | questionDot) PropertyName | "[" expression "]") } |
InstantiationExpression { typeofExpression !instantiate TypeArgList } |
VariableName
}
type[@isGroup=Type] {
ThisType { kw<"this"> } |
LiteralType {
plusMin? Number |
boolean |
String
} |
TemplateType |
NullType { kw<"null"> } |
VoidType { kw<"void"> } |
TypeofType { kw<"typeof"> typeofExpression } |
KeyofType { !typePrefix tskw<"keyof"> type } |
UniqueType { !typePrefix tskw<"unique"> type } |
ImportType { kw<"import"> "(" String ")" } |
InferredType { tskw<"infer"> TypeName } |
ParenthesizedType { "(" type ")" } |
FunctionSignature { TypeParamList? ParamTypeList "=>" type } |
NewSignature { kw<"new"> ParamTypeList "=>" type } |
IndexedType |
TupleType { "[" commaSep<(Label ":")? type | "..." type> ~destructure "]" } |
ArrayType { type noSemiType "[" "]" } |
ReadonlyType { tskw<"readonly"> !readonly type } |
ObjectType |
UnionType {
type (!union unionOp type)+ |
unionOp type (!unionPrefixed unionOp type)*
} |
IntersectionType {
type (!intersection intersectionOp type)+ |
intersectionOp type (!intersectionPrefixed intersectionOp type)*
} |
ConditionalType { type !typeExtends kw<"extends"> type questionOp ~arrow type LogicOp<":"> type } |
ParameterizedType { (TypeName | IndexedType) !typeargs TypeArgList } |
TypeName
}
IndexedType {
type !typeMember ("." TypeName | noSemiType "[" type "]")+
}
ObjectType {
"{" (
(MethodType |
PropertyType |
IndexSignature |
CallSignature { ParamTypeList (TypeAnnotation | TypePredicate) } |
NewSignature[@dynamicPrecedence=1] { @extend[@name=new]<word, "new"> ParamTypeList TypeAnnotation })
("," | semi)
)* ~destructure "}"
}
IndexSignature {
(plusMin? tsPkwMod<"readonly">)?
"[" PropertyDefinition { identifier } (TypeAnnotation | ~tsIn kw<"in"> type (ckw<"as"> type)?) "]"
(plusMin? Optional)?
TypeAnnotation
}
MethodType {
pkwMod<"async">?
(pkwMod<"get"> | pkwMod<"set"> | Star)?
propName
(plusMin? Optional)?
functionSignature
}
PropertyType {
(plusMin? tsPkwMod<"readonly">)?
propName
(plusMin? Optional)?
TypeAnnotation
}
ParamTypeList[@name=ParamList] {
"(" commaSep<"..."? pattern ~arrow Optional? ~arrow TypeAnnotation? | kw<"this"> TypeAnnotation> ")"
}
@skip {} {
TemplateString[isolate] {
templateStart (templateEscape | templateContent | templateExpr)* templateEnd
}
TemplateType[isolate] {
templateStart (templateContent | templateType)* templateEnd
}
String[isolate] {
'"' (stringContentDouble | Escape)* ('"' | "\n") |
"'" (stringContentSingle | Escape)* ("'" | "\n")
}
BlockComment[isolate] { "/*" (blockCommentContent | blockCommentNewline)* blockCommentEnd }
}
templateExpr[@name=Interpolation,isolate] { InterpolationStart expression? InterpolationEnd }
templateType[@name=Interpolation,isolate] { InterpolationStart type? InterpolationEnd }
@skip {} {
JSXElement {
JSXSelfClosingTag |
(JSXOpenTag | JSXFragmentTag) (JSXText | JSXElement | JSXEscape)* JSXCloseTag
}
}
JSXSelfClosingTag { JSXStartTag jsxElementName jsxAttribute* JSXSelfCloseEndTag }
JSXOpenTag { JSXStartTag jsxElementName jsxAttribute* JSXEndTag }
JSXFragmentTag { JSXStartTag JSXEndTag }
JSXCloseTag { JSXStartCloseTag jsxElementName? JSXEndTag }
jsxElementName {
JSXIdentifier |
JSXBuiltin { JSXLowerIdentifier } |
JSXNamespacedName |
JSXMemberExpression
}
JSXMemberExpression { (JSXMemberExpression | JSXIdentifier | JSXLowerIdentifier) "." (JSXIdentifier | JSXLowerIdentifier) }
JSXNamespacedName { (JSXIdentifier | JSXNamespacedName | JSXLowerIdentifier) ":" (JSXIdentifier | JSXLowerIdentifier) }
jsxAttribute {
JSXSpreadAttribute { "{" "..." expression "}" } |
JSXAttribute { (JSXIdentifier | JSXNamespacedName | JSXLowerIdentifier) ("=" jsxAttributeValue)? }
}
jsxAttributeValue {
JSXAttributeValue |
JSXEscape { "{" expression "}" } |
JSXElement
}
JSXEscape { "{" "..."? expression "}" }
commaSep<content> {
"" | content ("," content?)*
}
commaSep1<content> {
content ("," content)*
}
// Keywords
kw<term> { @specialize[@name={term}]<identifier, term> }
// Contextual keywords
ckw<term> { @extend[@name={term}]<identifier, term> }
tskw<term> { @extend[@name={term},@dialect=ts]<identifier, term> }
async { @extend[@name=async]<identifier, "async"> }
// Contextual keyword in property context
pkwMod<term> { @extend[@name={term}]<word, term> }
tsPkwMod<term> { @extend[@name={term},@dialect=ts]<word, term> }
semi { ";" | insertSemi }
boolean { @specialize[@name=BooleanLiteral]<identifier, "true" | "false"> }
Star { "*" }
VariableName { identifier ~arrow }
VariableDefinition { identifier ~arrow }
TypeDefinition { identifier }
TypeName { identifier ~arrow }
Label { identifier }
PropertyName { word ~propName }
PropertyDefinition { word ~propName }
PrivatePropertyName { privateIdentifier }
PrivatePropertyDefinition { privateIdentifier }
Optional { "?" }
questionOp[@name=LogicOp] { "?" }
unionOp[@name=LogicOp] { "|" }
plusMin { ArithOp<"+" | "-"> }
intersectionOp[@name=LogicOp] { "&" }
@skip { spaces | newline | LineComment | BlockComment }
@context trackNewline from "./tokens.js"
@external tokens noSemicolon from "./tokens" { noSemi }
@external tokens noSemicolonType from "./tokens" { noSemiType }
@external tokens operatorToken from "./tokens" {
incdec[@name=ArithOp],
incdecPrefix[@name=ArithOp]
questionDot[@name="?."]
}
@external tokens jsx from "./tokens" { JSXStartTag }
@local tokens {
InterpolationStart[closedBy=InterpolationEnd] { "${" }
templateEnd { "`" }
templateEscape[@name=Escape] { Escape }
@else templateContent
}
@local tokens {
blockCommentEnd { "*/" }
blockCommentNewline { "\n" }
@else blockCommentContent
}
@tokens {
spaces[@export] { $[\u0009 \u000b\u00a0\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]+ }
newline[@export] { $[\r\n\u2028\u2029] }
LineComment[isolate] { "//" ![\n]* }
Hashbang { "#!" ![\n]* }
divide[@name=ArithOp] { "/" }
@precedence { "/*", LineComment, divide }
@precedence { "/*", LineComment, RegExp }
identifierChar { @asciiLetter | $[_$\u{a1}-\u{10ffff}] }
word { identifierChar (identifierChar | @digit)* }
identifier { word }
privateIdentifier { "#" word }
@precedence { spaces, newline, identifier }
@precedence { spaces, newline, JSXIdentifier, JSXLowerIdentifier }
@precedence { spaces, newline, word }
hex { @digit | $[a-fA-F] }
Number {
(@digit ("_" | @digit)* ("." ("_" | @digit)*)? | "." @digit ("_" | @digit)*)
(("e" | "E") ("+" | "-")? ("_" | @digit)+)? |
@digit ("_" | @digit)* "n" |
"0x" (hex | "_")+ "n"? |
"0b" $[01_]+ "n"? |
"0o" $[0-7_]+ "n"?
}
@precedence { Number "." }
Escape {
"\\" ("x" hex hex | "u" ("{" hex+ "}" | hex hex hex hex) | ![xu])
}
stringContentSingle { ![\\\n']+ }
stringContentDouble { ![\\\n"]+ }
templateStart { "`" }
InterpolationEnd[openedBy=InterpolationStart] { "}" }
ArithOp<expr> { expr }
LogicOp<expr> { expr }
BitOp<expr> { expr }
CompareOp<expr> { expr }
UpdateOp<expr> { expr }
@precedence { "*", ArithOp }
RegExp[isolate] { "/" (![/\\\n[] | "\\" ![\n] | "[" (![\n\\\]] | "\\" ![\n])* "]")+ ("/" $[dgimsuvy]*)? }
LessThan[@name=CompareOp] { "<" }
"="[@name=Equals]
"..."[@name=Spread]
"=>"[@name=Arrow]
"(" ")" "[" "]" "{" "}" "<" ">"
"." "," ";" ":" "@"
JSXIdentifier { $[A-Z_$\u{a1}-\u{10ffff}] (identifierChar | @digit | "-")* }
JSXLowerIdentifier[@name=JSXIdentifier] { $[a-z] (identifierChar | @digit | "-")* }
JSXAttributeValue { '"' !["]* '"' | "'" ![']* "'" }
JSXStartCloseTag { "</" }
JSXEndTag { ">" }
JSXSelfCloseEndTag { "/>" }
JSXText { ![<{]+ }
tsAngleOpen[@dialect=ts,@name="<"] { "<" }
}
@external tokens insertSemicolon from "./tokens" { insertSemi }
@external propSource jsHighlight from "./highlight"
@detectDelim

33
frontend/node_modules/@lezer/javascript/src/parser.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,177 @@
// This file was generated by lezer-generator. You probably shouldn't edit it.
export const
noSemi = 316,
noSemiType = 317,
incdec = 1,
incdecPrefix = 2,
questionDot = 3,
JSXStartTag = 4,
insertSemi = 318,
spaces = 320,
newline = 321,
LineComment = 5,
BlockComment = 6,
Script = 7,
Hashbang = 8,
ExportDeclaration = 9,
_export = 10,
Star = 11,
as = 12,
VariableName = 13,
String = 14,
Escape = 15,
from = 16,
_default = 18,
FunctionDeclaration = 19,
async = 64,
_function = 21,
VariableDefinition = 22,
TypeParamList = 25,
_in = 26,
out = 27,
_const = 28,
TypeDefinition = 29,
_extends = 30,
_this = 32,
Number = 35,
BooleanLiteral = 36,
TemplateType = 37,
InterpolationEnd = 38,
templateType = 39,
InterpolationStart = 40,
_null = 42,
_void = 44,
_typeof = 46,
PropertyName = 49,
TemplateString = 51,
templateEscape = 52,
templateExpr = 53,
_super = 54,
RegExp = 55,
ArrayExpression = 57,
Property = 63,
get = 65,
set = 66,
PropertyDefinition = 67,
Block = 68,
_new = 200,
ArgList = 75,
UnaryExpression = 76,
_delete = 77,
YieldExpression = 80,
_yield = 81,
AwaitExpression = 82,
_await = 83,
ParenthesizedExpression = 84,
ClassExpression = 85,
_class = 86,
ClassBody = 87,
MethodDeclaration = 88,
Decorator = 89,
PrivatePropertyName = 92,
TypeArgList = 94,
LessThan = 95,
declare = 225,
Privacy = 117,
_static = 99,
abstract = 208,
override = 101,
PrivatePropertyDefinition = 102,
PropertyDeclaration = 103,
readonly = 118,
accessor = 105,
Optional = 106,
TypeAnnotation = 107,
StaticBlock = 109,
FunctionExpression = 110,
ArrowFunction = 111,
ParamList = 113,
ArrayPattern = 114,
ObjectPattern = 115,
PatternProperty = 116,
MemberExpression = 120,
BinaryExpression = 121,
divide = 123,
_instanceof = 128,
satisfies = 129,
questionOp = 137,
AssignmentExpression = 139,
_import = 146,
JSXElement = 148,
JSXSelfCloseEndTag = 149,
JSXSelfClosingTag = 150,
JSXIdentifier = 151,
JSXLowerIdentifier = 153,
JSXNamespacedName = 154,
JSXMemberExpression = 155,
JSXAttributeValue = 158,
JSXEndTag = 160,
JSXOpenTag = 161,
JSXFragmentTag = 162,
JSXText = 163,
JSXEscape = 164,
JSXStartCloseTag = 165,
JSXCloseTag = 166,
tsAngleOpen = 168,
SequenceExpression = 171,
keyof = 174,
unique = 176,
infer = 179,
TypeName = 180,
ParamTypeList = 183,
IndexedType = 185,
Label = 187,
ObjectType = 190,
MethodType = 191,
PropertyType = 192,
IndexSignature = 193,
TypePredicate = 196,
asserts = 197,
is = 198,
unionOp = 202,
intersectionOp = 204,
ClassDeclaration = 207,
_implements = 209,
type = 210,
VariableDeclaration = 211,
_let = 212,
_var = 213,
using = 214,
TypeAliasDeclaration = 215,
InterfaceDeclaration = 216,
_interface = 217,
EnumDeclaration = 218,
_enum = 219,
NamespaceDeclaration = 221,
namespace = 222,
module = 223,
AmbientDeclaration = 224,
global = 227,
ExportGroup = 231,
ImportDeclaration = 234,
defer = 235,
ImportGroup = 236,
_for = 238,
ForSpec = 239,
ForInSpec = 240,
ForOfSpec = 241,
of = 242,
_while = 244,
_with = 246,
_do = 248,
_if = 250,
_else = 251,
_switch = 253,
_case = 256,
_try = 259,
_catch = 261,
_finally = 263,
_return = 265,
_throw = 267,
_break = 269,
_continue = 271,
_debugger = 273,
SingleExpression = 276,
SingleClassItem = 277,
Dialect_jsx = 0,
Dialect_ts = 1

87
frontend/node_modules/@lezer/javascript/src/tokens.js generated vendored Normal file
View File

@ -0,0 +1,87 @@
/* Hand-written tokenizers for JavaScript tokens that can't be
expressed by lezer's built-in tokenizer. */
import {ExternalTokenizer, ContextTracker} from "@lezer/lr"
import {insertSemi, noSemi, noSemiType, incdec, incdecPrefix, questionDot,
spaces, newline, BlockComment, LineComment,
JSXStartTag, Dialect_jsx} from "./parser.terms.js"
const space = [9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200,
8201, 8202, 8232, 8233, 8239, 8287, 12288]
const braceR = 125, semicolon = 59, slash = 47, star = 42, plus = 43, minus = 45, lt = 60, comma = 44,
question = 63, dot = 46, bracketL = 91
export const trackNewline = new ContextTracker({
start: false,
shift(context, term) {
return term == LineComment || term == BlockComment || term == spaces ? context : term == newline
},
strict: false
})
export const insertSemicolon = new ExternalTokenizer((input, stack) => {
let {next} = input
if (next == braceR || next == -1 || stack.context)
input.acceptToken(insertSemi)
}, {contextual: true, fallback: true})
export const noSemicolon = new ExternalTokenizer((input, stack) => {
let {next} = input, after
if (space.indexOf(next) > -1) return
if (next == slash && ((after = input.peek(1)) == slash || after == star)) return
if (next != braceR && next != semicolon && next != -1 && !stack.context)
input.acceptToken(noSemi)
}, {contextual: true})
export const noSemicolonType = new ExternalTokenizer((input, stack) => {
if (input.next == bracketL && !stack.context) input.acceptToken(noSemiType)
}, {contextual: true})
export const operatorToken = new ExternalTokenizer((input, stack) => {
let {next} = input
if (next == plus || next == minus) {
input.advance()
if (next == input.next) {
input.advance()
let mayPostfix = !stack.context && stack.canShift(incdec)
input.acceptToken(mayPostfix ? incdec : incdecPrefix)
}
} else if (next == question && input.peek(1) == dot) {
input.advance(); input.advance()
if (input.next < 48 || input.next > 57) // No digit after
input.acceptToken(questionDot)
}
}, {contextual: true})
function identifierChar(ch, start) {
return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch == 95 || ch >= 192 ||
!start && ch >= 48 && ch <= 57
}
export const jsx = new ExternalTokenizer((input, stack) => {
if (input.next != lt || !stack.dialectEnabled(Dialect_jsx)) return
input.advance()
if (input.next == slash) return
// Scan for an identifier followed by a comma or 'extends', don't
// treat this as a start tag if present.
let back = 0
while (space.indexOf(input.next) > -1) { input.advance(); back++ }
if (identifierChar(input.next, true)) {
input.advance()
back++
while (identifierChar(input.next, false)) { input.advance(); back++ }
while (space.indexOf(input.next) > -1) { input.advance(); back++ }
if (input.next == comma) return
for (let i = 0;; i++) {
if (i == 7) {
if (!identifierChar(input.next, true)) return
break
}
if (input.next != "extends".charCodeAt(i)) break
input.advance()
back++
}
}
input.acceptToken(JSXStartTag, -back)
})

View File

@ -0,0 +1,64 @@
# Decorators on classes and class fields
@d1 class Foo {
@d2 bar() {}
@d3 get baz() { return 1 }
@d4 quux = 1
}
==>
Script(ClassDeclaration(
Decorator(VariableName),
class,VariableDefinition,ClassBody(
MethodDeclaration(Decorator(VariableName),PropertyDefinition,ParamList,Block),
MethodDeclaration(Decorator(VariableName),get,PropertyDefinition,ParamList,Block(
ReturnStatement(return,Number))),
PropertyDeclaration(Decorator(VariableName),PropertyDefinition,Equals,Number))))
# Multiple decorators
@d1 @d2 class Y {}
==>
Script(ClassDeclaration(Decorator(VariableName),Decorator(VariableName),class,VariableDefinition,ClassBody))
# Member decorators
@one.two class X {}
==>
Script(ClassDeclaration(Decorator(MemberExpression(VariableName,PropertyName)),class,VariableDefinition,ClassBody))
# Call decorators
@d(2) @a.b() class Z {}
==>
Script(ClassDeclaration(
Decorator(CallExpression(VariableName,ArgList(Number))),
Decorator(CallExpression(MemberExpression(VariableName,PropertyName),ArgList)),
class,VariableDefinition,ClassBody))
# Parenthesized decorators
@(a instanceof Array ? x : y)(2) class P {}
==>
Script(ClassDeclaration(
Decorator(CallExpression(ParenthesizedExpression(
ConditionalExpression(BinaryExpression(VariableName,instanceof,VariableName),LogicOp,VariableName,LogicOp,VariableName)),
ArgList(Number))),
class,VariableDefinition,ClassBody))
# Parameter decorators
function foo(@d bar) {}
==>
Script(FunctionDeclaration(function,VariableDefinition,ParamList(Decorator(VariableName),VariableDefinition),Block))

View File

@ -0,0 +1,686 @@
# Minimal
0
==>
Script(ExpressionStatement(Number))
# Strings
"A string with \"double\" and 'single' quotes";
'A string with "double" and \'single\' quotes';
'\\';
"\\";
'A string with new \
line';
==>
Script(ExpressionStatement(String(Escape,Escape)),
ExpressionStatement(String(Escape,Escape)),
ExpressionStatement(String(Escape)),
ExpressionStatement(String(Escape)),
ExpressionStatement(String(Escape)))
# Numbers
101;
3.14;
3.14e+1;
0x1ABCDEFabcdef;
0o7632157312;
0b1010101001;
1e+3;
==>
Script(
ExpressionStatement(Number),
ExpressionStatement(Number),
ExpressionStatement(Number),
ExpressionStatement(Number),
ExpressionStatement(Number),
ExpressionStatement(Number),
ExpressionStatement(Number))
# Identifiers
theVar;
theVar2;
$_;
é象𫝄;
últimaVez;
県;
==>
Script(
ExpressionStatement(VariableName),
ExpressionStatement(VariableName),
ExpressionStatement(VariableName),
ExpressionStatement(VariableName),
ExpressionStatement(VariableName),
ExpressionStatement(VariableName))
# RegExps
/one\\/;
/one/g;
/one/i;
/one/gim;
/on\/e/gim;
/on[^/]afe/gim;
/[\]/]/;
==>
Script(
ExpressionStatement(RegExp),
ExpressionStatement(RegExp),
ExpressionStatement(RegExp),
ExpressionStatement(RegExp),
ExpressionStatement(RegExp),
ExpressionStatement(RegExp),
ExpressionStatement(RegExp))
# Arrays
[];
[ "item1" ];
[ "item1", ];
[ "item1", item2 ];
[ , item2 ];
[ item2 = 5 ];
[ a, ...b, c ];
==>
Script(
ExpressionStatement(ArrayExpression),
ExpressionStatement(ArrayExpression(String)),
ExpressionStatement(ArrayExpression(String)),
ExpressionStatement(ArrayExpression(String,VariableName)),
ExpressionStatement(ArrayExpression(VariableName)),
ExpressionStatement(ArrayExpression(AssignmentExpression(VariableName,Equals,Number))),
ExpressionStatement(ArrayExpression(VariableName, Spread, VariableName, VariableName)))
# Functions
[
function() {},
function(arg1, ...arg2) {
arg2;
},
function stuff() {},
function trailing(a,) {},
function trailing(a,b,) {}
]
==>
Script(ExpressionStatement(ArrayExpression(
FunctionExpression(function,ParamList,Block),
FunctionExpression(function,ParamList(VariableDefinition,Spread,VariableDefinition), Block(ExpressionStatement(VariableName))),
FunctionExpression(function,VariableDefinition,ParamList,Block),
FunctionExpression(function,VariableDefinition,ParamList(VariableDefinition), Block),
FunctionExpression(function,VariableDefinition,ParamList(VariableDefinition,VariableDefinition),Block))))
# Arrow functions
a => 1;
() => 2;
(d, e) => 3;
(f, g,) => {
return h;
};
async () => 4;
==>
Script(
ExpressionStatement(ArrowFunction(ParamList(VariableDefinition),Arrow,Number)),
ExpressionStatement(ArrowFunction(ParamList,Arrow,Number)),
ExpressionStatement(ArrowFunction(ParamList(VariableDefinition,VariableDefinition),Arrow,Number)),
ExpressionStatement(ArrowFunction(ParamList(VariableDefinition,VariableDefinition),Arrow,Block(ReturnStatement(return,VariableName)))),
ExpressionStatement(ArrowFunction(async,ParamList,Arrow,Number)))
# Arrow function followed by comma
({
a: () => 1,
b: "x"
})
==>
Script(ExpressionStatement(ParenthesizedExpression(ObjectExpression(
Property(PropertyDefinition,ArrowFunction(ParamList,Arrow,Number)),
Property(PropertyDefinition,String)))))
# Long potential arrow function
(assign = [to, from], from = assign[0], to = assign[1]);
==>
Script(ExpressionStatement(ParenthesizedExpression(SequenceExpression(
AssignmentExpression(VariableName,Equals,ArrayExpression(VariableName,VariableName)),
AssignmentExpression(VariableName,Equals,MemberExpression(VariableName,Number)),
AssignmentExpression(VariableName,Equals,MemberExpression(VariableName,Number))))))
# Ternary operator
condition ? case1 : case2;
x.y = some.condition ? 2**x : 1 - 2;
==>
Script(
ExpressionStatement(ConditionalExpression(VariableName,LogicOp,VariableName,LogicOp,VariableName)),
ExpressionStatement(AssignmentExpression(
MemberExpression(VariableName,PropertyName),Equals,
ConditionalExpression(
MemberExpression(VariableName,PropertyName),LogicOp,
BinaryExpression(Number,ArithOp,VariableName),LogicOp,
BinaryExpression(Number,ArithOp,Number)))))
# Type operators
typeof x;
x instanceof String;
==>
Script(ExpressionStatement(UnaryExpression(typeof,VariableName)),
ExpressionStatement(BinaryExpression(VariableName,instanceof,VariableName)))
# Delete
delete thing['prop'];
true ? delete thing.prop : null;
==>
Script(
ExpressionStatement(UnaryExpression(delete,MemberExpression(VariableName,String))),
ExpressionStatement(ConditionalExpression(BooleanLiteral,LogicOp,
UnaryExpression(delete,MemberExpression(VariableName,PropertyName)),LogicOp,null)))
# Void
a = void b();
==>
Script(ExpressionStatement(AssignmentExpression(VariableName,Equals,UnaryExpression(void,CallExpression(VariableName,ArgList)))))
# Augmented assignment
s |= 1;
t %= 2;
w ^= 3;
x += 4;
y.z *= 5;
z += 1;
a >>= 1;
b >>>= 1;
c <<= 1;
==>
Script(
ExpressionStatement(AssignmentExpression(VariableName,UpdateOp,Number)),
ExpressionStatement(AssignmentExpression(VariableName,UpdateOp,Number)),
ExpressionStatement(AssignmentExpression(VariableName,UpdateOp,Number)),
ExpressionStatement(AssignmentExpression(VariableName,UpdateOp,Number)),
ExpressionStatement(AssignmentExpression(MemberExpression(VariableName,PropertyName),UpdateOp,Number)),
ExpressionStatement(AssignmentExpression(VariableName,UpdateOp,Number)),
ExpressionStatement(AssignmentExpression(VariableName,UpdateOp,Number)),
ExpressionStatement(AssignmentExpression(VariableName,UpdateOp,Number)),
ExpressionStatement(AssignmentExpression(VariableName,UpdateOp,Number)))
# Operator precedence
a <= b && c >= d;
a.b = c ? d : e;
a && b(c) && d;
a && new b(c) && d;
typeof a == b && c instanceof d;
==>
Script(
ExpressionStatement(BinaryExpression(BinaryExpression(VariableName,CompareOp,VariableName),LogicOp,
BinaryExpression(VariableName,CompareOp,VariableName))),
ExpressionStatement(AssignmentExpression(MemberExpression(VariableName,PropertyName),Equals,
ConditionalExpression(VariableName,LogicOp,VariableName,LogicOp,VariableName))),
ExpressionStatement(BinaryExpression(BinaryExpression(VariableName,LogicOp,CallExpression(VariableName,ArgList(VariableName))),LogicOp,
VariableName)),
ExpressionStatement(BinaryExpression(BinaryExpression(VariableName,LogicOp,NewExpression(new,VariableName,ArgList(VariableName))),LogicOp,
VariableName)),
ExpressionStatement(BinaryExpression(BinaryExpression(UnaryExpression(typeof,VariableName),CompareOp,VariableName),LogicOp,
BinaryExpression(VariableName,instanceof,VariableName))))
# Rest args
foo(...rest);
==>
Script(ExpressionStatement(CallExpression(VariableName,ArgList(Spread,VariableName))))
# Forward slashes after parenthesized expressions
(foo - bar) / baz;
if (foo - bar) /baz/;
(this.a() / this.b() - 1) / 2;
==>
Script(
ExpressionStatement(BinaryExpression(ParenthesizedExpression(BinaryExpression(VariableName,ArithOp,VariableName)),ArithOp,VariableName)),
IfStatement(if,ParenthesizedExpression(BinaryExpression(VariableName,ArithOp,VariableName)),
ExpressionStatement(RegExp)),
ExpressionStatement(BinaryExpression(ParenthesizedExpression(
BinaryExpression(
BinaryExpression(
CallExpression(MemberExpression(this,PropertyName),ArgList),ArithOp,
CallExpression(MemberExpression(this,PropertyName),ArgList)),ArithOp,Number)),ArithOp,Number)))
# Yield expressions
yield db.users.where('[endpoint+email]');
yield* a;
yield [22];
==>
Script(
ExpressionStatement(YieldExpression(yield,
CallExpression(MemberExpression(MemberExpression(VariableName,PropertyName),PropertyName),ArgList(String)))),
ExpressionStatement(YieldExpression(yield,Star,VariableName)),
ExpressionStatement(YieldExpression(yield,ArrayExpression(Number))))
# Template strings
`one line`;
`multi
line`;
`multi
${2 + 2}
hello
${1, 2}
line`;
`$$$$`;
`$`;
`$$$$${ async }`;
`\\\``;
`one${`two${`three`}`}`;
f`hi${there}`;
==>
Script(
ExpressionStatement(TemplateString),
ExpressionStatement(TemplateString),
ExpressionStatement(TemplateString(
Interpolation(InterpolationStart,BinaryExpression(Number,ArithOp,Number),InterpolationEnd),
Interpolation(InterpolationStart,SequenceExpression(Number,Number),InterpolationEnd))),
ExpressionStatement(TemplateString),
ExpressionStatement(TemplateString),
ExpressionStatement(TemplateString(Interpolation(InterpolationStart,VariableName,InterpolationEnd))),
ExpressionStatement(TemplateString(Escape,Escape)),
ExpressionStatement(TemplateString(Interpolation(InterpolationStart,TemplateString(
Interpolation(InterpolationStart,TemplateString,InterpolationEnd)),InterpolationEnd))),
ExpressionStatement(TaggedTemplateExpression(VariableName,TemplateString(
Interpolation(InterpolationStart,VariableName,InterpolationEnd)))))
# Atoms
this;
null;
undefined;
true;
false;
==>
Script(
ExpressionStatement(this),
ExpressionStatement(null),
ExpressionStatement(VariableName),
ExpressionStatement(BooleanLiteral),
ExpressionStatement(BooleanLiteral))
# Objects
foo({},
{ a: "b" },
{ c: "d", "e": f, 1: 2 },
{
g,
[methodName]() {}
},
{b, get},
{a,});
==>
Script(ExpressionStatement(CallExpression(VariableName,ArgList(
ObjectExpression,
ObjectExpression(Property(PropertyDefinition,String)),
ObjectExpression(Property(PropertyDefinition,String),Property(String,VariableName),Property(Number,Number)),
ObjectExpression(Property(PropertyDefinition),Property(VariableName,ParamList,Block)),
ObjectExpression(Property(PropertyDefinition),Property(PropertyDefinition)),
ObjectExpression(Property(PropertyDefinition))))))
# Method definitions
({
foo: true,
add(a, b) {
return a + b;
},
get bar() { return c; },
set bar(a) { c = a; },
*barGenerator() { yield c; },
get() { return 1; }
});
==>
Script(ExpressionStatement(ParenthesizedExpression(ObjectExpression(
Property(PropertyDefinition,BooleanLiteral),
Property(PropertyDefinition,ParamList(VariableDefinition,VariableDefinition),
Block(ReturnStatement(return,BinaryExpression(VariableName,ArithOp,VariableName)))),
Property(get,PropertyDefinition,ParamList,Block(ReturnStatement(return,VariableName))),
Property(set,PropertyDefinition,ParamList(VariableDefinition),
Block(ExpressionStatement(AssignmentExpression(VariableName,Equals,VariableName)))),
Property(Star,PropertyDefinition,ParamList,Block(ExpressionStatement(YieldExpression(yield,VariableName)))),
Property(PropertyDefinition,ParamList,Block(ReturnStatement(return,Number)))))))
# Keyword property names
({
finally() {},
catch() {},
get: function () {},
set() {},
static: true,
async: true,
});
==>
Script(ExpressionStatement(ParenthesizedExpression(ObjectExpression(
Property(PropertyDefinition,ParamList,Block),
Property(PropertyDefinition,ParamList,Block),
Property(PropertyDefinition,FunctionExpression(function,ParamList,Block)),
Property(PropertyDefinition,ParamList,Block),
Property(PropertyDefinition,BooleanLiteral),
Property(PropertyDefinition,BooleanLiteral)))))
# Generator functions
[
function *() {},
function *generateStuff(arg1, arg2) {
yield;
yield arg2;
}
];
==>
Script(ExpressionStatement(ArrayExpression(
FunctionExpression(function,Star,ParamList,Block),
FunctionExpression(function,Star,VariableDefinition,ParamList(VariableDefinition,VariableDefinition),Block(
ExpressionStatement(VariableName),
ExpressionStatement(YieldExpression(yield,VariableName)))))))
# Member expressions
x.someProperty;
x?.other;
x[someVariable];
f()["some-string"];
return returned.promise().done(a).fail(b);
==>
Script(
ExpressionStatement(MemberExpression(VariableName,PropertyName)),
ExpressionStatement(MemberExpression(VariableName,PropertyName)),
ExpressionStatement(MemberExpression(VariableName,VariableName)),
ExpressionStatement(MemberExpression(CallExpression(VariableName,ArgList),String)),
ReturnStatement(return,CallExpression(MemberExpression(CallExpression(MemberExpression(CallExpression(
MemberExpression(VariableName,PropertyName),ArgList),PropertyName),ArgList(VariableName)),PropertyName),ArgList(VariableName))))
# Callback chain
return this.map(function (a) {
return a.b;
})
// a comment
.filter(function (c) {
return 2;
});
==>
Script(ReturnStatement(return,CallExpression(MemberExpression(CallExpression(MemberExpression(this,PropertyName),
ArgList(FunctionExpression(function,ParamList(VariableDefinition),Block(ReturnStatement(return,MemberExpression(VariableName,PropertyName)))))),
LineComment,PropertyName),ArgList(FunctionExpression(function,ParamList(VariableDefinition),Block(ReturnStatement(return,Number)))))))
# Function calls
x.someMethod(arg1, "arg2");
(function(x, y) {
}(a, b));
f(new foo.bar(1), 2);
==>
Script(
ExpressionStatement(CallExpression(MemberExpression(VariableName,PropertyName),ArgList(VariableName,String))),
ExpressionStatement(ParenthesizedExpression(CallExpression(FunctionExpression(function,ParamList(VariableDefinition,VariableDefinition),Block),
ArgList(VariableName,VariableName)))),
ExpressionStatement(CallExpression(VariableName,ArgList(NewExpression(new,MemberExpression(VariableName,PropertyName),ArgList(Number)),Number))))
# Constructor calls
new foo(1);
new module.Klass(1, "two");
new Thing;
==>
Script(
ExpressionStatement(NewExpression(new,VariableName,ArgList(Number))),
ExpressionStatement(NewExpression(new,MemberExpression(VariableName,PropertyName),ArgList(Number,String))),
ExpressionStatement(NewExpression(new,VariableName)))
# Await Expressions
await asyncFunction();
await asyncPromise;
==>
Script(
ExpressionStatement(AwaitExpression(await,CallExpression(VariableName,ArgList))),
ExpressionStatement(AwaitExpression(await,VariableName)))
# Numeric operators
i++;
i--;
i + j * 3 - j % 5;
2 ** i * 3;
2 * i ** 3;
+x;
-x;
==>
Script(
ExpressionStatement(PostfixExpression(VariableName,ArithOp)),
ExpressionStatement(PostfixExpression(VariableName,ArithOp)),
ExpressionStatement(BinaryExpression(BinaryExpression(VariableName,ArithOp,BinaryExpression(VariableName,ArithOp,Number)),ArithOp,BinaryExpression(VariableName,ArithOp,Number))),
ExpressionStatement(BinaryExpression(BinaryExpression(Number,ArithOp,VariableName),ArithOp,Number)),
ExpressionStatement(BinaryExpression(Number,ArithOp,BinaryExpression(VariableName,ArithOp,Number))),
ExpressionStatement(UnaryExpression(ArithOp,VariableName)),
ExpressionStatement(UnaryExpression(ArithOp,VariableName)))
# Boolean operators
i || j;
i && j;
i ?? j;
!a && !b || !c && !d;
==>
Script(
ExpressionStatement(BinaryExpression(VariableName,LogicOp,VariableName)),
ExpressionStatement(BinaryExpression(VariableName,LogicOp,VariableName)),
ExpressionStatement(BinaryExpression(VariableName,LogicOp,VariableName)),
ExpressionStatement(BinaryExpression(BinaryExpression(UnaryExpression(LogicOp,VariableName),LogicOp,
UnaryExpression(LogicOp,VariableName)),LogicOp,BinaryExpression(UnaryExpression(LogicOp,VariableName),LogicOp,
UnaryExpression(LogicOp,VariableName)))))
# Bitwise operators
i >> j;
i >>> j;
i << j;
i & j;
i | j;
~i ^ ~j;
==>
Script(
ExpressionStatement(BinaryExpression(VariableName,BitOp,VariableName)),
ExpressionStatement(BinaryExpression(VariableName,BitOp,VariableName)),
ExpressionStatement(BinaryExpression(VariableName,BitOp,VariableName)),
ExpressionStatement(BinaryExpression(VariableName,BitOp,VariableName)),
ExpressionStatement(BinaryExpression(VariableName,BitOp,VariableName)),
ExpressionStatement(BinaryExpression(UnaryExpression(BitOp,VariableName),BitOp,UnaryExpression(BitOp,VariableName))))
# Relational operators
x < y;
x <= y;
x == y;
x === y;
x != y;
x !== y;
x > y;
x >= y;
==>
Script(
ExpressionStatement(BinaryExpression(VariableName,CompareOp,VariableName)),
ExpressionStatement(BinaryExpression(VariableName,CompareOp,VariableName)),
ExpressionStatement(BinaryExpression(VariableName,CompareOp,VariableName)),
ExpressionStatement(BinaryExpression(VariableName,CompareOp,VariableName)),
ExpressionStatement(BinaryExpression(VariableName,CompareOp,VariableName)),
ExpressionStatement(BinaryExpression(VariableName,CompareOp,VariableName)),
ExpressionStatement(BinaryExpression(VariableName,CompareOp,VariableName)),
ExpressionStatement(BinaryExpression(VariableName,CompareOp,VariableName)))
# Word operators
x in y;
x instanceof y;
!x instanceof y;
==>
Script(
ExpressionStatement(BinaryExpression(VariableName,in,VariableName)),
ExpressionStatement(BinaryExpression(VariableName,instanceof,VariableName)),
ExpressionStatement(BinaryExpression(UnaryExpression(LogicOp,VariableName),instanceof,VariableName)))
# Assignments
x = 0;
x.y = 0;
x["y"] = 0;
async = 0;
[a, b = 2] = foo;
({a, b, ...d} = c);
==>
Script(
ExpressionStatement(AssignmentExpression(VariableName,Equals,Number)),
ExpressionStatement(AssignmentExpression(MemberExpression(VariableName,PropertyName),Equals,Number)),
ExpressionStatement(AssignmentExpression(MemberExpression(VariableName,String),Equals,Number)),
ExpressionStatement(AssignmentExpression(VariableName,Equals,Number)),
ExpressionStatement(AssignmentExpression(ArrayPattern(VariableDefinition,VariableDefinition,Equals,Number),Equals,VariableName)),
ExpressionStatement(ParenthesizedExpression(AssignmentExpression(ObjectPattern(
PatternProperty(PropertyName),PatternProperty(PropertyName),PatternProperty(Spread,VariableDefinition)),Equals,VariableName))))
# Comma operator
a = 1, b = 2;
c = {d: (3, 4 + 5)};
==>
Script(
ExpressionStatement(SequenceExpression(AssignmentExpression(VariableName,Equals,Number),AssignmentExpression(VariableName,Equals,Number))),
ExpressionStatement(AssignmentExpression(VariableName,Equals,ObjectExpression(
Property(PropertyDefinition,ParenthesizedExpression(SequenceExpression(Number,BinaryExpression(Number,ArithOp,Number))))))))
# Punctuation
(foo(1, 2), bar);
==>
Script(ExpressionStatement(ParenthesizedExpression(
"(",SequenceExpression(CallExpression(VariableName,ArgList("(",Number,Number,")")),",",VariableName),")")))
# Doesn't choke on unfinished ternary operator
1?1
==>
Script(ExpressionStatement(ConditionalExpression(Number,LogicOp,Number,⚠)))
# Can handle unterminated template literals
`f
==>
Script(ExpressionStatement(TemplateString(⚠)))
# Ternary with leading-dot number
a?.2:.3
==>
Script(ExpressionStatement(ConditionalExpression(VariableName,LogicOp,Number,LogicOp,Number)))

79
frontend/node_modules/@lezer/javascript/test/jsx.txt generated vendored Normal file
View File

@ -0,0 +1,79 @@
# Self-closing element {"dialect": "jsx"}
<img/>
==>
Script(ExpressionStatement(JSXElement(JSXSelfClosingTag(JSXStartTag,JSXBuiltin(JSXIdentifier),JSXSelfCloseEndTag))))
# Regular element {"dialect": "jsx"}
<Foo>bar</Foo>
==>
Script(ExpressionStatement(JSXElement(
JSXOpenTag(JSXStartTag, JSXIdentifier, JSXEndTag),
JSXText,
JSXCloseTag(JSXStartCloseTag, JSXIdentifier, JSXEndTag))))
# Fragment {"dialect": "jsx"}
<>bar</>
==>
Script(ExpressionStatement(JSXElement(
JSXFragmentTag(JSXStartTag, JSXEndTag),
JSXText,
JSXCloseTag(JSXStartCloseTag, JSXEndTag))))
# Namespaced name {"dialect": "jsx"}
<blah-namespace:img/>
==>
Script(ExpressionStatement(JSXElement(
JSXSelfClosingTag(JSXStartTag,JSXNamespacedName(JSXIdentifier, JSXIdentifier),JSXSelfCloseEndTag))))
# Member name {"dialect": "jsx"}
<pkg.Component/>
==>
Script(ExpressionStatement(JSXElement(
JSXSelfClosingTag(JSXStartTag,JSXMemberExpression(JSXIdentifier, JSXIdentifier),JSXSelfCloseEndTag))))
# Nested tags {"dialect": "jsx"}
<a><b.C>text</b.C>{x} {...y}</a>
==>
Script(ExpressionStatement(JSXElement(
JSXOpenTag(JSXStartTag, JSXBuiltin(JSXIdentifier), JSXEndTag),
JSXElement(
JSXOpenTag(JSXStartTag, JSXMemberExpression(JSXIdentifier, JSXIdentifier), JSXEndTag),
JSXText,
JSXCloseTag(JSXStartCloseTag, JSXMemberExpression(JSXIdentifier, JSXIdentifier), JSXEndTag)),
JSXEscape(VariableName),
JSXText,
JSXEscape(Spread, VariableName),
JSXCloseTag(JSXStartCloseTag, JSXBuiltin(JSXIdentifier), JSXEndTag))))
# Attributes {"dialect": "jsx"}
<Foo a="1" b {...attrs} c={c}></Foo>
==>
Script(ExpressionStatement(JSXElement(
JSXOpenTag(JSXStartTag, JSXIdentifier,
JSXAttribute(JSXIdentifier, Equals, JSXAttributeValue),
JSXAttribute(JSXIdentifier),
JSXSpreadAttribute(Spread, VariableName),
JSXAttribute(JSXIdentifier, Equals, JSXEscape(VariableName)),
JSXEndTag),
JSXCloseTag(JSXStartCloseTag, JSXIdentifier, JSXEndTag))))

View File

@ -0,0 +1,77 @@
# No semicolons
x
if (a) {
var b = c
d
} else
e
==>
Script(
ExpressionStatement(VariableName),
IfStatement(if,ParenthesizedExpression(VariableName),Block(
VariableDeclaration(var,VariableDefinition,Equals,VariableName),
ExpressionStatement(VariableName)),
else,ExpressionStatement(VariableName)))
# Continued expressions on new line
x
+ 2
foo
(bar)
==>
Script(
ExpressionStatement(BinaryExpression(VariableName,ArithOp,Number)),
ExpressionStatement(CallExpression(VariableName,ArgList(VariableName))))
# Doesn't parse postfix ops on a new line
x
++y
==>
Script(
ExpressionStatement(VariableName),
ExpressionStatement(UnaryExpression(ArithOp,VariableName)))
# Eagerly cut return/break/continue
return 2
return
2
continue foo
continue
foo
break bar
break
bar
==>
Script(
ReturnStatement(return,Number),
ReturnStatement(return),
ExpressionStatement(Number),
ContinueStatement(continue,Label),
ContinueStatement(continue),
ExpressionStatement(VariableName),
BreakStatement(break,Label),
BreakStatement(break),
ExpressionStatement(VariableName))
# Cut return regardless of whitespace
{ return }
return // foo
;
==>
Script(Block(ReturnStatement(return)),ReturnStatement(return,LineComment))

View File

@ -0,0 +1,404 @@
# Variable declaration
var a = b
, c = d;
const [x] = y = 3;
==>
Script(
VariableDeclaration(var,VariableDefinition,Equals,VariableName,VariableDefinition,Equals,VariableName),
VariableDeclaration(const,ArrayPattern(VariableDefinition),Equals,AssignmentExpression(VariableName,Equals,Number)))
# Function declaration
function a(a, b) { return 3; }
function b({b}, c = d, e = f) {}
==>
Script(
FunctionDeclaration(function,VariableDefinition,ParamList(VariableDefinition,VariableDefinition),Block(ReturnStatement(return,Number))),
FunctionDeclaration(function,VariableDefinition,ParamList(
ObjectPattern(PatternProperty(PropertyName)),VariableDefinition,Equals,VariableName,VariableDefinition,Equals,VariableName),Block))
# Async functions
async function foo() {}
class Foo { async bar() {} }
async (a) => { return foo; };
==>
Script(
FunctionDeclaration(async,function,VariableDefinition,ParamList,Block),
ClassDeclaration(class,VariableDefinition,ClassBody(MethodDeclaration(async,PropertyDefinition,ParamList,Block))),
ExpressionStatement(ArrowFunction(async,ParamList(VariableDefinition),Arrow,Block(ReturnStatement(return,VariableName)))))
# If statements
if (x) log(y);
if (a.b) {
d;
}
if (a) {
c;
d;
} else {
e;
}
if (1) if (2) b; else c;
==>
Script(
IfStatement(if,ParenthesizedExpression(VariableName),ExpressionStatement(CallExpression(VariableName,ArgList(VariableName)))),
IfStatement(if,ParenthesizedExpression(MemberExpression(VariableName,PropertyName)),Block(ExpressionStatement(VariableName))),
IfStatement(if,ParenthesizedExpression(VariableName),Block(ExpressionStatement(VariableName),ExpressionStatement(VariableName)),
else,Block(ExpressionStatement(VariableName))),
IfStatement(if,ParenthesizedExpression(Number),IfStatement(if,ParenthesizedExpression(Number),ExpressionStatement(VariableName),
else,ExpressionStatement(VariableName))))
# While loop
while (1) debugger;
while (2) {
a;
b;
}
==>
Script(
WhileStatement(while,ParenthesizedExpression(Number),DebuggerStatement(debugger)),
WhileStatement(while,ParenthesizedExpression(Number),Block(ExpressionStatement(VariableName),ExpressionStatement(VariableName))))
# Labels
foo: 1;
foo: while(2) break foo;
==>
Script(
LabeledStatement(Label,ExpressionStatement(Number)),
LabeledStatement(Label,WhileStatement(while,ParenthesizedExpression(Number),BreakStatement(break,Label))))
# Try
try { throw new Error; } catch {}
try { 1; } catch (x) { 2; } finally { 3; }
==>
Script(
TryStatement(try,Block(ThrowStatement(throw,NewExpression(new,VariableName))),CatchClause(catch,Block)),
TryStatement(try,Block(ExpressionStatement(Number)),
CatchClause(catch,VariableDefinition,Block(ExpressionStatement(Number))),
FinallyClause(finally,Block(ExpressionStatement(Number)))))
# Switch
switch (x) {
case 1:
return true;
case 2:
case 50 * 3:
console.log("ok");
default:
return false;
}
==>
Script(SwitchStatement(switch,ParenthesizedExpression(VariableName),SwitchBody(
CaseLabel(case,Number),
ReturnStatement(return,BooleanLiteral),
CaseLabel(case,Number),
CaseLabel(case,BinaryExpression(Number,ArithOp,Number)),
ExpressionStatement(CallExpression(MemberExpression(VariableName,PropertyName),ArgList(String))),
DefaultLabel(default),
ReturnStatement(return,BooleanLiteral))))
# For
for (let x = 1; x < 10; x++) {}
for (const y of z) {}
for (var m in n) {}
for (q in r) {}
for (var a, b; c; d) continue;
for (i = 0, init(); i < 10; i++) {}
for (;;) {}
for (const {thing} in things) thing;
for await (let x of stream) {}
==>
Script(
ForStatement(for,ForSpec(VariableDeclaration(let,VariableDefinition,Equals,Number),
BinaryExpression(VariableName,CompareOp,Number),PostfixExpression(VariableName,ArithOp)),Block),
ForStatement(for,ForOfSpec(const,VariableDefinition,of,VariableName),Block),
ForStatement(for,ForInSpec(var,VariableDefinition,in,VariableName),Block),
ForStatement(for,ForInSpec(VariableName,in,VariableName),Block),
ForStatement(for,ForSpec(VariableDeclaration(var,VariableDefinition,VariableDefinition),VariableName,VariableName),ContinueStatement(continue)),
ForStatement(for,ForSpec(SequenceExpression(AssignmentExpression(VariableName,Equals,Number),
CallExpression(VariableName,ArgList)),BinaryExpression(VariableName,CompareOp,Number),PostfixExpression(VariableName,ArithOp)),Block),
ForStatement(for,ForSpec,Block),
ForStatement(for,ForInSpec(const,ObjectPattern(PatternProperty(PropertyName)),in,VariableName),ExpressionStatement(VariableName)),
ForStatement(for,await,ForOfSpec(let,VariableDefinition,of,VariableName),Block))
# Labeled statements
theLoop: for (;;) {
if (a) {
break theLoop;
}
}
==>
Script(LabeledStatement(Label,ForStatement(for,ForSpec,Block(
IfStatement(if,ParenthesizedExpression(VariableName),Block(BreakStatement(break,Label)))))))
# Classes
class Foo {
static one(a) { return a; };
two(b) { return b; }
finally() {}
}
class Foo extends require('another-class') {
constructor() { super(); }
bar() { super.a(); }
prop;
etc = 20;
static { f() }
}
==>
Script(
ClassDeclaration(class,VariableDefinition,ClassBody(
MethodDeclaration(static,PropertyDefinition,ParamList(VariableDefinition),Block(ReturnStatement(return,VariableName))),
MethodDeclaration(PropertyDefinition,ParamList(VariableDefinition),Block(ReturnStatement(return,VariableName))),
MethodDeclaration(PropertyDefinition,ParamList,Block))),
ClassDeclaration(class,VariableDefinition,extends,CallExpression(VariableName,ArgList(String)),ClassBody(
MethodDeclaration(PropertyDefinition,ParamList,Block(ExpressionStatement(CallExpression(super,ArgList)))),
MethodDeclaration(PropertyDefinition,ParamList,Block(ExpressionStatement(CallExpression(MemberExpression(super,PropertyName),ArgList)))),
PropertyDeclaration(PropertyDefinition),
PropertyDeclaration(PropertyDefinition,Equals,Number),
StaticBlock(static, Block(ExpressionStatement(CallExpression(VariableName,ArgList)))))))
# Private properties
class Foo {
#bar() { this.#a() + this?.#prop == #prop in this; }
#prop;
#etc = 20;
}
==>
Script(ClassDeclaration(class,VariableDefinition,ClassBody(
MethodDeclaration(PrivatePropertyDefinition,ParamList,Block(
ExpressionStatement(BinaryExpression(
BinaryExpression(
CallExpression(MemberExpression(this,PrivatePropertyName),ArgList),
ArithOp,
MemberExpression(this,PrivatePropertyName)),
CompareOp,
BinaryExpression(PrivatePropertyName, in, this))))),
PropertyDeclaration(PrivatePropertyDefinition),
PropertyDeclaration(PrivatePropertyDefinition,Equals,Number))))
# Computed properties
class Foo {
[x] = 44;
[Symbol.iterator]() {}
}
==>
Script(ClassDeclaration(class,VariableDefinition,ClassBody(
PropertyDeclaration(VariableName,Equals,Number),
MethodDeclaration(MemberExpression(VariableName,PropertyName),ParamList,Block))))
# Imports
import defaultMember from "module-name";
import * as name from "module-name";
import { member } from "module-name";
import { member1, member2 as alias2 } from "module-name";
import defaultMember, { member1, member2 as alias2, } from "module-name";
import "module-name";
import defer x from "y";
import defer from "y";
==>
Script(
ImportDeclaration(import,VariableDefinition,from,String),
ImportDeclaration(import,Star,as,VariableDefinition,from,String),
ImportDeclaration(import,ImportGroup(VariableDefinition),from,String),
ImportDeclaration(import,ImportGroup(VariableDefinition,VariableName,as,VariableDefinition),from,String),
ImportDeclaration(import,VariableDefinition,ImportGroup(VariableDefinition,VariableName,as,VariableDefinition),from,String),
ImportDeclaration(import,String),
ImportDeclaration(import,defer,VariableDefinition,from,String),
ImportDeclaration(import,VariableDefinition,from,String))
# Exports
export { name1, name2, name3 as x, nameN };
export let a, b = 2;
export default 2 + 2;
export default function() { }
export default async function name1() { }
export { name1 as default, } from "foo";
export * from 'foo';
==>
Script(
ExportDeclaration(export,ExportGroup(VariableName,VariableName,VariableName,as,VariableName,VariableName)),
ExportDeclaration(export,VariableDeclaration(let,VariableDefinition,VariableDefinition,Equals,Number)),
ExportDeclaration(export,default,BinaryExpression(Number,ArithOp,Number)),
ExportDeclaration(export,default,FunctionDeclaration(function,ParamList,Block)),
ExportDeclaration(export,default,FunctionDeclaration(async,function,VariableDefinition,ParamList,Block)),
ExportDeclaration(export,ExportGroup(VariableName,as,VariableName),from,String),
ExportDeclaration(export,Star,from,String))
# Empty statements
if (true) { ; };;;
==>
Script(IfStatement(if,ParenthesizedExpression(BooleanLiteral),Block))
# Comments
/* a */
one;
/* b **/
two;
/* c ***/
three;
/* d
***/
four;
y // comment
* z;
==>
Script(
BlockComment,
ExpressionStatement(VariableName),
BlockComment,
ExpressionStatement(VariableName),
BlockComment,
ExpressionStatement(VariableName),
BlockComment,
ExpressionStatement(VariableName),
ExpressionStatement(BinaryExpression(VariableName,LineComment,ArithOp,VariableName)))
# Recover from invalid char
const {foobar} = {};
==>
Script(VariableDeclaration(
const,
ObjectPattern("{",PatternProperty(PropertyName,⚠),"}"),
Equals,
ObjectExpression))
# Sync back to statement
function f() {
log(a b --c)
}
function g() {}
==>
Script(
FunctionDeclaration(function,VariableDefinition,ParamList,Block(ExpressionStatement(CallExpression(VariableName,ArgList(...))))),
FunctionDeclaration(function,VariableDefinition,ParamList,Block))
# Destructuring
({x} = y);
[u, v] = w;
let [a,, b = 0] = c;
let {x, y: z = 1} = d;
let {[f]: m} = e;
==>
Script(
ExpressionStatement(ParenthesizedExpression(AssignmentExpression(
ObjectPattern(PatternProperty(PropertyName)),Equals,VariableName))),
ExpressionStatement(AssignmentExpression(ArrayPattern(VariableDefinition,VariableDefinition),Equals,VariableName)),
VariableDeclaration(let,ArrayPattern(VariableDefinition,VariableDefinition,Equals,Number),Equals,VariableName),
VariableDeclaration(let,ObjectPattern(
PatternProperty(PropertyName),
PatternProperty(PropertyName,VariableDefinition,Equals,Number)
),Equals,VariableName),
VariableDeclaration(let,ObjectPattern(PatternProperty(VariableName,VariableDefinition)),Equals,VariableName))
# Generators
function* foo() { yield 1 }
class B {
*method() {}
}
({*x() {}})
==>
Script(
FunctionDeclaration(function,Star,VariableDefinition,ParamList,Block(
ExpressionStatement(YieldExpression(yield,Number)))),
ClassDeclaration(class,VariableDefinition,ClassBody(
MethodDeclaration(Star,PropertyDefinition,ParamList,Block))),
ExpressionStatement(ParenthesizedExpression(ObjectExpression(Property(Star,PropertyDefinition,ParamList,Block)))))
# Hashbang
#!/bin/env node
foo()
==>
Script(Hashbang,ExpressionStatement(CallExpression(VariableName,ArgList)))
# new.target
function MyObj() {
if (!new.target) {
throw new Error('Must construct MyObj with new');
}
}
==>
Script(
FunctionDeclaration(function,VariableDefinition,ParamList,Block(
IfStatement(if,ParenthesizedExpression(UnaryExpression(LogicOp,NewTarget(new,PropertyName))), Block(
ThrowStatement(throw,NewExpression(new,VariableName,ArgList(String))))))))

View File

@ -0,0 +1,17 @@
import {parser} from "../dist/index.js"
import {fileTests} from "@lezer/generator/dist/test"
import * as fs from "fs"
import * as path from "path"
import {fileURLToPath} from "url"
let caseDir = path.dirname(fileURLToPath(import.meta.url))
for (let file of fs.readdirSync(caseDir)) {
if (!/\.txt$/.test(file)) continue
let name = /^[^\.]*/.exec(file)[0]
describe(name, () => {
for (let {name, run} of fileTests(fs.readFileSync(path.join(caseDir, file), "utf8"), file))
it(name, () => run(parser))
})
}

View File

@ -0,0 +1,401 @@
# Undefined and Null Type {"dialect": "ts"}
let x: undefined
let y: null
==>
Script(
VariableDeclaration(let,VariableDefinition,TypeAnnotation(
TypeName)),
VariableDeclaration(let,VariableDefinition,TypeAnnotation(
NullType(null))))
# Type declaration {"dialect": "ts"}
function foo(a: number, b: "literal" | Map<number, boolean>): RegExp[] {}
==>
Script(FunctionDeclaration(function, VariableDefinition, ParamList(
VariableDefinition, TypeAnnotation(TypeName),
VariableDefinition, TypeAnnotation(UnionType(LiteralType(String), LogicOp, ParameterizedType(TypeName, TypeArgList(TypeName, TypeName))))
), TypeAnnotation(ArrayType(TypeName)), Block))
# Type predicate {"dialect": "ts"}
function isFoo(foo: any): foo is Foo { return true }
function assertFoo(foo: any): asserts foo is "string" { return true }
==>
Script(
FunctionDeclaration(function, VariableDefinition, ParamList(
VariableDefinition, TypeAnnotation(TypeName)
), TypePredicate(VariableName, is, TypeName), Block(ReturnStatement(return, BooleanLiteral))),
FunctionDeclaration(function,VariableDefinition,ParamList(
VariableDefinition,TypeAnnotation(TypeName)
),TypePredicate(asserts,VariableName,is,LiteralType(String)),Block(ReturnStatement(return,BooleanLiteral))))
# Type alias {"dialect": "ts"}
type Foo<T extends string> = T[]
==>
Script(TypeAliasDeclaration(type, TypeDefinition, TypeParamList(TypeDefinition, extends, TypeName), Equals, ArrayType(TypeName)))
# Enum declaration {"dialect": "ts"}
const enum Type { Red = 1, Blue, Green }
==>
Script(EnumDeclaration(const, enum, TypeDefinition, EnumBody(PropertyName, Equals, Number, PropertyName, PropertyName)))
# Interface declaration {"dialect": "ts"}
interface Foo {
readonly a: number
b(arg: string): void
(call: number): boolean
new (): Foo
readonly [x: string]: number
}
==>
Script(InterfaceDeclaration(interface, TypeDefinition, ObjectType(
PropertyType(readonly, PropertyDefinition, TypeAnnotation(TypeName)),
MethodType(PropertyDefinition, ParamList(VariableDefinition, TypeAnnotation(TypeName)), TypeAnnotation(VoidType(void))),
CallSignature(ParamList(VariableDefinition, TypeAnnotation(TypeName)), TypeAnnotation(TypeName)),
NewSignature(new,ParamList, TypeAnnotation(TypeName)),
IndexSignature(readonly, PropertyDefinition, TypeAnnotation(TypeName), TypeAnnotation(TypeName)))))
# Call type args {"dialect": "ts"}
foo<number, string>() + new Bar<11>()
x < 10 > 5
==>
Script(
ExpressionStatement(BinaryExpression(
CallExpression(InstantiationExpression(VariableName, TypeArgList(TypeName, TypeName)), ArgList),
ArithOp,
NewExpression(new, InstantiationExpression(VariableName, TypeArgList(LiteralType(Number))), ArgList))),
ExpressionStatement(BinaryExpression(BinaryExpression(VariableName, CompareOp, Number), CompareOp, Number)))
# Advanced types {"dialect": "ts"}
let x: typeof X.x | keyof Y & Z["Foo"] | A<string>
let tuple: [a, b]
let f: (x: number) => boolean
==>
Script(
VariableDeclaration(let, VariableDefinition, TypeAnnotation(
UnionType(TypeofType(typeof, MemberExpression(VariableName, PropertyName)), LogicOp,
IntersectionType(KeyofType(keyof, TypeName), LogicOp, IndexedType(TypeName, LiteralType(String))),
LogicOp, ParameterizedType(TypeName, TypeArgList(TypeName))))),
VariableDeclaration(let, VariableDefinition, TypeAnnotation(TupleType(TypeName, TypeName))),
VariableDeclaration(let, VariableDefinition, TypeAnnotation(FunctionSignature(
ParamList(VariableDefinition, TypeAnnotation(TypeName)), Arrow, TypeName))))
# Prefix union/intersection
let x:
| A
| B
| C
let y: & RegExp & (& Date)
==>
Script(
VariableDeclaration(let,VariableDefinition,TypeAnnotation(
UnionType(LogicOp,TypeName,LogicOp,TypeName,LogicOp,TypeName))),
VariableDeclaration(let,VariableDefinition,TypeAnnotation(
IntersectionType(LogicOp,TypeName,LogicOp,ParenthesizedType(IntersectionType(LogicOp,TypeName))))))
# Prefix cast {"dialect": "ts"}
<string>foo
==>
Script(ExpressionStatement(PrefixCast(TypeName, VariableName)))
# No prefix cast in JSX {"dialect": "ts jsx"}
<string>foo</string>
==>
Script(ExpressionStatement(JSXElement(
JSXOpenTag(JSXStartTag, JSXBuiltin(JSXIdentifier), JSXEndTag),
JSXText,
JSXCloseTag(JSXStartCloseTag, JSXBuiltin(JSXIdentifier), JSXEndTag))))
# Class definition {"dialect": "ts"}
class Foo<T> extends Bar<T> implements Stuff {
a: number
public readonly b: string = "two"
constructor(readonly x: boolean, public y: number, z: string) {}
private static blah(): void {}
}
==>
Script(ClassDeclaration(
class, VariableDefinition, TypeParamList(TypeDefinition),
extends, VariableName, TypeArgList(TypeName),
implements TypeName,
ClassBody(
PropertyDeclaration(PropertyDefinition, TypeAnnotation(TypeName)),
PropertyDeclaration(Privacy, readonly, PropertyDefinition, TypeAnnotation(TypeName), Equals, String),
MethodDeclaration(PropertyDefinition, ParamList(
readonly, VariableDefinition, TypeAnnotation(TypeName),
Privacy, VariableDefinition, TypeAnnotation(TypeName),
VariableDefinition, TypeAnnotation(TypeName)), Block),
MethodDeclaration(Privacy, static, PropertyDefinition, ParamList, TypeAnnotation(VoidType(void)), Block))))
# Arrow with type params {"dialect": "ts"}
let x = <T>(arg: T): T => arg
==>
Script(VariableDeclaration(let, VariableDefinition, Equals, ArrowFunction(
TypeParamList(TypeDefinition),
ParamList(VariableDefinition, TypeAnnotation(TypeName)),
TypeAnnotation(TypeName),
Arrow,
VariableName)))
# Template types {"dialect": "ts"}
type Tmpl<T> = `${string} ${5}` | `one ${Two}`
==>
Script(TypeAliasDeclaration(type, TypeDefinition, TypeParamList(TypeDefinition), Equals,
UnionType(TemplateType(Interpolation(InterpolationStart,TypeName,InterpolationEnd), Interpolation(InterpolationStart,LiteralType(Number),InterpolationEnd)), LogicOp, TemplateType(Interpolation(InterpolationStart,TypeName,InterpolationEnd)))))
# Extending complex types {"dialect": "ts"}
class Foo extends A.B<Param> {}
==>
Script(ClassDeclaration(class, VariableDefinition,
extends, MemberExpression(VariableName, PropertyName), TypeArgList(TypeName),
ClassBody))
# Object type {"dialect": "ts"}
type A = {a: number, b: number}
type B = {a: number; b: number;}
==>
Script(
TypeAliasDeclaration(type,TypeDefinition,Equals,ObjectType(
PropertyType(PropertyDefinition,TypeAnnotation(TypeName)),
PropertyType(PropertyDefinition,TypeAnnotation(TypeName)))),
TypeAliasDeclaration(type,TypeDefinition,Equals,ObjectType(
PropertyType(PropertyDefinition,TypeAnnotation(TypeName)),
PropertyType(PropertyDefinition,TypeAnnotation(TypeName)))))
# Conditional Type {"dialect": "ts"}
type X<T> = T extends E ? number : A
==>
Script(
TypeAliasDeclaration(type,TypeDefinition,TypeParamList(TypeDefinition),Equals,
ConditionalType(TypeName,extends,TypeName,LogicOp,TypeName,LogicOp,TypeName)))
# Generic Function Type {"dialect": "ts"}
let f: <T>() => T
==>
Script(
VariableDeclaration(let,VariableDefinition,TypeAnnotation(
FunctionSignature(TypeParamList(TypeDefinition),ParamList,Arrow,TypeName))))
# Satisfies operator {"dialect": "ts"}
let x = 1 satisfies number
==>
Script(VariableDeclaration(let,VariableDefinition,Equals,BinaryExpression(Number,satisfies,TypeName)))
# Override modifier on properties {"dialect": "ts"}
class A {
override accessor a;
static override b = 1;
override c = 2;
}
==>
Script(ClassDeclaration(class,VariableDefinition,ClassBody(
PropertyDeclaration(override,accessor,PropertyDefinition),
PropertyDeclaration(static,override,PropertyDefinition,Equals,Number),
PropertyDeclaration(override,PropertyDefinition,Equals,Number))))
# Class extending expression {"dialect": "ts"}
class X extends class {} {}
==>
Script(ClassDeclaration(class,VariableDefinition,extends,ClassExpression(class,ClassBody),ClassBody))
# Declare syntax {"dialect": "ts"}
declare namespace myLib {
function makeGreeting(s: string): string;
let numberOfGreetings: number;
}
declare function greet(setting: GreetingSettings): void;
declare class Greeter {
constructor(greeting: string);
greeting: string;
showGreeting(): void;
}
class X {
declare foo();
declare bar: number;
}
==>
Script(
AmbientDeclaration(declare,NamespaceDeclaration(namespace,VariableDefinition,Block(
FunctionDeclaration(function,VariableDefinition,ParamList(VariableDefinition,TypeAnnotation(TypeName)),
TypeAnnotation(TypeName)),
VariableDeclaration(let,VariableDefinition,TypeAnnotation(TypeName))))),
AmbientDeclaration(declare,AmbientFunctionDeclaration(function,VariableDefinition,
ParamList(VariableDefinition,TypeAnnotation(TypeName)),TypeAnnotation(VoidType(void)))),
AmbientDeclaration(declare,ClassDeclaration(class,VariableDefinition,ClassBody(
MethodDeclaration(PropertyDefinition,ParamList(VariableDefinition,TypeAnnotation(TypeName))),
PropertyDeclaration(PropertyDefinition,TypeAnnotation(TypeName)),
MethodDeclaration(PropertyDefinition,ParamList,TypeAnnotation(VoidType(void)))))),
ClassDeclaration(class,VariableDefinition,ClassBody(
MethodDeclaration(declare,PropertyDefinition,ParamList),
PropertyDeclaration(declare,PropertyDefinition,TypeAnnotation(TypeName)))))
# Declare this in a Function {"dialect": "ts"}
function foo(this: User) {}
==>
Script(FunctionDeclaration(function,VariableDefinition,ParamList(this,TypeAnnotation(TypeName)),Block))
# Prefers type parameters to comparison operators {"dialect": "ts jsx"}
let a = useState<string>(1)
return 2
==>
Script(
VariableDeclaration(let,VariableDefinition,Equals,
CallExpression(InstantiationExpression(VariableName,TypeArgList(TypeName)),ArgList(Number))),
ReturnStatement(return,Number))
# Type parameters vs JSX {"dialect": "jsx ts"}
let a = <T extends any>(f) => null
let b = <T,>() => 1
==>
Script(
VariableDeclaration(let,VariableDefinition,Equals,ArrowFunction(
TypeParamList(TypeDefinition,extends,TypeName),ParamList(VariableDefinition),Arrow,null)),
VariableDeclaration(let,VariableDefinition,Equals,ArrowFunction(
TypeParamList(TypeDefinition),ParamList,Arrow,Number)))
# Destructured parameters in function signature {"dialect": "ts"}
type F = ([a, b]: [number, number]) => void
==>
Script(TypeAliasDeclaration(type,TypeDefinition,Equals,FunctionSignature(
ParamList(ArrayPattern(VariableDefinition,VariableDefinition),TypeAnnotation(TupleType(TypeName,TypeName))),
Arrow,
VoidType(void))))
# Instantiated expression {"dialect": "ts"}
let x = a<b>;
type Foo = Bar<typeof baz<Bug<Quux>>>;
==>
Script(
VariableDeclaration(let,VariableDefinition,Equals,InstantiationExpression(VariableName,TypeArgList(TypeName))),
TypeAliasDeclaration(type,TypeDefinition,Equals,ParameterizedType(TypeName,TypeArgList(
TypeofType(typeof,InstantiationExpression(VariableName,TypeArgList(
ParameterizedType(TypeName,TypeArgList(TypeName)))))))))
# Not instantiated {"dialect": "ts"}
let x = a<b>c
==>
Script(VariableDeclaration(let,VariableDefinition,Equals,BinaryExpression(
BinaryExpression(VariableName,CompareOp,VariableName),CompareOp,VariableName)))
# Allows computed properties in types {"dialect": "ts"}
interface X {
[Symbol.iterator](): Iterator<number>
[1]: string
}
==>
Script(InterfaceDeclaration(interface,TypeDefinition,ObjectType(
MethodType(MemberExpression(VariableName,PropertyName),ParamList,
TypeAnnotation(ParameterizedType(TypeName,TypeArgList(TypeName)))),
PropertyType(Number,TypeAnnotation(TypeName)))))
# Binary type operators {"dialect": "ts"}
log(foo as number, {} satisfies AbstractObjectFactory<ParticleEmitter>)
==>
Script(ExpressionStatement(CallExpression(VariableName,ArgList(
BinaryExpression(VariableName,as,TypeName),
BinaryExpression(ObjectExpression,satisfies,ParameterizedType(TypeName,TypeArgList(TypeName)))))))
# Allows this parameters in function types {"dialect": "ts"}
let x: (this: X, expression: string) => Promise<T[]>
==>
Script(VariableDeclaration(let,VariableDefinition,TypeAnnotation(FunctionSignature(
ParamList(this,TypeAnnotation(TypeName),VariableDefinition,TypeAnnotation(TypeName)),
Arrow,
ParameterizedType(TypeName,TypeArgList(ArrayType(TypeName)))))))

21
frontend/node_modules/@lezer/lr/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
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.

25
frontend/node_modules/@lezer/lr/README.md generated vendored Normal file
View File

@ -0,0 +1,25 @@
# @lezer/lr
[ [**WEBSITE**](http://lezer.codemirror.net) | [**ISSUES**](https://github.com/lezer-parser/lezer/issues) | [**FORUM**](https://discuss.codemirror.net/c/lezer) | [**CHANGELOG**](https://github.com/lezer-parser/lr/blob/master/CHANGELOG.md) ]
Lezer ("reader" in Dutch, pronounced pretty much as laser) is an
incremental GLR parser intended for use in an editor or similar
system, which needs to keep a representation of the program current
during changes and in the face of syntax errors.
It prioritizes speed and compactness (both of parser table files and
of syntax tree) over having a highly usable parse tree—trees nodes are
just blobs with a start, end, tag, and set of child nodes, with no
further labeling of child nodes or extra metadata.
This package contains the run-time LR parser library. It consumes
parsers generated by
[@lezer/generator](https://github.com/lezer-parser/generator).
The parser programming interface is documented on [the
website](https://lezer.codemirror.net/docs/ref/#lr).
The code is licensed under an MIT license.
This project was hugely inspired by
[tree-sitter](http://tree-sitter.github.io/tree-sitter/).

45
frontend/node_modules/@lezer/lr/dist/constants.d.ts generated vendored Normal file
View File

@ -0,0 +1,45 @@
export declare const enum Action {
ReduceFlag = 65536,
ValueMask = 65535,
ReduceDepthShift = 19,
RepeatFlag = 131072,
GotoFlag = 131072,
StayFlag = 262144
}
export declare const enum StateFlag {
Skipped = 1,
Accepting = 2
}
export declare const enum Specialize {
Specialize = 0,
Extend = 1
}
export declare const enum Term {
Err = 0
}
export declare const enum Seq {
End = 65535,
Done = 0,
Next = 1,
Other = 2
}
export declare const enum ParseState {
Flags = 0,
Actions = 1,
Skip = 2,
TokenizerMask = 3,
DefaultReduce = 4,
ForcedReduce = 5,
Size = 6
}
export declare const enum Encode {
BigValCode = 126,
BigVal = 65535,
Start = 32,
Gap1 = 34,
Gap2 = 92,
Base = 46
}
export declare const enum File {
Version = 14
}

5
frontend/node_modules/@lezer/lr/dist/constants.js generated vendored Normal file
View File

@ -0,0 +1,5 @@
"use strict";
// This file defines some constants that are needed both in this
// package and in lezer-generator, so that the generator code can
// access them without them being part of lezer's public interface.
exports.__esModule = true;

1890
frontend/node_modules/@lezer/lr/dist/index.cjs generated vendored Normal file

File diff suppressed because it is too large Load Diff

303
frontend/node_modules/@lezer/lr/dist/index.d.cts generated vendored Normal file
View File

@ -0,0 +1,303 @@
import { Tree, NodePropSource, ParseWrapper, Parser, NodeSet, Input, TreeFragment, PartialParse, NodeType } from '@lezer/common';
/**
A parse stack. These are used internally by the parser to track
parsing progress. They also provide some properties and methods
that external code such as a tokenizer can use to get information
about the parse state.
*/
declare class Stack {
/**
The input position up to which this stack has parsed.
*/
pos: number;
/**
The stack's current [context](#lr.ContextTracker) value, if
any. Its type will depend on the context tracker's type
parameter, or it will be `null` if there is no context
tracker.
*/
get context(): any;
/**
Check if the given term would be able to be shifted (optionally
after some reductions) on this stack. This can be useful for
external tokenizers that want to make sure they only provide a
given token when it applies.
*/
canShift(term: number): boolean;
/**
Get the parser used by this stack.
*/
get parser(): LRParser;
/**
Test whether a given dialect (by numeric ID, as exported from
the terms file) is enabled.
*/
dialectEnabled(dialectID: number): boolean;
private shiftContext;
private reduceContext;
private updateContext;
}
/**
[Tokenizers](#lr.ExternalTokenizer) interact with the input
through this interface. It presents the input as a stream of
characters, tracking lookahead and hiding the complexity of
[ranges](#common.Parser.parse^ranges) from tokenizer code.
*/
declare class InputStream {
/**
Backup chunk
*/
private chunk2;
private chunk2Pos;
/**
The character code of the next code unit in the input, or -1
when the stream is at the end of the input.
*/
next: number;
/**
The current position of the stream. Note that, due to parses
being able to cover non-contiguous
[ranges](#common.Parser.startParse), advancing the stream does
not always mean its position moves a single unit.
*/
pos: number;
private rangeIndex;
private range;
/**
Look at a code unit near the stream position. `.peek(0)` equals
`.next`, `.peek(-1)` gives you the previous character, and so
on.
Note that looking around during tokenizing creates dependencies
on potentially far-away content, which may reduce the
effectiveness incremental parsing—when looking forward—or even
cause invalid reparses when looking backward more than 25 code
units, since the library does not track lookbehind.
*/
peek(offset: number): number;
/**
Accept a token. By default, the end of the token is set to the
current stream position, but you can pass an offset (relative to
the stream position) to change that.
*/
acceptToken(token: number, endOffset?: number): void;
/**
Accept a token ending at a specific given position.
*/
acceptTokenTo(token: number, endPos: number): void;
private getChunk;
private readNext;
/**
Move the stream forward N (defaults to 1) code units. Returns
the new value of [`next`](#lr.InputStream.next).
*/
advance(n?: number): number;
private setDone;
}
interface Tokenizer {
}
/**
@hide
*/
declare class LocalTokenGroup implements Tokenizer {
readonly precTable: number;
readonly elseToken?: number | undefined;
contextual: boolean;
fallback: boolean;
extend: boolean;
readonly data: Readonly<Uint16Array>;
constructor(data: Readonly<Uint16Array> | string, precTable: number, elseToken?: number | undefined);
token(input: InputStream, stack: Stack): void;
}
interface ExternalOptions {
/**
When set to true, mark this tokenizer as depending on the
current parse stack, which prevents its result from being cached
between parser actions at the same positions.
*/
contextual?: boolean;
/**
By defaults, when a tokenizer returns a token, that prevents
tokenizers with lower precedence from even running. When
`fallback` is true, the tokenizer is allowed to run when a
previous tokenizer returned a token that didn't match any of the
current state's actions.
*/
fallback?: boolean;
/**
When set to true, tokenizing will not stop after this tokenizer
has produced a token. (But it will still fail to reach this one
if a higher-precedence tokenizer produced a token.)
*/
extend?: boolean;
}
/**
`@external tokens` declarations in the grammar should resolve to
an instance of this class.
*/
declare class ExternalTokenizer {
/**
Create a tokenizer. The first argument is the function that,
given an input stream, scans for the types of tokens it
recognizes at the stream's position, and calls
[`acceptToken`](#lr.InputStream.acceptToken) when it finds
one.
*/
constructor(
/**
@internal
*/
token: (input: InputStream, stack: Stack) => void, options?: ExternalOptions);
}
/**
Context trackers are used to track stateful context (such as
indentation in the Python grammar, or parent elements in the XML
grammar) needed by external tokenizers. You declare them in a
grammar file as `@context exportName from "module"`.
Context values should be immutable, and can be updated (replaced)
on shift or reduce actions.
The export used in a `@context` declaration should be of this
type.
*/
declare class ContextTracker<T> {
/**
Define a context tracker.
*/
constructor(spec: {
/**
The initial value of the context at the start of the parse.
*/
start: T;
/**
Update the context when the parser executes a
[shift](https://en.wikipedia.org/wiki/LR_parser#Shift_and_reduce_actions)
action.
*/
shift?(context: T, term: number, stack: Stack, input: InputStream): T;
/**
Update the context when the parser executes a reduce action.
*/
reduce?(context: T, term: number, stack: Stack, input: InputStream): T;
/**
Update the context when the parser reuses a node from a tree
fragment.
*/
reuse?(context: T, node: Tree, stack: Stack, input: InputStream): T;
/**
Reduce a context value to a number (for cheap storage and
comparison). Only needed for strict contexts.
*/
hash?(context: T): number;
/**
By default, nodes can only be reused during incremental
parsing if they were created in the same context as the one in
which they are reused. Set this to false to disable that
check (and the overhead of storing the hashes).
*/
strict?: boolean;
});
}
/**
Configuration options when
[reconfiguring](#lr.LRParser.configure) a parser.
*/
interface ParserConfig {
/**
Node prop values to add to the parser's node set.
*/
props?: readonly NodePropSource[];
/**
The name of the `@top` declaration to parse from. If not
specified, the first top rule declaration in the grammar is
used.
*/
top?: string;
/**
A space-separated string of dialects to enable.
*/
dialect?: string;
/**
Replace the given external tokenizers with new ones.
*/
tokenizers?: {
from: ExternalTokenizer;
to: ExternalTokenizer;
}[];
/**
Replace external specializers with new ones.
*/
specializers?: {
from: (value: string, stack: Stack) => number;
to: (value: string, stack: Stack) => number;
}[];
/**
Replace the context tracker with a new one.
*/
contextTracker?: ContextTracker<any>;
/**
When true, the parser will raise an exception, rather than run
its error-recovery strategies, when the input doesn't match the
grammar.
*/
strict?: boolean;
/**
Add a wrapper, which can extend parses created by this parser
with additional logic (usually used to add
[mixed-language](#common.parseMixed) parsing).
*/
wrap?: ParseWrapper;
/**
The maximum length of the TreeBuffers generated in the output
tree. Defaults to 1024.
*/
bufferLength?: number;
}
/**
Holds the parse tables for a given grammar, as generated by
`lezer-generator`, and provides [methods](#common.Parser) to parse
content with.
*/
declare class LRParser extends Parser {
/**
The nodes used in the trees emitted by this parser.
*/
readonly nodeSet: NodeSet;
createParse(input: Input, fragments: readonly TreeFragment[], ranges: readonly {
from: number;
to: number;
}[]): PartialParse;
/**
Configure the parser. Returns a new parser instance that has the
given settings modified. Settings not provided in `config` are
kept from the original parser.
*/
configure(config: ParserConfig): LRParser;
/**
Tells you whether any [parse wrappers](#lr.ParserConfig.wrap)
are registered for this parser.
*/
hasWrappers(): boolean;
/**
Returns the name associated with a given term. This will only
work for all terms when the parser was generated with the
`--names` option. By default, only the names of tagged terms are
stored.
*/
getName(term: number): string;
/**
The type of top node produced by the parser.
*/
get topNode(): NodeType;
/**
Used by the output of the parser generator. Not available to
user code. @hide
*/
static deserialize(spec: any): LRParser;
}
export { ContextTracker, ExternalTokenizer, InputStream, LRParser, LocalTokenGroup, type ParserConfig, Stack };

303
frontend/node_modules/@lezer/lr/dist/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,303 @@
import { Tree, NodePropSource, ParseWrapper, Parser, NodeSet, Input, TreeFragment, PartialParse, NodeType } from '@lezer/common';
/**
A parse stack. These are used internally by the parser to track
parsing progress. They also provide some properties and methods
that external code such as a tokenizer can use to get information
about the parse state.
*/
declare class Stack {
/**
The input position up to which this stack has parsed.
*/
pos: number;
/**
The stack's current [context](#lr.ContextTracker) value, if
any. Its type will depend on the context tracker's type
parameter, or it will be `null` if there is no context
tracker.
*/
get context(): any;
/**
Check if the given term would be able to be shifted (optionally
after some reductions) on this stack. This can be useful for
external tokenizers that want to make sure they only provide a
given token when it applies.
*/
canShift(term: number): boolean;
/**
Get the parser used by this stack.
*/
get parser(): LRParser;
/**
Test whether a given dialect (by numeric ID, as exported from
the terms file) is enabled.
*/
dialectEnabled(dialectID: number): boolean;
private shiftContext;
private reduceContext;
private updateContext;
}
/**
[Tokenizers](#lr.ExternalTokenizer) interact with the input
through this interface. It presents the input as a stream of
characters, tracking lookahead and hiding the complexity of
[ranges](#common.Parser.parse^ranges) from tokenizer code.
*/
declare class InputStream {
/**
Backup chunk
*/
private chunk2;
private chunk2Pos;
/**
The character code of the next code unit in the input, or -1
when the stream is at the end of the input.
*/
next: number;
/**
The current position of the stream. Note that, due to parses
being able to cover non-contiguous
[ranges](#common.Parser.startParse), advancing the stream does
not always mean its position moves a single unit.
*/
pos: number;
private rangeIndex;
private range;
/**
Look at a code unit near the stream position. `.peek(0)` equals
`.next`, `.peek(-1)` gives you the previous character, and so
on.
Note that looking around during tokenizing creates dependencies
on potentially far-away content, which may reduce the
effectiveness incremental parsing—when looking forward—or even
cause invalid reparses when looking backward more than 25 code
units, since the library does not track lookbehind.
*/
peek(offset: number): number;
/**
Accept a token. By default, the end of the token is set to the
current stream position, but you can pass an offset (relative to
the stream position) to change that.
*/
acceptToken(token: number, endOffset?: number): void;
/**
Accept a token ending at a specific given position.
*/
acceptTokenTo(token: number, endPos: number): void;
private getChunk;
private readNext;
/**
Move the stream forward N (defaults to 1) code units. Returns
the new value of [`next`](#lr.InputStream.next).
*/
advance(n?: number): number;
private setDone;
}
interface Tokenizer {
}
/**
@hide
*/
declare class LocalTokenGroup implements Tokenizer {
readonly precTable: number;
readonly elseToken?: number | undefined;
contextual: boolean;
fallback: boolean;
extend: boolean;
readonly data: Readonly<Uint16Array>;
constructor(data: Readonly<Uint16Array> | string, precTable: number, elseToken?: number | undefined);
token(input: InputStream, stack: Stack): void;
}
interface ExternalOptions {
/**
When set to true, mark this tokenizer as depending on the
current parse stack, which prevents its result from being cached
between parser actions at the same positions.
*/
contextual?: boolean;
/**
By defaults, when a tokenizer returns a token, that prevents
tokenizers with lower precedence from even running. When
`fallback` is true, the tokenizer is allowed to run when a
previous tokenizer returned a token that didn't match any of the
current state's actions.
*/
fallback?: boolean;
/**
When set to true, tokenizing will not stop after this tokenizer
has produced a token. (But it will still fail to reach this one
if a higher-precedence tokenizer produced a token.)
*/
extend?: boolean;
}
/**
`@external tokens` declarations in the grammar should resolve to
an instance of this class.
*/
declare class ExternalTokenizer {
/**
Create a tokenizer. The first argument is the function that,
given an input stream, scans for the types of tokens it
recognizes at the stream's position, and calls
[`acceptToken`](#lr.InputStream.acceptToken) when it finds
one.
*/
constructor(
/**
@internal
*/
token: (input: InputStream, stack: Stack) => void, options?: ExternalOptions);
}
/**
Context trackers are used to track stateful context (such as
indentation in the Python grammar, or parent elements in the XML
grammar) needed by external tokenizers. You declare them in a
grammar file as `@context exportName from "module"`.
Context values should be immutable, and can be updated (replaced)
on shift or reduce actions.
The export used in a `@context` declaration should be of this
type.
*/
declare class ContextTracker<T> {
/**
Define a context tracker.
*/
constructor(spec: {
/**
The initial value of the context at the start of the parse.
*/
start: T;
/**
Update the context when the parser executes a
[shift](https://en.wikipedia.org/wiki/LR_parser#Shift_and_reduce_actions)
action.
*/
shift?(context: T, term: number, stack: Stack, input: InputStream): T;
/**
Update the context when the parser executes a reduce action.
*/
reduce?(context: T, term: number, stack: Stack, input: InputStream): T;
/**
Update the context when the parser reuses a node from a tree
fragment.
*/
reuse?(context: T, node: Tree, stack: Stack, input: InputStream): T;
/**
Reduce a context value to a number (for cheap storage and
comparison). Only needed for strict contexts.
*/
hash?(context: T): number;
/**
By default, nodes can only be reused during incremental
parsing if they were created in the same context as the one in
which they are reused. Set this to false to disable that
check (and the overhead of storing the hashes).
*/
strict?: boolean;
});
}
/**
Configuration options when
[reconfiguring](#lr.LRParser.configure) a parser.
*/
interface ParserConfig {
/**
Node prop values to add to the parser's node set.
*/
props?: readonly NodePropSource[];
/**
The name of the `@top` declaration to parse from. If not
specified, the first top rule declaration in the grammar is
used.
*/
top?: string;
/**
A space-separated string of dialects to enable.
*/
dialect?: string;
/**
Replace the given external tokenizers with new ones.
*/
tokenizers?: {
from: ExternalTokenizer;
to: ExternalTokenizer;
}[];
/**
Replace external specializers with new ones.
*/
specializers?: {
from: (value: string, stack: Stack) => number;
to: (value: string, stack: Stack) => number;
}[];
/**
Replace the context tracker with a new one.
*/
contextTracker?: ContextTracker<any>;
/**
When true, the parser will raise an exception, rather than run
its error-recovery strategies, when the input doesn't match the
grammar.
*/
strict?: boolean;
/**
Add a wrapper, which can extend parses created by this parser
with additional logic (usually used to add
[mixed-language](#common.parseMixed) parsing).
*/
wrap?: ParseWrapper;
/**
The maximum length of the TreeBuffers generated in the output
tree. Defaults to 1024.
*/
bufferLength?: number;
}
/**
Holds the parse tables for a given grammar, as generated by
`lezer-generator`, and provides [methods](#common.Parser) to parse
content with.
*/
declare class LRParser extends Parser {
/**
The nodes used in the trees emitted by this parser.
*/
readonly nodeSet: NodeSet;
createParse(input: Input, fragments: readonly TreeFragment[], ranges: readonly {
from: number;
to: number;
}[]): PartialParse;
/**
Configure the parser. Returns a new parser instance that has the
given settings modified. Settings not provided in `config` are
kept from the original parser.
*/
configure(config: ParserConfig): LRParser;
/**
Tells you whether any [parse wrappers](#lr.ParserConfig.wrap)
are registered for this parser.
*/
hasWrappers(): boolean;
/**
Returns the name associated with a given term. This will only
work for all terms when the parser was generated with the
`--names` option. By default, only the names of tagged terms are
stored.
*/
getName(term: number): string;
/**
The type of top node produced by the parser.
*/
get topNode(): NodeType;
/**
Used by the output of the parser generator. Not available to
user code. @hide
*/
static deserialize(spec: any): LRParser;
}
export { ContextTracker, ExternalTokenizer, InputStream, LRParser, LocalTokenGroup, type ParserConfig, Stack };

1883
frontend/node_modules/@lezer/lr/dist/index.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

32
frontend/node_modules/@lezer/lr/package.json generated vendored Normal file
View File

@ -0,0 +1,32 @@
{
"name": "@lezer/lr",
"version": "1.4.3",
"description": "Incremental parser",
"main": "dist/index.cjs",
"type": "module",
"exports": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"module": "dist/index.js",
"types": "dist/index.d.ts",
"author": "Marijn Haverbeke <marijn@haverbeke.berlin>",
"license": "MIT",
"repository": {
"type" : "git",
"url" : "https://github.com/lezer-parser/lr.git"
},
"devDependencies": {
"@marijn/buildtool": "^0.1.5",
"@types/node": "^20.6.2"
},
"dependencies": {
"@lezer/common": "^1.0.0"
},
"files": ["dist"],
"scripts": {
"test": "echo 'Tests are in @lezer/generator'",
"watch": "node build.js --watch",
"prepare": "node build.js; tsc src/constants.ts -d --outDir dist"
}
}

261
frontend/node_modules/@lezer/markdown/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,261 @@
## 1.6.0 (2025-11-03)
### Bug fixes
When a composite block adds a node while ending, make sure the composite node covers that end token.
### New features
Export the opening delimiters used for standard links and images, so that extension code can look for them.
## 1.5.1 (2025-10-20)
### Bug fixes
Fix an issue where `findOpeningDelimiter` could return the position of a close delimiter.
## 1.5.0 (2025-10-18)
### New features
A `getDelimiterAt` method on inline contexts makes it possible to get information about opening delimiters.
## 1.4.3 (2025-04-27)
### Bug fixes
Run the HTML parser on HTML comment blocks, since those may include non-comment content at their end.
## 1.4.2 (2025-02-24)
### Bug fixes
Move some dependencies to dev dependencies.
## 1.4.1 (2025-02-07)
### Bug fixes
Make sure TypeScript's new resolution styles can find the type declarations for the CommonJS files.
## 1.4.0 (2025-01-07)
### Bug fixes
Fix a regression in the autolink extension that made it fail to match some kinds of email addresses.
### New features
The new `BlockContext.peekLine` method can be used to scan the line ahead of the current one.
## 1.3.2 (2024-10-29)
### Bug fixes
Fix a quadratic slowdown in the Autolink extension on parsing text containing extremely long words.
## 1.3.1 (2024-09-02)
### Bug fixes
Fix emphasis parsing to properly test for punctuation on platforms that support regular expression unicode categories.
Fix an issue where dashes right after a paragraph weren't parsed as horizontal rules when setext headers are disabled.
## 1.3.0 (2024-04-03)
### Bug fixes
GFM autolinks will no longer include the closing bracket of a surrounding link or image.
### New features
`InlineContext.hasOpenLink` can now be used to query whether there is an unclosed link or image marker before the current token.
## 1.2.0 (2023-12-25)
### Bug fixes
Properly require whitespace before link titles. Parse autolinks as their own nodes
### New features
Wrap autolinks in an `Autolink` syntax node, rather than just `URL`, and exclude the wrapping angle brackets from the `URL` nodes.
## 1.1.2 (2023-12-07)
### Bug fixes
Fix a bug that could cause blockquote markers to be attached to the wrong parent node, causing them to overlap with sibling syntax nodes.
## 1.1.1 (2023-11-17)
### Bug fixes
Make sure GFM autolinking accepts URLs like test.co.uk
Fix a bug in `Autolink` that made it fail to accept some URLs with hyphens.
## 1.1.0 (2023-08-03)
### New features
The new `Autolink` extension (included in the `GFM` extension bundle) marks some types of URLs even without angle brackets.
## 1.0.5 (2023-06-30)
### Bug fixes
Fix another issue in reuse of nodes when the input has gaps.
## 1.0.4 (2023-06-29)
### Bug fixes
Fix another bug in incremental parsing across input gaps.
## 1.0.3 (2023-06-22)
### Bug fixes
Only parse list items as tasks when there is whitespace after the checkbox brackets. Remove an unnecessary regexp operator
Fix a crash doing an incremental parse on input ranges with gaps between them.
## 1.0.2 (2022-09-21)
### Bug fixes
In the stikethrough extension, ignore opening marks with a space after and closing marks with a space before them.
## 1.0.1 (2022-06-29)
### Bug fixes
Fix a crash that could occur when there were gaps in the parseable ranges right at the start of a line.
## 1.0.0 (2022-06-06)
### New features
First stable version.
## 0.16.1 (2022-05-20)
### Bug fixes
Fix a bug that prevented style tags from built-in extensions from being applied.
## 0.16.0 (2022-04-20)
### New features
This package now attached highlighting information to its syntax tree.
It is now possible to include highlighting information when defining nodes in extensions via `NodeSpec.style`.
## 0.15.6 (2022-03-18)
### Bug fixes
Fix a bug where GFM tables occurring directly below a paragraph weren't recognized.
## 0.15.5 (2022-02-18)
### New features
The `BlockContext` type now has a `depth` property providing the amount of parent nodes, and a `parentType` method allowing code to inspect the type of those nodes.
## 0.15.4 (2022-02-02)
### Bug fixes
Fix compatibility fallback for engines with RegExp `\p` support.
## 0.15.3 (2021-12-13)
### Bug fixes
Fix a bug where, if there were multiple extensions passed to the editor, the `wrap` option got dropped from the resulting configuration.
## 0.15.2 (2021-11-08)
### Bug fixes
Fix a bug where an ordered list item after a nested bullet list would get treated as part of the bullet list item.
## 0.15.1 (2021-10-11)
### Bug fixes
Fix a bug that caused `endLeafBlock` configuration to be ignored by the parser.
## 0.15.0 (2021-08-11)
### Breaking changes
The module name has changed from `lezer-markdown` to `@lezer/markdown`.
`MarkdownParser` now extends `Parser` and follows its interface.
The Markdown parser no longer has its own support for nested parsing (but can be wrapped with `parseCode` to get a similar effect).
### New features
The new `parseCode` function can be used to set up a mixed-language parser for Markdown.
## 0.14.5 (2021-05-12)
### Bug fixes
Fix an issue were continued paragraph lines starting with tabs could cause the parser to create a tree with invalid node positions.
## 0.14.4 (2021-03-09)
### Bug fixes
Fix a bug where an unterminated nested code block could call a nested parser with a start position beyond the end of the document.
Fix a bug where the parser could return an invalid tree when `forceFinish` was called during a nested parse.
## 0.14.3 (2021-02-22)
### Breaking changes
`parseInline` has been moved to `MarkdownParser` so that it can also be called from an inline context.
### New features
Heading nodes now have different types based on their level.
The `elt` helper method can now be called with a `Tree` to wrap the result of a nested parse in an element.
The `startNested` method is now exported.
## 0.14.2 (2021-02-12)
### Bug fixes
`BlockParser.parse`'s exported type was missing an argument.
Fix a bug that would cause incorrect offsets for children nested two deep in an element passed to `BlockContext.addElement`.
## 0.14.1 (2021-02-11)
### Bug fixes
Fix table parsing when header cells are empty.
## 0.14.0 (2021-02-10)
### New features
Add an extension interface. The `configure` method now takes more options, allowing client code to define new syntax node types and parse logic.
Add extensions for subscript, superscript, strikethrough, tables, and task lists to the distribution.
## 0.13.0 (2020-12-04)
### Breaking changes
First numbered release.

21
frontend/node_modules/@lezer/markdown/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (C) 2020 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
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.

725
frontend/node_modules/@lezer/markdown/README.md generated vendored Normal file
View File

@ -0,0 +1,725 @@
<!-- /README.md is generated from /src/README.md -->
# @lezer/markdown
This is an incremental Markdown ([CommonMark](https://commonmark.org/)
with support for extension) parser that integrates well with the
[Lezer](https://lezer.codemirror.net/) parser system. It does not in
fact use the Lezer runtime (that runs LR parsers, and Markdown can't
really be parsed that way), but it produces Lezer-style compact syntax
trees and consumes fragments of such trees for its incremental
parsing.
Note that this only _parses_ the document, producing a data structure
that represents its syntactic form, and doesn't help with outputting
HTML. Also, in order to be single-pass and incremental, it doesn't do
some things that a conforming CommonMark parser is expected to
do—specifically, it doesn't validate link references, so it'll parse
`[a][b]` and similar as a link, even if no `[b]` reference is
declared.
The
[@codemirror/lang-markdown](https://github.com/codemirror/lang-markdown)
package integrates this parser with CodeMirror to provide Markdown
editor support.
The code is licensed under an MIT license.
## Interface
<dl>
<dt id="user-content-parser">
<code><strong><a href="#user-content-parser">parser</a></strong>: <a href="#user-content-markdownparser">MarkdownParser</a></code></dt>
<dd><p>The default CommonMark parser.</p>
</dd>
</dl>
<dl>
<dt id="user-content-markdownparser">
<h4>
<code>class</code>
<a href="#user-content-markdownparser">MarkdownParser</a> <code>extends <a href="https://lezer.codemirror.net/docs/ref/#common.Parser">Parser</a></code></h4>
</dt>
<dd><p>A Markdown parser configuration.</p>
<dl><dt id="user-content-markdownparser.nodeset">
<code><strong><a href="#user-content-markdownparser.nodeset">nodeSet</a></strong>: <a href="https://lezer.codemirror.net/docs/ref/#common.NodeSet">NodeSet</a></code></dt>
<dd><p>The parser's syntax <a href="https://lezer.codemirror.net/docs/ref/#common.NodeSet">node
types</a>.</p>
</dd><dt id="user-content-markdownparser.configure">
<code><strong><a href="#user-content-markdownparser.configure">configure</a></strong>(<a id="user-content-markdownparser.configure^spec" href="#user-content-markdownparser.configure^spec">spec</a>: <a href="#user-content-markdownextension">MarkdownExtension</a>) → <a href="#user-content-markdownparser">MarkdownParser</a></code></dt>
<dd><p>Reconfigure the parser.</p>
</dd><dt id="user-content-markdownparser.parseinline">
<code><strong><a href="#user-content-markdownparser.parseinline">parseInline</a></strong>(<a id="user-content-markdownparser.parseinline^text" href="#user-content-markdownparser.parseinline^text">text</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>, <a id="user-content-markdownparser.parseinline^offset" href="#user-content-markdownparser.parseinline^offset">offset</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>) → <a href="#user-content-element">Element</a>[]</code></dt>
<dd><p>Parse the given piece of inline text at the given offset,
returning an array of <a href="#user-content-element"><code>Element</code></a> objects representing
the inline content.</p>
</dd></dl>
</dd>
</dl>
<dl>
<dt id="user-content-markdownconfig">
<h4>
<code>interface</code>
<a href="#user-content-markdownconfig">MarkdownConfig</a></h4>
</dt>
<dd><p>Objects of this type are used to
<a href="#user-content-markdownparser.configure">configure</a> the Markdown parser.</p>
<dl><dt id="user-content-markdownconfig.props">
<code><strong><a href="#user-content-markdownconfig.props">props</a></strong>&#8288;?: readonly <a href="https://lezer.codemirror.net/docs/ref/#common.NodePropSource">NodePropSource</a>[]</code></dt>
<dd><p>Node props to add to the parser's node set.</p>
</dd><dt id="user-content-markdownconfig.definenodes">
<code><strong><a href="#user-content-markdownconfig.definenodes">defineNodes</a></strong>&#8288;?: readonly (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a> | <a href="#user-content-nodespec">NodeSpec</a>)[]</code></dt>
<dd><p>Define new <a href="#user-content-nodespec">node types</a> for use in parser extensions.</p>
</dd><dt id="user-content-markdownconfig.parseblock">
<code><strong><a href="#user-content-markdownconfig.parseblock">parseBlock</a></strong>&#8288;?: readonly <a href="#user-content-blockparser">BlockParser</a>[]</code></dt>
<dd><p>Define additional <a href="#user-content-blockparser">block parsing</a> logic.</p>
</dd><dt id="user-content-markdownconfig.parseinline">
<code><strong><a href="#user-content-markdownconfig.parseinline">parseInline</a></strong>&#8288;?: readonly <a href="#user-content-inlineparser">InlineParser</a>[]</code></dt>
<dd><p>Define new <a href="#user-content-inlineparser">inline parsing</a> logic.</p>
</dd><dt id="user-content-markdownconfig.remove">
<code><strong><a href="#user-content-markdownconfig.remove">remove</a></strong>&#8288;?: readonly <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>[]</code></dt>
<dd><p>Remove the named parsers from the configuration.</p>
</dd><dt id="user-content-markdownconfig.wrap">
<code><strong><a href="#user-content-markdownconfig.wrap">wrap</a></strong>&#8288;?: <a href="https://lezer.codemirror.net/docs/ref/#common.ParseWrapper">ParseWrapper</a></code></dt>
<dd><p>Add a parse wrapper (such as a <a href="#user-content-common.parsemixed">mixed-language
parser</a>) to this parser.</p>
</dd></dl>
</dd>
</dl>
<dl>
<dt id="user-content-markdownextension">
<code>type</code>
<code><strong><a href="#user-content-markdownextension">MarkdownExtension</a></strong> = <a href="#user-content-markdownconfig">MarkdownConfig</a> | readonly <a href="#user-content-markdownextension">MarkdownExtension</a>[]</code>
</dt>
<dd><p>To make it possible to group extensions together into bigger
extensions (such as the <a href="#user-content-gfm">Github-flavored Markdown</a>
extension), <a href="#user-content-markdownparser.configure">reconfiguration</a> accepts
nested arrays of <a href="#user-content-markdownconfig">config</a> objects.</p>
</dd>
</dl>
<dl>
<dt id="user-content-parsecode">
<code><strong><a href="#user-content-parsecode">parseCode</a></strong>(<a id="user-content-parsecode^config" href="#user-content-parsecode^config">config</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>) → <a href="#user-content-markdownextension">MarkdownExtension</a></code></dt>
<dd><p>Create a Markdown extension to enable nested parsing on code
blocks and/or embedded HTML.</p>
<dl><dt id="user-content-parsecode^config">
<code><strong><a href="#user-content-parsecode^config">config</a></strong></code></dt>
<dd><dl><dt id="user-content-parsecode^config.codeparser">
<code><strong><a href="#user-content-parsecode^config.codeparser">codeParser</a></strong>&#8288;?: fn(<a id="user-content-parsecode^config.codeparser^info" href="#user-content-parsecode^config.codeparser^info">info</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>) → <a href="https://lezer.codemirror.net/docs/ref/#common.Parser">Parser</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null">null</a></code></dt>
<dd><p>When provided, this will be used to parse the content of code
blocks. <code>info</code> is the string after the opening <code>```</code> marker,
or the empty string if there is no such info or this is an
indented code block. If there is a parser available for the
code, it should return a function that can construct the
<a href="https://lezer.codemirror.net/docs/ref/#common.PartialParse">parse</a>.</p>
</dd><dt id="user-content-parsecode^config.htmlparser">
<code><strong><a href="#user-content-parsecode^config.htmlparser">htmlParser</a></strong>&#8288;?: <a href="https://lezer.codemirror.net/docs/ref/#common.Parser">Parser</a></code></dt>
<dd><p>The parser used to parse HTML tags (both block and inline).</p>
</dd></dl></dd></dl></dd>
</dl>
### GitHub Flavored Markdown
<dl>
<dt id="user-content-gfm">
<code><strong><a href="#user-content-gfm">GFM</a></strong>: <a href="#user-content-markdownconfig">MarkdownConfig</a>[]</code></dt>
<dd><p>Extension bundle containing <a href="#user-content-table"><code>Table</code></a>,
<a href="#user-content-tasklist"><code>TaskList</code></a>, <a href="#user-content-strikethrough"><code>Strikethrough</code></a>, and
<a href="#user-content-autolink"><code>Autolink</code></a>.</p>
</dd>
</dl>
<dl>
<dt id="user-content-table">
<code><strong><a href="#user-content-table">Table</a></strong>: <a href="#user-content-markdownconfig">MarkdownConfig</a></code></dt>
<dd><p>This extension provides
<a href="https://github.github.com/gfm/#tables-extension-">GFM-style</a>
tables, using syntax like this:</p>
<pre><code>| head 1 | head 2 |
| --- | --- |
| cell 1 | cell 2 |
</code></pre>
</dd>
</dl>
<dl>
<dt id="user-content-tasklist">
<code><strong><a href="#user-content-tasklist">TaskList</a></strong>: <a href="#user-content-markdownconfig">MarkdownConfig</a></code></dt>
<dd><p>Extension providing
<a href="https://github.github.com/gfm/#task-list-items-extension-">GFM-style</a>
task list items, where list items can be prefixed with <code>[ ]</code> or
<code>[x]</code> to add a checkbox.</p>
</dd>
</dl>
<dl>
<dt id="user-content-strikethrough">
<code><strong><a href="#user-content-strikethrough">Strikethrough</a></strong>: <a href="#user-content-markdownconfig">MarkdownConfig</a></code></dt>
<dd><p>An extension that implements
<a href="https://github.github.com/gfm/#strikethrough-extension-">GFM-style</a>
Strikethrough syntax using <code>~~</code> delimiters.</p>
</dd>
</dl>
<dl>
<dt id="user-content-autolink">
<code><strong><a href="#user-content-autolink">Autolink</a></strong>: <a href="#user-content-markdownconfig">MarkdownConfig</a></code></dt>
<dd><p>Extension that implements autolinking for
<code>www.</code>/<code>http://</code>/<code>https://</code>/<code>mailto:</code>/<code>xmpp:</code> URLs and email
addresses.</p>
</dd>
</dl>
### Other extensions
<dl>
<dt id="user-content-subscript">
<code><strong><a href="#user-content-subscript">Subscript</a></strong>: <a href="#user-content-markdownconfig">MarkdownConfig</a></code></dt>
<dd><p>Extension providing
<a href="https://pandoc.org/MANUAL.html#superscripts-and-subscripts">Pandoc-style</a>
subscript using <code>~</code> markers.</p>
</dd>
</dl>
<dl>
<dt id="user-content-superscript">
<code><strong><a href="#user-content-superscript">Superscript</a></strong>: <a href="#user-content-markdownconfig">MarkdownConfig</a></code></dt>
<dd><p>Extension providing
<a href="https://pandoc.org/MANUAL.html#superscripts-and-subscripts">Pandoc-style</a>
superscript using <code>^</code> markers.</p>
</dd>
</dl>
<dl>
<dt id="user-content-emoji">
<code><strong><a href="#user-content-emoji">Emoji</a></strong>: <a href="#user-content-markdownconfig">MarkdownConfig</a></code></dt>
<dd><p>Extension that parses two colons with only letters, underscores,
and numbers between them as <code>Emoji</code> nodes.</p>
</dd>
</dl>
### Extension
The parser can, to a certain extent, be extended to handle additional
syntax.
<dl>
<dt id="user-content-nodespec">
<h4>
<code>interface</code>
<a href="#user-content-nodespec">NodeSpec</a></h4>
</dt>
<dd><p>Used in the <a href="#user-content-markdownconfig.definenodes">configuration</a> to define
new <a href="https://lezer.codemirror.net/docs/ref/#common.NodeType">syntax node
types</a>.</p>
<dl><dt id="user-content-nodespec.name">
<code><strong><a href="#user-content-nodespec.name">name</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></dt>
<dd><p>The node's name.</p>
</dd><dt id="user-content-nodespec.block">
<code><strong><a href="#user-content-nodespec.block">block</a></strong>&#8288;?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></dt>
<dd><p>Should be set to true if this type represents a block node.</p>
</dd><dt id="user-content-nodespec.composite">
<code><strong><a href="#user-content-nodespec.composite">composite</a></strong>&#8288;?: fn(<a id="user-content-nodespec.composite^cx" href="#user-content-nodespec.composite^cx">cx</a>: <a href="#user-content-blockcontext">BlockContext</a>, <a id="user-content-nodespec.composite^line" href="#user-content-nodespec.composite^line">line</a>: <a href="#user-content-line">Line</a>, <a id="user-content-nodespec.composite^value" href="#user-content-nodespec.composite^value">value</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></dt>
<dd><p>If this is a composite block, this should hold a function that,
at the start of a new line where that block is active, checks
whether the composite block should continue (return value) and
optionally <a href="#user-content-line.movebase">adjusts</a> the line's base position
and <a href="#user-content-line.addmarker">registers</a> nodes for any markers involved
in the block's syntax.</p>
</dd><dt id="user-content-nodespec.style">
<code><strong><a href="#user-content-nodespec.style">style</a></strong>&#8288;?: <a href="https://lezer.codemirror.net/docs/ref/#highlight.Tag">Tag</a> | readonly <a href="https://lezer.codemirror.net/docs/ref/#highlight.Tag">Tag</a>[] | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>&lt;<a href="https://lezer.codemirror.net/docs/ref/#highlight.Tag">Tag</a> | readonly <a href="https://lezer.codemirror.net/docs/ref/#highlight.Tag">Tag</a>[]&gt;</code></dt>
<dd><p>Add highlighting tag information for this node. The value of
this property may either by a tag or array of tags to assign
directly to this node, or an object in the style of
<a href="https://lezer.codemirror.net/docs/ref/#highlight.styleTags"><code>styleTags</code></a>'s
argument to assign more complicated rules.</p>
</dd></dl>
</dd>
</dl>
<dl>
<dt id="user-content-blockcontext">
<h4>
<code>class</code>
<a href="#user-content-blockcontext">BlockContext</a> <code>implements <a href="https://lezer.codemirror.net/docs/ref/#common.PartialParse">PartialParse</a></code></h4>
</dt>
<dd><p>Block-level parsing functions get access to this context object.</p>
<dl><dt id="user-content-blockcontext.linestart">
<code><strong><a href="#user-content-blockcontext.linestart">lineStart</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>The start of the current line.</p>
</dd><dt id="user-content-blockcontext.parser">
<code><strong><a href="#user-content-blockcontext.parser">parser</a></strong>: <a href="#user-content-markdownparser">MarkdownParser</a></code></dt>
<dd><p>The parser configuration used.</p>
</dd><dt id="user-content-blockcontext.depth">
<code><strong><a href="#user-content-blockcontext.depth">depth</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>The number of parent blocks surrounding the current block.</p>
</dd><dt id="user-content-blockcontext.parenttype">
<code><strong><a href="#user-content-blockcontext.parenttype">parentType</a></strong>(<a id="user-content-blockcontext.parenttype^depth" href="#user-content-blockcontext.parenttype^depth">depth</a>&#8288;?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a> = this.depth - 1) → <a href="https://lezer.codemirror.net/docs/ref/#common.NodeType">NodeType</a></code></dt>
<dd><p>Get the type of the parent block at the given depth. When no
depth is passed, return the type of the innermost parent.</p>
</dd><dt id="user-content-blockcontext.nextline">
<code><strong><a href="#user-content-blockcontext.nextline">nextLine</a></strong>() → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></dt>
<dd><p>Move to the next input line. This should only be called by
(non-composite) <a href="#user-content-blockparser.parse">block parsers</a> that consume
the line directly, or leaf block parser
<a href="#user-content-leafblockparser.nextline"><code>nextLine</code></a> methods when they
consume the current line (and return true).</p>
</dd><dt id="user-content-blockcontext.peekline">
<code><strong><a href="#user-content-blockcontext.peekline">peekLine</a></strong>() → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></dt>
<dd><p>Retrieve the text of the line after the current one, without
actually moving the context's current line forward.</p>
</dd><dt id="user-content-blockcontext.prevlineend">
<code><strong><a href="#user-content-blockcontext.prevlineend">prevLineEnd</a></strong>() → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>The end position of the previous line.</p>
</dd><dt id="user-content-blockcontext.startcomposite">
<code><strong><a href="#user-content-blockcontext.startcomposite">startComposite</a></strong>(<a id="user-content-blockcontext.startcomposite^type" href="#user-content-blockcontext.startcomposite^type">type</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>, <a id="user-content-blockcontext.startcomposite^start" href="#user-content-blockcontext.startcomposite^start">start</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, <a id="user-content-blockcontext.startcomposite^value" href="#user-content-blockcontext.startcomposite^value">value</a>&#8288;?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a> = 0)</code></dt>
<dd><p>Start a composite block. Should only be called from <a href="#user-content-blockparser.parse">block
parser functions</a> that return null.</p>
</dd><dt id="user-content-blockcontext.addelement">
<code><strong><a href="#user-content-blockcontext.addelement">addElement</a></strong>(<a id="user-content-blockcontext.addelement^elt" href="#user-content-blockcontext.addelement^elt">elt</a>: <a href="#user-content-element">Element</a>)</code></dt>
<dd><p>Add a block element. Can be called by <a href="#user-content-blockparser.parse">block
parsers</a>.</p>
</dd><dt id="user-content-blockcontext.addleafelement">
<code><strong><a href="#user-content-blockcontext.addleafelement">addLeafElement</a></strong>(<a id="user-content-blockcontext.addleafelement^leaf" href="#user-content-blockcontext.addleafelement^leaf">leaf</a>: <a href="#user-content-leafblock">LeafBlock</a>, <a id="user-content-blockcontext.addleafelement^elt" href="#user-content-blockcontext.addleafelement^elt">elt</a>: <a href="#user-content-element">Element</a>)</code></dt>
<dd><p>Add a block element from a <a href="#user-content-leafblockparser">leaf parser</a>. This
makes sure any extra composite block markup (such as blockquote
markers) inside the block are also added to the syntax tree.</p>
</dd><dt id="user-content-blockcontext.elt">
<code><strong><a href="#user-content-blockcontext.elt">elt</a></strong>(<a id="user-content-blockcontext.elt^type" href="#user-content-blockcontext.elt^type">type</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>, <a id="user-content-blockcontext.elt^from" href="#user-content-blockcontext.elt^from">from</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, <a id="user-content-blockcontext.elt^to" href="#user-content-blockcontext.elt^to">to</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, <a id="user-content-blockcontext.elt^children" href="#user-content-blockcontext.elt^children">children</a>&#8288;?: readonly <a href="#user-content-element">Element</a>[]) → <a href="#user-content-element">Element</a></code><div><code><strong><a href="#user-content-blockcontext.elt">elt</a></strong>(<a id="user-content-blockcontext.elt^tree" href="#user-content-blockcontext.elt^tree">tree</a>: <a href="https://lezer.codemirror.net/docs/ref/#common.Tree">Tree</a>, <a id="user-content-blockcontext.elt^at" href="#user-content-blockcontext.elt^at">at</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>) → <a href="#user-content-element">Element</a></code></div></dt>
<dd><p>Create an <a href="#user-content-element"><code>Element</code></a> object to represent some syntax
node.</p>
</dd></dl>
</dd>
</dl>
<dl>
<dt id="user-content-blockparser">
<h4>
<code>interface</code>
<a href="#user-content-blockparser">BlockParser</a></h4>
</dt>
<dd><p>Block parsers handle block-level structure. There are three
general types of block parsers:</p>
<ul>
<li>
<p>Composite block parsers, which handle things like lists and
blockquotes. These define a <a href="#user-content-blockparser.parse"><code>parse</code></a> method
that <a href="#user-content-blockcontext.startcomposite">starts</a> a composite block
and returns null when it recognizes its syntax.</p>
</li>
<li>
<p>Eager leaf block parsers, used for things like code or HTML
blocks. These can unambiguously recognize their content from its
first line. They define a <a href="#user-content-blockparser.parse"><code>parse</code></a> method
that, if it recognizes the construct,
<a href="#user-content-blockcontext.nextline">moves</a> the current line forward to the
line beyond the end of the block,
<a href="#user-content-blockcontext.addelement">add</a> a syntax node for the block, and
return true.</p>
</li>
<li>
<p>Leaf block parsers that observe a paragraph-like construct as it
comes in, and optionally decide to handle it at some point. This
is used for &quot;setext&quot; (underlined) headings and link references.
These define a <a href="#user-content-blockparser.leaf"><code>leaf</code></a> method that checks
the first line of the block and returns a
<a href="#user-content-leafblockparser"><code>LeafBlockParser</code></a> object if it wants to
observe that block.</p>
</li>
</ul>
<dl><dt id="user-content-blockparser.name">
<code><strong><a href="#user-content-blockparser.name">name</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></dt>
<dd><p>The name of the parser. Can be used by other block parsers to
<a href="#user-content-blockparser.before">specify</a> precedence.</p>
</dd><dt id="user-content-blockparser.parse">
<code><strong><a href="#user-content-blockparser.parse">parse</a></strong>&#8288;?: fn(<a id="user-content-blockparser.parse^cx" href="#user-content-blockparser.parse^cx">cx</a>: <a href="#user-content-blockcontext">BlockContext</a>, <a id="user-content-blockparser.parse^line" href="#user-content-blockparser.parse^line">line</a>: <a href="#user-content-line">Line</a>) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null">null</a></code></dt>
<dd><p>The eager parse function, which can look at the block's first
line and return <code>false</code> to do nothing, <code>true</code> if it has parsed
(and <a href="#user-content-blockcontext.nextline">moved past</a> a block), or <code>null</code> if
it has started a composite block.</p>
</dd><dt id="user-content-blockparser.leaf">
<code><strong><a href="#user-content-blockparser.leaf">leaf</a></strong>&#8288;?: fn(<a id="user-content-blockparser.leaf^cx" href="#user-content-blockparser.leaf^cx">cx</a>: <a href="#user-content-blockcontext">BlockContext</a>, <a id="user-content-blockparser.leaf^leaf" href="#user-content-blockparser.leaf^leaf">leaf</a>: <a href="#user-content-leafblock">LeafBlock</a>) → <a href="#user-content-leafblockparser">LeafBlockParser</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null">null</a></code></dt>
<dd><p>A leaf parse function. If no <a href="#user-content-blockparser.parse">regular</a> parse
functions match for a given line, its content will be
accumulated for a paragraph-style block. This method can return
an <a href="#user-content-leafblockparser">object</a> that overrides that style of
parsing in some situations.</p>
</dd><dt id="user-content-blockparser.endleaf">
<code><strong><a href="#user-content-blockparser.endleaf">endLeaf</a></strong>&#8288;?: fn(<a id="user-content-blockparser.endleaf^cx" href="#user-content-blockparser.endleaf^cx">cx</a>: <a href="#user-content-blockcontext">BlockContext</a>, <a id="user-content-blockparser.endleaf^line" href="#user-content-blockparser.endleaf^line">line</a>: <a href="#user-content-line">Line</a>, <a id="user-content-blockparser.endleaf^leaf" href="#user-content-blockparser.endleaf^leaf">leaf</a>: <a href="#user-content-leafblock">LeafBlock</a>) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></dt>
<dd><p>Some constructs, such as code blocks or newly started
blockquotes, can interrupt paragraphs even without a blank line.
If your construct can do this, provide a predicate here that
recognizes lines that should end a paragraph (or other non-eager
<a href="#user-content-blockparser.leaf">leaf block</a>).</p>
</dd><dt id="user-content-blockparser.before">
<code><strong><a href="#user-content-blockparser.before">before</a></strong>&#8288;?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></dt>
<dd><p>When given, this parser will be installed directly before the
block parser with the given name. The default configuration
defines block parsers with names LinkReference, IndentedCode,
FencedCode, Blockquote, HorizontalRule, BulletList, OrderedList,
ATXHeading, HTMLBlock, and SetextHeading.</p>
</dd><dt id="user-content-blockparser.after">
<code><strong><a href="#user-content-blockparser.after">after</a></strong>&#8288;?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></dt>
<dd><p>When given, the parser will be installed directly <em>after</em> the
parser with the given name.</p>
</dd></dl>
</dd>
</dl>
<dl>
<dt id="user-content-leafblockparser">
<h4>
<code>interface</code>
<a href="#user-content-leafblockparser">LeafBlockParser</a></h4>
</dt>
<dd><p>Objects that are used to <a href="#user-content-blockparser.leaf">override</a>
paragraph-style blocks should conform to this interface.</p>
<dl><dt id="user-content-leafblockparser.nextline">
<code><strong><a href="#user-content-leafblockparser.nextline">nextLine</a></strong>(<a id="user-content-leafblockparser.nextline^cx" href="#user-content-leafblockparser.nextline^cx">cx</a>: <a href="#user-content-blockcontext">BlockContext</a>, <a id="user-content-leafblockparser.nextline^line" href="#user-content-leafblockparser.nextline^line">line</a>: <a href="#user-content-line">Line</a>, <a id="user-content-leafblockparser.nextline^leaf" href="#user-content-leafblockparser.nextline^leaf">leaf</a>: <a href="#user-content-leafblock">LeafBlock</a>) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></dt>
<dd><p>Update the parser's state for the next line, and optionally
finish the block. This is not called for the first line (the
object is constructed at that line), but for any further lines.
When it returns <code>true</code>, the block is finished. It is okay for
the function to <a href="#user-content-blockcontext.nextline">consume</a> the current
line or any subsequent lines when returning true.</p>
</dd><dt id="user-content-leafblockparser.finish">
<code><strong><a href="#user-content-leafblockparser.finish">finish</a></strong>(<a id="user-content-leafblockparser.finish^cx" href="#user-content-leafblockparser.finish^cx">cx</a>: <a href="#user-content-blockcontext">BlockContext</a>, <a id="user-content-leafblockparser.finish^leaf" href="#user-content-leafblockparser.finish^leaf">leaf</a>: <a href="#user-content-leafblock">LeafBlock</a>) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></dt>
<dd><p>Called when the block is finished by external circumstances
(such as a blank line or the <a href="#user-content-blockparser.endleaf">start</a> of
another construct). If this parser can handle the block up to
its current position, it should
<a href="#user-content-blockcontext.addleafelement">finish</a> the block and return
true.</p>
</dd></dl>
</dd>
</dl>
<dl>
<dt id="user-content-line">
<h4>
<code>class</code>
<a href="#user-content-line">Line</a></h4>
</dt>
<dd><p>Data structure used during block-level per-line parsing.</p>
<dl><dt id="user-content-line.text">
<code><strong><a href="#user-content-line.text">text</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></dt>
<dd><p>The line's full text.</p>
</dd><dt id="user-content-line.baseindent">
<code><strong><a href="#user-content-line.baseindent">baseIndent</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>The base indent provided by the composite contexts (that have
been handled so far).</p>
</dd><dt id="user-content-line.basepos">
<code><strong><a href="#user-content-line.basepos">basePos</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>The string position corresponding to the base indent.</p>
</dd><dt id="user-content-line.pos">
<code><strong><a href="#user-content-line.pos">pos</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>The position of the next non-whitespace character beyond any
list, blockquote, or other composite block markers.</p>
</dd><dt id="user-content-line.indent">
<code><strong><a href="#user-content-line.indent">indent</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>The column of the next non-whitespace character.</p>
</dd><dt id="user-content-line.next">
<code><strong><a href="#user-content-line.next">next</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>The character code of the character after <code>pos</code>.</p>
</dd><dt id="user-content-line.skipspace">
<code><strong><a href="#user-content-line.skipspace">skipSpace</a></strong>(<a id="user-content-line.skipspace^from" href="#user-content-line.skipspace^from">from</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>Skip whitespace after the given position, return the position of
the next non-space character or the end of the line if there's
only space after <code>from</code>.</p>
</dd><dt id="user-content-line.movebase">
<code><strong><a href="#user-content-line.movebase">moveBase</a></strong>(<a id="user-content-line.movebase^to" href="#user-content-line.movebase^to">to</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)</code></dt>
<dd><p>Move the line's base position forward to the given position.
This should only be called by composite <a href="#user-content-blockparser.parse">block
parsers</a> or <a href="#user-content-nodespec.composite">markup skipping
functions</a>.</p>
</dd><dt id="user-content-line.movebasecolumn">
<code><strong><a href="#user-content-line.movebasecolumn">moveBaseColumn</a></strong>(<a id="user-content-line.movebasecolumn^indent" href="#user-content-line.movebasecolumn^indent">indent</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)</code></dt>
<dd><p>Move the line's base position forward to the given <em>column</em>.</p>
</dd><dt id="user-content-line.addmarker">
<code><strong><a href="#user-content-line.addmarker">addMarker</a></strong>(<a id="user-content-line.addmarker^elt" href="#user-content-line.addmarker^elt">elt</a>: <a href="#user-content-element">Element</a>)</code></dt>
<dd><p>Store a composite-block-level marker. Should be called from
<a href="#user-content-nodespec.composite">markup skipping functions</a> when they
consume any non-whitespace characters.</p>
</dd><dt id="user-content-line.countindent">
<code><strong><a href="#user-content-line.countindent">countIndent</a></strong>(<a id="user-content-line.countindent^to" href="#user-content-line.countindent^to">to</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, <a id="user-content-line.countindent^from" href="#user-content-line.countindent^from">from</a>&#8288;?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a> = 0, <a id="user-content-line.countindent^indent" href="#user-content-line.countindent^indent">indent</a>&#8288;?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a> = 0) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>Find the column position at <code>to</code>, optionally starting at a given
position and column.</p>
</dd><dt id="user-content-line.findcolumn">
<code><strong><a href="#user-content-line.findcolumn">findColumn</a></strong>(<a id="user-content-line.findcolumn^goal" href="#user-content-line.findcolumn^goal">goal</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>Find the position corresponding to the given column.</p>
</dd></dl>
</dd>
</dl>
<dl>
<dt id="user-content-leafblock">
<h4>
<code>class</code>
<a href="#user-content-leafblock">LeafBlock</a></h4>
</dt>
<dd><p>Data structure used to accumulate a block's content during <a href="#user-content-blockparser.leaf">leaf
block parsing</a>.</p>
<dl><dt id="user-content-leafblock.parsers">
<code><strong><a href="#user-content-leafblock.parsers">parsers</a></strong>: <a href="#user-content-leafblockparser">LeafBlockParser</a>[]</code></dt>
<dd><p>The block parsers active for this block.</p>
</dd><dt id="user-content-leafblock.start">
<code><strong><a href="#user-content-leafblock.start">start</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>The start position of the block.</p>
</dd><dt id="user-content-leafblock.content">
<code><strong><a href="#user-content-leafblock.content">content</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></dt>
<dd><p>The block's text content.</p>
</dd></dl>
</dd>
</dl>
<dl>
<dt id="user-content-inlinecontext">
<h4>
<code>class</code>
<a href="#user-content-inlinecontext">InlineContext</a></h4>
</dt>
<dd><p>Inline parsing functions get access to this context, and use it to
read the content and emit syntax nodes.</p>
<dl><dt id="user-content-inlinecontext.parser">
<code><strong><a href="#user-content-inlinecontext.parser">parser</a></strong>: <a href="#user-content-markdownparser">MarkdownParser</a></code></dt>
<dd><p>The parser that is being used.</p>
</dd><dt id="user-content-inlinecontext.text">
<code><strong><a href="#user-content-inlinecontext.text">text</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></dt>
<dd><p>The text of this inline section.</p>
</dd><dt id="user-content-inlinecontext.offset">
<code><strong><a href="#user-content-inlinecontext.offset">offset</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>The starting offset of the section in the document.</p>
</dd><dt id="user-content-inlinecontext.char">
<code><strong><a href="#user-content-inlinecontext.char">char</a></strong>(<a id="user-content-inlinecontext.char^pos" href="#user-content-inlinecontext.char^pos">pos</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>Get the character code at the given (document-relative)
position.</p>
</dd><dt id="user-content-inlinecontext.end">
<code><strong><a href="#user-content-inlinecontext.end">end</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>The position of the end of this inline section.</p>
</dd><dt id="user-content-inlinecontext.slice">
<code><strong><a href="#user-content-inlinecontext.slice">slice</a></strong>(<a id="user-content-inlinecontext.slice^from" href="#user-content-inlinecontext.slice^from">from</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, <a id="user-content-inlinecontext.slice^to" href="#user-content-inlinecontext.slice^to">to</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></dt>
<dd><p>Get a substring of this inline section. Again uses
document-relative positions.</p>
</dd><dt id="user-content-inlinecontext.adddelimiter">
<code><strong><a href="#user-content-inlinecontext.adddelimiter">addDelimiter</a></strong>(<a id="user-content-inlinecontext.adddelimiter^type" href="#user-content-inlinecontext.adddelimiter^type">type</a>: <a href="#user-content-delimitertype">DelimiterType</a>, <a id="user-content-inlinecontext.adddelimiter^from" href="#user-content-inlinecontext.adddelimiter^from">from</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, <a id="user-content-inlinecontext.adddelimiter^to" href="#user-content-inlinecontext.adddelimiter^to">to</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, <a id="user-content-inlinecontext.adddelimiter^open" href="#user-content-inlinecontext.adddelimiter^open">open</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>, <a id="user-content-inlinecontext.adddelimiter^close" href="#user-content-inlinecontext.adddelimiter^close">close</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>Add a <a href="#user-content-delimitertype">delimiter</a> at this given position. <code>open</code>
and <code>close</code> indicate whether this delimiter is opening, closing,
or both. Returns the end of the delimiter, for convenient
returning from <a href="#user-content-inlineparser.parse">parse functions</a>.</p>
</dd><dt id="user-content-inlinecontext.hasopenlink">
<code><strong><a href="#user-content-inlinecontext.hasopenlink">hasOpenLink</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></dt>
<dd><p>Returns true when there is an unmatched link or image opening
token before the current position.</p>
</dd><dt id="user-content-inlinecontext.addelement">
<code><strong><a href="#user-content-inlinecontext.addelement">addElement</a></strong>(<a id="user-content-inlinecontext.addelement^elt" href="#user-content-inlinecontext.addelement^elt">elt</a>: <a href="#user-content-element">Element</a>) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>Add an inline element. Returns the end of the element.</p>
</dd><dt id="user-content-inlinecontext.findopeningdelimiter">
<code><strong><a href="#user-content-inlinecontext.findopeningdelimiter">findOpeningDelimiter</a></strong>(<a id="user-content-inlinecontext.findopeningdelimiter^type" href="#user-content-inlinecontext.findopeningdelimiter^type">type</a>: <a href="#user-content-delimitertype">DelimiterType</a>) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null">null</a></code></dt>
<dd><p>Find an opening delimiter of the given type. Returns <code>null</code> if
no delimiter is found, or an index that can be passed to
<a href="#user-content-inlinecontext.takecontent"><code>takeContent</code></a> otherwise.</p>
</dd><dt id="user-content-inlinecontext.takecontent">
<code><strong><a href="#user-content-inlinecontext.takecontent">takeContent</a></strong>(<a id="user-content-inlinecontext.takecontent^startindex" href="#user-content-inlinecontext.takecontent^startindex">startIndex</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>) → <a href="#user-content-element">Element</a>[]</code></dt>
<dd><p>Remove all inline elements and delimiters starting from the
given index (which you should get from
<a href="#user-content-inlinecontext.findopeningdelimiter"><code>findOpeningDelimiter</code></a>,
resolve delimiters inside of them, and return them as an array
of elements.</p>
</dd><dt id="user-content-inlinecontext.getdelimiterat">
<code><strong><a href="#user-content-inlinecontext.getdelimiterat">getDelimiterAt</a></strong>(<a id="user-content-inlinecontext.getdelimiterat^index" href="#user-content-inlinecontext.getdelimiterat^index">index</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>) → {from: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, to: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, type: <a href="#user-content-delimitertype">DelimiterType</a>} | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null">null</a></code></dt>
<dd><p>Return the delimiter at the given index. Mostly useful to get
additional info out of a delimiter index returned by
<a href="#user-content-inlinecontext.findopeningdelimiter"><code>findOpeningDelimiter</code></a>.
Returns null if there is no delimiter at this index.</p>
</dd><dt id="user-content-inlinecontext.skipspace">
<code><strong><a href="#user-content-inlinecontext.skipspace">skipSpace</a></strong>(<a id="user-content-inlinecontext.skipspace^from" href="#user-content-inlinecontext.skipspace^from">from</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>Skip space after the given (document) position, returning either
the position of the next non-space character or the end of the
section.</p>
</dd><dt id="user-content-inlinecontext.elt">
<code><strong><a href="#user-content-inlinecontext.elt">elt</a></strong>(<a id="user-content-inlinecontext.elt^type" href="#user-content-inlinecontext.elt^type">type</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>, <a id="user-content-inlinecontext.elt^from" href="#user-content-inlinecontext.elt^from">from</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, <a id="user-content-inlinecontext.elt^to" href="#user-content-inlinecontext.elt^to">to</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, <a id="user-content-inlinecontext.elt^children" href="#user-content-inlinecontext.elt^children">children</a>&#8288;?: readonly <a href="#user-content-element">Element</a>[]) → <a href="#user-content-element">Element</a></code><div><code><strong><a href="#user-content-inlinecontext.elt">elt</a></strong>(<a id="user-content-inlinecontext.elt^tree" href="#user-content-inlinecontext.elt^tree">tree</a>: <a href="https://lezer.codemirror.net/docs/ref/#common.Tree">Tree</a>, <a id="user-content-inlinecontext.elt^at" href="#user-content-inlinecontext.elt^at">at</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>) → <a href="#user-content-element">Element</a></code></div></dt>
<dd><p>Create an <a href="#user-content-element"><code>Element</code></a> for a syntax node.</p>
</dd><dt id="user-content-inlinecontext^linkstart">
<code>static <strong><a href="#user-content-inlinecontext^linkstart">linkStart</a></strong>: <a href="#user-content-delimitertype">DelimiterType</a></code></dt>
<dd><p>The opening delimiter type used by the standard link parser.</p>
</dd><dt id="user-content-inlinecontext^imagestart">
<code>static <strong><a href="#user-content-inlinecontext^imagestart">imageStart</a></strong>: <a href="#user-content-delimitertype">DelimiterType</a></code></dt>
<dd><p>Opening delimiter type used for standard images.</p>
</dd></dl>
</dd>
</dl>
<dl>
<dt id="user-content-inlineparser">
<h4>
<code>interface</code>
<a href="#user-content-inlineparser">InlineParser</a></h4>
</dt>
<dd><p>Inline parsers are called for every character of parts of the
document that are parsed as inline content.</p>
<dl><dt id="user-content-inlineparser.name">
<code><strong><a href="#user-content-inlineparser.name">name</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></dt>
<dd><p>This parser's name, which can be used by other parsers to
<a href="#user-content-inlineparser.before">indicate</a> a relative precedence.</p>
</dd><dt id="user-content-inlineparser.parse">
<code><strong><a href="#user-content-inlineparser.parse">parse</a></strong>(<a id="user-content-inlineparser.parse^cx" href="#user-content-inlineparser.parse^cx">cx</a>: <a href="#user-content-inlinecontext">InlineContext</a>, <a id="user-content-inlineparser.parse^next" href="#user-content-inlineparser.parse^next">next</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>, <a id="user-content-inlineparser.parse^pos" href="#user-content-inlineparser.parse^pos">pos</a>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>) → <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>The parse function. Gets the next character and its position as
arguments. Should return -1 if it doesn't handle the character,
or add some <a href="#user-content-inlinecontext.addelement">element</a> or
<a href="#user-content-inlinecontext.adddelimiter">delimiter</a> and return the end
position of the content it parsed if it can.</p>
</dd><dt id="user-content-inlineparser.before">
<code><strong><a href="#user-content-inlineparser.before">before</a></strong>&#8288;?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></dt>
<dd><p>When given, this parser will be installed directly before the
parser with the given name. The default configuration defines
inline parsers with names Escape, Entity, InlineCode, HTMLTag,
Emphasis, HardBreak, Link, and Image. When no <code>before</code> or
<code>after</code> property is given, the parser is added to the end of the
list.</p>
</dd><dt id="user-content-inlineparser.after">
<code><strong><a href="#user-content-inlineparser.after">after</a></strong>&#8288;?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></dt>
<dd><p>When given, the parser will be installed directly <em>after</em> the
parser with the given name.</p>
</dd></dl>
</dd>
</dl>
<dl>
<dt id="user-content-delimitertype">
<h4>
<code>interface</code>
<a href="#user-content-delimitertype">DelimiterType</a></h4>
</dt>
<dd><p>Delimiters are used during inline parsing to store the positions
of things that <em>might</em> be delimiters, if another matching
delimiter is found. They are identified by objects with these
properties.</p>
<dl><dt id="user-content-delimitertype.resolve">
<code><strong><a href="#user-content-delimitertype.resolve">resolve</a></strong>&#8288;?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></dt>
<dd><p>If this is given, the delimiter should be matched automatically
when a piece of inline content is finished. Such delimiters will
be matched with delimiters of the same type according to their
<a href="#user-content-inlinecontext.adddelimiter">open and close</a> properties. When a
match is found, the content between the delimiters is wrapped in
a node whose name is given by the value of this property.</p>
<p>When this isn't given, you need to match the delimiter eagerly
using the <a href="#user-content-inlinecontext.findopeningdelimiter"><code>findOpeningDelimiter</code></a>
and <a href="#user-content-inlinecontext.takecontent"><code>takeContent</code></a> methods.</p>
</dd><dt id="user-content-delimitertype.mark">
<code><strong><a href="#user-content-delimitertype.mark">mark</a></strong>&#8288;?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></dt>
<dd><p>If the delimiter itself should, when matched, create a syntax
node, set this to the name of the syntax node.</p>
</dd></dl>
</dd>
</dl>
<dl>
<dt id="user-content-element">
<h4>
<code>class</code>
<a href="#user-content-element">Element</a></h4>
</dt>
<dd><p>Elements are used to compose syntax nodes during parsing.</p>
<dl><dt id="user-content-element.type">
<code><strong><a href="#user-content-element.type">type</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>The node's
<a href="https://lezer.codemirror.net/docs/ref/#common.NodeType.id">id</a>.</p>
</dd><dt id="user-content-element.from">
<code><strong><a href="#user-content-element.from">from</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>The start of the node, as an offset from the start of the document.</p>
</dd><dt id="user-content-element.to">
<code><strong><a href="#user-content-element.to">to</a></strong>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></dt>
<dd><p>The end of the node.</p>
</dd></dl>
</dd>
</dl>

View File

@ -0,0 +1,39 @@
// Build github-proof readmes that contain the package's API
// docs as HTML.
const {gather} = require("getdocs-ts")
const {build} = require("builddocs")
const {join} = require("path"), fs = require("fs")
let root = join(__dirname, "..")
function buildReadme() {
let template = fs.readFileSync(join(root, "src", "README.md"), "utf8")
let placeholders = template.match(/\n@\w+(?=\n|$)/g), dummy = placeholders.join("\n\n<hr>\n\n")
let html = build({
mainText: dummy,
anchorPrefix: "",
allowUnresolvedTypes: false,
imports: [type => {
if (/\bcommon\b/.test(type.typeSource))
return `https://lezer.codemirror.net/docs/ref/#common.${type.type}`
if (/\blr\b/.test(type.typeSource))
return `https://lezer.codemirror.net/docs/ref/#lr.${type.type}`
if (/\bhighlight\b/.test(type.typeSource))
return `https://lezer.codemirror.net/docs/ref/#highlight.${type.type}`
if (type.type == "NodeSet") console.log(type.typeSource)
}]
}, gather({filename: join(root, "src", "index.ts"), basedir: join(root, "src"), }))
html = html.replace(/<\/?span.*?>/g, "")
.replace(/id="(.*?)"/g, (_, id) => `id="user-content-${id.toLowerCase()}"`)
.replace(/href="#(.*?)"/g, (_, id) => `href="#user-content-${id.toLowerCase()}"`)
let pieces = html.split("\n<hr>\n")
let i = 0
return template.replace(/\n@\w+(?=\n|$)/g, _ => pieces[i++])
}
fs.writeFileSync(join(root, "README.md"), buildReadme())

16
frontend/node_modules/@lezer/markdown/build.js generated vendored Normal file
View File

@ -0,0 +1,16 @@
import {build, watch} from "@marijn/buildtool"
import {fileURLToPath} from "url"
import {dirname, join} from "path"
let tsOptions = {
lib: ["es5", "es6"],
target: "es6"
}
let main = join(dirname(fileURLToPath(import.meta.url)), "src", "index.ts")
if (process.argv.includes("--watch")) {
watch([main], [], {tsOptions})
} else {
build(main, {tsOptions})
}

2344
frontend/node_modules/@lezer/markdown/dist/index.cjs generated vendored Normal file

File diff suppressed because it is too large Load Diff

600
frontend/node_modules/@lezer/markdown/dist/index.d.cts generated vendored Normal file
View File

@ -0,0 +1,600 @@
import { PartialParse, Tree, NodeType, NodePropSource, ParseWrapper, Parser, NodeSet, Input, TreeFragment } from '@lezer/common';
import { Tag } from '@lezer/highlight';
/**
Data structure used to accumulate a block's content during [leaf
block parsing](#BlockParser.leaf).
*/
declare class LeafBlock {
/**
The start position of the block.
*/
readonly start: number;
/**
The block's text content.
*/
content: string;
/**
The block parsers active for this block.
*/
parsers: LeafBlockParser[];
}
/**
Data structure used during block-level per-line parsing.
*/
declare class Line {
/**
The line's full text.
*/
text: string;
/**
The base indent provided by the composite contexts (that have
been handled so far).
*/
baseIndent: number;
/**
The string position corresponding to the base indent.
*/
basePos: number;
/**
The position of the next non-whitespace character beyond any
list, blockquote, or other composite block markers.
*/
pos: number;
/**
The column of the next non-whitespace character.
*/
indent: number;
/**
The character code of the character after `pos`.
*/
next: number;
/**
Skip whitespace after the given position, return the position of
the next non-space character or the end of the line if there's
only space after `from`.
*/
skipSpace(from: number): number;
/**
Move the line's base position forward to the given position.
This should only be called by composite [block
parsers](#BlockParser.parse) or [markup skipping
functions](#NodeSpec.composite).
*/
moveBase(to: number): void;
/**
Move the line's base position forward to the given _column_.
*/
moveBaseColumn(indent: number): void;
/**
Store a composite-block-level marker. Should be called from
[markup skipping functions](#NodeSpec.composite) when they
consume any non-whitespace characters.
*/
addMarker(elt: Element): void;
/**
Find the column position at `to`, optionally starting at a given
position and column.
*/
countIndent(to: number, from?: number, indent?: number): number;
/**
Find the position corresponding to the given column.
*/
findColumn(goal: number): number;
}
type BlockResult = boolean | null;
/**
Block-level parsing functions get access to this context object.
*/
declare class BlockContext implements PartialParse {
/**
The parser configuration used.
*/
readonly parser: MarkdownParser;
private line;
private atEnd;
private fragments;
private to;
stoppedAt: number | null;
/**
The start of the current line.
*/
lineStart: number;
get parsedPos(): number;
advance(): Tree | null;
stopAt(pos: number): void;
private reuseFragment;
/**
The number of parent blocks surrounding the current block.
*/
get depth(): number;
/**
Get the type of the parent block at the given depth. When no
depth is passed, return the type of the innermost parent.
*/
parentType(depth?: number): NodeType;
/**
Move to the next input line. This should only be called by
(non-composite) [block parsers](#BlockParser.parse) that consume
the line directly, or leaf block parser
[`nextLine`](#LeafBlockParser.nextLine) methods when they
consume the current line (and return true).
*/
nextLine(): boolean;
/**
Retrieve the text of the line after the current one, without
actually moving the context's current line forward.
*/
peekLine(): string;
private moveRangeI;
private lineChunkAt;
/**
The end position of the previous line.
*/
prevLineEnd(): number;
/**
Start a composite block. Should only be called from [block
parser functions](#BlockParser.parse) that return null.
*/
startComposite(type: string, start: number, value?: number): void;
/**
Add a block element. Can be called by [block
parsers](#BlockParser.parse).
*/
addElement(elt: Element): void;
/**
Add a block element from a [leaf parser](#LeafBlockParser). This
makes sure any extra composite block markup (such as blockquote
markers) inside the block are also added to the syntax tree.
*/
addLeafElement(leaf: LeafBlock, elt: Element): void;
private finish;
private addGaps;
/**
Create an [`Element`](#Element) object to represent some syntax
node.
*/
elt(type: string, from: number, to: number, children?: readonly Element[]): Element;
elt(tree: Tree, at: number): Element;
}
/**
Used in the [configuration](#MarkdownConfig.defineNodes) to define
new [syntax node
types](https://lezer.codemirror.net/docs/ref/#common.NodeType).
*/
interface NodeSpec {
/**
The node's name.
*/
name: string;
/**
Should be set to true if this type represents a block node.
*/
block?: boolean;
/**
If this is a composite block, this should hold a function that,
at the start of a new line where that block is active, checks
whether the composite block should continue (return value) and
optionally [adjusts](#Line.moveBase) the line's base position
and [registers](#Line.addMarker) nodes for any markers involved
in the block's syntax.
*/
composite?(cx: BlockContext, line: Line, value: number): boolean;
/**
Add highlighting tag information for this node. The value of
this property may either by a tag or array of tags to assign
directly to this node, or an object in the style of
[`styleTags`](https://lezer.codemirror.net/docs/ref/#highlight.styleTags)'s
argument to assign more complicated rules.
*/
style?: Tag | readonly Tag[] | {
[selector: string]: Tag | readonly Tag[];
};
}
/**
Inline parsers are called for every character of parts of the
document that are parsed as inline content.
*/
interface InlineParser {
/**
This parser's name, which can be used by other parsers to
[indicate](#InlineParser.before) a relative precedence.
*/
name: string;
/**
The parse function. Gets the next character and its position as
arguments. Should return -1 if it doesn't handle the character,
or add some [element](#InlineContext.addElement) or
[delimiter](#InlineContext.addDelimiter) and return the end
position of the content it parsed if it can.
*/
parse(cx: InlineContext, next: number, pos: number): number;
/**
When given, this parser will be installed directly before the
parser with the given name. The default configuration defines
inline parsers with names Escape, Entity, InlineCode, HTMLTag,
Emphasis, HardBreak, Link, and Image. When no `before` or
`after` property is given, the parser is added to the end of the
list.
*/
before?: string;
/**
When given, the parser will be installed directly _after_ the
parser with the given name.
*/
after?: string;
}
/**
Block parsers handle block-level structure. There are three
general types of block parsers:
- Composite block parsers, which handle things like lists and
blockquotes. These define a [`parse`](#BlockParser.parse) method
that [starts](#BlockContext.startComposite) a composite block
and returns null when it recognizes its syntax. The node type
used by such a block must define a
[`composite`](#NodeSpec.composite) function as well.
- Eager leaf block parsers, used for things like code or HTML
blocks. These can unambiguously recognize their content from its
first line. They define a [`parse`](#BlockParser.parse) method
that, if it recognizes the construct,
[moves](#BlockContext.nextLine) the current line forward to the
line beyond the end of the block,
[add](#BlockContext.addElement) a syntax node for the block, and
return true.
- Leaf block parsers that observe a paragraph-like construct as it
comes in, and optionally decide to handle it at some point. This
is used for "setext" (underlined) headings and link references.
These define a [`leaf`](#BlockParser.leaf) method that checks
the first line of the block and returns a
[`LeafBlockParser`](#LeafBlockParser) object if it wants to
observe that block.
*/
interface BlockParser {
/**
The name of the parser. Can be used by other block parsers to
[specify](#BlockParser.before) precedence.
*/
name: string;
/**
The eager parse function, which can look at the block's first
line and return `false` to do nothing, `true` if it has parsed
(and [moved past](#BlockContext.nextLine) a block), or `null` if
it has [started](#BlockContext.startComposite) a composite block.
*/
parse?(cx: BlockContext, line: Line): BlockResult;
/**
A leaf parse function. If no [regular](#BlockParser.parse) parse
functions match for a given line, its content will be
accumulated for a paragraph-style block. This method can return
an [object](#LeafBlockParser) that overrides that style of
parsing in some situations.
*/
leaf?(cx: BlockContext, leaf: LeafBlock): LeafBlockParser | null;
/**
Some constructs, such as code blocks or newly started
blockquotes, can interrupt paragraphs even without a blank line.
If your construct can do this, provide a predicate here that
recognizes lines that should end a paragraph (or other non-eager
[leaf block](#BlockParser.leaf)).
*/
endLeaf?(cx: BlockContext, line: Line, leaf: LeafBlock): boolean;
/**
When given, this parser will be installed directly before the
block parser with the given name. The default configuration
defines block parsers with names LinkReference, IndentedCode,
FencedCode, Blockquote, HorizontalRule, BulletList, OrderedList,
ATXHeading, HTMLBlock, and SetextHeading.
*/
before?: string;
/**
When given, the parser will be installed directly _after_ the
parser with the given name.
*/
after?: string;
}
/**
Objects that are used to [override](#BlockParser.leaf)
paragraph-style blocks should conform to this interface.
*/
interface LeafBlockParser {
/**
Update the parser's state for the next line, and optionally
finish the block. This is not called for the first line (the
object is constructed at that line), but for any further lines.
When it returns `true`, the block is finished. It is okay for
the function to [consume](#BlockContext.nextLine) the current
line or any subsequent lines when returning true.
*/
nextLine(cx: BlockContext, line: Line, leaf: LeafBlock): boolean;
/**
Called when the block is finished by external circumstances
(such as a blank line or the [start](#BlockParser.endLeaf) of
another construct). If this parser can handle the block up to
its current position, it should
[finish](#BlockContext.addLeafElement) the block and return
true.
*/
finish(cx: BlockContext, leaf: LeafBlock): boolean;
}
/**
Objects of this type are used to
[configure](#MarkdownParser.configure) the Markdown parser.
*/
interface MarkdownConfig {
/**
Node props to add to the parser's node set.
*/
props?: readonly NodePropSource[];
/**
Define new [node types](#NodeSpec) for use in parser extensions.
*/
defineNodes?: readonly (string | NodeSpec)[];
/**
Define additional [block parsing](#BlockParser) logic.
*/
parseBlock?: readonly BlockParser[];
/**
Define new [inline parsing](#InlineParser) logic.
*/
parseInline?: readonly InlineParser[];
/**
Remove the named parsers from the configuration.
*/
remove?: readonly string[];
/**
Add a parse wrapper (such as a [mixed-language
parser](#common.parseMixed)) to this parser.
*/
wrap?: ParseWrapper;
}
/**
To make it possible to group extensions together into bigger
extensions (such as the [Github-flavored Markdown](#GFM)
extension), [reconfiguration](#MarkdownParser.configure) accepts
nested arrays of [config](#MarkdownConfig) objects.
*/
type MarkdownExtension = MarkdownConfig | readonly MarkdownExtension[];
/**
A Markdown parser configuration.
*/
declare class MarkdownParser extends Parser {
/**
The parser's syntax [node
types](https://lezer.codemirror.net/docs/ref/#common.NodeSet).
*/
readonly nodeSet: NodeSet;
createParse(input: Input, fragments: readonly TreeFragment[], ranges: readonly {
from: number;
to: number;
}[]): PartialParse;
/**
Reconfigure the parser.
*/
configure(spec: MarkdownExtension): MarkdownParser;
/**
Parse the given piece of inline text at the given offset,
returning an array of [`Element`](#Element) objects representing
the inline content.
*/
parseInline(text: string, offset: number): Element[];
}
/**
Elements are used to compose syntax nodes during parsing.
*/
declare class Element {
/**
The node's
[id](https://lezer.codemirror.net/docs/ref/#common.NodeType.id).
*/
readonly type: number;
/**
The start of the node, as an offset from the start of the document.
*/
readonly from: number;
/**
The end of the node.
*/
readonly to: number;
}
/**
Delimiters are used during inline parsing to store the positions
of things that _might_ be delimiters, if another matching
delimiter is found. They are identified by objects with these
properties.
*/
interface DelimiterType {
/**
If this is given, the delimiter should be matched automatically
when a piece of inline content is finished. Such delimiters will
be matched with delimiters of the same type according to their
[open and close](#InlineContext.addDelimiter) properties. When a
match is found, the content between the delimiters is wrapped in
a node whose name is given by the value of this property.
When this isn't given, you need to match the delimiter eagerly
using the [`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter)
and [`takeContent`](#InlineContext.takeContent) methods.
*/
resolve?: string;
/**
If the delimiter itself should, when matched, create a syntax
node, set this to the name of the syntax node.
*/
mark?: string;
}
/**
Inline parsing functions get access to this context, and use it to
read the content and emit syntax nodes.
*/
declare class InlineContext {
/**
The parser that is being used.
*/
readonly parser: MarkdownParser;
/**
The text of this inline section.
*/
readonly text: string;
/**
The starting offset of the section in the document.
*/
readonly offset: number;
/**
Get the character code at the given (document-relative)
position.
*/
char(pos: number): number;
/**
The position of the end of this inline section.
*/
get end(): number;
/**
Get a substring of this inline section. Again uses
document-relative positions.
*/
slice(from: number, to: number): string;
/**
Add a [delimiter](#DelimiterType) at this given position. `open`
and `close` indicate whether this delimiter is opening, closing,
or both. Returns the end of the delimiter, for convenient
returning from [parse functions](#InlineParser.parse).
*/
addDelimiter(type: DelimiterType, from: number, to: number, open: boolean, close: boolean): number;
/**
Returns true when there is an unmatched link or image opening
token before the current position.
*/
get hasOpenLink(): boolean;
/**
Add an inline element. Returns the end of the element.
*/
addElement(elt: Element): number;
/**
Find an opening delimiter of the given type. Returns `null` if
no delimiter is found, or an index that can be passed to
[`takeContent`](#InlineContext.takeContent) otherwise.
*/
findOpeningDelimiter(type: DelimiterType): number | null;
/**
Remove all inline elements and delimiters starting from the
given index (which you should get from
[`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter),
resolve delimiters inside of them, and return them as an array
of elements.
*/
takeContent(startIndex: number): Element[];
/**
Return the delimiter at the given index. Mostly useful to get
additional info out of a delimiter index returned by
[`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter).
Returns null if there is no delimiter at this index.
*/
getDelimiterAt(index: number): {
from: number;
to: number;
type: DelimiterType;
} | null;
/**
Skip space after the given (document) position, returning either
the position of the next non-space character or the end of the
section.
*/
skipSpace(from: number): number;
/**
Create an [`Element`](#Element) for a syntax node.
*/
elt(type: string, from: number, to: number, children?: readonly Element[]): Element;
elt(tree: Tree, at: number): Element;
/**
The opening delimiter type used by the standard link parser.
*/
static linkStart: DelimiterType;
/**
Opening delimiter type used for standard images.
*/
static imageStart: DelimiterType;
}
/**
The default CommonMark parser.
*/
declare const parser: MarkdownParser;
/**
Create a Markdown extension to enable nested parsing on code
blocks and/or embedded HTML.
*/
declare function parseCode(config: {
/**
When provided, this will be used to parse the content of code
blocks. `info` is the string after the opening ` ``` ` marker,
or the empty string if there is no such info or this is an
indented code block. If there is a parser available for the
code, it should return a function that can construct the
[parse](https://lezer.codemirror.net/docs/ref/#common.PartialParse).
*/
codeParser?: (info: string) => null | Parser;
/**
The parser used to parse HTML tags (both block and inline).
*/
htmlParser?: Parser;
}): MarkdownExtension;
/**
An extension that implements
[GFM-style](https://github.github.com/gfm/#strikethrough-extension-)
Strikethrough syntax using `~~` delimiters.
*/
declare const Strikethrough: MarkdownConfig;
/**
This extension provides
[GFM-style](https://github.github.com/gfm/#tables-extension-)
tables, using syntax like this:
```
| head 1 | head 2 |
| --- | --- |
| cell 1 | cell 2 |
```
*/
declare const Table: MarkdownConfig;
/**
Extension providing
[GFM-style](https://github.github.com/gfm/#task-list-items-extension-)
task list items, where list items can be prefixed with `[ ]` or
`[x]` to add a checkbox.
*/
declare const TaskList: MarkdownConfig;
/**
Extension that implements autolinking for
`www.`/`http://`/`https://`/`mailto:`/`xmpp:` URLs and email
addresses.
*/
declare const Autolink: MarkdownConfig;
/**
Extension bundle containing [`Table`](#Table),
[`TaskList`](#TaskList), [`Strikethrough`](#Strikethrough), and
[`Autolink`](#Autolink).
*/
declare const GFM: MarkdownConfig[];
/**
Extension providing
[Pandoc-style](https://pandoc.org/MANUAL.html#superscripts-and-subscripts)
superscript using `^` markers.
*/
declare const Superscript: MarkdownConfig;
/**
Extension providing
[Pandoc-style](https://pandoc.org/MANUAL.html#superscripts-and-subscripts)
subscript using `~` markers.
*/
declare const Subscript: MarkdownConfig;
/**
Extension that parses two colons with only letters, underscores,
and numbers between them as `Emoji` nodes.
*/
declare const Emoji: MarkdownConfig;
export { Autolink, BlockContext, type BlockParser, type DelimiterType, Element, Emoji, GFM, InlineContext, type InlineParser, LeafBlock, type LeafBlockParser, Line, type MarkdownConfig, type MarkdownExtension, MarkdownParser, type NodeSpec, Strikethrough, Subscript, Superscript, Table, TaskList, parseCode, parser };

600
frontend/node_modules/@lezer/markdown/dist/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,600 @@
import { PartialParse, Tree, NodeType, NodePropSource, ParseWrapper, Parser, NodeSet, Input, TreeFragment } from '@lezer/common';
import { Tag } from '@lezer/highlight';
/**
Data structure used to accumulate a block's content during [leaf
block parsing](#BlockParser.leaf).
*/
declare class LeafBlock {
/**
The start position of the block.
*/
readonly start: number;
/**
The block's text content.
*/
content: string;
/**
The block parsers active for this block.
*/
parsers: LeafBlockParser[];
}
/**
Data structure used during block-level per-line parsing.
*/
declare class Line {
/**
The line's full text.
*/
text: string;
/**
The base indent provided by the composite contexts (that have
been handled so far).
*/
baseIndent: number;
/**
The string position corresponding to the base indent.
*/
basePos: number;
/**
The position of the next non-whitespace character beyond any
list, blockquote, or other composite block markers.
*/
pos: number;
/**
The column of the next non-whitespace character.
*/
indent: number;
/**
The character code of the character after `pos`.
*/
next: number;
/**
Skip whitespace after the given position, return the position of
the next non-space character or the end of the line if there's
only space after `from`.
*/
skipSpace(from: number): number;
/**
Move the line's base position forward to the given position.
This should only be called by composite [block
parsers](#BlockParser.parse) or [markup skipping
functions](#NodeSpec.composite).
*/
moveBase(to: number): void;
/**
Move the line's base position forward to the given _column_.
*/
moveBaseColumn(indent: number): void;
/**
Store a composite-block-level marker. Should be called from
[markup skipping functions](#NodeSpec.composite) when they
consume any non-whitespace characters.
*/
addMarker(elt: Element): void;
/**
Find the column position at `to`, optionally starting at a given
position and column.
*/
countIndent(to: number, from?: number, indent?: number): number;
/**
Find the position corresponding to the given column.
*/
findColumn(goal: number): number;
}
type BlockResult = boolean | null;
/**
Block-level parsing functions get access to this context object.
*/
declare class BlockContext implements PartialParse {
/**
The parser configuration used.
*/
readonly parser: MarkdownParser;
private line;
private atEnd;
private fragments;
private to;
stoppedAt: number | null;
/**
The start of the current line.
*/
lineStart: number;
get parsedPos(): number;
advance(): Tree | null;
stopAt(pos: number): void;
private reuseFragment;
/**
The number of parent blocks surrounding the current block.
*/
get depth(): number;
/**
Get the type of the parent block at the given depth. When no
depth is passed, return the type of the innermost parent.
*/
parentType(depth?: number): NodeType;
/**
Move to the next input line. This should only be called by
(non-composite) [block parsers](#BlockParser.parse) that consume
the line directly, or leaf block parser
[`nextLine`](#LeafBlockParser.nextLine) methods when they
consume the current line (and return true).
*/
nextLine(): boolean;
/**
Retrieve the text of the line after the current one, without
actually moving the context's current line forward.
*/
peekLine(): string;
private moveRangeI;
private lineChunkAt;
/**
The end position of the previous line.
*/
prevLineEnd(): number;
/**
Start a composite block. Should only be called from [block
parser functions](#BlockParser.parse) that return null.
*/
startComposite(type: string, start: number, value?: number): void;
/**
Add a block element. Can be called by [block
parsers](#BlockParser.parse).
*/
addElement(elt: Element): void;
/**
Add a block element from a [leaf parser](#LeafBlockParser). This
makes sure any extra composite block markup (such as blockquote
markers) inside the block are also added to the syntax tree.
*/
addLeafElement(leaf: LeafBlock, elt: Element): void;
private finish;
private addGaps;
/**
Create an [`Element`](#Element) object to represent some syntax
node.
*/
elt(type: string, from: number, to: number, children?: readonly Element[]): Element;
elt(tree: Tree, at: number): Element;
}
/**
Used in the [configuration](#MarkdownConfig.defineNodes) to define
new [syntax node
types](https://lezer.codemirror.net/docs/ref/#common.NodeType).
*/
interface NodeSpec {
/**
The node's name.
*/
name: string;
/**
Should be set to true if this type represents a block node.
*/
block?: boolean;
/**
If this is a composite block, this should hold a function that,
at the start of a new line where that block is active, checks
whether the composite block should continue (return value) and
optionally [adjusts](#Line.moveBase) the line's base position
and [registers](#Line.addMarker) nodes for any markers involved
in the block's syntax.
*/
composite?(cx: BlockContext, line: Line, value: number): boolean;
/**
Add highlighting tag information for this node. The value of
this property may either by a tag or array of tags to assign
directly to this node, or an object in the style of
[`styleTags`](https://lezer.codemirror.net/docs/ref/#highlight.styleTags)'s
argument to assign more complicated rules.
*/
style?: Tag | readonly Tag[] | {
[selector: string]: Tag | readonly Tag[];
};
}
/**
Inline parsers are called for every character of parts of the
document that are parsed as inline content.
*/
interface InlineParser {
/**
This parser's name, which can be used by other parsers to
[indicate](#InlineParser.before) a relative precedence.
*/
name: string;
/**
The parse function. Gets the next character and its position as
arguments. Should return -1 if it doesn't handle the character,
or add some [element](#InlineContext.addElement) or
[delimiter](#InlineContext.addDelimiter) and return the end
position of the content it parsed if it can.
*/
parse(cx: InlineContext, next: number, pos: number): number;
/**
When given, this parser will be installed directly before the
parser with the given name. The default configuration defines
inline parsers with names Escape, Entity, InlineCode, HTMLTag,
Emphasis, HardBreak, Link, and Image. When no `before` or
`after` property is given, the parser is added to the end of the
list.
*/
before?: string;
/**
When given, the parser will be installed directly _after_ the
parser with the given name.
*/
after?: string;
}
/**
Block parsers handle block-level structure. There are three
general types of block parsers:
- Composite block parsers, which handle things like lists and
blockquotes. These define a [`parse`](#BlockParser.parse) method
that [starts](#BlockContext.startComposite) a composite block
and returns null when it recognizes its syntax. The node type
used by such a block must define a
[`composite`](#NodeSpec.composite) function as well.
- Eager leaf block parsers, used for things like code or HTML
blocks. These can unambiguously recognize their content from its
first line. They define a [`parse`](#BlockParser.parse) method
that, if it recognizes the construct,
[moves](#BlockContext.nextLine) the current line forward to the
line beyond the end of the block,
[add](#BlockContext.addElement) a syntax node for the block, and
return true.
- Leaf block parsers that observe a paragraph-like construct as it
comes in, and optionally decide to handle it at some point. This
is used for "setext" (underlined) headings and link references.
These define a [`leaf`](#BlockParser.leaf) method that checks
the first line of the block and returns a
[`LeafBlockParser`](#LeafBlockParser) object if it wants to
observe that block.
*/
interface BlockParser {
/**
The name of the parser. Can be used by other block parsers to
[specify](#BlockParser.before) precedence.
*/
name: string;
/**
The eager parse function, which can look at the block's first
line and return `false` to do nothing, `true` if it has parsed
(and [moved past](#BlockContext.nextLine) a block), or `null` if
it has [started](#BlockContext.startComposite) a composite block.
*/
parse?(cx: BlockContext, line: Line): BlockResult;
/**
A leaf parse function. If no [regular](#BlockParser.parse) parse
functions match for a given line, its content will be
accumulated for a paragraph-style block. This method can return
an [object](#LeafBlockParser) that overrides that style of
parsing in some situations.
*/
leaf?(cx: BlockContext, leaf: LeafBlock): LeafBlockParser | null;
/**
Some constructs, such as code blocks or newly started
blockquotes, can interrupt paragraphs even without a blank line.
If your construct can do this, provide a predicate here that
recognizes lines that should end a paragraph (or other non-eager
[leaf block](#BlockParser.leaf)).
*/
endLeaf?(cx: BlockContext, line: Line, leaf: LeafBlock): boolean;
/**
When given, this parser will be installed directly before the
block parser with the given name. The default configuration
defines block parsers with names LinkReference, IndentedCode,
FencedCode, Blockquote, HorizontalRule, BulletList, OrderedList,
ATXHeading, HTMLBlock, and SetextHeading.
*/
before?: string;
/**
When given, the parser will be installed directly _after_ the
parser with the given name.
*/
after?: string;
}
/**
Objects that are used to [override](#BlockParser.leaf)
paragraph-style blocks should conform to this interface.
*/
interface LeafBlockParser {
/**
Update the parser's state for the next line, and optionally
finish the block. This is not called for the first line (the
object is constructed at that line), but for any further lines.
When it returns `true`, the block is finished. It is okay for
the function to [consume](#BlockContext.nextLine) the current
line or any subsequent lines when returning true.
*/
nextLine(cx: BlockContext, line: Line, leaf: LeafBlock): boolean;
/**
Called when the block is finished by external circumstances
(such as a blank line or the [start](#BlockParser.endLeaf) of
another construct). If this parser can handle the block up to
its current position, it should
[finish](#BlockContext.addLeafElement) the block and return
true.
*/
finish(cx: BlockContext, leaf: LeafBlock): boolean;
}
/**
Objects of this type are used to
[configure](#MarkdownParser.configure) the Markdown parser.
*/
interface MarkdownConfig {
/**
Node props to add to the parser's node set.
*/
props?: readonly NodePropSource[];
/**
Define new [node types](#NodeSpec) for use in parser extensions.
*/
defineNodes?: readonly (string | NodeSpec)[];
/**
Define additional [block parsing](#BlockParser) logic.
*/
parseBlock?: readonly BlockParser[];
/**
Define new [inline parsing](#InlineParser) logic.
*/
parseInline?: readonly InlineParser[];
/**
Remove the named parsers from the configuration.
*/
remove?: readonly string[];
/**
Add a parse wrapper (such as a [mixed-language
parser](#common.parseMixed)) to this parser.
*/
wrap?: ParseWrapper;
}
/**
To make it possible to group extensions together into bigger
extensions (such as the [Github-flavored Markdown](#GFM)
extension), [reconfiguration](#MarkdownParser.configure) accepts
nested arrays of [config](#MarkdownConfig) objects.
*/
type MarkdownExtension = MarkdownConfig | readonly MarkdownExtension[];
/**
A Markdown parser configuration.
*/
declare class MarkdownParser extends Parser {
/**
The parser's syntax [node
types](https://lezer.codemirror.net/docs/ref/#common.NodeSet).
*/
readonly nodeSet: NodeSet;
createParse(input: Input, fragments: readonly TreeFragment[], ranges: readonly {
from: number;
to: number;
}[]): PartialParse;
/**
Reconfigure the parser.
*/
configure(spec: MarkdownExtension): MarkdownParser;
/**
Parse the given piece of inline text at the given offset,
returning an array of [`Element`](#Element) objects representing
the inline content.
*/
parseInline(text: string, offset: number): Element[];
}
/**
Elements are used to compose syntax nodes during parsing.
*/
declare class Element {
/**
The node's
[id](https://lezer.codemirror.net/docs/ref/#common.NodeType.id).
*/
readonly type: number;
/**
The start of the node, as an offset from the start of the document.
*/
readonly from: number;
/**
The end of the node.
*/
readonly to: number;
}
/**
Delimiters are used during inline parsing to store the positions
of things that _might_ be delimiters, if another matching
delimiter is found. They are identified by objects with these
properties.
*/
interface DelimiterType {
/**
If this is given, the delimiter should be matched automatically
when a piece of inline content is finished. Such delimiters will
be matched with delimiters of the same type according to their
[open and close](#InlineContext.addDelimiter) properties. When a
match is found, the content between the delimiters is wrapped in
a node whose name is given by the value of this property.
When this isn't given, you need to match the delimiter eagerly
using the [`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter)
and [`takeContent`](#InlineContext.takeContent) methods.
*/
resolve?: string;
/**
If the delimiter itself should, when matched, create a syntax
node, set this to the name of the syntax node.
*/
mark?: string;
}
/**
Inline parsing functions get access to this context, and use it to
read the content and emit syntax nodes.
*/
declare class InlineContext {
/**
The parser that is being used.
*/
readonly parser: MarkdownParser;
/**
The text of this inline section.
*/
readonly text: string;
/**
The starting offset of the section in the document.
*/
readonly offset: number;
/**
Get the character code at the given (document-relative)
position.
*/
char(pos: number): number;
/**
The position of the end of this inline section.
*/
get end(): number;
/**
Get a substring of this inline section. Again uses
document-relative positions.
*/
slice(from: number, to: number): string;
/**
Add a [delimiter](#DelimiterType) at this given position. `open`
and `close` indicate whether this delimiter is opening, closing,
or both. Returns the end of the delimiter, for convenient
returning from [parse functions](#InlineParser.parse).
*/
addDelimiter(type: DelimiterType, from: number, to: number, open: boolean, close: boolean): number;
/**
Returns true when there is an unmatched link or image opening
token before the current position.
*/
get hasOpenLink(): boolean;
/**
Add an inline element. Returns the end of the element.
*/
addElement(elt: Element): number;
/**
Find an opening delimiter of the given type. Returns `null` if
no delimiter is found, or an index that can be passed to
[`takeContent`](#InlineContext.takeContent) otherwise.
*/
findOpeningDelimiter(type: DelimiterType): number | null;
/**
Remove all inline elements and delimiters starting from the
given index (which you should get from
[`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter),
resolve delimiters inside of them, and return them as an array
of elements.
*/
takeContent(startIndex: number): Element[];
/**
Return the delimiter at the given index. Mostly useful to get
additional info out of a delimiter index returned by
[`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter).
Returns null if there is no delimiter at this index.
*/
getDelimiterAt(index: number): {
from: number;
to: number;
type: DelimiterType;
} | null;
/**
Skip space after the given (document) position, returning either
the position of the next non-space character or the end of the
section.
*/
skipSpace(from: number): number;
/**
Create an [`Element`](#Element) for a syntax node.
*/
elt(type: string, from: number, to: number, children?: readonly Element[]): Element;
elt(tree: Tree, at: number): Element;
/**
The opening delimiter type used by the standard link parser.
*/
static linkStart: DelimiterType;
/**
Opening delimiter type used for standard images.
*/
static imageStart: DelimiterType;
}
/**
The default CommonMark parser.
*/
declare const parser: MarkdownParser;
/**
Create a Markdown extension to enable nested parsing on code
blocks and/or embedded HTML.
*/
declare function parseCode(config: {
/**
When provided, this will be used to parse the content of code
blocks. `info` is the string after the opening ` ``` ` marker,
or the empty string if there is no such info or this is an
indented code block. If there is a parser available for the
code, it should return a function that can construct the
[parse](https://lezer.codemirror.net/docs/ref/#common.PartialParse).
*/
codeParser?: (info: string) => null | Parser;
/**
The parser used to parse HTML tags (both block and inline).
*/
htmlParser?: Parser;
}): MarkdownExtension;
/**
An extension that implements
[GFM-style](https://github.github.com/gfm/#strikethrough-extension-)
Strikethrough syntax using `~~` delimiters.
*/
declare const Strikethrough: MarkdownConfig;
/**
This extension provides
[GFM-style](https://github.github.com/gfm/#tables-extension-)
tables, using syntax like this:
```
| head 1 | head 2 |
| --- | --- |
| cell 1 | cell 2 |
```
*/
declare const Table: MarkdownConfig;
/**
Extension providing
[GFM-style](https://github.github.com/gfm/#task-list-items-extension-)
task list items, where list items can be prefixed with `[ ]` or
`[x]` to add a checkbox.
*/
declare const TaskList: MarkdownConfig;
/**
Extension that implements autolinking for
`www.`/`http://`/`https://`/`mailto:`/`xmpp:` URLs and email
addresses.
*/
declare const Autolink: MarkdownConfig;
/**
Extension bundle containing [`Table`](#Table),
[`TaskList`](#TaskList), [`Strikethrough`](#Strikethrough), and
[`Autolink`](#Autolink).
*/
declare const GFM: MarkdownConfig[];
/**
Extension providing
[Pandoc-style](https://pandoc.org/MANUAL.html#superscripts-and-subscripts)
superscript using `^` markers.
*/
declare const Superscript: MarkdownConfig;
/**
Extension providing
[Pandoc-style](https://pandoc.org/MANUAL.html#superscripts-and-subscripts)
subscript using `~` markers.
*/
declare const Subscript: MarkdownConfig;
/**
Extension that parses two colons with only letters, underscores,
and numbers between them as `Emoji` nodes.
*/
declare const Emoji: MarkdownConfig;
export { Autolink, BlockContext, type BlockParser, type DelimiterType, Element, Emoji, GFM, InlineContext, type InlineParser, LeafBlock, type LeafBlockParser, Line, type MarkdownConfig, type MarkdownExtension, MarkdownParser, type NodeSpec, Strikethrough, Subscript, Superscript, Table, TaskList, parseCode, parser };

2327
frontend/node_modules/@lezer/markdown/dist/index.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

37
frontend/node_modules/@lezer/markdown/package.json generated vendored Normal file
View File

@ -0,0 +1,37 @@
{
"name": "@lezer/markdown",
"version": "1.6.0",
"description": "Incremental Markdown parser that consumes and emits Lezer trees",
"main": "dist/index.cjs",
"type": "module",
"exports": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"module": "dist/index.js",
"types": "dist/index.d.ts",
"author": "Marijn Haverbeke <marijn@haverbeke.berlin>",
"license": "MIT",
"devDependencies": {
"ist": "^1.1.1",
"mocha": "^10.2.0",
"@lezer/html": "^1.0.0",
"getdocs-ts": "^0.1.0",
"builddocs": "^1.0.0",
"@marijn/buildtool": "^0.1.6"
},
"dependencies": {
"@lezer/common": "^1.0.0",
"@lezer/highlight": "^1.0.0"
},
"repository": {
"type" : "git",
"url" : "https://github.com/lezer-parser/markdown.git"
},
"scripts": {
"watch": "node build.js --watch",
"prepare": "node build.js",
"test": "mocha",
"build-readme": "node bin/build-readme.cjs"
}
}

83
frontend/node_modules/@lezer/markdown/src/README.md generated vendored Normal file
View File

@ -0,0 +1,83 @@
<!-- /README.md is generated from /src/README.md -->
# @lezer/markdown
This is an incremental Markdown ([CommonMark](https://commonmark.org/)
with support for extension) parser that integrates well with the
[Lezer](https://lezer.codemirror.net/) parser system. It does not in
fact use the Lezer runtime (that runs LR parsers, and Markdown can't
really be parsed that way), but it produces Lezer-style compact syntax
trees and consumes fragments of such trees for its incremental
parsing.
Note that this only _parses_ the document, producing a data structure
that represents its syntactic form, and doesn't help with outputting
HTML. Also, in order to be single-pass and incremental, it doesn't do
some things that a conforming CommonMark parser is expected to
do—specifically, it doesn't validate link references, so it'll parse
`[a][b]` and similar as a link, even if no `[b]` reference is
declared.
The
[@codemirror/lang-markdown](https://github.com/codemirror/lang-markdown)
package integrates this parser with CodeMirror to provide Markdown
editor support.
The code is licensed under an MIT license.
## Interface
@parser
@MarkdownParser
@MarkdownConfig
@MarkdownExtension
@parseCode
### GitHub Flavored Markdown
@GFM
@Table
@TaskList
@Strikethrough
@Autolink
### Other extensions
@Subscript
@Superscript
@Emoji
### Extension
The parser can, to a certain extent, be extended to handle additional
syntax.
@NodeSpec
@BlockContext
@BlockParser
@LeafBlockParser
@Line
@LeafBlock
@InlineContext
@InlineParser
@DelimiterType
@Element

301
frontend/node_modules/@lezer/markdown/src/extension.ts generated vendored Normal file
View File

@ -0,0 +1,301 @@
import {InlineContext, BlockContext, MarkdownConfig,
LeafBlockParser, LeafBlock, Line, Element, space, Punctuation} from "./markdown"
import {tags as t} from "@lezer/highlight"
const StrikethroughDelim = {resolve: "Strikethrough", mark: "StrikethroughMark"}
/// An extension that implements
/// [GFM-style](https://github.github.com/gfm/#strikethrough-extension-)
/// Strikethrough syntax using `~~` delimiters.
export const Strikethrough: MarkdownConfig = {
defineNodes: [{
name: "Strikethrough",
style: {"Strikethrough/...": t.strikethrough}
}, {
name: "StrikethroughMark",
style: t.processingInstruction
}],
parseInline: [{
name: "Strikethrough",
parse(cx, next, pos) {
if (next != 126 /* '~' */ || cx.char(pos + 1) != 126 || cx.char(pos + 2) == 126) return -1
let before = cx.slice(pos - 1, pos), after = cx.slice(pos + 2, pos + 3)
let sBefore = /\s|^$/.test(before), sAfter = /\s|^$/.test(after)
let pBefore = Punctuation.test(before), pAfter = Punctuation.test(after)
return cx.addDelimiter(StrikethroughDelim, pos, pos + 2,
!sAfter && (!pAfter || sBefore || pBefore),
!sBefore && (!pBefore || sAfter || pAfter))
},
after: "Emphasis"
}]
}
// Parse a line as a table row and return the row count. When `elts`
// is given, push syntax elements for the content onto it.
function parseRow(cx: BlockContext, line: string, startI = 0, elts?: Element[], offset = 0) {
let count = 0, first = true, cellStart = -1, cellEnd = -1, esc = false
let parseCell = () => {
elts!.push(cx.elt("TableCell", offset + cellStart, offset + cellEnd,
cx.parser.parseInline(line.slice(cellStart, cellEnd), offset + cellStart)))
}
for (let i = startI; i < line.length; i++) {
let next = line.charCodeAt(i)
if (next == 124 /* '|' */ && !esc) {
if (!first || cellStart > -1) count++
first = false
if (elts) {
if (cellStart > -1) parseCell()
elts.push(cx.elt("TableDelimiter", i + offset, i + offset + 1))
}
cellStart = cellEnd = -1
} else if (esc || next != 32 && next != 9) {
if (cellStart < 0) cellStart = i
cellEnd = i + 1
}
esc = !esc && next == 92
}
if (cellStart > -1) {
count++
if (elts) parseCell()
}
return count
}
function hasPipe(str: string, start: number) {
for (let i = start; i < str.length; i++) {
let next = str.charCodeAt(i)
if (next == 124 /* '|' */) return true
if (next == 92 /* '\\' */) i++
}
return false
}
const delimiterLine = /^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/
class TableParser implements LeafBlockParser {
// Null means we haven't seen the second line yet, false means this
// isn't a table, and an array means this is a table and we've
// parsed the given rows so far.
rows: false | null | Element[] = null
nextLine(cx: BlockContext, line: Line, leaf: LeafBlock) {
if (this.rows == null) { // Second line
this.rows = false
let lineText
if ((line.next == 45 || line.next == 58 || line.next == 124 /* '-:|' */) &&
delimiterLine.test(lineText = line.text.slice(line.pos))) {
let firstRow: Element[] = [], firstCount = parseRow(cx, leaf.content, 0, firstRow, leaf.start)
if (firstCount == parseRow(cx, lineText, line.pos))
this.rows = [cx.elt("TableHeader", leaf.start, leaf.start + leaf.content.length, firstRow),
cx.elt("TableDelimiter", cx.lineStart + line.pos, cx.lineStart + line.text.length)]
}
} else if (this.rows) { // Line after the second
let content: Element[] = []
parseRow(cx, line.text, line.pos, content, cx.lineStart)
this.rows.push(cx.elt("TableRow", cx.lineStart + line.pos, cx.lineStart + line.text.length, content))
}
return false
}
finish(cx: BlockContext, leaf: LeafBlock) {
if (!this.rows) return false
cx.addLeafElement(leaf, cx.elt("Table", leaf.start, leaf.start + leaf.content.length, this.rows as readonly Element[]))
return true
}
}
/// This extension provides
/// [GFM-style](https://github.github.com/gfm/#tables-extension-)
/// tables, using syntax like this:
///
/// ```
/// | head 1 | head 2 |
/// | --- | --- |
/// | cell 1 | cell 2 |
/// ```
export const Table: MarkdownConfig = {
defineNodes: [
{name: "Table", block: true},
{name: "TableHeader", style: {"TableHeader/...": t.heading}},
"TableRow",
{name: "TableCell", style: t.content},
{name: "TableDelimiter", style: t.processingInstruction},
],
parseBlock: [{
name: "Table",
leaf(_, leaf) { return hasPipe(leaf.content, 0) ? new TableParser : null },
endLeaf(cx, line, leaf) {
if (leaf.parsers.some(p => p instanceof TableParser) || !hasPipe(line.text, line.basePos)) return false
let next = cx.peekLine()
return delimiterLine.test(next) && parseRow(cx, line.text, line.basePos) == parseRow(cx, next, line.basePos)
},
before: "SetextHeading"
}]
}
class TaskParser implements LeafBlockParser {
nextLine() { return false }
finish(cx: BlockContext, leaf: LeafBlock) {
cx.addLeafElement(leaf, cx.elt("Task", leaf.start, leaf.start + leaf.content.length, [
cx.elt("TaskMarker", leaf.start, leaf.start + 3),
...cx.parser.parseInline(leaf.content.slice(3), leaf.start + 3)
]))
return true
}
}
/// Extension providing
/// [GFM-style](https://github.github.com/gfm/#task-list-items-extension-)
/// task list items, where list items can be prefixed with `[ ]` or
/// `[x]` to add a checkbox.
export const TaskList: MarkdownConfig = {
defineNodes: [
{name: "Task", block: true, style: t.list},
{name: "TaskMarker", style: t.atom}
],
parseBlock: [{
name: "TaskList",
leaf(cx, leaf) {
return /^\[[ xX]\][ \t]/.test(leaf.content) && cx.parentType().name == "ListItem" ? new TaskParser : null
},
after: "SetextHeading"
}]
}
const autolinkRE = /(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy
const urlRE = /[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy
const lastTwoDomainWords = /[\w-]+\.[\w-]+($|\/)/
const emailRE = /[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy
const xmppResourceRE = /\/[a-zA-Z\d@.]+/gy
function count(str: string, from: number, to: number, ch: string) {
let result = 0
for (let i = from; i < to; i++) if (str[i] == ch) result++
return result
}
function autolinkURLEnd(text: string, from: number) {
urlRE.lastIndex = from
let m = urlRE.exec(text)
if (!m || lastTwoDomainWords.exec(m[0])![0].indexOf("_") > -1) return -1
let end = from + m[0].length
for (;;) {
let last = text[end - 1], m
if (/[?!.,:*_~]/.test(last) ||
last == ")" && count(text, from, end, ")") > count(text, from, end, "("))
end--
else if (last == ";" && (m = /&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(text.slice(from, end))))
end = from + m.index
else
break
}
return end
}
function autolinkEmailEnd(text: string, from: number) {
emailRE.lastIndex = from
let m = emailRE.exec(text)
if (!m) return -1
let last = m[0][m[0].length - 1]
return last == "_" || last == "-" ? -1 : from + m[0].length - (last == "." ? 1 : 0)
}
/// Extension that implements autolinking for
/// `www.`/`http://`/`https://`/`mailto:`/`xmpp:` URLs and email
/// addresses.
export const Autolink: MarkdownConfig = {
parseInline: [{
name: "Autolink",
parse(cx, next, absPos) {
let pos = absPos - cx.offset
if (pos && /\w/.test(cx.text[pos - 1])) return -1
autolinkRE.lastIndex = pos
let m = autolinkRE.exec(cx.text), end = -1
if (!m) return -1
if (m[1] || m[2]) { // www., http://
end = autolinkURLEnd(cx.text, pos + m[0].length)
if (end > -1 && cx.hasOpenLink) {
let noBracket = /([^\[\]]|\[[^\]]*\])*/.exec(cx.text.slice(pos, end))
end = pos + noBracket![0].length
}
} else if (m[3]) { // email address
end = autolinkEmailEnd(cx.text, pos)
} else { // mailto:/xmpp:
end = autolinkEmailEnd(cx.text, pos + m[0].length)
if (end > -1 && m[0] == "xmpp:") {
xmppResourceRE.lastIndex = end
m = xmppResourceRE.exec(cx.text)
if (m) end = m.index + m[0].length
}
}
if (end < 0) return -1
cx.addElement(cx.elt("URL", absPos, end + cx.offset))
return end + cx.offset
}
}]
}
/// Extension bundle containing [`Table`](#Table),
/// [`TaskList`](#TaskList), [`Strikethrough`](#Strikethrough), and
/// [`Autolink`](#Autolink).
export const GFM = [Table, TaskList, Strikethrough, Autolink]
function parseSubSuper(ch: number, node: string, mark: string) {
return (cx: InlineContext, next: number, pos: number) => {
if (next != ch || cx.char(pos + 1) == ch) return -1
let elts = [cx.elt(mark, pos, pos + 1)]
for (let i = pos + 1; i < cx.end; i++) {
let next = cx.char(i)
if (next == ch)
return cx.addElement(cx.elt(node, pos, i + 1, elts.concat(cx.elt(mark, i, i + 1))))
if (next == 92 /* '\\' */)
elts.push(cx.elt("Escape", i, i++ + 2))
if (space(next)) break
}
return -1
}
}
/// Extension providing
/// [Pandoc-style](https://pandoc.org/MANUAL.html#superscripts-and-subscripts)
/// superscript using `^` markers.
export const Superscript: MarkdownConfig = {
defineNodes: [
{name: "Superscript", style: t.special(t.content)},
{name: "SuperscriptMark", style: t.processingInstruction}
],
parseInline: [{
name: "Superscript",
parse: parseSubSuper(94 /* '^' */, "Superscript", "SuperscriptMark")
}]
}
/// Extension providing
/// [Pandoc-style](https://pandoc.org/MANUAL.html#superscripts-and-subscripts)
/// subscript using `~` markers.
export const Subscript: MarkdownConfig = {
defineNodes: [
{name: "Subscript", style: t.special(t.content)},
{name: "SubscriptMark", style: t.processingInstruction}
],
parseInline: [{
name: "Subscript",
parse: parseSubSuper(126 /* '~' */, "Subscript", "SubscriptMark")
}]
}
/// Extension that parses two colons with only letters, underscores,
/// and numbers between them as `Emoji` nodes.
export const Emoji: MarkdownConfig = {
defineNodes: [{name: "Emoji", style: t.character}],
parseInline: [{
name: "Emoji",
parse(cx, next, pos) {
let match: RegExpMatchArray | null
if (next != 58 /* ':' */ || !(match = /^[a-zA-Z_0-9]+:/.exec(cx.slice(pos + 1, cx.end)))) return -1
return cx.addElement(cx.elt("Emoji", pos, pos + 1 + match[0].length))
}
}]
}

5
frontend/node_modules/@lezer/markdown/src/index.ts generated vendored Normal file
View File

@ -0,0 +1,5 @@
export {parser, MarkdownParser, MarkdownConfig, MarkdownExtension,
NodeSpec, InlineParser, BlockParser, LeafBlockParser,
Line, Element, LeafBlock, DelimiterType, BlockContext, InlineContext} from "./markdown"
export {parseCode} from "./nest"
export {Table, TaskList, Strikethrough, Autolink, GFM, Subscript, Superscript, Emoji} from "./extension"

1958
frontend/node_modules/@lezer/markdown/src/markdown.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

46
frontend/node_modules/@lezer/markdown/src/nest.ts generated vendored Normal file
View File

@ -0,0 +1,46 @@
import {SyntaxNode, Parser, Input, parseMixed, SyntaxNodeRef} from "@lezer/common"
import {Type, MarkdownExtension} from "./markdown"
function leftOverSpace(node: SyntaxNode, from: number, to: number) {
let ranges = []
for (let n = node.firstChild, pos = from;; n = n.nextSibling) {
let nextPos = n ? n.from : to
if (nextPos > pos) ranges.push({from: pos, to: nextPos})
if (!n) break
pos = n.to
}
return ranges
}
/// Create a Markdown extension to enable nested parsing on code
/// blocks and/or embedded HTML.
export function parseCode(config: {
/// When provided, this will be used to parse the content of code
/// blocks. `info` is the string after the opening ` ``` ` marker,
/// or the empty string if there is no such info or this is an
/// indented code block. If there is a parser available for the
/// code, it should return a function that can construct the
/// [parse](https://lezer.codemirror.net/docs/ref/#common.PartialParse).
codeParser?: (info: string) => null | Parser
/// The parser used to parse HTML tags (both block and inline).
htmlParser?: Parser,
}): MarkdownExtension {
let {codeParser, htmlParser} = config
let wrap = parseMixed((node: SyntaxNodeRef, input: Input) => {
let id = node.type.id
if (codeParser && (id == Type.CodeBlock || id == Type.FencedCode)) {
let info = ""
if (id == Type.FencedCode) {
let infoNode = node.node.getChild(Type.CodeInfo)
if (infoNode) info = input.read(infoNode.from, infoNode.to)
}
let parser = codeParser(info)
if (parser)
return {parser, overlay: node => node.type.id == Type.CodeText}
} else if (htmlParser && (id == Type.HTMLBlock || id == Type.HTMLTag || id == Type.CommentBlock)) {
return {parser: htmlParser, overlay: leftOverSpace(node.node, node.from, node.to)}
}
return null
})
return {wrap}
}

View File

@ -0,0 +1,14 @@
import {Tree} from "@lezer/common"
export function compareTree(a: Tree, b: Tree) {
let curA = a.cursor(), curB = b.cursor()
for (;;) {
let mismatch = null, next = false
if (curA.type != curB.type) mismatch = `Node type mismatch (${curA.name} vs ${curB.name})`
else if (curA.from != curB.from) mismatch = `Start pos mismatch for ${curA.name}: ${curA.from} vs ${curB.from}`
else if (curA.to != curB.to) mismatch = `End pos mismatch for ${curA.name}: ${curA.to} vs ${curB.to}`
else if ((next = curA.next()) != curB.next()) mismatch = `Tree size mismatch`
if (mismatch) throw new Error(`${mismatch}\n ${a}\n ${b}`)
if (!next) break
}
}

79
frontend/node_modules/@lezer/markdown/test/spec.ts generated vendored Normal file
View File

@ -0,0 +1,79 @@
import {Tree} from "@lezer/common"
import {MarkdownParser} from ".."
const abbrev: {[abbr: string]: string} = {
__proto__: null as any,
CB: "CodeBlock",
FC: "FencedCode",
Q: "Blockquote",
HR: "HorizontalRule",
BL: "BulletList",
OL: "OrderedList",
LI: "ListItem",
H1: "ATXHeading1",
H2: "ATXHeading2",
H3: "ATXHeading3",
H4: "ATXHeading4",
H5: "ATXHeading5",
H6: "ATXHeading6",
SH1: "SetextHeading1",
SH2: "SetextHeading2",
HB: "HTMLBlock",
PI: "ProcessingInstructionBlock",
CMB: "CommentBlock",
LR: "LinkReference",
P: "Paragraph",
Esc: "Escape",
Ent: "Entity",
BR: "HardBreak",
Em: "Emphasis",
St: "StrongEmphasis",
Ln: "Link",
Al: "Autolink",
Im: "Image",
C: "InlineCode",
HT: "HTMLTag",
CM: "Comment",
Pi: "ProcessingInstruction",
h: "HeaderMark",
q: "QuoteMark",
l: "ListMark",
L: "LinkMark",
e: "EmphasisMark",
c: "CodeMark",
cI: "CodeInfo",
cT: "CodeText",
LT: "LinkTitle",
LL: "LinkLabel"
}
export class SpecParser {
constructor(readonly parser: MarkdownParser, readonly localAbbrev?: {[name: string]: string}) {}
type(name: string) {
name = (this.localAbbrev && this.localAbbrev[name]) || abbrev[name] || name
return this.parser.nodeSet.types.find(t => t.name == name)?.id
}
parse(spec: string, specName: string) {
let doc = "", buffer = [], stack: number[] = []
for (let pos = 0; pos < spec.length; pos++) {
let ch = spec[pos]
if (ch == "{") {
let name = /^(\w+):/.exec(spec.slice(pos + 1)), tag = name && this.type(name[1])
if (tag == null) throw new Error(`Invalid node opening mark at ${pos} in ${specName}`)
pos += name![0].length
stack.push(tag, doc.length, buffer.length)
} else if (ch == "}") {
if (!stack.length) throw new Error(`Mismatched node close mark at ${pos} in ${specName}`)
let bufStart = stack.pop()!, from = stack.pop()!, type = stack.pop()!
buffer.push(type, from, doc.length, 4 + buffer.length - bufStart)
} else {
doc += ch
}
}
if (stack.length) throw new Error(`Unclosed node in ${specName}`)
return {tree: Tree.build({buffer, nodeSet: this.parser.nodeSet, topID: this.type("Document")!, length: doc.length}), doc}
}
}

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