OLD | NEW |
| (Empty) |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 // NOTE: THIS FILE IS GENERATED. DO NOT EDIT. | |
6 // | |
7 // Instead modify 'pkg/front_end/messages.yaml' and run | |
8 // 'pkg/front_end/tool/_fasta/generate_messages.dart' to update. | |
9 | |
10 library fasta.problems; | |
11 | |
12 import 'package:front_end/src/fasta/scanner/token.dart' show Token; | |
13 | |
14 import 'package:front_end/src/fasta/parser/error_kind.dart' show ErrorKind; | |
15 | |
16 problemExpectedClassBodyToSkip(Token token) { | |
17 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
18 String lexeme = token.lexeme; | |
19 return { | |
20 'message': "Expected a class body, but got '$lexeme'.", | |
21 'code': ErrorKind.ExpectedClassBodyToSkip, | |
22 'arguments': { | |
23 'token': token, | |
24 }, | |
25 }; | |
26 } | |
27 | |
28 problemStackOverflow() { | |
29 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
30 | |
31 return { | |
32 'message': "Stack overflow.", | |
33 'code': ErrorKind.StackOverflow, | |
34 'arguments': {}, | |
35 }; | |
36 } | |
37 | |
38 problemUnexpectedToken(Token token) { | |
39 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
40 String lexeme = token.lexeme; | |
41 return { | |
42 'message': "Unexpected token '$lexeme'.", | |
43 'code': ErrorKind.UnexpectedToken, | |
44 'arguments': { | |
45 'token': token, | |
46 }, | |
47 }; | |
48 } | |
49 | |
50 problemAwaitAsIdentifier() { | |
51 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
52 | |
53 return { | |
54 'message': | |
55 "'await' can't be used as an identifier in 'async', 'async*', or 'sync*'
methods.", | |
56 'code': ErrorKind.AwaitAsIdentifier, | |
57 'arguments': {}, | |
58 }; | |
59 } | |
60 | |
61 problemFactoryNotSync() { | |
62 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
63 | |
64 return { | |
65 'message': "Factories can't use 'async', 'async*', or 'sync*'.", | |
66 'code': ErrorKind.FactoryNotSync, | |
67 'arguments': {}, | |
68 }; | |
69 } | |
70 | |
71 problemYieldNotGenerator() { | |
72 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
73 | |
74 return { | |
75 'message': "'yield' can only be used in 'sync*' or 'async*' methods.", | |
76 'code': ErrorKind.YieldNotGenerator, | |
77 'arguments': {}, | |
78 }; | |
79 } | |
80 | |
81 problemSetterNotSync() { | |
82 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
83 | |
84 return { | |
85 'message': "Setters can't use 'async', 'async*', or 'sync*'.", | |
86 'code': ErrorKind.SetterNotSync, | |
87 'arguments': {}, | |
88 }; | |
89 } | |
90 | |
91 problemNonAsciiWhitespace(int codePoint) { | |
92 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
93 String unicode = "(U+${codePoint.toRadixString(16).padLeft(4, '0')})"; | |
94 return { | |
95 'message': | |
96 "The non-ASCII space character $unicode can only be used in strings and
comments.", | |
97 'code': ErrorKind.NonAsciiWhitespace, | |
98 'arguments': { | |
99 'codePoint': codePoint, | |
100 }, | |
101 }; | |
102 } | |
103 | |
104 problemExpectedIdentifier(Token token) { | |
105 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
106 String lexeme = token.lexeme; | |
107 return { | |
108 'message': "'$lexeme' is a reserved word and can't be used here.", | |
109 'tip': "Try using a different name.", | |
110 'code': ErrorKind.ExpectedIdentifier, | |
111 'arguments': { | |
112 'token': token, | |
113 }, | |
114 }; | |
115 } | |
116 | |
117 problemExpectedBlockToSkip() { | |
118 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
119 | |
120 return { | |
121 'message': "Expected a function body or '=>'.", | |
122 'tip': "Try adding {}.", | |
123 'code': ErrorKind.ExpectedBlockToSkip, | |
124 'arguments': {}, | |
125 }; | |
126 } | |
127 | |
128 problemRequiredParameterWithDefault() { | |
129 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
130 | |
131 return { | |
132 'message': "Non-optional parameters can't have a default value.", | |
133 'tip': "Try removing the default value or making the parameter optional.", | |
134 'code': ErrorKind.RequiredParameterWithDefault, | |
135 'arguments': {}, | |
136 }; | |
137 } | |
138 | |
139 problemUnspecified(String string) { | |
140 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
141 | |
142 return { | |
143 'message': "$string", | |
144 'code': ErrorKind.Unspecified, | |
145 'arguments': { | |
146 'string': string, | |
147 }, | |
148 }; | |
149 } | |
150 | |
151 problemMissingExponent() { | |
152 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
153 | |
154 return { | |
155 'message': | |
156 "Numbers in exponential notation should always contain an exponent (an i
nteger number with an optional sign).", | |
157 'tip': | |
158 "Make sure there is an exponent, and remove any whitespace before it.", | |
159 'code': ErrorKind.MissingExponent, | |
160 'arguments': {}, | |
161 }; | |
162 } | |
163 | |
164 problemPositionalParameterWithEquals() { | |
165 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
166 | |
167 return { | |
168 'message': | |
169 "Positional optional parameters can't use ':' to specify a default value
.", | |
170 'tip': "Try replacing ':' with '='.", | |
171 'code': ErrorKind.PositionalParameterWithEquals, | |
172 'arguments': {}, | |
173 }; | |
174 } | |
175 | |
176 problemUnexpectedDollarInString() { | |
177 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
178 | |
179 return { | |
180 'message': | |
181 "A '\$' has special meaning inside a string, and must be followed by an
identifier or an expression in curly braces ({}).", | |
182 'tip': "Try adding a backslash (\) to escape the '\$'.", | |
183 'code': ErrorKind.UnexpectedDollarInString, | |
184 'arguments': {}, | |
185 }; | |
186 } | |
187 | |
188 problemExtraneousModifier(Token token) { | |
189 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
190 String lexeme = token.lexeme; | |
191 return { | |
192 'message': "Can't have modifier '$lexeme' here.", | |
193 'tip': "Try removing '$lexeme'.", | |
194 'code': ErrorKind.ExtraneousModifier, | |
195 'arguments': { | |
196 'token': token, | |
197 }, | |
198 }; | |
199 } | |
200 | |
201 problemEmptyOptionalParameterList() { | |
202 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
203 | |
204 return { | |
205 'message': "Optional parameter lists cannot be empty.", | |
206 'tip': "Try adding an optional parameter to the list.", | |
207 'code': ErrorKind.EmptyOptionalParameterList, | |
208 'arguments': {}, | |
209 }; | |
210 } | |
211 | |
212 problemUnterminatedString(String string) { | |
213 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
214 | |
215 return { | |
216 'message': "String must end with $string.", | |
217 'code': ErrorKind.UnterminatedString, | |
218 'arguments': { | |
219 'string': string, | |
220 }, | |
221 }; | |
222 } | |
223 | |
224 problemAwaitNotAsync() { | |
225 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
226 | |
227 return { | |
228 'message': "'await' can only be used in 'async' or 'async*' methods.", | |
229 'code': ErrorKind.AwaitNotAsync, | |
230 'arguments': {}, | |
231 }; | |
232 } | |
233 | |
234 problemExpectedFunctionBody(Token token) { | |
235 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
236 String lexeme = token.lexeme; | |
237 return { | |
238 'message': "Expected a function body, but got '$lexeme'.", | |
239 'code': ErrorKind.ExpectedFunctionBody, | |
240 'arguments': { | |
241 'token': token, | |
242 }, | |
243 }; | |
244 } | |
245 | |
246 problemExpectedHexDigit() { | |
247 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
248 | |
249 return { | |
250 'message': "A hex digit (0-9 or A-F) must follow '0x'.", | |
251 'code': ErrorKind.ExpectedHexDigit, | |
252 'arguments': {}, | |
253 }; | |
254 } | |
255 | |
256 problemEmptyNamedParameterList() { | |
257 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
258 | |
259 return { | |
260 'message': "Named parameter lists cannot be empty.", | |
261 'tip': "Try adding a named parameter to the list.", | |
262 'code': ErrorKind.EmptyNamedParameterList, | |
263 'arguments': {}, | |
264 }; | |
265 } | |
266 | |
267 problemUnsupportedPrefixPlus() { | |
268 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
269 | |
270 return { | |
271 'message': "'+' is not a prefix operator. ", | |
272 'tip': "Try removing '+'.", | |
273 'code': ErrorKind.UnsupportedPrefixPlus, | |
274 'arguments': {}, | |
275 }; | |
276 } | |
277 | |
278 problemExpectedString(Token token) { | |
279 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
280 String lexeme = token.lexeme; | |
281 return { | |
282 'message': "Expected a String, but got '$lexeme'.", | |
283 'code': ErrorKind.ExpectedString, | |
284 'arguments': { | |
285 'token': token, | |
286 }, | |
287 }; | |
288 } | |
289 | |
290 problemAbstractNotSync() { | |
291 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
292 | |
293 return { | |
294 'message': "Abstract methods can't use 'async', 'async*', or 'sync*'.", | |
295 'code': ErrorKind.AbstractNotSync, | |
296 'arguments': {}, | |
297 }; | |
298 } | |
299 | |
300 problemExpectedDeclaration(Token token) { | |
301 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
302 String lexeme = token.lexeme; | |
303 return { | |
304 'message': "Expected a declaration, but got '$lexeme'.", | |
305 'code': ErrorKind.ExpectedDeclaration, | |
306 'arguments': { | |
307 'token': token, | |
308 }, | |
309 }; | |
310 } | |
311 | |
312 problemAsciiControlCharacter(int codePoint) { | |
313 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
314 String unicode = "(U+${codePoint.toRadixString(16).padLeft(4, '0')})"; | |
315 return { | |
316 'message': | |
317 "The control character $unicode can only be used in strings and comments
.", | |
318 'code': ErrorKind.AsciiControlCharacter, | |
319 'arguments': { | |
320 'codePoint': codePoint, | |
321 }, | |
322 }; | |
323 } | |
324 | |
325 problemUnmatchedToken(String string, Token token) { | |
326 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
327 String lexeme = token.lexeme; | |
328 return { | |
329 'message': "Can't find '$string' to match '$lexeme'.", | |
330 'code': ErrorKind.UnmatchedToken, | |
331 'arguments': { | |
332 'string': string, | |
333 'token': token, | |
334 }, | |
335 }; | |
336 } | |
337 | |
338 problemInvalidSyncModifier() { | |
339 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
340 | |
341 return { | |
342 'message': "Invalid modifier 'sync'.", | |
343 'tip': "Try replacing 'sync' with 'sync*'.", | |
344 'code': ErrorKind.InvalidSyncModifier, | |
345 'arguments': {}, | |
346 }; | |
347 } | |
348 | |
349 problemExpectedOpenParens() { | |
350 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
351 | |
352 return { | |
353 'message': "Expected '('.", | |
354 'code': ErrorKind.ExpectedOpenParens, | |
355 'arguments': {}, | |
356 }; | |
357 } | |
358 | |
359 problemUnterminatedComment() { | |
360 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
361 | |
362 return { | |
363 'message': "Comment starting with '/*' must end with '*/'.", | |
364 'code': ErrorKind.UnterminatedComment, | |
365 'arguments': {}, | |
366 }; | |
367 } | |
368 | |
369 problemExpectedClassBody(Token token) { | |
370 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
371 String lexeme = token.lexeme; | |
372 return { | |
373 'message': "Expected a class body, but got '$lexeme'.", | |
374 'code': ErrorKind.ExpectedClassBody, | |
375 'arguments': { | |
376 'token': token, | |
377 }, | |
378 }; | |
379 } | |
380 | |
381 problemExpectedExpression(Token token) { | |
382 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
383 String lexeme = token.lexeme; | |
384 return { | |
385 'message': "Expected an expression, but got '$lexeme'.", | |
386 'code': ErrorKind.ExpectedExpression, | |
387 'arguments': { | |
388 'token': token, | |
389 }, | |
390 }; | |
391 } | |
392 | |
393 problemInvalidAwaitFor() { | |
394 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
395 | |
396 return { | |
397 'message': | |
398 "'await' is only supported in methods with an 'async' or 'async*' body m
odifier.", | |
399 'tip': | |
400 "Try adding 'async' or 'async*' to the method body or removing the 'awai
t' keyword.", | |
401 'code': ErrorKind.InvalidAwaitFor, | |
402 'arguments': {}, | |
403 }; | |
404 } | |
405 | |
406 problemExpectedType(Token token) { | |
407 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
408 String lexeme = token.lexeme; | |
409 return { | |
410 'message': "Expected a type, but got '$lexeme'.", | |
411 'code': ErrorKind.ExpectedType, | |
412 'arguments': { | |
413 'token': token, | |
414 }, | |
415 }; | |
416 } | |
417 | |
418 problemUnterminatedToken() { | |
419 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
420 | |
421 return { | |
422 'message': "Incomplete token.", | |
423 'code': ErrorKind.UnterminatedToken, | |
424 'arguments': {}, | |
425 }; | |
426 } | |
427 | |
428 problemExpectedButGot(Token token) { | |
429 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
430 String lexeme = token.lexeme; | |
431 return { | |
432 'message': "Expected '$lexeme' before this.", | |
433 'tip': "DONT_KNOW_HOW_TO_FIX,", | |
434 'code': ErrorKind.ExpectedButGot, | |
435 'arguments': { | |
436 'token': token, | |
437 }, | |
438 }; | |
439 } | |
440 | |
441 problemAwaitForNotAsync() { | |
442 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
443 | |
444 return { | |
445 'message': | |
446 "Asynchronous for-loop can only be used in 'async' or 'async*' methods."
, | |
447 'code': ErrorKind.AwaitForNotAsync, | |
448 'arguments': {}, | |
449 }; | |
450 } | |
451 | |
452 problemEncoding() { | |
453 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
454 | |
455 return { | |
456 'message': "Unable to decode bytes as UTF-8.", | |
457 'code': ErrorKind.Encoding, | |
458 'arguments': {}, | |
459 }; | |
460 } | |
461 | |
462 problemAsyncAsIdentifier() { | |
463 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
464 | |
465 return { | |
466 'message': | |
467 "'async' can't be used as an identifier in 'async', 'async*', or 'sync*'
methods.", | |
468 'code': ErrorKind.AsyncAsIdentifier, | |
469 'arguments': {}, | |
470 }; | |
471 } | |
472 | |
473 problemYieldAsIdentifier() { | |
474 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
475 | |
476 return { | |
477 'message': | |
478 "'yield' can't be used as an identifier in 'async', 'async*', or 'sync*'
methods.", | |
479 'code': ErrorKind.YieldAsIdentifier, | |
480 'arguments': {}, | |
481 }; | |
482 } | |
483 | |
484 problemOnlyTry() { | |
485 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
486 | |
487 return { | |
488 'message': | |
489 "Try block should be followed by 'on', 'catch', or 'finally' block.", | |
490 'tip': "Did you forget to add a 'finally' block?", | |
491 'code': ErrorKind.OnlyTry, | |
492 'arguments': {}, | |
493 }; | |
494 } | |
495 | |
496 problemInvalidInlineFunctionType() { | |
497 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
498 | |
499 return { | |
500 'message': "Invalid inline function type.", | |
501 'tip': | |
502 "Try changing the inline function type (as in 'int f()') to a prefixed f
unction type using the `Function` keyword (as in 'int Function() f').", | |
503 'code': ErrorKind.InvalidInlineFunctionType, | |
504 'arguments': {}, | |
505 }; | |
506 } | |
507 | |
508 problemExpectedBody() { | |
509 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
510 | |
511 return { | |
512 'message': "Expected a function body or '=>'.", | |
513 'tip': "Try adding {}.", | |
514 'code': ErrorKind.ExpectedBody, | |
515 'arguments': {}, | |
516 }; | |
517 } | |
518 | |
519 problemInvalidVoid() { | |
520 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
521 | |
522 return { | |
523 'message': "Type 'void' can't be used here because it isn't a return type.", | |
524 'tip': | |
525 "Try removing 'void' keyword or replace it with 'var', 'final', or a typ
e.", | |
526 'code': ErrorKind.InvalidVoid, | |
527 'arguments': {}, | |
528 }; | |
529 } | |
530 | |
531 problemBuiltInIdentifierAsType(Token token) { | |
532 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
533 String lexeme = token.lexeme; | |
534 return { | |
535 'message': "Can't use '$lexeme' as a type.", | |
536 'code': ErrorKind.BuiltInIdentifierAsType, | |
537 'arguments': { | |
538 'token': token, | |
539 }, | |
540 }; | |
541 } | |
542 | |
543 problemGeneratorReturnsValue() { | |
544 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
545 | |
546 return { | |
547 'message': "'sync*' and 'async*' can't return a value.", | |
548 'code': ErrorKind.GeneratorReturnsValue, | |
549 'arguments': {}, | |
550 }; | |
551 } | |
552 | |
553 problemBuiltInIdentifierInDeclaration(Token token) { | |
554 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
555 String lexeme = token.lexeme; | |
556 return { | |
557 'message': "Can't use '$lexeme' as a name here.", | |
558 'code': ErrorKind.BuiltInIdentifierInDeclaration, | |
559 'arguments': { | |
560 'token': token, | |
561 }, | |
562 }; | |
563 } | |
564 | |
565 problemNonAsciiIdentifier(String character, int codePoint) { | |
566 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
567 String unicode = "(U+${codePoint.toRadixString(16).padLeft(4, '0')})"; | |
568 return { | |
569 'message': | |
570 "The non-ASCII character '$character' ($unicode) can't be used in identi
fiers, only in strings and comments.", | |
571 'tip': | |
572 "Try using an US-ASCII letter, a digit, '_' (an underscore), or '\$' (a
dollar sign).", | |
573 'code': ErrorKind.NonAsciiIdentifier, | |
574 'arguments': { | |
575 'character': character, | |
576 'codePoint': codePoint, | |
577 }, | |
578 }; | |
579 } | |
580 | |
581 problemExtraneousModifierReplace(Token token) { | |
582 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | |
583 String lexeme = token.lexeme; | |
584 return { | |
585 'message': "Can't have modifier '$lexeme' here.", | |
586 'tip': "Try replacing modifier '$lexeme' with 'var', 'final', or a type.", | |
587 'code': ErrorKind.ExtraneousModifierReplace, | |
588 'arguments': { | |
589 'token': token, | |
590 }, | |
591 }; | |
592 } | |
OLD | NEW |