Try to match str
and advance str.length
characters.
Try to match str
and advance str.length
characters.
Reports an error if the input does not match str
or if str.length
goes past the EOF.
Consume/Advance length
characters, and return the consumed characters.
Consume/Advance length
characters, and return the consumed characters. Returns "" if at EOF.
Consume characters until f
returns false on the peek of input.
Consume characters until f
returns false on the peek of input.
- should the stopped character be included in the consumed characters?
the consumed characters
Consume characters until input matches stop
Consume characters until input matches stop
- should stop be included in the consumed characters?
the consumed characters
Does the current input match str
? If so, advance str.length
.
Does the current input match str
? If so, advance str.length
.
Will not advance if str.length
surpasses EOF
true if advancing, false otherwise.
Does f
applied to the current peek return true or false? If true, advance one character.
Does f
applied to the current peek return true or false? If true, advance one character.
Will not advance if at EOF.
true if advancing, false otherwise.
Set the source position of a Positional
Recursively match pairs of prefixes and suffixes and return the consumed characters
Recursively match pairs of prefixes and suffixes and return the consumed characters
Terminates at EOF.
Match zero or more parser
Match a string literal, allowing for escaped quotes.
Match a string literal, allowing for escaped quotes. Terminates at EOF.
TwirlParser is a recursive descent parser for a modified grammar of the Play2 template language as loosely defined here and more rigorously defined by the original template parser,
play.templates.ScalaTemplateCompiler.TemplateParser
. TwirlParser is meant to be a near drop in replacement forplay.templates.ScalaTemplateCompiler.TemplateParser
.The original grammar, as reversed-engineered from
play.templates.ScalaTemplateCompiler.TemplateParser
, is defined as follows:TwirlParser implements a slightly modified version of the above grammar that removes some back-tracking within the 'mixed' non-terminal. It is defined as follows:
TwirlParser can detect several type of parse errors and provides line information. In all cases, the parser will continue parsing the best it can after encountering an error. The following errors are what can be detected: