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

Unified Diff: mojo/public/dart/third_party/csslib/lib/src/token.dart

Issue 1346773002: Stop running pub get at gclient sync time and fix build bugs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 3 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
Index: mojo/public/dart/third_party/csslib/lib/src/token.dart
diff --git a/mojo/public/dart/third_party/csslib/lib/src/token.dart b/mojo/public/dart/third_party/csslib/lib/src/token.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e30484d589c9f72e3a6c041df38259f560153dcb
--- /dev/null
+++ b/mojo/public/dart/third_party/csslib/lib/src/token.dart
@@ -0,0 +1,65 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+part of csslib.parser;
+
+/**
+ * A single token in the Dart language.
+ */
+class Token {
+ /** A member of [TokenKind] specifying what kind of token this is. */
+ final int kind;
+
+ /** The location where this token was parsed from. */
+ final FileSpan span;
+
+ /** The start offset of this token. */
+ int get start => span.start.offset;
+
+ /** The end offset of this token. */
+ int get end => span.end.offset;
+
+ /** Returns the source text corresponding to this [Token]. */
+ String get text => span.text;
+
+ Token(this.kind, this.span);
+
+ /** Returns a pretty representation of this token for error messages. **/
+ String toString() {
+ var kindText = TokenKind.kindToString(kind);
+ var actualText = text.trim();
+ if (kindText != actualText) {
+ if (actualText.length > 10) {
+ actualText = '${actualText.substring(0, 8)}...';
+ }
+ return '$kindText($actualText)';
+ } else {
+ return kindText;
+ }
+ }
+}
+
+/** A token containing a parsed literal value. */
+class LiteralToken extends Token {
+ var value;
+ LiteralToken(int kind, FileSpan span, this.value) : super(kind, span);
+}
+
+/** A token containing error information. */
+class ErrorToken extends Token {
+ String message;
+ ErrorToken(int kind, FileSpan span, this.message) : super(kind, span);
+}
+
+/**
+ * CSS ident-token.
+ *
+ * See <http://dev.w3.org/csswg/css-syntax/#typedef-ident-token> and
+ * <http://dev.w3.org/csswg/css-syntax/#ident-token-diagram>.
+ */
+class IdentifierToken extends Token {
+ final String text;
+
+ IdentifierToken(this.text, int kind, FileSpan span) : super(kind, span);
+}
« no previous file with comments | « mojo/public/dart/third_party/csslib/lib/src/property.dart ('k') | mojo/public/dart/third_party/csslib/lib/src/tokenizer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698