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

Unified Diff: frog/leg/scanner/partial_parser.dart

Issue 9873021: Move frog/leg to lib/compiler/implementation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « frog/leg/scanner/parser_task.dart ('k') | frog/leg/scanner/scanner.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/scanner/partial_parser.dart
===================================================================
--- frog/leg/scanner/partial_parser.dart (revision 5925)
+++ frog/leg/scanner/partial_parser.dart (working copy)
@@ -1,110 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-class PartialParser extends Parser {
- PartialParser(Listener listener) : super(listener);
-
- Token parseClassBody(Token token) => skipClassBody(token);
-
- Token fullParseClassBody(Token token) => super.parseClassBody(token);
-
- Token parseExpression(Token token) => skipExpression(token);
-
- Token skipExpression(Token token) {
- while (true) {
- final kind = token.kind;
- final value = token.stringValue;
- if ((kind === EOF_TOKEN) ||
- (value === ';') ||
- (value === ',') ||
- (value === ']'))
- return token;
- if (value === '=') {
- var nextValue = token.next.stringValue;
- if (nextValue === 'const') {
- token = token.next;
- nextValue = token.next.stringValue;
- }
- if (nextValue === '{') {
- // Handle cases like this:
- // class Foo {
- // var map;
- // Foo() : map = {};
- // }
- BeginGroupToken begin = token.next;
- token = (begin.endGroup !== null) ? begin.endGroup : token;
- token = token.next;
- continue;
- }
- if (nextValue === '<') {
- // Handle cases like this:
- // class Foo {
- // var map;
- // Foo() : map = <Foo>{};
- // }
- BeginGroupToken begin = token.next;
- token = (begin.endGroup !== null) ? begin.endGroup : token;
- token = token.next;
- if (token.stringValue === '{') {
- begin = token;
- token = (begin.endGroup !== null) ? begin.endGroup : token;
- token = token.next;
- }
- continue;
- }
- }
- if (!mayParseFunctionExpressions && value === '{')
- return token;
- if ((value !== '<') && (token is BeginGroupToken)) {
- BeginGroupToken begin = token;
- token = (begin.endGroup !== null) ? begin.endGroup : token;
- }
- token = token.next;
- }
- }
-
- Token skipClassBody(Token token) {
- if (!optional('{', token)) {
- return listener.expectedClassBodyToSkip(token);
- }
- BeginGroupToken beginGroupToken = token;
- assert(beginGroupToken.endGroup === null ||
- beginGroupToken.endGroup.kind === $CLOSE_CURLY_BRACKET);
- return beginGroupToken.endGroup;
- }
-
- Token parseFunctionBody(Token token, bool isExpression) {
- assert(!isExpression);
- String value = token.stringValue;
- if (value === ';') {
- // No body.
- } else if (value === '=>') {
- token = parseExpression(token.next);
- expectSemicolon(token);
- } else {
- token = skipBlock(token);
- }
- // There is no "skipped function body event", so we use
- // handleNoFunctionBody instead.
- listener.handleNoFunctionBody(token);
- return token;
- }
-
- Token parseFormalParameters(Token token) => skipFormals(token);
-
- Token skipFormals(Token token) {
- listener.beginOptionalFormalParameters(token);
- if (!optional('(', token)) {
- if (optional(';', token)) {
- listener.recoverableError("expected '('", token: token);
- return token;
- }
- return listener.unexpected(token);
- }
- BeginGroupToken beginGroupToken = token;
- Token endToken = beginGroupToken.endGroup;
- listener.endFormalParameters(0, token, endToken);
- return endToken.next;
- }
-}
« no previous file with comments | « frog/leg/scanner/parser_task.dart ('k') | frog/leg/scanner/scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698