idleState function

Function? idleState(
  1. Lexer lexer
)

This is the default state. It routes to the appropriate state for further handling.

Implementation

Function? idleState(Lexer lexer) {
  String chr = lexer.peek();

  if (chr == Token.EOF) {
    return null;
  }

  if (isWhitespace(chr) || isLineTerminator(chr)) {
    lexer.next();
    lexer.ignore();

    return idleState;
  }

  switch (chr) {
    case "@":
      return dateTimeState;
    case "#":
      return metaKeyState;
    case "*":
      return noteState;
    default:
      return valueState;
  }
}