Token constructor

Token(
  1. String line
)

Implementation

Token(String line) {
  final pos = line.indexOf(' ');
  type = line.substring(0, pos);

  if (type.contains('[')) {
    index = int.parse(type.substring(type.indexOf('[') + 1, type.indexOf(']')));
    type = type.substring(0, type.indexOf('['));
  }

  text = _unescape(line.substring(pos + 1).trim());
}