@Deprecated public abstract class CompositeParser extends DelegateParser
Note, this class is deprecated in favor of GrammarDefinition that provides a more
flexible way to define composite parsers.
To create a new composite grammar subclass CompositeParser. Override the method initialize() and for every production call def(String,
org.petitparser.parser.Parser) giving the parsers a name. The start production must be named
'start'.
To refer to other productions use ref(String). To redefine or attach
actions to productions use redef(String, Function), redef(String, org.petitparser.parser.Parser) and action(String, Function).
delegate| Constructor | Description |
|---|---|
CompositeParser() |
Deprecated.
|
| Modifier and Type | Method | Description |
|---|---|---|
protected <S,T> void |
action(String name,
Function<S,T> function) |
Deprecated.
Attaches an action
function to an existing production name. |
protected void |
def(String name,
Parser parser) |
Deprecated.
Defines a production with a
name and a parser. |
protected abstract void |
initialize() |
Deprecated.
Automatically called by the framework to initialize the grammar.
|
protected void |
redef(String name,
Function<Parser,Parser> function) |
Deprecated.
Redefines an existing production with a
name and a function producing a new
parser. |
protected void |
redef(String name,
Parser parser) |
Deprecated.
Redefines an existing production with a
name and a new parser. |
Parser |
ref(String name) |
Deprecated.
Returns a reference to the production with the given
name. |
copy, getChildren, parseOn, replaceclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaccept, and, callCC, delimitedBy, end, end, flatten, hasEqualChildren, hasEqualProperties, isEqualTo, isEqualTo, map, matches, matchesSkipping, neg, neg, not, not, optional, optional, or, parse, permute, pick, plus, plusGreedy, plusLazy, repeat, repeatGreedy, repeatLazy, separatedBy, seq, settable, star, starGreedy, starLazy, times, token, toString, trim, trim, trimprotected abstract void initialize()
public final Parser ref(String name)
name.
This method works during initialization and after completion of the initialization. During the initialization it returns delegate parsers that are eventually replaced by the real parsers. Afterwards it returns the defined parser (mostly useful for testing).
protected final void def(String name, Parser parser)
name and a parser. Only call this method during
initialization.protected final void redef(String name, Parser parser)
name and a new parser. Only call this
method during initialization.protected final void redef(String name, Function<Parser,Parser> function)
name and a function producing a new
parser. Only call this method during initialization.Copyright © 2018 PetitParser. All rights reserved.