public abstract class AbstractMatcher extends Object implements Matcher
Modifier and Type | Field and Description |
---|---|
protected int |
effectiveStartMark |
protected LexerParser |
parser |
Constructor and Description |
---|
AbstractMatcher(LexerParser parser) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Checks LexerMatcher and start mark.
|
boolean |
equivalent(Matcher obj)
Equality without start mark.
|
List<ParsingContext.AutoCompleteResult> |
getAutoCompleteOptions(MatchingPhase phase)
Retrieves main autoComplete options from lexer config, if any.
|
protected abstract List<ParsingContext.AutoCompleteResult> |
getAutoCompleteSecondaryOptions(MatchingPhase phase) |
int |
getEffectiveStartMark() |
int |
getEndMark() |
Pattern |
getFollowingCharPattern() |
Grammar |
getGrammar() |
LexerParser |
getLexerParser() |
String |
getMatchedText()
Retrieves text between start of match and end of match.
|
ParsingContext |
getParsingContext() |
Pattern |
getPreviousCharPattern() |
AdvancedReader |
getSource() |
int |
getStartMark() |
Integer |
getWeight() |
protected List<ParsingContext.AutoCompleteResult> |
handleSecondaryOptions(MatchingPhase phase,
AutoCompleteConfiguration lexerAc,
AutoCompleteConfiguration matcherAc,
List<ParsingContext.AutoCompleteResult> autoCompleteSecondaryOptions)
Updates autoComplete groups of the secondary options with the matcher config, of if none with the lexer config.
|
int |
hashCode() |
protected abstract int |
internalMatch(MatchingPhase phase,
boolean unread)
Performs specific part of the match.
|
boolean |
isExcludedFromHierarchy(Matcher matcher)
Tells if the provided matcher should be excluded from this matcher's lexer's 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)
Tells if this match pattern matches the next characters of the source.
|
void |
toBeginParse()
If isSkipMatchText is true, goes to end of match.
|
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() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getFollowingCharPatternMatchResult, getLexerMatcher, getPreviousCharPatternMatchResult, injectResult, isAutoCompletePossible
protected final LexerParser parser
protected int effectiveStartMark
public AbstractMatcher(LexerParser parser)
public final int match(MatchingPhase phase, boolean unread) throws IOException, DslException
Matcher
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
public List<ParsingContext.AutoCompleteResult> getAutoCompleteOptions(MatchingPhase phase) throws DslException, IOException
getAutoCompleteOptions
in interface Matcher
phase
- Phase when the matching is performed.DslException
IOException
protected List<ParsingContext.AutoCompleteResult> handleSecondaryOptions(MatchingPhase phase, AutoCompleteConfiguration lexerAc, AutoCompleteConfiguration matcherAc, List<ParsingContext.AutoCompleteResult> autoCompleteSecondaryOptions)
phase
- lexerAc
- matcherAc
- autoCompleteSecondaryOptions
- protected abstract List<ParsingContext.AutoCompleteResult> getAutoCompleteSecondaryOptions(MatchingPhase phase) throws IOException, DslException
IOException
DslException
protected abstract int internalMatch(MatchingPhase phase, boolean unread) throws IOException, DslException
phase
- Phase is already handled by main match method but is provided as information. It might not be used in general.unread
- Flag is already handled by main match method but is provided as information. It might not be used in general.IOException
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()
toBeginParse
in interface Matcher
public LexerParser getLexerParser()
getLexerParser
in interface Matcher
public Grammar getGrammar()
getGrammar
in interface Matcher
public AdvancedReader getSource()
public ParsingContext getParsingContext()
getParsingContext
in interface Matcher
public Integer getWeight()
public Boolean isMatched()
public int getStartMark()
getStartMark
in interface Matcher
public int getEffectiveStartMark()
getEffectiveStartMark
in interface Matcher
public int getEndMark()
getEndMark
in interface Matcher
public boolean isExcludedFromHierarchy(Matcher matcher) throws DslException
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 boolean equals(Object obj)
public boolean equivalent(Matcher obj)
equivalent
in interface Matcher