platform/packages/graphql/graphql_parser/lib/src/language/token.dart
Tobe O 4e69153e3e Add 'packages/graphql/' from commit '33e2f86ba73d559197b6270df036256104726aca'
git-subtree-dir: packages/graphql
git-subtree-mainline: ac29392d7f
git-subtree-split: 33e2f86ba7
2020-02-15 18:22:07 -05:00

19 lines
387 B
Dart

import 'package:source_span/source_span.dart';
import 'token_type.dart';
class Token {
final TokenType type;
final String text;
FileSpan span;
Token(this.type, this.text, [this.span]);
@override
String toString() {
if (span == null) {
return "'$text' -> $type";
} else {
return "(${span.start.line}:${span.start.column}) '$text' -> $type";
}
}
}