OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
7 | 7 |
8 library engine.parser; | 8 library engine.parser; |
9 | 9 |
10 import 'dart:collection'; | 10 import 'dart:collection'; |
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 newNode = parent.accept(dispatcher); | 1294 newNode = parent.accept(dispatcher); |
1295 // | 1295 // |
1296 // Validate that the new node can replace the old node. | 1296 // Validate that the new node can replace the old node. |
1297 // | 1297 // |
1298 Token mappedToken = _tokenMap.get(oldNode.endToken.next); | 1298 Token mappedToken = _tokenMap.get(oldNode.endToken.next); |
1299 if (mappedToken == null || mappedToken.offset != newNode.endToken.next.o
ffset || newNode.offset != oldNode.offset) { | 1299 if (mappedToken == null || mappedToken.offset != newNode.endToken.next.o
ffset || newNode.offset != oldNode.offset) { |
1300 advanceToParent = true; | 1300 advanceToParent = true; |
1301 } | 1301 } |
1302 } on InsufficientContextException catch (exception) { | 1302 } on InsufficientContextException catch (exception) { |
1303 advanceToParent = true; | 1303 advanceToParent = true; |
1304 } on JavaException catch (exception) { | 1304 } catch (exception) { |
1305 return null; | 1305 return null; |
1306 } | 1306 } |
1307 if (advanceToParent) { | 1307 if (advanceToParent) { |
1308 newNode = null; | 1308 newNode = null; |
1309 oldNode = parent; | 1309 oldNode = parent; |
1310 originalOffset = oldNode.offset; | 1310 originalOffset = oldNode.offset; |
1311 parseToken = _findTokenAt(parseToken, originalOffset); | 1311 parseToken = _findTokenAt(parseToken, originalOffset); |
1312 parser.currentToken = parseToken; | 1312 parser.currentToken = parseToken; |
1313 } | 1313 } |
1314 } | 1314 } |
(...skipping 2787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4102 return null; | 4102 return null; |
4103 } | 4103 } |
4104 return new CommentReference(newKeyword, identifier); | 4104 return new CommentReference(newKeyword, identifier); |
4105 } else if (_tokenMatchesKeyword(firstToken, Keyword.THIS) || _tokenMatches
Keyword(firstToken, Keyword.NULL) || _tokenMatchesKeyword(firstToken, Keyword.TR
UE) || _tokenMatchesKeyword(firstToken, Keyword.FALSE)) { | 4105 } else if (_tokenMatchesKeyword(firstToken, Keyword.THIS) || _tokenMatches
Keyword(firstToken, Keyword.NULL) || _tokenMatchesKeyword(firstToken, Keyword.TR
UE) || _tokenMatchesKeyword(firstToken, Keyword.FALSE)) { |
4106 // TODO(brianwilkerson) If we want to support this we will need to exten
d the definition | 4106 // TODO(brianwilkerson) If we want to support this we will need to exten
d the definition |
4107 // of CommentReference to take an expression rather than an identifier.
For now we just | 4107 // of CommentReference to take an expression rather than an identifier.
For now we just |
4108 // ignore it to reduce the number of errors produced, but that's probabl
y not a valid | 4108 // ignore it to reduce the number of errors produced, but that's probabl
y not a valid |
4109 // long term approach. | 4109 // long term approach. |
4110 return null; | 4110 return null; |
4111 } | 4111 } |
4112 } on JavaException catch (exception) { | 4112 } catch (exception) { |
4113 } | 4113 } |
4114 return null; | 4114 return null; |
4115 } | 4115 } |
4116 | 4116 |
4117 /** | 4117 /** |
4118 * Parse all of the comment references occurring in the given array of documen
tation comments. | 4118 * Parse all of the comment references occurring in the given array of documen
tation comments. |
4119 * | 4119 * |
4120 * <pre> | 4120 * <pre> |
4121 * commentReference ::= | 4121 * commentReference ::= |
4122 * '[' 'new'? qualified ']' libraryReference? | 4122 * '[' 'new'? qualified ']' libraryReference? |
(...skipping 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6207 expression = new ThisExpression(andAdvance); | 6207 expression = new ThisExpression(andAdvance); |
6208 } else { | 6208 } else { |
6209 expression = parseSimpleIdentifier(); | 6209 expression = parseSimpleIdentifier(); |
6210 } | 6210 } |
6211 elements.add(new InterpolationExpression(openToken, expression, null)); | 6211 elements.add(new InterpolationExpression(openToken, expression, null)); |
6212 } | 6212 } |
6213 if (_matches(TokenType.STRING)) { | 6213 if (_matches(TokenType.STRING)) { |
6214 string = andAdvance; | 6214 string = andAdvance; |
6215 hasMore = _matches(TokenType.STRING_INTERPOLATION_EXPRESSION) || _matche
s(TokenType.STRING_INTERPOLATION_IDENTIFIER); | 6215 hasMore = _matches(TokenType.STRING_INTERPOLATION_EXPRESSION) || _matche
s(TokenType.STRING_INTERPOLATION_IDENTIFIER); |
6216 elements.add(new InterpolationString(string, _computeStringValue(string.
lexeme, false, !hasMore))); | 6216 elements.add(new InterpolationString(string, _computeStringValue(string.
lexeme, false, !hasMore))); |
| 6217 } else { |
| 6218 hasMore = false; |
6217 } | 6219 } |
6218 } | 6220 } |
6219 return new StringInterpolation(elements); | 6221 return new StringInterpolation(elements); |
6220 } | 6222 } |
6221 | 6223 |
6222 /** | 6224 /** |
6223 * Parse a super constructor invocation. | 6225 * Parse a super constructor invocation. |
6224 * | 6226 * |
6225 * <pre> | 6227 * <pre> |
6226 * superConstructorInvocation ::= | 6228 * superConstructorInvocation ::= |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6333 if (_matchesIdentifier()) { | 6335 if (_matchesIdentifier()) { |
6334 components.add(andAdvance); | 6336 components.add(andAdvance); |
6335 } else { | 6337 } else { |
6336 _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER, []); | 6338 _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER, []); |
6337 components.add(_createSyntheticToken(TokenType.IDENTIFIER)); | 6339 components.add(_createSyntheticToken(TokenType.IDENTIFIER)); |
6338 break; | 6340 break; |
6339 } | 6341 } |
6340 } | 6342 } |
6341 } else if (_currentToken.isOperator) { | 6343 } else if (_currentToken.isOperator) { |
6342 components.add(andAdvance); | 6344 components.add(andAdvance); |
| 6345 } else if (_tokenMatchesKeyword(_currentToken, Keyword.VOID)) { |
| 6346 components.add(andAdvance); |
6343 } else { | 6347 } else { |
6344 _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER, []); | 6348 _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER, []); |
6345 components.add(_createSyntheticToken(TokenType.IDENTIFIER)); | 6349 components.add(_createSyntheticToken(TokenType.IDENTIFIER)); |
6346 } | 6350 } |
6347 return new SymbolLiteral(poundSign, new List.from(components)); | 6351 return new SymbolLiteral(poundSign, new List.from(components)); |
6348 } | 6352 } |
6349 | 6353 |
6350 /** | 6354 /** |
6351 * Parse a throw expression. | 6355 * Parse a throw expression. |
6352 * | 6356 * |
(...skipping 3066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9419 return trampoline(target, arguments[0], arguments[1]); | 9423 return trampoline(target, arguments[0], arguments[1]); |
9420 case 3: | 9424 case 3: |
9421 return trampoline(target, arguments[0], arguments[1], arguments[2]); | 9425 return trampoline(target, arguments[0], arguments[1], arguments[2]); |
9422 case 4: | 9426 case 4: |
9423 return trampoline(target, arguments[0], arguments[1], arguments[2], argu
ments[3]); | 9427 return trampoline(target, arguments[0], arguments[1], arguments[2], argu
ments[3]); |
9424 default: | 9428 default: |
9425 throw new IllegalArgumentException("Not implemented for > 4 arguments"); | 9429 throw new IllegalArgumentException("Not implemented for > 4 arguments"); |
9426 } | 9430 } |
9427 } | 9431 } |
9428 } | 9432 } |
OLD | NEW |