1
1
import Exception from "../exception" ;
2
2
3
- function LocationInfo ( locInfo ) {
4
- locInfo = locInfo || { } ;
5
- this . firstLine = locInfo . first_line ;
6
- this . firstColumn = locInfo . first_column ;
7
- this . lastColumn = locInfo . last_column ;
8
- this . lastLine = locInfo . last_line ;
9
- }
10
-
11
3
var AST = {
12
4
ProgramNode : function ( statements , blockParams , strip , locInfo ) {
13
- LocationInfo . call ( this , locInfo ) ;
5
+ this . loc = locInfo ;
14
6
this . type = "program" ;
15
7
this . statements = statements ;
16
8
this . blockParams = blockParams ;
17
9
this . strip = strip ;
18
10
} ,
19
11
20
12
MustacheNode : function ( rawParams , hash , open , strip , locInfo ) {
21
- LocationInfo . call ( this , locInfo ) ;
13
+ this . loc = locInfo ;
22
14
this . type = "mustache" ;
23
15
this . strip = strip ;
24
16
@@ -47,7 +39,7 @@ var AST = {
47
39
} ,
48
40
49
41
SexprNode : function ( rawParams , hash , locInfo ) {
50
- LocationInfo . call ( this , locInfo ) ;
42
+ this . loc = locInfo ;
51
43
52
44
this . type = "sexpr" ;
53
45
this . hash = hash ;
@@ -70,7 +62,7 @@ var AST = {
70
62
} ,
71
63
72
64
PartialNode : function ( partialName , context , hash , strip , locInfo ) {
73
- LocationInfo . call ( this , locInfo ) ;
65
+ this . loc = locInfo ;
74
66
this . type = "partial" ;
75
67
this . partialName = partialName ;
76
68
this . context = context ;
@@ -81,7 +73,7 @@ var AST = {
81
73
} ,
82
74
83
75
BlockNode : function ( sexpr , program , inverse , strip , locInfo ) {
84
- LocationInfo . call ( this , locInfo ) ;
76
+ this . loc = locInfo ;
85
77
86
78
this . type = 'block' ;
87
79
this . sexpr = sexpr ;
@@ -95,19 +87,19 @@ var AST = {
95
87
} ,
96
88
97
89
ContentNode : function ( string , locInfo ) {
98
- LocationInfo . call ( this , locInfo ) ;
90
+ this . loc = locInfo ;
99
91
this . type = "content" ;
100
92
this . original = this . string = string ;
101
93
} ,
102
94
103
95
HashNode : function ( pairs , locInfo ) {
104
- LocationInfo . call ( this , locInfo ) ;
96
+ this . loc = locInfo ;
105
97
this . type = "hash" ;
106
98
this . pairs = pairs ;
107
99
} ,
108
100
109
101
IdNode : function ( parts , locInfo ) {
110
- LocationInfo . call ( this , locInfo ) ;
102
+ this . loc = locInfo ;
111
103
this . type = "ID" ;
112
104
113
105
var original = "" ,
@@ -147,44 +139,44 @@ var AST = {
147
139
} ,
148
140
149
141
PartialNameNode : function ( name , locInfo ) {
150
- LocationInfo . call ( this , locInfo ) ;
142
+ this . loc = locInfo ;
151
143
this . type = "PARTIAL_NAME" ;
152
144
this . name = name . original ;
153
145
} ,
154
146
155
147
DataNode : function ( id , locInfo ) {
156
- LocationInfo . call ( this , locInfo ) ;
148
+ this . loc = locInfo ;
157
149
this . type = "DATA" ;
158
150
this . id = id ;
159
151
this . stringModeValue = id . stringModeValue ;
160
152
this . idName = '@' + id . stringModeValue ;
161
153
} ,
162
154
163
155
StringNode : function ( string , locInfo ) {
164
- LocationInfo . call ( this , locInfo ) ;
156
+ this . loc = locInfo ;
165
157
this . type = "STRING" ;
166
158
this . original =
167
159
this . string =
168
160
this . stringModeValue = string ;
169
161
} ,
170
162
171
163
NumberNode : function ( number , locInfo ) {
172
- LocationInfo . call ( this , locInfo ) ;
164
+ this . loc = locInfo ;
173
165
this . type = "NUMBER" ;
174
166
this . original =
175
167
this . number = number ;
176
168
this . stringModeValue = Number ( number ) ;
177
169
} ,
178
170
179
171
BooleanNode : function ( bool , locInfo ) {
180
- LocationInfo . call ( this , locInfo ) ;
172
+ this . loc = locInfo ;
181
173
this . type = "BOOLEAN" ;
182
174
this . bool = bool ;
183
175
this . stringModeValue = bool === "true" ;
184
176
} ,
185
177
186
178
CommentNode : function ( comment , strip , locInfo ) {
187
- LocationInfo . call ( this , locInfo ) ;
179
+ this . loc = locInfo ;
188
180
this . type = "comment" ;
189
181
this . comment = comment ;
190
182
0 commit comments