public class CppShallowParser extends CStyleShallowParserBase
What this parser does and does not:
Modifier and Type | Field and Description |
---|---|
protected static java.util.EnumSet<ETokenType> |
BASE_TYPE_OR_IDENTIFIER
Base token types for types or identifiers (without primitive types).
|
protected static java.util.EnumSet<ETokenType> |
METHOD_AND_TYPE_DECLARATION_MODIFIERS
Token types that are modifiers in front of a type declaration or method.
|
protected static java.util.EnumSet<ETokenType> |
PRIMITIVE_TYPES
Basic keywords used for primitive types in a C++ like language.
|
OPERATORS_WITH_ALTERNATIVE_REPRESENTATION
Constructor and Description |
---|
CppShallowParser() |
Modifier and Type | Method and Description |
---|---|
protected void |
contributeExpandedMacroRule()
Rules for detecting expanded macros in C/C++ code.
|
protected RecognizerBase<EGenericParserStates> |
createAnnotationSubrecognizer()
Returns a subrecognizer for C++ annotations/attributes.
|
protected void |
createCaseRule()
Case statement is parsed as meta, as it is hardly a statement on its own.
|
protected void |
createClassElementsRules()
Parser rules for both attributes and methods.
|
protected void |
createMetaRules()
Creates rules for meta elements.
|
protected RecognizerBase<EGenericParserStates> |
createScopeRecognizer()
Creates a new recognizer that can match a scope prefix for a method-like
construct.
|
protected void |
createSimpleStatementRule()
Simple statement.
|
protected void |
createSubExpressionRules()
Creates rules for dealing with constructs in subexpressions, such as
anonymous classes, lambdas, etc.
|
protected void |
createTypeRules()
Parser rules for module/namespace and type creation.
|
protected java.util.List<IToken> |
filterTokens(java.util.List<IToken> tokens)
Creates a filtered view of the tokens.
|
java.util.EnumSet<ETokenType> |
getMethodAndTypeDeclarationModifiers()
Returns all method and type declaration modifiers.
|
protected java.util.EnumSet<ETokenType> |
getPrimitiveTypes()
Returns all primitive token types.
|
protected 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 java.util.EnumSet<ETokenType> |
getSimpleBlockKeywordsWithParentheses()
Returns the set of all keywords that start a simple block with optional
parentheses (see implementers for examples).
|
protected java.util.EnumSet<ETokenType> |
getStatementStartTokens()
Returns a set of all tokens that can start a statement, besides a type (see
CStyleShallowParserBase.typePatternInState(EGenericParserStates...) and a literal. |
protected RecognizerBase<EGenericParserStates> |
getSubExpressionRecognizer()
Returns a recognizer used for detecting sub expressions (anonymous classes,
lambdas, etc.) within expressions.
|
protected java.util.EnumSet<ETokenType> |
getTypeKeywords()
Returns the set of keywords that start a type.
|
protected java.util.EnumSet<ETokenType> |
getTypeOrIdentifier()
Returns all primitive token types.
|
protected boolean |
isFilteredToken(IToken token,
IToken previousToken)
Template method that can be used to ignore/filter certain tokens.
|
protected RecognizerBase<EGenericParserStates> |
typePattern(RecognizerBase<EGenericParserStates> currentState)
Creates a recognizer that matches all valid types.
|
completeSimpleStatement, completeSimpleStatement, contributeSimpleStatementRules, createBasicBlockRules, createBlockRuleWithContinuation, createDoWhileRule, createElseIfRule, createLambdaWithArrowRules, createStatementRules, createTypedefRules, getTypeModifier, getValidIdentifiers, skipOptionalParameters, typePatternInState
createRecognizer, endWithPossibleContinuation, inAnyState, inState, parse, parseFragment, parseTopLevel
protected static final java.util.EnumSet<ETokenType> PRIMITIVE_TYPES
protected static final java.util.EnumSet<ETokenType> BASE_TYPE_OR_IDENTIFIER
protected static final java.util.EnumSet<ETokenType> METHOD_AND_TYPE_DECLARATION_MODIFIERS
public CppShallowParser()
protected void createMetaRules()
CStyleShallowParserBase
createMetaRules
in class CStyleShallowParserBase
protected void createClassElementsRules()
CStyleShallowParserBase
createClassElementsRules
in class CStyleShallowParserBase
protected void createTypeRules()
CStyleShallowParserBase
createTypeRules
in class CStyleShallowParserBase
protected RecognizerBase<EGenericParserStates> createAnnotationSubrecognizer()
protected java.util.EnumSet<ETokenType> getTypeKeywords()
CStyleShallowParserBase
getTypeKeywords
in class CStyleShallowParserBase
protected java.util.EnumSet<ETokenType> getPrimitiveTypes()
protected java.util.EnumSet<ETokenType> getTypeOrIdentifier()
public java.util.EnumSet<ETokenType> getMethodAndTypeDeclarationModifiers()
protected RecognizerBase<EGenericParserStates> createScopeRecognizer()
protected void createCaseRule()
CStyleShallowParserBase
createCaseRule
in class CStyleShallowParserBase
protected void contributeExpandedMacroRule()
protected void createSimpleStatementRule()
CStyleShallowParserBase
createSimpleStatementRule
in class CStyleShallowParserBase
protected java.util.EnumSet<ETokenType> getSimpleBlockKeywordsWithParentheses()
CStyleShallowParserBase
getSimpleBlockKeywordsWithParentheses
in class CStyleShallowParserBase
protected java.util.EnumSet<ETokenType> getSimpleBlockKeywordsWithoutParentheses()
CStyleShallowParserBase
getSimpleBlockKeywordsWithoutParentheses
in class CStyleShallowParserBase
protected java.util.EnumSet<ETokenType> getStatementStartTokens()
CStyleShallowParserBase
CStyleShallowParserBase.typePatternInState(EGenericParserStates...)
and a literal.getStatementStartTokens
in class CStyleShallowParserBase
protected RecognizerBase<EGenericParserStates> typePattern(RecognizerBase<EGenericParserStates> currentState)
CStyleShallowParserBase
typePattern
in class CStyleShallowParserBase
protected void createSubExpressionRules()
CStyleShallowParserBase
createSubExpressionRules
in class CStyleShallowParserBase
protected RecognizerBase<EGenericParserStates> getSubExpressionRecognizer()
CStyleShallowParserBase
getSubExpressionRecognizer
in class CStyleShallowParserBase
protected boolean isFilteredToken(IToken token, IToken previousToken)
ShallowParserBase
isFilteredToken
in class ShallowParserBase<EGenericParserStates>
previousToken
- the last non-filtered token (can be used for context sensitive
filtering). This may be null is no previous token exists.protected java.util.List<IToken> filterTokens(java.util.List<IToken> tokens)
ShallowParserBase
filterTokens
in class ShallowParserBase<EGenericParserStates>