public abstract class CStyleShallowParserBase extends ShallowParserBase<EGenericParserStates>
Modifier and Type | Field and Description |
---|---|
protected static java.util.EnumSet<ETokenType> |
OPERATORS_WITH_ALTERNATIVE_REPRESENTATION
C++ operators that have an alternative (string) representations.
|
Modifier | Constructor and Description |
---|---|
protected |
CStyleShallowParserBase()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
completeSimpleStatement(RecognizerBase<EGenericParserStates> baseRecognizer)
Completes a recognizer for a simple statement.
|
protected void |
completeSimpleStatement(RecognizerBase<EGenericParserStates> baseRecognizer,
java.lang.String subtype)
Completes a recognizer for a simple statement.
|
protected void |
contributeSimpleStatementRules(java.util.EnumSet<ETokenType> localVariableIdentifiers,
java.util.EnumSet<ETokenType> statementStartTokens)
Contributes rules for detecting simple statements (local variable
declarations, assignments, etc.) inside methods.
|
protected void |
createBasicBlockRules()
Block constructs, such as if/else, while/for/switch, try/catch/finally,
synchronized (only in some languages).
|
protected void |
createBlockRuleWithContinuation(java.util.EnumSet<ETokenType> startTokens,
java.util.EnumSet<ETokenType> continuationTokens,
boolean canBeFollowedByParentheses,
boolean alwaysBraces)
Creates a rule for recognizing a statement starting with a single keyword,
optionally followed by an expression in parentheses, and followed by a block
or a single statement.
|
protected void |
createCaseRule()
Case statement is parsed as meta, as it is hardly a statement on its own.
|
protected abstract void |
createClassElementsRules()
Parser rules for both attributes and methods.
|
protected void |
createDoWhileRule()
Creates the do-while rule.
|
protected void |
createElseIfRule()
Special rule for else-if.
|
protected void |
createLambdaWithArrowRules(ETokenType arrowType)
Creates rules for parsing lambdas with arrows like in Java or C#.
|
protected void |
createMetaRules()
Creates rules for meta elements.
|
protected void |
createSimpleStatementRule()
Simple statement.
|
protected void |
createStatementRules()
Creates parser rules for statements.
|
protected void |
createSubExpressionRules()
Creates rules for dealing with constructs in subexpressions, such as
anonymous classes, lambdas, etc.
|
protected void |
createTypedefRules()
Creates rules for C style typedef
|
protected void |
createTypeRules()
Parser rules for module/namespace and type creation.
|
protected abstract java.util.EnumSet<ETokenType> |
getSimpleBlockKeywordsWithoutParentheses()
Returns the set of all keywords that start a simple block but are never
followed by parentheses (see implementers for examples).
|
protected abstract java.util.EnumSet<ETokenType> |
getSimpleBlockKeywordsWithParentheses()
Returns the set of all keywords that start a simple block with optional
parentheses (see implementers for examples).
|
protected abstract java.util.EnumSet<ETokenType> |
getStatementStartTokens()
Returns a set of all tokens that can start a statement, besides a type (see
typePatternInState(EGenericParserStates...) and a literal. |
protected RecognizerBase<EGenericParserStates> |
getSubExpressionRecognizer()
Returns a recognizer used for detecting sub expressions (anonymous classes,
lambdas, etc.) within expressions.
|
protected abstract java.util.EnumSet<ETokenType> |
getTypeKeywords()
Returns the set of keywords that start a type.
|
protected java.util.EnumSet<ETokenType> |
getTypeModifier()
Returns the valid type modifiers for the language.
|
protected java.util.EnumSet<ETokenType> |
getValidIdentifiers()
Returns the set of all valid identifiers, i.e.
|
static int |
skipOptionalParameters(java.util.List<IToken> tokens,
int currentOffset)
Skips over the optional parameters and returns the new offset or
RecognizerBase.NO_MATCH if it is malformed. |
protected abstract RecognizerBase<EGenericParserStates> |
typePattern(RecognizerBase<EGenericParserStates> currentState)
Creates a recognizer that matches all valid types.
|
protected RecognizerBase<EGenericParserStates> |
typePatternInState(EGenericParserStates... states)
Creates a recognizer that matches all valid types, starting from the given
state.
|
createRecognizer, endWithPossibleContinuation, filterTokens, inAnyState, inState, isFilteredToken, parse, parseFragment, parseTopLevel
protected static final java.util.EnumSet<ETokenType> OPERATORS_WITH_ALTERNATIVE_REPRESENTATION
protected CStyleShallowParserBase()
protected void createMetaRules()
protected void createTypeRules()
protected void createTypedefRules()
protected java.util.EnumSet<ETokenType> getTypeModifier()
protected abstract java.util.EnumSet<ETokenType> getTypeKeywords()
protected abstract void createClassElementsRules()
protected void createStatementRules()
protected void createElseIfRule()
protected void createBasicBlockRules()
protected void createCaseRule()
protected void createDoWhileRule()
protected void contributeSimpleStatementRules(java.util.EnumSet<ETokenType> localVariableIdentifiers, java.util.EnumSet<ETokenType> statementStartTokens)
protected void createSimpleStatementRule()
protected void createSubExpressionRules()
protected RecognizerBase<EGenericParserStates> getSubExpressionRecognizer()
protected java.util.EnumSet<ETokenType> getValidIdentifiers()
protected abstract java.util.EnumSet<ETokenType> getSimpleBlockKeywordsWithParentheses()
protected abstract java.util.EnumSet<ETokenType> getSimpleBlockKeywordsWithoutParentheses()
protected abstract java.util.EnumSet<ETokenType> getStatementStartTokens()
typePatternInState(EGenericParserStates...)
and a literal.protected abstract RecognizerBase<EGenericParserStates> typePattern(RecognizerBase<EGenericParserStates> currentState)
protected RecognizerBase<EGenericParserStates> typePatternInState(EGenericParserStates... states)
protected void createBlockRuleWithContinuation(java.util.EnumSet<ETokenType> startTokens, java.util.EnumSet<ETokenType> continuationTokens, boolean canBeFollowedByParentheses, boolean alwaysBraces)
continuationTokens
- list of tokens that indicate a continued statement if encountered
after the block. May be null.protected void completeSimpleStatement(RecognizerBase<EGenericParserStates> baseRecognizer)
protected void completeSimpleStatement(RecognizerBase<EGenericParserStates> baseRecognizer, java.lang.String subtype)
protected void createLambdaWithArrowRules(ETokenType arrowType)
public static int skipOptionalParameters(java.util.List<IToken> tokens, int currentOffset)
RecognizerBase.NO_MATCH
if it is malformed.