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

Side by Side Diff: tokenizer.dart

Issue 8400017: Peek past balanced parens to see if they are an expression or lambda. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/frog
Patch Set: expand comments Created 9 years, 1 month 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
« parser.dart ('K') | « tests/frog/frog.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Generated by scripts/tokenizer_gen.py. 4 // Generated by scripts/tokenizer_gen.py.
5 5
6
7 /**
8 */
9 interface TokenSource {
10 Token next();
11 }
12
6 class InterpStack { 13 class InterpStack {
7 InterpStack next, previous; 14 InterpStack next, previous;
8 final int quote; 15 final int quote;
9 final bool isMultiline; 16 final bool isMultiline;
10 int depth; 17 int depth;
11 18
12 InterpStack(this.previous, this.quote, this.isMultiline): depth = -1; 19 InterpStack(this.previous, this.quote, this.isMultiline): depth = -1;
13 20
14 InterpStack pop() { 21 InterpStack pop() {
15 return this.previous; 22 return this.previous;
16 } 23 }
17 24
18 static InterpStack push(InterpStack stack, int quote, bool isMultiline) { 25 static InterpStack push(InterpStack stack, int quote, bool isMultiline) {
19 var newStack = new InterpStack(stack, quote, isMultiline); 26 var newStack = new InterpStack(stack, quote, isMultiline);
20 if (stack != null) newStack.previous = stack; 27 if (stack != null) newStack.previous = stack;
21 return newStack; 28 return newStack;
22 } 29 }
23 } 30 }
24 31
25 /** 32 /**
26 * The base class for our tokenizer. The hand coded parts are in this file, with 33 * The base class for our tokenizer. The hand coded parts are in this file, with
27 * the generated parts in the subclass Tokenizer. 34 * the generated parts in the subclass Tokenizer.
28 */ 35 */
29 class TokenizerBase extends TokenizerHelpers { 36 class TokenizerBase extends TokenizerHelpers implements TokenSource {
30 final SourceFile _source; 37 final SourceFile _source;
31 final bool _skipWhitespace; 38 final bool _skipWhitespace;
32 String _text; 39 String _text;
33 40
34 int _index; 41 int _index;
35 int _startIndex; 42 int _startIndex;
36 43
37 /** Keeps track of string interpolation state. */ 44 /** Keeps track of string interpolation state. */
38 InterpStack _interpStack; 45 InterpStack _interpStack;
39 46
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 if (_interpStack != null && _interpStack.depth == -1) { 391 if (_interpStack != null && _interpStack.depth == -1) {
385 _interpStack.depth = 0; 392 _interpStack.depth = 0;
386 } 393 }
387 if (kind == TokenKind.IDENTIFIER) { 394 if (kind == TokenKind.IDENTIFIER) {
388 return _finishToken(TokenKind.IDENTIFIER); 395 return _finishToken(TokenKind.IDENTIFIER);
389 } else { 396 } else {
390 return _finishToken(kind); 397 return _finishToken(kind);
391 } 398 }
392 } 399 }
393 } 400 }
OLDNEW
« parser.dart ('K') | « tests/frog/frog.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698