| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 class PartialParser extends Parser { | 5 class PartialParser extends Parser { |
| 6 PartialParser(Listener listener) : super(listener); | 6 PartialParser(Listener listener) : super(listener); |
| 7 | 7 |
| 8 Token parseClassBody(Token token) => skipClassBody(token); | 8 Token parseClassBody(Token token) => skipClassBody(token); |
| 9 | 9 |
| 10 Token fullParseClassBody(Token token) => super.parseClassBody(token); | 10 Token fullParseClassBody(Token token) => super.parseClassBody(token); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 token = token.next; | 74 token = token.next; |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 Token skipClassBody(Token token) { | 78 Token skipClassBody(Token token) { |
| 79 if (!optional('{', token)) { | 79 if (!optional('{', token)) { |
| 80 return listener.expectedClassBodyToSkip(token); | 80 return listener.expectedClassBodyToSkip(token); |
| 81 } | 81 } |
| 82 BeginGroupToken beginGroupToken = token; | 82 BeginGroupToken beginGroupToken = token; |
| 83 assert(beginGroupToken.endGroup === null || | 83 Token endGroup = beginGroupToken.endGroup; |
| 84 beginGroupToken.endGroup.kind === $CLOSE_CURLY_BRACKET); | 84 if (endGroup === null) { |
| 85 return beginGroupToken.endGroup; | 85 return listener.unmatched(beginGroupToken); |
| 86 } else if (endGroup.kind !== $CLOSE_CURLY_BRACKET) { |
| 87 return listener.unmatched(beginGroupToken); |
| 88 } |
| 89 return endGroup; |
| 86 } | 90 } |
| 87 | 91 |
| 88 Token parseFunctionBody(Token token, bool isExpression) { | 92 Token parseFunctionBody(Token token, bool isExpression) { |
| 89 assert(!isExpression); | 93 assert(!isExpression); |
| 90 String value = token.stringValue; | 94 String value = token.stringValue; |
| 91 if (value === ';') { | 95 if (value === ';') { |
| 92 // No body. | 96 // No body. |
| 93 } else if (value === '=>') { | 97 } else if (value === '=>') { |
| 94 token = parseExpression(token.next); | 98 token = parseExpression(token.next); |
| 95 expectSemicolon(token); | 99 expectSemicolon(token); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 112 return token; | 116 return token; |
| 113 } | 117 } |
| 114 return listener.unexpected(token); | 118 return listener.unexpected(token); |
| 115 } | 119 } |
| 116 BeginGroupToken beginGroupToken = token; | 120 BeginGroupToken beginGroupToken = token; |
| 117 Token endToken = beginGroupToken.endGroup; | 121 Token endToken = beginGroupToken.endGroup; |
| 118 listener.endFormalParameters(0, token, endToken); | 122 listener.endFormalParameters(0, token, endToken); |
| 119 return endToken.next; | 123 return endToken.next; |
| 120 } | 124 } |
| 121 } | 125 } |
| OLD | NEW |