public abstract class AbstractPackratParser extends AbstractParser implements IPackratParser, Marker.IMarkerClient, ICharSequenceWithOffset, IParsedTokenAcceptor, IHiddenTokenHandler, IConsumerUtility
IParser.NullImpl
IMarkerFactory.IMarker
IHiddenTokenHandler.IHiddenTokenState
EMPTY_HIDDENS
Modifier | Constructor and Description |
---|---|
protected |
AbstractPackratParser(IParseResultFactory parseResultFactory,
IGrammarAccess grammarAccess) |
Modifier and Type | Method and Description |
---|---|
void |
accept(AbstractParsedToken token) |
char |
charAt(int index) |
void |
consumeAction(Action action,
boolean isMany) |
int |
consumeEnum(EnumLiteralDeclaration literal,
ICharacterClass notFollowedBy) |
protected void |
consumeHiddens() |
int |
consumeKeyword(Keyword keyword,
java.lang.String feature,
boolean isMany,
boolean isBoolean,
ICharacterClass notFollowedBy,
boolean optional) |
int |
consumeNonTerminal(INonTerminalConsumer consumer,
java.lang.String feature,
boolean isMany,
boolean isDatatype,
boolean isBoolean,
AbstractElement grammarElement,
boolean optional) |
int |
consumeTerminal(ITerminalConsumer consumer,
java.lang.String feature,
boolean isMany,
boolean isBoolean,
AbstractElement grammarElement,
ISequenceMatcher notMatching,
boolean optional) |
protected java.lang.CharSequence |
createCharSequence(java.io.Reader reader0) |
protected KeywordConsumer |
createKeywordConsumer() |
protected EnumLiteralConsumer |
createLiteralConsumer() |
protected abstract IParserConfiguration |
createParserConfiguration(AbstractParserConfiguration.IInternalParserConfiguration configuration) |
protected IParseResult |
doParse(java.lang.CharSequence sequence) |
protected IParseResult |
doParse(java.io.Reader reader) |
Marker |
getActiveMarker() |
protected IGrammarAccess |
getGrammarAccess() |
java.lang.CharSequence |
getInput() |
Marker |
getNextMarker(Marker parent,
int offset) |
int |
getOffset()
Retrieves the current state of the offset property.
|
protected IParseResultFactory |
getParseResultFactory() |
protected INonTerminalConsumer |
getRootConsumer() |
void |
incOffset()
Increments the offset by one.
|
void |
incOffset(int amount)
Increments the offset by the given amount.
|
int |
length() |
IMarkerFactory.IMarker |
mark()
Creates a new marker.
|
IParseResult |
parse(java.lang.CharSequence input) |
IParseResult |
parse(java.lang.CharSequence input,
INonTerminalConsumer consumer) |
protected IParseResult |
parse(INonTerminalConsumer consumer) |
void |
releaseMarker(Marker marker) |
IHiddenTokenHandler.IHiddenTokenState |
replaceHiddenTokens(ITerminalConsumer... consumers) |
void |
setActiveMarker(Marker marker) |
void |
setOffset(int offset)
Random access to modify the offset.
|
java.lang.CharSequence |
subSequence(int start,
int end) |
doReparse, isReparseSupported, parse, reparse
protected AbstractPackratParser(IParseResultFactory parseResultFactory, IGrammarAccess grammarAccess)
protected abstract IParserConfiguration createParserConfiguration(AbstractParserConfiguration.IInternalParserConfiguration configuration)
protected KeywordConsumer createKeywordConsumer()
protected EnumLiteralConsumer createLiteralConsumer()
public java.lang.CharSequence getInput()
public final IParseResult parse(java.lang.CharSequence input)
parse
in interface IPackratParser
public final IParseResult parse(java.lang.CharSequence input, INonTerminalConsumer consumer)
parse
in interface IPackratParser
protected final IParseResult parse(INonTerminalConsumer consumer)
protected INonTerminalConsumer getRootConsumer()
protected void consumeHiddens()
public IMarkerFactory.IMarker mark()
IMarkerFactory
mark
in interface IMarkerFactory
public Marker getActiveMarker()
getActiveMarker
in interface Marker.IMarkerClient
public Marker getNextMarker(Marker parent, int offset)
getNextMarker
in interface Marker.IMarkerClient
public void setActiveMarker(Marker marker)
setActiveMarker
in interface Marker.IMarkerClient
public void releaseMarker(Marker marker)
releaseMarker
in interface Marker.IMarkerClient
public int consumeKeyword(Keyword keyword, java.lang.String feature, boolean isMany, boolean isBoolean, ICharacterClass notFollowedBy, boolean optional)
consumeKeyword
in interface IConsumerUtility
public int consumeEnum(EnumLiteralDeclaration literal, ICharacterClass notFollowedBy)
consumeEnum
in interface IConsumerUtility
public int consumeTerminal(ITerminalConsumer consumer, java.lang.String feature, boolean isMany, boolean isBoolean, AbstractElement grammarElement, ISequenceMatcher notMatching, boolean optional)
consumeTerminal
in interface IConsumerUtility
public int consumeNonTerminal(INonTerminalConsumer consumer, java.lang.String feature, boolean isMany, boolean isDatatype, boolean isBoolean, AbstractElement grammarElement, boolean optional) throws java.lang.Exception
consumeNonTerminal
in interface IConsumerUtility
java.lang.Exception
public void consumeAction(Action action, boolean isMany)
consumeAction
in interface IConsumerUtility
protected IParseResultFactory getParseResultFactory()
protected IGrammarAccess getGrammarAccess()
public int getOffset()
ICharSequenceWithOffset
getOffset
in interface ICharSequenceWithOffset
public char charAt(int index)
charAt
in interface java.lang.CharSequence
public int length()
length
in interface java.lang.CharSequence
public java.lang.CharSequence subSequence(int start, int end)
subSequence
in interface java.lang.CharSequence
public void incOffset()
ICharSequenceWithOffset
incOffset
in interface ICharSequenceWithOffset
public void incOffset(int amount)
ICharSequenceWithOffset
incOffset
in interface ICharSequenceWithOffset
amount
- the number of offset that should be shifted.public void accept(AbstractParsedToken token)
accept
in interface IParsedTokenAcceptor
public void setOffset(int offset)
ICharSequenceWithOffset
setOffset
in interface ICharSequenceWithOffset
offset
- the new offset.public IHiddenTokenHandler.IHiddenTokenState replaceHiddenTokens(ITerminalConsumer... consumers)
replaceHiddenTokens
in interface IHiddenTokenHandler
protected IParseResult doParse(java.io.Reader reader)
doParse
in class AbstractParser
protected java.lang.CharSequence createCharSequence(java.io.Reader reader0)
protected IParseResult doParse(java.lang.CharSequence sequence)
doParse
in class AbstractParser