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

Unified Diff: packages/csslib/lib/src/tokenizer_base.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 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 | « packages/csslib/lib/src/tokenizer.dart ('k') | packages/csslib/lib/src/tokenkind.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/csslib/lib/src/tokenizer_base.dart
diff --git a/packages/csslib/lib/src/tokenizer_base.dart b/packages/csslib/lib/src/tokenizer_base.dart
index 663c987d1312265407e2e4c80cf4aaf6410eef29..c2a448fd8e209ca5f1563f19d3270db33de4b966 100644
--- a/packages/csslib/lib/src/tokenizer_base.dart
+++ b/packages/csslib/lib/src/tokenizer_base.dart
@@ -55,8 +55,7 @@ abstract class TokenizerBase {
int _index = 0;
int _startIndex = 0;
- TokenizerBase(this._file, this._text, this._inString,
- [this._index = 0]);
+ TokenizerBase(this._file, this._text, this._inString, [this._index = 0]);
Token next();
int getIdentifierKind();
@@ -80,9 +79,9 @@ abstract class TokenizerBase {
}
}
- int _peekChar() {
- if (_index < _text.length) {
- return _text.codeUnitAt(_index);
+ int _peekChar([int offset = 0]) {
+ if (_index + offset < _text.length) {
+ return _text.codeUnitAt(_index + offset);
} else {
return 0;
}
@@ -101,6 +100,17 @@ abstract class TokenizerBase {
}
}
+ bool _nextCharsAreNumber(int first) {
+ if (TokenizerHelpers.isDigit(first)) return true;
+ var second = _peekChar();
+ if (first == TokenChar.DOT) return TokenizerHelpers.isDigit(second);
+ if (first == TokenChar.PLUS || first == TokenChar.MINUS) {
+ return TokenizerHelpers.isDigit(second) ||
+ (second == TokenChar.DOT && TokenizerHelpers.isDigit(_peekChar(1)));
+ }
+ return false;
+ }
+
Token _finishToken(int kind) {
return new Token(kind, _file.span(_startIndex, _index));
}
« no previous file with comments | « packages/csslib/lib/src/tokenizer.dart ('k') | packages/csslib/lib/src/tokenkind.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698