public abstract class AbstractMatcherWrapper extends Object implements Matcher
getLexerMatcher()
should be overriden to avoid unexpected behaviors.Constructor and Description |
---|
AbstractMatcherWrapper() |
AbstractMatcherWrapper(Matcher wrapped)
Wraps the provided matcher
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
boolean |
equivalent(Matcher obj)
Equality without start mark.
|
List<ParsingContext.AutoCompleteResult> |
getAutoCompleteOptions(MatchingPhase phase)
Computes autoComplete options from current partial matches, if any.
|
int |
getEffectiveStartMark() |
int |
getEndMark() |
Pattern |
getFollowingCharPattern() |
CharPatternMatchResult |
getFollowingCharPatternMatchResult() |
Grammar |
getGrammar() |
LexerMatcher |
getLexerMatcher() |
LexerParser |
getLexerParser() |
String |
getMatchedText()
Retrieves text between start of match and end of match.
|
ParsingContext |
getParsingContext() |
Pattern |
getPreviousCharPattern() |
CharPatternMatchResult |
getPreviousCharPatternMatchResult() |
AdvancedReader |
getSource() |
int |
getStartMark() |
Integer |
getWeight() |
Matcher |
getWrapped() |
int |
hashCode() |
void |
injectResult(Object target)
If the matcher (or one or several of the matchers in the chain) generates an Object, this allows to inject it (or them) into the result.
|
boolean |
isAutoCompletePossible()
Considering match result, tells if autoComplete is possible or not (i.e. if options should be searched or not).
|
boolean |
isExcludedFromHierarchy(Matcher matcher)
Tells if provided sub matcher should be excluded from matching hierarchy.
|
boolean |
isExclusionHierarchyBreaker()
Tells if this matcher should break search for exclusion in older hierarchy.
|
Boolean |
isMatched() |
boolean |
isSkipMatchText() |
int |
match(MatchingPhase phase,
boolean unread)
Can't be overriden in order to force update of matching hierarchy.
|
void |
toBeginParse()
Replaces the source at its state to where the parsing process should begin.
|
void |
toEndOfMatch()
Replaces the source at its state after match ended if successful.
|
void |
toStartOfMatch()
Replaces the source at its state before match started.
|
String |
toString() |
protected int |
wrappedMatch(MatchingPhase phase,
boolean unread)
This method can be overridden if necessary, instead of
match(MatchingPhase, boolean) . |
public AbstractMatcherWrapper()
public AbstractMatcherWrapper(Matcher wrapped)
wrapped
- Matcher to wrappublic final int match(MatchingPhase phase, boolean unread) throws IOException, DslException
match
in interface Matcher
phase
- Phase when the matching is performed.unread
- Tells if the source should be replaced at start after the match operation or not.
If match fails, this parameter is ignored and source is unread.IOException
DslException
wrappedMatch(MatchingPhase, boolean)
protected int wrappedMatch(MatchingPhase phase, boolean unread) throws IOException, DslException
match(MatchingPhase, boolean)
.IOException
DslException
public List<ParsingContext.AutoCompleteResult> getAutoCompleteOptions(MatchingPhase phase) throws IOException, DslException
Matcher
getAutoCompleteOptions
in interface Matcher
phase
- Phase when the matching is performed.IOException
DslException
public boolean isAutoCompletePossible() throws DslException
Matcher
isAutoCompletePossible
in interface Matcher
DslException
public void toStartOfMatch()
Matcher
toStartOfMatch
in interface Matcher
public void toEndOfMatch()
Matcher
toEndOfMatch
in interface Matcher
public String getMatchedText() throws IOException
Matcher
getMatchedText
in interface Matcher
IOException
public void toBeginParse()
Matcher
toBeginParse
in interface Matcher
public Integer getWeight()
public Boolean isMatched()
public CharPatternMatchResult getPreviousCharPatternMatchResult()
getPreviousCharPatternMatchResult
in interface Matcher
public CharPatternMatchResult getFollowingCharPatternMatchResult()
getFollowingCharPatternMatchResult
in interface Matcher
public void injectResult(Object target) throws DslException
Matcher
injectResult
in interface Matcher
DslException
public LexerMatcher getLexerMatcher()
getLexerMatcher
in interface Matcher
public LexerParser getLexerParser()
getLexerParser
in interface Matcher
public ParsingContext getParsingContext()
getParsingContext
in interface Matcher
public Grammar getGrammar()
getGrammar
in interface Matcher
public AdvancedReader getSource()
public int getEffectiveStartMark()
getEffectiveStartMark
in interface Matcher
public int getStartMark()
getStartMark
in interface Matcher
public int getEndMark()
getEndMark
in interface Matcher
public boolean isExcludedFromHierarchy(Matcher matcher) throws DslException
Matcher
isExcludedFromHierarchy
in interface Matcher
DslException
public Pattern getPreviousCharPattern()
getPreviousCharPattern
in interface Matcher
public Pattern getFollowingCharPattern()
getFollowingCharPattern
in interface Matcher
public boolean isSkipMatchText()
isSkipMatchText
in interface Matcher
public boolean isExclusionHierarchyBreaker()
Matcher
isExclusionHierarchyBreaker
in interface Matcher
public Matcher getWrapped()
public boolean equivalent(Matcher obj)
equivalent
in interface Matcher