consume method

void consume()

Implementation

void consume() {
  token = null;
  type = TokenType.none;
  start = index;
  if (index < source.length) {
    final String? ch = nextChar();
    if (ch != null &&
        (!(checkSingle(ch, '/', TokenType.solidus) ||
            checkSingle(ch, '.', TokenType.period) ||
            checkSingle(ch, '(', TokenType.open) ||
            checkSingle(ch, ')', TokenType.close) ||
            checkAnnotation(ch) ||
            checkNumber(ch) ||
            checkNumberOrSymbol(ch)))) {
      throw UcumException(
          "Error processing unit '$source': unexpected character '$ch' at position $start");
    }
  }
}