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

Side by Side Diff: third_party/pkg/angular/lib/core/parser/tokens.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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
(Empty)
1 part of angular.core.parser.lexer;
2
3 class Token {
4 static const Token EOF = const Token._(-1);
5 final int index;
6 const Token._(this.index);
7
8 bool get isIdentifier => false;
9 bool get isString => false;
10 bool get isNumber => false;
11
12 bool isCharacter(int code) => false;
13 bool isOperator(String operator) => false;
14
15 bool get isKeyword => false;
16 bool get isKeywordNull => false;
17 bool get isKeywordUndefined => false;
18 bool get isKeywordTrue => false;
19 bool get isKeywordFalse => false;
20
21 num toNumber() => null;
22 }
23
24 class CharacterToken extends Token {
25 final int _code;
26 CharacterToken(int index, this._code) : super._(index);
27 bool isCharacter(int code) => _code == code;
28 String toString() => new String.fromCharCode(_code);
29 }
30
31 class IdentifierToken extends Token {
32 final String _text;
33 final bool _isKeyword;
34 IdentifierToken(int index, this._text, this._isKeyword) : super._(index);
35 bool get isIdentifier => !_isKeyword;
36 bool get isKeyword => _isKeyword;
37 bool get isKeywordNull => _isKeyword && _text == "null";
38 bool get isKeywordUndefined => _isKeyword && _text == "undefined";
39 bool get isKeywordTrue => _isKeyword && _text == "true";
40 bool get isKeywordFalse => _isKeyword && _text == "false";
41 String toString() => _text;
42 }
43
44 class OperatorToken extends Token {
45 final String _text;
46 OperatorToken(int index, this._text) : super._(index);
47 bool isOperator(String operator) => _text == operator;
48 String toString() => _text;
49 }
50
51 class NumberToken extends Token {
52 final num _value;
53 NumberToken(int index, this._value) : super._(index);
54 bool get isNumber => true;
55 num toNumber() => _value;
56 String toString() => "$_value";
57 }
58
59 class StringToken extends Token {
60 final String input;
61 final String _value;
62 StringToken(int index, this.input, this._value) : super._(index);
63 bool get isString => true;
64 String toString() => _value;
65 }
OLDNEW
« no previous file with comments | « third_party/pkg/angular/lib/core/parser/syntax.dart ('k') | third_party/pkg/angular/lib/core/parser/unparser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698