Added missing changes and modified dist assets.
This commit is contained in:
parent
3de07763cf
commit
1d8732f877
72
dist/index.js
generated
vendored
72
dist/index.js
generated
vendored
@ -64431,6 +64431,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
|
|||||||
let hasNewline = false;
|
let hasNewline = false;
|
||||||
let hasNewlineAfterProp = false;
|
let hasNewlineAfterProp = false;
|
||||||
let reqSpace = false;
|
let reqSpace = false;
|
||||||
|
let tab = null;
|
||||||
let anchor = null;
|
let anchor = null;
|
||||||
let tag = null;
|
let tag = null;
|
||||||
let comma = null;
|
let comma = null;
|
||||||
@ -64444,6 +64445,12 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
|
|||||||
onError(token.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');
|
onError(token.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');
|
||||||
reqSpace = false;
|
reqSpace = false;
|
||||||
}
|
}
|
||||||
|
if (tab) {
|
||||||
|
if (token.type !== 'comment') {
|
||||||
|
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
|
||||||
|
}
|
||||||
|
tab = null;
|
||||||
|
}
|
||||||
switch (token.type) {
|
switch (token.type) {
|
||||||
case 'space':
|
case 'space':
|
||||||
// At the doc level, tabs at line start may be parsed
|
// At the doc level, tabs at line start may be parsed
|
||||||
@ -64451,9 +64458,10 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
|
|||||||
// In a flow collection, only the parser handles indent.
|
// In a flow collection, only the parser handles indent.
|
||||||
if (!flow &&
|
if (!flow &&
|
||||||
atNewline &&
|
atNewline &&
|
||||||
indicator !== 'doc-start' &&
|
(indicator !== 'doc-start' || next?.type !== 'flow-collection') &&
|
||||||
token.source[0] === '\t')
|
token.source[0] === '\t') {
|
||||||
onError(token, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
|
tab = token;
|
||||||
|
}
|
||||||
hasSpace = true;
|
hasSpace = true;
|
||||||
break;
|
break;
|
||||||
case 'comment': {
|
case 'comment': {
|
||||||
@ -64539,8 +64547,11 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
|
|||||||
next.type !== 'space' &&
|
next.type !== 'space' &&
|
||||||
next.type !== 'newline' &&
|
next.type !== 'newline' &&
|
||||||
next.type !== 'comma' &&
|
next.type !== 'comma' &&
|
||||||
(next.type !== 'scalar' || next.source !== ''))
|
(next.type !== 'scalar' || next.source !== '')) {
|
||||||
onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');
|
onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');
|
||||||
|
}
|
||||||
|
if (tab)
|
||||||
|
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
|
||||||
return {
|
return {
|
||||||
comma,
|
comma,
|
||||||
found,
|
found,
|
||||||
@ -67138,11 +67149,11 @@ function isEmpty(ch) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const hexDigits = '0123456789ABCDEFabcdef'.split('');
|
const hexDigits = new Set('0123456789ABCDEFabcdef');
|
||||||
const tagChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split('');
|
const tagChars = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()");
|
||||||
const invalidFlowScalarChars = ',[]{}'.split('');
|
const flowIndicatorChars = new Set(',[]{}');
|
||||||
const invalidAnchorChars = ' ,[]{}\n\r\t'.split('');
|
const invalidAnchorChars = new Set(' ,[]{}\n\r\t');
|
||||||
const isNotAnchorChar = (ch) => !ch || invalidAnchorChars.includes(ch);
|
const isNotAnchorChar = (ch) => !ch || invalidAnchorChars.has(ch);
|
||||||
/**
|
/**
|
||||||
* Splits an input string into lexical tokens, i.e. smaller strings that are
|
* Splits an input string into lexical tokens, i.e. smaller strings that are
|
||||||
* easily identifiable by `tokens.tokenType()`.
|
* easily identifiable by `tokens.tokenType()`.
|
||||||
@ -67584,8 +67595,10 @@ class Lexer {
|
|||||||
if (indent >= this.indentNext) {
|
if (indent >= this.indentNext) {
|
||||||
if (this.blockScalarIndent === -1)
|
if (this.blockScalarIndent === -1)
|
||||||
this.indentNext = indent;
|
this.indentNext = indent;
|
||||||
else
|
else {
|
||||||
this.indentNext += this.blockScalarIndent;
|
this.indentNext =
|
||||||
|
this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);
|
||||||
|
}
|
||||||
do {
|
do {
|
||||||
const cs = this.continueScalar(nl + 1);
|
const cs = this.continueScalar(nl + 1);
|
||||||
if (cs === -1)
|
if (cs === -1)
|
||||||
@ -67625,7 +67638,7 @@ class Lexer {
|
|||||||
while ((ch = this.buffer[++i])) {
|
while ((ch = this.buffer[++i])) {
|
||||||
if (ch === ':') {
|
if (ch === ':') {
|
||||||
const next = this.buffer[i + 1];
|
const next = this.buffer[i + 1];
|
||||||
if (isEmpty(next) || (inFlow && next === ','))
|
if (isEmpty(next) || (inFlow && flowIndicatorChars.has(next)))
|
||||||
break;
|
break;
|
||||||
end = i;
|
end = i;
|
||||||
}
|
}
|
||||||
@ -67640,7 +67653,7 @@ class Lexer {
|
|||||||
else
|
else
|
||||||
end = i;
|
end = i;
|
||||||
}
|
}
|
||||||
if (next === '#' || (inFlow && invalidFlowScalarChars.includes(next)))
|
if (next === '#' || (inFlow && flowIndicatorChars.has(next)))
|
||||||
break;
|
break;
|
||||||
if (ch === '\n') {
|
if (ch === '\n') {
|
||||||
const cs = this.continueScalar(i + 1);
|
const cs = this.continueScalar(i + 1);
|
||||||
@ -67650,7 +67663,7 @@ class Lexer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (inFlow && invalidFlowScalarChars.includes(ch))
|
if (inFlow && flowIndicatorChars.has(ch))
|
||||||
break;
|
break;
|
||||||
end = i;
|
end = i;
|
||||||
}
|
}
|
||||||
@ -67695,7 +67708,7 @@ class Lexer {
|
|||||||
case ':': {
|
case ':': {
|
||||||
const inFlow = this.flowLevel > 0;
|
const inFlow = this.flowLevel > 0;
|
||||||
const ch1 = this.charAt(1);
|
const ch1 = this.charAt(1);
|
||||||
if (isEmpty(ch1) || (inFlow && invalidFlowScalarChars.includes(ch1))) {
|
if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
|
||||||
if (!inFlow)
|
if (!inFlow)
|
||||||
this.indentNext = this.indentValue + 1;
|
this.indentNext = this.indentValue + 1;
|
||||||
else if (this.flowKey)
|
else if (this.flowKey)
|
||||||
@ -67720,11 +67733,11 @@ class Lexer {
|
|||||||
let i = this.pos + 1;
|
let i = this.pos + 1;
|
||||||
let ch = this.buffer[i];
|
let ch = this.buffer[i];
|
||||||
while (ch) {
|
while (ch) {
|
||||||
if (tagChars.includes(ch))
|
if (tagChars.has(ch))
|
||||||
ch = this.buffer[++i];
|
ch = this.buffer[++i];
|
||||||
else if (ch === '%' &&
|
else if (ch === '%' &&
|
||||||
hexDigits.includes(this.buffer[i + 1]) &&
|
hexDigits.has(this.buffer[i + 1]) &&
|
||||||
hexDigits.includes(this.buffer[i + 2])) {
|
hexDigits.has(this.buffer[i + 2])) {
|
||||||
ch = this.buffer[(i += 3)];
|
ch = this.buffer[(i += 3)];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -68132,7 +68145,7 @@ class Parser {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Object.assign(it, { key: token, sep: [] });
|
Object.assign(it, { key: token, sep: [] });
|
||||||
this.onKeyLine = !includesToken(it.start, 'explicit-key-ind');
|
this.onKeyLine = !it.explicitKey;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -68341,9 +68354,9 @@ class Parser {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.indent >= map.indent) {
|
if (this.indent >= map.indent) {
|
||||||
const atNextItem = !this.onKeyLine &&
|
const atMapIndent = !this.onKeyLine && this.indent === map.indent;
|
||||||
this.indent === map.indent &&
|
const atNextItem = atMapIndent &&
|
||||||
it.sep &&
|
(it.sep || it.explicitKey) &&
|
||||||
this.type !== 'seq-item-ind';
|
this.type !== 'seq-item-ind';
|
||||||
// For empty nodes, assign newline-separated not indented empty tokens to following node
|
// For empty nodes, assign newline-separated not indented empty tokens to following node
|
||||||
let start = [];
|
let start = [];
|
||||||
@ -68384,25 +68397,26 @@ class Parser {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 'explicit-key-ind':
|
case 'explicit-key-ind':
|
||||||
if (!it.sep && !includesToken(it.start, 'explicit-key-ind')) {
|
if (!it.sep && !it.explicitKey) {
|
||||||
it.start.push(this.sourceToken);
|
it.start.push(this.sourceToken);
|
||||||
|
it.explicitKey = true;
|
||||||
}
|
}
|
||||||
else if (atNextItem || it.value) {
|
else if (atNextItem || it.value) {
|
||||||
start.push(this.sourceToken);
|
start.push(this.sourceToken);
|
||||||
map.items.push({ start });
|
map.items.push({ start, explicitKey: true });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.stack.push({
|
this.stack.push({
|
||||||
type: 'block-map',
|
type: 'block-map',
|
||||||
offset: this.offset,
|
offset: this.offset,
|
||||||
indent: this.indent,
|
indent: this.indent,
|
||||||
items: [{ start: [this.sourceToken] }]
|
items: [{ start: [this.sourceToken], explicitKey: true }]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.onKeyLine = true;
|
this.onKeyLine = true;
|
||||||
return;
|
return;
|
||||||
case 'map-value-ind':
|
case 'map-value-ind':
|
||||||
if (includesToken(it.start, 'explicit-key-ind')) {
|
if (it.explicitKey) {
|
||||||
if (!it.sep) {
|
if (!it.sep) {
|
||||||
if (includesToken(it.start, 'newline')) {
|
if (includesToken(it.start, 'newline')) {
|
||||||
Object.assign(it, { key: null, sep: [this.sourceToken] });
|
Object.assign(it, { key: null, sep: [this.sourceToken] });
|
||||||
@ -68493,9 +68507,7 @@ class Parser {
|
|||||||
default: {
|
default: {
|
||||||
const bv = this.startBlockValue(map);
|
const bv = this.startBlockValue(map);
|
||||||
if (bv) {
|
if (bv) {
|
||||||
if (atNextItem &&
|
if (atMapIndent && bv.type !== 'block-seq') {
|
||||||
bv.type !== 'block-seq' &&
|
|
||||||
includesToken(it.start, 'explicit-key-ind')) {
|
|
||||||
map.items.push({ start });
|
map.items.push({ start });
|
||||||
}
|
}
|
||||||
this.stack.push(bv);
|
this.stack.push(bv);
|
||||||
@ -68716,7 +68728,7 @@ class Parser {
|
|||||||
type: 'block-map',
|
type: 'block-map',
|
||||||
offset: this.offset,
|
offset: this.offset,
|
||||||
indent: this.indent,
|
indent: this.indent,
|
||||||
items: [{ start }]
|
items: [{ start, explicitKey: true }]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case 'map-value-ind': {
|
case 'map-value-ind': {
|
||||||
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user