Extensions for Superpower parsers.
static
TextParser<T> ThenIgnore<T U> (thisTextParser<T> self,TextParser<U> other)
Try self, and then other. If both succeed then return the value of self.
T
U
self:
other:
returns: The new composite parser.
static
TokenListParser<TKind T> ThenIgnore<TKind T U> (thisTokenListParser<TKind T> self,TokenListParser<TKind U> other)
Parse self, then other, returning the result of self.
TKind
T
U
self:
other:
returns: The new composite parser.
static
TokenListParser<TKind IEnumerable<Source>> SeparatedBy<TKind Source Separator> (thisTokenListParser<TKind Source> source,TokenListParser<TKind Separator> separator)
Parse any number of element separated by the separator element.
TKind The token kind.
Source The type of the source parser.
Separator The type of the separator parser.
source: The source parser.
separator: The separator parser.
returns: The new composite parser.
static
TokenListParser<TKind Source> Between<TKind Source Before After> (thisTokenListParser<TKind Source> source,TokenListParser<TKind Before> before,TokenListParser<TKind After> after)
Parse elements between before and after.
TKind The token kind.
Source The type of the source parser.
Before The type of the before parser.
After The type of the after parser.
source: The source parser.
before: The before parser.
after: The after parser.
returns: The new composite parser.
static
TextParser<Source> Between<Source Other> (thisTextParser<Source> self,TextParser<Other> other)
Parse an element between other.
Source The type of the source parser.
Other The type of the other parser.
self:
other:
returns: The new composite parser.
static
TokenListParser<TKind Source> Between<TKind Source Other> (thisTokenListParser<TKind Source> source,TokenListParser<TKind Other> other)
Parse an element between other.
TKind The token kind.
Source The type of the source parser.
Other The type of the other parser.
source: The source parser.
other: The other parser.
returns: The new composite parser.
static
TextParser<EnumType> EnumParser<EnumType>()
Parse any string matching the name of the provided enum.
EnumType The type of the enum to parse.
returns: The new composite parser.
static
TextParser<string> StringIn (params string[] source)
Return the result if it matches any of the provided source strings.
source: The strings that can be parsed.
returns: The parser for the strings.
static
TextParser<string> AsString (thisTextParser<char> charParser,bool atLeastOnce = false)
Convert the character parser to a string parser.
charParser: The characters that can be parsed.
atLeastOnce: If true then require at least 1 character to succeed.
returns: The new composite parser.
static
TextParser<IEnumerable<Source>> UpTo<Source> (thisTextParser<Source> source,int value)
Parse multiple elements up to the provided value.
Source The type of the source parser.
source: The source parser.
value: The maximum number.
returns: