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 Tokenizer extends CSSTokenizerBase { | 5 class Tokenizer extends CSSTokenizerBase { |
6 TokenKind cssTokens; | 6 TokenKind cssTokens; |
7 | 7 |
8 bool _selectorParsing; | 8 bool _selectorParsing; |
9 | 9 |
10 Tokenizer(SourceFile source, bool skipWhitespace, [int index = 0]) | 10 Tokenizer(SourceFile source, bool skipWhitespace, [int index = 0]) |
11 : super(source, skipWhitespace, index), _selectorParsing = false { | 11 : super(source, skipWhitespace, index), _selectorParsing = false { |
12 cssTokens = new TokenKind(); | 12 cssTokens = new TokenKind(); |
13 } | 13 } |
14 | 14 |
15 int get startIndex() => _startIndex; | 15 int get startIndex => _startIndex; |
16 | 16 |
17 Token next() { | 17 Token next() { |
18 // keep track of our starting position | 18 // keep track of our starting position |
19 _startIndex = _index; | 19 _startIndex = _index; |
20 | 20 |
21 if (_interpStack != null && _interpStack.depth == 0) { | 21 if (_interpStack != null && _interpStack.depth == 0) { |
22 var istack = _interpStack; | 22 var istack = _interpStack; |
23 _interpStack = _interpStack.pop(); | 23 _interpStack = _interpStack.pop(); |
24 | 24 |
25 /* TODO(terry): Enable for variable and string interpolation. | 25 /* TODO(terry): Enable for variable and string interpolation. |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 static bool isHexDigit(int c) { | 306 static bool isHexDigit(int c) { |
307 return (isDigit(c) || (c >= 97/*a*/ && c <= 102/*f*/) | 307 return (isDigit(c) || (c >= 97/*a*/ && c <= 102/*f*/) |
308 || (c >= 65/*A*/ && c <= 70/*F*/)); | 308 || (c >= 65/*A*/ && c <= 70/*F*/)); |
309 } | 309 } |
310 | 310 |
311 static bool isIdentifierPart(int c) { | 311 static bool isIdentifierPart(int c) { |
312 return (isIdentifierStart(c) || isDigit(c) || c == 45 /*-*/); | 312 return (isIdentifierStart(c) || isDigit(c) || c == 45 /*-*/); |
313 } | 313 } |
314 } | 314 } |
315 | 315 |
OLD | NEW |