Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Side by Side Diff: pkg/front_end/lib/src/fasta/problems.dart

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

Powered by Google App Engine
This is Rietveld 408576698