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

Side by Side Diff: pkg/analyzer_experimental/lib/src/generated/parser.dart

Issue 23852002: java2dart improvements and new analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 library engine.parser; 3 library engine.parser;
4 import 'dart:collection'; 4 import 'dart:collection';
5 import 'java_core.dart'; 5 import 'java_core.dart';
6 import 'instrumentation.dart'; 6 import 'instrumentation.dart';
7 import 'error.dart'; 7 import 'error.dart';
8 import 'source.dart'; 8 import 'source.dart';
9 import 'scanner.dart'; 9 import 'scanner.dart';
10 import 'ast.dart'; 10 import 'ast.dart';
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 * value is invalid. 420 * value is invalid.
421 * 421 *
422 * @param builder the builder to which the scalar value is to be appended 422 * @param builder the builder to which the scalar value is to be appended
423 * @param escapeSequence the escape sequence that was parsed to produce the sc alar value 423 * @param escapeSequence the escape sequence that was parsed to produce the sc alar value
424 * @param scalarValue the value to be appended 424 * @param scalarValue the value to be appended
425 * @param startIndex the index of the first character representing the scalar value 425 * @param startIndex the index of the first character representing the scalar value
426 * @param endIndex the index of the last character representing the scalar val ue 426 * @param endIndex the index of the last character representing the scalar val ue
427 */ 427 */
428 void appendScalarValue(JavaStringBuilder builder, String escapeSequence, int s calarValue, int startIndex, int endIndex) { 428 void appendScalarValue(JavaStringBuilder builder, String escapeSequence, int s calarValue, int startIndex, int endIndex) {
429 if (scalarValue < 0 || scalarValue > Character.MAX_CODE_POINT || (scalarValu e >= 0xD800 && scalarValue <= 0xDFFF)) { 429 if (scalarValue < 0 || scalarValue > Character.MAX_CODE_POINT || (scalarValu e >= 0xD800 && scalarValue <= 0xDFFF)) {
430 reportError7(ParserErrorCode.INVALID_CODE_POINT, [escapeSequence]); 430 reportError8(ParserErrorCode.INVALID_CODE_POINT, [escapeSequence]);
431 return; 431 return;
432 } 432 }
433 if (scalarValue < Character.MAX_VALUE) { 433 if (scalarValue < Character.MAX_VALUE) {
434 builder.appendChar((scalarValue as int)); 434 builder.appendChar(scalarValue as int);
435 } else { 435 } else {
436 builder.append(Character.toChars(scalarValue)); 436 builder.append(Character.toChars(scalarValue));
437 } 437 }
438 } 438 }
439 439
440 /** 440 /**
441 * Compute the content of a string with the given literal representation. 441 * Compute the content of a string with the given literal representation.
442 * 442 *
443 * @param lexeme the literal representation of the string 443 * @param lexeme the literal representation of the string
444 * @param first `true` if this is the first token in a string literal 444 * @param first `true` if this is the first token in a string literal
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 * 563 *
564 * assignableSelector ::= 564 * assignableSelector ::=
565 * '[' expression ']' 565 * '[' expression ']'
566 * | '.' identifier 566 * | '.' identifier
567 * </pre> 567 * </pre>
568 * 568 *
569 * @param expression the expression being checked 569 * @param expression the expression being checked
570 */ 570 */
571 void ensureAssignable(Expression expression) { 571 void ensureAssignable(Expression expression) {
572 if (expression != null && !expression.isAssignable) { 572 if (expression != null && !expression.isAssignable) {
573 reportError7(ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, []); 573 reportError8(ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, []);
574 } 574 }
575 } 575 }
576 576
577 /** 577 /**
578 * If the current token is a keyword matching the given string, return it afte r advancing to the 578 * If the current token is a keyword matching the given string, return it afte r advancing to the
579 * next token. Otherwise report an error and return the current token without advancing. 579 * next token. Otherwise report an error and return the current token without advancing.
580 * 580 *
581 * @param keyword the keyword that is expected 581 * @param keyword the keyword that is expected
582 * @return the token that matched the given type 582 * @return the token that matched the given type
583 */ 583 */
584 Token expect(Keyword keyword) { 584 Token expect(Keyword keyword) {
585 if (matches(keyword)) { 585 if (matches(keyword)) {
586 return andAdvance; 586 return andAdvance;
587 } 587 }
588 reportError7(ParserErrorCode.EXPECTED_TOKEN, [keyword.syntax]); 588 reportError8(ParserErrorCode.EXPECTED_TOKEN, [keyword.syntax]);
589 return _currentToken; 589 return _currentToken;
590 } 590 }
591 591
592 /** 592 /**
593 * If the current token has the expected type, return it after advancing to th e next token. 593 * If the current token has the expected type, return it after advancing to th e next token.
594 * Otherwise report an error and return the current token without advancing. 594 * Otherwise report an error and return the current token without advancing.
595 * 595 *
596 * @param type the type of token that is expected 596 * @param type the type of token that is expected
597 * @return the token that matched the given type 597 * @return the token that matched the given type
598 */ 598 */
599 Token expect2(TokenType type) { 599 Token expect2(TokenType type) {
600 if (matches5(type)) { 600 if (matches5(type)) {
601 return andAdvance; 601 return andAdvance;
602 } 602 }
603 if (identical(type, TokenType.SEMICOLON)) { 603 if (identical(type, TokenType.SEMICOLON)) {
604 reportError8(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previous, [type .lexeme]); 604 reportError9(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previous, [type .lexeme]);
605 } else { 605 } else {
606 reportError7(ParserErrorCode.EXPECTED_TOKEN, [type.lexeme]); 606 reportError8(ParserErrorCode.EXPECTED_TOKEN, [type.lexeme]);
607 } 607 }
608 return _currentToken; 608 return _currentToken;
609 } 609 }
610 610
611 /** 611 /**
612 * Search the given list of ranges for a range that contains the given index. Return the range 612 * Search the given list of ranges for a range that contains the given index. Return the range
613 * that was found, or `null` if none of the ranges contain the index. 613 * that was found, or `null` if none of the ranges contain the index.
614 * 614 *
615 * @param ranges the ranges to be searched 615 * @param ranges the ranges to be searched
616 * @param index the index contained in the returned range 616 * @param index the index contained in the returned range
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 * <pre> 1129 * <pre>
1130 * argumentDefinitionTest ::= 1130 * argumentDefinitionTest ::=
1131 * '?' identifier 1131 * '?' identifier
1132 * </pre> 1132 * </pre>
1133 * 1133 *
1134 * @return the argument definition test that was parsed 1134 * @return the argument definition test that was parsed
1135 */ 1135 */
1136 ArgumentDefinitionTest parseArgumentDefinitionTest() { 1136 ArgumentDefinitionTest parseArgumentDefinitionTest() {
1137 Token question = expect2(TokenType.QUESTION); 1137 Token question = expect2(TokenType.QUESTION);
1138 SimpleIdentifier identifier = parseSimpleIdentifier(); 1138 SimpleIdentifier identifier = parseSimpleIdentifier();
1139 reportError8(ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST, question, []); 1139 reportError9(ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST, question, []);
1140 return new ArgumentDefinitionTest.full(question, identifier); 1140 return new ArgumentDefinitionTest.full(question, identifier);
1141 } 1141 }
1142 1142
1143 /** 1143 /**
1144 * Parse a list of arguments. 1144 * Parse a list of arguments.
1145 * 1145 *
1146 * <pre> 1146 * <pre>
1147 * arguments ::= 1147 * arguments ::=
1148 * '(' argumentList? ')' 1148 * '(' argumentList? ')'
1149 * 1149 *
(...skipping 12 matching lines...) Expand all
1162 } 1162 }
1163 Expression argument = parseArgument(); 1163 Expression argument = parseArgument();
1164 arguments.add(argument); 1164 arguments.add(argument);
1165 bool foundNamedArgument = argument is NamedExpression; 1165 bool foundNamedArgument = argument is NamedExpression;
1166 bool generatedError = false; 1166 bool generatedError = false;
1167 while (optional(TokenType.COMMA)) { 1167 while (optional(TokenType.COMMA)) {
1168 argument = parseArgument(); 1168 argument = parseArgument();
1169 arguments.add(argument); 1169 arguments.add(argument);
1170 if (foundNamedArgument) { 1170 if (foundNamedArgument) {
1171 if (!generatedError && argument is! NamedExpression) { 1171 if (!generatedError && argument is! NamedExpression) {
1172 reportError7(ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT, []); 1172 reportError8(ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT, []);
1173 generatedError = true; 1173 generatedError = true;
1174 } 1174 }
1175 } else if (argument is NamedExpression) { 1175 } else if (argument is NamedExpression) {
1176 foundNamedArgument = true; 1176 foundNamedArgument = true;
1177 } 1177 }
1178 } 1178 }
1179 Token rightParenthesis = expect2(TokenType.CLOSE_PAREN); 1179 Token rightParenthesis = expect2(TokenType.CLOSE_PAREN);
1180 return new ArgumentList.full(leftParenthesis, arguments, rightParenthesis); 1180 return new ArgumentList.full(leftParenthesis, arguments, rightParenthesis);
1181 } 1181 }
1182 1182
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 Expression parseAssignableExpression(bool primaryAllowed) { 1216 Expression parseAssignableExpression(bool primaryAllowed) {
1217 if (matches(Keyword.SUPER)) { 1217 if (matches(Keyword.SUPER)) {
1218 return parseAssignableSelector(new SuperExpression.full(andAdvance), false ); 1218 return parseAssignableSelector(new SuperExpression.full(andAdvance), false );
1219 } 1219 }
1220 Expression expression = parsePrimaryExpression(); 1220 Expression expression = parsePrimaryExpression();
1221 bool isOptional = primaryAllowed || expression is SimpleIdentifier; 1221 bool isOptional = primaryAllowed || expression is SimpleIdentifier;
1222 while (true) { 1222 while (true) {
1223 while (matches5(TokenType.OPEN_PAREN)) { 1223 while (matches5(TokenType.OPEN_PAREN)) {
1224 ArgumentList argumentList = parseArgumentList(); 1224 ArgumentList argumentList = parseArgumentList();
1225 if (expression is SimpleIdentifier) { 1225 if (expression is SimpleIdentifier) {
1226 expression = new MethodInvocation.full(null, null, (expression as Simp leIdentifier), argumentList); 1226 expression = new MethodInvocation.full(null, null, expression as Simpl eIdentifier, argumentList);
1227 } else if (expression is PrefixedIdentifier) { 1227 } else if (expression is PrefixedIdentifier) {
1228 PrefixedIdentifier identifier = expression as PrefixedIdentifier; 1228 PrefixedIdentifier identifier = expression as PrefixedIdentifier;
1229 expression = new MethodInvocation.full(identifier.prefix, identifier.p eriod, identifier.identifier, argumentList); 1229 expression = new MethodInvocation.full(identifier.prefix, identifier.p eriod, identifier.identifier, argumentList);
1230 } else if (expression is PropertyAccess) { 1230 } else if (expression is PropertyAccess) {
1231 PropertyAccess access = expression as PropertyAccess; 1231 PropertyAccess access = expression as PropertyAccess;
1232 expression = new MethodInvocation.full(access.target, access.operator, access.propertyName, argumentList); 1232 expression = new MethodInvocation.full(access.target, access.operator, access.propertyName, argumentList);
1233 } else { 1233 } else {
1234 expression = new FunctionExpressionInvocation.full(expression, argumen tList); 1234 expression = new FunctionExpressionInvocation.full(expression, argumen tList);
1235 } 1235 }
1236 if (!primaryAllowed) { 1236 if (!primaryAllowed) {
(...skipping 30 matching lines...) Expand all
1267 if (matches5(TokenType.OPEN_SQUARE_BRACKET)) { 1267 if (matches5(TokenType.OPEN_SQUARE_BRACKET)) {
1268 Token leftBracket = andAdvance; 1268 Token leftBracket = andAdvance;
1269 Expression index = parseExpression2(); 1269 Expression index = parseExpression2();
1270 Token rightBracket = expect2(TokenType.CLOSE_SQUARE_BRACKET); 1270 Token rightBracket = expect2(TokenType.CLOSE_SQUARE_BRACKET);
1271 return new IndexExpression.forTarget_full(prefix, leftBracket, index, righ tBracket); 1271 return new IndexExpression.forTarget_full(prefix, leftBracket, index, righ tBracket);
1272 } else if (matches5(TokenType.PERIOD)) { 1272 } else if (matches5(TokenType.PERIOD)) {
1273 Token period = andAdvance; 1273 Token period = andAdvance;
1274 return new PropertyAccess.full(prefix, period, parseSimpleIdentifier()); 1274 return new PropertyAccess.full(prefix, period, parseSimpleIdentifier());
1275 } else { 1275 } else {
1276 if (!optional) { 1276 if (!optional) {
1277 reportError7(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, []); 1277 reportError8(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, []);
1278 } 1278 }
1279 return prefix; 1279 return prefix;
1280 } 1280 }
1281 } 1281 }
1282 1282
1283 /** 1283 /**
1284 * Parse a bitwise and expression. 1284 * Parse a bitwise and expression.
1285 * 1285 *
1286 * <pre> 1286 * <pre>
1287 * bitwiseAndExpression ::= 1287 * bitwiseAndExpression ::=
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 Block parseBlock() { 1368 Block parseBlock() {
1369 Token leftBracket = expect2(TokenType.OPEN_CURLY_BRACKET); 1369 Token leftBracket = expect2(TokenType.OPEN_CURLY_BRACKET);
1370 List<Statement> statements = new List<Statement>(); 1370 List<Statement> statements = new List<Statement>();
1371 Token statementStart = _currentToken; 1371 Token statementStart = _currentToken;
1372 while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET)) { 1372 while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET)) {
1373 Statement statement = parseStatement2(); 1373 Statement statement = parseStatement2();
1374 if (statement != null) { 1374 if (statement != null) {
1375 statements.add(statement); 1375 statements.add(statement);
1376 } 1376 }
1377 if (identical(_currentToken, statementStart)) { 1377 if (identical(_currentToken, statementStart)) {
1378 reportError8(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentT oken.lexeme]); 1378 reportError9(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentT oken.lexeme]);
1379 advance(); 1379 advance();
1380 } 1380 }
1381 statementStart = _currentToken; 1381 statementStart = _currentToken;
1382 } 1382 }
1383 Token rightBracket = expect2(TokenType.CLOSE_CURLY_BRACKET); 1383 Token rightBracket = expect2(TokenType.CLOSE_CURLY_BRACKET);
1384 return new Block.full(leftBracket, statements, rightBracket); 1384 return new Block.full(leftBracket, statements, rightBracket);
1385 } 1385 }
1386 1386
1387 /** 1387 /**
1388 * Parse a break statement. 1388 * Parse a break statement.
1389 * 1389 *
1390 * <pre> 1390 * <pre>
1391 * breakStatement ::= 1391 * breakStatement ::=
1392 * 'break' identifier? ';' 1392 * 'break' identifier? ';'
1393 * </pre> 1393 * </pre>
1394 * 1394 *
1395 * @return the break statement that was parsed 1395 * @return the break statement that was parsed
1396 */ 1396 */
1397 Statement parseBreakStatement() { 1397 Statement parseBreakStatement() {
1398 Token breakKeyword = expect(Keyword.BREAK); 1398 Token breakKeyword = expect(Keyword.BREAK);
1399 SimpleIdentifier label = null; 1399 SimpleIdentifier label = null;
1400 if (matchesIdentifier()) { 1400 if (matchesIdentifier()) {
1401 label = parseSimpleIdentifier(); 1401 label = parseSimpleIdentifier();
1402 } 1402 }
1403 if (!_inLoop && !_inSwitch && label == null) { 1403 if (!_inLoop && !_inSwitch && label == null) {
1404 reportError8(ParserErrorCode.BREAK_OUTSIDE_OF_LOOP, breakKeyword, []); 1404 reportError9(ParserErrorCode.BREAK_OUTSIDE_OF_LOOP, breakKeyword, []);
1405 } 1405 }
1406 Token semicolon = expect2(TokenType.SEMICOLON); 1406 Token semicolon = expect2(TokenType.SEMICOLON);
1407 return new BreakStatement.full(breakKeyword, label, semicolon); 1407 return new BreakStatement.full(breakKeyword, label, semicolon);
1408 } 1408 }
1409 1409
1410 /** 1410 /**
1411 * Parse a cascade section. 1411 * Parse a cascade section.
1412 * 1412 *
1413 * <pre> 1413 * <pre>
1414 * cascadeSection ::= 1414 * cascadeSection ::=
(...skipping 15 matching lines...) Expand all
1430 SimpleIdentifier functionName = null; 1430 SimpleIdentifier functionName = null;
1431 if (matchesIdentifier()) { 1431 if (matchesIdentifier()) {
1432 functionName = parseSimpleIdentifier(); 1432 functionName = parseSimpleIdentifier();
1433 } else if (identical(_currentToken.type, TokenType.OPEN_SQUARE_BRACKET)) { 1433 } else if (identical(_currentToken.type, TokenType.OPEN_SQUARE_BRACKET)) {
1434 Token leftBracket = andAdvance; 1434 Token leftBracket = andAdvance;
1435 Expression index = parseExpression2(); 1435 Expression index = parseExpression2();
1436 Token rightBracket = expect2(TokenType.CLOSE_SQUARE_BRACKET); 1436 Token rightBracket = expect2(TokenType.CLOSE_SQUARE_BRACKET);
1437 expression = new IndexExpression.forCascade_full(period, leftBracket, inde x, rightBracket); 1437 expression = new IndexExpression.forCascade_full(period, leftBracket, inde x, rightBracket);
1438 period = null; 1438 period = null;
1439 } else { 1439 } else {
1440 reportError8(ParserErrorCode.MISSING_IDENTIFIER, _currentToken, [_currentT oken.lexeme]); 1440 reportError9(ParserErrorCode.MISSING_IDENTIFIER, _currentToken, [_currentT oken.lexeme]);
1441 functionName = createSyntheticIdentifier(); 1441 functionName = createSyntheticIdentifier();
1442 } 1442 }
1443 if (identical(_currentToken.type, TokenType.OPEN_PAREN)) { 1443 if (identical(_currentToken.type, TokenType.OPEN_PAREN)) {
1444 while (identical(_currentToken.type, TokenType.OPEN_PAREN)) { 1444 while (identical(_currentToken.type, TokenType.OPEN_PAREN)) {
1445 if (functionName != null) { 1445 if (functionName != null) {
1446 expression = new MethodInvocation.full(expression, period, functionNam e, parseArgumentList()); 1446 expression = new MethodInvocation.full(expression, period, functionNam e, parseArgumentList());
1447 period = null; 1447 period = null;
1448 functionName = null; 1448 functionName = null;
1449 } else if (expression == null) { 1449 } else if (expression == null) {
1450 expression = new MethodInvocation.full(expression, period, createSynth eticIdentifier(), parseArgumentList()); 1450 expression = new MethodInvocation.full(expression, period, createSynth eticIdentifier(), parseArgumentList());
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 } 1499 }
1500 ExtendsClause extendsClause = null; 1500 ExtendsClause extendsClause = null;
1501 WithClause withClause = null; 1501 WithClause withClause = null;
1502 ImplementsClause implementsClause = null; 1502 ImplementsClause implementsClause = null;
1503 bool foundClause = true; 1503 bool foundClause = true;
1504 while (foundClause) { 1504 while (foundClause) {
1505 if (matches(Keyword.EXTENDS)) { 1505 if (matches(Keyword.EXTENDS)) {
1506 if (extendsClause == null) { 1506 if (extendsClause == null) {
1507 extendsClause = parseExtendsClause(); 1507 extendsClause = parseExtendsClause();
1508 if (withClause != null) { 1508 if (withClause != null) {
1509 reportError8(ParserErrorCode.WITH_BEFORE_EXTENDS, withClause.withKey word, []); 1509 reportError9(ParserErrorCode.WITH_BEFORE_EXTENDS, withClause.withKey word, []);
1510 } else if (implementsClause != null) { 1510 } else if (implementsClause != null) {
1511 reportError8(ParserErrorCode.IMPLEMENTS_BEFORE_EXTENDS, implementsCl ause.keyword, []); 1511 reportError9(ParserErrorCode.IMPLEMENTS_BEFORE_EXTENDS, implementsCl ause.keyword, []);
1512 } 1512 }
1513 } else { 1513 } else {
1514 reportError8(ParserErrorCode.MULTIPLE_EXTENDS_CLAUSES, extendsClause.k eyword, []); 1514 reportError9(ParserErrorCode.MULTIPLE_EXTENDS_CLAUSES, extendsClause.k eyword, []);
1515 parseExtendsClause(); 1515 parseExtendsClause();
1516 } 1516 }
1517 } else if (matches(Keyword.WITH)) { 1517 } else if (matches(Keyword.WITH)) {
1518 if (withClause == null) { 1518 if (withClause == null) {
1519 withClause = parseWithClause(); 1519 withClause = parseWithClause();
1520 if (implementsClause != null) { 1520 if (implementsClause != null) {
1521 reportError8(ParserErrorCode.IMPLEMENTS_BEFORE_WITH, implementsClaus e.keyword, []); 1521 reportError9(ParserErrorCode.IMPLEMENTS_BEFORE_WITH, implementsClaus e.keyword, []);
1522 } 1522 }
1523 } else { 1523 } else {
1524 reportError8(ParserErrorCode.MULTIPLE_WITH_CLAUSES, withClause.withKey word, []); 1524 reportError9(ParserErrorCode.MULTIPLE_WITH_CLAUSES, withClause.withKey word, []);
1525 parseWithClause(); 1525 parseWithClause();
1526 } 1526 }
1527 } else if (matches(Keyword.IMPLEMENTS)) { 1527 } else if (matches(Keyword.IMPLEMENTS)) {
1528 if (implementsClause == null) { 1528 if (implementsClause == null) {
1529 implementsClause = parseImplementsClause(); 1529 implementsClause = parseImplementsClause();
1530 } else { 1530 } else {
1531 reportError8(ParserErrorCode.MULTIPLE_IMPLEMENTS_CLAUSES, implementsCl ause.keyword, []); 1531 reportError9(ParserErrorCode.MULTIPLE_IMPLEMENTS_CLAUSES, implementsCl ause.keyword, []);
1532 parseImplementsClause(); 1532 parseImplementsClause();
1533 } 1533 }
1534 } else { 1534 } else {
1535 foundClause = false; 1535 foundClause = false;
1536 } 1536 }
1537 } 1537 }
1538 if (withClause != null && extendsClause == null) { 1538 if (withClause != null && extendsClause == null) {
1539 reportError8(ParserErrorCode.WITH_WITHOUT_EXTENDS, withClause.withKeyword, []); 1539 reportError9(ParserErrorCode.WITH_WITHOUT_EXTENDS, withClause.withKeyword, []);
1540 } 1540 }
1541 NativeClause nativeClause = null; 1541 NativeClause nativeClause = null;
1542 if (matches2(_NATIVE) && matches4(peek(), TokenType.STRING)) { 1542 if (matches2(_NATIVE) && matches4(peek(), TokenType.STRING)) {
1543 nativeClause = parseNativeClause(); 1543 nativeClause = parseNativeClause();
1544 } 1544 }
1545 Token leftBracket = null; 1545 Token leftBracket = null;
1546 List<ClassMember> members = null; 1546 List<ClassMember> members = null;
1547 Token rightBracket = null; 1547 Token rightBracket = null;
1548 if (matches5(TokenType.OPEN_CURLY_BRACKET)) { 1548 if (matches5(TokenType.OPEN_CURLY_BRACKET)) {
1549 leftBracket = expect2(TokenType.OPEN_CURLY_BRACKET); 1549 leftBracket = expect2(TokenType.OPEN_CURLY_BRACKET);
1550 members = parseClassMembers(className, getEndToken(leftBracket)); 1550 members = parseClassMembers(className, getEndToken(leftBracket));
1551 rightBracket = expect2(TokenType.CLOSE_CURLY_BRACKET); 1551 rightBracket = expect2(TokenType.CLOSE_CURLY_BRACKET);
1552 } else { 1552 } else {
1553 leftBracket = createSyntheticToken2(TokenType.OPEN_CURLY_BRACKET); 1553 leftBracket = createSyntheticToken2(TokenType.OPEN_CURLY_BRACKET);
1554 rightBracket = createSyntheticToken2(TokenType.CLOSE_CURLY_BRACKET); 1554 rightBracket = createSyntheticToken2(TokenType.CLOSE_CURLY_BRACKET);
1555 reportError7(ParserErrorCode.MISSING_CLASS_BODY, []); 1555 reportError8(ParserErrorCode.MISSING_CLASS_BODY, []);
1556 } 1556 }
1557 ClassDeclaration classDeclaration = new ClassDeclaration.full(commentAndMeta data.comment, commentAndMetadata.metadata, abstractKeyword, keyword, name, typeP arameters, extendsClause, withClause, implementsClause, leftBracket, members, ri ghtBracket); 1557 ClassDeclaration classDeclaration = new ClassDeclaration.full(commentAndMeta data.comment, commentAndMetadata.metadata, abstractKeyword, keyword, name, typeP arameters, extendsClause, withClause, implementsClause, leftBracket, members, ri ghtBracket);
1558 classDeclaration.nativeClause = nativeClause; 1558 classDeclaration.nativeClause = nativeClause;
1559 return classDeclaration; 1559 return classDeclaration;
1560 } 1560 }
1561 1561
1562 /** 1562 /**
1563 * Parse a class member. 1563 * Parse a class member.
1564 * 1564 *
1565 * <pre> 1565 * <pre>
(...skipping 30 matching lines...) Expand all
1596 if (matchesIdentifier()) { 1596 if (matchesIdentifier()) {
1597 if (matchesAny(peek(), [TokenType.EQ, TokenType.COMMA, TokenType.SEMIC OLON])) { 1597 if (matchesAny(peek(), [TokenType.EQ, TokenType.COMMA, TokenType.SEMIC OLON])) {
1598 reportError(ParserErrorCode.VOID_VARIABLE, returnType, []); 1598 reportError(ParserErrorCode.VOID_VARIABLE, returnType, []);
1599 return parseInitializedIdentifierList(commentAndMetadata, modifiers. staticKeyword, validateModifiersForField(modifiers), returnType); 1599 return parseInitializedIdentifierList(commentAndMetadata, modifiers. staticKeyword, validateModifiersForField(modifiers), returnType);
1600 } 1600 }
1601 } 1601 }
1602 if (isOperator(_currentToken)) { 1602 if (isOperator(_currentToken)) {
1603 validateModifiersForOperator(modifiers); 1603 validateModifiersForOperator(modifiers);
1604 return parseOperator(commentAndMetadata, modifiers.externalKeyword, re turnType); 1604 return parseOperator(commentAndMetadata, modifiers.externalKeyword, re turnType);
1605 } 1605 }
1606 reportError8(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []); 1606 reportError9(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
1607 return null; 1607 return null;
1608 } 1608 }
1609 } else if (matches(Keyword.GET) && matchesIdentifier2(peek())) { 1609 } else if (matches(Keyword.GET) && matchesIdentifier2(peek())) {
1610 validateModifiersForGetterOrSetterOrMethod(modifiers); 1610 validateModifiersForGetterOrSetterOrMethod(modifiers);
1611 return parseGetter(commentAndMetadata, modifiers.externalKeyword, modifier s.staticKeyword, null); 1611 return parseGetter(commentAndMetadata, modifiers.externalKeyword, modifier s.staticKeyword, null);
1612 } else if (matches(Keyword.SET) && matchesIdentifier2(peek())) { 1612 } else if (matches(Keyword.SET) && matchesIdentifier2(peek())) {
1613 validateModifiersForGetterOrSetterOrMethod(modifiers); 1613 validateModifiersForGetterOrSetterOrMethod(modifiers);
1614 return parseSetter(commentAndMetadata, modifiers.externalKeyword, modifier s.staticKeyword, null); 1614 return parseSetter(commentAndMetadata, modifiers.externalKeyword, modifier s.staticKeyword, null);
1615 } else if (matches(Keyword.OPERATOR) && isOperator(peek())) { 1615 } else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
1616 validateModifiersForOperator(modifiers); 1616 validateModifiersForOperator(modifiers);
1617 return parseOperator(commentAndMetadata, modifiers.externalKeyword, null); 1617 return parseOperator(commentAndMetadata, modifiers.externalKeyword, null);
1618 } else if (!matchesIdentifier()) { 1618 } else if (!matchesIdentifier()) {
1619 if (isOperator(_currentToken)) { 1619 if (isOperator(_currentToken)) {
1620 validateModifiersForOperator(modifiers); 1620 validateModifiersForOperator(modifiers);
1621 return parseOperator(commentAndMetadata, modifiers.externalKeyword, null ); 1621 return parseOperator(commentAndMetadata, modifiers.externalKeyword, null );
1622 } 1622 }
1623 reportError8(ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken, []); 1623 reportError9(ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken, []);
1624 return null; 1624 return null;
1625 } else if (matches4(peek(), TokenType.PERIOD) && matchesIdentifier2(peek2(2) ) && matches4(peek2(3), TokenType.OPEN_PAREN)) { 1625 } else if (matches4(peek(), TokenType.PERIOD) && matchesIdentifier2(peek2(2) ) && matches4(peek2(3), TokenType.OPEN_PAREN)) {
1626 return parseConstructor(commentAndMetadata, modifiers.externalKeyword, val idateModifiersForConstructor(modifiers), modifiers.factoryKeyword, parseSimpleId entifier(), andAdvance, parseSimpleIdentifier(), parseFormalParameterList()); 1626 return parseConstructor(commentAndMetadata, modifiers.externalKeyword, val idateModifiersForConstructor(modifiers), modifiers.factoryKeyword, parseSimpleId entifier(), andAdvance, parseSimpleIdentifier(), parseFormalParameterList());
1627 } else if (matches4(peek(), TokenType.OPEN_PAREN)) { 1627 } else if (matches4(peek(), TokenType.OPEN_PAREN)) {
1628 SimpleIdentifier methodName = parseSimpleIdentifier(); 1628 SimpleIdentifier methodName = parseSimpleIdentifier();
1629 FormalParameterList parameters = parseFormalParameterList(); 1629 FormalParameterList parameters = parseFormalParameterList();
1630 if (matches5(TokenType.COLON) || modifiers.factoryKeyword != null || metho dName.name == className) { 1630 if (matches5(TokenType.COLON) || modifiers.factoryKeyword != null || metho dName.name == className) {
1631 return parseConstructor(commentAndMetadata, modifiers.externalKeyword, v alidateModifiersForConstructor(modifiers), modifiers.factoryKeyword, methodName, null, null, parameters); 1631 return parseConstructor(commentAndMetadata, modifiers.externalKeyword, v alidateModifiersForConstructor(modifiers), modifiers.factoryKeyword, methodName, null, null, parameters);
1632 } 1632 }
1633 validateModifiersForGetterOrSetterOrMethod(modifiers); 1633 validateModifiersForGetterOrSetterOrMethod(modifiers);
1634 validateFormalParameterList(parameters); 1634 validateFormalParameterList(parameters);
1635 return parseMethodDeclaration2(commentAndMetadata, modifiers.externalKeywo rd, modifiers.staticKeyword, null, methodName, parameters); 1635 return parseMethodDeclaration2(commentAndMetadata, modifiers.externalKeywo rd, modifiers.staticKeyword, null, methodName, parameters);
1636 } else if (matchesAny(peek(), [TokenType.EQ, TokenType.COMMA, TokenType.SEMI COLON])) { 1636 } else if (matchesAny(peek(), [TokenType.EQ, TokenType.COMMA, TokenType.SEMI COLON])) {
1637 if (modifiers.constKeyword == null && modifiers.finalKeyword == null && mo difiers.varKeyword == null) { 1637 if (modifiers.constKeyword == null && modifiers.finalKeyword == null && mo difiers.varKeyword == null) {
1638 reportError7(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []); 1638 reportError8(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []);
1639 } 1639 }
1640 return parseInitializedIdentifierList(commentAndMetadata, modifiers.static Keyword, validateModifiersForField(modifiers), null); 1640 return parseInitializedIdentifierList(commentAndMetadata, modifiers.static Keyword, validateModifiersForField(modifiers), null);
1641 } 1641 }
1642 TypeName type = parseTypeName(); 1642 TypeName type = parseTypeName();
1643 if (matches(Keyword.GET) && matchesIdentifier2(peek())) { 1643 if (matches(Keyword.GET) && matchesIdentifier2(peek())) {
1644 validateModifiersForGetterOrSetterOrMethod(modifiers); 1644 validateModifiersForGetterOrSetterOrMethod(modifiers);
1645 return parseGetter(commentAndMetadata, modifiers.externalKeyword, modifier s.staticKeyword, type); 1645 return parseGetter(commentAndMetadata, modifiers.externalKeyword, modifier s.staticKeyword, type);
1646 } else if (matches(Keyword.SET) && matchesIdentifier2(peek())) { 1646 } else if (matches(Keyword.SET) && matchesIdentifier2(peek())) {
1647 validateModifiersForGetterOrSetterOrMethod(modifiers); 1647 validateModifiersForGetterOrSetterOrMethod(modifiers);
1648 return parseSetter(commentAndMetadata, modifiers.externalKeyword, modifier s.staticKeyword, type); 1648 return parseSetter(commentAndMetadata, modifiers.externalKeyword, modifier s.staticKeyword, type);
1649 } else if (matches(Keyword.OPERATOR) && isOperator(peek())) { 1649 } else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
1650 validateModifiersForOperator(modifiers); 1650 validateModifiersForOperator(modifiers);
1651 return parseOperator(commentAndMetadata, modifiers.externalKeyword, type); 1651 return parseOperator(commentAndMetadata, modifiers.externalKeyword, type);
1652 } else if (!matchesIdentifier()) { 1652 } else if (!matchesIdentifier()) {
1653 if (matches5(TokenType.CLOSE_CURLY_BRACKET)) { 1653 if (matches5(TokenType.CLOSE_CURLY_BRACKET)) {
1654 return parseInitializedIdentifierList(commentAndMetadata, modifiers.stat icKeyword, validateModifiersForField(modifiers), type); 1654 return parseInitializedIdentifierList(commentAndMetadata, modifiers.stat icKeyword, validateModifiersForField(modifiers), type);
1655 } 1655 }
1656 if (isOperator(_currentToken)) { 1656 if (isOperator(_currentToken)) {
1657 validateModifiersForOperator(modifiers); 1657 validateModifiersForOperator(modifiers);
1658 return parseOperator(commentAndMetadata, modifiers.externalKeyword, type ); 1658 return parseOperator(commentAndMetadata, modifiers.externalKeyword, type );
1659 } 1659 }
1660 reportError8(ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken, []); 1660 reportError9(ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken, []);
1661 return null; 1661 return null;
1662 } else if (matches4(peek(), TokenType.OPEN_PAREN)) { 1662 } else if (matches4(peek(), TokenType.OPEN_PAREN)) {
1663 SimpleIdentifier methodName = parseSimpleIdentifier(); 1663 SimpleIdentifier methodName = parseSimpleIdentifier();
1664 FormalParameterList parameters = parseFormalParameterList(); 1664 FormalParameterList parameters = parseFormalParameterList();
1665 if (methodName.name == className) { 1665 if (methodName.name == className) {
1666 reportError(ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, type, []); 1666 reportError(ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, type, []);
1667 return parseConstructor(commentAndMetadata, modifiers.externalKeyword, v alidateModifiersForConstructor(modifiers), modifiers.factoryKeyword, methodName, null, null, parameters); 1667 return parseConstructor(commentAndMetadata, modifiers.externalKeyword, v alidateModifiersForConstructor(modifiers), modifiers.factoryKeyword, methodName, null, null, parameters);
1668 } 1668 }
1669 validateModifiersForGetterOrSetterOrMethod(modifiers); 1669 validateModifiersForGetterOrSetterOrMethod(modifiers);
1670 validateFormalParameterList(parameters); 1670 validateFormalParameterList(parameters);
(...skipping 13 matching lines...) Expand all
1684 * @param className the name of the class whose members are being parsed 1684 * @param className the name of the class whose members are being parsed
1685 * @param closingBracket the closing bracket for the class, or `null` if the c losing bracket 1685 * @param closingBracket the closing bracket for the class, or `null` if the c losing bracket
1686 * is missing 1686 * is missing
1687 * @return the list of class members that were parsed 1687 * @return the list of class members that were parsed
1688 */ 1688 */
1689 List<ClassMember> parseClassMembers(String className, Token closingBracket) { 1689 List<ClassMember> parseClassMembers(String className, Token closingBracket) {
1690 List<ClassMember> members = new List<ClassMember>(); 1690 List<ClassMember> members = new List<ClassMember>();
1691 Token memberStart = _currentToken; 1691 Token memberStart = _currentToken;
1692 while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET) && (closingBracket != null || (!matches(Keyword.CLASS) && !matches(Keyword.TYPED EF)))) { 1692 while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET) && (closingBracket != null || (!matches(Keyword.CLASS) && !matches(Keyword.TYPED EF)))) {
1693 if (matches5(TokenType.SEMICOLON)) { 1693 if (matches5(TokenType.SEMICOLON)) {
1694 reportError8(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentT oken.lexeme]); 1694 reportError9(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentT oken.lexeme]);
1695 advance(); 1695 advance();
1696 } else { 1696 } else {
1697 ClassMember member = parseClassMember(className); 1697 ClassMember member = parseClassMember(className);
1698 if (member != null) { 1698 if (member != null) {
1699 members.add(member); 1699 members.add(member);
1700 } 1700 }
1701 } 1701 }
1702 if (identical(_currentToken, memberStart)) { 1702 if (identical(_currentToken, memberStart)) {
1703 reportError8(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentT oken.lexeme]); 1703 reportError9(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentT oken.lexeme]);
1704 advance(); 1704 advance();
1705 } 1705 }
1706 memberStart = _currentToken; 1706 memberStart = _currentToken;
1707 } 1707 }
1708 return members; 1708 return members;
1709 } 1709 }
1710 1710
1711 /** 1711 /**
1712 * Parse a class type alias. 1712 * Parse a class type alias.
1713 * 1713 *
(...skipping 27 matching lines...) Expand all
1741 } 1741 }
1742 ImplementsClause implementsClause = null; 1742 ImplementsClause implementsClause = null;
1743 if (matches(Keyword.IMPLEMENTS)) { 1743 if (matches(Keyword.IMPLEMENTS)) {
1744 implementsClause = parseImplementsClause(); 1744 implementsClause = parseImplementsClause();
1745 } 1745 }
1746 Token semicolon; 1746 Token semicolon;
1747 if (matches5(TokenType.SEMICOLON)) { 1747 if (matches5(TokenType.SEMICOLON)) {
1748 semicolon = andAdvance; 1748 semicolon = andAdvance;
1749 } else { 1749 } else {
1750 if (matches5(TokenType.OPEN_CURLY_BRACKET)) { 1750 if (matches5(TokenType.OPEN_CURLY_BRACKET)) {
1751 reportError7(ParserErrorCode.EXPECTED_TOKEN, [TokenType.SEMICOLON.lexeme ]); 1751 reportError8(ParserErrorCode.EXPECTED_TOKEN, [TokenType.SEMICOLON.lexeme ]);
1752 Token leftBracket = andAdvance; 1752 Token leftBracket = andAdvance;
1753 parseClassMembers(className.name, getEndToken(leftBracket)); 1753 parseClassMembers(className.name, getEndToken(leftBracket));
1754 expect2(TokenType.CLOSE_CURLY_BRACKET); 1754 expect2(TokenType.CLOSE_CURLY_BRACKET);
1755 } else { 1755 } else {
1756 reportError8(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previous, [To kenType.SEMICOLON.lexeme]); 1756 reportError9(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previous, [To kenType.SEMICOLON.lexeme]);
1757 } 1757 }
1758 semicolon = createSyntheticToken2(TokenType.SEMICOLON); 1758 semicolon = createSyntheticToken2(TokenType.SEMICOLON);
1759 } 1759 }
1760 return new ClassTypeAlias.full(commentAndMetadata.comment, commentAndMetadat a.metadata, keyword, className, typeParameters, equals, abstractKeyword, supercl ass, withClause, implementsClause, semicolon); 1760 return new ClassTypeAlias.full(commentAndMetadata.comment, commentAndMetadat a.metadata, keyword, className, typeParameters, equals, abstractKeyword, supercl ass, withClause, implementsClause, semicolon);
1761 } 1761 }
1762 1762
1763 /** 1763 /**
1764 * Parse a list of combinators in a directive. 1764 * Parse a list of combinators in a directive.
1765 * 1765 *
1766 * <pre> 1766 * <pre>
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 bool partDirectiveFound = false; 1947 bool partDirectiveFound = false;
1948 bool directiveFoundAfterDeclaration = false; 1948 bool directiveFoundAfterDeclaration = false;
1949 List<Directive> directives = new List<Directive>(); 1949 List<Directive> directives = new List<Directive>();
1950 List<CompilationUnitMember> declarations = new List<CompilationUnitMember>() ; 1950 List<CompilationUnitMember> declarations = new List<CompilationUnitMember>() ;
1951 Token memberStart = _currentToken; 1951 Token memberStart = _currentToken;
1952 while (!matches5(TokenType.EOF)) { 1952 while (!matches5(TokenType.EOF)) {
1953 CommentAndMetadata commentAndMetadata = parseCommentAndMetadata(); 1953 CommentAndMetadata commentAndMetadata = parseCommentAndMetadata();
1954 if ((matches(Keyword.IMPORT) || matches(Keyword.EXPORT) || matches(Keyword .LIBRARY) || matches(Keyword.PART)) && !matches4(peek(), TokenType.PERIOD) && !m atches4(peek(), TokenType.LT)) { 1954 if ((matches(Keyword.IMPORT) || matches(Keyword.EXPORT) || matches(Keyword .LIBRARY) || matches(Keyword.PART)) && !matches4(peek(), TokenType.PERIOD) && !m atches4(peek(), TokenType.LT)) {
1955 Directive directive = parseDirective(commentAndMetadata); 1955 Directive directive = parseDirective(commentAndMetadata);
1956 if (declarations.length > 0 && !directiveFoundAfterDeclaration) { 1956 if (declarations.length > 0 && !directiveFoundAfterDeclaration) {
1957 reportError7(ParserErrorCode.DIRECTIVE_AFTER_DECLARATION, []); 1957 reportError8(ParserErrorCode.DIRECTIVE_AFTER_DECLARATION, []);
1958 directiveFoundAfterDeclaration = true; 1958 directiveFoundAfterDeclaration = true;
1959 } 1959 }
1960 if (directive is LibraryDirective) { 1960 if (directive is LibraryDirective) {
1961 if (libraryDirectiveFound) { 1961 if (libraryDirectiveFound) {
1962 reportError7(ParserErrorCode.MULTIPLE_LIBRARY_DIRECTIVES, []); 1962 reportError8(ParserErrorCode.MULTIPLE_LIBRARY_DIRECTIVES, []);
1963 } else { 1963 } else {
1964 if (directives.length > 0) { 1964 if (directives.length > 0) {
1965 reportError7(ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST, []); 1965 reportError8(ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST, []);
1966 } 1966 }
1967 libraryDirectiveFound = true; 1967 libraryDirectiveFound = true;
1968 } 1968 }
1969 } else if (directive is PartDirective) { 1969 } else if (directive is PartDirective) {
1970 partDirectiveFound = true; 1970 partDirectiveFound = true;
1971 } else if (partDirectiveFound) { 1971 } else if (partDirectiveFound) {
1972 if (directive is ExportDirective) { 1972 if (directive is ExportDirective) {
1973 reportError8(ParserErrorCode.EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, ((directive as NamespaceDirective)).keyword, []); 1973 reportError9(ParserErrorCode.EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, ((directive as NamespaceDirective)).keyword, []);
1974 } else if (directive is ImportDirective) { 1974 } else if (directive is ImportDirective) {
1975 reportError8(ParserErrorCode.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, ((directive as NamespaceDirective)).keyword, []); 1975 reportError9(ParserErrorCode.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, ((directive as NamespaceDirective)).keyword, []);
1976 } 1976 }
1977 } 1977 }
1978 if (directive is PartOfDirective) { 1978 if (directive is PartOfDirective) {
1979 if (partOfDirectiveFound) { 1979 if (partOfDirectiveFound) {
1980 reportError7(ParserErrorCode.MULTIPLE_PART_OF_DIRECTIVES, []); 1980 reportError8(ParserErrorCode.MULTIPLE_PART_OF_DIRECTIVES, []);
1981 } else { 1981 } else {
1982 for (Directive preceedingDirective in directives) { 1982 for (Directive preceedingDirective in directives) {
1983 reportError8(ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART, precee dingDirective.keyword, []); 1983 reportError9(ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART, precee dingDirective.keyword, []);
1984 } 1984 }
1985 partOfDirectiveFound = true; 1985 partOfDirectiveFound = true;
1986 } 1986 }
1987 } else { 1987 } else {
1988 if (partOfDirectiveFound) { 1988 if (partOfDirectiveFound) {
1989 reportError8(ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART, directiv e.keyword, []); 1989 reportError9(ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART, directiv e.keyword, []);
1990 } 1990 }
1991 } 1991 }
1992 directives.add(directive); 1992 directives.add(directive);
1993 } else if (matches5(TokenType.SEMICOLON)) { 1993 } else if (matches5(TokenType.SEMICOLON)) {
1994 reportError8(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentT oken.lexeme]); 1994 reportError9(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentT oken.lexeme]);
1995 advance(); 1995 advance();
1996 } else { 1996 } else {
1997 CompilationUnitMember member = parseCompilationUnitMember(commentAndMeta data); 1997 CompilationUnitMember member = parseCompilationUnitMember(commentAndMeta data);
1998 if (member != null) { 1998 if (member != null) {
1999 declarations.add(member); 1999 declarations.add(member);
2000 } 2000 }
2001 } 2001 }
2002 if (identical(_currentToken, memberStart)) { 2002 if (identical(_currentToken, memberStart)) {
2003 reportError8(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentT oken.lexeme]); 2003 reportError9(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentT oken.lexeme]);
2004 advance(); 2004 advance();
2005 while (!matches5(TokenType.EOF) && !couldBeStartOfCompilationUnitMember( )) { 2005 while (!matches5(TokenType.EOF) && !couldBeStartOfCompilationUnitMember( )) {
2006 advance(); 2006 advance();
2007 } 2007 }
2008 } 2008 }
2009 memberStart = _currentToken; 2009 memberStart = _currentToken;
2010 } 2010 }
2011 return new CompilationUnit.full(firstToken, scriptTag, directives, declarati ons, _currentToken); 2011 return new CompilationUnit.full(firstToken, scriptTag, directives, declarati ons, _currentToken);
2012 } 2012 }
2013 2013
(...skipping 24 matching lines...) Expand all
2038 } else if (matches(Keyword.TYPEDEF) && !matches4(peek(), TokenType.PERIOD) & & !matches4(peek(), TokenType.LT)) { 2038 } else if (matches(Keyword.TYPEDEF) && !matches4(peek(), TokenType.PERIOD) & & !matches4(peek(), TokenType.LT)) {
2039 validateModifiersForTypedef(modifiers); 2039 validateModifiersForTypedef(modifiers);
2040 return parseTypeAlias(commentAndMetadata); 2040 return parseTypeAlias(commentAndMetadata);
2041 } 2041 }
2042 if (matches(Keyword.VOID)) { 2042 if (matches(Keyword.VOID)) {
2043 TypeName returnType = parseReturnType(); 2043 TypeName returnType = parseReturnType();
2044 if ((matches(Keyword.GET) || matches(Keyword.SET)) && matchesIdentifier2(p eek())) { 2044 if ((matches(Keyword.GET) || matches(Keyword.SET)) && matchesIdentifier2(p eek())) {
2045 validateModifiersForTopLevelFunction(modifiers); 2045 validateModifiersForTopLevelFunction(modifiers);
2046 return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKe yword, null); 2046 return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKe yword, null);
2047 } else if (matches(Keyword.OPERATOR) && isOperator(peek())) { 2047 } else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
2048 reportError8(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []); 2048 reportError9(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
2049 return convertToFunctionDeclaration(parseOperator(commentAndMetadata, mo difiers.externalKeyword, returnType)); 2049 return convertToFunctionDeclaration(parseOperator(commentAndMetadata, mo difiers.externalKeyword, returnType));
2050 } else if (matchesIdentifier() && matchesAny(peek(), [ 2050 } else if (matchesIdentifier() && matchesAny(peek(), [
2051 TokenType.OPEN_PAREN, 2051 TokenType.OPEN_PAREN,
2052 TokenType.OPEN_CURLY_BRACKET, 2052 TokenType.OPEN_CURLY_BRACKET,
2053 TokenType.FUNCTION])) { 2053 TokenType.FUNCTION])) {
2054 validateModifiersForTopLevelFunction(modifiers); 2054 validateModifiersForTopLevelFunction(modifiers);
2055 return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKe yword, returnType); 2055 return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKe yword, returnType);
2056 } else { 2056 } else {
2057 if (matchesIdentifier()) { 2057 if (matchesIdentifier()) {
2058 if (matchesAny(peek(), [TokenType.EQ, TokenType.COMMA, TokenType.SEMIC OLON])) { 2058 if (matchesAny(peek(), [TokenType.EQ, TokenType.COMMA, TokenType.SEMIC OLON])) {
2059 reportError(ParserErrorCode.VOID_VARIABLE, returnType, []); 2059 reportError(ParserErrorCode.VOID_VARIABLE, returnType, []);
2060 return new TopLevelVariableDeclaration.full(commentAndMetadata.comme nt, commentAndMetadata.metadata, parseVariableDeclarationList2(null, validateMod ifiersForTopLevelVariable(modifiers), null), expect2(TokenType.SEMICOLON)); 2060 return new TopLevelVariableDeclaration.full(commentAndMetadata.comme nt, commentAndMetadata.metadata, parseVariableDeclarationList2(null, validateMod ifiersForTopLevelVariable(modifiers), null), expect2(TokenType.SEMICOLON));
2061 } 2061 }
2062 } 2062 }
2063 reportError8(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []); 2063 reportError9(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
2064 return null; 2064 return null;
2065 } 2065 }
2066 } else if ((matches(Keyword.GET) || matches(Keyword.SET)) && matchesIdentifi er2(peek())) { 2066 } else if ((matches(Keyword.GET) || matches(Keyword.SET)) && matchesIdentifi er2(peek())) {
2067 validateModifiersForTopLevelFunction(modifiers); 2067 validateModifiersForTopLevelFunction(modifiers);
2068 return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyw ord, null); 2068 return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyw ord, null);
2069 } else if (matches(Keyword.OPERATOR) && isOperator(peek())) { 2069 } else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
2070 reportError8(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []); 2070 reportError9(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
2071 return convertToFunctionDeclaration(parseOperator(commentAndMetadata, modi fiers.externalKeyword, null)); 2071 return convertToFunctionDeclaration(parseOperator(commentAndMetadata, modi fiers.externalKeyword, null));
2072 } else if (!matchesIdentifier()) { 2072 } else if (!matchesIdentifier()) {
2073 reportError8(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []); 2073 reportError9(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
2074 return null; 2074 return null;
2075 } else if (matches4(peek(), TokenType.OPEN_PAREN)) { 2075 } else if (matches4(peek(), TokenType.OPEN_PAREN)) {
2076 validateModifiersForTopLevelFunction(modifiers); 2076 validateModifiersForTopLevelFunction(modifiers);
2077 return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyw ord, null); 2077 return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyw ord, null);
2078 } else if (matchesAny(peek(), [TokenType.EQ, TokenType.COMMA, TokenType.SEMI COLON])) { 2078 } else if (matchesAny(peek(), [TokenType.EQ, TokenType.COMMA, TokenType.SEMI COLON])) {
2079 if (modifiers.constKeyword == null && modifiers.finalKeyword == null && mo difiers.varKeyword == null) { 2079 if (modifiers.constKeyword == null && modifiers.finalKeyword == null && mo difiers.varKeyword == null) {
2080 reportError7(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []); 2080 reportError8(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []);
2081 } 2081 }
2082 return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, co mmentAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiers ForTopLevelVariable(modifiers), null), expect2(TokenType.SEMICOLON)); 2082 return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, co mmentAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiers ForTopLevelVariable(modifiers), null), expect2(TokenType.SEMICOLON));
2083 } 2083 }
2084 TypeName returnType = parseReturnType(); 2084 TypeName returnType = parseReturnType();
2085 if ((matches(Keyword.GET) || matches(Keyword.SET)) && matchesIdentifier2(pee k())) { 2085 if ((matches(Keyword.GET) || matches(Keyword.SET)) && matchesIdentifier2(pee k())) {
2086 validateModifiersForTopLevelFunction(modifiers); 2086 validateModifiersForTopLevelFunction(modifiers);
2087 return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyw ord, returnType); 2087 return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyw ord, returnType);
2088 } else if (matches(Keyword.OPERATOR) && isOperator(peek())) { 2088 } else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
2089 reportError8(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []); 2089 reportError9(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
2090 return convertToFunctionDeclaration(parseOperator(commentAndMetadata, modi fiers.externalKeyword, returnType)); 2090 return convertToFunctionDeclaration(parseOperator(commentAndMetadata, modi fiers.externalKeyword, returnType));
2091 } else if (matches5(TokenType.AT)) { 2091 } else if (matches5(TokenType.AT)) {
2092 return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, co mmentAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiers ForTopLevelVariable(modifiers), returnType), expect2(TokenType.SEMICOLON)); 2092 return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, co mmentAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiers ForTopLevelVariable(modifiers), returnType), expect2(TokenType.SEMICOLON));
2093 } else if (!matchesIdentifier()) { 2093 } else if (!matchesIdentifier()) {
2094 reportError8(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []); 2094 reportError9(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
2095 Token semicolon; 2095 Token semicolon;
2096 if (matches5(TokenType.SEMICOLON)) { 2096 if (matches5(TokenType.SEMICOLON)) {
2097 semicolon = andAdvance; 2097 semicolon = andAdvance;
2098 } else { 2098 } else {
2099 semicolon = createSyntheticToken2(TokenType.SEMICOLON); 2099 semicolon = createSyntheticToken2(TokenType.SEMICOLON);
2100 } 2100 }
2101 List<VariableDeclaration> variables = new List<VariableDeclaration>(); 2101 List<VariableDeclaration> variables = new List<VariableDeclaration>();
2102 variables.add(new VariableDeclaration.full(null, null, createSyntheticIden tifier(), null, null)); 2102 variables.add(new VariableDeclaration.full(null, null, createSyntheticIden tifier(), null, null));
2103 return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, co mmentAndMetadata.metadata, new VariableDeclarationList.full(null, null, null, re turnType, variables), semicolon); 2103 return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, co mmentAndMetadata.metadata, new VariableDeclarationList.full(null, null, null, re turnType, variables), semicolon);
2104 } 2104 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
2187 if (matches5(TokenType.EQ)) { 2187 if (matches5(TokenType.EQ)) {
2188 separator = andAdvance; 2188 separator = andAdvance;
2189 redirectedConstructor = parseConstructorName(); 2189 redirectedConstructor = parseConstructorName();
2190 body = new EmptyFunctionBody.full(expect2(TokenType.SEMICOLON)); 2190 body = new EmptyFunctionBody.full(expect2(TokenType.SEMICOLON));
2191 if (factoryKeyword == null) { 2191 if (factoryKeyword == null) {
2192 reportError(ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR, redi rectedConstructor, []); 2192 reportError(ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR, redi rectedConstructor, []);
2193 } 2193 }
2194 } else { 2194 } else {
2195 body = parseFunctionBody(true, ParserErrorCode.MISSING_FUNCTION_BODY, fals e); 2195 body = parseFunctionBody(true, ParserErrorCode.MISSING_FUNCTION_BODY, fals e);
2196 if (constKeyword != null && factoryKeyword != null) { 2196 if (constKeyword != null && factoryKeyword != null) {
2197 reportError8(ParserErrorCode.CONST_FACTORY, factoryKeyword, []); 2197 reportError9(ParserErrorCode.CONST_FACTORY, factoryKeyword, []);
2198 } else if (body is EmptyFunctionBody) { 2198 } else if (body is EmptyFunctionBody) {
2199 if (factoryKeyword != null && externalKeyword == null) { 2199 if (factoryKeyword != null && externalKeyword == null) {
2200 reportError8(ParserErrorCode.FACTORY_WITHOUT_BODY, factoryKeyword, []) ; 2200 reportError9(ParserErrorCode.FACTORY_WITHOUT_BODY, factoryKeyword, []) ;
2201 } 2201 }
2202 } else { 2202 } else {
2203 if (constKeyword != null) { 2203 if (constKeyword != null) {
2204 reportError(ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY, body, []); 2204 reportError(ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY, body, []);
2205 } else if (!bodyAllowed) { 2205 } else if (!bodyAllowed) {
2206 reportError(ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY, body, []); 2206 reportError(ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY, body, []);
2207 } 2207 }
2208 } 2208 }
2209 } 2209 }
2210 return new ConstructorDeclaration.full(commentAndMetadata.comment, commentAn dMetadata.metadata, externalKeyword, constKeyword, factoryKeyword, returnType, p eriod, name, parameters, separator, initializers, redirectedConstructor, body); 2210 return new ConstructorDeclaration.full(commentAndMetadata.comment, commentAn dMetadata.metadata, externalKeyword, constKeyword, factoryKeyword, returnType, p eriod, name, parameters, separator, initializers, redirectedConstructor, body);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2272 * <pre> 2272 * <pre>
2273 * continueStatement ::= 2273 * continueStatement ::=
2274 * 'continue' identifier? ';' 2274 * 'continue' identifier? ';'
2275 * </pre> 2275 * </pre>
2276 * 2276 *
2277 * @return the continue statement that was parsed 2277 * @return the continue statement that was parsed
2278 */ 2278 */
2279 Statement parseContinueStatement() { 2279 Statement parseContinueStatement() {
2280 Token continueKeyword = expect(Keyword.CONTINUE); 2280 Token continueKeyword = expect(Keyword.CONTINUE);
2281 if (!_inLoop && !_inSwitch) { 2281 if (!_inLoop && !_inSwitch) {
2282 reportError8(ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP, continueKeyword, [] ); 2282 reportError9(ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP, continueKeyword, [] );
2283 } 2283 }
2284 SimpleIdentifier label = null; 2284 SimpleIdentifier label = null;
2285 if (matchesIdentifier()) { 2285 if (matchesIdentifier()) {
2286 label = parseSimpleIdentifier(); 2286 label = parseSimpleIdentifier();
2287 } 2287 }
2288 if (_inSwitch && !_inLoop && label == null) { 2288 if (_inSwitch && !_inLoop && label == null) {
2289 reportError8(ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE, continueKeywo rd, []); 2289 reportError9(ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE, continueKeywo rd, []);
2290 } 2290 }
2291 Token semicolon = expect2(TokenType.SEMICOLON); 2291 Token semicolon = expect2(TokenType.SEMICOLON);
2292 return new ContinueStatement.full(continueKeyword, label, semicolon); 2292 return new ContinueStatement.full(continueKeyword, label, semicolon);
2293 } 2293 }
2294 2294
2295 /** 2295 /**
2296 * Parse a directive. 2296 * Parse a directive.
2297 * 2297 *
2298 * <pre> 2298 * <pre>
2299 * directive ::= 2299 * directive ::=
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
2567 keyword = andAdvance; 2567 keyword = andAdvance;
2568 if (isTypedIdentifier(_currentToken)) { 2568 if (isTypedIdentifier(_currentToken)) {
2569 type = parseTypeName(); 2569 type = parseTypeName();
2570 } 2570 }
2571 } else if (matches(Keyword.VAR)) { 2571 } else if (matches(Keyword.VAR)) {
2572 keyword = andAdvance; 2572 keyword = andAdvance;
2573 } else { 2573 } else {
2574 if (isTypedIdentifier(_currentToken)) { 2574 if (isTypedIdentifier(_currentToken)) {
2575 type = parseReturnType(); 2575 type = parseReturnType();
2576 } else if (!optional) { 2576 } else if (!optional) {
2577 reportError7(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []); 2577 reportError8(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []);
2578 } 2578 }
2579 } 2579 }
2580 return new FinalConstVarOrType(keyword, type); 2580 return new FinalConstVarOrType(keyword, type);
2581 } 2581 }
2582 2582
2583 /** 2583 /**
2584 * Parse a formal parameter. At most one of `isOptional` and `isNamed` can be 2584 * Parse a formal parameter. At most one of `isOptional` and `isNamed` can be
2585 * `true`. 2585 * `true`.
2586 * 2586 *
2587 * <pre> 2587 * <pre>
2588 * defaultFormalParameter ::= 2588 * defaultFormalParameter ::=
2589 * normalFormalParameter ('=' expression)? 2589 * normalFormalParameter ('=' expression)?
2590 * 2590 *
2591 * defaultNamedParameter ::= 2591 * defaultNamedParameter ::=
2592 * normalFormalParameter (':' expression)? 2592 * normalFormalParameter (':' expression)?
2593 * </pre> 2593 * </pre>
2594 * 2594 *
2595 * @param kind the kind of parameter being expected based on the presence or a bsence of group 2595 * @param kind the kind of parameter being expected based on the presence or a bsence of group
2596 * delimiters 2596 * delimiters
2597 * @return the formal parameter that was parsed 2597 * @return the formal parameter that was parsed
2598 */ 2598 */
2599 FormalParameter parseFormalParameter(ParameterKind kind) { 2599 FormalParameter parseFormalParameter(ParameterKind kind) {
2600 NormalFormalParameter parameter = parseNormalFormalParameter(); 2600 NormalFormalParameter parameter = parseNormalFormalParameter();
2601 if (matches5(TokenType.EQ)) { 2601 if (matches5(TokenType.EQ)) {
2602 Token seperator = andAdvance; 2602 Token seperator = andAdvance;
2603 Expression defaultValue = parseExpression2(); 2603 Expression defaultValue = parseExpression2();
2604 if (identical(kind, ParameterKind.NAMED)) { 2604 if (identical(kind, ParameterKind.NAMED)) {
2605 reportError8(ParserErrorCode.WRONG_SEPARATOR_FOR_NAMED_PARAMETER, sepera tor, []); 2605 reportError9(ParserErrorCode.WRONG_SEPARATOR_FOR_NAMED_PARAMETER, sepera tor, []);
2606 } else if (identical(kind, ParameterKind.REQUIRED)) { 2606 } else if (identical(kind, ParameterKind.REQUIRED)) {
2607 reportError(ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP, paramete r, []); 2607 reportError(ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP, paramete r, []);
2608 } 2608 }
2609 return new DefaultFormalParameter.full(parameter, kind, seperator, default Value); 2609 return new DefaultFormalParameter.full(parameter, kind, seperator, default Value);
2610 } else if (matches5(TokenType.COLON)) { 2610 } else if (matches5(TokenType.COLON)) {
2611 Token seperator = andAdvance; 2611 Token seperator = andAdvance;
2612 Expression defaultValue = parseExpression2(); 2612 Expression defaultValue = parseExpression2();
2613 if (identical(kind, ParameterKind.POSITIONAL)) { 2613 if (identical(kind, ParameterKind.POSITIONAL)) {
2614 reportError8(ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER, s eperator, []); 2614 reportError9(ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER, s eperator, []);
2615 } else if (identical(kind, ParameterKind.REQUIRED)) { 2615 } else if (identical(kind, ParameterKind.REQUIRED)) {
2616 reportError(ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP, parameter, [] ); 2616 reportError(ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP, parameter, [] );
2617 } 2617 }
2618 return new DefaultFormalParameter.full(parameter, kind, seperator, default Value); 2618 return new DefaultFormalParameter.full(parameter, kind, seperator, default Value);
2619 } else if (kind != ParameterKind.REQUIRED) { 2619 } else if (kind != ParameterKind.REQUIRED) {
2620 return new DefaultFormalParameter.full(parameter, kind, null, null); 2620 return new DefaultFormalParameter.full(parameter, kind, null, null);
2621 } 2621 }
2622 return parameter; 2622 return parameter;
2623 } 2623 }
2624 2624
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2666 bool reportedMuliplePositionalGroups = false; 2666 bool reportedMuliplePositionalGroups = false;
2667 bool reportedMulipleNamedGroups = false; 2667 bool reportedMulipleNamedGroups = false;
2668 bool reportedMixedGroups = false; 2668 bool reportedMixedGroups = false;
2669 bool wasOptionalParameter = false; 2669 bool wasOptionalParameter = false;
2670 Token initialToken = null; 2670 Token initialToken = null;
2671 do { 2671 do {
2672 if (firstParameter) { 2672 if (firstParameter) {
2673 firstParameter = false; 2673 firstParameter = false;
2674 } else if (!optional(TokenType.COMMA)) { 2674 } else if (!optional(TokenType.COMMA)) {
2675 if (getEndToken(leftParenthesis) != null) { 2675 if (getEndToken(leftParenthesis) != null) {
2676 reportError7(ParserErrorCode.EXPECTED_TOKEN, [TokenType.COMMA.lexeme]) ; 2676 reportError8(ParserErrorCode.EXPECTED_TOKEN, [TokenType.COMMA.lexeme]) ;
2677 } else { 2677 } else {
2678 reportError8(ParserErrorCode.MISSING_CLOSING_PARENTHESIS, _currentToke n.previous, []); 2678 reportError9(ParserErrorCode.MISSING_CLOSING_PARENTHESIS, _currentToke n.previous, []);
2679 break; 2679 break;
2680 } 2680 }
2681 } 2681 }
2682 initialToken = _currentToken; 2682 initialToken = _currentToken;
2683 if (matches5(TokenType.OPEN_SQUARE_BRACKET)) { 2683 if (matches5(TokenType.OPEN_SQUARE_BRACKET)) {
2684 wasOptionalParameter = true; 2684 wasOptionalParameter = true;
2685 if (leftSquareBracket != null && !reportedMuliplePositionalGroups) { 2685 if (leftSquareBracket != null && !reportedMuliplePositionalGroups) {
2686 reportError7(ParserErrorCode.MULTIPLE_POSITIONAL_PARAMETER_GROUPS, []) ; 2686 reportError8(ParserErrorCode.MULTIPLE_POSITIONAL_PARAMETER_GROUPS, []) ;
2687 reportedMuliplePositionalGroups = true; 2687 reportedMuliplePositionalGroups = true;
2688 } 2688 }
2689 if (leftCurlyBracket != null && !reportedMixedGroups) { 2689 if (leftCurlyBracket != null && !reportedMixedGroups) {
2690 reportError7(ParserErrorCode.MIXED_PARAMETER_GROUPS, []); 2690 reportError8(ParserErrorCode.MIXED_PARAMETER_GROUPS, []);
2691 reportedMixedGroups = true; 2691 reportedMixedGroups = true;
2692 } 2692 }
2693 leftSquareBracket = andAdvance; 2693 leftSquareBracket = andAdvance;
2694 currentParameters = positionalParameters; 2694 currentParameters = positionalParameters;
2695 kind = ParameterKind.POSITIONAL; 2695 kind = ParameterKind.POSITIONAL;
2696 } else if (matches5(TokenType.OPEN_CURLY_BRACKET)) { 2696 } else if (matches5(TokenType.OPEN_CURLY_BRACKET)) {
2697 wasOptionalParameter = true; 2697 wasOptionalParameter = true;
2698 if (leftCurlyBracket != null && !reportedMulipleNamedGroups) { 2698 if (leftCurlyBracket != null && !reportedMulipleNamedGroups) {
2699 reportError7(ParserErrorCode.MULTIPLE_NAMED_PARAMETER_GROUPS, []); 2699 reportError8(ParserErrorCode.MULTIPLE_NAMED_PARAMETER_GROUPS, []);
2700 reportedMulipleNamedGroups = true; 2700 reportedMulipleNamedGroups = true;
2701 } 2701 }
2702 if (leftSquareBracket != null && !reportedMixedGroups) { 2702 if (leftSquareBracket != null && !reportedMixedGroups) {
2703 reportError7(ParserErrorCode.MIXED_PARAMETER_GROUPS, []); 2703 reportError8(ParserErrorCode.MIXED_PARAMETER_GROUPS, []);
2704 reportedMixedGroups = true; 2704 reportedMixedGroups = true;
2705 } 2705 }
2706 leftCurlyBracket = andAdvance; 2706 leftCurlyBracket = andAdvance;
2707 currentParameters = namedParameters; 2707 currentParameters = namedParameters;
2708 kind = ParameterKind.NAMED; 2708 kind = ParameterKind.NAMED;
2709 } 2709 }
2710 FormalParameter parameter = parseFormalParameter(kind); 2710 FormalParameter parameter = parseFormalParameter(kind);
2711 parameters.add(parameter); 2711 parameters.add(parameter);
2712 currentParameters.add(parameter); 2712 currentParameters.add(parameter);
2713 if (identical(kind, ParameterKind.REQUIRED) && wasOptionalParameter) { 2713 if (identical(kind, ParameterKind.REQUIRED) && wasOptionalParameter) {
2714 reportError(ParserErrorCode.NORMAL_BEFORE_OPTIONAL_PARAMETERS, parameter , []); 2714 reportError(ParserErrorCode.NORMAL_BEFORE_OPTIONAL_PARAMETERS, parameter , []);
2715 } 2715 }
2716 if (matches5(TokenType.CLOSE_SQUARE_BRACKET)) { 2716 if (matches5(TokenType.CLOSE_SQUARE_BRACKET)) {
2717 rightSquareBracket = andAdvance; 2717 rightSquareBracket = andAdvance;
2718 currentParameters = normalParameters; 2718 currentParameters = normalParameters;
2719 if (leftSquareBracket == null) { 2719 if (leftSquareBracket == null) {
2720 if (leftCurlyBracket != null) { 2720 if (leftCurlyBracket != null) {
2721 reportError7(ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP, [ "}"]); 2721 reportError8(ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP, [ "}"]);
2722 rightCurlyBracket = rightSquareBracket; 2722 rightCurlyBracket = rightSquareBracket;
2723 rightSquareBracket = null; 2723 rightSquareBracket = null;
2724 } else { 2724 } else {
2725 reportError7(ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GRO UP, ["["]); 2725 reportError8(ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GRO UP, ["["]);
2726 } 2726 }
2727 } 2727 }
2728 kind = ParameterKind.REQUIRED; 2728 kind = ParameterKind.REQUIRED;
2729 } else if (matches5(TokenType.CLOSE_CURLY_BRACKET)) { 2729 } else if (matches5(TokenType.CLOSE_CURLY_BRACKET)) {
2730 rightCurlyBracket = andAdvance; 2730 rightCurlyBracket = andAdvance;
2731 currentParameters = normalParameters; 2731 currentParameters = normalParameters;
2732 if (leftCurlyBracket == null) { 2732 if (leftCurlyBracket == null) {
2733 if (leftSquareBracket != null) { 2733 if (leftSquareBracket != null) {
2734 reportError7(ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP, [ "]"]); 2734 reportError8(ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP, [ "]"]);
2735 rightSquareBracket = rightCurlyBracket; 2735 rightSquareBracket = rightCurlyBracket;
2736 rightCurlyBracket = null; 2736 rightCurlyBracket = null;
2737 } else { 2737 } else {
2738 reportError7(ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GRO UP, ["{"]); 2738 reportError8(ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GRO UP, ["{"]);
2739 } 2739 }
2740 } 2740 }
2741 kind = ParameterKind.REQUIRED; 2741 kind = ParameterKind.REQUIRED;
2742 } 2742 }
2743 } while (!matches5(TokenType.CLOSE_PAREN) && initialToken != _currentToken); 2743 } while (!matches5(TokenType.CLOSE_PAREN) && initialToken != _currentToken);
2744 Token rightParenthesis = expect2(TokenType.CLOSE_PAREN); 2744 Token rightParenthesis = expect2(TokenType.CLOSE_PAREN);
2745 if (leftSquareBracket != null && rightSquareBracket == null) { 2745 if (leftSquareBracket != null && rightSquareBracket == null) {
2746 reportError7(ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP, ["]"] ); 2746 reportError8(ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP, ["]"] );
2747 } 2747 }
2748 if (leftCurlyBracket != null && rightCurlyBracket == null) { 2748 if (leftCurlyBracket != null && rightCurlyBracket == null) {
2749 reportError7(ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP, ["}"] ); 2749 reportError8(ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP, ["}"] );
2750 } 2750 }
2751 if (leftSquareBracket == null) { 2751 if (leftSquareBracket == null) {
2752 leftSquareBracket = leftCurlyBracket; 2752 leftSquareBracket = leftCurlyBracket;
2753 } 2753 }
2754 if (rightSquareBracket == null) { 2754 if (rightSquareBracket == null) {
2755 rightSquareBracket = rightCurlyBracket; 2755 rightSquareBracket = rightCurlyBracket;
2756 } 2756 }
2757 return new FormalParameterList.full(leftParenthesis, parameters, leftSquareB racket, rightSquareBracket, rightParenthesis); 2757 return new FormalParameterList.full(leftParenthesis, parameters, leftSquareB racket, rightSquareBracket, rightParenthesis);
2758 } 2758 }
2759 2759
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2792 variables.add(new VariableDeclaration.full(null, null, variableName, n ull, null)); 2792 variables.add(new VariableDeclaration.full(null, null, variableName, n ull, null));
2793 variableList = new VariableDeclarationList.full(commentAndMetadata.com ment, commentAndMetadata.metadata, null, null, variables); 2793 variableList = new VariableDeclarationList.full(commentAndMetadata.com ment, commentAndMetadata.metadata, null, null, variables);
2794 } else if (isInitializedVariableDeclaration()) { 2794 } else if (isInitializedVariableDeclaration()) {
2795 variableList = parseVariableDeclarationList(commentAndMetadata); 2795 variableList = parseVariableDeclarationList(commentAndMetadata);
2796 } else { 2796 } else {
2797 initialization = parseExpression2(); 2797 initialization = parseExpression2();
2798 } 2798 }
2799 if (matches(Keyword.IN)) { 2799 if (matches(Keyword.IN)) {
2800 DeclaredIdentifier loopVariable = null; 2800 DeclaredIdentifier loopVariable = null;
2801 if (variableList == null) { 2801 if (variableList == null) {
2802 reportError7(ParserErrorCode.MISSING_VARIABLE_IN_FOR_EACH, []); 2802 reportError8(ParserErrorCode.MISSING_VARIABLE_IN_FOR_EACH, []);
2803 } else { 2803 } else {
2804 NodeList<VariableDeclaration> variables = variableList.variables; 2804 NodeList<VariableDeclaration> variables = variableList.variables;
2805 if (variables.length > 1) { 2805 if (variables.length > 1) {
2806 reportError7(ParserErrorCode.MULTIPLE_VARIABLES_IN_FOR_EACH, [vari ables.length.toString()]); 2806 reportError8(ParserErrorCode.MULTIPLE_VARIABLES_IN_FOR_EACH, [vari ables.length.toString()]);
2807 } 2807 }
2808 VariableDeclaration variable = variables[0]; 2808 VariableDeclaration variable = variables[0];
2809 if (variable.initializer != null) { 2809 if (variable.initializer != null) {
2810 reportError7(ParserErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH, []) ; 2810 reportError8(ParserErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH, []) ;
2811 } 2811 }
2812 loopVariable = new DeclaredIdentifier.full(commentAndMetadata.commen t, commentAndMetadata.metadata, variableList.keyword, variableList.type, variabl e.name); 2812 loopVariable = new DeclaredIdentifier.full(commentAndMetadata.commen t, commentAndMetadata.metadata, variableList.keyword, variableList.type, variabl e.name);
2813 } 2813 }
2814 Token inKeyword = expect(Keyword.IN); 2814 Token inKeyword = expect(Keyword.IN);
2815 Expression iterator = parseExpression2(); 2815 Expression iterator = parseExpression2();
2816 Token rightParenthesis = expect2(TokenType.CLOSE_PAREN); 2816 Token rightParenthesis = expect2(TokenType.CLOSE_PAREN);
2817 Statement body = parseStatement2(); 2817 Statement body = parseStatement2();
2818 return new ForEachStatement.full(forKeyword, leftParenthesis, loopVari able, inKeyword, iterator, rightParenthesis, body); 2818 return new ForEachStatement.full(forKeyword, leftParenthesis, loopVari able, inKeyword, iterator, rightParenthesis, body);
2819 } 2819 }
2820 } 2820 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2856 * @return the function body that was parsed 2856 * @return the function body that was parsed
2857 */ 2857 */
2858 FunctionBody parseFunctionBody(bool mayBeEmpty, ParserErrorCode emptyErrorCode , bool inExpression) { 2858 FunctionBody parseFunctionBody(bool mayBeEmpty, ParserErrorCode emptyErrorCode , bool inExpression) {
2859 bool wasInLoop = _inLoop; 2859 bool wasInLoop = _inLoop;
2860 bool wasInSwitch = _inSwitch; 2860 bool wasInSwitch = _inSwitch;
2861 _inLoop = false; 2861 _inLoop = false;
2862 _inSwitch = false; 2862 _inSwitch = false;
2863 try { 2863 try {
2864 if (matches5(TokenType.SEMICOLON)) { 2864 if (matches5(TokenType.SEMICOLON)) {
2865 if (!mayBeEmpty) { 2865 if (!mayBeEmpty) {
2866 reportError7(emptyErrorCode, []); 2866 reportError8(emptyErrorCode, []);
2867 } 2867 }
2868 return new EmptyFunctionBody.full(andAdvance); 2868 return new EmptyFunctionBody.full(andAdvance);
2869 } else if (matches5(TokenType.FUNCTION)) { 2869 } else if (matches5(TokenType.FUNCTION)) {
2870 Token functionDefinition = andAdvance; 2870 Token functionDefinition = andAdvance;
2871 Expression expression = parseExpression2(); 2871 Expression expression = parseExpression2();
2872 Token semicolon = null; 2872 Token semicolon = null;
2873 if (!inExpression) { 2873 if (!inExpression) {
2874 semicolon = expect2(TokenType.SEMICOLON); 2874 semicolon = expect2(TokenType.SEMICOLON);
2875 } 2875 }
2876 return new ExpressionFunctionBody.full(functionDefinition, expression, s emicolon); 2876 return new ExpressionFunctionBody.full(functionDefinition, expression, s emicolon);
2877 } else if (matches5(TokenType.OPEN_CURLY_BRACKET)) { 2877 } else if (matches5(TokenType.OPEN_CURLY_BRACKET)) {
2878 return new BlockFunctionBody.full(parseBlock()); 2878 return new BlockFunctionBody.full(parseBlock());
2879 } else if (matches2(_NATIVE)) { 2879 } else if (matches2(_NATIVE)) {
2880 Token nativeToken = andAdvance; 2880 Token nativeToken = andAdvance;
2881 StringLiteral stringLiteral = null; 2881 StringLiteral stringLiteral = null;
2882 if (matches5(TokenType.STRING)) { 2882 if (matches5(TokenType.STRING)) {
2883 stringLiteral = parseStringLiteral(); 2883 stringLiteral = parseStringLiteral();
2884 } 2884 }
2885 return new NativeFunctionBody.full(nativeToken, stringLiteral, expect2(T okenType.SEMICOLON)); 2885 return new NativeFunctionBody.full(nativeToken, stringLiteral, expect2(T okenType.SEMICOLON));
2886 } else { 2886 } else {
2887 reportError7(emptyErrorCode, []); 2887 reportError8(emptyErrorCode, []);
2888 return new EmptyFunctionBody.full(createSyntheticToken2(TokenType.SEMICO LON)); 2888 return new EmptyFunctionBody.full(createSyntheticToken2(TokenType.SEMICO LON));
2889 } 2889 }
2890 } finally { 2890 } finally {
2891 _inLoop = wasInLoop; 2891 _inLoop = wasInLoop;
2892 _inSwitch = wasInSwitch; 2892 _inSwitch = wasInSwitch;
2893 } 2893 }
2894 } 2894 }
2895 2895
2896 /** 2896 /**
2897 * Parse a function declaration. 2897 * Parse a function declaration.
(...skipping 20 matching lines...) Expand all
2918 } else if (matches(Keyword.SET) && !matches4(peek(), TokenType.OPEN_PAREN)) { 2918 } else if (matches(Keyword.SET) && !matches4(peek(), TokenType.OPEN_PAREN)) {
2919 keyword = andAdvance; 2919 keyword = andAdvance;
2920 } 2920 }
2921 SimpleIdentifier name = parseSimpleIdentifier(); 2921 SimpleIdentifier name = parseSimpleIdentifier();
2922 FormalParameterList parameters = null; 2922 FormalParameterList parameters = null;
2923 if (!isGetter) { 2923 if (!isGetter) {
2924 if (matches5(TokenType.OPEN_PAREN)) { 2924 if (matches5(TokenType.OPEN_PAREN)) {
2925 parameters = parseFormalParameterList(); 2925 parameters = parseFormalParameterList();
2926 validateFormalParameterList(parameters); 2926 validateFormalParameterList(parameters);
2927 } else { 2927 } else {
2928 reportError7(ParserErrorCode.MISSING_FUNCTION_PARAMETERS, []); 2928 reportError8(ParserErrorCode.MISSING_FUNCTION_PARAMETERS, []);
2929 } 2929 }
2930 } else if (matches5(TokenType.OPEN_PAREN)) { 2930 } else if (matches5(TokenType.OPEN_PAREN)) {
2931 reportError7(ParserErrorCode.GETTER_WITH_PARAMETERS, []); 2931 reportError8(ParserErrorCode.GETTER_WITH_PARAMETERS, []);
2932 parseFormalParameterList(); 2932 parseFormalParameterList();
2933 } 2933 }
2934 FunctionBody body; 2934 FunctionBody body;
2935 if (externalKeyword == null) { 2935 if (externalKeyword == null) {
2936 body = parseFunctionBody(false, ParserErrorCode.MISSING_FUNCTION_BODY, fal se); 2936 body = parseFunctionBody(false, ParserErrorCode.MISSING_FUNCTION_BODY, fal se);
2937 } else { 2937 } else {
2938 body = new EmptyFunctionBody.full(expect2(TokenType.SEMICOLON)); 2938 body = new EmptyFunctionBody.full(expect2(TokenType.SEMICOLON));
2939 } 2939 }
2940 return new FunctionDeclaration.full(commentAndMetadata.comment, commentAndMe tadata.metadata, externalKeyword, returnType, keyword, name, new FunctionExpress ion.full(parameters, body)); 2940 return new FunctionDeclaration.full(commentAndMetadata.comment, commentAndMe tadata.metadata, externalKeyword, returnType, keyword, name, new FunctionExpress ion.full(parameters, body));
2941 } 2941 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
3007 TypeName returnType = null; 3007 TypeName returnType = null;
3008 if (hasReturnTypeInTypeAlias()) { 3008 if (hasReturnTypeInTypeAlias()) {
3009 returnType = parseReturnType(); 3009 returnType = parseReturnType();
3010 } 3010 }
3011 SimpleIdentifier name = parseSimpleIdentifier(); 3011 SimpleIdentifier name = parseSimpleIdentifier();
3012 TypeParameterList typeParameters = null; 3012 TypeParameterList typeParameters = null;
3013 if (matches5(TokenType.LT)) { 3013 if (matches5(TokenType.LT)) {
3014 typeParameters = parseTypeParameterList(); 3014 typeParameters = parseTypeParameterList();
3015 } 3015 }
3016 if (matches5(TokenType.SEMICOLON) || matches5(TokenType.EOF)) { 3016 if (matches5(TokenType.SEMICOLON) || matches5(TokenType.EOF)) {
3017 reportError7(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, []); 3017 reportError8(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, []);
3018 FormalParameterList parameters = new FormalParameterList.full(createSynthe ticToken2(TokenType.OPEN_PAREN), null, null, null, createSyntheticToken2(TokenTy pe.CLOSE_PAREN)); 3018 FormalParameterList parameters = new FormalParameterList.full(createSynthe ticToken2(TokenType.OPEN_PAREN), null, null, null, createSyntheticToken2(TokenTy pe.CLOSE_PAREN));
3019 Token semicolon = expect2(TokenType.SEMICOLON); 3019 Token semicolon = expect2(TokenType.SEMICOLON);
3020 return new FunctionTypeAlias.full(commentAndMetadata.comment, commentAndMe tadata.metadata, keyword, returnType, name, typeParameters, parameters, semicolo n); 3020 return new FunctionTypeAlias.full(commentAndMetadata.comment, commentAndMe tadata.metadata, keyword, returnType, name, typeParameters, parameters, semicolo n);
3021 } else if (!matches5(TokenType.OPEN_PAREN)) { 3021 } else if (!matches5(TokenType.OPEN_PAREN)) {
3022 reportError7(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, []); 3022 reportError8(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, []);
3023 return new FunctionTypeAlias.full(commentAndMetadata.comment, commentAndMe tadata.metadata, keyword, returnType, name, typeParameters, new FormalParameterL ist.full(createSyntheticToken2(TokenType.OPEN_PAREN), null, null, null, createSy ntheticToken2(TokenType.CLOSE_PAREN)), createSyntheticToken2(TokenType.SEMICOLON )); 3023 return new FunctionTypeAlias.full(commentAndMetadata.comment, commentAndMe tadata.metadata, keyword, returnType, name, typeParameters, new FormalParameterL ist.full(createSyntheticToken2(TokenType.OPEN_PAREN), null, null, null, createSy ntheticToken2(TokenType.CLOSE_PAREN)), createSyntheticToken2(TokenType.SEMICOLON ));
3024 } 3024 }
3025 FormalParameterList parameters = parseFormalParameterList(); 3025 FormalParameterList parameters = parseFormalParameterList();
3026 validateFormalParameterList(parameters); 3026 validateFormalParameterList(parameters);
3027 Token semicolon = expect2(TokenType.SEMICOLON); 3027 Token semicolon = expect2(TokenType.SEMICOLON);
3028 return new FunctionTypeAlias.full(commentAndMetadata.comment, commentAndMeta data.metadata, keyword, returnType, name, typeParameters, parameters, semicolon) ; 3028 return new FunctionTypeAlias.full(commentAndMetadata.comment, commentAndMeta data.metadata, keyword, returnType, name, typeParameters, parameters, semicolon) ;
3029 } 3029 }
3030 3030
3031 /** 3031 /**
3032 * Parse a getter. 3032 * Parse a getter.
(...skipping 11 matching lines...) Expand all
3044 * @param externalKeyword the 'external' token 3044 * @param externalKeyword the 'external' token
3045 * @param staticKeyword the static keyword, or `null` if the getter is not sta tic 3045 * @param staticKeyword the static keyword, or `null` if the getter is not sta tic
3046 * @param the return type that has already been parsed, or `null` if there was no return 3046 * @param the return type that has already been parsed, or `null` if there was no return
3047 * type 3047 * type
3048 * @return the getter that was parsed 3048 * @return the getter that was parsed
3049 */ 3049 */
3050 MethodDeclaration parseGetter(CommentAndMetadata commentAndMetadata, Token ext ernalKeyword, Token staticKeyword, TypeName returnType) { 3050 MethodDeclaration parseGetter(CommentAndMetadata commentAndMetadata, Token ext ernalKeyword, Token staticKeyword, TypeName returnType) {
3051 Token propertyKeyword = expect(Keyword.GET); 3051 Token propertyKeyword = expect(Keyword.GET);
3052 SimpleIdentifier name = parseSimpleIdentifier(); 3052 SimpleIdentifier name = parseSimpleIdentifier();
3053 if (matches5(TokenType.OPEN_PAREN) && matches4(peek(), TokenType.CLOSE_PAREN )) { 3053 if (matches5(TokenType.OPEN_PAREN) && matches4(peek(), TokenType.CLOSE_PAREN )) {
3054 reportError7(ParserErrorCode.GETTER_WITH_PARAMETERS, []); 3054 reportError8(ParserErrorCode.GETTER_WITH_PARAMETERS, []);
3055 advance(); 3055 advance();
3056 advance(); 3056 advance();
3057 } 3057 }
3058 FunctionBody body = parseFunctionBody(externalKeyword != null || staticKeywo rd == null, ParserErrorCode.STATIC_GETTER_WITHOUT_BODY, false); 3058 FunctionBody body = parseFunctionBody(externalKeyword != null || staticKeywo rd == null, ParserErrorCode.STATIC_GETTER_WITHOUT_BODY, false);
3059 if (externalKeyword != null && body is! EmptyFunctionBody) { 3059 if (externalKeyword != null && body is! EmptyFunctionBody) {
3060 reportError7(ParserErrorCode.EXTERNAL_GETTER_WITH_BODY, []); 3060 reportError8(ParserErrorCode.EXTERNAL_GETTER_WITH_BODY, []);
3061 } 3061 }
3062 return new MethodDeclaration.full(commentAndMetadata.comment, commentAndMeta data.metadata, externalKeyword, staticKeyword, returnType, propertyKeyword, null , name, null, body); 3062 return new MethodDeclaration.full(commentAndMetadata.comment, commentAndMeta data.metadata, externalKeyword, staticKeyword, returnType, propertyKeyword, null , name, null, body);
3063 } 3063 }
3064 3064
3065 /** 3065 /**
3066 * Parse a list of identifiers. 3066 * Parse a list of identifiers.
3067 * 3067 *
3068 * <pre> 3068 * <pre>
3069 * identifierList ::= 3069 * identifierList ::=
3070 * identifier (',' identifier)* 3070 * identifier (',' identifier)*
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
3248 * missing 3248 * missing
3249 * @return the library name that was parsed 3249 * @return the library name that was parsed
3250 */ 3250 */
3251 LibraryIdentifier parseLibraryName(ParserErrorCode missingNameError, Token mis singNameToken) { 3251 LibraryIdentifier parseLibraryName(ParserErrorCode missingNameError, Token mis singNameToken) {
3252 if (matchesIdentifier()) { 3252 if (matchesIdentifier()) {
3253 return parseLibraryIdentifier(); 3253 return parseLibraryIdentifier();
3254 } else if (matches5(TokenType.STRING)) { 3254 } else if (matches5(TokenType.STRING)) {
3255 StringLiteral string = parseStringLiteral(); 3255 StringLiteral string = parseStringLiteral();
3256 reportError(ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME, string, []); 3256 reportError(ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME, string, []);
3257 } else { 3257 } else {
3258 reportError8(missingNameError, missingNameToken, []); 3258 reportError9(missingNameError, missingNameToken, []);
3259 } 3259 }
3260 List<SimpleIdentifier> components = new List<SimpleIdentifier>(); 3260 List<SimpleIdentifier> components = new List<SimpleIdentifier>();
3261 components.add(createSyntheticIdentifier()); 3261 components.add(createSyntheticIdentifier());
3262 return new LibraryIdentifier.full(components); 3262 return new LibraryIdentifier.full(components);
3263 } 3263 }
3264 3264
3265 /** 3265 /**
3266 * Parse a list literal. 3266 * Parse a list literal.
3267 * 3267 *
3268 * <pre> 3268 * <pre>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
3325 TypedLiteral parseListOrMapLiteral(Token modifier) { 3325 TypedLiteral parseListOrMapLiteral(Token modifier) {
3326 TypeArgumentList typeArguments = null; 3326 TypeArgumentList typeArguments = null;
3327 if (matches5(TokenType.LT)) { 3327 if (matches5(TokenType.LT)) {
3328 typeArguments = parseTypeArgumentList(); 3328 typeArguments = parseTypeArgumentList();
3329 } 3329 }
3330 if (matches5(TokenType.OPEN_CURLY_BRACKET)) { 3330 if (matches5(TokenType.OPEN_CURLY_BRACKET)) {
3331 return parseMapLiteral(modifier, typeArguments); 3331 return parseMapLiteral(modifier, typeArguments);
3332 } else if (matches5(TokenType.OPEN_SQUARE_BRACKET) || matches5(TokenType.IND EX)) { 3332 } else if (matches5(TokenType.OPEN_SQUARE_BRACKET) || matches5(TokenType.IND EX)) {
3333 return parseListLiteral(modifier, typeArguments); 3333 return parseListLiteral(modifier, typeArguments);
3334 } 3334 }
3335 reportError7(ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL, []); 3335 reportError8(ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL, []);
3336 return new ListLiteral.full(modifier, typeArguments, createSyntheticToken2(T okenType.OPEN_SQUARE_BRACKET), null, createSyntheticToken2(TokenType.CLOSE_SQUAR E_BRACKET)); 3336 return new ListLiteral.full(modifier, typeArguments, createSyntheticToken2(T okenType.OPEN_SQUARE_BRACKET), null, createSyntheticToken2(TokenType.CLOSE_SQUAR E_BRACKET));
3337 } 3337 }
3338 3338
3339 /** 3339 /**
3340 * Parse a logical and expression. 3340 * Parse a logical and expression.
3341 * 3341 *
3342 * <pre> 3342 * <pre>
3343 * logicalAndExpression ::= 3343 * logicalAndExpression ::=
3344 * bitwiseOrExpression ('&&' bitwiseOrExpression)* 3344 * bitwiseOrExpression ('&&' bitwiseOrExpression)*
3345 * </pre> 3345 * </pre>
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
3495 * </pre> 3495 * </pre>
3496 * 3496 *
3497 * @return the modifiers that were parsed 3497 * @return the modifiers that were parsed
3498 */ 3498 */
3499 Modifiers parseModifiers() { 3499 Modifiers parseModifiers() {
3500 Modifiers modifiers = new Modifiers(); 3500 Modifiers modifiers = new Modifiers();
3501 bool progress = true; 3501 bool progress = true;
3502 while (progress) { 3502 while (progress) {
3503 if (matches(Keyword.ABSTRACT) && !matches4(peek(), TokenType.PERIOD) && !m atches4(peek(), TokenType.LT)) { 3503 if (matches(Keyword.ABSTRACT) && !matches4(peek(), TokenType.PERIOD) && !m atches4(peek(), TokenType.LT)) {
3504 if (modifiers.abstractKeyword != null) { 3504 if (modifiers.abstractKeyword != null) {
3505 reportError7(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexem e]); 3505 reportError8(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexem e]);
3506 advance(); 3506 advance();
3507 } else { 3507 } else {
3508 modifiers.abstractKeyword = andAdvance; 3508 modifiers.abstractKeyword = andAdvance;
3509 } 3509 }
3510 } else if (matches(Keyword.CONST)) { 3510 } else if (matches(Keyword.CONST)) {
3511 if (modifiers.constKeyword != null) { 3511 if (modifiers.constKeyword != null) {
3512 reportError7(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexem e]); 3512 reportError8(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexem e]);
3513 advance(); 3513 advance();
3514 } else { 3514 } else {
3515 modifiers.constKeyword = andAdvance; 3515 modifiers.constKeyword = andAdvance;
3516 } 3516 }
3517 } else if (matches(Keyword.EXTERNAL) && !matches4(peek(), TokenType.PERIOD ) && !matches4(peek(), TokenType.LT)) { 3517 } else if (matches(Keyword.EXTERNAL) && !matches4(peek(), TokenType.PERIOD ) && !matches4(peek(), TokenType.LT)) {
3518 if (modifiers.externalKeyword != null) { 3518 if (modifiers.externalKeyword != null) {
3519 reportError7(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexem e]); 3519 reportError8(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexem e]);
3520 advance(); 3520 advance();
3521 } else { 3521 } else {
3522 modifiers.externalKeyword = andAdvance; 3522 modifiers.externalKeyword = andAdvance;
3523 } 3523 }
3524 } else if (matches(Keyword.FACTORY) && !matches4(peek(), TokenType.PERIOD) && !matches4(peek(), TokenType.LT)) { 3524 } else if (matches(Keyword.FACTORY) && !matches4(peek(), TokenType.PERIOD) && !matches4(peek(), TokenType.LT)) {
3525 if (modifiers.factoryKeyword != null) { 3525 if (modifiers.factoryKeyword != null) {
3526 reportError7(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexem e]); 3526 reportError8(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexem e]);
3527 advance(); 3527 advance();
3528 } else { 3528 } else {
3529 modifiers.factoryKeyword = andAdvance; 3529 modifiers.factoryKeyword = andAdvance;
3530 } 3530 }
3531 } else if (matches(Keyword.FINAL)) { 3531 } else if (matches(Keyword.FINAL)) {
3532 if (modifiers.finalKeyword != null) { 3532 if (modifiers.finalKeyword != null) {
3533 reportError7(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexem e]); 3533 reportError8(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexem e]);
3534 advance(); 3534 advance();
3535 } else { 3535 } else {
3536 modifiers.finalKeyword = andAdvance; 3536 modifiers.finalKeyword = andAdvance;
3537 } 3537 }
3538 } else if (matches(Keyword.STATIC) && !matches4(peek(), TokenType.PERIOD) && !matches4(peek(), TokenType.LT)) { 3538 } else if (matches(Keyword.STATIC) && !matches4(peek(), TokenType.PERIOD) && !matches4(peek(), TokenType.LT)) {
3539 if (modifiers.staticKeyword != null) { 3539 if (modifiers.staticKeyword != null) {
3540 reportError7(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexem e]); 3540 reportError8(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexem e]);
3541 advance(); 3541 advance();
3542 } else { 3542 } else {
3543 modifiers.staticKeyword = andAdvance; 3543 modifiers.staticKeyword = andAdvance;
3544 } 3544 }
3545 } else if (matches(Keyword.VAR)) { 3545 } else if (matches(Keyword.VAR)) {
3546 if (modifiers.varKeyword != null) { 3546 if (modifiers.varKeyword != null) {
3547 reportError7(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexem e]); 3547 reportError8(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexem e]);
3548 advance(); 3548 advance();
3549 } else { 3549 } else {
3550 modifiers.varKeyword = andAdvance; 3550 modifiers.varKeyword = andAdvance;
3551 } 3551 }
3552 } else { 3552 } else {
3553 progress = false; 3553 progress = false;
3554 } 3554 }
3555 } 3555 }
3556 return modifiers; 3556 return modifiers;
3557 } 3557 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
3679 return parseFunctionDeclarationStatement2(commentAndMetadata, returnTy pe); 3679 return parseFunctionDeclarationStatement2(commentAndMetadata, returnTy pe);
3680 } else { 3680 } else {
3681 if (matchesIdentifier()) { 3681 if (matchesIdentifier()) {
3682 if (matchesAny(peek(), [TokenType.EQ, TokenType.COMMA, TokenType.SEM ICOLON])) { 3682 if (matchesAny(peek(), [TokenType.EQ, TokenType.COMMA, TokenType.SEM ICOLON])) {
3683 reportError(ParserErrorCode.VOID_VARIABLE, returnType, []); 3683 reportError(ParserErrorCode.VOID_VARIABLE, returnType, []);
3684 return parseVariableDeclarationStatement(commentAndMetadata); 3684 return parseVariableDeclarationStatement(commentAndMetadata);
3685 } 3685 }
3686 } else if (matches5(TokenType.CLOSE_CURLY_BRACKET)) { 3686 } else if (matches5(TokenType.CLOSE_CURLY_BRACKET)) {
3687 return parseVariableDeclarationStatement2(commentAndMetadata, null, returnType); 3687 return parseVariableDeclarationStatement2(commentAndMetadata, null, returnType);
3688 } 3688 }
3689 reportError7(ParserErrorCode.MISSING_STATEMENT, []); 3689 reportError8(ParserErrorCode.MISSING_STATEMENT, []);
3690 return new EmptyStatement.full(createSyntheticToken2(TokenType.SEMICOL ON)); 3690 return new EmptyStatement.full(createSyntheticToken2(TokenType.SEMICOL ON));
3691 } 3691 }
3692 } else if (identical(keyword, Keyword.CONST)) { 3692 } else if (identical(keyword, Keyword.CONST)) {
3693 if (matchesAny(peek(), [ 3693 if (matchesAny(peek(), [
3694 TokenType.LT, 3694 TokenType.LT,
3695 TokenType.OPEN_CURLY_BRACKET, 3695 TokenType.OPEN_CURLY_BRACKET,
3696 TokenType.OPEN_SQUARE_BRACKET, 3696 TokenType.OPEN_SQUARE_BRACKET,
3697 TokenType.INDEX])) { 3697 TokenType.INDEX])) {
3698 return new ExpressionStatement.full(parseExpression2(), expect2(TokenT ype.SEMICOLON)); 3698 return new ExpressionStatement.full(parseExpression2(), expect2(TokenT ype.SEMICOLON));
3699 } else if (matches4(peek(), TokenType.IDENTIFIER)) { 3699 } else if (matches4(peek(), TokenType.IDENTIFIER)) {
3700 Token afterType = skipTypeName(peek()); 3700 Token afterType = skipTypeName(peek());
3701 if (afterType != null) { 3701 if (afterType != null) {
3702 if (matches4(afterType, TokenType.OPEN_PAREN) || (matches4(afterType , TokenType.PERIOD) && matches4(afterType.next, TokenType.IDENTIFIER) && matches 4(afterType.next.next, TokenType.OPEN_PAREN))) { 3702 if (matches4(afterType, TokenType.OPEN_PAREN) || (matches4(afterType , TokenType.PERIOD) && matches4(afterType.next, TokenType.IDENTIFIER) && matches 4(afterType.next.next, TokenType.OPEN_PAREN))) {
3703 return new ExpressionStatement.full(parseExpression2(), expect2(To kenType.SEMICOLON)); 3703 return new ExpressionStatement.full(parseExpression2(), expect2(To kenType.SEMICOLON));
3704 } 3704 }
3705 } 3705 }
3706 } 3706 }
3707 return parseVariableDeclarationStatement(commentAndMetadata); 3707 return parseVariableDeclarationStatement(commentAndMetadata);
3708 } else if (identical(keyword, Keyword.NEW) || identical(keyword, Keyword.T RUE) || identical(keyword, Keyword.FALSE) || identical(keyword, Keyword.NULL) || identical(keyword, Keyword.SUPER) || identical(keyword, Keyword.THIS)) { 3708 } else if (identical(keyword, Keyword.NEW) || identical(keyword, Keyword.T RUE) || identical(keyword, Keyword.FALSE) || identical(keyword, Keyword.NULL) || identical(keyword, Keyword.SUPER) || identical(keyword, Keyword.THIS)) {
3709 return new ExpressionStatement.full(parseExpression2(), expect2(TokenTyp e.SEMICOLON)); 3709 return new ExpressionStatement.full(parseExpression2(), expect2(TokenTyp e.SEMICOLON));
3710 } else { 3710 } else {
3711 reportError7(ParserErrorCode.MISSING_STATEMENT, []); 3711 reportError8(ParserErrorCode.MISSING_STATEMENT, []);
3712 return new EmptyStatement.full(createSyntheticToken2(TokenType.SEMICOLON )); 3712 return new EmptyStatement.full(createSyntheticToken2(TokenType.SEMICOLON ));
3713 } 3713 }
3714 } else if (matches5(TokenType.SEMICOLON)) { 3714 } else if (matches5(TokenType.SEMICOLON)) {
3715 return parseEmptyStatement(); 3715 return parseEmptyStatement();
3716 } else if (isInitializedVariableDeclaration()) { 3716 } else if (isInitializedVariableDeclaration()) {
3717 return parseVariableDeclarationStatement(commentAndMetadata); 3717 return parseVariableDeclarationStatement(commentAndMetadata);
3718 } else if (isFunctionDeclaration()) { 3718 } else if (isFunctionDeclaration()) {
3719 return parseFunctionDeclarationStatement(); 3719 return parseFunctionDeclarationStatement();
3720 } else if (matches5(TokenType.CLOSE_CURLY_BRACKET)) { 3720 } else if (matches5(TokenType.CLOSE_CURLY_BRACKET)) {
3721 reportError7(ParserErrorCode.MISSING_STATEMENT, []); 3721 reportError8(ParserErrorCode.MISSING_STATEMENT, []);
3722 return new EmptyStatement.full(createSyntheticToken2(TokenType.SEMICOLON)) ; 3722 return new EmptyStatement.full(createSyntheticToken2(TokenType.SEMICOLON)) ;
3723 } else { 3723 } else {
3724 return new ExpressionStatement.full(parseExpression2(), expect2(TokenType. SEMICOLON)); 3724 return new ExpressionStatement.full(parseExpression2(), expect2(TokenType. SEMICOLON));
3725 } 3725 }
3726 } 3726 }
3727 3727
3728 /** 3728 /**
3729 * Parse a normal formal parameter. 3729 * Parse a normal formal parameter.
3730 * 3730 *
3731 * <pre> 3731 * <pre>
(...skipping 22 matching lines...) Expand all
3754 Token period = null; 3754 Token period = null;
3755 if (matches(Keyword.THIS)) { 3755 if (matches(Keyword.THIS)) {
3756 thisKeyword = andAdvance; 3756 thisKeyword = andAdvance;
3757 period = expect2(TokenType.PERIOD); 3757 period = expect2(TokenType.PERIOD);
3758 } 3758 }
3759 SimpleIdentifier identifier = parseSimpleIdentifier(); 3759 SimpleIdentifier identifier = parseSimpleIdentifier();
3760 if (matches5(TokenType.OPEN_PAREN)) { 3760 if (matches5(TokenType.OPEN_PAREN)) {
3761 FormalParameterList parameters = parseFormalParameterList(); 3761 FormalParameterList parameters = parseFormalParameterList();
3762 if (thisKeyword == null) { 3762 if (thisKeyword == null) {
3763 if (holder.keyword != null) { 3763 if (holder.keyword != null) {
3764 reportError8(ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR, holder.keyw ord, []); 3764 reportError9(ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR, holder.keyw ord, []);
3765 } 3765 }
3766 return new FunctionTypedFormalParameter.full(commentAndMetadata.comment, commentAndMetadata.metadata, holder.type, identifier, parameters); 3766 return new FunctionTypedFormalParameter.full(commentAndMetadata.comment, commentAndMetadata.metadata, holder.type, identifier, parameters);
3767 } else { 3767 } else {
3768 return new FieldFormalParameter.full(commentAndMetadata.comment, comment AndMetadata.metadata, holder.keyword, holder.type, thisKeyword, period, identifi er, parameters); 3768 return new FieldFormalParameter.full(commentAndMetadata.comment, comment AndMetadata.metadata, holder.keyword, holder.type, thisKeyword, period, identifi er, parameters);
3769 } 3769 }
3770 } 3770 }
3771 TypeName type = holder.type; 3771 TypeName type = holder.type;
3772 if (type != null) { 3772 if (type != null) {
3773 if (matches3(type.name.beginToken, Keyword.VOID)) { 3773 if (matches3(type.name.beginToken, Keyword.VOID)) {
3774 reportError8(ParserErrorCode.VOID_PARAMETER, type.name.beginToken, []); 3774 reportError9(ParserErrorCode.VOID_PARAMETER, type.name.beginToken, []);
3775 } else if (holder.keyword != null && matches3(holder.keyword, Keyword.VAR) ) { 3775 } else if (holder.keyword != null && matches3(holder.keyword, Keyword.VAR) ) {
3776 reportError8(ParserErrorCode.VAR_AND_TYPE, holder.keyword, []); 3776 reportError9(ParserErrorCode.VAR_AND_TYPE, holder.keyword, []);
3777 } 3777 }
3778 } 3778 }
3779 if (thisKeyword != null) { 3779 if (thisKeyword != null) {
3780 return new FieldFormalParameter.full(commentAndMetadata.comment, commentAn dMetadata.metadata, holder.keyword, holder.type, thisKeyword, period, identifier , null); 3780 return new FieldFormalParameter.full(commentAndMetadata.comment, commentAn dMetadata.metadata, holder.keyword, holder.type, thisKeyword, period, identifier , null);
3781 } 3781 }
3782 return new SimpleFormalParameter.full(commentAndMetadata.comment, commentAnd Metadata.metadata, holder.keyword, holder.type, identifier); 3782 return new SimpleFormalParameter.full(commentAndMetadata.comment, commentAnd Metadata.metadata, holder.keyword, holder.type, identifier);
3783 } 3783 }
3784 3784
3785 /** 3785 /**
3786 * Parse an operator declaration. 3786 * Parse an operator declaration.
(...skipping 11 matching lines...) Expand all
3798 * @param externalKeyword the 'external' token 3798 * @param externalKeyword the 'external' token
3799 * @param the return type that has already been parsed, or `null` if there was no return 3799 * @param the return type that has already been parsed, or `null` if there was no return
3800 * type 3800 * type
3801 * @return the operator declaration that was parsed 3801 * @return the operator declaration that was parsed
3802 */ 3802 */
3803 MethodDeclaration parseOperator(CommentAndMetadata commentAndMetadata, Token e xternalKeyword, TypeName returnType) { 3803 MethodDeclaration parseOperator(CommentAndMetadata commentAndMetadata, Token e xternalKeyword, TypeName returnType) {
3804 Token operatorKeyword; 3804 Token operatorKeyword;
3805 if (matches(Keyword.OPERATOR)) { 3805 if (matches(Keyword.OPERATOR)) {
3806 operatorKeyword = andAdvance; 3806 operatorKeyword = andAdvance;
3807 } else { 3807 } else {
3808 reportError8(ParserErrorCode.MISSING_KEYWORD_OPERATOR, _currentToken, []); 3808 reportError9(ParserErrorCode.MISSING_KEYWORD_OPERATOR, _currentToken, []);
3809 operatorKeyword = createSyntheticToken(Keyword.OPERATOR); 3809 operatorKeyword = createSyntheticToken(Keyword.OPERATOR);
3810 } 3810 }
3811 if (!_currentToken.isUserDefinableOperator) { 3811 if (!_currentToken.isUserDefinableOperator) {
3812 reportError7(ParserErrorCode.NON_USER_DEFINABLE_OPERATOR, [_currentToken.l exeme]); 3812 reportError8(ParserErrorCode.NON_USER_DEFINABLE_OPERATOR, [_currentToken.l exeme]);
3813 } 3813 }
3814 SimpleIdentifier name = new SimpleIdentifier.full(andAdvance); 3814 SimpleIdentifier name = new SimpleIdentifier.full(andAdvance);
3815 if (matches5(TokenType.EQ)) { 3815 if (matches5(TokenType.EQ)) {
3816 Token previous = _currentToken.previous; 3816 Token previous = _currentToken.previous;
3817 if ((matches4(previous, TokenType.EQ_EQ) || matches4(previous, TokenType.B ANG_EQ)) && _currentToken.offset == previous.offset + 2) { 3817 if ((matches4(previous, TokenType.EQ_EQ) || matches4(previous, TokenType.B ANG_EQ)) && _currentToken.offset == previous.offset + 2) {
3818 reportError7(ParserErrorCode.INVALID_OPERATOR, ["${previous.lexeme}${_cu rrentToken.lexeme}"]); 3818 reportError8(ParserErrorCode.INVALID_OPERATOR, ["${previous.lexeme}${_cu rrentToken.lexeme}"]);
3819 advance(); 3819 advance();
3820 } 3820 }
3821 } 3821 }
3822 FormalParameterList parameters = parseFormalParameterList(); 3822 FormalParameterList parameters = parseFormalParameterList();
3823 validateFormalParameterList(parameters); 3823 validateFormalParameterList(parameters);
3824 FunctionBody body = parseFunctionBody(true, ParserErrorCode.MISSING_FUNCTION _BODY, false); 3824 FunctionBody body = parseFunctionBody(true, ParserErrorCode.MISSING_FUNCTION _BODY, false);
3825 if (externalKeyword != null && body is! EmptyFunctionBody) { 3825 if (externalKeyword != null && body is! EmptyFunctionBody) {
3826 reportError7(ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY, []); 3826 reportError8(ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY, []);
3827 } 3827 }
3828 return new MethodDeclaration.full(commentAndMetadata.comment, commentAndMeta data.metadata, externalKeyword, null, returnType, null, operatorKeyword, name, p arameters, body); 3828 return new MethodDeclaration.full(commentAndMetadata.comment, commentAndMeta data.metadata, externalKeyword, null, returnType, null, operatorKeyword, name, p arameters, body);
3829 } 3829 }
3830 3830
3831 /** 3831 /**
3832 * Parse a return type if one is given, otherwise return `null` without advanc ing. 3832 * Parse a return type if one is given, otherwise return `null` without advanc ing.
3833 * 3833 *
3834 * @return the return type that was parsed 3834 * @return the return type that was parsed
3835 */ 3835 */
3836 TypeName parseOptionalReturnType() { 3836 TypeName parseOptionalReturnType() {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
3901 } else { 3901 } else {
3902 operand = parseAssignableSelector(operand, true); 3902 operand = parseAssignableSelector(operand, true);
3903 } 3903 }
3904 } while (matches5(TokenType.OPEN_SQUARE_BRACKET) || matches5(TokenType.PER IOD) || matches5(TokenType.OPEN_PAREN)); 3904 } while (matches5(TokenType.OPEN_SQUARE_BRACKET) || matches5(TokenType.PER IOD) || matches5(TokenType.OPEN_PAREN));
3905 return operand; 3905 return operand;
3906 } 3906 }
3907 if (!_currentToken.type.isIncrementOperator) { 3907 if (!_currentToken.type.isIncrementOperator) {
3908 return operand; 3908 return operand;
3909 } 3909 }
3910 if (operand is Literal || operand is FunctionExpressionInvocation) { 3910 if (operand is Literal || operand is FunctionExpressionInvocation) {
3911 reportError7(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, []); 3911 reportError8(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, []);
3912 } 3912 }
3913 Token operator = andAdvance; 3913 Token operator = andAdvance;
3914 return new PostfixExpression.full(operand, operator); 3914 return new PostfixExpression.full(operand, operator);
3915 } 3915 }
3916 3916
3917 /** 3917 /**
3918 * Parse a prefixed identifier. 3918 * Parse a prefixed identifier.
3919 * 3919 *
3920 * <pre> 3920 * <pre>
3921 * prefixedIdentifier ::= 3921 * prefixedIdentifier ::=
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
4014 } 4014 }
4015 Token leftParenthesis = andAdvance; 4015 Token leftParenthesis = andAdvance;
4016 Expression expression = parseExpression2(); 4016 Expression expression = parseExpression2();
4017 Token rightParenthesis = expect2(TokenType.CLOSE_PAREN); 4017 Token rightParenthesis = expect2(TokenType.CLOSE_PAREN);
4018 return new ParenthesizedExpression.full(leftParenthesis, expression, right Parenthesis); 4018 return new ParenthesizedExpression.full(leftParenthesis, expression, right Parenthesis);
4019 } else if (matches5(TokenType.LT)) { 4019 } else if (matches5(TokenType.LT)) {
4020 return parseListOrMapLiteral(null); 4020 return parseListOrMapLiteral(null);
4021 } else if (matches5(TokenType.QUESTION)) { 4021 } else if (matches5(TokenType.QUESTION)) {
4022 return parseArgumentDefinitionTest(); 4022 return parseArgumentDefinitionTest();
4023 } else if (matches(Keyword.VOID)) { 4023 } else if (matches(Keyword.VOID)) {
4024 reportError7(ParserErrorCode.UNEXPECTED_TOKEN, [_currentToken.lexeme]); 4024 reportError8(ParserErrorCode.UNEXPECTED_TOKEN, [_currentToken.lexeme]);
4025 advance(); 4025 advance();
4026 return parsePrimaryExpression(); 4026 return parsePrimaryExpression();
4027 } else if (matches5(TokenType.HASH)) { 4027 } else if (matches5(TokenType.HASH)) {
4028 return parseSymbolLiteral(); 4028 return parseSymbolLiteral();
4029 } else { 4029 } else {
4030 reportError7(ParserErrorCode.MISSING_IDENTIFIER, []); 4030 reportError8(ParserErrorCode.MISSING_IDENTIFIER, []);
4031 return createSyntheticIdentifier(); 4031 return createSyntheticIdentifier();
4032 } 4032 }
4033 } 4033 }
4034 4034
4035 /** 4035 /**
4036 * Parse a redirecting constructor invocation. 4036 * Parse a redirecting constructor invocation.
4037 * 4037 *
4038 * <pre> 4038 * <pre>
4039 * redirectingConstructorInvocation ::= 4039 * redirectingConstructorInvocation ::=
4040 * 'this' ('.' identifier)? arguments 4040 * 'this' ('.' identifier)? arguments
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
4160 * type 4160 * type
4161 * @return the setter that was parsed 4161 * @return the setter that was parsed
4162 */ 4162 */
4163 MethodDeclaration parseSetter(CommentAndMetadata commentAndMetadata, Token ext ernalKeyword, Token staticKeyword, TypeName returnType) { 4163 MethodDeclaration parseSetter(CommentAndMetadata commentAndMetadata, Token ext ernalKeyword, Token staticKeyword, TypeName returnType) {
4164 Token propertyKeyword = expect(Keyword.SET); 4164 Token propertyKeyword = expect(Keyword.SET);
4165 SimpleIdentifier name = parseSimpleIdentifier(); 4165 SimpleIdentifier name = parseSimpleIdentifier();
4166 FormalParameterList parameters = parseFormalParameterList(); 4166 FormalParameterList parameters = parseFormalParameterList();
4167 validateFormalParameterList(parameters); 4167 validateFormalParameterList(parameters);
4168 FunctionBody body = parseFunctionBody(externalKeyword != null || staticKeywo rd == null, ParserErrorCode.STATIC_SETTER_WITHOUT_BODY, false); 4168 FunctionBody body = parseFunctionBody(externalKeyword != null || staticKeywo rd == null, ParserErrorCode.STATIC_SETTER_WITHOUT_BODY, false);
4169 if (externalKeyword != null && body is! EmptyFunctionBody) { 4169 if (externalKeyword != null && body is! EmptyFunctionBody) {
4170 reportError7(ParserErrorCode.EXTERNAL_SETTER_WITH_BODY, []); 4170 reportError8(ParserErrorCode.EXTERNAL_SETTER_WITH_BODY, []);
4171 } 4171 }
4172 return new MethodDeclaration.full(commentAndMetadata.comment, commentAndMeta data.metadata, externalKeyword, staticKeyword, returnType, propertyKeyword, null , name, parameters, body); 4172 return new MethodDeclaration.full(commentAndMetadata.comment, commentAndMeta data.metadata, externalKeyword, staticKeyword, returnType, propertyKeyword, null , name, parameters, body);
4173 } 4173 }
4174 4174
4175 /** 4175 /**
4176 * Parse a shift expression. 4176 * Parse a shift expression.
4177 * 4177 *
4178 * <pre> 4178 * <pre>
4179 * shiftExpression ::= 4179 * shiftExpression ::=
4180 * additiveExpression (shiftOperator additiveExpression)* 4180 * additiveExpression (shiftOperator additiveExpression)*
(...skipping 23 matching lines...) Expand all
4204 * identifier ::= 4204 * identifier ::=
4205 * IDENTIFIER 4205 * IDENTIFIER
4206 * </pre> 4206 * </pre>
4207 * 4207 *
4208 * @return the simple identifier that was parsed 4208 * @return the simple identifier that was parsed
4209 */ 4209 */
4210 SimpleIdentifier parseSimpleIdentifier() { 4210 SimpleIdentifier parseSimpleIdentifier() {
4211 if (matchesIdentifier()) { 4211 if (matchesIdentifier()) {
4212 return new SimpleIdentifier.full(andAdvance); 4212 return new SimpleIdentifier.full(andAdvance);
4213 } 4213 }
4214 reportError7(ParserErrorCode.MISSING_IDENTIFIER, []); 4214 reportError8(ParserErrorCode.MISSING_IDENTIFIER, []);
4215 return createSyntheticIdentifier(); 4215 return createSyntheticIdentifier();
4216 } 4216 }
4217 4217
4218 /** 4218 /**
4219 * Parse a statement. 4219 * Parse a statement.
4220 * 4220 *
4221 * <pre> 4221 * <pre>
4222 * statement ::= 4222 * statement ::=
4223 * label* nonLabeledStatement 4223 * label* nonLabeledStatement
4224 * </pre> 4224 * </pre>
(...skipping 23 matching lines...) Expand all
4248 * </pre> 4248 * </pre>
4249 * 4249 *
4250 * @return the statements that were parsed 4250 * @return the statements that were parsed
4251 */ 4251 */
4252 List<Statement> parseStatements2() { 4252 List<Statement> parseStatements2() {
4253 List<Statement> statements = new List<Statement>(); 4253 List<Statement> statements = new List<Statement>();
4254 Token statementStart = _currentToken; 4254 Token statementStart = _currentToken;
4255 while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET) && !isSwitchMember()) { 4255 while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET) && !isSwitchMember()) {
4256 statements.add(parseStatement2()); 4256 statements.add(parseStatement2());
4257 if (identical(_currentToken, statementStart)) { 4257 if (identical(_currentToken, statementStart)) {
4258 reportError8(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentT oken.lexeme]); 4258 reportError9(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentT oken.lexeme]);
4259 advance(); 4259 advance();
4260 } 4260 }
4261 statementStart = _currentToken; 4261 statementStart = _currentToken;
4262 } 4262 }
4263 return statements; 4263 return statements;
4264 } 4264 }
4265 4265
4266 /** 4266 /**
4267 * Parse a string literal that contains interpolations. 4267 * Parse a string literal that contains interpolations.
4268 * 4268 *
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
4312 List<StringLiteral> strings = new List<StringLiteral>(); 4312 List<StringLiteral> strings = new List<StringLiteral>();
4313 while (matches5(TokenType.STRING)) { 4313 while (matches5(TokenType.STRING)) {
4314 Token string = andAdvance; 4314 Token string = andAdvance;
4315 if (matches5(TokenType.STRING_INTERPOLATION_EXPRESSION) || matches5(TokenT ype.STRING_INTERPOLATION_IDENTIFIER)) { 4315 if (matches5(TokenType.STRING_INTERPOLATION_EXPRESSION) || matches5(TokenT ype.STRING_INTERPOLATION_IDENTIFIER)) {
4316 strings.add(parseStringInterpolation(string)); 4316 strings.add(parseStringInterpolation(string));
4317 } else { 4317 } else {
4318 strings.add(new SimpleStringLiteral.full(string, computeStringValue(stri ng.lexeme, true, true))); 4318 strings.add(new SimpleStringLiteral.full(string, computeStringValue(stri ng.lexeme, true, true)));
4319 } 4319 }
4320 } 4320 }
4321 if (strings.length < 1) { 4321 if (strings.length < 1) {
4322 reportError7(ParserErrorCode.EXPECTED_STRING_LITERAL, []); 4322 reportError8(ParserErrorCode.EXPECTED_STRING_LITERAL, []);
4323 return createSyntheticStringLiteral(); 4323 return createSyntheticStringLiteral();
4324 } else if (strings.length == 1) { 4324 } else if (strings.length == 1) {
4325 return strings[0]; 4325 return strings[0];
4326 } else { 4326 } else {
4327 return new AdjacentStrings.full(strings); 4327 return new AdjacentStrings.full(strings);
4328 } 4328 }
4329 } 4329 }
4330 4330
4331 /** 4331 /**
4332 * Parse a super constructor invocation. 4332 * Parse a super constructor invocation.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4377 Token rightParenthesis = expect2(TokenType.CLOSE_PAREN); 4377 Token rightParenthesis = expect2(TokenType.CLOSE_PAREN);
4378 Token leftBracket = expect2(TokenType.OPEN_CURLY_BRACKET); 4378 Token leftBracket = expect2(TokenType.OPEN_CURLY_BRACKET);
4379 Token defaultKeyword = null; 4379 Token defaultKeyword = null;
4380 List<SwitchMember> members = new List<SwitchMember>(); 4380 List<SwitchMember> members = new List<SwitchMember>();
4381 while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET )) { 4381 while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET )) {
4382 List<Label> labels = new List<Label>(); 4382 List<Label> labels = new List<Label>();
4383 while (matchesIdentifier() && matches4(peek(), TokenType.COLON)) { 4383 while (matchesIdentifier() && matches4(peek(), TokenType.COLON)) {
4384 SimpleIdentifier identifier = parseSimpleIdentifier(); 4384 SimpleIdentifier identifier = parseSimpleIdentifier();
4385 String label = identifier.token.lexeme; 4385 String label = identifier.token.lexeme;
4386 if (definedLabels.contains(label)) { 4386 if (definedLabels.contains(label)) {
4387 reportError8(ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT, id entifier.token, [label]); 4387 reportError9(ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT, id entifier.token, [label]);
4388 } else { 4388 } else {
4389 javaSetAdd(definedLabels, label); 4389 javaSetAdd(definedLabels, label);
4390 } 4390 }
4391 Token colon = expect2(TokenType.COLON); 4391 Token colon = expect2(TokenType.COLON);
4392 labels.add(new Label.full(identifier, colon)); 4392 labels.add(new Label.full(identifier, colon));
4393 } 4393 }
4394 if (matches(Keyword.CASE)) { 4394 if (matches(Keyword.CASE)) {
4395 Token caseKeyword = andAdvance; 4395 Token caseKeyword = andAdvance;
4396 Expression caseExpression = parseExpression2(); 4396 Expression caseExpression = parseExpression2();
4397 Token colon = expect2(TokenType.COLON); 4397 Token colon = expect2(TokenType.COLON);
4398 members.add(new SwitchCase.full(labels, caseKeyword, caseExpression, c olon, parseStatements2())); 4398 members.add(new SwitchCase.full(labels, caseKeyword, caseExpression, c olon, parseStatements2()));
4399 if (defaultKeyword != null) { 4399 if (defaultKeyword != null) {
4400 reportError8(ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE, cas eKeyword, []); 4400 reportError9(ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE, cas eKeyword, []);
4401 } 4401 }
4402 } else if (matches(Keyword.DEFAULT)) { 4402 } else if (matches(Keyword.DEFAULT)) {
4403 if (defaultKeyword != null) { 4403 if (defaultKeyword != null) {
4404 reportError8(ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES, peek (), []); 4404 reportError9(ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES, peek (), []);
4405 } 4405 }
4406 defaultKeyword = andAdvance; 4406 defaultKeyword = andAdvance;
4407 Token colon = expect2(TokenType.COLON); 4407 Token colon = expect2(TokenType.COLON);
4408 members.add(new SwitchDefault.full(labels, defaultKeyword, colon, pars eStatements2())); 4408 members.add(new SwitchDefault.full(labels, defaultKeyword, colon, pars eStatements2()));
4409 } else { 4409 } else {
4410 reportError7(ParserErrorCode.EXPECTED_CASE_OR_DEFAULT, []); 4410 reportError8(ParserErrorCode.EXPECTED_CASE_OR_DEFAULT, []);
4411 while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRA CKET) && !matches(Keyword.CASE) && !matches(Keyword.DEFAULT)) { 4411 while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRA CKET) && !matches(Keyword.CASE) && !matches(Keyword.DEFAULT)) {
4412 advance(); 4412 advance();
4413 } 4413 }
4414 } 4414 }
4415 } 4415 }
4416 Token rightBracket = expect2(TokenType.CLOSE_CURLY_BRACKET); 4416 Token rightBracket = expect2(TokenType.CLOSE_CURLY_BRACKET);
4417 return new SwitchStatement.full(keyword, leftParenthesis, expression, righ tParenthesis, leftBracket, members, rightBracket); 4417 return new SwitchStatement.full(keyword, leftParenthesis, expression, righ tParenthesis, leftBracket, members, rightBracket);
4418 } finally { 4418 } finally {
4419 _inSwitch = wasInSwitch; 4419 _inSwitch = wasInSwitch;
4420 } 4420 }
(...skipping 12 matching lines...) Expand all
4433 SymbolLiteral parseSymbolLiteral() { 4433 SymbolLiteral parseSymbolLiteral() {
4434 Token poundSign = andAdvance; 4434 Token poundSign = andAdvance;
4435 List<Token> components = new List<Token>(); 4435 List<Token> components = new List<Token>();
4436 if (matches5(TokenType.IDENTIFIER)) { 4436 if (matches5(TokenType.IDENTIFIER)) {
4437 components.add(andAdvance); 4437 components.add(andAdvance);
4438 while (matches5(TokenType.PERIOD)) { 4438 while (matches5(TokenType.PERIOD)) {
4439 advance(); 4439 advance();
4440 if (matches5(TokenType.IDENTIFIER)) { 4440 if (matches5(TokenType.IDENTIFIER)) {
4441 components.add(andAdvance); 4441 components.add(andAdvance);
4442 } else { 4442 } else {
4443 reportError7(ParserErrorCode.MISSING_IDENTIFIER, []); 4443 reportError8(ParserErrorCode.MISSING_IDENTIFIER, []);
4444 components.add(createSyntheticToken2(TokenType.IDENTIFIER)); 4444 components.add(createSyntheticToken2(TokenType.IDENTIFIER));
4445 break; 4445 break;
4446 } 4446 }
4447 } 4447 }
4448 } else if (_currentToken.isOperator) { 4448 } else if (_currentToken.isOperator) {
4449 components.add(andAdvance); 4449 components.add(andAdvance);
4450 } else { 4450 } else {
4451 reportError7(ParserErrorCode.MISSING_IDENTIFIER, []); 4451 reportError8(ParserErrorCode.MISSING_IDENTIFIER, []);
4452 components.add(createSyntheticToken2(TokenType.IDENTIFIER)); 4452 components.add(createSyntheticToken2(TokenType.IDENTIFIER));
4453 } 4453 }
4454 return new SymbolLiteral.full(poundSign, new List.from(components)); 4454 return new SymbolLiteral.full(poundSign, new List.from(components));
4455 } 4455 }
4456 4456
4457 /** 4457 /**
4458 * Parse a throw expression. 4458 * Parse a throw expression.
4459 * 4459 *
4460 * <pre> 4460 * <pre>
4461 * throwExpression ::= 4461 * throwExpression ::=
4462 * 'throw' expression 4462 * 'throw' expression
4463 * </pre> 4463 * </pre>
4464 * 4464 *
4465 * @return the throw expression that was parsed 4465 * @return the throw expression that was parsed
4466 */ 4466 */
4467 Expression parseThrowExpression() { 4467 Expression parseThrowExpression() {
4468 Token keyword = expect(Keyword.THROW); 4468 Token keyword = expect(Keyword.THROW);
4469 if (matches5(TokenType.SEMICOLON) || matches5(TokenType.CLOSE_PAREN)) { 4469 if (matches5(TokenType.SEMICOLON) || matches5(TokenType.CLOSE_PAREN)) {
4470 reportError8(ParserErrorCode.MISSING_EXPRESSION_IN_THROW, _currentToken, [ ]); 4470 reportError9(ParserErrorCode.MISSING_EXPRESSION_IN_THROW, _currentToken, [ ]);
4471 return new ThrowExpression.full(keyword, createSyntheticIdentifier()); 4471 return new ThrowExpression.full(keyword, createSyntheticIdentifier());
4472 } 4472 }
4473 Expression expression = parseExpression2(); 4473 Expression expression = parseExpression2();
4474 return new ThrowExpression.full(keyword, expression); 4474 return new ThrowExpression.full(keyword, expression);
4475 } 4475 }
4476 4476
4477 /** 4477 /**
4478 * Parse a throw expression. 4478 * Parse a throw expression.
4479 * 4479 *
4480 * <pre> 4480 * <pre>
4481 * throwExpressionWithoutCascade ::= 4481 * throwExpressionWithoutCascade ::=
4482 * 'throw' expressionWithoutCascade 4482 * 'throw' expressionWithoutCascade
4483 * </pre> 4483 * </pre>
4484 * 4484 *
4485 * @return the throw expression that was parsed 4485 * @return the throw expression that was parsed
4486 */ 4486 */
4487 Expression parseThrowExpressionWithoutCascade() { 4487 Expression parseThrowExpressionWithoutCascade() {
4488 Token keyword = expect(Keyword.THROW); 4488 Token keyword = expect(Keyword.THROW);
4489 if (matches5(TokenType.SEMICOLON) || matches5(TokenType.CLOSE_PAREN)) { 4489 if (matches5(TokenType.SEMICOLON) || matches5(TokenType.CLOSE_PAREN)) {
4490 reportError8(ParserErrorCode.MISSING_EXPRESSION_IN_THROW, _currentToken, [ ]); 4490 reportError9(ParserErrorCode.MISSING_EXPRESSION_IN_THROW, _currentToken, [ ]);
4491 return new ThrowExpression.full(keyword, createSyntheticIdentifier()); 4491 return new ThrowExpression.full(keyword, createSyntheticIdentifier());
4492 } 4492 }
4493 Expression expression = parseExpressionWithoutCascade(); 4493 Expression expression = parseExpressionWithoutCascade();
4494 return new ThrowExpression.full(keyword, expression); 4494 return new ThrowExpression.full(keyword, expression);
4495 } 4495 }
4496 4496
4497 /** 4497 /**
4498 * Parse a try statement. 4498 * Parse a try statement.
4499 * 4499 *
4500 * <pre> 4500 * <pre>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
4544 } 4544 }
4545 Block catchBody = parseBlock(); 4545 Block catchBody = parseBlock();
4546 catchClauses.add(new CatchClause.full(onKeyword, exceptionType, catchKeywo rd, leftParenthesis, exceptionParameter, comma, stackTraceParameter, rightParent hesis, catchBody)); 4546 catchClauses.add(new CatchClause.full(onKeyword, exceptionType, catchKeywo rd, leftParenthesis, exceptionParameter, comma, stackTraceParameter, rightParent hesis, catchBody));
4547 } 4547 }
4548 Token finallyKeyword = null; 4548 Token finallyKeyword = null;
4549 if (matches(Keyword.FINALLY)) { 4549 if (matches(Keyword.FINALLY)) {
4550 finallyKeyword = andAdvance; 4550 finallyKeyword = andAdvance;
4551 finallyClause = parseBlock(); 4551 finallyClause = parseBlock();
4552 } else { 4552 } else {
4553 if (catchClauses.isEmpty) { 4553 if (catchClauses.isEmpty) {
4554 reportError7(ParserErrorCode.MISSING_CATCH_OR_FINALLY, []); 4554 reportError8(ParserErrorCode.MISSING_CATCH_OR_FINALLY, []);
4555 } 4555 }
4556 } 4556 }
4557 return new TryStatement.full(tryKeyword, body, catchClauses, finallyKeyword, finallyClause); 4557 return new TryStatement.full(tryKeyword, body, catchClauses, finallyKeyword, finallyClause);
4558 } 4558 }
4559 4559
4560 /** 4560 /**
4561 * Parse a type alias. 4561 * Parse a type alias.
4562 * 4562 *
4563 * <pre> 4563 * <pre>
4564 * typeAlias ::= 4564 * typeAlias ::=
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
4630 * <pre> 4630 * <pre>
4631 * type ::= 4631 * type ::=
4632 * qualified typeArguments? 4632 * qualified typeArguments?
4633 * </pre> 4633 * </pre>
4634 * 4634 *
4635 * @return the type name that was parsed 4635 * @return the type name that was parsed
4636 */ 4636 */
4637 TypeName parseTypeName() { 4637 TypeName parseTypeName() {
4638 Identifier typeName; 4638 Identifier typeName;
4639 if (matches(Keyword.VAR)) { 4639 if (matches(Keyword.VAR)) {
4640 reportError7(ParserErrorCode.VAR_AS_TYPE_NAME, []); 4640 reportError8(ParserErrorCode.VAR_AS_TYPE_NAME, []);
4641 typeName = new SimpleIdentifier.full(andAdvance); 4641 typeName = new SimpleIdentifier.full(andAdvance);
4642 } else if (matchesIdentifier()) { 4642 } else if (matchesIdentifier()) {
4643 typeName = parsePrefixedIdentifier(); 4643 typeName = parsePrefixedIdentifier();
4644 } else { 4644 } else {
4645 typeName = createSyntheticIdentifier(); 4645 typeName = createSyntheticIdentifier();
4646 reportError7(ParserErrorCode.EXPECTED_TYPE_NAME, []); 4646 reportError8(ParserErrorCode.EXPECTED_TYPE_NAME, []);
4647 } 4647 }
4648 TypeArgumentList typeArguments = null; 4648 TypeArgumentList typeArguments = null;
4649 if (matches5(TokenType.LT)) { 4649 if (matches5(TokenType.LT)) {
4650 typeArguments = parseTypeArgumentList(); 4650 typeArguments = parseTypeArgumentList();
4651 } 4651 }
4652 return new TypeName.full(typeName, typeArguments); 4652 return new TypeName.full(typeName, typeArguments);
4653 } 4653 }
4654 4654
4655 /** 4655 /**
4656 * Parse a type parameter. 4656 * Parse a type parameter.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
4726 } 4726 }
4727 if (identical(operator.type, TokenType.MINUS_MINUS)) { 4727 if (identical(operator.type, TokenType.MINUS_MINUS)) {
4728 int offset = operator.offset; 4728 int offset = operator.offset;
4729 Token firstOperator = new Token(TokenType.MINUS, offset); 4729 Token firstOperator = new Token(TokenType.MINUS, offset);
4730 Token secondOperator = new Token(TokenType.MINUS, offset + 1); 4730 Token secondOperator = new Token(TokenType.MINUS, offset + 1);
4731 secondOperator.setNext(_currentToken); 4731 secondOperator.setNext(_currentToken);
4732 firstOperator.setNext(secondOperator); 4732 firstOperator.setNext(secondOperator);
4733 operator.previous.setNext(firstOperator); 4733 operator.previous.setNext(firstOperator);
4734 return new PrefixExpression.full(firstOperator, new PrefixExpression.f ull(secondOperator, new SuperExpression.full(andAdvance))); 4734 return new PrefixExpression.full(firstOperator, new PrefixExpression.f ull(secondOperator, new SuperExpression.full(andAdvance)));
4735 } else { 4735 } else {
4736 reportError7(ParserErrorCode.INVALID_OPERATOR_FOR_SUPER, [operator.lex eme]); 4736 reportError8(ParserErrorCode.INVALID_OPERATOR_FOR_SUPER, [operator.lex eme]);
4737 return new PrefixExpression.full(operator, new SuperExpression.full(an dAdvance)); 4737 return new PrefixExpression.full(operator, new SuperExpression.full(an dAdvance));
4738 } 4738 }
4739 } 4739 }
4740 return new PrefixExpression.full(operator, parseAssignableExpression(false )); 4740 return new PrefixExpression.full(operator, parseAssignableExpression(false ));
4741 } else if (matches5(TokenType.PLUS)) { 4741 } else if (matches5(TokenType.PLUS)) {
4742 reportError7(ParserErrorCode.MISSING_IDENTIFIER, []); 4742 reportError8(ParserErrorCode.MISSING_IDENTIFIER, []);
4743 return createSyntheticIdentifier(); 4743 return createSyntheticIdentifier();
4744 } 4744 }
4745 return parsePostfixExpression(); 4745 return parsePostfixExpression();
4746 } 4746 }
4747 4747
4748 /** 4748 /**
4749 * Parse a variable declaration. 4749 * Parse a variable declaration.
4750 * 4750 *
4751 * <pre> 4751 * <pre>
4752 * variableDeclaration ::= 4752 * variableDeclaration ::=
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
4793 * 4793 *
4794 * @param commentAndMetadata the metadata to be associated with the variable d eclaration list, or 4794 * @param commentAndMetadata the metadata to be associated with the variable d eclaration list, or
4795 * `null` if there is no attempt at parsing the comment and metadata 4795 * `null` if there is no attempt at parsing the comment and metadata
4796 * @param keyword the token representing the 'final', 'const' or 'var' keyword , or `null` if 4796 * @param keyword the token representing the 'final', 'const' or 'var' keyword , or `null` if
4797 * there is no keyword 4797 * there is no keyword
4798 * @param type the type of the variables in the list 4798 * @param type the type of the variables in the list
4799 * @return the variable declaration list that was parsed 4799 * @return the variable declaration list that was parsed
4800 */ 4800 */
4801 VariableDeclarationList parseVariableDeclarationList2(CommentAndMetadata comme ntAndMetadata, Token keyword, TypeName type) { 4801 VariableDeclarationList parseVariableDeclarationList2(CommentAndMetadata comme ntAndMetadata, Token keyword, TypeName type) {
4802 if (type != null && keyword != null && matches3(keyword, Keyword.VAR)) { 4802 if (type != null && keyword != null && matches3(keyword, Keyword.VAR)) {
4803 reportError8(ParserErrorCode.VAR_AND_TYPE, keyword, []); 4803 reportError9(ParserErrorCode.VAR_AND_TYPE, keyword, []);
4804 } 4804 }
4805 List<VariableDeclaration> variables = new List<VariableDeclaration>(); 4805 List<VariableDeclaration> variables = new List<VariableDeclaration>();
4806 variables.add(parseVariableDeclaration()); 4806 variables.add(parseVariableDeclaration());
4807 while (matches5(TokenType.COMMA)) { 4807 while (matches5(TokenType.COMMA)) {
4808 advance(); 4808 advance();
4809 variables.add(parseVariableDeclaration()); 4809 variables.add(parseVariableDeclaration());
4810 } 4810 }
4811 return new VariableDeclarationList.full(commentAndMetadata != null ? comment AndMetadata.comment : null, commentAndMetadata != null ? commentAndMetadata.meta data : null, keyword, type, variables); 4811 return new VariableDeclarationList.full(commentAndMetadata != null ? comment AndMetadata.comment : null, commentAndMetadata != null ? commentAndMetadata.meta data : null, keyword, type, variables);
4812 } 4812 }
4813 4813
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
4928 void reportError(ParserErrorCode errorCode, ASTNode node, List<Object> argumen ts) { 4928 void reportError(ParserErrorCode errorCode, ASTNode node, List<Object> argumen ts) {
4929 _errorListener.onError(new AnalysisError.con2(_source, node.offset, node.len gth, errorCode, arguments)); 4929 _errorListener.onError(new AnalysisError.con2(_source, node.offset, node.len gth, errorCode, arguments));
4930 } 4930 }
4931 4931
4932 /** 4932 /**
4933 * Report an error with the given error code and arguments. 4933 * Report an error with the given error code and arguments.
4934 * 4934 *
4935 * @param errorCode the error code of the error to be reported 4935 * @param errorCode the error code of the error to be reported
4936 * @param arguments the arguments to the error, used to compose the error mess age 4936 * @param arguments the arguments to the error, used to compose the error mess age
4937 */ 4937 */
4938 void reportError7(ParserErrorCode errorCode, List<Object> arguments) { 4938 void reportError8(ParserErrorCode errorCode, List<Object> arguments) {
4939 reportError8(errorCode, _currentToken, arguments); 4939 reportError9(errorCode, _currentToken, arguments);
4940 } 4940 }
4941 4941
4942 /** 4942 /**
4943 * Report an error with the given error code and arguments. 4943 * Report an error with the given error code and arguments.
4944 * 4944 *
4945 * @param errorCode the error code of the error to be reported 4945 * @param errorCode the error code of the error to be reported
4946 * @param token the token specifying the location of the error 4946 * @param token the token specifying the location of the error
4947 * @param arguments the arguments to the error, used to compose the error mess age 4947 * @param arguments the arguments to the error, used to compose the error mess age
4948 */ 4948 */
4949 void reportError8(ParserErrorCode errorCode, Token token, List<Object> argumen ts) { 4949 void reportError9(ParserErrorCode errorCode, Token token, List<Object> argumen ts) {
4950 _errorListener.onError(new AnalysisError.con2(_source, token.offset, token.l ength, errorCode, arguments)); 4950 _errorListener.onError(new AnalysisError.con2(_source, token.offset, token.l ength, errorCode, arguments));
4951 } 4951 }
4952 4952
4953 /** 4953 /**
4954 * Parse the 'final', 'const', 'var' or type preceding a variable declaration, starting at the 4954 * Parse the 'final', 'const', 'var' or type preceding a variable declaration, starting at the
4955 * given token, without actually creating a type or changing the current token . Return the token 4955 * given token, without actually creating a type or changing the current token . Return the token
4956 * following the type that was parsed, or `null` if the given token is not the first token 4956 * following the type that was parsed, or `null` if the given token is not the first token
4957 * in a valid type. 4957 * in a valid type.
4958 * 4958 *
4959 * <pre> 4959 * <pre>
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
5377 } else if (currentChar == 0x66) { 5377 } else if (currentChar == 0x66) {
5378 builder.appendChar(0xC); 5378 builder.appendChar(0xC);
5379 } else if (currentChar == 0x62) { 5379 } else if (currentChar == 0x62) {
5380 builder.appendChar(0x8); 5380 builder.appendChar(0x8);
5381 } else if (currentChar == 0x74) { 5381 } else if (currentChar == 0x74) {
5382 builder.appendChar(0x9); 5382 builder.appendChar(0x9);
5383 } else if (currentChar == 0x76) { 5383 } else if (currentChar == 0x76) {
5384 builder.appendChar(0xB); 5384 builder.appendChar(0xB);
5385 } else if (currentChar == 0x78) { 5385 } else if (currentChar == 0x78) {
5386 if (currentIndex + 2 >= length) { 5386 if (currentIndex + 2 >= length) {
5387 reportError7(ParserErrorCode.INVALID_HEX_ESCAPE, []); 5387 reportError8(ParserErrorCode.INVALID_HEX_ESCAPE, []);
5388 return length; 5388 return length;
5389 } 5389 }
5390 int firstDigit = lexeme.codeUnitAt(currentIndex + 1); 5390 int firstDigit = lexeme.codeUnitAt(currentIndex + 1);
5391 int secondDigit = lexeme.codeUnitAt(currentIndex + 2); 5391 int secondDigit = lexeme.codeUnitAt(currentIndex + 2);
5392 if (!isHexDigit(firstDigit) || !isHexDigit(secondDigit)) { 5392 if (!isHexDigit(firstDigit) || !isHexDigit(secondDigit)) {
5393 reportError7(ParserErrorCode.INVALID_HEX_ESCAPE, []); 5393 reportError8(ParserErrorCode.INVALID_HEX_ESCAPE, []);
5394 } else { 5394 } else {
5395 builder.appendChar((((Character.digit(firstDigit, 16) << 4) + Character. digit(secondDigit, 16)) as int)); 5395 builder.appendChar(((Character.digit(firstDigit, 16) << 4) + Character.d igit(secondDigit, 16)) as int);
5396 } 5396 }
5397 return currentIndex + 3; 5397 return currentIndex + 3;
5398 } else if (currentChar == 0x75) { 5398 } else if (currentChar == 0x75) {
5399 currentIndex++; 5399 currentIndex++;
5400 if (currentIndex >= length) { 5400 if (currentIndex >= length) {
5401 reportError7(ParserErrorCode.INVALID_UNICODE_ESCAPE, []); 5401 reportError8(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
5402 return length; 5402 return length;
5403 } 5403 }
5404 currentChar = lexeme.codeUnitAt(currentIndex); 5404 currentChar = lexeme.codeUnitAt(currentIndex);
5405 if (currentChar == 0x7B) { 5405 if (currentChar == 0x7B) {
5406 currentIndex++; 5406 currentIndex++;
5407 if (currentIndex >= length) { 5407 if (currentIndex >= length) {
5408 reportError7(ParserErrorCode.INVALID_UNICODE_ESCAPE, []); 5408 reportError8(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
5409 return length; 5409 return length;
5410 } 5410 }
5411 currentChar = lexeme.codeUnitAt(currentIndex); 5411 currentChar = lexeme.codeUnitAt(currentIndex);
5412 int digitCount = 0; 5412 int digitCount = 0;
5413 int value = 0; 5413 int value = 0;
5414 while (currentChar != 0x7D) { 5414 while (currentChar != 0x7D) {
5415 if (!isHexDigit(currentChar)) { 5415 if (!isHexDigit(currentChar)) {
5416 reportError7(ParserErrorCode.INVALID_UNICODE_ESCAPE, []); 5416 reportError8(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
5417 currentIndex++; 5417 currentIndex++;
5418 while (currentIndex < length && lexeme.codeUnitAt(currentIndex) != 0 x7D) { 5418 while (currentIndex < length && lexeme.codeUnitAt(currentIndex) != 0 x7D) {
5419 currentIndex++; 5419 currentIndex++;
5420 } 5420 }
5421 return currentIndex + 1; 5421 return currentIndex + 1;
5422 } 5422 }
5423 digitCount++; 5423 digitCount++;
5424 value = (value << 4) + Character.digit(currentChar, 16); 5424 value = (value << 4) + Character.digit(currentChar, 16);
5425 currentIndex++; 5425 currentIndex++;
5426 if (currentIndex >= length) { 5426 if (currentIndex >= length) {
5427 reportError7(ParserErrorCode.INVALID_UNICODE_ESCAPE, []); 5427 reportError8(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
5428 return length; 5428 return length;
5429 } 5429 }
5430 currentChar = lexeme.codeUnitAt(currentIndex); 5430 currentChar = lexeme.codeUnitAt(currentIndex);
5431 } 5431 }
5432 if (digitCount < 1 || digitCount > 6) { 5432 if (digitCount < 1 || digitCount > 6) {
5433 reportError7(ParserErrorCode.INVALID_UNICODE_ESCAPE, []); 5433 reportError8(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
5434 } 5434 }
5435 appendScalarValue(builder, lexeme.substring(index, currentIndex + 1), va lue, index, currentIndex); 5435 appendScalarValue(builder, lexeme.substring(index, currentIndex + 1), va lue, index, currentIndex);
5436 return currentIndex + 1; 5436 return currentIndex + 1;
5437 } else { 5437 } else {
5438 if (currentIndex + 3 >= length) { 5438 if (currentIndex + 3 >= length) {
5439 reportError7(ParserErrorCode.INVALID_UNICODE_ESCAPE, []); 5439 reportError8(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
5440 return length; 5440 return length;
5441 } 5441 }
5442 int firstDigit = currentChar; 5442 int firstDigit = currentChar;
5443 int secondDigit = lexeme.codeUnitAt(currentIndex + 1); 5443 int secondDigit = lexeme.codeUnitAt(currentIndex + 1);
5444 int thirdDigit = lexeme.codeUnitAt(currentIndex + 2); 5444 int thirdDigit = lexeme.codeUnitAt(currentIndex + 2);
5445 int fourthDigit = lexeme.codeUnitAt(currentIndex + 3); 5445 int fourthDigit = lexeme.codeUnitAt(currentIndex + 3);
5446 if (!isHexDigit(firstDigit) || !isHexDigit(secondDigit) || !isHexDigit(t hirdDigit) || !isHexDigit(fourthDigit)) { 5446 if (!isHexDigit(firstDigit) || !isHexDigit(secondDigit) || !isHexDigit(t hirdDigit) || !isHexDigit(fourthDigit)) {
5447 reportError7(ParserErrorCode.INVALID_UNICODE_ESCAPE, []); 5447 reportError8(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
5448 } else { 5448 } else {
5449 appendScalarValue(builder, lexeme.substring(index, currentIndex + 1), ((((((Character.digit(firstDigit, 16) << 4) + Character.digit(secondDigit, 16)) << 4) + Character.digit(thirdDigit, 16)) << 4) + Character.digit(fourthDigit, 16 )), index, currentIndex + 3); 5449 appendScalarValue(builder, lexeme.substring(index, currentIndex + 1), (((((Character.digit(firstDigit, 16) << 4) + Character.digit(secondDigit, 16)) < < 4) + Character.digit(thirdDigit, 16)) << 4) + Character.digit(fourthDigit, 16) , index, currentIndex + 3);
5450 } 5450 }
5451 return currentIndex + 4; 5451 return currentIndex + 4;
5452 } 5452 }
5453 } else { 5453 } else {
5454 builder.appendChar(currentChar); 5454 builder.appendChar(currentChar);
5455 } 5455 }
5456 return currentIndex + 1; 5456 return currentIndex + 1;
5457 } 5457 }
5458 5458
5459 /** 5459 /**
(...skipping 11 matching lines...) Expand all
5471 5471
5472 /** 5472 /**
5473 * Validate that the given set of modifiers is appropriate for a class and ret urn the 'abstract' 5473 * Validate that the given set of modifiers is appropriate for a class and ret urn the 'abstract'
5474 * keyword if there is one. 5474 * keyword if there is one.
5475 * 5475 *
5476 * @param modifiers the modifiers being validated 5476 * @param modifiers the modifiers being validated
5477 */ 5477 */
5478 Token validateModifiersForClass(Modifiers modifiers) { 5478 Token validateModifiersForClass(Modifiers modifiers) {
5479 validateModifiersForTopLevelDeclaration(modifiers); 5479 validateModifiersForTopLevelDeclaration(modifiers);
5480 if (modifiers.constKeyword != null) { 5480 if (modifiers.constKeyword != null) {
5481 reportError8(ParserErrorCode.CONST_CLASS, modifiers.constKeyword, []); 5481 reportError9(ParserErrorCode.CONST_CLASS, modifiers.constKeyword, []);
5482 } 5482 }
5483 if (modifiers.externalKeyword != null) { 5483 if (modifiers.externalKeyword != null) {
5484 reportError8(ParserErrorCode.EXTERNAL_CLASS, modifiers.externalKeyword, [] ); 5484 reportError9(ParserErrorCode.EXTERNAL_CLASS, modifiers.externalKeyword, [] );
5485 } 5485 }
5486 if (modifiers.finalKeyword != null) { 5486 if (modifiers.finalKeyword != null) {
5487 reportError8(ParserErrorCode.FINAL_CLASS, modifiers.finalKeyword, []); 5487 reportError9(ParserErrorCode.FINAL_CLASS, modifiers.finalKeyword, []);
5488 } 5488 }
5489 if (modifiers.varKeyword != null) { 5489 if (modifiers.varKeyword != null) {
5490 reportError8(ParserErrorCode.VAR_CLASS, modifiers.varKeyword, []); 5490 reportError9(ParserErrorCode.VAR_CLASS, modifiers.varKeyword, []);
5491 } 5491 }
5492 return modifiers.abstractKeyword; 5492 return modifiers.abstractKeyword;
5493 } 5493 }
5494 5494
5495 /** 5495 /**
5496 * Validate that the given set of modifiers is appropriate for a constructor a nd return the 5496 * Validate that the given set of modifiers is appropriate for a constructor a nd return the
5497 * 'const' keyword if there is one. 5497 * 'const' keyword if there is one.
5498 * 5498 *
5499 * @param modifiers the modifiers being validated 5499 * @param modifiers the modifiers being validated
5500 * @return the 'const' or 'final' keyword associated with the constructor 5500 * @return the 'const' or 'final' keyword associated with the constructor
5501 */ 5501 */
5502 Token validateModifiersForConstructor(Modifiers modifiers) { 5502 Token validateModifiersForConstructor(Modifiers modifiers) {
5503 if (modifiers.abstractKeyword != null) { 5503 if (modifiers.abstractKeyword != null) {
5504 reportError7(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []); 5504 reportError8(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
5505 } 5505 }
5506 if (modifiers.finalKeyword != null) { 5506 if (modifiers.finalKeyword != null) {
5507 reportError8(ParserErrorCode.FINAL_CONSTRUCTOR, modifiers.finalKeyword, [] ); 5507 reportError9(ParserErrorCode.FINAL_CONSTRUCTOR, modifiers.finalKeyword, [] );
5508 } 5508 }
5509 if (modifiers.staticKeyword != null) { 5509 if (modifiers.staticKeyword != null) {
5510 reportError8(ParserErrorCode.STATIC_CONSTRUCTOR, modifiers.staticKeyword, []); 5510 reportError9(ParserErrorCode.STATIC_CONSTRUCTOR, modifiers.staticKeyword, []);
5511 } 5511 }
5512 if (modifiers.varKeyword != null) { 5512 if (modifiers.varKeyword != null) {
5513 reportError8(ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, modifiers.varKe yword, []); 5513 reportError9(ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, modifiers.varKe yword, []);
5514 } 5514 }
5515 Token externalKeyword = modifiers.externalKeyword; 5515 Token externalKeyword = modifiers.externalKeyword;
5516 Token constKeyword = modifiers.constKeyword; 5516 Token constKeyword = modifiers.constKeyword;
5517 Token factoryKeyword = modifiers.factoryKeyword; 5517 Token factoryKeyword = modifiers.factoryKeyword;
5518 if (externalKeyword != null && constKeyword != null && constKeyword.offset < externalKeyword.offset) { 5518 if (externalKeyword != null && constKeyword != null && constKeyword.offset < externalKeyword.offset) {
5519 reportError8(ParserErrorCode.EXTERNAL_AFTER_CONST, externalKeyword, []); 5519 reportError9(ParserErrorCode.EXTERNAL_AFTER_CONST, externalKeyword, []);
5520 } 5520 }
5521 if (externalKeyword != null && factoryKeyword != null && factoryKeyword.offs et < externalKeyword.offset) { 5521 if (externalKeyword != null && factoryKeyword != null && factoryKeyword.offs et < externalKeyword.offset) {
5522 reportError8(ParserErrorCode.EXTERNAL_AFTER_FACTORY, externalKeyword, []); 5522 reportError9(ParserErrorCode.EXTERNAL_AFTER_FACTORY, externalKeyword, []);
5523 } 5523 }
5524 return constKeyword; 5524 return constKeyword;
5525 } 5525 }
5526 5526
5527 /** 5527 /**
5528 * Validate that the given set of modifiers is appropriate for a field and ret urn the 'final', 5528 * Validate that the given set of modifiers is appropriate for a field and ret urn the 'final',
5529 * 'const' or 'var' keyword if there is one. 5529 * 'const' or 'var' keyword if there is one.
5530 * 5530 *
5531 * @param modifiers the modifiers being validated 5531 * @param modifiers the modifiers being validated
5532 * @return the 'final', 'const' or 'var' keyword associated with the field 5532 * @return the 'final', 'const' or 'var' keyword associated with the field
5533 */ 5533 */
5534 Token validateModifiersForField(Modifiers modifiers) { 5534 Token validateModifiersForField(Modifiers modifiers) {
5535 if (modifiers.abstractKeyword != null) { 5535 if (modifiers.abstractKeyword != null) {
5536 reportError7(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []); 5536 reportError8(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
5537 } 5537 }
5538 if (modifiers.externalKeyword != null) { 5538 if (modifiers.externalKeyword != null) {
5539 reportError8(ParserErrorCode.EXTERNAL_FIELD, modifiers.externalKeyword, [] ); 5539 reportError9(ParserErrorCode.EXTERNAL_FIELD, modifiers.externalKeyword, [] );
5540 } 5540 }
5541 if (modifiers.factoryKeyword != null) { 5541 if (modifiers.factoryKeyword != null) {
5542 reportError8(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKey word, []); 5542 reportError9(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKey word, []);
5543 } 5543 }
5544 Token staticKeyword = modifiers.staticKeyword; 5544 Token staticKeyword = modifiers.staticKeyword;
5545 Token constKeyword = modifiers.constKeyword; 5545 Token constKeyword = modifiers.constKeyword;
5546 Token finalKeyword = modifiers.finalKeyword; 5546 Token finalKeyword = modifiers.finalKeyword;
5547 Token varKeyword = modifiers.varKeyword; 5547 Token varKeyword = modifiers.varKeyword;
5548 if (constKeyword != null) { 5548 if (constKeyword != null) {
5549 if (finalKeyword != null) { 5549 if (finalKeyword != null) {
5550 reportError8(ParserErrorCode.CONST_AND_FINAL, finalKeyword, []); 5550 reportError9(ParserErrorCode.CONST_AND_FINAL, finalKeyword, []);
5551 } 5551 }
5552 if (varKeyword != null) { 5552 if (varKeyword != null) {
5553 reportError8(ParserErrorCode.CONST_AND_VAR, varKeyword, []); 5553 reportError9(ParserErrorCode.CONST_AND_VAR, varKeyword, []);
5554 } 5554 }
5555 if (staticKeyword != null && constKeyword.offset < staticKeyword.offset) { 5555 if (staticKeyword != null && constKeyword.offset < staticKeyword.offset) {
5556 reportError8(ParserErrorCode.STATIC_AFTER_CONST, staticKeyword, []); 5556 reportError9(ParserErrorCode.STATIC_AFTER_CONST, staticKeyword, []);
5557 } 5557 }
5558 } else if (finalKeyword != null) { 5558 } else if (finalKeyword != null) {
5559 if (varKeyword != null) { 5559 if (varKeyword != null) {
5560 reportError8(ParserErrorCode.FINAL_AND_VAR, varKeyword, []); 5560 reportError9(ParserErrorCode.FINAL_AND_VAR, varKeyword, []);
5561 } 5561 }
5562 if (staticKeyword != null && finalKeyword.offset < staticKeyword.offset) { 5562 if (staticKeyword != null && finalKeyword.offset < staticKeyword.offset) {
5563 reportError8(ParserErrorCode.STATIC_AFTER_FINAL, staticKeyword, []); 5563 reportError9(ParserErrorCode.STATIC_AFTER_FINAL, staticKeyword, []);
5564 } 5564 }
5565 } else if (varKeyword != null && staticKeyword != null && varKeyword.offset < staticKeyword.offset) { 5565 } else if (varKeyword != null && staticKeyword != null && varKeyword.offset < staticKeyword.offset) {
5566 reportError8(ParserErrorCode.STATIC_AFTER_VAR, staticKeyword, []); 5566 reportError9(ParserErrorCode.STATIC_AFTER_VAR, staticKeyword, []);
5567 } 5567 }
5568 return lexicallyFirst([constKeyword, finalKeyword, varKeyword]); 5568 return lexicallyFirst([constKeyword, finalKeyword, varKeyword]);
5569 } 5569 }
5570 5570
5571 /** 5571 /**
5572 * Validate that the given set of modifiers is appropriate for a local functio n. 5572 * Validate that the given set of modifiers is appropriate for a local functio n.
5573 * 5573 *
5574 * @param modifiers the modifiers being validated 5574 * @param modifiers the modifiers being validated
5575 */ 5575 */
5576 void validateModifiersForFunctionDeclarationStatement(Modifiers modifiers) { 5576 void validateModifiersForFunctionDeclarationStatement(Modifiers modifiers) {
5577 if (modifiers.abstractKeyword != null || modifiers.constKeyword != null || m odifiers.externalKeyword != null || modifiers.factoryKeyword != null || modifier s.finalKeyword != null || modifiers.staticKeyword != null || modifiers.varKeywor d != null) { 5577 if (modifiers.abstractKeyword != null || modifiers.constKeyword != null || m odifiers.externalKeyword != null || modifiers.factoryKeyword != null || modifier s.finalKeyword != null || modifiers.staticKeyword != null || modifiers.varKeywor d != null) {
5578 reportError7(ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER, []); 5578 reportError8(ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER, []);
5579 } 5579 }
5580 } 5580 }
5581 5581
5582 /** 5582 /**
5583 * Validate that the given set of modifiers is appropriate for a getter, sette r, or method. 5583 * Validate that the given set of modifiers is appropriate for a getter, sette r, or method.
5584 * 5584 *
5585 * @param modifiers the modifiers being validated 5585 * @param modifiers the modifiers being validated
5586 */ 5586 */
5587 void validateModifiersForGetterOrSetterOrMethod(Modifiers modifiers) { 5587 void validateModifiersForGetterOrSetterOrMethod(Modifiers modifiers) {
5588 if (modifiers.abstractKeyword != null) { 5588 if (modifiers.abstractKeyword != null) {
5589 reportError7(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []); 5589 reportError8(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
5590 } 5590 }
5591 if (modifiers.constKeyword != null) { 5591 if (modifiers.constKeyword != null) {
5592 reportError8(ParserErrorCode.CONST_METHOD, modifiers.constKeyword, []); 5592 reportError9(ParserErrorCode.CONST_METHOD, modifiers.constKeyword, []);
5593 } 5593 }
5594 if (modifiers.factoryKeyword != null) { 5594 if (modifiers.factoryKeyword != null) {
5595 reportError8(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKey word, []); 5595 reportError9(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKey word, []);
5596 } 5596 }
5597 if (modifiers.finalKeyword != null) { 5597 if (modifiers.finalKeyword != null) {
5598 reportError8(ParserErrorCode.FINAL_METHOD, modifiers.finalKeyword, []); 5598 reportError9(ParserErrorCode.FINAL_METHOD, modifiers.finalKeyword, []);
5599 } 5599 }
5600 if (modifiers.varKeyword != null) { 5600 if (modifiers.varKeyword != null) {
5601 reportError8(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []); 5601 reportError9(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []);
5602 } 5602 }
5603 Token externalKeyword = modifiers.externalKeyword; 5603 Token externalKeyword = modifiers.externalKeyword;
5604 Token staticKeyword = modifiers.staticKeyword; 5604 Token staticKeyword = modifiers.staticKeyword;
5605 if (externalKeyword != null && staticKeyword != null && staticKeyword.offset < externalKeyword.offset) { 5605 if (externalKeyword != null && staticKeyword != null && staticKeyword.offset < externalKeyword.offset) {
5606 reportError8(ParserErrorCode.EXTERNAL_AFTER_STATIC, externalKeyword, []); 5606 reportError9(ParserErrorCode.EXTERNAL_AFTER_STATIC, externalKeyword, []);
5607 } 5607 }
5608 } 5608 }
5609 5609
5610 /** 5610 /**
5611 * Validate that the given set of modifiers is appropriate for a getter, sette r, or method. 5611 * Validate that the given set of modifiers is appropriate for a getter, sette r, or method.
5612 * 5612 *
5613 * @param modifiers the modifiers being validated 5613 * @param modifiers the modifiers being validated
5614 */ 5614 */
5615 void validateModifiersForOperator(Modifiers modifiers) { 5615 void validateModifiersForOperator(Modifiers modifiers) {
5616 if (modifiers.abstractKeyword != null) { 5616 if (modifiers.abstractKeyword != null) {
5617 reportError7(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []); 5617 reportError8(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
5618 } 5618 }
5619 if (modifiers.constKeyword != null) { 5619 if (modifiers.constKeyword != null) {
5620 reportError8(ParserErrorCode.CONST_METHOD, modifiers.constKeyword, []); 5620 reportError9(ParserErrorCode.CONST_METHOD, modifiers.constKeyword, []);
5621 } 5621 }
5622 if (modifiers.factoryKeyword != null) { 5622 if (modifiers.factoryKeyword != null) {
5623 reportError8(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKey word, []); 5623 reportError9(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKey word, []);
5624 } 5624 }
5625 if (modifiers.finalKeyword != null) { 5625 if (modifiers.finalKeyword != null) {
5626 reportError8(ParserErrorCode.FINAL_METHOD, modifiers.finalKeyword, []); 5626 reportError9(ParserErrorCode.FINAL_METHOD, modifiers.finalKeyword, []);
5627 } 5627 }
5628 if (modifiers.staticKeyword != null) { 5628 if (modifiers.staticKeyword != null) {
5629 reportError8(ParserErrorCode.STATIC_OPERATOR, modifiers.staticKeyword, []) ; 5629 reportError9(ParserErrorCode.STATIC_OPERATOR, modifiers.staticKeyword, []) ;
5630 } 5630 }
5631 if (modifiers.varKeyword != null) { 5631 if (modifiers.varKeyword != null) {
5632 reportError8(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []); 5632 reportError9(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []);
5633 } 5633 }
5634 } 5634 }
5635 5635
5636 /** 5636 /**
5637 * Validate that the given set of modifiers is appropriate for a top-level dec laration. 5637 * Validate that the given set of modifiers is appropriate for a top-level dec laration.
5638 * 5638 *
5639 * @param modifiers the modifiers being validated 5639 * @param modifiers the modifiers being validated
5640 */ 5640 */
5641 void validateModifiersForTopLevelDeclaration(Modifiers modifiers) { 5641 void validateModifiersForTopLevelDeclaration(Modifiers modifiers) {
5642 if (modifiers.factoryKeyword != null) { 5642 if (modifiers.factoryKeyword != null) {
5643 reportError8(ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION, modifiers.fact oryKeyword, []); 5643 reportError9(ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION, modifiers.fact oryKeyword, []);
5644 } 5644 }
5645 if (modifiers.staticKeyword != null) { 5645 if (modifiers.staticKeyword != null) {
5646 reportError8(ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION, modifiers.stati cKeyword, []); 5646 reportError9(ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION, modifiers.stati cKeyword, []);
5647 } 5647 }
5648 } 5648 }
5649 5649
5650 /** 5650 /**
5651 * Validate that the given set of modifiers is appropriate for a top-level fun ction. 5651 * Validate that the given set of modifiers is appropriate for a top-level fun ction.
5652 * 5652 *
5653 * @param modifiers the modifiers being validated 5653 * @param modifiers the modifiers being validated
5654 */ 5654 */
5655 void validateModifiersForTopLevelFunction(Modifiers modifiers) { 5655 void validateModifiersForTopLevelFunction(Modifiers modifiers) {
5656 validateModifiersForTopLevelDeclaration(modifiers); 5656 validateModifiersForTopLevelDeclaration(modifiers);
5657 if (modifiers.abstractKeyword != null) { 5657 if (modifiers.abstractKeyword != null) {
5658 reportError7(ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION, []); 5658 reportError8(ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION, []);
5659 } 5659 }
5660 if (modifiers.constKeyword != null) { 5660 if (modifiers.constKeyword != null) {
5661 reportError8(ParserErrorCode.CONST_CLASS, modifiers.constKeyword, []); 5661 reportError9(ParserErrorCode.CONST_CLASS, modifiers.constKeyword, []);
5662 } 5662 }
5663 if (modifiers.finalKeyword != null) { 5663 if (modifiers.finalKeyword != null) {
5664 reportError8(ParserErrorCode.FINAL_CLASS, modifiers.finalKeyword, []); 5664 reportError9(ParserErrorCode.FINAL_CLASS, modifiers.finalKeyword, []);
5665 } 5665 }
5666 if (modifiers.varKeyword != null) { 5666 if (modifiers.varKeyword != null) {
5667 reportError8(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []); 5667 reportError9(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []);
5668 } 5668 }
5669 } 5669 }
5670 5670
5671 /** 5671 /**
5672 * Validate that the given set of modifiers is appropriate for a field and ret urn the 'final', 5672 * Validate that the given set of modifiers is appropriate for a field and ret urn the 'final',
5673 * 'const' or 'var' keyword if there is one. 5673 * 'const' or 'var' keyword if there is one.
5674 * 5674 *
5675 * @param modifiers the modifiers being validated 5675 * @param modifiers the modifiers being validated
5676 * @return the 'final', 'const' or 'var' keyword associated with the field 5676 * @return the 'final', 'const' or 'var' keyword associated with the field
5677 */ 5677 */
5678 Token validateModifiersForTopLevelVariable(Modifiers modifiers) { 5678 Token validateModifiersForTopLevelVariable(Modifiers modifiers) {
5679 validateModifiersForTopLevelDeclaration(modifiers); 5679 validateModifiersForTopLevelDeclaration(modifiers);
5680 if (modifiers.abstractKeyword != null) { 5680 if (modifiers.abstractKeyword != null) {
5681 reportError7(ParserErrorCode.ABSTRACT_TOP_LEVEL_VARIABLE, []); 5681 reportError8(ParserErrorCode.ABSTRACT_TOP_LEVEL_VARIABLE, []);
5682 } 5682 }
5683 if (modifiers.externalKeyword != null) { 5683 if (modifiers.externalKeyword != null) {
5684 reportError8(ParserErrorCode.EXTERNAL_FIELD, modifiers.externalKeyword, [] ); 5684 reportError9(ParserErrorCode.EXTERNAL_FIELD, modifiers.externalKeyword, [] );
5685 } 5685 }
5686 Token constKeyword = modifiers.constKeyword; 5686 Token constKeyword = modifiers.constKeyword;
5687 Token finalKeyword = modifiers.finalKeyword; 5687 Token finalKeyword = modifiers.finalKeyword;
5688 Token varKeyword = modifiers.varKeyword; 5688 Token varKeyword = modifiers.varKeyword;
5689 if (constKeyword != null) { 5689 if (constKeyword != null) {
5690 if (finalKeyword != null) { 5690 if (finalKeyword != null) {
5691 reportError8(ParserErrorCode.CONST_AND_FINAL, finalKeyword, []); 5691 reportError9(ParserErrorCode.CONST_AND_FINAL, finalKeyword, []);
5692 } 5692 }
5693 if (varKeyword != null) { 5693 if (varKeyword != null) {
5694 reportError8(ParserErrorCode.CONST_AND_VAR, varKeyword, []); 5694 reportError9(ParserErrorCode.CONST_AND_VAR, varKeyword, []);
5695 } 5695 }
5696 } else if (finalKeyword != null) { 5696 } else if (finalKeyword != null) {
5697 if (varKeyword != null) { 5697 if (varKeyword != null) {
5698 reportError8(ParserErrorCode.FINAL_AND_VAR, varKeyword, []); 5698 reportError9(ParserErrorCode.FINAL_AND_VAR, varKeyword, []);
5699 } 5699 }
5700 } 5700 }
5701 return lexicallyFirst([constKeyword, finalKeyword, varKeyword]); 5701 return lexicallyFirst([constKeyword, finalKeyword, varKeyword]);
5702 } 5702 }
5703 5703
5704 /** 5704 /**
5705 * Validate that the given set of modifiers is appropriate for a class and ret urn the 'abstract' 5705 * Validate that the given set of modifiers is appropriate for a class and ret urn the 'abstract'
5706 * keyword if there is one. 5706 * keyword if there is one.
5707 * 5707 *
5708 * @param modifiers the modifiers being validated 5708 * @param modifiers the modifiers being validated
5709 */ 5709 */
5710 void validateModifiersForTypedef(Modifiers modifiers) { 5710 void validateModifiersForTypedef(Modifiers modifiers) {
5711 validateModifiersForTopLevelDeclaration(modifiers); 5711 validateModifiersForTopLevelDeclaration(modifiers);
5712 if (modifiers.abstractKeyword != null) { 5712 if (modifiers.abstractKeyword != null) {
5713 reportError8(ParserErrorCode.ABSTRACT_TYPEDEF, modifiers.abstractKeyword, []); 5713 reportError9(ParserErrorCode.ABSTRACT_TYPEDEF, modifiers.abstractKeyword, []);
5714 } 5714 }
5715 if (modifiers.constKeyword != null) { 5715 if (modifiers.constKeyword != null) {
5716 reportError8(ParserErrorCode.CONST_TYPEDEF, modifiers.constKeyword, []); 5716 reportError9(ParserErrorCode.CONST_TYPEDEF, modifiers.constKeyword, []);
5717 } 5717 }
5718 if (modifiers.externalKeyword != null) { 5718 if (modifiers.externalKeyword != null) {
5719 reportError8(ParserErrorCode.EXTERNAL_TYPEDEF, modifiers.externalKeyword, []); 5719 reportError9(ParserErrorCode.EXTERNAL_TYPEDEF, modifiers.externalKeyword, []);
5720 } 5720 }
5721 if (modifiers.finalKeyword != null) { 5721 if (modifiers.finalKeyword != null) {
5722 reportError8(ParserErrorCode.FINAL_TYPEDEF, modifiers.finalKeyword, []); 5722 reportError9(ParserErrorCode.FINAL_TYPEDEF, modifiers.finalKeyword, []);
5723 } 5723 }
5724 if (modifiers.varKeyword != null) { 5724 if (modifiers.varKeyword != null) {
5725 reportError8(ParserErrorCode.VAR_TYPEDEF, modifiers.varKeyword, []); 5725 reportError9(ParserErrorCode.VAR_TYPEDEF, modifiers.varKeyword, []);
5726 } 5726 }
5727 } 5727 }
5728 } 5728 }
5729 class KeywordToken_12 extends KeywordToken { 5729 class KeywordToken_12 extends KeywordToken {
5730 KeywordToken_12(Keyword arg0, int arg1) : super(arg0, arg1); 5730 KeywordToken_12(Keyword arg0, int arg1) : super(arg0, arg1);
5731 int get length => 0; 5731 int get length => 0;
5732 } 5732 }
5733 class AnalysisErrorListener_13 implements AnalysisErrorListener { 5733 class AnalysisErrorListener_13 implements AnalysisErrorListener {
5734 List<bool> errorFound; 5734 List<bool> errorFound;
5735 AnalysisErrorListener_13(this.errorFound); 5735 AnalysisErrorListener_13(this.errorFound);
5736 void onError(AnalysisError error) { 5736 void onError(AnalysisError error) {
5737 errorFound[0] = true; 5737 errorFound[0] = true;
5738 } 5738 }
5739 } 5739 }
5740 /** 5740 /**
5741 * The enumeration `ParserErrorCode` defines the error codes used for errors det ected by the 5741 * The enumeration `ParserErrorCode` defines the error codes used for errors det ected by the
5742 * parser. The convention for this class is for the name of the error code to in dicate the problem 5742 * parser. The convention for this class is for the name of the error code to in dicate the problem
5743 * that caused the error to be generated and for the error message to explain wh at is wrong and, 5743 * that caused the error to be generated and for the error message to explain wh at is wrong and,
5744 * when appropriate, how the problem can be corrected. 5744 * when appropriate, how the problem can be corrected.
5745 * 5745 *
5746 * @coverage dart.engine.parser 5746 * @coverage dart.engine.parser
5747 */ 5747 */
5748 class ParserErrorCode implements Enum<ParserErrorCode>, ErrorCode { 5748 class ParserErrorCode extends Enum<ParserErrorCode> implements ErrorCode {
5749 static final ParserErrorCode ABSTRACT_CLASS_MEMBER = new ParserErrorCode.con2( 'ABSTRACT_CLASS_MEMBER', 0, "Members of classes cannot be declared to be 'abstra ct'"); 5749 static final ParserErrorCode ABSTRACT_CLASS_MEMBER = new ParserErrorCode.con3( 'ABSTRACT_CLASS_MEMBER', 0, "Members of classes cannot be declared to be 'abstra ct'");
5750 static final ParserErrorCode ABSTRACT_STATIC_METHOD = new ParserErrorCode.con2 ('ABSTRACT_STATIC_METHOD', 1, "Static methods cannot be declared to be 'abstract '"); 5750 static final ParserErrorCode ABSTRACT_STATIC_METHOD = new ParserErrorCode.con3 ('ABSTRACT_STATIC_METHOD', 1, "Static methods cannot be declared to be 'abstract '");
5751 static final ParserErrorCode ABSTRACT_TOP_LEVEL_FUNCTION = new ParserErrorCode .con2('ABSTRACT_TOP_LEVEL_FUNCTION', 2, "Top-level functions cannot be declared to be 'abstract'"); 5751 static final ParserErrorCode ABSTRACT_TOP_LEVEL_FUNCTION = new ParserErrorCode .con3('ABSTRACT_TOP_LEVEL_FUNCTION', 2, "Top-level functions cannot be declared to be 'abstract'");
5752 static final ParserErrorCode ABSTRACT_TOP_LEVEL_VARIABLE = new ParserErrorCode .con2('ABSTRACT_TOP_LEVEL_VARIABLE', 3, "Top-level variables cannot be declared to be 'abstract'"); 5752 static final ParserErrorCode ABSTRACT_TOP_LEVEL_VARIABLE = new ParserErrorCode .con3('ABSTRACT_TOP_LEVEL_VARIABLE', 3, "Top-level variables cannot be declared to be 'abstract'");
5753 static final ParserErrorCode ABSTRACT_TYPEDEF = new ParserErrorCode.con2('ABST RACT_TYPEDEF', 4, "Type aliases cannot be declared to be 'abstract'"); 5753 static final ParserErrorCode ABSTRACT_TYPEDEF = new ParserErrorCode.con3('ABST RACT_TYPEDEF', 4, "Type aliases cannot be declared to be 'abstract'");
5754 static final ParserErrorCode BREAK_OUTSIDE_OF_LOOP = new ParserErrorCode.con2( 'BREAK_OUTSIDE_OF_LOOP', 5, "A break statement cannot be used outside of a loop or switch statement"); 5754 static final ParserErrorCode BREAK_OUTSIDE_OF_LOOP = new ParserErrorCode.con3( 'BREAK_OUTSIDE_OF_LOOP', 5, "A break statement cannot be used outside of a loop or switch statement");
5755 static final ParserErrorCode CONST_AND_FINAL = new ParserErrorCode.con2('CONST _AND_FINAL', 6, "Members cannot be declared to be both 'const' and 'final'"); 5755 static final ParserErrorCode CONST_AND_FINAL = new ParserErrorCode.con3('CONST _AND_FINAL', 6, "Members cannot be declared to be both 'const' and 'final'");
5756 static final ParserErrorCode CONST_AND_VAR = new ParserErrorCode.con2('CONST_A ND_VAR', 7, "Members cannot be declared to be both 'const' and 'var'"); 5756 static final ParserErrorCode CONST_AND_VAR = new ParserErrorCode.con3('CONST_A ND_VAR', 7, "Members cannot be declared to be both 'const' and 'var'");
5757 static final ParserErrorCode CONST_CLASS = new ParserErrorCode.con2('CONST_CLA SS', 8, "Classes cannot be declared to be 'const'"); 5757 static final ParserErrorCode CONST_CLASS = new ParserErrorCode.con3('CONST_CLA SS', 8, "Classes cannot be declared to be 'const'");
5758 static final ParserErrorCode CONST_CONSTRUCTOR_WITH_BODY = new ParserErrorCode .con2('CONST_CONSTRUCTOR_WITH_BODY', 9, "'const' constructors cannot have a body "); 5758 static final ParserErrorCode CONST_CONSTRUCTOR_WITH_BODY = new ParserErrorCode .con3('CONST_CONSTRUCTOR_WITH_BODY', 9, "'const' constructors cannot have a body ");
5759 static final ParserErrorCode CONST_FACTORY = new ParserErrorCode.con2('CONST_F ACTORY', 10, "Only redirecting factory constructors can be declared to be 'const '"); 5759 static final ParserErrorCode CONST_FACTORY = new ParserErrorCode.con3('CONST_F ACTORY', 10, "Only redirecting factory constructors can be declared to be 'const '");
5760 static final ParserErrorCode CONST_METHOD = new ParserErrorCode.con2('CONST_ME THOD', 11, "Getters, setters and methods cannot be declared to be 'const'"); 5760 static final ParserErrorCode CONST_METHOD = new ParserErrorCode.con3('CONST_ME THOD', 11, "Getters, setters and methods cannot be declared to be 'const'");
5761 static final ParserErrorCode CONST_TYPEDEF = new ParserErrorCode.con2('CONST_T YPEDEF', 12, "Type aliases cannot be declared to be 'const'"); 5761 static final ParserErrorCode CONST_TYPEDEF = new ParserErrorCode.con3('CONST_T YPEDEF', 12, "Type aliases cannot be declared to be 'const'");
5762 static final ParserErrorCode CONSTRUCTOR_WITH_RETURN_TYPE = new ParserErrorCod e.con2('CONSTRUCTOR_WITH_RETURN_TYPE', 13, "Constructors cannot have a return ty pe"); 5762 static final ParserErrorCode CONSTRUCTOR_WITH_RETURN_TYPE = new ParserErrorCod e.con3('CONSTRUCTOR_WITH_RETURN_TYPE', 13, "Constructors cannot have a return ty pe");
5763 static final ParserErrorCode CONTINUE_OUTSIDE_OF_LOOP = new ParserErrorCode.co n2('CONTINUE_OUTSIDE_OF_LOOP', 14, "A continue statement cannot be used outside of a loop or switch statement"); 5763 static final ParserErrorCode CONTINUE_OUTSIDE_OF_LOOP = new ParserErrorCode.co n3('CONTINUE_OUTSIDE_OF_LOOP', 14, "A continue statement cannot be used outside of a loop or switch statement");
5764 static final ParserErrorCode CONTINUE_WITHOUT_LABEL_IN_CASE = new ParserErrorC ode.con2('CONTINUE_WITHOUT_LABEL_IN_CASE', 15, "A continue statement in a switch statement must have a label as a target"); 5764 static final ParserErrorCode CONTINUE_WITHOUT_LABEL_IN_CASE = new ParserErrorC ode.con3('CONTINUE_WITHOUT_LABEL_IN_CASE', 15, "A continue statement in a switch statement must have a label as a target");
5765 static final ParserErrorCode DEPRECATED_ARGUMENT_DEFINITION_TEST = new ParserE rrorCode.con2('DEPRECATED_ARGUMENT_DEFINITION_TEST', 16, "The argument definitio n test ('?' operator) has been deprecated"); 5765 static final ParserErrorCode DEPRECATED_ARGUMENT_DEFINITION_TEST = new ParserE rrorCode.con3('DEPRECATED_ARGUMENT_DEFINITION_TEST', 16, "The argument definitio n test ('?' operator) has been deprecated");
5766 static final ParserErrorCode DIRECTIVE_AFTER_DECLARATION = new ParserErrorCode .con2('DIRECTIVE_AFTER_DECLARATION', 17, "Directives must appear before any decl arations"); 5766 static final ParserErrorCode DIRECTIVE_AFTER_DECLARATION = new ParserErrorCode .con3('DIRECTIVE_AFTER_DECLARATION', 17, "Directives must appear before any decl arations");
5767 static final ParserErrorCode DUPLICATE_LABEL_IN_SWITCH_STATEMENT = new ParserE rrorCode.con2('DUPLICATE_LABEL_IN_SWITCH_STATEMENT', 18, "The label %s was alrea dy used in this switch statement"); 5767 static final ParserErrorCode DUPLICATE_LABEL_IN_SWITCH_STATEMENT = new ParserE rrorCode.con3('DUPLICATE_LABEL_IN_SWITCH_STATEMENT', 18, "The label %s was alrea dy used in this switch statement");
5768 static final ParserErrorCode DUPLICATED_MODIFIER = new ParserErrorCode.con2('D UPLICATED_MODIFIER', 19, "The modifier '%s' was already specified."); 5768 static final ParserErrorCode DUPLICATED_MODIFIER = new ParserErrorCode.con3('D UPLICATED_MODIFIER', 19, "The modifier '%s' was already specified.");
5769 static final ParserErrorCode EQUALITY_CANNOT_BE_EQUALITY_OPERAND = new ParserE rrorCode.con2('EQUALITY_CANNOT_BE_EQUALITY_OPERAND', 20, "Equality expression ca nnot be operand of another equality expression."); 5769 static final ParserErrorCode EQUALITY_CANNOT_BE_EQUALITY_OPERAND = new ParserE rrorCode.con3('EQUALITY_CANNOT_BE_EQUALITY_OPERAND', 20, "Equality expression ca nnot be operand of another equality expression.");
5770 static final ParserErrorCode EXPECTED_CASE_OR_DEFAULT = new ParserErrorCode.co n2('EXPECTED_CASE_OR_DEFAULT', 21, "Expected 'case' or 'default'"); 5770 static final ParserErrorCode EXPECTED_CASE_OR_DEFAULT = new ParserErrorCode.co n3('EXPECTED_CASE_OR_DEFAULT', 21, "Expected 'case' or 'default'");
5771 static final ParserErrorCode EXPECTED_CLASS_MEMBER = new ParserErrorCode.con2( 'EXPECTED_CLASS_MEMBER', 22, "Expected a class member"); 5771 static final ParserErrorCode EXPECTED_CLASS_MEMBER = new ParserErrorCode.con3( 'EXPECTED_CLASS_MEMBER', 22, "Expected a class member");
5772 static final ParserErrorCode EXPECTED_EXECUTABLE = new ParserErrorCode.con2('E XPECTED_EXECUTABLE', 23, "Expected a method, getter, setter or operator declarat ion"); 5772 static final ParserErrorCode EXPECTED_EXECUTABLE = new ParserErrorCode.con3('E XPECTED_EXECUTABLE', 23, "Expected a method, getter, setter or operator declarat ion");
5773 static final ParserErrorCode EXPECTED_LIST_OR_MAP_LITERAL = new ParserErrorCod e.con2('EXPECTED_LIST_OR_MAP_LITERAL', 24, "Expected a list or map literal"); 5773 static final ParserErrorCode EXPECTED_LIST_OR_MAP_LITERAL = new ParserErrorCod e.con3('EXPECTED_LIST_OR_MAP_LITERAL', 24, "Expected a list or map literal");
5774 static final ParserErrorCode EXPECTED_STRING_LITERAL = new ParserErrorCode.con 2('EXPECTED_STRING_LITERAL', 25, "Expected a string literal"); 5774 static final ParserErrorCode EXPECTED_STRING_LITERAL = new ParserErrorCode.con 3('EXPECTED_STRING_LITERAL', 25, "Expected a string literal");
5775 static final ParserErrorCode EXPECTED_TOKEN = new ParserErrorCode.con2('EXPECT ED_TOKEN', 26, "Expected to find '%s'"); 5775 static final ParserErrorCode EXPECTED_TOKEN = new ParserErrorCode.con3('EXPECT ED_TOKEN', 26, "Expected to find '%s'");
5776 static final ParserErrorCode EXPECTED_ONE_LIST_TYPE_ARGUMENTS = new ParserErro rCode.con2('EXPECTED_ONE_LIST_TYPE_ARGUMENTS', 27, "List literal requires exactl y one type arguments or none, but %d found"); 5776 static final ParserErrorCode EXPECTED_ONE_LIST_TYPE_ARGUMENTS = new ParserErro rCode.con3('EXPECTED_ONE_LIST_TYPE_ARGUMENTS', 27, "List literal requires exactl y one type arguments or none, but %d found");
5777 static final ParserErrorCode EXPECTED_TWO_MAP_TYPE_ARGUMENTS = new ParserError Code.con2('EXPECTED_TWO_MAP_TYPE_ARGUMENTS', 28, "Map literal requires exactly t wo type arguments or none, but %d found"); 5777 static final ParserErrorCode EXPECTED_TWO_MAP_TYPE_ARGUMENTS = new ParserError Code.con3('EXPECTED_TWO_MAP_TYPE_ARGUMENTS', 28, "Map literal requires exactly t wo type arguments or none, but %d found");
5778 static final ParserErrorCode EXPECTED_TYPE_NAME = new ParserErrorCode.con2('EX PECTED_TYPE_NAME', 29, "Expected a type name"); 5778 static final ParserErrorCode EXPECTED_TYPE_NAME = new ParserErrorCode.con3('EX PECTED_TYPE_NAME', 29, "Expected a type name");
5779 static final ParserErrorCode EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new Parse rErrorCode.con2('EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 30, "Export directives must preceed part directives"); 5779 static final ParserErrorCode EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new Parse rErrorCode.con3('EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 30, "Export directives must preceed part directives");
5780 static final ParserErrorCode EXTERNAL_AFTER_CONST = new ParserErrorCode.con2(' EXTERNAL_AFTER_CONST', 31, "The modifier 'external' should be before the modifie r 'const'"); 5780 static final ParserErrorCode EXTERNAL_AFTER_CONST = new ParserErrorCode.con3(' EXTERNAL_AFTER_CONST', 31, "The modifier 'external' should be before the modifie r 'const'");
5781 static final ParserErrorCode EXTERNAL_AFTER_FACTORY = new ParserErrorCode.con2 ('EXTERNAL_AFTER_FACTORY', 32, "The modifier 'external' should be before the mod ifier 'factory'"); 5781 static final ParserErrorCode EXTERNAL_AFTER_FACTORY = new ParserErrorCode.con3 ('EXTERNAL_AFTER_FACTORY', 32, "The modifier 'external' should be before the mod ifier 'factory'");
5782 static final ParserErrorCode EXTERNAL_AFTER_STATIC = new ParserErrorCode.con2( 'EXTERNAL_AFTER_STATIC', 33, "The modifier 'external' should be before the modif ier 'static'"); 5782 static final ParserErrorCode EXTERNAL_AFTER_STATIC = new ParserErrorCode.con3( 'EXTERNAL_AFTER_STATIC', 33, "The modifier 'external' should be before the modif ier 'static'");
5783 static final ParserErrorCode EXTERNAL_CLASS = new ParserErrorCode.con2('EXTERN AL_CLASS', 34, "Classes cannot be declared to be 'external'"); 5783 static final ParserErrorCode EXTERNAL_CLASS = new ParserErrorCode.con3('EXTERN AL_CLASS', 34, "Classes cannot be declared to be 'external'");
5784 static final ParserErrorCode EXTERNAL_CONSTRUCTOR_WITH_BODY = new ParserErrorC ode.con2('EXTERNAL_CONSTRUCTOR_WITH_BODY', 35, "External constructors cannot hav e a body"); 5784 static final ParserErrorCode EXTERNAL_CONSTRUCTOR_WITH_BODY = new ParserErrorC ode.con3('EXTERNAL_CONSTRUCTOR_WITH_BODY', 35, "External constructors cannot hav e a body");
5785 static final ParserErrorCode EXTERNAL_FIELD = new ParserErrorCode.con2('EXTERN AL_FIELD', 36, "Fields cannot be declared to be 'external'"); 5785 static final ParserErrorCode EXTERNAL_FIELD = new ParserErrorCode.con3('EXTERN AL_FIELD', 36, "Fields cannot be declared to be 'external'");
5786 static final ParserErrorCode EXTERNAL_GETTER_WITH_BODY = new ParserErrorCode.c on2('EXTERNAL_GETTER_WITH_BODY', 37, "External getters cannot have a body"); 5786 static final ParserErrorCode EXTERNAL_GETTER_WITH_BODY = new ParserErrorCode.c on3('EXTERNAL_GETTER_WITH_BODY', 37, "External getters cannot have a body");
5787 static final ParserErrorCode EXTERNAL_METHOD_WITH_BODY = new ParserErrorCode.c on2('EXTERNAL_METHOD_WITH_BODY', 38, "External methods cannot have a body"); 5787 static final ParserErrorCode EXTERNAL_METHOD_WITH_BODY = new ParserErrorCode.c on3('EXTERNAL_METHOD_WITH_BODY', 38, "External methods cannot have a body");
5788 static final ParserErrorCode EXTERNAL_OPERATOR_WITH_BODY = new ParserErrorCode .con2('EXTERNAL_OPERATOR_WITH_BODY', 39, "External operators cannot have a body" ); 5788 static final ParserErrorCode EXTERNAL_OPERATOR_WITH_BODY = new ParserErrorCode .con3('EXTERNAL_OPERATOR_WITH_BODY', 39, "External operators cannot have a body" );
5789 static final ParserErrorCode EXTERNAL_SETTER_WITH_BODY = new ParserErrorCode.c on2('EXTERNAL_SETTER_WITH_BODY', 40, "External setters cannot have a body"); 5789 static final ParserErrorCode EXTERNAL_SETTER_WITH_BODY = new ParserErrorCode.c on3('EXTERNAL_SETTER_WITH_BODY', 40, "External setters cannot have a body");
5790 static final ParserErrorCode EXTERNAL_TYPEDEF = new ParserErrorCode.con2('EXTE RNAL_TYPEDEF', 41, "Type aliases cannot be declared to be 'external'"); 5790 static final ParserErrorCode EXTERNAL_TYPEDEF = new ParserErrorCode.con3('EXTE RNAL_TYPEDEF', 41, "Type aliases cannot be declared to be 'external'");
5791 static final ParserErrorCode FACTORY_TOP_LEVEL_DECLARATION = new ParserErrorCo de.con2('FACTORY_TOP_LEVEL_DECLARATION', 42, "Top-level declarations cannot be d eclared to be 'factory'"); 5791 static final ParserErrorCode FACTORY_TOP_LEVEL_DECLARATION = new ParserErrorCo de.con3('FACTORY_TOP_LEVEL_DECLARATION', 42, "Top-level declarations cannot be d eclared to be 'factory'");
5792 static final ParserErrorCode FACTORY_WITHOUT_BODY = new ParserErrorCode.con2(' FACTORY_WITHOUT_BODY', 43, "A non-redirecting 'factory' constructor must have a body"); 5792 static final ParserErrorCode FACTORY_WITHOUT_BODY = new ParserErrorCode.con3(' FACTORY_WITHOUT_BODY', 43, "A non-redirecting 'factory' constructor must have a body");
5793 static final ParserErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new Parse rErrorCode.con2('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 44, "Field initializers can only be used in a constructor"); 5793 static final ParserErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new Parse rErrorCode.con3('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 44, "Field initializers can only be used in a constructor");
5794 static final ParserErrorCode FINAL_AND_VAR = new ParserErrorCode.con2('FINAL_A ND_VAR', 45, "Members cannot be declared to be both 'final' and 'var'"); 5794 static final ParserErrorCode FINAL_AND_VAR = new ParserErrorCode.con3('FINAL_A ND_VAR', 45, "Members cannot be declared to be both 'final' and 'var'");
5795 static final ParserErrorCode FINAL_CLASS = new ParserErrorCode.con2('FINAL_CLA SS', 46, "Classes cannot be declared to be 'final'"); 5795 static final ParserErrorCode FINAL_CLASS = new ParserErrorCode.con3('FINAL_CLA SS', 46, "Classes cannot be declared to be 'final'");
5796 static final ParserErrorCode FINAL_CONSTRUCTOR = new ParserErrorCode.con2('FIN AL_CONSTRUCTOR', 47, "A constructor cannot be declared to be 'final'"); 5796 static final ParserErrorCode FINAL_CONSTRUCTOR = new ParserErrorCode.con3('FIN AL_CONSTRUCTOR', 47, "A constructor cannot be declared to be 'final'");
5797 static final ParserErrorCode FINAL_METHOD = new ParserErrorCode.con2('FINAL_ME THOD', 48, "Getters, setters and methods cannot be declared to be 'final'"); 5797 static final ParserErrorCode FINAL_METHOD = new ParserErrorCode.con3('FINAL_ME THOD', 48, "Getters, setters and methods cannot be declared to be 'final'");
5798 static final ParserErrorCode FINAL_TYPEDEF = new ParserErrorCode.con2('FINAL_T YPEDEF', 49, "Type aliases cannot be declared to be 'final'"); 5798 static final ParserErrorCode FINAL_TYPEDEF = new ParserErrorCode.con3('FINAL_T YPEDEF', 49, "Type aliases cannot be declared to be 'final'");
5799 static final ParserErrorCode FUNCTION_TYPED_PARAMETER_VAR = new ParserErrorCod e.con2('FUNCTION_TYPED_PARAMETER_VAR', 50, "Function typed parameters cannot spe cify 'const', 'final' or 'var' instead of return type"); 5799 static final ParserErrorCode FUNCTION_TYPED_PARAMETER_VAR = new ParserErrorCod e.con3('FUNCTION_TYPED_PARAMETER_VAR', 50, "Function typed parameters cannot spe cify 'const', 'final' or 'var' instead of return type");
5800 static final ParserErrorCode GETTER_WITH_PARAMETERS = new ParserErrorCode.con2 ('GETTER_WITH_PARAMETERS', 51, "Getter should be declared without a parameter li st"); 5800 static final ParserErrorCode GETTER_WITH_PARAMETERS = new ParserErrorCode.con3 ('GETTER_WITH_PARAMETERS', 51, "Getter should be declared without a parameter li st");
5801 static final ParserErrorCode ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE = new Parser ErrorCode.con2('ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE', 52, "Illegal assignment t o non-assignable expression"); 5801 static final ParserErrorCode ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE = new Parser ErrorCode.con3('ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE', 52, "Illegal assignment t o non-assignable expression");
5802 static final ParserErrorCode IMPLEMENTS_BEFORE_EXTENDS = new ParserErrorCode.c on2('IMPLEMENTS_BEFORE_EXTENDS', 53, "The extends clause must be before the impl ements clause"); 5802 static final ParserErrorCode IMPLEMENTS_BEFORE_EXTENDS = new ParserErrorCode.c on3('IMPLEMENTS_BEFORE_EXTENDS', 53, "The extends clause must be before the impl ements clause");
5803 static final ParserErrorCode IMPLEMENTS_BEFORE_WITH = new ParserErrorCode.con2 ('IMPLEMENTS_BEFORE_WITH', 54, "The with clause must be before the implements cl ause"); 5803 static final ParserErrorCode IMPLEMENTS_BEFORE_WITH = new ParserErrorCode.con3 ('IMPLEMENTS_BEFORE_WITH', 54, "The with clause must be before the implements cl ause");
5804 static final ParserErrorCode IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new Parse rErrorCode.con2('IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 55, "Import directives must preceed part directives"); 5804 static final ParserErrorCode IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new Parse rErrorCode.con3('IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 55, "Import directives must preceed part directives");
5805 static final ParserErrorCode INITIALIZED_VARIABLE_IN_FOR_EACH = new ParserErro rCode.con2('INITIALIZED_VARIABLE_IN_FOR_EACH', 56, "The loop variable in a for-e ach loop cannot be initialized"); 5805 static final ParserErrorCode INITIALIZED_VARIABLE_IN_FOR_EACH = new ParserErro rCode.con3('INITIALIZED_VARIABLE_IN_FOR_EACH', 56, "The loop variable in a for-e ach loop cannot be initialized");
5806 static final ParserErrorCode INVALID_CODE_POINT = new ParserErrorCode.con2('IN VALID_CODE_POINT', 57, "The escape sequence '%s' is not a valid code point"); 5806 static final ParserErrorCode INVALID_CODE_POINT = new ParserErrorCode.con3('IN VALID_CODE_POINT', 57, "The escape sequence '%s' is not a valid code point");
5807 static final ParserErrorCode INVALID_COMMENT_REFERENCE = new ParserErrorCode.c on2('INVALID_COMMENT_REFERENCE', 58, "Comment references should contain a possib ly prefixed identifier and can start with 'new', but should not contain anything else"); 5807 static final ParserErrorCode INVALID_COMMENT_REFERENCE = new ParserErrorCode.c on3('INVALID_COMMENT_REFERENCE', 58, "Comment references should contain a possib ly prefixed identifier and can start with 'new', but should not contain anything else");
5808 static final ParserErrorCode INVALID_HEX_ESCAPE = new ParserErrorCode.con2('IN VALID_HEX_ESCAPE', 59, "An escape sequence starting with '\\x' must be followed by 2 hexidecimal digits"); 5808 static final ParserErrorCode INVALID_HEX_ESCAPE = new ParserErrorCode.con3('IN VALID_HEX_ESCAPE', 59, "An escape sequence starting with '\\x' must be followed by 2 hexidecimal digits");
5809 static final ParserErrorCode INVALID_OPERATOR = new ParserErrorCode.con2('INVA LID_OPERATOR', 60, "The string '%s' is not a valid operator"); 5809 static final ParserErrorCode INVALID_OPERATOR = new ParserErrorCode.con3('INVA LID_OPERATOR', 60, "The string '%s' is not a valid operator");
5810 static final ParserErrorCode INVALID_OPERATOR_FOR_SUPER = new ParserErrorCode. con2('INVALID_OPERATOR_FOR_SUPER', 61, "The operator '%s' cannot be used with 's uper'"); 5810 static final ParserErrorCode INVALID_OPERATOR_FOR_SUPER = new ParserErrorCode. con3('INVALID_OPERATOR_FOR_SUPER', 61, "The operator '%s' cannot be used with 's uper'");
5811 static final ParserErrorCode INVALID_UNICODE_ESCAPE = new ParserErrorCode.con2 ('INVALID_UNICODE_ESCAPE', 62, "An escape sequence starting with '\\u' must be f ollowed by 4 hexidecimal digits or from 1 to 6 digits between '{' and '}'"); 5811 static final ParserErrorCode INVALID_UNICODE_ESCAPE = new ParserErrorCode.con3 ('INVALID_UNICODE_ESCAPE', 62, "An escape sequence starting with '\\u' must be f ollowed by 4 hexidecimal digits or from 1 to 6 digits between '{' and '}'");
5812 static final ParserErrorCode LIBRARY_DIRECTIVE_NOT_FIRST = new ParserErrorCode .con2('LIBRARY_DIRECTIVE_NOT_FIRST', 63, "The library directive must appear befo re all other directives"); 5812 static final ParserErrorCode LIBRARY_DIRECTIVE_NOT_FIRST = new ParserErrorCode .con3('LIBRARY_DIRECTIVE_NOT_FIRST', 63, "The library directive must appear befo re all other directives");
5813 static final ParserErrorCode LOCAL_FUNCTION_DECLARATION_MODIFIER = new ParserE rrorCode.con2('LOCAL_FUNCTION_DECLARATION_MODIFIER', 64, "Local function declara tions cannot specify any modifier"); 5813 static final ParserErrorCode LOCAL_FUNCTION_DECLARATION_MODIFIER = new ParserE rrorCode.con3('LOCAL_FUNCTION_DECLARATION_MODIFIER', 64, "Local function declara tions cannot specify any modifier");
5814 static final ParserErrorCode MISSING_ASSIGNABLE_SELECTOR = new ParserErrorCode .con2('MISSING_ASSIGNABLE_SELECTOR', 65, "Missing selector such as \".<identifie r>\" or \"[0]\""); 5814 static final ParserErrorCode MISSING_ASSIGNABLE_SELECTOR = new ParserErrorCode .con3('MISSING_ASSIGNABLE_SELECTOR', 65, "Missing selector such as \".<identifie r>\" or \"[0]\"");
5815 static final ParserErrorCode MISSING_CATCH_OR_FINALLY = new ParserErrorCode.co n2('MISSING_CATCH_OR_FINALLY', 66, "A try statement must have either a catch or finally clause"); 5815 static final ParserErrorCode MISSING_CATCH_OR_FINALLY = new ParserErrorCode.co n3('MISSING_CATCH_OR_FINALLY', 66, "A try statement must have either a catch or finally clause");
5816 static final ParserErrorCode MISSING_CLASS_BODY = new ParserErrorCode.con2('MI SSING_CLASS_BODY', 67, "A class definition must have a body, even if it is empty "); 5816 static final ParserErrorCode MISSING_CLASS_BODY = new ParserErrorCode.con3('MI SSING_CLASS_BODY', 67, "A class definition must have a body, even if it is empty ");
5817 static final ParserErrorCode MISSING_CLOSING_PARENTHESIS = new ParserErrorCode .con2('MISSING_CLOSING_PARENTHESIS', 68, "The closing parenthesis is missing"); 5817 static final ParserErrorCode MISSING_CLOSING_PARENTHESIS = new ParserErrorCode .con3('MISSING_CLOSING_PARENTHESIS', 68, "The closing parenthesis is missing");
5818 static final ParserErrorCode MISSING_CONST_FINAL_VAR_OR_TYPE = new ParserError Code.con2('MISSING_CONST_FINAL_VAR_OR_TYPE', 69, "Variables must be declared usi ng the keywords 'const', 'final', 'var' or a type name"); 5818 static final ParserErrorCode MISSING_CONST_FINAL_VAR_OR_TYPE = new ParserError Code.con3('MISSING_CONST_FINAL_VAR_OR_TYPE', 69, "Variables must be declared usi ng the keywords 'const', 'final', 'var' or a type name");
5819 static final ParserErrorCode MISSING_EXPRESSION_IN_THROW = new ParserErrorCode .con2('MISSING_EXPRESSION_IN_THROW', 70, "Throw expressions must compute the obj ect to be thrown"); 5819 static final ParserErrorCode MISSING_EXPRESSION_IN_THROW = new ParserErrorCode .con3('MISSING_EXPRESSION_IN_THROW', 70, "Throw expressions must compute the obj ect to be thrown");
5820 static final ParserErrorCode MISSING_FUNCTION_BODY = new ParserErrorCode.con2( 'MISSING_FUNCTION_BODY', 71, "A function body must be provided"); 5820 static final ParserErrorCode MISSING_FUNCTION_BODY = new ParserErrorCode.con3( 'MISSING_FUNCTION_BODY', 71, "A function body must be provided");
5821 static final ParserErrorCode MISSING_FUNCTION_PARAMETERS = new ParserErrorCode .con2('MISSING_FUNCTION_PARAMETERS', 72, "Functions must have an explicit list o f parameters"); 5821 static final ParserErrorCode MISSING_FUNCTION_PARAMETERS = new ParserErrorCode .con3('MISSING_FUNCTION_PARAMETERS', 72, "Functions must have an explicit list o f parameters");
5822 static final ParserErrorCode MISSING_IDENTIFIER = new ParserErrorCode.con2('MI SSING_IDENTIFIER', 73, "Expected an identifier"); 5822 static final ParserErrorCode MISSING_IDENTIFIER = new ParserErrorCode.con3('MI SSING_IDENTIFIER', 73, "Expected an identifier");
5823 static final ParserErrorCode MISSING_KEYWORD_OPERATOR = new ParserErrorCode.co n2('MISSING_KEYWORD_OPERATOR', 74, "Operator declarations must be preceeded by t he keyword 'operator'"); 5823 static final ParserErrorCode MISSING_KEYWORD_OPERATOR = new ParserErrorCode.co n3('MISSING_KEYWORD_OPERATOR', 74, "Operator declarations must be preceeded by t he keyword 'operator'");
5824 static final ParserErrorCode MISSING_NAME_IN_LIBRARY_DIRECTIVE = new ParserErr orCode.con2('MISSING_NAME_IN_LIBRARY_DIRECTIVE', 75, "Library directives must in clude a library name"); 5824 static final ParserErrorCode MISSING_NAME_IN_LIBRARY_DIRECTIVE = new ParserErr orCode.con3('MISSING_NAME_IN_LIBRARY_DIRECTIVE', 75, "Library directives must in clude a library name");
5825 static final ParserErrorCode MISSING_NAME_IN_PART_OF_DIRECTIVE = new ParserErr orCode.con2('MISSING_NAME_IN_PART_OF_DIRECTIVE', 76, "Library directives must in clude a library name"); 5825 static final ParserErrorCode MISSING_NAME_IN_PART_OF_DIRECTIVE = new ParserErr orCode.con3('MISSING_NAME_IN_PART_OF_DIRECTIVE', 76, "Library directives must in clude a library name");
5826 static final ParserErrorCode MISSING_STATEMENT = new ParserErrorCode.con2('MIS SING_STATEMENT', 77, "Expected a statement"); 5826 static final ParserErrorCode MISSING_STATEMENT = new ParserErrorCode.con3('MIS SING_STATEMENT', 77, "Expected a statement");
5827 static final ParserErrorCode MISSING_TERMINATOR_FOR_PARAMETER_GROUP = new Pars erErrorCode.con2('MISSING_TERMINATOR_FOR_PARAMETER_GROUP', 78, "There is no '%s' to close the parameter group"); 5827 static final ParserErrorCode MISSING_TERMINATOR_FOR_PARAMETER_GROUP = new Pars erErrorCode.con3('MISSING_TERMINATOR_FOR_PARAMETER_GROUP', 78, "There is no '%s' to close the parameter group");
5828 static final ParserErrorCode MISSING_TYPEDEF_PARAMETERS = new ParserErrorCode. con2('MISSING_TYPEDEF_PARAMETERS', 79, "Type aliases for functions must have an explicit list of parameters"); 5828 static final ParserErrorCode MISSING_TYPEDEF_PARAMETERS = new ParserErrorCode. con3('MISSING_TYPEDEF_PARAMETERS', 79, "Type aliases for functions must have an explicit list of parameters");
5829 static final ParserErrorCode MISSING_VARIABLE_IN_FOR_EACH = new ParserErrorCod e.con2('MISSING_VARIABLE_IN_FOR_EACH', 80, "A loop variable must be declared in a for-each loop before the 'in', but none were found"); 5829 static final ParserErrorCode MISSING_VARIABLE_IN_FOR_EACH = new ParserErrorCod e.con3('MISSING_VARIABLE_IN_FOR_EACH', 80, "A loop variable must be declared in a for-each loop before the 'in', but none were found");
5830 static final ParserErrorCode MIXED_PARAMETER_GROUPS = new ParserErrorCode.con2 ('MIXED_PARAMETER_GROUPS', 81, "Cannot have both positional and named parameters in a single parameter list"); 5830 static final ParserErrorCode MIXED_PARAMETER_GROUPS = new ParserErrorCode.con3 ('MIXED_PARAMETER_GROUPS', 81, "Cannot have both positional and named parameters in a single parameter list");
5831 static final ParserErrorCode MULTIPLE_EXTENDS_CLAUSES = new ParserErrorCode.co n2('MULTIPLE_EXTENDS_CLAUSES', 82, "Each class definition can have at most one e xtends clause"); 5831 static final ParserErrorCode MULTIPLE_EXTENDS_CLAUSES = new ParserErrorCode.co n3('MULTIPLE_EXTENDS_CLAUSES', 82, "Each class definition can have at most one e xtends clause");
5832 static final ParserErrorCode MULTIPLE_IMPLEMENTS_CLAUSES = new ParserErrorCode .con2('MULTIPLE_IMPLEMENTS_CLAUSES', 83, "Each class definition can have at most one implements clause"); 5832 static final ParserErrorCode MULTIPLE_IMPLEMENTS_CLAUSES = new ParserErrorCode .con3('MULTIPLE_IMPLEMENTS_CLAUSES', 83, "Each class definition can have at most one implements clause");
5833 static final ParserErrorCode MULTIPLE_LIBRARY_DIRECTIVES = new ParserErrorCode .con2('MULTIPLE_LIBRARY_DIRECTIVES', 84, "Only one library directive may be decl ared in a file"); 5833 static final ParserErrorCode MULTIPLE_LIBRARY_DIRECTIVES = new ParserErrorCode .con3('MULTIPLE_LIBRARY_DIRECTIVES', 84, "Only one library directive may be decl ared in a file");
5834 static final ParserErrorCode MULTIPLE_NAMED_PARAMETER_GROUPS = new ParserError Code.con2('MULTIPLE_NAMED_PARAMETER_GROUPS', 85, "Cannot have multiple groups of named parameters in a single parameter list"); 5834 static final ParserErrorCode MULTIPLE_NAMED_PARAMETER_GROUPS = new ParserError Code.con3('MULTIPLE_NAMED_PARAMETER_GROUPS', 85, "Cannot have multiple groups of named parameters in a single parameter list");
5835 static final ParserErrorCode MULTIPLE_PART_OF_DIRECTIVES = new ParserErrorCode .con2('MULTIPLE_PART_OF_DIRECTIVES', 86, "Only one part-of directive may be decl ared in a file"); 5835 static final ParserErrorCode MULTIPLE_PART_OF_DIRECTIVES = new ParserErrorCode .con3('MULTIPLE_PART_OF_DIRECTIVES', 86, "Only one part-of directive may be decl ared in a file");
5836 static final ParserErrorCode MULTIPLE_POSITIONAL_PARAMETER_GROUPS = new Parser ErrorCode.con2('MULTIPLE_POSITIONAL_PARAMETER_GROUPS', 87, "Cannot have multiple groups of positional parameters in a single parameter list"); 5836 static final ParserErrorCode MULTIPLE_POSITIONAL_PARAMETER_GROUPS = new Parser ErrorCode.con3('MULTIPLE_POSITIONAL_PARAMETER_GROUPS', 87, "Cannot have multiple groups of positional parameters in a single parameter list");
5837 static final ParserErrorCode MULTIPLE_VARIABLES_IN_FOR_EACH = new ParserErrorC ode.con2('MULTIPLE_VARIABLES_IN_FOR_EACH', 88, "A single loop variable must be d eclared in a for-each loop before the 'in', but %s were found"); 5837 static final ParserErrorCode MULTIPLE_VARIABLES_IN_FOR_EACH = new ParserErrorC ode.con3('MULTIPLE_VARIABLES_IN_FOR_EACH', 88, "A single loop variable must be d eclared in a for-each loop before the 'in', but %s were found");
5838 static final ParserErrorCode MULTIPLE_WITH_CLAUSES = new ParserErrorCode.con2( 'MULTIPLE_WITH_CLAUSES', 89, "Each class definition can have at most one with cl ause"); 5838 static final ParserErrorCode MULTIPLE_WITH_CLAUSES = new ParserErrorCode.con3( 'MULTIPLE_WITH_CLAUSES', 89, "Each class definition can have at most one with cl ause");
5839 static final ParserErrorCode NAMED_FUNCTION_EXPRESSION = new ParserErrorCode.c on2('NAMED_FUNCTION_EXPRESSION', 90, "Function expressions cannot be named"); 5839 static final ParserErrorCode NAMED_FUNCTION_EXPRESSION = new ParserErrorCode.c on3('NAMED_FUNCTION_EXPRESSION', 90, "Function expressions cannot be named");
5840 static final ParserErrorCode NAMED_PARAMETER_OUTSIDE_GROUP = new ParserErrorCo de.con2('NAMED_PARAMETER_OUTSIDE_GROUP', 91, "Named parameters must be enclosed in curly braces ('{' and '}')"); 5840 static final ParserErrorCode NAMED_PARAMETER_OUTSIDE_GROUP = new ParserErrorCo de.con3('NAMED_PARAMETER_OUTSIDE_GROUP', 91, "Named parameters must be enclosed in curly braces ('{' and '}')");
5841 static final ParserErrorCode NATIVE_CLAUSE_IN_NON_SDK_CODE = new ParserErrorCo de.con2('NATIVE_CLAUSE_IN_NON_SDK_CODE', 92, "Native clause can only be used in the SDK and code that is loaded through native extensions"); 5841 static final ParserErrorCode NATIVE_CLAUSE_IN_NON_SDK_CODE = new ParserErrorCo de.con3('NATIVE_CLAUSE_IN_NON_SDK_CODE', 92, "Native clause can only be used in the SDK and code that is loaded through native extensions");
5842 static final ParserErrorCode NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE = new Parser ErrorCode.con2('NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE', 93, "Native functions can only be declared in the SDK and code that is loaded through native extensions") ; 5842 static final ParserErrorCode NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE = new Parser ErrorCode.con3('NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE', 93, "Native functions can only be declared in the SDK and code that is loaded through native extensions") ;
5843 static final ParserErrorCode NON_CONSTRUCTOR_FACTORY = new ParserErrorCode.con 2('NON_CONSTRUCTOR_FACTORY', 94, "Only constructors can be declared to be a 'fac tory'"); 5843 static final ParserErrorCode NON_CONSTRUCTOR_FACTORY = new ParserErrorCode.con 3('NON_CONSTRUCTOR_FACTORY', 94, "Only constructors can be declared to be a 'fac tory'");
5844 static final ParserErrorCode NON_IDENTIFIER_LIBRARY_NAME = new ParserErrorCode .con2('NON_IDENTIFIER_LIBRARY_NAME', 95, "The name of a library must be an ident ifier"); 5844 static final ParserErrorCode NON_IDENTIFIER_LIBRARY_NAME = new ParserErrorCode .con3('NON_IDENTIFIER_LIBRARY_NAME', 95, "The name of a library must be an ident ifier");
5845 static final ParserErrorCode NON_PART_OF_DIRECTIVE_IN_PART = new ParserErrorCo de.con2('NON_PART_OF_DIRECTIVE_IN_PART', 96, "The part-of directive must be the only directive in a part"); 5845 static final ParserErrorCode NON_PART_OF_DIRECTIVE_IN_PART = new ParserErrorCo de.con3('NON_PART_OF_DIRECTIVE_IN_PART', 96, "The part-of directive must be the only directive in a part");
5846 static final ParserErrorCode NON_USER_DEFINABLE_OPERATOR = new ParserErrorCode .con2('NON_USER_DEFINABLE_OPERATOR', 97, "The operator '%s' is not user definabl e"); 5846 static final ParserErrorCode NON_USER_DEFINABLE_OPERATOR = new ParserErrorCode .con3('NON_USER_DEFINABLE_OPERATOR', 97, "The operator '%s' is not user definabl e");
5847 static final ParserErrorCode NORMAL_BEFORE_OPTIONAL_PARAMETERS = new ParserErr orCode.con2('NORMAL_BEFORE_OPTIONAL_PARAMETERS', 98, "Normal parameters must occ ur before optional parameters"); 5847 static final ParserErrorCode NORMAL_BEFORE_OPTIONAL_PARAMETERS = new ParserErr orCode.con3('NORMAL_BEFORE_OPTIONAL_PARAMETERS', 98, "Normal parameters must occ ur before optional parameters");
5848 static final ParserErrorCode POSITIONAL_AFTER_NAMED_ARGUMENT = new ParserError Code.con2('POSITIONAL_AFTER_NAMED_ARGUMENT', 99, "Positional arguments must occu r before named arguments"); 5848 static final ParserErrorCode POSITIONAL_AFTER_NAMED_ARGUMENT = new ParserError Code.con3('POSITIONAL_AFTER_NAMED_ARGUMENT', 99, "Positional arguments must occu r before named arguments");
5849 static final ParserErrorCode POSITIONAL_PARAMETER_OUTSIDE_GROUP = new ParserEr rorCode.con2('POSITIONAL_PARAMETER_OUTSIDE_GROUP', 100, "Positional parameters m ust be enclosed in square brackets ('[' and ']')"); 5849 static final ParserErrorCode POSITIONAL_PARAMETER_OUTSIDE_GROUP = new ParserEr rorCode.con3('POSITIONAL_PARAMETER_OUTSIDE_GROUP', 100, "Positional parameters m ust be enclosed in square brackets ('[' and ']')");
5850 static final ParserErrorCode REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR = new Pars erErrorCode.con2('REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR', 101, "Only factory co nstructor can specify '=' redirection."); 5850 static final ParserErrorCode REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR = new Pars erErrorCode.con3('REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR', 101, "Only factory co nstructor can specify '=' redirection.");
5851 static final ParserErrorCode STATIC_AFTER_CONST = new ParserErrorCode.con2('ST ATIC_AFTER_CONST', 102, "The modifier 'static' should be before the modifier 'co nst'"); 5851 static final ParserErrorCode STATIC_AFTER_CONST = new ParserErrorCode.con3('ST ATIC_AFTER_CONST', 102, "The modifier 'static' should be before the modifier 'co nst'");
5852 static final ParserErrorCode STATIC_AFTER_FINAL = new ParserErrorCode.con2('ST ATIC_AFTER_FINAL', 103, "The modifier 'static' should be before the modifier 'fi nal'"); 5852 static final ParserErrorCode STATIC_AFTER_FINAL = new ParserErrorCode.con3('ST ATIC_AFTER_FINAL', 103, "The modifier 'static' should be before the modifier 'fi nal'");
5853 static final ParserErrorCode STATIC_AFTER_VAR = new ParserErrorCode.con2('STAT IC_AFTER_VAR', 104, "The modifier 'static' should be before the modifier 'var'") ; 5853 static final ParserErrorCode STATIC_AFTER_VAR = new ParserErrorCode.con3('STAT IC_AFTER_VAR', 104, "The modifier 'static' should be before the modifier 'var'") ;
5854 static final ParserErrorCode STATIC_CONSTRUCTOR = new ParserErrorCode.con2('ST ATIC_CONSTRUCTOR', 105, "Constructors cannot be static"); 5854 static final ParserErrorCode STATIC_CONSTRUCTOR = new ParserErrorCode.con3('ST ATIC_CONSTRUCTOR', 105, "Constructors cannot be static");
5855 static final ParserErrorCode STATIC_GETTER_WITHOUT_BODY = new ParserErrorCode. con2('STATIC_GETTER_WITHOUT_BODY', 106, "A 'static' getter must have a body"); 5855 static final ParserErrorCode STATIC_GETTER_WITHOUT_BODY = new ParserErrorCode. con3('STATIC_GETTER_WITHOUT_BODY', 106, "A 'static' getter must have a body");
5856 static final ParserErrorCode STATIC_OPERATOR = new ParserErrorCode.con2('STATI C_OPERATOR', 107, "Operators cannot be static"); 5856 static final ParserErrorCode STATIC_OPERATOR = new ParserErrorCode.con3('STATI C_OPERATOR', 107, "Operators cannot be static");
5857 static final ParserErrorCode STATIC_SETTER_WITHOUT_BODY = new ParserErrorCode. con2('STATIC_SETTER_WITHOUT_BODY', 108, "A 'static' setter must have a body"); 5857 static final ParserErrorCode STATIC_SETTER_WITHOUT_BODY = new ParserErrorCode. con3('STATIC_SETTER_WITHOUT_BODY', 108, "A 'static' setter must have a body");
5858 static final ParserErrorCode STATIC_TOP_LEVEL_DECLARATION = new ParserErrorCod e.con2('STATIC_TOP_LEVEL_DECLARATION', 109, "Top-level declarations cannot be de clared to be 'static'"); 5858 static final ParserErrorCode STATIC_TOP_LEVEL_DECLARATION = new ParserErrorCod e.con3('STATIC_TOP_LEVEL_DECLARATION', 109, "Top-level declarations cannot be de clared to be 'static'");
5859 static final ParserErrorCode SWITCH_HAS_CASE_AFTER_DEFAULT_CASE = new ParserEr rorCode.con2('SWITCH_HAS_CASE_AFTER_DEFAULT_CASE', 110, "The 'default' case shou ld be the last case in a switch statement"); 5859 static final ParserErrorCode SWITCH_HAS_CASE_AFTER_DEFAULT_CASE = new ParserEr rorCode.con3('SWITCH_HAS_CASE_AFTER_DEFAULT_CASE', 110, "The 'default' case shou ld be the last case in a switch statement");
5860 static final ParserErrorCode SWITCH_HAS_MULTIPLE_DEFAULT_CASES = new ParserErr orCode.con2('SWITCH_HAS_MULTIPLE_DEFAULT_CASES', 111, "The 'default' case can on ly be declared once"); 5860 static final ParserErrorCode SWITCH_HAS_MULTIPLE_DEFAULT_CASES = new ParserErr orCode.con3('SWITCH_HAS_MULTIPLE_DEFAULT_CASES', 111, "The 'default' case can on ly be declared once");
5861 static final ParserErrorCode TOP_LEVEL_OPERATOR = new ParserErrorCode.con2('TO P_LEVEL_OPERATOR', 112, "Operators must be declared within a class"); 5861 static final ParserErrorCode TOP_LEVEL_OPERATOR = new ParserErrorCode.con3('TO P_LEVEL_OPERATOR', 112, "Operators must be declared within a class");
5862 static final ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP = new P arserErrorCode.con2('UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP', 113, "There is no '%s' to open a parameter group"); 5862 static final ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP = new P arserErrorCode.con3('UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP', 113, "There is no '%s' to open a parameter group");
5863 static final ParserErrorCode UNEXPECTED_TOKEN = new ParserErrorCode.con2('UNEX PECTED_TOKEN', 114, "Unexpected token '%s'"); 5863 static final ParserErrorCode UNEXPECTED_TOKEN = new ParserErrorCode.con3('UNEX PECTED_TOKEN', 114, "Unexpected token '%s'");
5864 static final ParserErrorCode WITH_BEFORE_EXTENDS = new ParserErrorCode.con2('W ITH_BEFORE_EXTENDS', 115, "The extends clause must be before the with clause"); 5864 static final ParserErrorCode WITH_BEFORE_EXTENDS = new ParserErrorCode.con3('W ITH_BEFORE_EXTENDS', 115, "The extends clause must be before the with clause");
5865 static final ParserErrorCode WITH_WITHOUT_EXTENDS = new ParserErrorCode.con2(' WITH_WITHOUT_EXTENDS', 116, "The with clause cannot be used without an extends c lause"); 5865 static final ParserErrorCode WITH_WITHOUT_EXTENDS = new ParserErrorCode.con3(' WITH_WITHOUT_EXTENDS', 116, "The with clause cannot be used without an extends c lause");
5866 static final ParserErrorCode WRONG_SEPARATOR_FOR_NAMED_PARAMETER = new ParserE rrorCode.con2('WRONG_SEPARATOR_FOR_NAMED_PARAMETER', 117, "The default value of a named parameter should be preceeded by ':'"); 5866 static final ParserErrorCode WRONG_SEPARATOR_FOR_NAMED_PARAMETER = new ParserE rrorCode.con3('WRONG_SEPARATOR_FOR_NAMED_PARAMETER', 117, "The default value of a named parameter should be preceeded by ':'");
5867 static final ParserErrorCode WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER = new Pa rserErrorCode.con2('WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER', 118, "The default value of a positional parameter should be preceeded by '='"); 5867 static final ParserErrorCode WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER = new Pa rserErrorCode.con3('WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER', 118, "The default value of a positional parameter should be preceeded by '='");
5868 static final ParserErrorCode WRONG_TERMINATOR_FOR_PARAMETER_GROUP = new Parser ErrorCode.con2('WRONG_TERMINATOR_FOR_PARAMETER_GROUP', 119, "Expected '%s' to cl ose parameter group"); 5868 static final ParserErrorCode WRONG_TERMINATOR_FOR_PARAMETER_GROUP = new Parser ErrorCode.con3('WRONG_TERMINATOR_FOR_PARAMETER_GROUP', 119, "Expected '%s' to cl ose parameter group");
5869 static final ParserErrorCode VAR_AND_TYPE = new ParserErrorCode.con2('VAR_AND_ TYPE', 120, "Variables cannot be declared using both 'var' and a type name; remo ve the 'var'"); 5869 static final ParserErrorCode VAR_AND_TYPE = new ParserErrorCode.con3('VAR_AND_ TYPE', 120, "Variables cannot be declared using both 'var' and a type name; remo ve the 'var'");
5870 static final ParserErrorCode VAR_AS_TYPE_NAME = new ParserErrorCode.con2('VAR_ AS_TYPE_NAME', 121, "The keyword 'var' cannot be used as a type name"); 5870 static final ParserErrorCode VAR_AS_TYPE_NAME = new ParserErrorCode.con3('VAR_ AS_TYPE_NAME', 121, "The keyword 'var' cannot be used as a type name");
5871 static final ParserErrorCode VAR_CLASS = new ParserErrorCode.con2('VAR_CLASS', 122, "Classes cannot be declared to be 'var'"); 5871 static final ParserErrorCode VAR_CLASS = new ParserErrorCode.con3('VAR_CLASS', 122, "Classes cannot be declared to be 'var'");
5872 static final ParserErrorCode VAR_RETURN_TYPE = new ParserErrorCode.con2('VAR_R ETURN_TYPE', 123, "The return type cannot be 'var'"); 5872 static final ParserErrorCode VAR_RETURN_TYPE = new ParserErrorCode.con3('VAR_R ETURN_TYPE', 123, "The return type cannot be 'var'");
5873 static final ParserErrorCode VAR_TYPEDEF = new ParserErrorCode.con2('VAR_TYPED EF', 124, "Type aliases cannot be declared to be 'var'"); 5873 static final ParserErrorCode VAR_TYPEDEF = new ParserErrorCode.con3('VAR_TYPED EF', 124, "Type aliases cannot be declared to be 'var'");
5874 static final ParserErrorCode VOID_PARAMETER = new ParserErrorCode.con2('VOID_P ARAMETER', 125, "Parameters cannot have a type of 'void'"); 5874 static final ParserErrorCode VOID_PARAMETER = new ParserErrorCode.con3('VOID_P ARAMETER', 125, "Parameters cannot have a type of 'void'");
5875 static final ParserErrorCode VOID_VARIABLE = new ParserErrorCode.con2('VOID_VA RIABLE', 126, "Variables cannot have a type of 'void'"); 5875 static final ParserErrorCode VOID_VARIABLE = new ParserErrorCode.con3('VOID_VA RIABLE', 126, "Variables cannot have a type of 'void'");
5876 static final List<ParserErrorCode> values = [ 5876 static final List<ParserErrorCode> values = [
5877 ABSTRACT_CLASS_MEMBER, 5877 ABSTRACT_CLASS_MEMBER,
5878 ABSTRACT_STATIC_METHOD, 5878 ABSTRACT_STATIC_METHOD,
5879 ABSTRACT_TOP_LEVEL_FUNCTION, 5879 ABSTRACT_TOP_LEVEL_FUNCTION,
5880 ABSTRACT_TOP_LEVEL_VARIABLE, 5880 ABSTRACT_TOP_LEVEL_VARIABLE,
5881 ABSTRACT_TYPEDEF, 5881 ABSTRACT_TYPEDEF,
5882 BREAK_OUTSIDE_OF_LOOP, 5882 BREAK_OUTSIDE_OF_LOOP,
5883 CONST_AND_FINAL, 5883 CONST_AND_FINAL,
5884 CONST_AND_VAR, 5884 CONST_AND_VAR,
5885 CONST_CLASS, 5885 CONST_CLASS,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
5995 WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER, 5995 WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER,
5996 WRONG_TERMINATOR_FOR_PARAMETER_GROUP, 5996 WRONG_TERMINATOR_FOR_PARAMETER_GROUP,
5997 VAR_AND_TYPE, 5997 VAR_AND_TYPE,
5998 VAR_AS_TYPE_NAME, 5998 VAR_AS_TYPE_NAME,
5999 VAR_CLASS, 5999 VAR_CLASS,
6000 VAR_RETURN_TYPE, 6000 VAR_RETURN_TYPE,
6001 VAR_TYPEDEF, 6001 VAR_TYPEDEF,
6002 VOID_PARAMETER, 6002 VOID_PARAMETER,
6003 VOID_VARIABLE]; 6003 VOID_VARIABLE];
6004 6004
6005 /// The name of this enum constant, as declared in the enum declaration.
6006 final String name;
6007
6008 /// The position in the enum declaration.
6009 final int ordinal;
6010
6011 /** 6005 /**
6012 * The severity of this error. 6006 * The severity of this error.
6013 */ 6007 */
6014 ErrorSeverity _severity; 6008 ErrorSeverity _severity;
6015 6009
6016 /** 6010 /**
6017 * The message template used to create the message to be displayed for this er ror. 6011 * The template used to create the message to be displayed for this error.
6018 */ 6012 */
6019 String _message; 6013 String _message;
6020 6014
6021 /** 6015 /**
6016 * The template used to create the correction to be displayed for this error, or `null` if
6017 * there is no correction information for this error.
6018 */
6019 String correction8;
6020
6021 /**
6022 * Initialize a newly created error code to have the given severity and messag e. 6022 * Initialize a newly created error code to have the given severity and messag e.
6023 * 6023 *
6024 * @param severity the severity of the error 6024 * @param severity the severity of the error
6025 * @param message the message template used to create the message to be displa yed for the error 6025 * @param message the message template used to create the message to be displa yed for the error
6026 */ 6026 */
6027 ParserErrorCode.con1(this.name, this.ordinal, ErrorSeverity severity, String m essage) { 6027 ParserErrorCode.con1(String name, int ordinal, ErrorSeverity severity, String message) : super(name, ordinal) {
6028 this._severity = severity; 6028 this._severity = severity;
6029 this._message = message; 6029 this._message = message;
6030 } 6030 }
6031 6031
6032 /** 6032 /**
6033 * Initialize a newly created error code to have the given severity, message a nd correction.
6034 *
6035 * @param severity the severity of the error
6036 * @param message the template used to create the message to be displayed for the error
6037 * @param correction the template used to create the correction to be displaye d for the error
6038 */
6039 ParserErrorCode.con2(String name, int ordinal, ErrorSeverity severity, String message, String correction) : super(name, ordinal) {
6040 this._severity = severity;
6041 this._message = message;
6042 this.correction8 = correction;
6043 }
6044
6045 /**
6033 * Initialize a newly created error code to have the given message and a sever ity of ERROR. 6046 * Initialize a newly created error code to have the given message and a sever ity of ERROR.
6034 * 6047 *
6035 * @param message the message template used to create the message to be displa yed for the error 6048 * @param message the message template used to create the message to be displa yed for the error
6036 */ 6049 */
6037 ParserErrorCode.con2(String name, int ordinal, String message) : this.con1(nam e, ordinal, ErrorSeverity.ERROR, message); 6050 ParserErrorCode.con3(String name, int ordinal, String message) : this.con1(nam e, ordinal, ErrorSeverity.ERROR, message);
6051 String get correction => correction8;
6038 ErrorSeverity get errorSeverity => _severity; 6052 ErrorSeverity get errorSeverity => _severity;
6039 String get message => _message; 6053 String get message => _message;
6040 ErrorType get type => ErrorType.SYNTACTIC_ERROR; 6054 ErrorType get type => ErrorType.SYNTACTIC_ERROR;
6041 int compareTo(ParserErrorCode other) => ordinal - other.ordinal;
6042 int get hashCode => ordinal;
6043 String toString() => name;
6044 } 6055 }
6045 /** 6056 /**
6046 * Instances of the class {link ToFormattedSourceVisitor} write a source represe ntation of a visited 6057 * Instances of the class {link ToFormattedSourceVisitor} write a source represe ntation of a visited
6047 * AST node (and all of it's children) to a writer. 6058 * AST node (and all of it's children) to a writer.
6048 */ 6059 */
6049 class ToFormattedSourceVisitor implements ASTVisitor<Object> { 6060 class ToFormattedSourceVisitor implements ASTVisitor<Object> {
6050 6061
6051 /** 6062 /**
6052 * The writer to which the source is to be written. 6063 * The writer to which the source is to be written.
6053 */ 6064 */
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
6980 if ("\n" == separator) { 6991 if ("\n" == separator) {
6981 _writer.print("\n"); 6992 _writer.print("\n");
6982 indent(); 6993 indent();
6983 } else if (i > 0) { 6994 } else if (i > 0) {
6984 _writer.print(separator); 6995 _writer.print(separator);
6985 } 6996 }
6986 _writer.print(tokens[i].lexeme); 6997 _writer.print(tokens[i].lexeme);
6987 } 6998 }
6988 } 6999 }
6989 } 7000 }
OLDNEW
« no previous file with comments | « pkg/analyzer_experimental/lib/src/generated/java_core.dart ('k') | pkg/analyzer_experimental/lib/src/generated/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698