Eats a given expression from the start of the working string. If the working
string does not contain the given expression, null
is returned (and not a
blank string). Only eats once, so any expression must be greedy if different
behavior is expected.
The regular expression passed into this function is automatically re-wrapped
with ^(?:<source>)
. Avoid adding these expressions on your own.
The pattern to match.
The capture group to return (returns the entire string (0
) by default)
The consumed characters.
Eats a given expression from the start of the working string. If the working
string does not contain the given expression, null
is returned (and not a
blank string). Only eats once, so any expression must be greedy if different
behavior is expected.
The regular expression passed into this function is automatically re-wrapped
with ^(?:<source>)
. Avoid adding these expressions on your own.
The pattern to match.
A RegExpExecArray.
Continue eating from the string until a string or regular expression
is matched. Unlike eatExpression, passed regular expressions
will not be re-wrapped with ^(?:)
. These must be added on your own if
you wish to match the start of the string.
The string or regular expression to match.
Optional
noFinish: booleanIf set to true
, null
will be returned instead if the
pattern is never matched. The working string will be reset to its original
state if this occurs. This prevents the function from being too greedy.
The consumed characters.
Parses a wikitext contribution survey row into a RawContributionSurveyRow. If invalid, an Error is thrown with relevant information.
Components of a parsed contribution survey row.
Views the next character to ContributionSurveyRowParser#eat.
The first character of the working string.
Parser for ContributionSurveyRows.
This is used directly in unit tests. Do not import unnecessary dependencies, as they may indirectly import the entire Deputy codebase outside a browser environment.