atom method

Parser<ExpressionNode> atom()
inherited

Atoms: identifiers, literals, parenthesized expressions, tuples, lists, dicts, sets, comprehensions.

Implementation

Parser<ExpressionNode> atom() => [
  ref0(yieldExpression),
  ref0(numberLiteral),
  ref0(stringLiteral),
  ref1(token, '...').map((_) => const ConstantNode(null)), // Ellipsis
  ref0(noneToken).map((_) => const ConstantNode(null)),
  ref0(trueToken).map((_) => const ConstantNode(true)),
  ref0(falseToken).map((_) => const ConstantNode(false)),
  ref0(identifier).map(NameNode.new),
  ref0(enclosedInParen),
  ref0(enclosedInBrackets),
  ref0(enclosedInBraces),
].toChoiceParser();