| OLD | NEW |
| 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 'java_engine.dart'; | 6 import 'java_engine.dart'; |
| 7 import 'instrumentation.dart'; | 7 import 'instrumentation.dart'; |
| 8 import 'error.dart'; | 8 import 'error.dart'; |
| 9 import 'source.dart'; | 9 import 'source.dart'; |
| 10 import 'scanner.dart'; | 10 import 'scanner.dart'; |
| 11 import 'ast.dart'; | 11 import 'ast.dart'; |
| 12 import 'utilities_dart.dart'; | 12 import 'utilities_dart.dart'; |
| 13 /** | 13 /** |
| 14 * Instances of the class {@code CommentAndMetadata} implement a simple data-hol
der for a method | 14 * Instances of the class `CommentAndMetadata` implement a simple data-holder fo
r a method |
| 15 * that needs to return multiple values. | 15 * that needs to return multiple values. |
| 16 * @coverage dart.engine.parser | 16 * @coverage dart.engine.parser |
| 17 */ | 17 */ |
| 18 class CommentAndMetadata { | 18 class CommentAndMetadata { |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * The documentation comment that was parsed, or {@code null} if none was give
n. | 21 * The documentation comment that was parsed, or `null` if none was given. |
| 22 */ | 22 */ |
| 23 Comment _comment; | 23 Comment _comment; |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * The metadata that was parsed. | 26 * The metadata that was parsed. |
| 27 */ | 27 */ |
| 28 List<Annotation> _metadata; | 28 List<Annotation> _metadata; |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * Initialize a newly created holder with the given data. | 31 * Initialize a newly created holder with the given data. |
| 32 * @param comment the documentation comment that was parsed | 32 * @param comment the documentation comment that was parsed |
| 33 * @param metadata the metadata that was parsed | 33 * @param metadata the metadata that was parsed |
| 34 */ | 34 */ |
| 35 CommentAndMetadata(Comment comment, List<Annotation> metadata) { | 35 CommentAndMetadata(Comment comment, List<Annotation> metadata) { |
| 36 this._comment = comment; | 36 this._comment = comment; |
| 37 this._metadata = metadata; | 37 this._metadata = metadata; |
| 38 } | 38 } |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * Return the documentation comment that was parsed, or {@code null} if none w
as given. | 41 * Return the documentation comment that was parsed, or `null` if none was giv
en. |
| 42 * @return the documentation comment that was parsed | 42 * @return the documentation comment that was parsed |
| 43 */ | 43 */ |
| 44 Comment get comment => _comment; | 44 Comment get comment => _comment; |
| 45 | 45 |
| 46 /** | 46 /** |
| 47 * Return the metadata that was parsed. If there was no metadata, then the lis
t will be empty. | 47 * Return the metadata that was parsed. If there was no metadata, then the lis
t will be empty. |
| 48 * @return the metadata that was parsed | 48 * @return the metadata that was parsed |
| 49 */ | 49 */ |
| 50 List<Annotation> get metadata => _metadata; | 50 List<Annotation> get metadata => _metadata; |
| 51 } | 51 } |
| 52 /** | 52 /** |
| 53 * Instances of the class {@code FinalConstVarOrType} implement a simple data-ho
lder for a method | 53 * Instances of the class `FinalConstVarOrType` implement a simple data-holder f
or a method |
| 54 * that needs to return multiple values. | 54 * that needs to return multiple values. |
| 55 * @coverage dart.engine.parser | 55 * @coverage dart.engine.parser |
| 56 */ | 56 */ |
| 57 class FinalConstVarOrType { | 57 class FinalConstVarOrType { |
| 58 | 58 |
| 59 /** | 59 /** |
| 60 * The 'final', 'const' or 'var' keyword, or {@code null} if none was given. | 60 * The 'final', 'const' or 'var' keyword, or `null` if none was given. |
| 61 */ | 61 */ |
| 62 Token _keyword; | 62 Token _keyword; |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * The type, of {@code null} if no type was specified. | 65 * The type, of `null` if no type was specified. |
| 66 */ | 66 */ |
| 67 TypeName _type; | 67 TypeName _type; |
| 68 | 68 |
| 69 /** | 69 /** |
| 70 * Initialize a newly created holder with the given data. | 70 * Initialize a newly created holder with the given data. |
| 71 * @param keyword the 'final', 'const' or 'var' keyword | 71 * @param keyword the 'final', 'const' or 'var' keyword |
| 72 * @param type the type | 72 * @param type the type |
| 73 */ | 73 */ |
| 74 FinalConstVarOrType(Token keyword, TypeName type) { | 74 FinalConstVarOrType(Token keyword, TypeName type) { |
| 75 this._keyword = keyword; | 75 this._keyword = keyword; |
| 76 this._type = type; | 76 this._type = type; |
| 77 } | 77 } |
| 78 | 78 |
| 79 /** | 79 /** |
| 80 * Return the 'final', 'const' or 'var' keyword, or {@code null} if none was g
iven. | 80 * Return the 'final', 'const' or 'var' keyword, or `null` if none was given. |
| 81 * @return the 'final', 'const' or 'var' keyword | 81 * @return the 'final', 'const' or 'var' keyword |
| 82 */ | 82 */ |
| 83 Token get keyword => _keyword; | 83 Token get keyword => _keyword; |
| 84 | 84 |
| 85 /** | 85 /** |
| 86 * Return the type, of {@code null} if no type was specified. | 86 * Return the type, of `null` if no type was specified. |
| 87 * @return the type | 87 * @return the type |
| 88 */ | 88 */ |
| 89 TypeName get type => _type; | 89 TypeName get type => _type; |
| 90 } | 90 } |
| 91 /** | 91 /** |
| 92 * Instances of the class {@code Modifiers} implement a simple data-holder for a
method that needs | 92 * Instances of the class `Modifiers` implement a simple data-holder for a metho
d that needs |
| 93 * to return multiple values. | 93 * to return multiple values. |
| 94 * @coverage dart.engine.parser | 94 * @coverage dart.engine.parser |
| 95 */ | 95 */ |
| 96 class Modifiers { | 96 class Modifiers { |
| 97 | 97 |
| 98 /** | 98 /** |
| 99 * The token representing the keyword 'abstract', or {@code null} if the keywo
rd was not found. | 99 * The token representing the keyword 'abstract', or `null` if the keyword was
not found. |
| 100 */ | 100 */ |
| 101 Token _abstractKeyword; | 101 Token _abstractKeyword; |
| 102 | 102 |
| 103 /** | 103 /** |
| 104 * The token representing the keyword 'const', or {@code null} if the keyword
was not found. | 104 * The token representing the keyword 'const', or `null` if the keyword was no
t found. |
| 105 */ | 105 */ |
| 106 Token _constKeyword; | 106 Token _constKeyword; |
| 107 | 107 |
| 108 /** | 108 /** |
| 109 * The token representing the keyword 'external', or {@code null} if the keywo
rd was not found. | 109 * The token representing the keyword 'external', or `null` if the keyword was
not found. |
| 110 */ | 110 */ |
| 111 Token _externalKeyword; | 111 Token _externalKeyword; |
| 112 | 112 |
| 113 /** | 113 /** |
| 114 * The token representing the keyword 'factory', or {@code null} if the keywor
d was not found. | 114 * The token representing the keyword 'factory', or `null` if the keyword was
not found. |
| 115 */ | 115 */ |
| 116 Token _factoryKeyword; | 116 Token _factoryKeyword; |
| 117 | 117 |
| 118 /** | 118 /** |
| 119 * The token representing the keyword 'final', or {@code null} if the keyword
was not found. | 119 * The token representing the keyword 'final', or `null` if the keyword was no
t found. |
| 120 */ | 120 */ |
| 121 Token _finalKeyword; | 121 Token _finalKeyword; |
| 122 | 122 |
| 123 /** | 123 /** |
| 124 * The token representing the keyword 'static', or {@code null} if the keyword
was not found. | 124 * The token representing the keyword 'static', or `null` if the keyword was n
ot found. |
| 125 */ | 125 */ |
| 126 Token _staticKeyword; | 126 Token _staticKeyword; |
| 127 | 127 |
| 128 /** | 128 /** |
| 129 * The token representing the keyword 'var', or {@code null} if the keyword wa
s not found. | 129 * The token representing the keyword 'var', or `null` if the keyword was not
found. |
| 130 */ | 130 */ |
| 131 Token _varKeyword; | 131 Token _varKeyword; |
| 132 | 132 |
| 133 /** | 133 /** |
| 134 * Return the token representing the keyword 'abstract', or {@code null} if th
e keyword was not | 134 * Return the token representing the keyword 'abstract', or `null` if the keyw
ord was not |
| 135 * found. | 135 * found. |
| 136 * @return the token representing the keyword 'abstract' | 136 * @return the token representing the keyword 'abstract' |
| 137 */ | 137 */ |
| 138 Token get abstractKeyword => _abstractKeyword; | 138 Token get abstractKeyword => _abstractKeyword; |
| 139 | 139 |
| 140 /** | 140 /** |
| 141 * Return the token representing the keyword 'const', or {@code null} if the k
eyword was not | 141 * Return the token representing the keyword 'const', or `null` if the keyword
was not |
| 142 * found. | 142 * found. |
| 143 * @return the token representing the keyword 'const' | 143 * @return the token representing the keyword 'const' |
| 144 */ | 144 */ |
| 145 Token get constKeyword => _constKeyword; | 145 Token get constKeyword => _constKeyword; |
| 146 | 146 |
| 147 /** | 147 /** |
| 148 * Return the token representing the keyword 'external', or {@code null} if th
e keyword was not | 148 * Return the token representing the keyword 'external', or `null` if the keyw
ord was not |
| 149 * found. | 149 * found. |
| 150 * @return the token representing the keyword 'external' | 150 * @return the token representing the keyword 'external' |
| 151 */ | 151 */ |
| 152 Token get externalKeyword => _externalKeyword; | 152 Token get externalKeyword => _externalKeyword; |
| 153 | 153 |
| 154 /** | 154 /** |
| 155 * Return the token representing the keyword 'factory', or {@code null} if the
keyword was not | 155 * Return the token representing the keyword 'factory', or `null` if the keywo
rd was not |
| 156 * found. | 156 * found. |
| 157 * @return the token representing the keyword 'factory' | 157 * @return the token representing the keyword 'factory' |
| 158 */ | 158 */ |
| 159 Token get factoryKeyword => _factoryKeyword; | 159 Token get factoryKeyword => _factoryKeyword; |
| 160 | 160 |
| 161 /** | 161 /** |
| 162 * Return the token representing the keyword 'final', or {@code null} if the k
eyword was not | 162 * Return the token representing the keyword 'final', or `null` if the keyword
was not |
| 163 * found. | 163 * found. |
| 164 * @return the token representing the keyword 'final' | 164 * @return the token representing the keyword 'final' |
| 165 */ | 165 */ |
| 166 Token get finalKeyword => _finalKeyword; | 166 Token get finalKeyword => _finalKeyword; |
| 167 | 167 |
| 168 /** | 168 /** |
| 169 * Return the token representing the keyword 'static', or {@code null} if the
keyword was not | 169 * Return the token representing the keyword 'static', or `null` if the keywor
d was not |
| 170 * found. | 170 * found. |
| 171 * @return the token representing the keyword 'static' | 171 * @return the token representing the keyword 'static' |
| 172 */ | 172 */ |
| 173 Token get staticKeyword => _staticKeyword; | 173 Token get staticKeyword => _staticKeyword; |
| 174 | 174 |
| 175 /** | 175 /** |
| 176 * Return the token representing the keyword 'var', or {@code null} if the key
word was not found. | 176 * Return the token representing the keyword 'var', or `null` if the keyword w
as not found. |
| 177 * @return the token representing the keyword 'var' | 177 * @return the token representing the keyword 'var' |
| 178 */ | 178 */ |
| 179 Token get varKeyword => _varKeyword; | 179 Token get varKeyword => _varKeyword; |
| 180 | 180 |
| 181 /** | 181 /** |
| 182 * Set the token representing the keyword 'abstract' to the given token. | 182 * Set the token representing the keyword 'abstract' to the given token. |
| 183 * @param abstractKeyword the token representing the keyword 'abstract' | 183 * @param abstractKeyword the token representing the keyword 'abstract' |
| 184 */ | 184 */ |
| 185 void set abstractKeyword(Token abstractKeyword2) { | 185 void set abstractKeyword(Token abstractKeyword2) { |
| 186 this._abstractKeyword = abstractKeyword2; | 186 this._abstractKeyword = abstractKeyword2; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 needsSpace = appendKeyword(builder, needsSpace, _constKeyword); | 239 needsSpace = appendKeyword(builder, needsSpace, _constKeyword); |
| 240 needsSpace = appendKeyword(builder, needsSpace, _externalKeyword); | 240 needsSpace = appendKeyword(builder, needsSpace, _externalKeyword); |
| 241 needsSpace = appendKeyword(builder, needsSpace, _factoryKeyword); | 241 needsSpace = appendKeyword(builder, needsSpace, _factoryKeyword); |
| 242 needsSpace = appendKeyword(builder, needsSpace, _finalKeyword); | 242 needsSpace = appendKeyword(builder, needsSpace, _finalKeyword); |
| 243 needsSpace = appendKeyword(builder, needsSpace, _staticKeyword); | 243 needsSpace = appendKeyword(builder, needsSpace, _staticKeyword); |
| 244 appendKeyword(builder, needsSpace, _varKeyword); | 244 appendKeyword(builder, needsSpace, _varKeyword); |
| 245 return builder.toString(); | 245 return builder.toString(); |
| 246 } | 246 } |
| 247 | 247 |
| 248 /** | 248 /** |
| 249 * If the given keyword is not {@code null}, append it to the given builder, p
refixing it with a | 249 * If the given keyword is not `null`, append it to the given builder, prefixi
ng it with a |
| 250 * space if needed. | 250 * space if needed. |
| 251 * @param builder the builder to which the keyword will be appended | 251 * @param builder the builder to which the keyword will be appended |
| 252 * @param needsSpace {@code true} if the keyword needs to be prefixed with a s
pace | 252 * @param needsSpace `true` if the keyword needs to be prefixed with a space |
| 253 * @param keyword the keyword to be appended | 253 * @param keyword the keyword to be appended |
| 254 * @return {@code true} if subsequent keywords need to be prefixed with a spac
e | 254 * @return `true` if subsequent keywords need to be prefixed with a space |
| 255 */ | 255 */ |
| 256 bool appendKeyword(JavaStringBuilder builder, bool needsSpace, Token keyword)
{ | 256 bool appendKeyword(JavaStringBuilder builder, bool needsSpace, Token keyword)
{ |
| 257 if (keyword != null) { | 257 if (keyword != null) { |
| 258 if (needsSpace) { | 258 if (needsSpace) { |
| 259 builder.appendChar(0x20); | 259 builder.appendChar(0x20); |
| 260 } | 260 } |
| 261 builder.append(keyword.lexeme); | 261 builder.append(keyword.lexeme); |
| 262 return true; | 262 return true; |
| 263 } | 263 } |
| 264 return needsSpace; | 264 return needsSpace; |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 /** | 267 /** |
| 268 * Instances of the class {@code Parser} are used to parse tokens into an AST st
ructure. | 268 * Instances of the class `Parser` are used to parse tokens into an AST structur
e. |
| 269 * @coverage dart.engine.parser | 269 * @coverage dart.engine.parser |
| 270 */ | 270 */ |
| 271 class Parser { | 271 class Parser { |
| 272 | 272 |
| 273 /** | 273 /** |
| 274 * The source being parsed. | 274 * The source being parsed. |
| 275 */ | 275 */ |
| 276 Source _source; | 276 Source _source; |
| 277 | 277 |
| 278 /** | 278 /** |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 _currentToken = token; | 322 _currentToken = token; |
| 323 return parseCompilationUnit2(); | 323 return parseCompilationUnit2(); |
| 324 } finally { | 324 } finally { |
| 325 instrumentation.log(); | 325 instrumentation.log(); |
| 326 } | 326 } |
| 327 } | 327 } |
| 328 | 328 |
| 329 /** | 329 /** |
| 330 * Parse an expression, starting with the given token. | 330 * Parse an expression, starting with the given token. |
| 331 * @param token the first token of the expression | 331 * @param token the first token of the expression |
| 332 * @return the expression that was parsed, or {@code null} if the tokens do no
t represent a | 332 * @return the expression that was parsed, or `null` if the tokens do not repr
esent a |
| 333 * recognizable expression | 333 * recognizable expression |
| 334 */ | 334 */ |
| 335 Expression parseExpression(Token token) { | 335 Expression parseExpression(Token token) { |
| 336 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi
ne.Parser.parseExpression"); | 336 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi
ne.Parser.parseExpression"); |
| 337 try { | 337 try { |
| 338 _currentToken = token; | 338 _currentToken = token; |
| 339 return parseExpression2(); | 339 return parseExpression2(); |
| 340 } finally { | 340 } finally { |
| 341 instrumentation.log(); | 341 instrumentation.log(); |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 | 344 |
| 345 /** | 345 /** |
| 346 * Parse a statement, starting with the given token. | 346 * Parse a statement, starting with the given token. |
| 347 * @param token the first token of the statement | 347 * @param token the first token of the statement |
| 348 * @return the statement that was parsed, or {@code null} if the tokens do not
represent a | 348 * @return the statement that was parsed, or `null` if the tokens do not repre
sent a |
| 349 * recognizable statement | 349 * recognizable statement |
| 350 */ | 350 */ |
| 351 Statement parseStatement(Token token) { | 351 Statement parseStatement(Token token) { |
| 352 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi
ne.Parser.parseStatement"); | 352 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi
ne.Parser.parseStatement"); |
| 353 try { | 353 try { |
| 354 _currentToken = token; | 354 _currentToken = token; |
| 355 return parseStatement2(); | 355 return parseStatement2(); |
| 356 } finally { | 356 } finally { |
| 357 instrumentation.log(); | 357 instrumentation.log(); |
| 358 } | 358 } |
| 359 } | 359 } |
| 360 | 360 |
| 361 /** | 361 /** |
| 362 * Parse a sequence of statements, starting with the given token. | 362 * Parse a sequence of statements, starting with the given token. |
| 363 * @param token the first token of the sequence of statement | 363 * @param token the first token of the sequence of statement |
| 364 * @return the statements that were parsed, or {@code null} if the tokens do n
ot represent a | 364 * @return the statements that were parsed, or `null` if the tokens do not rep
resent a |
| 365 * recognizable sequence of statements | 365 * recognizable sequence of statements |
| 366 */ | 366 */ |
| 367 List<Statement> parseStatements(Token token) { | 367 List<Statement> parseStatements(Token token) { |
| 368 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi
ne.Parser.parseStatements"); | 368 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi
ne.Parser.parseStatements"); |
| 369 try { | 369 try { |
| 370 _currentToken = token; | 370 _currentToken = token; |
| 371 return parseStatements2(); | 371 return parseStatements2(); |
| 372 } finally { | 372 } finally { |
| 373 instrumentation.log(); | 373 instrumentation.log(); |
| 374 } | 374 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 443 |
| 444 /** | 444 /** |
| 445 * Convert the given method declaration into the nearest valid top-level funct
ion declaration. | 445 * Convert the given method declaration into the nearest valid top-level funct
ion declaration. |
| 446 * @param method the method to be converted | 446 * @param method the method to be converted |
| 447 * @return the function declaration that most closely captures the components
of the given method | 447 * @return the function declaration that most closely captures the components
of the given method |
| 448 * declaration | 448 * declaration |
| 449 */ | 449 */ |
| 450 FunctionDeclaration convertToFunctionDeclaration(MethodDeclaration method) =>
new FunctionDeclaration.full(method.documentationComment, method.metadata, metho
d.externalKeyword, method.returnType, method.propertyKeyword, method.name, new F
unctionExpression.full(method.parameters, method.body)); | 450 FunctionDeclaration convertToFunctionDeclaration(MethodDeclaration method) =>
new FunctionDeclaration.full(method.documentationComment, method.metadata, metho
d.externalKeyword, method.returnType, method.propertyKeyword, method.name, new F
unctionExpression.full(method.parameters, method.body)); |
| 451 | 451 |
| 452 /** | 452 /** |
| 453 * Return {@code true} if the current token could be the start of a compilatio
n unit member. This | 453 * Return `true` if the current token could be the start of a compilation unit
member. This |
| 454 * method is used for recovery purposes to decide when to stop skipping tokens
after finding an | 454 * method is used for recovery purposes to decide when to stop skipping tokens
after finding an |
| 455 * error while parsing a compilation unit member. | 455 * error while parsing a compilation unit member. |
| 456 * @return {@code true} if the current token could be the start of a compilati
on unit member | 456 * @return `true` if the current token could be the start of a compilation uni
t member |
| 457 */ | 457 */ |
| 458 bool couldBeStartOfCompilationUnitMember() { | 458 bool couldBeStartOfCompilationUnitMember() { |
| 459 if ((matches(Keyword.IMPORT) || matches(Keyword.EXPORT) || matches(Keyword.L
IBRARY) || matches(Keyword.PART)) && !matches4(peek(), TokenType.PERIOD) && !mat
ches4(peek(), TokenType.LT)) { | 459 if ((matches(Keyword.IMPORT) || matches(Keyword.EXPORT) || matches(Keyword.L
IBRARY) || matches(Keyword.PART)) && !matches4(peek(), TokenType.PERIOD) && !mat
ches4(peek(), TokenType.LT)) { |
| 460 return true; | 460 return true; |
| 461 } else if (matches(Keyword.CLASS)) { | 461 } else if (matches(Keyword.CLASS)) { |
| 462 return true; | 462 return true; |
| 463 } else if (matches(Keyword.TYPEDEF) && !matches4(peek(), TokenType.PERIOD) &
& !matches4(peek(), TokenType.LT)) { | 463 } else if (matches(Keyword.TYPEDEF) && !matches4(peek(), TokenType.PERIOD) &
& !matches4(peek(), TokenType.LT)) { |
| 464 return true; | 464 return true; |
| 465 } else if (matches(Keyword.VOID) || ((matches(Keyword.GET) || matches(Keywor
d.SET)) && matchesIdentifier2(peek())) || (matches(Keyword.OPERATOR) && isOperat
or(peek()))) { | 465 } else if (matches(Keyword.VOID) || ((matches(Keyword.GET) || matches(Keywor
d.SET)) && matchesIdentifier2(peek())) || (matches(Keyword.OPERATOR) && isOperat
or(peek()))) { |
| 466 return true; | 466 return true; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 if (identical(type, TokenType.SEMICOLON)) { | 549 if (identical(type, TokenType.SEMICOLON)) { |
| 550 reportError8(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previous, [type
.lexeme]); | 550 reportError8(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previous, [type
.lexeme]); |
| 551 } else { | 551 } else { |
| 552 reportError7(ParserErrorCode.EXPECTED_TOKEN, [type.lexeme]); | 552 reportError7(ParserErrorCode.EXPECTED_TOKEN, [type.lexeme]); |
| 553 } | 553 } |
| 554 return _currentToken; | 554 return _currentToken; |
| 555 } | 555 } |
| 556 | 556 |
| 557 /** | 557 /** |
| 558 * Search the given list of ranges for a range that contains the given index.
Return the range | 558 * Search the given list of ranges for a range that contains the given index.
Return the range |
| 559 * that was found, or {@code null} if none of the ranges contain the index. | 559 * that was found, or `null` if none of the ranges contain the index. |
| 560 * @param ranges the ranges to be searched | 560 * @param ranges the ranges to be searched |
| 561 * @param index the index contained in the returned range | 561 * @param index the index contained in the returned range |
| 562 * @return the range that was found | 562 * @return the range that was found |
| 563 */ | 563 */ |
| 564 List<int> findRange(List<List<int>> ranges, int index) { | 564 List<int> findRange(List<List<int>> ranges, int index) { |
| 565 for (List<int> range in ranges) { | 565 for (List<int> range in ranges) { |
| 566 if (range[0] <= index && index <= range[1]) { | 566 if (range[0] <= index && index <= range[1]) { |
| 567 return range; | 567 return range; |
| 568 } else if (index < range[0]) { | 568 } else if (index < range[0]) { |
| 569 return null; | 569 return null; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 ranges.add(<int> [index, end]); | 618 ranges.add(<int> [index, end]); |
| 619 index = end + 1; | 619 index = end + 1; |
| 620 } else { | 620 } else { |
| 621 index = index + 1; | 621 index = index + 1; |
| 622 } | 622 } |
| 623 } | 623 } |
| 624 return ranges; | 624 return ranges; |
| 625 } | 625 } |
| 626 | 626 |
| 627 /** | 627 /** |
| 628 * Return the end token associated with the given begin token, or {@code null}
if either the given | 628 * Return the end token associated with the given begin token, or `null` if ei
ther the given |
| 629 * token is not a begin token or it does not have an end token associated with
it. | 629 * token is not a begin token or it does not have an end token associated with
it. |
| 630 * @param beginToken the token that is expected to have an end token associate
d with it | 630 * @param beginToken the token that is expected to have an end token associate
d with it |
| 631 * @return the end token associated with the begin token | 631 * @return the end token associated with the begin token |
| 632 */ | 632 */ |
| 633 Token getEndToken(Token beginToken) { | 633 Token getEndToken(Token beginToken) { |
| 634 if (beginToken is BeginToken) { | 634 if (beginToken is BeginToken) { |
| 635 return ((beginToken as BeginToken)).endToken; | 635 return ((beginToken as BeginToken)).endToken; |
| 636 } | 636 } |
| 637 return null; | 637 return null; |
| 638 } | 638 } |
| 639 | 639 |
| 640 /** | 640 /** |
| 641 * Return {@code true} if the current token is the first token of a return typ
e that is followed | 641 * Return `true` if the current token is the first token of a return type that
is followed |
| 642 * by an identifier, possibly followed by a list of type parameters, followed
by a | 642 * by an identifier, possibly followed by a list of type parameters, followed
by a |
| 643 * left-parenthesis. This is used by parseTypeAlias to determine whether or no
t to parse a return | 643 * left-parenthesis. This is used by parseTypeAlias to determine whether or no
t to parse a return |
| 644 * type. | 644 * type. |
| 645 * @return {@code true} if we can successfully parse the rest of a type alias
if we first parse a | 645 * @return `true` if we can successfully parse the rest of a type alias if we
first parse a |
| 646 * return type. | 646 * return type. |
| 647 */ | 647 */ |
| 648 bool hasReturnTypeInTypeAlias() { | 648 bool hasReturnTypeInTypeAlias() { |
| 649 Token next = skipReturnType(_currentToken); | 649 Token next = skipReturnType(_currentToken); |
| 650 if (next == null) { | 650 if (next == null) { |
| 651 return false; | 651 return false; |
| 652 } | 652 } |
| 653 return matchesIdentifier2(next); | 653 return matchesIdentifier2(next); |
| 654 } | 654 } |
| 655 | 655 |
| 656 /** | 656 /** |
| 657 * Return {@code true} if the current token appears to be the beginning of a f
unction declaration. | 657 * Return `true` if the current token appears to be the beginning of a functio
n declaration. |
| 658 * @return {@code true} if the current token appears to be the beginning of a
function declaration | 658 * @return `true` if the current token appears to be the beginning of a functi
on declaration |
| 659 */ | 659 */ |
| 660 bool isFunctionDeclaration() { | 660 bool isFunctionDeclaration() { |
| 661 if (matches(Keyword.VOID)) { | 661 if (matches(Keyword.VOID)) { |
| 662 return true; | 662 return true; |
| 663 } | 663 } |
| 664 Token afterReturnType = skipTypeName(_currentToken); | 664 Token afterReturnType = skipTypeName(_currentToken); |
| 665 if (afterReturnType == null) { | 665 if (afterReturnType == null) { |
| 666 afterReturnType = _currentToken; | 666 afterReturnType = _currentToken; |
| 667 } | 667 } |
| 668 Token afterIdentifier = skipSimpleIdentifier(afterReturnType); | 668 Token afterIdentifier = skipSimpleIdentifier(afterReturnType); |
| 669 if (afterIdentifier == null) { | 669 if (afterIdentifier == null) { |
| 670 afterIdentifier = skipSimpleIdentifier(_currentToken); | 670 afterIdentifier = skipSimpleIdentifier(_currentToken); |
| 671 } | 671 } |
| 672 if (afterIdentifier == null) { | 672 if (afterIdentifier == null) { |
| 673 return false; | 673 return false; |
| 674 } | 674 } |
| 675 return isFunctionExpression(afterIdentifier); | 675 return isFunctionExpression(afterIdentifier); |
| 676 } | 676 } |
| 677 | 677 |
| 678 /** | 678 /** |
| 679 * Return {@code true} if the given token appears to be the beginning of a fun
ction expression. | 679 * Return `true` if the given token appears to be the beginning of a function
expression. |
| 680 * @param startToken the token that might be the start of a function expressio
n | 680 * @param startToken the token that might be the start of a function expressio
n |
| 681 * @return {@code true} if the given token appears to be the beginning of a fu
nction expression | 681 * @return `true` if the given token appears to be the beginning of a function
expression |
| 682 */ | 682 */ |
| 683 bool isFunctionExpression(Token startToken) { | 683 bool isFunctionExpression(Token startToken) { |
| 684 Token afterParameters = skipFormalParameterList(startToken); | 684 Token afterParameters = skipFormalParameterList(startToken); |
| 685 if (afterParameters == null) { | 685 if (afterParameters == null) { |
| 686 return false; | 686 return false; |
| 687 } | 687 } |
| 688 return matchesAny(afterParameters, [TokenType.OPEN_CURLY_BRACKET, TokenType.
FUNCTION]); | 688 return matchesAny(afterParameters, [TokenType.OPEN_CURLY_BRACKET, TokenType.
FUNCTION]); |
| 689 } | 689 } |
| 690 | 690 |
| 691 /** | 691 /** |
| 692 * Return {@code true} if the given character is a valid hexadecimal digit. | 692 * Return `true` if the given character is a valid hexadecimal digit. |
| 693 * @param character the character being tested | 693 * @param character the character being tested |
| 694 * @return {@code true} if the character is a valid hexadecimal digit | 694 * @return `true` if the character is a valid hexadecimal digit |
| 695 */ | 695 */ |
| 696 bool isHexDigit(int character) => (0x30 <= character && character <= 0x39) ||
(0x41 <= character && character <= 0x46) || (0x61 <= character && character <= 0
x66); | 696 bool isHexDigit(int character) => (0x30 <= character && character <= 0x39) ||
(0x41 <= character && character <= 0x46) || (0x61 <= character && character <= 0
x66); |
| 697 | 697 |
| 698 /** | 698 /** |
| 699 * Return {@code true} if the current token is the first token in an initializ
ed variable | 699 * Return `true` if the current token is the first token in an initialized var
iable |
| 700 * declaration rather than an expression. This method assumes that we have alr
eady skipped past | 700 * declaration rather than an expression. This method assumes that we have alr
eady skipped past |
| 701 * any metadata that might be associated with the declaration. | 701 * any metadata that might be associated with the declaration. |
| 702 * <pre> | 702 * <pre> |
| 703 * initializedVariableDeclaration ::= | 703 * initializedVariableDeclaration ::= |
| 704 * declaredIdentifier ('=' expression)? (',' initializedIdentifier) | 704 * declaredIdentifier ('=' expression)? (',' initializedIdentifier) |
| 705 * declaredIdentifier ::= | 705 * declaredIdentifier ::= |
| 706 * metadata finalConstVarOrType identifier | 706 * metadata finalConstVarOrType identifier |
| 707 * finalConstVarOrType ::= | 707 * finalConstVarOrType ::= |
| 708 * 'final' type? | 708 * 'final' type? |
| 709 * | 'const' type? | 709 * | 'const' type? |
| 710 * | 'var' | 710 * | 'var' |
| 711 * | type | 711 * | type |
| 712 * type ::= | 712 * type ::= |
| 713 * qualified typeArguments? | 713 * qualified typeArguments? |
| 714 * initializedIdentifier ::= | 714 * initializedIdentifier ::= |
| 715 * identifier ('=' expression)? | 715 * identifier ('=' expression)? |
| 716 * </pre> | 716 * </pre> |
| 717 * @return {@code true} if the current token is the first token in an initiali
zed variable | 717 * @return `true` if the current token is the first token in an initialized va
riable |
| 718 * declaration | 718 * declaration |
| 719 */ | 719 */ |
| 720 bool isInitializedVariableDeclaration() { | 720 bool isInitializedVariableDeclaration() { |
| 721 if (matches(Keyword.FINAL) || matches(Keyword.VAR)) { | 721 if (matches(Keyword.FINAL) || matches(Keyword.VAR)) { |
| 722 return true; | 722 return true; |
| 723 } | 723 } |
| 724 if (matches(Keyword.CONST)) { | 724 if (matches(Keyword.CONST)) { |
| 725 return !matchesAny(peek(), [TokenType.LT, TokenType.OPEN_CURLY_BRACKET, To
kenType.OPEN_SQUARE_BRACKET, TokenType.INDEX]); | 725 return !matchesAny(peek(), [TokenType.LT, TokenType.OPEN_CURLY_BRACKET, To
kenType.OPEN_SQUARE_BRACKET, TokenType.INDEX]); |
| 726 } | 726 } |
| 727 Token token = skipTypeName(_currentToken); | 727 Token token = skipTypeName(_currentToken); |
| 728 if (token == null) { | 728 if (token == null) { |
| 729 return false; | 729 return false; |
| 730 } | 730 } |
| 731 token = skipSimpleIdentifier(token); | 731 token = skipSimpleIdentifier(token); |
| 732 if (token == null) { | 732 if (token == null) { |
| 733 return false; | 733 return false; |
| 734 } | 734 } |
| 735 TokenType type = token.type; | 735 TokenType type = token.type; |
| 736 return identical(type, TokenType.EQ) || identical(type, TokenType.COMMA) ||
identical(type, TokenType.SEMICOLON) || matches3(token, Keyword.IN); | 736 return identical(type, TokenType.EQ) || identical(type, TokenType.COMMA) ||
identical(type, TokenType.SEMICOLON) || matches3(token, Keyword.IN); |
| 737 } | 737 } |
| 738 | 738 |
| 739 /** | 739 /** |
| 740 * Given that we have just found bracketed text within a comment, look to see
whether that text is | 740 * Given that we have just found bracketed text within a comment, look to see
whether that text is |
| 741 * (a) followed by a parenthesized link address, (b) followed by a colon, or (
c) followed by | 741 * (a) followed by a parenthesized link address, (b) followed by a colon, or (
c) followed by |
| 742 * optional whitespace and another square bracket. | 742 * optional whitespace and another square bracket. |
| 743 * <p> | 743 * |
| 744 * This method uses the syntax described by the <a | 744 * This method uses the syntax described by the <a |
| 745 * href="http://daringfireball.net/projects/markdown/syntax">markdown</a> proj
ect. | 745 * href="http://daringfireball.net/projects/markdown/syntax">markdown</a> proj
ect. |
| 746 * @param comment the comment text in which the bracketed text was found | 746 * @param comment the comment text in which the bracketed text was found |
| 747 * @param rightIndex the index of the right bracket | 747 * @param rightIndex the index of the right bracket |
| 748 * @return {@code true} if the bracketed text is followed by a link address | 748 * @return `true` if the bracketed text is followed by a link address |
| 749 */ | 749 */ |
| 750 bool isLinkText(String comment, int rightIndex) { | 750 bool isLinkText(String comment, int rightIndex) { |
| 751 int length = comment.length; | 751 int length = comment.length; |
| 752 int index = rightIndex + 1; | 752 int index = rightIndex + 1; |
| 753 if (index >= length) { | 753 if (index >= length) { |
| 754 return false; | 754 return false; |
| 755 } | 755 } |
| 756 int nextChar = comment.codeUnitAt(index); | 756 int nextChar = comment.codeUnitAt(index); |
| 757 if (nextChar == 0x28 || nextChar == 0x3A) { | 757 if (nextChar == 0x28 || nextChar == 0x3A) { |
| 758 return true; | 758 return true; |
| 759 } | 759 } |
| 760 while (Character.isWhitespace(nextChar)) { | 760 while (Character.isWhitespace(nextChar)) { |
| 761 index = index + 1; | 761 index = index + 1; |
| 762 if (index >= length) { | 762 if (index >= length) { |
| 763 return false; | 763 return false; |
| 764 } | 764 } |
| 765 nextChar = comment.codeUnitAt(index); | 765 nextChar = comment.codeUnitAt(index); |
| 766 } | 766 } |
| 767 return nextChar == 0x5B; | 767 return nextChar == 0x5B; |
| 768 } | 768 } |
| 769 | 769 |
| 770 /** | 770 /** |
| 771 * Return {@code true} if the given token appears to be the beginning of an op
erator declaration. | 771 * Return `true` if the given token appears to be the beginning of an operator
declaration. |
| 772 * @param startToken the token that might be the start of an operator declarat
ion | 772 * @param startToken the token that might be the start of an operator declarat
ion |
| 773 * @return {@code true} if the given token appears to be the beginning of an o
perator declaration | 773 * @return `true` if the given token appears to be the beginning of an operato
r declaration |
| 774 */ | 774 */ |
| 775 bool isOperator(Token startToken) { | 775 bool isOperator(Token startToken) { |
| 776 if (startToken.isOperator()) { | 776 if (startToken.isOperator()) { |
| 777 Token token = startToken.next; | 777 Token token = startToken.next; |
| 778 while (token.isOperator()) { | 778 while (token.isOperator()) { |
| 779 token = token.next; | 779 token = token.next; |
| 780 } | 780 } |
| 781 return matches4(token, TokenType.OPEN_PAREN); | 781 return matches4(token, TokenType.OPEN_PAREN); |
| 782 } | 782 } |
| 783 return false; | 783 return false; |
| 784 } | 784 } |
| 785 | 785 |
| 786 /** | 786 /** |
| 787 * Return {@code true} if the current token appears to be the beginning of a s
witch member. | 787 * Return `true` if the current token appears to be the beginning of a switch
member. |
| 788 * @return {@code true} if the current token appears to be the beginning of a
switch member | 788 * @return `true` if the current token appears to be the beginning of a switch
member |
| 789 */ | 789 */ |
| 790 bool isSwitchMember() { | 790 bool isSwitchMember() { |
| 791 Token token = _currentToken; | 791 Token token = _currentToken; |
| 792 while (matches4(token, TokenType.IDENTIFIER) && matches4(token.next, TokenTy
pe.COLON)) { | 792 while (matches4(token, TokenType.IDENTIFIER) && matches4(token.next, TokenTy
pe.COLON)) { |
| 793 token = token.next.next; | 793 token = token.next.next; |
| 794 } | 794 } |
| 795 if (identical(token.type, TokenType.KEYWORD)) { | 795 if (identical(token.type, TokenType.KEYWORD)) { |
| 796 Keyword keyword = ((token as KeywordToken)).keyword; | 796 Keyword keyword = ((token as KeywordToken)).keyword; |
| 797 return identical(keyword, Keyword.CASE) || identical(keyword, Keyword.DEFA
ULT); | 797 return identical(keyword, Keyword.CASE) || identical(keyword, Keyword.DEFA
ULT); |
| 798 } | 798 } |
| 799 return false; | 799 return false; |
| 800 } | 800 } |
| 801 | 801 |
| 802 /** | 802 /** |
| 803 * Compare the given tokens to find the token that appears first in the source
being parsed. That | 803 * Compare the given tokens to find the token that appears first in the source
being parsed. That |
| 804 * is, return the left-most of all of the tokens. The arguments are allowed to
be {@code null}. | 804 * is, return the left-most of all of the tokens. The arguments are allowed to
be `null`. |
| 805 * Return the token with the smallest offset, or {@code null} if there are no
arguments or if all | 805 * Return the token with the smallest offset, or `null` if there are no argume
nts or if all |
| 806 * of the arguments are {@code null}. | 806 * of the arguments are `null`. |
| 807 * @param tokens the tokens being compared | 807 * @param tokens the tokens being compared |
| 808 * @return the token with the smallest offset | 808 * @return the token with the smallest offset |
| 809 */ | 809 */ |
| 810 Token lexicallyFirst(List<Token> tokens) { | 810 Token lexicallyFirst(List<Token> tokens) { |
| 811 Token first = null; | 811 Token first = null; |
| 812 int firstOffset = 2147483647; | 812 int firstOffset = 2147483647; |
| 813 for (Token token in tokens) { | 813 for (Token token in tokens) { |
| 814 if (token != null) { | 814 if (token != null) { |
| 815 int offset = token.offset; | 815 int offset = token.offset; |
| 816 if (offset < firstOffset) { | 816 if (offset < firstOffset) { |
| 817 first = token; | 817 first = token; |
| 818 firstOffset = offset; | 818 firstOffset = offset; |
| 819 } | 819 } |
| 820 } | 820 } |
| 821 } | 821 } |
| 822 return first; | 822 return first; |
| 823 } | 823 } |
| 824 | 824 |
| 825 /** | 825 /** |
| 826 * Return {@code true} if the current token matches the given keyword. | 826 * Return `true` if the current token matches the given keyword. |
| 827 * @param keyword the keyword that can optionally appear in the current locati
on | 827 * @param keyword the keyword that can optionally appear in the current locati
on |
| 828 * @return {@code true} if the current token matches the given keyword | 828 * @return `true` if the current token matches the given keyword |
| 829 */ | 829 */ |
| 830 bool matches(Keyword keyword) => matches3(_currentToken, keyword); | 830 bool matches(Keyword keyword) => matches3(_currentToken, keyword); |
| 831 | 831 |
| 832 /** | 832 /** |
| 833 * Return {@code true} if the current token matches the given identifier. | 833 * Return `true` if the current token matches the given identifier. |
| 834 * @param identifier the identifier that can optionally appear in the current
location | 834 * @param identifier the identifier that can optionally appear in the current
location |
| 835 * @return {@code true} if the current token matches the given identifier | 835 * @return `true` if the current token matches the given identifier |
| 836 */ | 836 */ |
| 837 bool matches2(String identifier) => identical(_currentToken.type, TokenType.ID
ENTIFIER) && _currentToken.lexeme == identifier; | 837 bool matches2(String identifier) => identical(_currentToken.type, TokenType.ID
ENTIFIER) && _currentToken.lexeme == identifier; |
| 838 | 838 |
| 839 /** | 839 /** |
| 840 * Return {@code true} if the given token matches the given keyword. | 840 * Return `true` if the given token matches the given keyword. |
| 841 * @param token the token being tested | 841 * @param token the token being tested |
| 842 * @param keyword the keyword that is being tested for | 842 * @param keyword the keyword that is being tested for |
| 843 * @return {@code true} if the given token matches the given keyword | 843 * @return `true` if the given token matches the given keyword |
| 844 */ | 844 */ |
| 845 bool matches3(Token token, Keyword keyword2) => identical(token.type, TokenTyp
e.KEYWORD) && identical(((token as KeywordToken)).keyword, keyword2); | 845 bool matches3(Token token, Keyword keyword2) => identical(token.type, TokenTyp
e.KEYWORD) && identical(((token as KeywordToken)).keyword, keyword2); |
| 846 | 846 |
| 847 /** | 847 /** |
| 848 * Return {@code true} if the given token has the given type. | 848 * Return `true` if the given token has the given type. |
| 849 * @param token the token being tested | 849 * @param token the token being tested |
| 850 * @param type the type of token that is being tested for | 850 * @param type the type of token that is being tested for |
| 851 * @return {@code true} if the given token has the given type | 851 * @return `true` if the given token has the given type |
| 852 */ | 852 */ |
| 853 bool matches4(Token token, TokenType type2) => identical(token.type, type2); | 853 bool matches4(Token token, TokenType type2) => identical(token.type, type2); |
| 854 | 854 |
| 855 /** | 855 /** |
| 856 * Return {@code true} if the current token has the given type. Note that this
method, unlike | 856 * Return `true` if the current token has the given type. Note that this metho
d, unlike |
| 857 * other variants, will modify the token stream if possible to match a wider r
ange of tokens. In | 857 * other variants, will modify the token stream if possible to match a wider r
ange of tokens. In |
| 858 * particular, if we are attempting to match a '>' and the next token is eithe
r a '>>' or '>>>', | 858 * particular, if we are attempting to match a '>' and the next token is eithe
r a '>>' or '>>>', |
| 859 * the token stream will be re-written and {@code true} will be returned. | 859 * the token stream will be re-written and `true` will be returned. |
| 860 * @param type the type of token that can optionally appear in the current loc
ation | 860 * @param type the type of token that can optionally appear in the current loc
ation |
| 861 * @return {@code true} if the current token has the given type | 861 * @return `true` if the current token has the given type |
| 862 */ | 862 */ |
| 863 bool matches5(TokenType type2) { | 863 bool matches5(TokenType type2) { |
| 864 TokenType currentType = _currentToken.type; | 864 TokenType currentType = _currentToken.type; |
| 865 if (currentType != type2) { | 865 if (currentType != type2) { |
| 866 if (identical(type2, TokenType.GT)) { | 866 if (identical(type2, TokenType.GT)) { |
| 867 if (identical(currentType, TokenType.GT_GT)) { | 867 if (identical(currentType, TokenType.GT_GT)) { |
| 868 int offset = _currentToken.offset; | 868 int offset = _currentToken.offset; |
| 869 Token first = new Token(TokenType.GT, offset); | 869 Token first = new Token(TokenType.GT, offset); |
| 870 Token second = new Token(TokenType.GT, offset + 1); | 870 Token second = new Token(TokenType.GT, offset + 1); |
| 871 second.setNext(_currentToken.next); | 871 second.setNext(_currentToken.next); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 894 _currentToken = first; | 894 _currentToken = first; |
| 895 return true; | 895 return true; |
| 896 } | 896 } |
| 897 } | 897 } |
| 898 return false; | 898 return false; |
| 899 } | 899 } |
| 900 return true; | 900 return true; |
| 901 } | 901 } |
| 902 | 902 |
| 903 /** | 903 /** |
| 904 * Return {@code true} if the given token has any one of the given types. | 904 * Return `true` if the given token has any one of the given types. |
| 905 * @param token the token being tested | 905 * @param token the token being tested |
| 906 * @param types the types of token that are being tested for | 906 * @param types the types of token that are being tested for |
| 907 * @return {@code true} if the given token has any of the given types | 907 * @return `true` if the given token has any of the given types |
| 908 */ | 908 */ |
| 909 bool matchesAny(Token token, List<TokenType> types) { | 909 bool matchesAny(Token token, List<TokenType> types) { |
| 910 TokenType actualType = token.type; | 910 TokenType actualType = token.type; |
| 911 for (TokenType type in types) { | 911 for (TokenType type in types) { |
| 912 if (identical(actualType, type)) { | 912 if (identical(actualType, type)) { |
| 913 return true; | 913 return true; |
| 914 } | 914 } |
| 915 } | 915 } |
| 916 return false; | 916 return false; |
| 917 } | 917 } |
| 918 | 918 |
| 919 /** | 919 /** |
| 920 * Return {@code true} if the current token is a valid identifier. Valid ident
ifiers include | 920 * Return `true` if the current token is a valid identifier. Valid identifiers
include |
| 921 * built-in identifiers (pseudo-keywords). | 921 * built-in identifiers (pseudo-keywords). |
| 922 * @return {@code true} if the current token is a valid identifier | 922 * @return `true` if the current token is a valid identifier |
| 923 */ | 923 */ |
| 924 bool matchesIdentifier() => matchesIdentifier2(_currentToken); | 924 bool matchesIdentifier() => matchesIdentifier2(_currentToken); |
| 925 | 925 |
| 926 /** | 926 /** |
| 927 * Return {@code true} if the given token is a valid identifier. Valid identif
iers include | 927 * Return `true` if the given token is a valid identifier. Valid identifiers i
nclude |
| 928 * built-in identifiers (pseudo-keywords). | 928 * built-in identifiers (pseudo-keywords). |
| 929 * @return {@code true} if the given token is a valid identifier | 929 * @return `true` if the given token is a valid identifier |
| 930 */ | 930 */ |
| 931 bool matchesIdentifier2(Token token) => matches4(token, TokenType.IDENTIFIER)
|| (matches4(token, TokenType.KEYWORD) && ((token as KeywordToken)).keyword.isPs
eudoKeyword()); | 931 bool matchesIdentifier2(Token token) => matches4(token, TokenType.IDENTIFIER)
|| (matches4(token, TokenType.KEYWORD) && ((token as KeywordToken)).keyword.isPs
eudoKeyword()); |
| 932 | 932 |
| 933 /** | 933 /** |
| 934 * If the current token has the given type, then advance to the next token and
return {@code true}. Otherwise, return {@code false} without advancing. | 934 * If the current token has the given type, then advance to the next token and
return `true`. Otherwise, return `false` without advancing. |
| 935 * @param type the type of token that can optionally appear in the current loc
ation | 935 * @param type the type of token that can optionally appear in the current loc
ation |
| 936 * @return {@code true} if the current token has the given type | 936 * @return `true` if the current token has the given type |
| 937 */ | 937 */ |
| 938 bool optional(TokenType type) { | 938 bool optional(TokenType type) { |
| 939 if (matches5(type)) { | 939 if (matches5(type)) { |
| 940 advance(); | 940 advance(); |
| 941 return true; | 941 return true; |
| 942 } | 942 } |
| 943 return false; | 943 return false; |
| 944 } | 944 } |
| 945 | 945 |
| 946 /** | 946 /** |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 } | 1080 } |
| 1081 | 1081 |
| 1082 /** | 1082 /** |
| 1083 * Parse an assignable expression. | 1083 * Parse an assignable expression. |
| 1084 * <pre> | 1084 * <pre> |
| 1085 * assignableExpression ::= | 1085 * assignableExpression ::= |
| 1086 * primary (arguments* assignableSelector)+ | 1086 * primary (arguments* assignableSelector)+ |
| 1087 * | 'super' assignableSelector | 1087 * | 'super' assignableSelector |
| 1088 * | identifier | 1088 * | identifier |
| 1089 * </pre> | 1089 * </pre> |
| 1090 * @param primaryAllowed {@code true} if the expression is allowed to be a pri
mary without any | 1090 * @param primaryAllowed `true` if the expression is allowed to be a primary w
ithout any |
| 1091 * assignable selector | 1091 * assignable selector |
| 1092 * @return the assignable expression that was parsed | 1092 * @return the assignable expression that was parsed |
| 1093 */ | 1093 */ |
| 1094 Expression parseAssignableExpression(bool primaryAllowed) { | 1094 Expression parseAssignableExpression(bool primaryAllowed) { |
| 1095 if (matches(Keyword.SUPER)) { | 1095 if (matches(Keyword.SUPER)) { |
| 1096 return parseAssignableSelector(new SuperExpression.full(andAdvance), false
); | 1096 return parseAssignableSelector(new SuperExpression.full(andAdvance), false
); |
| 1097 } | 1097 } |
| 1098 Expression expression = parsePrimaryExpression(); | 1098 Expression expression = parsePrimaryExpression(); |
| 1099 bool isOptional = primaryAllowed || expression is SimpleIdentifier; | 1099 bool isOptional = primaryAllowed || expression is SimpleIdentifier; |
| 1100 while (true) { | 1100 while (true) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1129 } | 1129 } |
| 1130 | 1130 |
| 1131 /** | 1131 /** |
| 1132 * Parse an assignable selector. | 1132 * Parse an assignable selector. |
| 1133 * <pre> | 1133 * <pre> |
| 1134 * assignableSelector ::= | 1134 * assignableSelector ::= |
| 1135 * '\[' expression '\]' | 1135 * '\[' expression '\]' |
| 1136 * | '.' identifier | 1136 * | '.' identifier |
| 1137 * </pre> | 1137 * </pre> |
| 1138 * @param prefix the expression preceding the selector | 1138 * @param prefix the expression preceding the selector |
| 1139 * @param optional {@code true} if the selector is optional | 1139 * @param optional `true` if the selector is optional |
| 1140 * @return the assignable selector that was parsed | 1140 * @return the assignable selector that was parsed |
| 1141 */ | 1141 */ |
| 1142 Expression parseAssignableSelector(Expression prefix, bool optional) { | 1142 Expression parseAssignableSelector(Expression prefix, bool optional) { |
| 1143 if (matches5(TokenType.OPEN_SQUARE_BRACKET)) { | 1143 if (matches5(TokenType.OPEN_SQUARE_BRACKET)) { |
| 1144 Token leftBracket = andAdvance; | 1144 Token leftBracket = andAdvance; |
| 1145 Expression index = parseExpression2(); | 1145 Expression index = parseExpression2(); |
| 1146 Token rightBracket = expect2(TokenType.CLOSE_SQUARE_BRACKET); | 1146 Token rightBracket = expect2(TokenType.CLOSE_SQUARE_BRACKET); |
| 1147 return new IndexExpression.forTarget_full(prefix, leftBracket, index, righ
tBracket); | 1147 return new IndexExpression.forTarget_full(prefix, leftBracket, index, righ
tBracket); |
| 1148 } else if (matches5(TokenType.PERIOD)) { | 1148 } else if (matches5(TokenType.PERIOD)) { |
| 1149 Token period = andAdvance; | 1149 Token period = andAdvance; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 return expression; | 1338 return expression; |
| 1339 } | 1339 } |
| 1340 | 1340 |
| 1341 /** | 1341 /** |
| 1342 * Parse a class declaration. | 1342 * Parse a class declaration. |
| 1343 * <pre> | 1343 * <pre> |
| 1344 * classDeclaration ::= | 1344 * classDeclaration ::= |
| 1345 * metadata 'abstract'? 'class' name typeParameterList? (extendsClause withCla
use?)? implementsClause? '{' classMembers '}' | 1345 * metadata 'abstract'? 'class' name typeParameterList? (extendsClause withCla
use?)? implementsClause? '{' classMembers '}' |
| 1346 * </pre> | 1346 * </pre> |
| 1347 * @param commentAndMetadata the metadata to be associated with the member | 1347 * @param commentAndMetadata the metadata to be associated with the member |
| 1348 * @param abstractKeyword the token for the keyword 'abstract', or {@code null
} if the keyword was | 1348 * @param abstractKeyword the token for the keyword 'abstract', or `null` if t
he keyword was |
| 1349 * not given | 1349 * not given |
| 1350 * @return the class declaration that was parsed | 1350 * @return the class declaration that was parsed |
| 1351 */ | 1351 */ |
| 1352 ClassDeclaration parseClassDeclaration(CommentAndMetadata commentAndMetadata,
Token abstractKeyword) { | 1352 ClassDeclaration parseClassDeclaration(CommentAndMetadata commentAndMetadata,
Token abstractKeyword) { |
| 1353 Token keyword = expect(Keyword.CLASS); | 1353 Token keyword = expect(Keyword.CLASS); |
| 1354 SimpleIdentifier name = parseSimpleIdentifier(); | 1354 SimpleIdentifier name = parseSimpleIdentifier(); |
| 1355 String className = name.name; | 1355 String className = name.name; |
| 1356 TypeParameterList typeParameters = null; | 1356 TypeParameterList typeParameters = null; |
| 1357 if (matches5(TokenType.LT)) { | 1357 if (matches5(TokenType.LT)) { |
| 1358 typeParameters = parseTypeParameterList(); | 1358 typeParameters = parseTypeParameterList(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 } | 1418 } |
| 1419 | 1419 |
| 1420 /** | 1420 /** |
| 1421 * Parse a class member. | 1421 * Parse a class member. |
| 1422 * <pre> | 1422 * <pre> |
| 1423 * classMemberDefinition ::= | 1423 * classMemberDefinition ::= |
| 1424 * declaration ';' | 1424 * declaration ';' |
| 1425 * | methodSignature functionBody | 1425 * | methodSignature functionBody |
| 1426 * </pre> | 1426 * </pre> |
| 1427 * @param className the name of the class containing the member being parsed | 1427 * @param className the name of the class containing the member being parsed |
| 1428 * @return the class member that was parsed, or {@code null} if what was found
was not a valid | 1428 * @return the class member that was parsed, or `null` if what was found was n
ot a valid |
| 1429 * class member | 1429 * class member |
| 1430 */ | 1430 */ |
| 1431 ClassMember parseClassMember(String className) { | 1431 ClassMember parseClassMember(String className) { |
| 1432 CommentAndMetadata commentAndMetadata = parseCommentAndMetadata(); | 1432 CommentAndMetadata commentAndMetadata = parseCommentAndMetadata(); |
| 1433 Modifiers modifiers = parseModifiers(); | 1433 Modifiers modifiers = parseModifiers(); |
| 1434 if (matches(Keyword.VOID)) { | 1434 if (matches(Keyword.VOID)) { |
| 1435 TypeName returnType = parseReturnType(); | 1435 TypeName returnType = parseReturnType(); |
| 1436 if (matches(Keyword.GET) && matchesIdentifier2(peek())) { | 1436 if (matches(Keyword.GET) && matchesIdentifier2(peek())) { |
| 1437 validateModifiersForGetterOrSetterOrMethod(modifiers); | 1437 validateModifiersForGetterOrSetterOrMethod(modifiers); |
| 1438 return parseGetter(commentAndMetadata, modifiers.externalKeyword, modifi
ers.staticKeyword, returnType); | 1438 return parseGetter(commentAndMetadata, modifiers.externalKeyword, modifi
ers.staticKeyword, returnType); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1526 return parseInitializedIdentifierList(commentAndMetadata, modifiers.staticKe
yword, validateModifiersForField(modifiers), type); | 1526 return parseInitializedIdentifierList(commentAndMetadata, modifiers.staticKe
yword, validateModifiersForField(modifiers), type); |
| 1527 } | 1527 } |
| 1528 | 1528 |
| 1529 /** | 1529 /** |
| 1530 * Parse a list of class members. | 1530 * Parse a list of class members. |
| 1531 * <pre> | 1531 * <pre> |
| 1532 * classMembers ::= | 1532 * classMembers ::= |
| 1533 * (metadata memberDefinition) | 1533 * (metadata memberDefinition) |
| 1534 * </pre> | 1534 * </pre> |
| 1535 * @param className the name of the class whose members are being parsed | 1535 * @param className the name of the class whose members are being parsed |
| 1536 * @param closingBracket the closing bracket for the class, or {@code null} if
the closing bracket | 1536 * @param closingBracket the closing bracket for the class, or `null` if the c
losing bracket |
| 1537 * is missing | 1537 * is missing |
| 1538 * @return the list of class members that were parsed | 1538 * @return the list of class members that were parsed |
| 1539 */ | 1539 */ |
| 1540 List<ClassMember> parseClassMembers(String className, Token closingBracket) { | 1540 List<ClassMember> parseClassMembers(String className, Token closingBracket) { |
| 1541 List<ClassMember> members = new List<ClassMember>(); | 1541 List<ClassMember> members = new List<ClassMember>(); |
| 1542 Token memberStart = _currentToken; | 1542 Token memberStart = _currentToken; |
| 1543 while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET)
&& (closingBracket != null || (!matches(Keyword.CLASS) && !matches(Keyword.TYPED
EF)))) { | 1543 while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET)
&& (closingBracket != null || (!matches(Keyword.CLASS) && !matches(Keyword.TYPED
EF)))) { |
| 1544 if (matches5(TokenType.SEMICOLON)) { | 1544 if (matches5(TokenType.SEMICOLON)) { |
| 1545 reportError8(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentT
oken.lexeme]); | 1545 reportError8(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentT
oken.lexeme]); |
| 1546 advance(); | 1546 advance(); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 | 1657 |
| 1658 /** | 1658 /** |
| 1659 * Parse a comment reference from the source between square brackets. | 1659 * Parse a comment reference from the source between square brackets. |
| 1660 * <pre> | 1660 * <pre> |
| 1661 * commentReference ::= | 1661 * commentReference ::= |
| 1662 * 'new'? prefixedIdentifier | 1662 * 'new'? prefixedIdentifier |
| 1663 * </pre> | 1663 * </pre> |
| 1664 * @param referenceSource the source occurring between the square brackets wit
hin a documentation | 1664 * @param referenceSource the source occurring between the square brackets wit
hin a documentation |
| 1665 * comment | 1665 * comment |
| 1666 * @param sourceOffset the offset of the first character of the reference sour
ce | 1666 * @param sourceOffset the offset of the first character of the reference sour
ce |
| 1667 * @return the comment reference that was parsed, or {@code null} if no refere
nce could be found | 1667 * @return the comment reference that was parsed, or `null` if no reference co
uld be found |
| 1668 */ | 1668 */ |
| 1669 CommentReference parseCommentReference(String referenceSource, int sourceOffse
t) { | 1669 CommentReference parseCommentReference(String referenceSource, int sourceOffse
t) { |
| 1670 if (referenceSource.length == 0) { | 1670 if (referenceSource.length == 0) { |
| 1671 return null; | 1671 return null; |
| 1672 } | 1672 } |
| 1673 try { | 1673 try { |
| 1674 List<bool> errorFound = [false]; | 1674 List<bool> errorFound = [false]; |
| 1675 AnalysisErrorListener listener = new AnalysisErrorListener_11(errorFound); | 1675 AnalysisErrorListener listener = new AnalysisErrorListener_11(errorFound); |
| 1676 StringScanner scanner = new StringScanner(null, referenceSource, listener)
; | 1676 StringScanner scanner = new StringScanner(null, referenceSource, listener)
; |
| 1677 scanner.setSourceStart(1, 1, sourceOffset); | 1677 scanner.setSourceStart(1, 1, sourceOffset); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1748 } else { | 1748 } else { |
| 1749 leftIndex = comment.indexOf('[', range[1] + 1); | 1749 leftIndex = comment.indexOf('[', range[1] + 1); |
| 1750 } | 1750 } |
| 1751 } | 1751 } |
| 1752 } | 1752 } |
| 1753 return references; | 1753 return references; |
| 1754 } | 1754 } |
| 1755 | 1755 |
| 1756 /** | 1756 /** |
| 1757 * Parse a compilation unit. | 1757 * Parse a compilation unit. |
| 1758 * <p> | 1758 * |
| 1759 * Specified: | 1759 * Specified: |
| 1760 * <pre> | 1760 * <pre> |
| 1761 * compilationUnit ::= | 1761 * compilationUnit ::= |
| 1762 * scriptTag? directive* topLevelDeclaration | 1762 * scriptTag? directive* topLevelDeclaration |
| 1763 * </pre> | 1763 * </pre> |
| 1764 * Actual: | 1764 * Actual: |
| 1765 * <pre> | 1765 * <pre> |
| 1766 * compilationUnit ::= | 1766 * compilationUnit ::= |
| 1767 * scriptTag? topLevelElement | 1767 * scriptTag? topLevelElement |
| 1768 * topLevelElement ::= | 1768 * topLevelElement ::= |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1854 * | functionTypeAlias | 1854 * | functionTypeAlias |
| 1855 * | external functionSignature | 1855 * | external functionSignature |
| 1856 * | external getterSignature | 1856 * | external getterSignature |
| 1857 * | external setterSignature | 1857 * | external setterSignature |
| 1858 * | functionSignature functionBody | 1858 * | functionSignature functionBody |
| 1859 * | returnType? getOrSet identifier formalParameterList functionBody | 1859 * | returnType? getOrSet identifier formalParameterList functionBody |
| 1860 * | (final | const) type? staticFinalDeclarationList ';' | 1860 * | (final | const) type? staticFinalDeclarationList ';' |
| 1861 * | variableDeclaration ';' | 1861 * | variableDeclaration ';' |
| 1862 * </pre> | 1862 * </pre> |
| 1863 * @param commentAndMetadata the metadata to be associated with the member | 1863 * @param commentAndMetadata the metadata to be associated with the member |
| 1864 * @return the compilation unit member that was parsed, or {@code null} if wha
t was parsed could | 1864 * @return the compilation unit member that was parsed, or `null` if what was
parsed could |
| 1865 * not be represented as a compilation unit member | 1865 * not be represented as a compilation unit member |
| 1866 */ | 1866 */ |
| 1867 CompilationUnitMember parseCompilationUnitMember(CommentAndMetadata commentAnd
Metadata) { | 1867 CompilationUnitMember parseCompilationUnitMember(CommentAndMetadata commentAnd
Metadata) { |
| 1868 Modifiers modifiers = parseModifiers(); | 1868 Modifiers modifiers = parseModifiers(); |
| 1869 if (matches(Keyword.CLASS)) { | 1869 if (matches(Keyword.CLASS)) { |
| 1870 return parseClassDeclaration(commentAndMetadata, validateModifiersForClass
(modifiers)); | 1870 return parseClassDeclaration(commentAndMetadata, validateModifiersForClass
(modifiers)); |
| 1871 } else if (matches(Keyword.TYPEDEF) && !matches4(peek(), TokenType.PERIOD) &
& !matches4(peek(), TokenType.LT)) { | 1871 } else if (matches(Keyword.TYPEDEF) && !matches4(peek(), TokenType.PERIOD) &
& !matches4(peek(), TokenType.LT)) { |
| 1872 validateModifiersForTypedef(modifiers); | 1872 validateModifiersForTypedef(modifiers); |
| 1873 return parseTypeAlias(commentAndMetadata); | 1873 return parseTypeAlias(commentAndMetadata); |
| 1874 } | 1874 } |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2122 } | 2122 } |
| 2123 } | 2123 } |
| 2124 | 2124 |
| 2125 /** | 2125 /** |
| 2126 * Parse a documentation comment. | 2126 * Parse a documentation comment. |
| 2127 * <pre> | 2127 * <pre> |
| 2128 * documentationComment ::= | 2128 * documentationComment ::= |
| 2129 * multiLineComment? | 2129 * multiLineComment? |
| 2130 * | singleLineComment | 2130 * | singleLineComment |
| 2131 * </pre> | 2131 * </pre> |
| 2132 * @return the documentation comment that was parsed, or {@code null} if there
was no comment | 2132 * @return the documentation comment that was parsed, or `null` if there was n
o comment |
| 2133 */ | 2133 */ |
| 2134 Comment parseDocumentationComment() { | 2134 Comment parseDocumentationComment() { |
| 2135 List<Token> commentTokens = new List<Token>(); | 2135 List<Token> commentTokens = new List<Token>(); |
| 2136 Token commentToken = _currentToken.precedingComments; | 2136 Token commentToken = _currentToken.precedingComments; |
| 2137 while (commentToken != null) { | 2137 while (commentToken != null) { |
| 2138 if (identical(commentToken.type, TokenType.SINGLE_LINE_COMMENT)) { | 2138 if (identical(commentToken.type, TokenType.SINGLE_LINE_COMMENT)) { |
| 2139 if (commentToken.lexeme.startsWith("///")) { | 2139 if (commentToken.lexeme.startsWith("///")) { |
| 2140 if (commentTokens.length == 1 && commentTokens[0].lexeme.startsWith("/
**")) { | 2140 if (commentTokens.length == 1 && commentTokens[0].lexeme.startsWith("/
**")) { |
| 2141 commentTokens.clear(); | 2141 commentTokens.clear(); |
| 2142 } | 2142 } |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2327 | 2327 |
| 2328 /** | 2328 /** |
| 2329 * Parse the 'final', 'const', 'var' or type preceding a variable declaration. | 2329 * Parse the 'final', 'const', 'var' or type preceding a variable declaration. |
| 2330 * <pre> | 2330 * <pre> |
| 2331 * finalConstVarOrType ::= | 2331 * finalConstVarOrType ::= |
| 2332 * | 'final' type? | 2332 * | 'final' type? |
| 2333 * | 'const' type? | 2333 * | 'const' type? |
| 2334 * | 'var' | 2334 * | 'var' |
| 2335 * | type | 2335 * | type |
| 2336 * </pre> | 2336 * </pre> |
| 2337 * @param optional {@code true} if the keyword and type are optional | 2337 * @param optional `true` if the keyword and type are optional |
| 2338 * @return the 'final', 'const', 'var' or type that was parsed | 2338 * @return the 'final', 'const', 'var' or type that was parsed |
| 2339 */ | 2339 */ |
| 2340 FinalConstVarOrType parseFinalConstVarOrType(bool optional) { | 2340 FinalConstVarOrType parseFinalConstVarOrType(bool optional) { |
| 2341 Token keyword = null; | 2341 Token keyword = null; |
| 2342 TypeName type = null; | 2342 TypeName type = null; |
| 2343 if (matches(Keyword.FINAL) || matches(Keyword.CONST)) { | 2343 if (matches(Keyword.FINAL) || matches(Keyword.CONST)) { |
| 2344 keyword = andAdvance; | 2344 keyword = andAdvance; |
| 2345 if (matchesIdentifier2(peek()) || matches4(peek(), TokenType.LT) || matche
s3(peek(), Keyword.THIS) || (matches4(peek(), TokenType.PERIOD) && matchesIdenti
fier2(peek2(2)) && (matchesIdentifier2(peek2(3)) || matches4(peek2(3), TokenType
.LT) || matches3(peek2(3), Keyword.THIS)))) { | 2345 if (matchesIdentifier2(peek()) || matches4(peek(), TokenType.LT) || matche
s3(peek(), Keyword.THIS) || (matches4(peek(), TokenType.PERIOD) && matchesIdenti
fier2(peek2(2)) && (matchesIdentifier2(peek2(3)) || matches4(peek2(3), TokenType
.LT) || matches3(peek2(3), Keyword.THIS)))) { |
| 2346 type = parseTypeName(); | 2346 type = parseTypeName(); |
| 2347 } | 2347 } |
| 2348 } else if (matches(Keyword.VAR)) { | 2348 } else if (matches(Keyword.VAR)) { |
| 2349 keyword = andAdvance; | 2349 keyword = andAdvance; |
| 2350 } else { | 2350 } else { |
| 2351 if (matchesIdentifier2(peek()) || matches4(peek(), TokenType.LT) || matche
s3(peek(), Keyword.THIS) || (matches4(peek(), TokenType.PERIOD) && matchesIdenti
fier2(peek2(2)) && (matchesIdentifier2(peek2(3)) || matches4(peek2(3), TokenType
.LT) || matches3(peek2(3), Keyword.THIS)))) { | 2351 if (matchesIdentifier2(peek()) || matches4(peek(), TokenType.LT) || matche
s3(peek(), Keyword.THIS) || (matches4(peek(), TokenType.PERIOD) && matchesIdenti
fier2(peek2(2)) && (matchesIdentifier2(peek2(3)) || matches4(peek2(3), TokenType
.LT) || matches3(peek2(3), Keyword.THIS)))) { |
| 2352 type = parseReturnType(); | 2352 type = parseReturnType(); |
| 2353 } else if (!optional) { | 2353 } else if (!optional) { |
| 2354 reportError7(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []); | 2354 reportError7(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []); |
| 2355 } | 2355 } |
| 2356 } | 2356 } |
| 2357 return new FinalConstVarOrType(keyword, type); | 2357 return new FinalConstVarOrType(keyword, type); |
| 2358 } | 2358 } |
| 2359 | 2359 |
| 2360 /** | 2360 /** |
| 2361 * Parse a formal parameter. At most one of {@code isOptional} and {@code isNa
med} can be{@code true}. | 2361 * Parse a formal parameter. At most one of `isOptional` and `isNamed` can be`
true`. |
| 2362 * <pre> | 2362 * <pre> |
| 2363 * defaultFormalParameter ::= | 2363 * defaultFormalParameter ::= |
| 2364 * normalFormalParameter ('=' expression)? | 2364 * normalFormalParameter ('=' expression)? |
| 2365 * defaultNamedParameter ::= | 2365 * defaultNamedParameter ::= |
| 2366 * normalFormalParameter (':' expression)? | 2366 * normalFormalParameter (':' expression)? |
| 2367 * </pre> | 2367 * </pre> |
| 2368 * @param kind the kind of parameter being expected based on the presence or a
bsence of group | 2368 * @param kind the kind of parameter being expected based on the presence or a
bsence of group |
| 2369 * delimiters | 2369 * delimiters |
| 2370 * @return the formal parameter that was parsed | 2370 * @return the formal parameter that was parsed |
| 2371 */ | 2371 */ |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2596 /** | 2596 /** |
| 2597 * Parse a function body. | 2597 * Parse a function body. |
| 2598 * <pre> | 2598 * <pre> |
| 2599 * functionBody ::= | 2599 * functionBody ::= |
| 2600 * '=>' expression ';' | 2600 * '=>' expression ';' |
| 2601 * | block | 2601 * | block |
| 2602 * functionExpressionBody ::= | 2602 * functionExpressionBody ::= |
| 2603 * '=>' expression | 2603 * '=>' expression |
| 2604 * | block | 2604 * | block |
| 2605 * </pre> | 2605 * </pre> |
| 2606 * @param mayBeEmpty {@code true} if the function body is allowed to be empty | 2606 * @param mayBeEmpty `true` if the function body is allowed to be empty |
| 2607 * @param emptyErrorCode the error code to report if function body expecte, bu
t not found | 2607 * @param emptyErrorCode the error code to report if function body expecte, bu
t not found |
| 2608 * @param inExpression {@code true} if the function body is being parsed as pa
rt of an expression | 2608 * @param inExpression `true` if the function body is being parsed as part of
an expression |
| 2609 * and therefore does not have a terminating semicolon | 2609 * and therefore does not have a terminating semicolon |
| 2610 * @return the function body that was parsed | 2610 * @return the function body that was parsed |
| 2611 */ | 2611 */ |
| 2612 FunctionBody parseFunctionBody(bool mayBeEmpty, ParserErrorCode emptyErrorCode
, bool inExpression) { | 2612 FunctionBody parseFunctionBody(bool mayBeEmpty, ParserErrorCode emptyErrorCode
, bool inExpression) { |
| 2613 bool wasInLoop = _inLoop; | 2613 bool wasInLoop = _inLoop; |
| 2614 bool wasInSwitch = _inSwitch; | 2614 bool wasInSwitch = _inSwitch; |
| 2615 _inLoop = false; | 2615 _inLoop = false; |
| 2616 _inSwitch = false; | 2616 _inSwitch = false; |
| 2617 try { | 2617 try { |
| 2618 if (matches5(TokenType.SEMICOLON)) { | 2618 if (matches5(TokenType.SEMICOLON)) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2649 | 2649 |
| 2650 /** | 2650 /** |
| 2651 * Parse a function declaration. | 2651 * Parse a function declaration. |
| 2652 * <pre> | 2652 * <pre> |
| 2653 * functionDeclaration ::= | 2653 * functionDeclaration ::= |
| 2654 * functionSignature functionBody | 2654 * functionSignature functionBody |
| 2655 * | returnType? getOrSet identifier formalParameterList functionBody | 2655 * | returnType? getOrSet identifier formalParameterList functionBody |
| 2656 * </pre> | 2656 * </pre> |
| 2657 * @param commentAndMetadata the documentation comment and metadata to be asso
ciated with the | 2657 * @param commentAndMetadata the documentation comment and metadata to be asso
ciated with the |
| 2658 * declaration | 2658 * declaration |
| 2659 * @param externalKeyword the 'external' keyword, or {@code null} if the funct
ion is not external | 2659 * @param externalKeyword the 'external' keyword, or `null` if the function is
not external |
| 2660 * @param returnType the return type, or {@code null} if there is no return ty
pe | 2660 * @param returnType the return type, or `null` if there is no return type |
| 2661 * @param isStatement {@code true} if the function declaration is being parsed
as a statement | 2661 * @param isStatement `true` if the function declaration is being parsed as a
statement |
| 2662 * @return the function declaration that was parsed | 2662 * @return the function declaration that was parsed |
| 2663 */ | 2663 */ |
| 2664 FunctionDeclaration parseFunctionDeclaration(CommentAndMetadata commentAndMeta
data, Token externalKeyword, TypeName returnType) { | 2664 FunctionDeclaration parseFunctionDeclaration(CommentAndMetadata commentAndMeta
data, Token externalKeyword, TypeName returnType) { |
| 2665 Token keyword = null; | 2665 Token keyword = null; |
| 2666 bool isGetter = false; | 2666 bool isGetter = false; |
| 2667 if (matches(Keyword.GET) && !matches4(peek(), TokenType.OPEN_PAREN)) { | 2667 if (matches(Keyword.GET) && !matches4(peek(), TokenType.OPEN_PAREN)) { |
| 2668 keyword = andAdvance; | 2668 keyword = andAdvance; |
| 2669 isGetter = true; | 2669 isGetter = true; |
| 2670 } else if (matches(Keyword.SET) && !matches4(peek(), TokenType.OPEN_PAREN))
{ | 2670 } else if (matches(Keyword.SET) && !matches4(peek(), TokenType.OPEN_PAREN))
{ |
| 2671 keyword = andAdvance; | 2671 keyword = andAdvance; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2703 Statement parseFunctionDeclarationStatement() => parseFunctionDeclarationState
ment2(parseCommentAndMetadata(), parseOptionalReturnType()); | 2703 Statement parseFunctionDeclarationStatement() => parseFunctionDeclarationState
ment2(parseCommentAndMetadata(), parseOptionalReturnType()); |
| 2704 | 2704 |
| 2705 /** | 2705 /** |
| 2706 * Parse a function declaration statement. | 2706 * Parse a function declaration statement. |
| 2707 * <pre> | 2707 * <pre> |
| 2708 * functionDeclarationStatement ::= | 2708 * functionDeclarationStatement ::= |
| 2709 * functionSignature functionBody | 2709 * functionSignature functionBody |
| 2710 * </pre> | 2710 * </pre> |
| 2711 * @param commentAndMetadata the documentation comment and metadata to be asso
ciated with the | 2711 * @param commentAndMetadata the documentation comment and metadata to be asso
ciated with the |
| 2712 * declaration | 2712 * declaration |
| 2713 * @param returnType the return type, or {@code null} if there is no return ty
pe | 2713 * @param returnType the return type, or `null` if there is no return type |
| 2714 * @return the function declaration statement that was parsed | 2714 * @return the function declaration statement that was parsed |
| 2715 */ | 2715 */ |
| 2716 Statement parseFunctionDeclarationStatement2(CommentAndMetadata commentAndMeta
data, TypeName returnType) => new FunctionDeclarationStatement.full(parseFunctio
nDeclaration(commentAndMetadata, null, returnType)); | 2716 Statement parseFunctionDeclarationStatement2(CommentAndMetadata commentAndMeta
data, TypeName returnType) => new FunctionDeclarationStatement.full(parseFunctio
nDeclaration(commentAndMetadata, null, returnType)); |
| 2717 | 2717 |
| 2718 /** | 2718 /** |
| 2719 * Parse a function expression. | 2719 * Parse a function expression. |
| 2720 * <pre> | 2720 * <pre> |
| 2721 * functionExpression ::= | 2721 * functionExpression ::= |
| 2722 * formalParameterList functionExpressionBody | 2722 * formalParameterList functionExpressionBody |
| 2723 * </pre> | 2723 * </pre> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2771 * Parse a getter. | 2771 * Parse a getter. |
| 2772 * <pre> | 2772 * <pre> |
| 2773 * getter ::= | 2773 * getter ::= |
| 2774 * getterSignature functionBody? | 2774 * getterSignature functionBody? |
| 2775 * getterSignature ::= | 2775 * getterSignature ::= |
| 2776 * 'external'? 'static'? returnType? 'get' identifier | 2776 * 'external'? 'static'? returnType? 'get' identifier |
| 2777 * </pre> | 2777 * </pre> |
| 2778 * @param commentAndMetadata the documentation comment and metadata to be asso
ciated with the | 2778 * @param commentAndMetadata the documentation comment and metadata to be asso
ciated with the |
| 2779 * declaration | 2779 * declaration |
| 2780 * @param externalKeyword the 'external' token | 2780 * @param externalKeyword the 'external' token |
| 2781 * @param staticKeyword the static keyword, or {@code null} if the getter is n
ot static | 2781 * @param staticKeyword the static keyword, or `null` if the getter is not sta
tic |
| 2782 * @param the return type that has already been parsed, or {@code null} if the
re was no return | 2782 * @param the return type that has already been parsed, or `null` if there was
no return |
| 2783 * type | 2783 * type |
| 2784 * @return the getter that was parsed | 2784 * @return the getter that was parsed |
| 2785 */ | 2785 */ |
| 2786 MethodDeclaration parseGetter(CommentAndMetadata commentAndMetadata, Token ext
ernalKeyword, Token staticKeyword, TypeName returnType) { | 2786 MethodDeclaration parseGetter(CommentAndMetadata commentAndMetadata, Token ext
ernalKeyword, Token staticKeyword, TypeName returnType) { |
| 2787 Token propertyKeyword = expect(Keyword.GET); | 2787 Token propertyKeyword = expect(Keyword.GET); |
| 2788 SimpleIdentifier name = parseSimpleIdentifier(); | 2788 SimpleIdentifier name = parseSimpleIdentifier(); |
| 2789 if (matches5(TokenType.OPEN_PAREN) && matches4(peek(), TokenType.CLOSE_PAREN
)) { | 2789 if (matches5(TokenType.OPEN_PAREN) && matches4(peek(), TokenType.CLOSE_PAREN
)) { |
| 2790 reportError7(ParserErrorCode.GETTER_WITH_PARAMETERS, []); | 2790 reportError7(ParserErrorCode.GETTER_WITH_PARAMETERS, []); |
| 2791 advance(); | 2791 advance(); |
| 2792 advance(); | 2792 advance(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2886 * ?? ::= | 2886 * ?? ::= |
| 2887 * 'static'? ('var' | type) initializedIdentifierList ';' | 2887 * 'static'? ('var' | type) initializedIdentifierList ';' |
| 2888 * | 'final' type? initializedIdentifierList ';' | 2888 * | 'final' type? initializedIdentifierList ';' |
| 2889 * initializedIdentifierList ::= | 2889 * initializedIdentifierList ::= |
| 2890 * initializedIdentifier (',' initializedIdentifier) | 2890 * initializedIdentifier (',' initializedIdentifier) |
| 2891 * initializedIdentifier ::= | 2891 * initializedIdentifier ::= |
| 2892 * identifier ('=' expression)? | 2892 * identifier ('=' expression)? |
| 2893 * </pre> | 2893 * </pre> |
| 2894 * @param commentAndMetadata the documentation comment and metadata to be asso
ciated with the | 2894 * @param commentAndMetadata the documentation comment and metadata to be asso
ciated with the |
| 2895 * declaration | 2895 * declaration |
| 2896 * @param staticKeyword the static keyword, or {@code null} if the getter is n
ot static | 2896 * @param staticKeyword the static keyword, or `null` if the getter is not sta
tic |
| 2897 * @param keyword the token representing the 'final', 'const' or 'var' keyword
, or {@code null} if | 2897 * @param keyword the token representing the 'final', 'const' or 'var' keyword
, or `null` if |
| 2898 * there is no keyword | 2898 * there is no keyword |
| 2899 * @param type the type that has already been parsed, or {@code null} if 'var'
was provided | 2899 * @param type the type that has already been parsed, or `null` if 'var' was p
rovided |
| 2900 * @return the getter that was parsed | 2900 * @return the getter that was parsed |
| 2901 */ | 2901 */ |
| 2902 FieldDeclaration parseInitializedIdentifierList(CommentAndMetadata commentAndM
etadata, Token staticKeyword, Token keyword, TypeName type) { | 2902 FieldDeclaration parseInitializedIdentifierList(CommentAndMetadata commentAndM
etadata, Token staticKeyword, Token keyword, TypeName type) { |
| 2903 VariableDeclarationList fieldList = parseVariableDeclarationList2(null, keyw
ord, type); | 2903 VariableDeclarationList fieldList = parseVariableDeclarationList2(null, keyw
ord, type); |
| 2904 return new FieldDeclaration.full(commentAndMetadata.comment, commentAndMetad
ata.metadata, staticKeyword, fieldList, expect2(TokenType.SEMICOLON)); | 2904 return new FieldDeclaration.full(commentAndMetadata.comment, commentAndMetad
ata.metadata, staticKeyword, fieldList, expect2(TokenType.SEMICOLON)); |
| 2905 } | 2905 } |
| 2906 | 2906 |
| 2907 /** | 2907 /** |
| 2908 * Parse an instance creation expression. | 2908 * Parse an instance creation expression. |
| 2909 * <pre> | 2909 * <pre> |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2977 components.add(createSyntheticIdentifier()); | 2977 components.add(createSyntheticIdentifier()); |
| 2978 return new LibraryIdentifier.full(components); | 2978 return new LibraryIdentifier.full(components); |
| 2979 } | 2979 } |
| 2980 | 2980 |
| 2981 /** | 2981 /** |
| 2982 * Parse a list literal. | 2982 * Parse a list literal. |
| 2983 * <pre> | 2983 * <pre> |
| 2984 * listLiteral ::= | 2984 * listLiteral ::= |
| 2985 * 'const'? typeArguments? '\[' (expressionList ','?)? '\]' | 2985 * 'const'? typeArguments? '\[' (expressionList ','?)? '\]' |
| 2986 * </pre> | 2986 * </pre> |
| 2987 * @param modifier the 'const' modifier appearing before the literal, or {@cod
e null} if there is | 2987 * @param modifier the 'const' modifier appearing before the literal, or `null
` if there is |
| 2988 * no modifier | 2988 * no modifier |
| 2989 * @param typeArguments the type arguments appearing before the literal, or {@
code null} if there | 2989 * @param typeArguments the type arguments appearing before the literal, or `n
ull` if there |
| 2990 * are no type arguments | 2990 * are no type arguments |
| 2991 * @return the list literal that was parsed | 2991 * @return the list literal that was parsed |
| 2992 */ | 2992 */ |
| 2993 ListLiteral parseListLiteral(Token modifier, TypeArgumentList typeArguments) { | 2993 ListLiteral parseListLiteral(Token modifier, TypeArgumentList typeArguments) { |
| 2994 if (matches5(TokenType.INDEX)) { | 2994 if (matches5(TokenType.INDEX)) { |
| 2995 BeginToken leftBracket = new BeginToken(TokenType.OPEN_SQUARE_BRACKET, _cu
rrentToken.offset); | 2995 BeginToken leftBracket = new BeginToken(TokenType.OPEN_SQUARE_BRACKET, _cu
rrentToken.offset); |
| 2996 Token rightBracket = new Token(TokenType.CLOSE_SQUARE_BRACKET, _currentTok
en.offset + 1); | 2996 Token rightBracket = new Token(TokenType.CLOSE_SQUARE_BRACKET, _currentTok
en.offset + 1); |
| 2997 leftBracket.endToken = rightBracket; | 2997 leftBracket.endToken = rightBracket; |
| 2998 rightBracket.setNext(_currentToken.next); | 2998 rightBracket.setNext(_currentToken.next); |
| 2999 leftBracket.setNext(rightBracket); | 2999 leftBracket.setNext(rightBracket); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3017 return new ListLiteral.full(modifier, typeArguments, leftBracket, elements,
rightBracket); | 3017 return new ListLiteral.full(modifier, typeArguments, leftBracket, elements,
rightBracket); |
| 3018 } | 3018 } |
| 3019 | 3019 |
| 3020 /** | 3020 /** |
| 3021 * Parse a list or map literal. | 3021 * Parse a list or map literal. |
| 3022 * <pre> | 3022 * <pre> |
| 3023 * listOrMapLiteral ::= | 3023 * listOrMapLiteral ::= |
| 3024 * listLiteral | 3024 * listLiteral |
| 3025 * | mapLiteral | 3025 * | mapLiteral |
| 3026 * </pre> | 3026 * </pre> |
| 3027 * @param modifier the 'const' modifier appearing before the literal, or {@cod
e null} if there is | 3027 * @param modifier the 'const' modifier appearing before the literal, or `null
` if there is |
| 3028 * no modifier | 3028 * no modifier |
| 3029 * @return the list or map literal that was parsed | 3029 * @return the list or map literal that was parsed |
| 3030 */ | 3030 */ |
| 3031 TypedLiteral parseListOrMapLiteral(Token modifier) { | 3031 TypedLiteral parseListOrMapLiteral(Token modifier) { |
| 3032 TypeArgumentList typeArguments = null; | 3032 TypeArgumentList typeArguments = null; |
| 3033 if (matches5(TokenType.LT)) { | 3033 if (matches5(TokenType.LT)) { |
| 3034 typeArguments = parseTypeArgumentList(); | 3034 typeArguments = parseTypeArgumentList(); |
| 3035 } | 3035 } |
| 3036 if (matches5(TokenType.OPEN_CURLY_BRACKET)) { | 3036 if (matches5(TokenType.OPEN_CURLY_BRACKET)) { |
| 3037 return parseMapLiteral(modifier, typeArguments); | 3037 return parseMapLiteral(modifier, typeArguments); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3075 } | 3075 } |
| 3076 return expression; | 3076 return expression; |
| 3077 } | 3077 } |
| 3078 | 3078 |
| 3079 /** | 3079 /** |
| 3080 * Parse a map literal. | 3080 * Parse a map literal. |
| 3081 * <pre> | 3081 * <pre> |
| 3082 * mapLiteral ::= | 3082 * mapLiteral ::= |
| 3083 * 'const'? typeArguments? '{' (mapLiteralEntry (',' mapLiteralEntry)* ','?)?
'}' | 3083 * 'const'? typeArguments? '{' (mapLiteralEntry (',' mapLiteralEntry)* ','?)?
'}' |
| 3084 * </pre> | 3084 * </pre> |
| 3085 * @param modifier the 'const' modifier appearing before the literal, or {@cod
e null} if there is | 3085 * @param modifier the 'const' modifier appearing before the literal, or `null
` if there is |
| 3086 * no modifier | 3086 * no modifier |
| 3087 * @param typeArguments the type arguments that were declared, or {@code null}
if there are no | 3087 * @param typeArguments the type arguments that were declared, or `null` if th
ere are no |
| 3088 * type arguments | 3088 * type arguments |
| 3089 * @return the map literal that was parsed | 3089 * @return the map literal that was parsed |
| 3090 */ | 3090 */ |
| 3091 MapLiteral parseMapLiteral(Token modifier, TypeArgumentList typeArguments) { | 3091 MapLiteral parseMapLiteral(Token modifier, TypeArgumentList typeArguments) { |
| 3092 if (typeArguments != null) { | 3092 if (typeArguments != null) { |
| 3093 int num = typeArguments.arguments.length; | 3093 int num = typeArguments.arguments.length; |
| 3094 if (num != 2) { | 3094 if (num != 2) { |
| 3095 reportError(ParserErrorCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS, typeArgumen
ts, [num]); | 3095 reportError(ParserErrorCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS, typeArgumen
ts, [num]); |
| 3096 } | 3096 } |
| 3097 } | 3097 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3129 /** | 3129 /** |
| 3130 * Parse a method declaration. | 3130 * Parse a method declaration. |
| 3131 * <pre> | 3131 * <pre> |
| 3132 * functionDeclaration ::= | 3132 * functionDeclaration ::= |
| 3133 * 'external'? 'static'? functionSignature functionBody | 3133 * 'external'? 'static'? functionSignature functionBody |
| 3134 * | 'external'? functionSignature ';' | 3134 * | 'external'? functionSignature ';' |
| 3135 * </pre> | 3135 * </pre> |
| 3136 * @param commentAndMetadata the documentation comment and metadata to be asso
ciated with the | 3136 * @param commentAndMetadata the documentation comment and metadata to be asso
ciated with the |
| 3137 * declaration | 3137 * declaration |
| 3138 * @param externalKeyword the 'external' token | 3138 * @param externalKeyword the 'external' token |
| 3139 * @param staticKeyword the static keyword, or {@code null} if the getter is n
ot static | 3139 * @param staticKeyword the static keyword, or `null` if the getter is not sta
tic |
| 3140 * @param returnType the return type of the method | 3140 * @param returnType the return type of the method |
| 3141 * @return the method declaration that was parsed | 3141 * @return the method declaration that was parsed |
| 3142 */ | 3142 */ |
| 3143 MethodDeclaration parseMethodDeclaration(CommentAndMetadata commentAndMetadata
, Token externalKeyword, Token staticKeyword, TypeName returnType) { | 3143 MethodDeclaration parseMethodDeclaration(CommentAndMetadata commentAndMetadata
, Token externalKeyword, Token staticKeyword, TypeName returnType) { |
| 3144 SimpleIdentifier methodName = parseSimpleIdentifier(); | 3144 SimpleIdentifier methodName = parseSimpleIdentifier(); |
| 3145 FormalParameterList parameters = parseFormalParameterList(); | 3145 FormalParameterList parameters = parseFormalParameterList(); |
| 3146 validateFormalParameterList(parameters); | 3146 validateFormalParameterList(parameters); |
| 3147 return parseMethodDeclaration2(commentAndMetadata, externalKeyword, staticKe
yword, returnType, methodName, parameters); | 3147 return parseMethodDeclaration2(commentAndMetadata, externalKeyword, staticKe
yword, returnType, methodName, parameters); |
| 3148 } | 3148 } |
| 3149 | 3149 |
| 3150 /** | 3150 /** |
| 3151 * Parse a method declaration. | 3151 * Parse a method declaration. |
| 3152 * <pre> | 3152 * <pre> |
| 3153 * functionDeclaration ::= | 3153 * functionDeclaration ::= |
| 3154 * ('external' 'static'?)? functionSignature functionBody | 3154 * ('external' 'static'?)? functionSignature functionBody |
| 3155 * | 'external'? functionSignature ';' | 3155 * | 'external'? functionSignature ';' |
| 3156 * </pre> | 3156 * </pre> |
| 3157 * @param commentAndMetadata the documentation comment and metadata to be asso
ciated with the | 3157 * @param commentAndMetadata the documentation comment and metadata to be asso
ciated with the |
| 3158 * declaration | 3158 * declaration |
| 3159 * @param externalKeyword the 'external' token | 3159 * @param externalKeyword the 'external' token |
| 3160 * @param staticKeyword the static keyword, or {@code null} if the getter is n
ot static | 3160 * @param staticKeyword the static keyword, or `null` if the getter is not sta
tic |
| 3161 * @param returnType the return type of the method | 3161 * @param returnType the return type of the method |
| 3162 * @param name the name of the method | 3162 * @param name the name of the method |
| 3163 * @param parameters the parameters to the method | 3163 * @param parameters the parameters to the method |
| 3164 * @return the method declaration that was parsed | 3164 * @return the method declaration that was parsed |
| 3165 */ | 3165 */ |
| 3166 MethodDeclaration parseMethodDeclaration2(CommentAndMetadata commentAndMetadat
a, Token externalKeyword, Token staticKeyword, TypeName returnType, SimpleIdenti
fier name, FormalParameterList parameters) { | 3166 MethodDeclaration parseMethodDeclaration2(CommentAndMetadata commentAndMetadat
a, Token externalKeyword, Token staticKeyword, TypeName returnType, SimpleIdenti
fier name, FormalParameterList parameters) { |
| 3167 FunctionBody body = parseFunctionBody(externalKeyword != null || staticKeywo
rd == null, ParserErrorCode.MISSING_FUNCTION_BODY, false); | 3167 FunctionBody body = parseFunctionBody(externalKeyword != null || staticKeywo
rd == null, ParserErrorCode.MISSING_FUNCTION_BODY, false); |
| 3168 if (externalKeyword != null) { | 3168 if (externalKeyword != null) { |
| 3169 if (body is! EmptyFunctionBody) { | 3169 if (body is! EmptyFunctionBody) { |
| 3170 reportError(ParserErrorCode.EXTERNAL_METHOD_WITH_BODY, body, []); | 3170 reportError(ParserErrorCode.EXTERNAL_METHOD_WITH_BODY, body, []); |
| 3171 } | 3171 } |
| 3172 } else if (staticKeyword != null) { | 3172 } else if (staticKeyword != null) { |
| 3173 if (body is EmptyFunctionBody) { | 3173 if (body is EmptyFunctionBody) { |
| 3174 reportError(ParserErrorCode.ABSTRACT_STATIC_METHOD, body, []); | 3174 reportError(ParserErrorCode.ABSTRACT_STATIC_METHOD, body, []); |
| 3175 } | 3175 } |
| 3176 } | 3176 } |
| 3177 return new MethodDeclaration.full(commentAndMetadata.comment, commentAndMeta
data.metadata, externalKeyword, staticKeyword, returnType, null, null, name, par
ameters, body); | 3177 return new MethodDeclaration.full(commentAndMetadata.comment, commentAndMeta
data.metadata, externalKeyword, staticKeyword, returnType, null, null, name, par
ameters, body); |
| 3178 } | 3178 } |
| 3179 | 3179 |
| 3180 /** | 3180 /** |
| 3181 * Parse the modifiers preceding a declaration. This method allows the modifie
rs to appear in any | 3181 * Parse the modifiers preceding a declaration. This method allows the modifie
rs to appear in any |
| 3182 * order but does generate errors for duplicated modifiers. Checks for other p
roblems, such as | 3182 * order but does generate errors for duplicated modifiers. Checks for other p
roblems, such as |
| 3183 * having the modifiers appear in the wrong order or specifying both 'const' a
nd 'final', are | 3183 * having the modifiers appear in the wrong order or specifying both 'const' a
nd 'final', are |
| 3184 * reported in one of the methods whose name is prefixed with {@code validateM
odifiersFor}. | 3184 * reported in one of the methods whose name is prefixed with `validateModifie
rsFor`. |
| 3185 * <pre> | 3185 * <pre> |
| 3186 * modifiers ::= | 3186 * modifiers ::= |
| 3187 * ('abstract' | 'const' | 'external' | 'factory' | 'final' | 'static' | 'var'
) | 3187 * ('abstract' | 'const' | 'external' | 'factory' | 'final' | 'static' | 'var'
) |
| 3188 * </pre> | 3188 * </pre> |
| 3189 * @return the modifiers that were parsed | 3189 * @return the modifiers that were parsed |
| 3190 */ | 3190 */ |
| 3191 Modifiers parseModifiers() { | 3191 Modifiers parseModifiers() { |
| 3192 Modifiers modifiers = new Modifiers(); | 3192 Modifiers modifiers = new Modifiers(); |
| 3193 bool progress = true; | 3193 bool progress = true; |
| 3194 while (progress) { | 3194 while (progress) { |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3435 * Parse an operator declaration. | 3435 * Parse an operator declaration. |
| 3436 * <pre> | 3436 * <pre> |
| 3437 * operatorDeclaration ::= | 3437 * operatorDeclaration ::= |
| 3438 * operatorSignature (';' | functionBody) | 3438 * operatorSignature (';' | functionBody) |
| 3439 * operatorSignature ::= | 3439 * operatorSignature ::= |
| 3440 * 'external'? returnType? 'operator' operator formalParameterList | 3440 * 'external'? returnType? 'operator' operator formalParameterList |
| 3441 * </pre> | 3441 * </pre> |
| 3442 * @param commentAndMetadata the documentation comment and metadata to be asso
ciated with the | 3442 * @param commentAndMetadata the documentation comment and metadata to be asso
ciated with the |
| 3443 * declaration | 3443 * declaration |
| 3444 * @param externalKeyword the 'external' token | 3444 * @param externalKeyword the 'external' token |
| 3445 * @param the return type that has already been parsed, or {@code null} if the
re was no return | 3445 * @param the return type that has already been parsed, or `null` if there was
no return |
| 3446 * type | 3446 * type |
| 3447 * @return the operator declaration that was parsed | 3447 * @return the operator declaration that was parsed |
| 3448 */ | 3448 */ |
| 3449 MethodDeclaration parseOperator(CommentAndMetadata commentAndMetadata, Token e
xternalKeyword, TypeName returnType) { | 3449 MethodDeclaration parseOperator(CommentAndMetadata commentAndMetadata, Token e
xternalKeyword, TypeName returnType) { |
| 3450 Token operatorKeyword; | 3450 Token operatorKeyword; |
| 3451 if (matches(Keyword.OPERATOR)) { | 3451 if (matches(Keyword.OPERATOR)) { |
| 3452 operatorKeyword = andAdvance; | 3452 operatorKeyword = andAdvance; |
| 3453 } else { | 3453 } else { |
| 3454 reportError8(ParserErrorCode.MISSING_KEYWORD_OPERATOR, _currentToken, []); | 3454 reportError8(ParserErrorCode.MISSING_KEYWORD_OPERATOR, _currentToken, []); |
| 3455 operatorKeyword = createSyntheticToken(Keyword.OPERATOR); | 3455 operatorKeyword = createSyntheticToken(Keyword.OPERATOR); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 3468 FormalParameterList parameters = parseFormalParameterList(); | 3468 FormalParameterList parameters = parseFormalParameterList(); |
| 3469 validateFormalParameterList(parameters); | 3469 validateFormalParameterList(parameters); |
| 3470 FunctionBody body = parseFunctionBody(true, ParserErrorCode.MISSING_FUNCTION
_BODY, false); | 3470 FunctionBody body = parseFunctionBody(true, ParserErrorCode.MISSING_FUNCTION
_BODY, false); |
| 3471 if (externalKeyword != null && body is! EmptyFunctionBody) { | 3471 if (externalKeyword != null && body is! EmptyFunctionBody) { |
| 3472 reportError7(ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY, []); | 3472 reportError7(ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY, []); |
| 3473 } | 3473 } |
| 3474 return new MethodDeclaration.full(commentAndMetadata.comment, commentAndMeta
data.metadata, externalKeyword, null, returnType, null, operatorKeyword, name, p
arameters, body); | 3474 return new MethodDeclaration.full(commentAndMetadata.comment, commentAndMeta
data.metadata, externalKeyword, null, returnType, null, operatorKeyword, name, p
arameters, body); |
| 3475 } | 3475 } |
| 3476 | 3476 |
| 3477 /** | 3477 /** |
| 3478 * Parse a return type if one is given, otherwise return {@code null} without
advancing. | 3478 * Parse a return type if one is given, otherwise return `null` without advanc
ing. |
| 3479 * @return the return type that was parsed | 3479 * @return the return type that was parsed |
| 3480 */ | 3480 */ |
| 3481 TypeName parseOptionalReturnType() { | 3481 TypeName parseOptionalReturnType() { |
| 3482 if (matches(Keyword.VOID)) { | 3482 if (matches(Keyword.VOID)) { |
| 3483 return parseReturnType(); | 3483 return parseReturnType(); |
| 3484 } else if (matchesIdentifier() && !matches(Keyword.GET) && !matches(Keyword.
SET) && !matches(Keyword.OPERATOR) && (matchesIdentifier2(peek()) || matches4(pe
ek(), TokenType.LT))) { | 3484 } else if (matchesIdentifier() && !matches(Keyword.GET) && !matches(Keyword.
SET) && !matches(Keyword.OPERATOR) && (matchesIdentifier2(peek()) || matches4(pe
ek(), TokenType.LT))) { |
| 3485 return parseReturnType(); | 3485 return parseReturnType(); |
| 3486 } else if (matchesIdentifier() && matches4(peek(), TokenType.PERIOD) && matc
hesIdentifier2(peek2(2)) && (matchesIdentifier2(peek2(3)) || matches4(peek2(3),
TokenType.LT))) { | 3486 } else if (matchesIdentifier() && matches4(peek(), TokenType.PERIOD) && matc
hesIdentifier2(peek2(2)) && (matchesIdentifier2(peek2(3)) || matches4(peek2(3),
TokenType.LT))) { |
| 3487 return parseReturnType(); | 3487 return parseReturnType(); |
| 3488 } | 3488 } |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3766 * Parse a setter. | 3766 * Parse a setter. |
| 3767 * <pre> | 3767 * <pre> |
| 3768 * setter ::= | 3768 * setter ::= |
| 3769 * setterSignature functionBody? | 3769 * setterSignature functionBody? |
| 3770 * setterSignature ::= | 3770 * setterSignature ::= |
| 3771 * 'external'? 'static'? returnType? 'set' identifier formalParameterList | 3771 * 'external'? 'static'? returnType? 'set' identifier formalParameterList |
| 3772 * </pre> | 3772 * </pre> |
| 3773 * @param commentAndMetadata the documentation comment and metadata to be asso
ciated with the | 3773 * @param commentAndMetadata the documentation comment and metadata to be asso
ciated with the |
| 3774 * declaration | 3774 * declaration |
| 3775 * @param externalKeyword the 'external' token | 3775 * @param externalKeyword the 'external' token |
| 3776 * @param staticKeyword the static keyword, or {@code null} if the setter is n
ot static | 3776 * @param staticKeyword the static keyword, or `null` if the setter is not sta
tic |
| 3777 * @param the return type that has already been parsed, or {@code null} if the
re was no return | 3777 * @param the return type that has already been parsed, or `null` if there was
no return |
| 3778 * type | 3778 * type |
| 3779 * @return the setter that was parsed | 3779 * @return the setter that was parsed |
| 3780 */ | 3780 */ |
| 3781 MethodDeclaration parseSetter(CommentAndMetadata commentAndMetadata, Token ext
ernalKeyword, Token staticKeyword, TypeName returnType) { | 3781 MethodDeclaration parseSetter(CommentAndMetadata commentAndMetadata, Token ext
ernalKeyword, Token staticKeyword, TypeName returnType) { |
| 3782 Token propertyKeyword = expect(Keyword.SET); | 3782 Token propertyKeyword = expect(Keyword.SET); |
| 3783 SimpleIdentifier name = parseSimpleIdentifier(); | 3783 SimpleIdentifier name = parseSimpleIdentifier(); |
| 3784 FormalParameterList parameters = parseFormalParameterList(); | 3784 FormalParameterList parameters = parseFormalParameterList(); |
| 3785 validateFormalParameterList(parameters); | 3785 validateFormalParameterList(parameters); |
| 3786 FunctionBody body = parseFunctionBody(externalKeyword != null || staticKeywo
rd == null, ParserErrorCode.STATIC_SETTER_WITHOUT_BODY, false); | 3786 FunctionBody body = parseFunctionBody(externalKeyword != null || staticKeywo
rd == null, ParserErrorCode.STATIC_SETTER_WITHOUT_BODY, false); |
| 3787 if (externalKeyword != null && body is! EmptyFunctionBody) { | 3787 if (externalKeyword != null && body is! EmptyFunctionBody) { |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4316 FinalConstVarOrType holder = parseFinalConstVarOrType(false); | 4316 FinalConstVarOrType holder = parseFinalConstVarOrType(false); |
| 4317 return parseVariableDeclarationList2(commentAndMetadata, holder.keyword, hol
der.type); | 4317 return parseVariableDeclarationList2(commentAndMetadata, holder.keyword, hol
der.type); |
| 4318 } | 4318 } |
| 4319 | 4319 |
| 4320 /** | 4320 /** |
| 4321 * Parse a variable declaration list. | 4321 * Parse a variable declaration list. |
| 4322 * <pre> | 4322 * <pre> |
| 4323 * variableDeclarationList ::= | 4323 * variableDeclarationList ::= |
| 4324 * finalConstVarOrType variableDeclaration (',' variableDeclaration) | 4324 * finalConstVarOrType variableDeclaration (',' variableDeclaration) |
| 4325 * </pre> | 4325 * </pre> |
| 4326 * @param commentAndMetadata the metadata to be associated with the variable d
eclaration list, or{@code null} if there is no attempt at parsing the comment an
d metadata | 4326 * @param commentAndMetadata the metadata to be associated with the variable d
eclaration list, or`null` if there is no attempt at parsing the comment and meta
data |
| 4327 * @param keyword the token representing the 'final', 'const' or 'var' keyword
, or {@code null} if | 4327 * @param keyword the token representing the 'final', 'const' or 'var' keyword
, or `null` if |
| 4328 * there is no keyword | 4328 * there is no keyword |
| 4329 * @param type the type of the variables in the list | 4329 * @param type the type of the variables in the list |
| 4330 * @return the variable declaration list that was parsed | 4330 * @return the variable declaration list that was parsed |
| 4331 */ | 4331 */ |
| 4332 VariableDeclarationList parseVariableDeclarationList2(CommentAndMetadata comme
ntAndMetadata, Token keyword, TypeName type) { | 4332 VariableDeclarationList parseVariableDeclarationList2(CommentAndMetadata comme
ntAndMetadata, Token keyword, TypeName type) { |
| 4333 List<VariableDeclaration> variables = new List<VariableDeclaration>(); | 4333 List<VariableDeclaration> variables = new List<VariableDeclaration>(); |
| 4334 variables.add(parseVariableDeclaration()); | 4334 variables.add(parseVariableDeclaration()); |
| 4335 while (matches5(TokenType.COMMA)) { | 4335 while (matches5(TokenType.COMMA)) { |
| 4336 advance(); | 4336 advance(); |
| 4337 variables.add(parseVariableDeclaration()); | 4337 variables.add(parseVariableDeclaration()); |
| 4338 } | 4338 } |
| 4339 return new VariableDeclarationList.full(commentAndMetadata != null ? comment
AndMetadata.comment : null, commentAndMetadata != null ? commentAndMetadata.meta
data : null, keyword, type, variables); | 4339 return new VariableDeclarationList.full(commentAndMetadata != null ? comment
AndMetadata.comment : null, commentAndMetadata != null ? commentAndMetadata.meta
data : null, keyword, type, variables); |
| 4340 } | 4340 } |
| 4341 | 4341 |
| 4342 /** | 4342 /** |
| 4343 * Parse a variable declaration statement. | 4343 * Parse a variable declaration statement. |
| 4344 * <pre> | 4344 * <pre> |
| 4345 * variableDeclarationStatement ::= | 4345 * variableDeclarationStatement ::= |
| 4346 * variableDeclarationList ';' | 4346 * variableDeclarationList ';' |
| 4347 * </pre> | 4347 * </pre> |
| 4348 * @param commentAndMetadata the metadata to be associated with the variable d
eclaration | 4348 * @param commentAndMetadata the metadata to be associated with the variable d
eclaration |
| 4349 * statement, or {@code null} if there is no attempt at parsing the comment an
d metadata | 4349 * statement, or `null` if there is no attempt at parsing the comment and meta
data |
| 4350 * @return the variable declaration statement that was parsed | 4350 * @return the variable declaration statement that was parsed |
| 4351 */ | 4351 */ |
| 4352 VariableDeclarationStatement parseVariableDeclarationStatement(CommentAndMetad
ata commentAndMetadata) { | 4352 VariableDeclarationStatement parseVariableDeclarationStatement(CommentAndMetad
ata commentAndMetadata) { |
| 4353 VariableDeclarationList variableList = parseVariableDeclarationList(commentA
ndMetadata); | 4353 VariableDeclarationList variableList = parseVariableDeclarationList(commentA
ndMetadata); |
| 4354 Token semicolon = expect2(TokenType.SEMICOLON); | 4354 Token semicolon = expect2(TokenType.SEMICOLON); |
| 4355 return new VariableDeclarationStatement.full(variableList, semicolon); | 4355 return new VariableDeclarationStatement.full(variableList, semicolon); |
| 4356 } | 4356 } |
| 4357 | 4357 |
| 4358 /** | 4358 /** |
| 4359 * Parse a variable declaration statement. | 4359 * Parse a variable declaration statement. |
| 4360 * <pre> | 4360 * <pre> |
| 4361 * variableDeclarationStatement ::= | 4361 * variableDeclarationStatement ::= |
| 4362 * variableDeclarationList ';' | 4362 * variableDeclarationList ';' |
| 4363 * </pre> | 4363 * </pre> |
| 4364 * @param commentAndMetadata the metadata to be associated with the variable d
eclaration | 4364 * @param commentAndMetadata the metadata to be associated with the variable d
eclaration |
| 4365 * statement, or {@code null} if there is no attempt at parsing the comment an
d metadata | 4365 * statement, or `null` if there is no attempt at parsing the comment and meta
data |
| 4366 * @param keyword the token representing the 'final', 'const' or 'var' keyword
, or {@code null} if | 4366 * @param keyword the token representing the 'final', 'const' or 'var' keyword
, or `null` if |
| 4367 * there is no keyword | 4367 * there is no keyword |
| 4368 * @param type the type of the variables in the list | 4368 * @param type the type of the variables in the list |
| 4369 * @return the variable declaration statement that was parsed | 4369 * @return the variable declaration statement that was parsed |
| 4370 */ | 4370 */ |
| 4371 VariableDeclarationStatement parseVariableDeclarationStatement2(CommentAndMeta
data commentAndMetadata, Token keyword, TypeName type) { | 4371 VariableDeclarationStatement parseVariableDeclarationStatement2(CommentAndMeta
data commentAndMetadata, Token keyword, TypeName type) { |
| 4372 VariableDeclarationList variableList = parseVariableDeclarationList2(comment
AndMetadata, keyword, type); | 4372 VariableDeclarationList variableList = parseVariableDeclarationList2(comment
AndMetadata, keyword, type); |
| 4373 Token semicolon = expect2(TokenType.SEMICOLON); | 4373 Token semicolon = expect2(TokenType.SEMICOLON); |
| 4374 return new VariableDeclarationStatement.full(variableList, semicolon); | 4374 return new VariableDeclarationStatement.full(variableList, semicolon); |
| 4375 } | 4375 } |
| 4376 | 4376 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4409 Token with2 = expect(Keyword.WITH); | 4409 Token with2 = expect(Keyword.WITH); |
| 4410 List<TypeName> types = new List<TypeName>(); | 4410 List<TypeName> types = new List<TypeName>(); |
| 4411 types.add(parseTypeName()); | 4411 types.add(parseTypeName()); |
| 4412 while (optional(TokenType.COMMA)) { | 4412 while (optional(TokenType.COMMA)) { |
| 4413 types.add(parseTypeName()); | 4413 types.add(parseTypeName()); |
| 4414 } | 4414 } |
| 4415 return new WithClause.full(with2, types); | 4415 return new WithClause.full(with2, types); |
| 4416 } | 4416 } |
| 4417 | 4417 |
| 4418 /** | 4418 /** |
| 4419 * Return the token that is immediately after the current token. This is equiv
alent to{@link #peek(int) peek(1)}. | 4419 * Return the token that is immediately after the current token. This is equiv
alent to[peek]. |
| 4420 * @return the token that is immediately after the current token | 4420 * @return the token that is immediately after the current token |
| 4421 */ | 4421 */ |
| 4422 Token peek() => _currentToken.next; | 4422 Token peek() => _currentToken.next; |
| 4423 | 4423 |
| 4424 /** | 4424 /** |
| 4425 * Return the token that is the given distance after the current token. | 4425 * Return the token that is the given distance after the current token. |
| 4426 * @param distance the number of tokens to look ahead, where {@code 0} is the
current token,{@code 1} is the next token, etc. | 4426 * @param distance the number of tokens to look ahead, where `0` is the curren
t token,`1` is the next token, etc. |
| 4427 * @return the token that is the given distance after the current token | 4427 * @return the token that is the given distance after the current token |
| 4428 */ | 4428 */ |
| 4429 Token peek2(int distance) { | 4429 Token peek2(int distance) { |
| 4430 Token token = _currentToken; | 4430 Token token = _currentToken; |
| 4431 for (int i = 0; i < distance; i++) { | 4431 for (int i = 0; i < distance; i++) { |
| 4432 token = token.next; | 4432 token = token.next; |
| 4433 } | 4433 } |
| 4434 return token; | 4434 return token; |
| 4435 } | 4435 } |
| 4436 | 4436 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 4459 * @param token the token specifying the location of the error | 4459 * @param token the token specifying the location of the error |
| 4460 * @param arguments the arguments to the error, used to compose the error mess
age | 4460 * @param arguments the arguments to the error, used to compose the error mess
age |
| 4461 */ | 4461 */ |
| 4462 void reportError8(ParserErrorCode errorCode, Token token, List<Object> argumen
ts) { | 4462 void reportError8(ParserErrorCode errorCode, Token token, List<Object> argumen
ts) { |
| 4463 _errorListener.onError(new AnalysisError.con2(_source, token.offset, token.l
ength, errorCode, arguments)); | 4463 _errorListener.onError(new AnalysisError.con2(_source, token.offset, token.l
ength, errorCode, arguments)); |
| 4464 } | 4464 } |
| 4465 | 4465 |
| 4466 /** | 4466 /** |
| 4467 * Parse the 'final', 'const', 'var' or type preceding a variable declaration,
starting at the | 4467 * Parse the 'final', 'const', 'var' or type preceding a variable declaration,
starting at the |
| 4468 * given token, without actually creating a type or changing the current token
. Return the token | 4468 * given token, without actually creating a type or changing the current token
. Return the token |
| 4469 * following the type that was parsed, or {@code null} if the given token is n
ot the first token | 4469 * following the type that was parsed, or `null` if the given token is not the
first token |
| 4470 * in a valid type. | 4470 * in a valid type. |
| 4471 * <pre> | 4471 * <pre> |
| 4472 * finalConstVarOrType ::= | 4472 * finalConstVarOrType ::= |
| 4473 * | 'final' type? | 4473 * | 'final' type? |
| 4474 * | 'const' type? | 4474 * | 'const' type? |
| 4475 * | 'var' | 4475 * | 'var' |
| 4476 * | type | 4476 * | type |
| 4477 * </pre> | 4477 * </pre> |
| 4478 * @param startToken the token at which parsing is to begin | 4478 * @param startToken the token at which parsing is to begin |
| 4479 * @return the token following the type that was parsed | 4479 * @return the token following the type that was parsed |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4491 if (matchesIdentifier2(next) || matches4(next, TokenType.LT) || matches3(n
ext, Keyword.THIS) || (matches4(next, TokenType.PERIOD) && matchesIdentifier2(ne
xt.next) && (matchesIdentifier2(next.next.next) || matches4(next.next.next, Toke
nType.LT) || matches3(next.next.next, Keyword.THIS)))) { | 4491 if (matchesIdentifier2(next) || matches4(next, TokenType.LT) || matches3(n
ext, Keyword.THIS) || (matches4(next, TokenType.PERIOD) && matchesIdentifier2(ne
xt.next) && (matchesIdentifier2(next.next.next) || matches4(next.next.next, Toke
nType.LT) || matches3(next.next.next, Keyword.THIS)))) { |
| 4492 return skipReturnType(startToken); | 4492 return skipReturnType(startToken); |
| 4493 } | 4493 } |
| 4494 } | 4494 } |
| 4495 return null; | 4495 return null; |
| 4496 } | 4496 } |
| 4497 | 4497 |
| 4498 /** | 4498 /** |
| 4499 * Parse a list of formal parameters, starting at the given token, without act
ually creating a | 4499 * Parse a list of formal parameters, starting at the given token, without act
ually creating a |
| 4500 * formal parameter list or changing the current token. Return the token follo
wing the formal | 4500 * formal parameter list or changing the current token. Return the token follo
wing the formal |
| 4501 * parameter list that was parsed, or {@code null} if the given token is not t
he first token in a | 4501 * parameter list that was parsed, or `null` if the given token is not the fir
st token in a |
| 4502 * valid list of formal parameter. | 4502 * valid list of formal parameter. |
| 4503 * <p> | 4503 * |
| 4504 * Note that unlike other skip methods, this method uses a heuristic. In the w
orst case, the | 4504 * Note that unlike other skip methods, this method uses a heuristic. In the w
orst case, the |
| 4505 * parameters could be prefixed by metadata, which would require us to be able
to skip arbitrary | 4505 * parameters could be prefixed by metadata, which would require us to be able
to skip arbitrary |
| 4506 * expressions. Rather than duplicate the logic of most of the parse methods w
e simply look for | 4506 * expressions. Rather than duplicate the logic of most of the parse methods w
e simply look for |
| 4507 * something that is likely to be a list of parameters and then skip to return
ing the token after | 4507 * something that is likely to be a list of parameters and then skip to return
ing the token after |
| 4508 * the closing parenthesis. | 4508 * the closing parenthesis. |
| 4509 * <p> | 4509 * |
| 4510 * This method must be kept in sync with {@link #parseFormalParameterList()}. | 4510 * This method must be kept in sync with [parseFormalParameterList]. |
| 4511 * <pre> | 4511 * <pre> |
| 4512 * formalParameterList ::= | 4512 * formalParameterList ::= |
| 4513 * '(' ')' | 4513 * '(' ')' |
| 4514 * | '(' normalFormalParameters (',' optionalFormalParameters)? ')' | 4514 * | '(' normalFormalParameters (',' optionalFormalParameters)? ')' |
| 4515 * | '(' optionalFormalParameters ')' | 4515 * | '(' optionalFormalParameters ')' |
| 4516 * normalFormalParameters ::= | 4516 * normalFormalParameters ::= |
| 4517 * normalFormalParameter (',' normalFormalParameter) | 4517 * normalFormalParameter (',' normalFormalParameter) |
| 4518 * optionalFormalParameters ::= | 4518 * optionalFormalParameters ::= |
| 4519 * optionalPositionalFormalParameters | 4519 * optionalPositionalFormalParameters |
| 4520 * | namedFormalParameters | 4520 * | namedFormalParameters |
| (...skipping 27 matching lines...) Expand all Loading... |
| 4548 return null; | 4548 return null; |
| 4549 } | 4549 } |
| 4550 if (skipSimpleIdentifier(afterType) == null) { | 4550 if (skipSimpleIdentifier(afterType) == null) { |
| 4551 return null; | 4551 return null; |
| 4552 } | 4552 } |
| 4553 return skipPastMatchingToken(startToken); | 4553 return skipPastMatchingToken(startToken); |
| 4554 } | 4554 } |
| 4555 | 4555 |
| 4556 /** | 4556 /** |
| 4557 * If the given token is a begin token with an associated end token, then retu
rn the token | 4557 * If the given token is a begin token with an associated end token, then retu
rn the token |
| 4558 * following the end token. Otherwise, return {@code null}. | 4558 * following the end token. Otherwise, return `null`. |
| 4559 * @param startToken the token that is assumed to be a being token | 4559 * @param startToken the token that is assumed to be a being token |
| 4560 * @return the token following the matching end token | 4560 * @return the token following the matching end token |
| 4561 */ | 4561 */ |
| 4562 Token skipPastMatchingToken(Token startToken) { | 4562 Token skipPastMatchingToken(Token startToken) { |
| 4563 if (startToken is! BeginToken) { | 4563 if (startToken is! BeginToken) { |
| 4564 return null; | 4564 return null; |
| 4565 } | 4565 } |
| 4566 Token closeParen = ((startToken as BeginToken)).endToken; | 4566 Token closeParen = ((startToken as BeginToken)).endToken; |
| 4567 if (closeParen == null) { | 4567 if (closeParen == null) { |
| 4568 return null; | 4568 return null; |
| 4569 } | 4569 } |
| 4570 return closeParen.next; | 4570 return closeParen.next; |
| 4571 } | 4571 } |
| 4572 | 4572 |
| 4573 /** | 4573 /** |
| 4574 * Parse a prefixed identifier, starting at the given token, without actually
creating a prefixed | 4574 * Parse a prefixed identifier, starting at the given token, without actually
creating a prefixed |
| 4575 * identifier or changing the current token. Return the token following the pr
efixed identifier | 4575 * identifier or changing the current token. Return the token following the pr
efixed identifier |
| 4576 * that was parsed, or {@code null} if the given token is not the first token
in a valid prefixed | 4576 * that was parsed, or `null` if the given token is not the first token in a v
alid prefixed |
| 4577 * identifier. | 4577 * identifier. |
| 4578 * <p> | 4578 * |
| 4579 * This method must be kept in sync with {@link #parsePrefixedIdentifier()}. | 4579 * This method must be kept in sync with [parsePrefixedIdentifier]. |
| 4580 * <pre> | 4580 * <pre> |
| 4581 * prefixedIdentifier ::= | 4581 * prefixedIdentifier ::= |
| 4582 * identifier ('.' identifier)? | 4582 * identifier ('.' identifier)? |
| 4583 * </pre> | 4583 * </pre> |
| 4584 * @param startToken the token at which parsing is to begin | 4584 * @param startToken the token at which parsing is to begin |
| 4585 * @return the token following the prefixed identifier that was parsed | 4585 * @return the token following the prefixed identifier that was parsed |
| 4586 */ | 4586 */ |
| 4587 Token skipPrefixedIdentifier(Token startToken) { | 4587 Token skipPrefixedIdentifier(Token startToken) { |
| 4588 Token token = skipSimpleIdentifier(startToken); | 4588 Token token = skipSimpleIdentifier(startToken); |
| 4589 if (token == null) { | 4589 if (token == null) { |
| 4590 return null; | 4590 return null; |
| 4591 } else if (!matches4(token, TokenType.PERIOD)) { | 4591 } else if (!matches4(token, TokenType.PERIOD)) { |
| 4592 return token; | 4592 return token; |
| 4593 } | 4593 } |
| 4594 return skipSimpleIdentifier(token.next); | 4594 return skipSimpleIdentifier(token.next); |
| 4595 } | 4595 } |
| 4596 | 4596 |
| 4597 /** | 4597 /** |
| 4598 * Parse a return type, starting at the given token, without actually creating
a return type or | 4598 * Parse a return type, starting at the given token, without actually creating
a return type or |
| 4599 * changing the current token. Return the token following the return type that
was parsed, or{@code null} if the given token is not the first token in a valid
return type. | 4599 * changing the current token. Return the token following the return type that
was parsed, or`null` if the given token is not the first token in a valid retur
n type. |
| 4600 * <p> | 4600 * |
| 4601 * This method must be kept in sync with {@link #parseReturnType()}. | 4601 * This method must be kept in sync with [parseReturnType]. |
| 4602 * <pre> | 4602 * <pre> |
| 4603 * returnType ::= | 4603 * returnType ::= |
| 4604 * 'void' | 4604 * 'void' |
| 4605 * | type | 4605 * | type |
| 4606 * </pre> | 4606 * </pre> |
| 4607 * @param startToken the token at which parsing is to begin | 4607 * @param startToken the token at which parsing is to begin |
| 4608 * @return the token following the return type that was parsed | 4608 * @return the token following the return type that was parsed |
| 4609 */ | 4609 */ |
| 4610 Token skipReturnType(Token startToken) { | 4610 Token skipReturnType(Token startToken) { |
| 4611 if (matches3(startToken, Keyword.VOID)) { | 4611 if (matches3(startToken, Keyword.VOID)) { |
| 4612 return startToken.next; | 4612 return startToken.next; |
| 4613 } else { | 4613 } else { |
| 4614 return skipTypeName(startToken); | 4614 return skipTypeName(startToken); |
| 4615 } | 4615 } |
| 4616 } | 4616 } |
| 4617 | 4617 |
| 4618 /** | 4618 /** |
| 4619 * Parse a simple identifier, starting at the given token, without actually cr
eating a simple | 4619 * Parse a simple identifier, starting at the given token, without actually cr
eating a simple |
| 4620 * identifier or changing the current token. Return the token following the si
mple identifier that | 4620 * identifier or changing the current token. Return the token following the si
mple identifier that |
| 4621 * was parsed, or {@code null} if the given token is not the first token in a
valid simple | 4621 * was parsed, or `null` if the given token is not the first token in a valid
simple |
| 4622 * identifier. | 4622 * identifier. |
| 4623 * <p> | 4623 * |
| 4624 * This method must be kept in sync with {@link #parseSimpleIdentifier()}. | 4624 * This method must be kept in sync with [parseSimpleIdentifier]. |
| 4625 * <pre> | 4625 * <pre> |
| 4626 * identifier ::= | 4626 * identifier ::= |
| 4627 * IDENTIFIER | 4627 * IDENTIFIER |
| 4628 * </pre> | 4628 * </pre> |
| 4629 * @param startToken the token at which parsing is to begin | 4629 * @param startToken the token at which parsing is to begin |
| 4630 * @return the token following the simple identifier that was parsed | 4630 * @return the token following the simple identifier that was parsed |
| 4631 */ | 4631 */ |
| 4632 Token skipSimpleIdentifier(Token startToken) { | 4632 Token skipSimpleIdentifier(Token startToken) { |
| 4633 if (matches4(startToken, TokenType.IDENTIFIER) || (matches4(startToken, Toke
nType.KEYWORD) && ((startToken as KeywordToken)).keyword.isPseudoKeyword())) { | 4633 if (matches4(startToken, TokenType.IDENTIFIER) || (matches4(startToken, Toke
nType.KEYWORD) && ((startToken as KeywordToken)).keyword.isPseudoKeyword())) { |
| 4634 return startToken.next; | 4634 return startToken.next; |
| 4635 } | 4635 } |
| 4636 return null; | 4636 return null; |
| 4637 } | 4637 } |
| 4638 | 4638 |
| 4639 /** | 4639 /** |
| 4640 * Parse a string literal that contains interpolations, starting at the given
token, without | 4640 * Parse a string literal that contains interpolations, starting at the given
token, without |
| 4641 * actually creating a string literal or changing the current token. Return th
e token following | 4641 * actually creating a string literal or changing the current token. Return th
e token following |
| 4642 * the string literal that was parsed, or {@code null} if the given token is n
ot the first token | 4642 * the string literal that was parsed, or `null` if the given token is not the
first token |
| 4643 * in a valid string literal. | 4643 * in a valid string literal. |
| 4644 * <p> | 4644 * |
| 4645 * This method must be kept in sync with {@link #parseStringInterpolation(Toke
n)}. | 4645 * This method must be kept in sync with [parseStringInterpolation]. |
| 4646 * @param startToken the token at which parsing is to begin | 4646 * @param startToken the token at which parsing is to begin |
| 4647 * @return the string literal that was parsed | 4647 * @return the string literal that was parsed |
| 4648 */ | 4648 */ |
| 4649 Token skipStringInterpolation(Token startToken) { | 4649 Token skipStringInterpolation(Token startToken) { |
| 4650 Token token = startToken; | 4650 Token token = startToken; |
| 4651 TokenType type = token.type; | 4651 TokenType type = token.type; |
| 4652 while (identical(type, TokenType.STRING_INTERPOLATION_EXPRESSION) || identic
al(type, TokenType.STRING_INTERPOLATION_IDENTIFIER)) { | 4652 while (identical(type, TokenType.STRING_INTERPOLATION_EXPRESSION) || identic
al(type, TokenType.STRING_INTERPOLATION_IDENTIFIER)) { |
| 4653 if (identical(type, TokenType.STRING_INTERPOLATION_EXPRESSION)) { | 4653 if (identical(type, TokenType.STRING_INTERPOLATION_EXPRESSION)) { |
| 4654 token = token.next; | 4654 token = token.next; |
| 4655 type = token.type; | 4655 type = token.type; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 4685 token = token.next; | 4685 token = token.next; |
| 4686 type = token.type; | 4686 type = token.type; |
| 4687 } | 4687 } |
| 4688 } | 4688 } |
| 4689 return token; | 4689 return token; |
| 4690 } | 4690 } |
| 4691 | 4691 |
| 4692 /** | 4692 /** |
| 4693 * Parse a string literal, starting at the given token, without actually creat
ing a string literal | 4693 * Parse a string literal, starting at the given token, without actually creat
ing a string literal |
| 4694 * or changing the current token. Return the token following the string litera
l that was parsed, | 4694 * or changing the current token. Return the token following the string litera
l that was parsed, |
| 4695 * or {@code null} if the given token is not the first token in a valid string
literal. | 4695 * or `null` if the given token is not the first token in a valid string liter
al. |
| 4696 * <p> | 4696 * |
| 4697 * This method must be kept in sync with {@link #parseStringLiteral()}. | 4697 * This method must be kept in sync with [parseStringLiteral]. |
| 4698 * <pre> | 4698 * <pre> |
| 4699 * stringLiteral ::= | 4699 * stringLiteral ::= |
| 4700 * MULTI_LINE_STRING+ | 4700 * MULTI_LINE_STRING+ |
| 4701 * | SINGLE_LINE_STRING+ | 4701 * | SINGLE_LINE_STRING+ |
| 4702 * </pre> | 4702 * </pre> |
| 4703 * @param startToken the token at which parsing is to begin | 4703 * @param startToken the token at which parsing is to begin |
| 4704 * @return the token following the string literal that was parsed | 4704 * @return the token following the string literal that was parsed |
| 4705 */ | 4705 */ |
| 4706 Token skipStringLiteral(Token startToken) { | 4706 Token skipStringLiteral(Token startToken) { |
| 4707 Token token = startToken; | 4707 Token token = startToken; |
| 4708 while (token != null && matches4(token, TokenType.STRING)) { | 4708 while (token != null && matches4(token, TokenType.STRING)) { |
| 4709 token = token.next; | 4709 token = token.next; |
| 4710 TokenType type = token.type; | 4710 TokenType type = token.type; |
| 4711 if (identical(type, TokenType.STRING_INTERPOLATION_EXPRESSION) || identica
l(type, TokenType.STRING_INTERPOLATION_IDENTIFIER)) { | 4711 if (identical(type, TokenType.STRING_INTERPOLATION_EXPRESSION) || identica
l(type, TokenType.STRING_INTERPOLATION_IDENTIFIER)) { |
| 4712 token = skipStringInterpolation(token); | 4712 token = skipStringInterpolation(token); |
| 4713 } | 4713 } |
| 4714 } | 4714 } |
| 4715 if (identical(token, startToken)) { | 4715 if (identical(token, startToken)) { |
| 4716 return null; | 4716 return null; |
| 4717 } | 4717 } |
| 4718 return token; | 4718 return token; |
| 4719 } | 4719 } |
| 4720 | 4720 |
| 4721 /** | 4721 /** |
| 4722 * Parse a list of type arguments, starting at the given token, without actual
ly creating a type argument list | 4722 * Parse a list of type arguments, starting at the given token, without actual
ly creating a type argument list |
| 4723 * or changing the current token. Return the token following the type argument
list that was parsed, | 4723 * or changing the current token. Return the token following the type argument
list that was parsed, |
| 4724 * or {@code null} if the given token is not the first token in a valid type a
rgument list. | 4724 * or `null` if the given token is not the first token in a valid type argumen
t list. |
| 4725 * <p> | 4725 * |
| 4726 * This method must be kept in sync with {@link #parseTypeArgumentList()}. | 4726 * This method must be kept in sync with [parseTypeArgumentList]. |
| 4727 * <pre> | 4727 * <pre> |
| 4728 * typeArguments ::= | 4728 * typeArguments ::= |
| 4729 * '<' typeList '>' | 4729 * '<' typeList '>' |
| 4730 * typeList ::= | 4730 * typeList ::= |
| 4731 * type (',' type) | 4731 * type (',' type) |
| 4732 * </pre> | 4732 * </pre> |
| 4733 * @param startToken the token at which parsing is to begin | 4733 * @param startToken the token at which parsing is to begin |
| 4734 * @return the token following the type argument list that was parsed | 4734 * @return the token following the type argument list that was parsed |
| 4735 */ | 4735 */ |
| 4736 Token skipTypeArgumentList(Token startToken) { | 4736 Token skipTypeArgumentList(Token startToken) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 4753 } else if (identical(token.type, TokenType.GT_GT)) { | 4753 } else if (identical(token.type, TokenType.GT_GT)) { |
| 4754 Token second = new Token(TokenType.GT, token.offset + 1); | 4754 Token second = new Token(TokenType.GT, token.offset + 1); |
| 4755 second.setNextWithoutSettingPrevious(token.next); | 4755 second.setNextWithoutSettingPrevious(token.next); |
| 4756 return second; | 4756 return second; |
| 4757 } | 4757 } |
| 4758 return null; | 4758 return null; |
| 4759 } | 4759 } |
| 4760 | 4760 |
| 4761 /** | 4761 /** |
| 4762 * Parse a type name, starting at the given token, without actually creating a
type name or | 4762 * Parse a type name, starting at the given token, without actually creating a
type name or |
| 4763 * changing the current token. Return the token following the type name that w
as parsed, or{@code null} if the given token is not the first token in a valid t
ype name. | 4763 * changing the current token. Return the token following the type name that w
as parsed, or`null` if the given token is not the first token in a valid type na
me. |
| 4764 * <p> | 4764 * |
| 4765 * This method must be kept in sync with {@link #parseTypeName()}. | 4765 * This method must be kept in sync with [parseTypeName]. |
| 4766 * <pre> | 4766 * <pre> |
| 4767 * type ::= | 4767 * type ::= |
| 4768 * qualified typeArguments? | 4768 * qualified typeArguments? |
| 4769 * </pre> | 4769 * </pre> |
| 4770 * @param startToken the token at which parsing is to begin | 4770 * @param startToken the token at which parsing is to begin |
| 4771 * @return the token following the type name that was parsed | 4771 * @return the token following the type name that was parsed |
| 4772 */ | 4772 */ |
| 4773 Token skipTypeName(Token startToken) { | 4773 Token skipTypeName(Token startToken) { |
| 4774 Token token = skipPrefixedIdentifier(startToken); | 4774 Token token = skipPrefixedIdentifier(startToken); |
| 4775 if (token == null) { | 4775 if (token == null) { |
| 4776 return null; | 4776 return null; |
| 4777 } | 4777 } |
| 4778 if (matches4(token, TokenType.LT)) { | 4778 if (matches4(token, TokenType.LT)) { |
| 4779 token = skipTypeArgumentList(token); | 4779 token = skipTypeArgumentList(token); |
| 4780 } | 4780 } |
| 4781 return token; | 4781 return token; |
| 4782 } | 4782 } |
| 4783 | 4783 |
| 4784 /** | 4784 /** |
| 4785 * Parse a list of type parameters, starting at the given token, without actua
lly creating a type | 4785 * Parse a list of type parameters, starting at the given token, without actua
lly creating a type |
| 4786 * parameter list or changing the current token. Return the token following th
e type parameter | 4786 * parameter list or changing the current token. Return the token following th
e type parameter |
| 4787 * list that was parsed, or {@code null} if the given token is not the first t
oken in a valid type | 4787 * list that was parsed, or `null` if the given token is not the first token i
n a valid type |
| 4788 * parameter list. | 4788 * parameter list. |
| 4789 * <p> | 4789 * |
| 4790 * This method must be kept in sync with {@link #parseTypeParameterList()}. | 4790 * This method must be kept in sync with [parseTypeParameterList]. |
| 4791 * <pre> | 4791 * <pre> |
| 4792 * typeParameterList ::= | 4792 * typeParameterList ::= |
| 4793 * '<' typeParameter (',' typeParameter)* '>' | 4793 * '<' typeParameter (',' typeParameter)* '>' |
| 4794 * </pre> | 4794 * </pre> |
| 4795 * @param startToken the token at which parsing is to begin | 4795 * @param startToken the token at which parsing is to begin |
| 4796 * @return the token following the type parameter list that was parsed | 4796 * @return the token following the type parameter list that was parsed |
| 4797 */ | 4797 */ |
| 4798 Token skipTypeParameterList(Token startToken) { | 4798 Token skipTypeParameterList(Token startToken) { |
| 4799 if (!matches4(startToken, TokenType.LT)) { | 4799 if (!matches4(startToken, TokenType.LT)) { |
| 4800 return null; | 4800 return null; |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5192 int get length => 0; | 5192 int get length => 0; |
| 5193 } | 5193 } |
| 5194 class AnalysisErrorListener_11 implements AnalysisErrorListener { | 5194 class AnalysisErrorListener_11 implements AnalysisErrorListener { |
| 5195 List<bool> errorFound; | 5195 List<bool> errorFound; |
| 5196 AnalysisErrorListener_11(this.errorFound); | 5196 AnalysisErrorListener_11(this.errorFound); |
| 5197 void onError(AnalysisError error) { | 5197 void onError(AnalysisError error) { |
| 5198 errorFound[0] = true; | 5198 errorFound[0] = true; |
| 5199 } | 5199 } |
| 5200 } | 5200 } |
| 5201 /** | 5201 /** |
| 5202 * The enumeration {@code ParserErrorCode} defines the error codes used for erro
rs detected by the | 5202 * The enumeration `ParserErrorCode` defines the error codes used for errors det
ected by the |
| 5203 * parser. The convention for this class is for the name of the error code to in
dicate the problem | 5203 * parser. The convention for this class is for the name of the error code to in
dicate the problem |
| 5204 * that caused the error to be generated and for the error message to explain wh
at is wrong and, | 5204 * that caused the error to be generated and for the error message to explain wh
at is wrong and, |
| 5205 * when appropriate, how the problem can be corrected. | 5205 * when appropriate, how the problem can be corrected. |
| 5206 * @coverage dart.engine.parser | 5206 * @coverage dart.engine.parser |
| 5207 */ | 5207 */ |
| 5208 class ParserErrorCode implements Comparable<ParserErrorCode>, ErrorCode { | 5208 class ParserErrorCode implements Comparable<ParserErrorCode>, ErrorCode { |
| 5209 static final ParserErrorCode ABSTRACT_CLASS_MEMBER = new ParserErrorCode.con2(
'ABSTRACT_CLASS_MEMBER', 0, "Members of classes cannot be declared to be 'abstra
ct'"); | 5209 static final ParserErrorCode ABSTRACT_CLASS_MEMBER = new ParserErrorCode.con2(
'ABSTRACT_CLASS_MEMBER', 0, "Members of classes cannot be declared to be 'abstra
ct'"); |
| 5210 static final ParserErrorCode ABSTRACT_STATIC_METHOD = new ParserErrorCode.con2
('ABSTRACT_STATIC_METHOD', 1, "Static methods cannot be declared to be 'abstract
'"); | 5210 static final ParserErrorCode ABSTRACT_STATIC_METHOD = new ParserErrorCode.con2
('ABSTRACT_STATIC_METHOD', 1, "Static methods cannot be declared to be 'abstract
'"); |
| 5211 static final ParserErrorCode ABSTRACT_TOP_LEVEL_FUNCTION = new ParserErrorCode
.con2('ABSTRACT_TOP_LEVEL_FUNCTION', 2, "Top-level functions cannot be declared
to be 'abstract'"); | 5211 static final ParserErrorCode ABSTRACT_TOP_LEVEL_FUNCTION = new ParserErrorCode
.con2('ABSTRACT_TOP_LEVEL_FUNCTION', 2, "Top-level functions cannot be declared
to be 'abstract'"); |
| 5212 static final ParserErrorCode ABSTRACT_TOP_LEVEL_VARIABLE = new ParserErrorCode
.con2('ABSTRACT_TOP_LEVEL_VARIABLE', 3, "Top-level variables cannot be declared
to be 'abstract'"); | 5212 static final ParserErrorCode ABSTRACT_TOP_LEVEL_VARIABLE = new ParserErrorCode
.con2('ABSTRACT_TOP_LEVEL_VARIABLE', 3, "Top-level variables cannot be declared
to be 'abstract'"); |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6262 for (int i = 0; i < size; i++) { | 6262 for (int i = 0; i < size; i++) { |
| 6263 if (i > 0) { | 6263 if (i > 0) { |
| 6264 _writer.print(separator); | 6264 _writer.print(separator); |
| 6265 } | 6265 } |
| 6266 nodes[i].accept(this); | 6266 nodes[i].accept(this); |
| 6267 } | 6267 } |
| 6268 } | 6268 } |
| 6269 } | 6269 } |
| 6270 } | 6270 } |
| 6271 } | 6271 } |
| OLD | NEW |