option

Given a subrule 'r', represents the expression 'r?'. It tries to match 'r' and if this matches successfully, it returns this match. If 'r' failed, 'r?' is still a success, but without any child nor match.

alias option!(literal!"abc") rule; // Aka '"abc"?'
ParseTree input = ParseTree("",false,[],"abcd");

ParseTree result = rule(input);
assert(result.successful);
assert(result.matches == ["abc"]);
assert(result.children.length == 1);
assert(result.children[0] == literal!"abc"(input));
  1. ParseTree option(ParseTree p)
    template option(alias r)
  2. ParseTree option(string input)
  3. string option(GetName g)

Members

Functions

option
ParseTree option(ParseTree p)
Undocumented in source. Be warned that the author may not have intended to support it.
option
string option(GetName g)
Undocumented in source. Be warned that the author may not have intended to support it.
option
ParseTree option(string input)
Undocumented in source. Be warned that the author may not have intended to support it.

Manifest constants

name
enum name;
Undocumented in source.

Meta