booleanLiteral function

Parser<Literal> booleanLiteral()

Implementation

Parser<Literal> booleanLiteral() {
  final wordBoundary = pattern('a-zA-Z0-9_-').not();
  return ((string('true') | string('false')) & wordBoundary.and())
      .map((value) {
        final keyword = value[0] as String;
        return Literal(keyword == 'true', LiteralType.boolean);
      })
      .labeled('booleanLiteral');
}