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, typePatternInStatecreateRecognizer, endWithPossibleContinuation, inAnyState, inState, parse, parseFragment, parseTopLevelprotected 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()
CStyleShallowParserBasecreateMetaRules in class CStyleShallowParserBaseprotected void createClassElementsRules()
CStyleShallowParserBasecreateClassElementsRules in class CStyleShallowParserBaseprotected void createTypeRules()
CStyleShallowParserBasecreateTypeRules in class CStyleShallowParserBaseprotected RecognizerBase<EGenericParserStates> createAnnotationSubrecognizer()
protected java.util.EnumSet<ETokenType> getTypeKeywords()
CStyleShallowParserBasegetTypeKeywords in class CStyleShallowParserBaseprotected java.util.EnumSet<ETokenType> getPrimitiveTypes()
protected java.util.EnumSet<ETokenType> getTypeOrIdentifier()
public java.util.EnumSet<ETokenType> getMethodAndTypeDeclarationModifiers()
protected RecognizerBase<EGenericParserStates> createScopeRecognizer()
protected void createCaseRule()
CStyleShallowParserBasecreateCaseRule in class CStyleShallowParserBaseprotected void contributeExpandedMacroRule()
protected void createSimpleStatementRule()
CStyleShallowParserBasecreateSimpleStatementRule in class CStyleShallowParserBaseprotected java.util.EnumSet<ETokenType> getSimpleBlockKeywordsWithParentheses()
CStyleShallowParserBasegetSimpleBlockKeywordsWithParentheses in class CStyleShallowParserBaseprotected java.util.EnumSet<ETokenType> getSimpleBlockKeywordsWithoutParentheses()
CStyleShallowParserBasegetSimpleBlockKeywordsWithoutParentheses in class CStyleShallowParserBaseprotected java.util.EnumSet<ETokenType> getStatementStartTokens()
CStyleShallowParserBaseCStyleShallowParserBase.typePatternInState(EGenericParserStates...) and a literal.getStatementStartTokens in class CStyleShallowParserBaseprotected RecognizerBase<EGenericParserStates> typePattern(RecognizerBase<EGenericParserStates> currentState)
CStyleShallowParserBasetypePattern in class CStyleShallowParserBaseprotected void createSubExpressionRules()
CStyleShallowParserBasecreateSubExpressionRules in class CStyleShallowParserBaseprotected RecognizerBase<EGenericParserStates> getSubExpressionRecognizer()
CStyleShallowParserBasegetSubExpressionRecognizer in class CStyleShallowParserBaseprotected boolean isFilteredToken(IToken token, IToken previousToken)
ShallowParserBaseisFilteredToken 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)
ShallowParserBasefilterTokens in class ShallowParserBase<EGenericParserStates>