unsignedConstant method

Parser<LiteralExpressionNode> unsignedConstant()

Implementation

Parser<LiteralExpressionNode> unsignedConstant() => [
  ref1(
    token,
    'nil',
  ).map((_) => const LiteralExpressionNode(raw: 'nil', value: null)),
  ref0(stringLiteral).map(
    (s) => LiteralExpressionNode(
      raw: s,
      value: s.length >= 2 && s.startsWith("'") && s.endsWith("'")
          ? s.substring(1, s.length - 1).replaceAll("''", "'")
          : s,
    ),
  ),
  ref0(unsignedNumber)
      .map((n) => LiteralExpressionNode(raw: n.toString(), value: n)),
  ref0(identifier).map((id) => LiteralExpressionNode(raw: id, value: id)),
].toChoiceParser();