File tree Expand file tree Collapse file tree 6 files changed +298
-7
lines changed
fluent/test/fixtures_structure Expand file tree Collapse file tree 6 files changed +298
-7
lines changed Original file line number Diff line number Diff line change @@ -134,9 +134,12 @@ export default class FluentParser {
134
134
throw err ;
135
135
}
136
136
137
- const errorIndex = ps . index ;
137
+ let errorIndex = ps . index ;
138
138
ps . skipToNextEntryStart ( entryStartPos ) ;
139
- const nextEntryStart = ps . index ;
139
+ let nextEntryStart = ps . index ;
140
+ if ( nextEntryStart < errorIndex ) {
141
+ errorIndex = nextEntryStart ;
142
+ }
140
143
141
144
// Create a Junk instance
142
145
const slice = ps . string . substring ( entryStartPos , nextEntryStart ) ;
Original file line number Diff line number Diff line change 1
- # ~ERROR E0003, pos 12 , args "}"
1
+ # ~ERROR E0003, pos 8 , args "}"
2
2
foo = {
3
3
bar = Bar
4
4
# ~ERROR E0014 , pos 26
Original file line number Diff line number Diff line change
1
+ key01 = Value
2
+ Continued here.
3
+
4
+ key02 =
5
+ Value
6
+ Continued here.
7
+
8
+ # ERROR "Continued" looks like a new message.
9
+ # key03 parses fine with just "Value".
10
+ key03 =
11
+ Value
12
+ Continued here
13
+ and here.
14
+
15
+ # ERROR "Continued" and "and" look like new messages
16
+ # key04 parses fine with just "Value".
17
+ key04 =
18
+ Value
19
+ Continued here
20
+ and even here.
Original file line number Diff line number Diff line change
1
+ {
2
+ "type" : " Resource" ,
3
+ "body" : [
4
+ {
5
+ "type" : " Message" ,
6
+ "id" : {
7
+ "type" : " Identifier" ,
8
+ "name" : " key01" ,
9
+ "span" : {
10
+ "type" : " Span" ,
11
+ "start" : 0 ,
12
+ "end" : 5
13
+ }
14
+ },
15
+ "value" : {
16
+ "type" : " Pattern" ,
17
+ "elements" : [
18
+ {
19
+ "type" : " TextElement" ,
20
+ "value" : " Value\n Continued here." ,
21
+ "span" : {
22
+ "type" : " Span" ,
23
+ "start" : 8 ,
24
+ "end" : 33
25
+ }
26
+ }
27
+ ],
28
+ "span" : {
29
+ "type" : " Span" ,
30
+ "start" : 8 ,
31
+ "end" : 33
32
+ }
33
+ },
34
+ "attributes" : [],
35
+ "comment" : null ,
36
+ "span" : {
37
+ "type" : " Span" ,
38
+ "start" : 0 ,
39
+ "end" : 33
40
+ }
41
+ },
42
+ {
43
+ "type" : " Message" ,
44
+ "id" : {
45
+ "type" : " Identifier" ,
46
+ "name" : " key02" ,
47
+ "span" : {
48
+ "type" : " Span" ,
49
+ "start" : 35 ,
50
+ "end" : 40
51
+ }
52
+ },
53
+ "value" : {
54
+ "type" : " Pattern" ,
55
+ "elements" : [
56
+ {
57
+ "type" : " TextElement" ,
58
+ "value" : " Value\n Continued here." ,
59
+ "span" : {
60
+ "type" : " Span" ,
61
+ "start" : 47 ,
62
+ "end" : 72
63
+ }
64
+ }
65
+ ],
66
+ "span" : {
67
+ "type" : " Span" ,
68
+ "start" : 47 ,
69
+ "end" : 72
70
+ }
71
+ },
72
+ "attributes" : [],
73
+ "comment" : null ,
74
+ "span" : {
75
+ "type" : " Span" ,
76
+ "start" : 35 ,
77
+ "end" : 72
78
+ }
79
+ },
80
+ {
81
+ "type" : " Message" ,
82
+ "id" : {
83
+ "type" : " Identifier" ,
84
+ "name" : " key03" ,
85
+ "span" : {
86
+ "type" : " Span" ,
87
+ "start" : 159 ,
88
+ "end" : 164
89
+ }
90
+ },
91
+ "value" : {
92
+ "type" : " Pattern" ,
93
+ "elements" : [
94
+ {
95
+ "type" : " TextElement" ,
96
+ "value" : " Value" ,
97
+ "span" : {
98
+ "type" : " Span" ,
99
+ "start" : 171 ,
100
+ "end" : 176
101
+ }
102
+ }
103
+ ],
104
+ "span" : {
105
+ "type" : " Span" ,
106
+ "start" : 171 ,
107
+ "end" : 176
108
+ }
109
+ },
110
+ "attributes" : [],
111
+ "comment" : {
112
+ "type" : " Comment" ,
113
+ "content" : " ERROR \" Continued\" looks like a new message.\n key03 parses fine with just \" Value\" ." ,
114
+ "span" : {
115
+ "type" : " Span" ,
116
+ "start" : 74 ,
117
+ "end" : 158
118
+ }
119
+ },
120
+ "span" : {
121
+ "type" : " Span" ,
122
+ "start" : 74 ,
123
+ "end" : 176
124
+ }
125
+ },
126
+ {
127
+ "type" : " Junk" ,
128
+ "annotations" : [
129
+ {
130
+ "type" : " Annotation" ,
131
+ "code" : " E0003" ,
132
+ "args" : [
133
+ " ="
134
+ ],
135
+ "message" : " Expected token: \" =\" " ,
136
+ "span" : {
137
+ "type" : " Span" ,
138
+ "start" : 187 ,
139
+ "end" : 187
140
+ }
141
+ }
142
+ ],
143
+ "content" : " Continued here\n and here.\n\n " ,
144
+ "span" : {
145
+ "type" : " Span" ,
146
+ "start" : 177 ,
147
+ "end" : 207
148
+ }
149
+ },
150
+ {
151
+ "type" : " Message" ,
152
+ "id" : {
153
+ "type" : " Identifier" ,
154
+ "name" : " key04" ,
155
+ "span" : {
156
+ "type" : " Span" ,
157
+ "start" : 299 ,
158
+ "end" : 304
159
+ }
160
+ },
161
+ "value" : {
162
+ "type" : " Pattern" ,
163
+ "elements" : [
164
+ {
165
+ "type" : " TextElement" ,
166
+ "value" : " Value" ,
167
+ "span" : {
168
+ "type" : " Span" ,
169
+ "start" : 311 ,
170
+ "end" : 316
171
+ }
172
+ }
173
+ ],
174
+ "span" : {
175
+ "type" : " Span" ,
176
+ "start" : 311 ,
177
+ "end" : 316
178
+ }
179
+ },
180
+ "attributes" : [],
181
+ "comment" : {
182
+ "type" : " Comment" ,
183
+ "content" : " ERROR \" Continued\" and \" and\" look like new messages\n key04 parses fine with just \" Value\" ." ,
184
+ "span" : {
185
+ "type" : " Span" ,
186
+ "start" : 207 ,
187
+ "end" : 298
188
+ }
189
+ },
190
+ "span" : {
191
+ "type" : " Span" ,
192
+ "start" : 207 ,
193
+ "end" : 316
194
+ }
195
+ },
196
+ {
197
+ "type" : " Junk" ,
198
+ "annotations" : [
199
+ {
200
+ "type" : " Annotation" ,
201
+ "code" : " E0003" ,
202
+ "args" : [
203
+ " ="
204
+ ],
205
+ "message" : " Expected token: \" =\" " ,
206
+ "span" : {
207
+ "type" : " Span" ,
208
+ "start" : 327 ,
209
+ "end" : 327
210
+ }
211
+ }
212
+ ],
213
+ "content" : " Continued here\n " ,
214
+ "span" : {
215
+ "type" : " Span" ,
216
+ "start" : 317 ,
217
+ "end" : 332
218
+ }
219
+ },
220
+ {
221
+ "type" : " Junk" ,
222
+ "annotations" : [
223
+ {
224
+ "type" : " Annotation" ,
225
+ "code" : " E0003" ,
226
+ "args" : [
227
+ " ="
228
+ ],
229
+ "message" : " Expected token: \" =\" " ,
230
+ "span" : {
231
+ "type" : " Span" ,
232
+ "start" : 336 ,
233
+ "end" : 336
234
+ }
235
+ }
236
+ ],
237
+ "content" : " and even here.\n " ,
238
+ "span" : {
239
+ "type" : " Span" ,
240
+ "start" : 332 ,
241
+ "end" : 347
242
+ }
243
+ }
244
+ ],
245
+ "span" : {
246
+ "type" : " Span" ,
247
+ "start" : 0 ,
248
+ "end" : 347
249
+ }
250
+ }
Original file line number Diff line number Diff line change 13
13
"message" : " Expected token: \" }\" " ,
14
14
"span" : {
15
15
"type" : " Span" ,
16
- "start" : 16 ,
17
- "end" : 16
16
+ "start" : 10 ,
17
+ "end" : 10
18
18
}
19
19
}
20
20
],
73
73
"message" : " Positional arguments must not follow named arguments" ,
74
74
"span" : {
75
75
"type" : " Span" ,
76
- "start" : 76 ,
77
- "end" : 76
76
+ "start" : 70 ,
77
+ "end" : 70
78
78
}
79
79
}
80
80
],
Original file line number Diff line number Diff line change
1
+ {
2
+ "key01" : [
3
+ " Value" ,
4
+ " \n " ,
5
+ " Continued here."
6
+ ],
7
+ "key02" : [
8
+ " Value" ,
9
+ " \n " ,
10
+ " Continued here."
11
+ ],
12
+ "key03" : [
13
+ " Value"
14
+ ],
15
+ "key04" : [
16
+ " Value"
17
+ ]
18
+ }
You can’t perform that action at this time.
0 commit comments