dot method

void dot()

Implementation

void dot() {
  final char = advance();

  // Lua supports numbers beginning with "." which indicates
  // the leading whole part is a zero. e.g. ".3" == "0.3".
  if (number.hasMatch(peek().lexeme)) {
    final token = parseNumber();
    tokens.add(Token(token.type, token.lexeme, char.pos));
    return;
  }

  if (peek().lexeme == '.') {
    advance();

    if(peek().lexeme == '.') {
      tokens.add(char.toToken(TokenType.kSpread, lexeme: '...'));
    } else {
      tokens.add(char.toToken(TokenType.kConcat, lexeme: '..'));
    }

    return;
  }

  tokens.add(char.toToken(TokenType.kDot));
}