@herb-tools/core 0.6.0 → 0.7.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/dist/herb-core.browser.js +235 -41
- package/dist/herb-core.browser.js.map +1 -1
- package/dist/herb-core.cjs +242 -40
- package/dist/herb-core.cjs.map +1 -1
- package/dist/herb-core.esm.js +235 -41
- package/dist/herb-core.esm.js.map +1 -1
- package/dist/herb-core.umd.js +242 -40
- package/dist/herb-core.umd.js.map +1 -1
- package/dist/types/ast-utils.d.ts +52 -2
- package/dist/types/node-type-guards.d.ts +3 -3
- package/dist/types/nodes.d.ts +41 -0
- package/package.json +1 -1
- package/src/ast-utils.ts +106 -3
- package/src/errors.ts +1 -1
- package/src/node-type-guards.ts +44 -42
- package/src/nodes.ts +147 -4
- package/src/visitor.ts +1 -1
package/src/nodes.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/javascript/packages/core/src/nodes.ts.erb
|
|
3
3
|
|
|
4
4
|
import { Location } from "./location.js"
|
|
5
5
|
import { Token, SerializedToken } from "./token.js"
|
|
@@ -33,6 +33,10 @@ export abstract class Node implements BaseNodeProps {
|
|
|
33
33
|
return fromSerializedNode(node)
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
static get type(): NodeType {
|
|
37
|
+
throw new Error("AST_NODE")
|
|
38
|
+
}
|
|
39
|
+
|
|
36
40
|
constructor(type: NodeType, location: Location, errors: HerbError[]) {
|
|
37
41
|
this.type = type
|
|
38
42
|
this.location = location
|
|
@@ -51,6 +55,14 @@ export abstract class Node implements BaseNodeProps {
|
|
|
51
55
|
return this.treeInspect(0)
|
|
52
56
|
}
|
|
53
57
|
|
|
58
|
+
is<T extends Node>(nodeClass: { new(...args: any[]): T; prototype: T, type: NodeType }): this is T {
|
|
59
|
+
return this.type === nodeClass.type
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
isOfType<T extends Node>(type: NodeType): this is T {
|
|
63
|
+
return this.type === type
|
|
64
|
+
}
|
|
65
|
+
|
|
54
66
|
get isSingleLine(): boolean {
|
|
55
67
|
return this.location.start.line === this.location.end.line
|
|
56
68
|
}
|
|
@@ -68,7 +80,7 @@ export abstract class Node implements BaseNodeProps {
|
|
|
68
80
|
if (!array) return "∅\n"
|
|
69
81
|
if (array.length === 0) return "[]\n"
|
|
70
82
|
|
|
71
|
-
let output = `(${array.length} item${array.length
|
|
83
|
+
let output = `(${array.length} item${array.length === 1 ? "" : "s"})\n`
|
|
72
84
|
|
|
73
85
|
array.forEach((item, index) => {
|
|
74
86
|
const isLast = index === array.length - 1
|
|
@@ -110,7 +122,7 @@ export abstract class Node implements BaseNodeProps {
|
|
|
110
122
|
.trimStart()
|
|
111
123
|
.split("\n")
|
|
112
124
|
.map((line, index) =>
|
|
113
|
-
index
|
|
125
|
+
index === 0 ? line.trimStart() : `${prefix}${prefix2}${line}`,
|
|
114
126
|
)
|
|
115
127
|
.join("\n")
|
|
116
128
|
.trimStart()
|
|
@@ -133,6 +145,10 @@ export interface DocumentNodeProps extends BaseNodeProps {
|
|
|
133
145
|
export class DocumentNode extends Node {
|
|
134
146
|
readonly children: Node[];
|
|
135
147
|
|
|
148
|
+
static get type(): NodeType {
|
|
149
|
+
return "AST_DOCUMENT_NODE"
|
|
150
|
+
}
|
|
151
|
+
|
|
136
152
|
static from(data: SerializedDocumentNode): DocumentNode {
|
|
137
153
|
return new DocumentNode({
|
|
138
154
|
type: data.type,
|
|
@@ -199,6 +215,10 @@ export interface LiteralNodeProps extends BaseNodeProps {
|
|
|
199
215
|
export class LiteralNode extends Node {
|
|
200
216
|
readonly content: string;
|
|
201
217
|
|
|
218
|
+
static get type(): NodeType {
|
|
219
|
+
return "AST_LITERAL_NODE"
|
|
220
|
+
}
|
|
221
|
+
|
|
202
222
|
static from(data: SerializedLiteralNode): LiteralNode {
|
|
203
223
|
return new LiteralNode({
|
|
204
224
|
type: data.type,
|
|
@@ -275,6 +295,10 @@ export class HTMLOpenTagNode extends Node {
|
|
|
275
295
|
readonly children: Node[];
|
|
276
296
|
readonly is_void: boolean;
|
|
277
297
|
|
|
298
|
+
static get type(): NodeType {
|
|
299
|
+
return "AST_HTML_OPEN_TAG_NODE"
|
|
300
|
+
}
|
|
301
|
+
|
|
278
302
|
static from(data: SerializedHTMLOpenTagNode): HTMLOpenTagNode {
|
|
279
303
|
return new HTMLOpenTagNode({
|
|
280
304
|
type: data.type,
|
|
@@ -366,6 +390,10 @@ export class HTMLCloseTagNode extends Node {
|
|
|
366
390
|
readonly children: Node[];
|
|
367
391
|
readonly tag_closing: Token | null;
|
|
368
392
|
|
|
393
|
+
static get type(): NodeType {
|
|
394
|
+
return "AST_HTML_CLOSE_TAG_NODE"
|
|
395
|
+
}
|
|
396
|
+
|
|
369
397
|
static from(data: SerializedHTMLCloseTagNode): HTMLCloseTagNode {
|
|
370
398
|
return new HTMLCloseTagNode({
|
|
371
399
|
type: data.type,
|
|
@@ -439,6 +467,7 @@ export interface SerializedHTMLElementNode extends SerializedNode {
|
|
|
439
467
|
body: SerializedNode[];
|
|
440
468
|
close_tag: SerializedHTMLCloseTagNode | null;
|
|
441
469
|
is_void: boolean;
|
|
470
|
+
source: string;
|
|
442
471
|
}
|
|
443
472
|
|
|
444
473
|
export interface HTMLElementNodeProps extends BaseNodeProps {
|
|
@@ -447,6 +476,7 @@ export interface HTMLElementNodeProps extends BaseNodeProps {
|
|
|
447
476
|
body: Node[];
|
|
448
477
|
close_tag: HTMLCloseTagNode | null;
|
|
449
478
|
is_void: boolean;
|
|
479
|
+
source: string;
|
|
450
480
|
}
|
|
451
481
|
|
|
452
482
|
export class HTMLElementNode extends Node {
|
|
@@ -455,6 +485,11 @@ export class HTMLElementNode extends Node {
|
|
|
455
485
|
readonly body: Node[];
|
|
456
486
|
readonly close_tag: HTMLCloseTagNode | null;
|
|
457
487
|
readonly is_void: boolean;
|
|
488
|
+
readonly source: string;
|
|
489
|
+
|
|
490
|
+
static get type(): NodeType {
|
|
491
|
+
return "AST_HTML_ELEMENT_NODE"
|
|
492
|
+
}
|
|
458
493
|
|
|
459
494
|
static from(data: SerializedHTMLElementNode): HTMLElementNode {
|
|
460
495
|
return new HTMLElementNode({
|
|
@@ -466,6 +501,7 @@ export class HTMLElementNode extends Node {
|
|
|
466
501
|
body: (data.body || []).map(node => fromSerializedNode(node)),
|
|
467
502
|
close_tag: data.close_tag ? fromSerializedNode((data.close_tag)) : null,
|
|
468
503
|
is_void: data.is_void,
|
|
504
|
+
source: data.source,
|
|
469
505
|
})
|
|
470
506
|
}
|
|
471
507
|
|
|
@@ -476,6 +512,7 @@ export class HTMLElementNode extends Node {
|
|
|
476
512
|
this.body = props.body;
|
|
477
513
|
this.close_tag = props.close_tag;
|
|
478
514
|
this.is_void = props.is_void;
|
|
515
|
+
this.source = props.source;
|
|
479
516
|
}
|
|
480
517
|
|
|
481
518
|
accept(visitor: Visitor): void {
|
|
@@ -512,6 +549,7 @@ export class HTMLElementNode extends Node {
|
|
|
512
549
|
body: this.body.map(node => node.toJSON()),
|
|
513
550
|
close_tag: this.close_tag ? this.close_tag.toJSON() : null,
|
|
514
551
|
is_void: this.is_void,
|
|
552
|
+
source: this.source,
|
|
515
553
|
};
|
|
516
554
|
}
|
|
517
555
|
|
|
@@ -524,7 +562,8 @@ export class HTMLElementNode extends Node {
|
|
|
524
562
|
output += `├── tag_name: ${this.tag_name ? this.tag_name.treeInspect() : "∅"}\n`;
|
|
525
563
|
output += `├── body: ${this.inspectArray(this.body, "│ ")}`;
|
|
526
564
|
output += `├── close_tag: ${this.inspectNode(this.close_tag, "│ ")}`;
|
|
527
|
-
output +=
|
|
565
|
+
output += `├── is_void: ${typeof this.is_void === 'boolean' ? String(this.is_void) : "∅"}\n`;
|
|
566
|
+
output += `└── source: ${this.source ? JSON.stringify(this.source) : "∅"}\n`;
|
|
528
567
|
|
|
529
568
|
return output
|
|
530
569
|
}
|
|
@@ -551,6 +590,10 @@ export class HTMLAttributeValueNode extends Node {
|
|
|
551
590
|
readonly close_quote: Token | null;
|
|
552
591
|
readonly quoted: boolean;
|
|
553
592
|
|
|
593
|
+
static get type(): NodeType {
|
|
594
|
+
return "AST_HTML_ATTRIBUTE_VALUE_NODE"
|
|
595
|
+
}
|
|
596
|
+
|
|
554
597
|
static from(data: SerializedHTMLAttributeValueNode): HTMLAttributeValueNode {
|
|
555
598
|
return new HTMLAttributeValueNode({
|
|
556
599
|
type: data.type,
|
|
@@ -629,6 +672,10 @@ export interface HTMLAttributeNameNodeProps extends BaseNodeProps {
|
|
|
629
672
|
export class HTMLAttributeNameNode extends Node {
|
|
630
673
|
readonly children: Node[];
|
|
631
674
|
|
|
675
|
+
static get type(): NodeType {
|
|
676
|
+
return "AST_HTML_ATTRIBUTE_NAME_NODE"
|
|
677
|
+
}
|
|
678
|
+
|
|
632
679
|
static from(data: SerializedHTMLAttributeNameNode): HTMLAttributeNameNode {
|
|
633
680
|
return new HTMLAttributeNameNode({
|
|
634
681
|
type: data.type,
|
|
@@ -701,6 +748,10 @@ export class HTMLAttributeNode extends Node {
|
|
|
701
748
|
readonly equals: Token | null;
|
|
702
749
|
readonly value: HTMLAttributeValueNode | null;
|
|
703
750
|
|
|
751
|
+
static get type(): NodeType {
|
|
752
|
+
return "AST_HTML_ATTRIBUTE_NODE"
|
|
753
|
+
}
|
|
754
|
+
|
|
704
755
|
static from(data: SerializedHTMLAttributeNode): HTMLAttributeNode {
|
|
705
756
|
return new HTMLAttributeNode({
|
|
706
757
|
type: data.type,
|
|
@@ -777,6 +828,10 @@ export interface HTMLTextNodeProps extends BaseNodeProps {
|
|
|
777
828
|
export class HTMLTextNode extends Node {
|
|
778
829
|
readonly content: string;
|
|
779
830
|
|
|
831
|
+
static get type(): NodeType {
|
|
832
|
+
return "AST_HTML_TEXT_NODE"
|
|
833
|
+
}
|
|
834
|
+
|
|
780
835
|
static from(data: SerializedHTMLTextNode): HTMLTextNode {
|
|
781
836
|
return new HTMLTextNode({
|
|
782
837
|
type: data.type,
|
|
@@ -847,6 +902,10 @@ export class HTMLCommentNode extends Node {
|
|
|
847
902
|
readonly children: Node[];
|
|
848
903
|
readonly comment_end: Token | null;
|
|
849
904
|
|
|
905
|
+
static get type(): NodeType {
|
|
906
|
+
return "AST_HTML_COMMENT_NODE"
|
|
907
|
+
}
|
|
908
|
+
|
|
850
909
|
static from(data: SerializedHTMLCommentNode): HTMLCommentNode {
|
|
851
910
|
return new HTMLCommentNode({
|
|
852
911
|
type: data.type,
|
|
@@ -927,6 +986,10 @@ export class HTMLDoctypeNode extends Node {
|
|
|
927
986
|
readonly children: Node[];
|
|
928
987
|
readonly tag_closing: Token | null;
|
|
929
988
|
|
|
989
|
+
static get type(): NodeType {
|
|
990
|
+
return "AST_HTML_DOCTYPE_NODE"
|
|
991
|
+
}
|
|
992
|
+
|
|
930
993
|
static from(data: SerializedHTMLDoctypeNode): HTMLDoctypeNode {
|
|
931
994
|
return new HTMLDoctypeNode({
|
|
932
995
|
type: data.type,
|
|
@@ -1007,6 +1070,10 @@ export class XMLDeclarationNode extends Node {
|
|
|
1007
1070
|
readonly children: Node[];
|
|
1008
1071
|
readonly tag_closing: Token | null;
|
|
1009
1072
|
|
|
1073
|
+
static get type(): NodeType {
|
|
1074
|
+
return "AST_XML_DECLARATION_NODE"
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1010
1077
|
static from(data: SerializedXMLDeclarationNode): XMLDeclarationNode {
|
|
1011
1078
|
return new XMLDeclarationNode({
|
|
1012
1079
|
type: data.type,
|
|
@@ -1087,6 +1154,10 @@ export class CDATANode extends Node {
|
|
|
1087
1154
|
readonly children: Node[];
|
|
1088
1155
|
readonly tag_closing: Token | null;
|
|
1089
1156
|
|
|
1157
|
+
static get type(): NodeType {
|
|
1158
|
+
return "AST_CDATA_NODE"
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1090
1161
|
static from(data: SerializedCDATANode): CDATANode {
|
|
1091
1162
|
return new CDATANode({
|
|
1092
1163
|
type: data.type,
|
|
@@ -1161,6 +1232,10 @@ export interface WhitespaceNodeProps extends BaseNodeProps {
|
|
|
1161
1232
|
export class WhitespaceNode extends Node {
|
|
1162
1233
|
readonly value: Token | null;
|
|
1163
1234
|
|
|
1235
|
+
static get type(): NodeType {
|
|
1236
|
+
return "AST_WHITESPACE_NODE"
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1164
1239
|
static from(data: SerializedWhitespaceNode): WhitespaceNode {
|
|
1165
1240
|
return new WhitespaceNode({
|
|
1166
1241
|
type: data.type,
|
|
@@ -1240,6 +1315,10 @@ export class ERBContentNode extends Node {
|
|
|
1240
1315
|
readonly parsed: boolean;
|
|
1241
1316
|
readonly valid: boolean;
|
|
1242
1317
|
|
|
1318
|
+
static get type(): NodeType {
|
|
1319
|
+
return "AST_ERB_CONTENT_NODE"
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1243
1322
|
static from(data: SerializedERBContentNode): ERBContentNode {
|
|
1244
1323
|
return new ERBContentNode({
|
|
1245
1324
|
type: data.type,
|
|
@@ -1330,6 +1409,10 @@ export class ERBEndNode extends Node {
|
|
|
1330
1409
|
readonly content: Token | null;
|
|
1331
1410
|
readonly tag_closing: Token | null;
|
|
1332
1411
|
|
|
1412
|
+
static get type(): NodeType {
|
|
1413
|
+
return "AST_ERB_END_NODE"
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1333
1416
|
static from(data: SerializedERBEndNode): ERBEndNode {
|
|
1334
1417
|
return new ERBEndNode({
|
|
1335
1418
|
type: data.type,
|
|
@@ -1411,6 +1494,10 @@ export class ERBElseNode extends Node {
|
|
|
1411
1494
|
readonly tag_closing: Token | null;
|
|
1412
1495
|
readonly statements: Node[];
|
|
1413
1496
|
|
|
1497
|
+
static get type(): NodeType {
|
|
1498
|
+
return "AST_ERB_ELSE_NODE"
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1414
1501
|
static from(data: SerializedERBElseNode): ERBElseNode {
|
|
1415
1502
|
return new ERBElseNode({
|
|
1416
1503
|
type: data.type,
|
|
@@ -1504,6 +1591,10 @@ export class ERBIfNode extends Node {
|
|
|
1504
1591
|
readonly subsequent: Node | null;
|
|
1505
1592
|
readonly end_node: ERBEndNode | null;
|
|
1506
1593
|
|
|
1594
|
+
static get type(): NodeType {
|
|
1595
|
+
return "AST_ERB_IF_NODE"
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1507
1598
|
static from(data: SerializedERBIfNode): ERBIfNode {
|
|
1508
1599
|
return new ERBIfNode({
|
|
1509
1600
|
type: data.type,
|
|
@@ -1606,6 +1697,10 @@ export class ERBBlockNode extends Node {
|
|
|
1606
1697
|
readonly body: Node[];
|
|
1607
1698
|
readonly end_node: ERBEndNode | null;
|
|
1608
1699
|
|
|
1700
|
+
static get type(): NodeType {
|
|
1701
|
+
return "AST_ERB_BLOCK_NODE"
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1609
1704
|
static from(data: SerializedERBBlockNode): ERBBlockNode {
|
|
1610
1705
|
return new ERBBlockNode({
|
|
1611
1706
|
type: data.type,
|
|
@@ -1699,6 +1794,10 @@ export class ERBWhenNode extends Node {
|
|
|
1699
1794
|
readonly tag_closing: Token | null;
|
|
1700
1795
|
readonly statements: Node[];
|
|
1701
1796
|
|
|
1797
|
+
static get type(): NodeType {
|
|
1798
|
+
return "AST_ERB_WHEN_NODE"
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1702
1801
|
static from(data: SerializedERBWhenNode): ERBWhenNode {
|
|
1703
1802
|
return new ERBWhenNode({
|
|
1704
1803
|
type: data.type,
|
|
@@ -1795,6 +1894,10 @@ export class ERBCaseNode extends Node {
|
|
|
1795
1894
|
readonly else_clause: ERBElseNode | null;
|
|
1796
1895
|
readonly end_node: ERBEndNode | null;
|
|
1797
1896
|
|
|
1897
|
+
static get type(): NodeType {
|
|
1898
|
+
return "AST_ERB_CASE_NODE"
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1798
1901
|
static from(data: SerializedERBCaseNode): ERBCaseNode {
|
|
1799
1902
|
return new ERBCaseNode({
|
|
1800
1903
|
type: data.type,
|
|
@@ -1909,6 +2012,10 @@ export class ERBCaseMatchNode extends Node {
|
|
|
1909
2012
|
readonly else_clause: ERBElseNode | null;
|
|
1910
2013
|
readonly end_node: ERBEndNode | null;
|
|
1911
2014
|
|
|
2015
|
+
static get type(): NodeType {
|
|
2016
|
+
return "AST_ERB_CASE_MATCH_NODE"
|
|
2017
|
+
}
|
|
2018
|
+
|
|
1912
2019
|
static from(data: SerializedERBCaseMatchNode): ERBCaseMatchNode {
|
|
1913
2020
|
return new ERBCaseMatchNode({
|
|
1914
2021
|
type: data.type,
|
|
@@ -2017,6 +2124,10 @@ export class ERBWhileNode extends Node {
|
|
|
2017
2124
|
readonly statements: Node[];
|
|
2018
2125
|
readonly end_node: ERBEndNode | null;
|
|
2019
2126
|
|
|
2127
|
+
static get type(): NodeType {
|
|
2128
|
+
return "AST_ERB_WHILE_NODE"
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2020
2131
|
static from(data: SerializedERBWhileNode): ERBWhileNode {
|
|
2021
2132
|
return new ERBWhileNode({
|
|
2022
2133
|
type: data.type,
|
|
@@ -2113,6 +2224,10 @@ export class ERBUntilNode extends Node {
|
|
|
2113
2224
|
readonly statements: Node[];
|
|
2114
2225
|
readonly end_node: ERBEndNode | null;
|
|
2115
2226
|
|
|
2227
|
+
static get type(): NodeType {
|
|
2228
|
+
return "AST_ERB_UNTIL_NODE"
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2116
2231
|
static from(data: SerializedERBUntilNode): ERBUntilNode {
|
|
2117
2232
|
return new ERBUntilNode({
|
|
2118
2233
|
type: data.type,
|
|
@@ -2209,6 +2324,10 @@ export class ERBForNode extends Node {
|
|
|
2209
2324
|
readonly statements: Node[];
|
|
2210
2325
|
readonly end_node: ERBEndNode | null;
|
|
2211
2326
|
|
|
2327
|
+
static get type(): NodeType {
|
|
2328
|
+
return "AST_ERB_FOR_NODE"
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2212
2331
|
static from(data: SerializedERBForNode): ERBForNode {
|
|
2213
2332
|
return new ERBForNode({
|
|
2214
2333
|
type: data.type,
|
|
@@ -2305,6 +2424,10 @@ export class ERBRescueNode extends Node {
|
|
|
2305
2424
|
readonly statements: Node[];
|
|
2306
2425
|
readonly subsequent: ERBRescueNode | null;
|
|
2307
2426
|
|
|
2427
|
+
static get type(): NodeType {
|
|
2428
|
+
return "AST_ERB_RESCUE_NODE"
|
|
2429
|
+
}
|
|
2430
|
+
|
|
2308
2431
|
static from(data: SerializedERBRescueNode): ERBRescueNode {
|
|
2309
2432
|
return new ERBRescueNode({
|
|
2310
2433
|
type: data.type,
|
|
@@ -2398,6 +2521,10 @@ export class ERBEnsureNode extends Node {
|
|
|
2398
2521
|
readonly tag_closing: Token | null;
|
|
2399
2522
|
readonly statements: Node[];
|
|
2400
2523
|
|
|
2524
|
+
static get type(): NodeType {
|
|
2525
|
+
return "AST_ERB_ENSURE_NODE"
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2401
2528
|
static from(data: SerializedERBEnsureNode): ERBEnsureNode {
|
|
2402
2529
|
return new ERBEnsureNode({
|
|
2403
2530
|
type: data.type,
|
|
@@ -2497,6 +2624,10 @@ export class ERBBeginNode extends Node {
|
|
|
2497
2624
|
readonly ensure_clause: ERBEnsureNode | null;
|
|
2498
2625
|
readonly end_node: ERBEndNode | null;
|
|
2499
2626
|
|
|
2627
|
+
static get type(): NodeType {
|
|
2628
|
+
return "AST_ERB_BEGIN_NODE"
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2500
2631
|
static from(data: SerializedERBBeginNode): ERBBeginNode {
|
|
2501
2632
|
return new ERBBeginNode({
|
|
2502
2633
|
type: data.type,
|
|
@@ -2614,6 +2745,10 @@ export class ERBUnlessNode extends Node {
|
|
|
2614
2745
|
readonly else_clause: ERBElseNode | null;
|
|
2615
2746
|
readonly end_node: ERBEndNode | null;
|
|
2616
2747
|
|
|
2748
|
+
static get type(): NodeType {
|
|
2749
|
+
return "AST_ERB_UNLESS_NODE"
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2617
2752
|
static from(data: SerializedERBUnlessNode): ERBUnlessNode {
|
|
2618
2753
|
return new ERBUnlessNode({
|
|
2619
2754
|
type: data.type,
|
|
@@ -2710,6 +2845,10 @@ export class ERBYieldNode extends Node {
|
|
|
2710
2845
|
readonly content: Token | null;
|
|
2711
2846
|
readonly tag_closing: Token | null;
|
|
2712
2847
|
|
|
2848
|
+
static get type(): NodeType {
|
|
2849
|
+
return "AST_ERB_YIELD_NODE"
|
|
2850
|
+
}
|
|
2851
|
+
|
|
2713
2852
|
static from(data: SerializedERBYieldNode): ERBYieldNode {
|
|
2714
2853
|
return new ERBYieldNode({
|
|
2715
2854
|
type: data.type,
|
|
@@ -2791,6 +2930,10 @@ export class ERBInNode extends Node {
|
|
|
2791
2930
|
readonly tag_closing: Token | null;
|
|
2792
2931
|
readonly statements: Node[];
|
|
2793
2932
|
|
|
2933
|
+
static get type(): NodeType {
|
|
2934
|
+
return "AST_ERB_IN_NODE"
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2794
2937
|
static from(data: SerializedERBInNode): ERBInNode {
|
|
2795
2938
|
return new ERBInNode({
|
|
2796
2939
|
type: data.type,
|
package/src/visitor.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/javascript/packages/core/src/visitor.ts.erb
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
Node,
|