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

Side by Side Diff: frog/leg/scanner/parser.dart

Issue 9616058: Implement parsing and resolving of type-variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * An event generating parser of Dart programs. This parser expects 6 * An event generating parser of Dart programs. This parser expects
7 * all tokens in a linked list. 7 * all tokens in a linked list.
8 */ 8 */
9 class Parser { 9 class Parser {
10 final Listener listener; 10 final Listener listener;
11 bool mayParseFunctionExpressions = true; 11 bool mayParseFunctionExpressions = true;
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 311
312 Token parseTypeArgumentsOpt(Token token) { 312 Token parseTypeArgumentsOpt(Token token) {
313 return parseStuff(token, 313 return parseStuff(token,
314 (t) => listener.beginTypeArguments(t), 314 (t) => listener.beginTypeArguments(t),
315 (t) => parseType(t), 315 (t) => parseType(t),
316 (c, bt, et) => listener.endTypeArguments(c, bt, et), 316 (c, bt, et) => listener.endTypeArguments(c, bt, et),
317 (t) => listener.handleNoTypeArguments(t)); 317 (t) => listener.handleNoTypeArguments(t));
318 } 318 }
319 319
320 Token parseTypeVariablesOpt(Token token) { 320 Token parseTypeVariablesOpt(Token token) {
321 if (optional('<', token)) {
322 BeginGroupToken beginGroupToken = token;
323 // TODO(ahe): Parse type variables.
324
325 // For now, skip to the matching '>' if it exists. Otherwise,
326 // don't advance and assume the caller will report some kind of
327 // error.
328 if (beginGroupToken.endGroup !== null) {
329 token = beginGroupToken.endGroup.next;
330 }
331 }
332 listener.handleNoTypeVariables(token);
333 return token;
334 }
335
336 Token parseTypeVariablesOptX(Token token) {
337 return parseStuff(token, 321 return parseStuff(token,
338 (t) => listener.beginTypeVariables(t), 322 (t) => listener.beginTypeVariables(t),
339 (t) => parseTypeVariable(t), 323 (t) => parseTypeVariable(t),
340 (c, bt, et) => listener.endTypeVariables(c, bt, et), 324 (c, bt, et) => listener.endTypeVariables(c, bt, et),
341 (t) => listener.handleNoTypeVariables(t)); 325 (t) => listener.handleNoTypeVariables(t));
342 } 326 }
343 327
344 // TODO(ahe): Clean this up. 328 // TODO(ahe): Clean this up.
345 Token parseStuff(Token token, Function beginStuff, Function stuffParser, 329 Token parseStuff(Token token, Function beginStuff, Function stuffParser,
346 Function endStuff, Function handleNoStuff) { 330 Function endStuff, Function handleNoStuff) {
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 } 1579 }
1596 listener.handleContinueStatement(hasTarget, continueKeyword, token); 1580 listener.handleContinueStatement(hasTarget, continueKeyword, token);
1597 return expectSemicolon(token); 1581 return expectSemicolon(token);
1598 } 1582 }
1599 1583
1600 Token parseEmptyStatement(Token token) { 1584 Token parseEmptyStatement(Token token) {
1601 listener.handleEmptyStatement(token); 1585 listener.handleEmptyStatement(token);
1602 return expectSemicolon(token); 1586 return expectSemicolon(token);
1603 } 1587 }
1604 } 1588 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698