@stxt-lang/core 0.11.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/core/LineParser.d.ts +1 -1
- package/out/core/LineParser.js +1 -1
- package/out/core/Parser.js +3 -1
- package/package.json +1 -1
package/out/core/LineParser.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { Line } from "./Line";
|
|
|
12
12
|
*
|
|
13
13
|
* @param line source line, with its indentation.
|
|
14
14
|
* @param lastNodeBlock true if the node currently open is a BLOCK text node.
|
|
15
|
-
* @param lastLevel indentation level of the node currently open.
|
|
15
|
+
* @param lastLevel indentation level of the node currently open, -1 when there is none.
|
|
16
16
|
* @param numLine line number, for the error messages.
|
|
17
17
|
* @param validate false to split the line without enforcing the indentation rules.
|
|
18
18
|
* @returns the line already split into indentation and content.
|
package/out/core/LineParser.js
CHANGED
|
@@ -18,7 +18,7 @@ const Line_1 = require("./Line");
|
|
|
18
18
|
*
|
|
19
19
|
* @param line source line, with its indentation.
|
|
20
20
|
* @param lastNodeBlock true if the node currently open is a BLOCK text node.
|
|
21
|
-
* @param lastLevel indentation level of the node currently open.
|
|
21
|
+
* @param lastLevel indentation level of the node currently open, -1 when there is none.
|
|
22
22
|
* @param numLine line number, for the error messages.
|
|
23
23
|
* @param validate false to split the line without enforcing the indentation rules.
|
|
24
24
|
* @returns the line already split into indentation and content.
|
package/out/core/Parser.js
CHANGED
|
@@ -86,7 +86,9 @@ class Parser {
|
|
|
86
86
|
try {
|
|
87
87
|
const lastNode = stack.length === 0 ? null : stack[stack.length - 1];
|
|
88
88
|
// The stack holds the open nodes, one per level: its size is the level of the next line's parent
|
|
89
|
-
|
|
89
|
+
// With no open node the reference level is -1 (spec 8.3): the first line of the
|
|
90
|
+
// document, and the first after every node has been closed, must be at level 0.
|
|
91
|
+
const lastLevel = lastNode ? stack.length - 1 : -1;
|
|
90
92
|
const lastNodeText = lastNode instanceof TextNode_1.TextNode;
|
|
91
93
|
// Parse the line
|
|
92
94
|
const line = (0, LineParser_1.parseLine)(lineString, lastNodeText, lastLevel, lineNumber);
|