platform/lib/src/language/token.dart

19 lines
375 B
Dart
Raw Normal View History

2017-01-22 23:15:53 +00:00
import 'package:source_span/source_span.dart';
import 'token_type.dart';
class Token {
final TokenType type;
final String text;
2017-07-05 22:44:13 +00:00
FileSpan span;
2017-01-22 23:15:53 +00:00
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";
}
}