public class CsShallowParser extends CStyleShallowParserBase
What this parser does and does not:
Modifier and Type | Field and Description |
---|---|
static java.util.EnumSet<ETokenType> |
VALID_IDENTIFIERS
A set of all token types that can be used as valid identifiers.
|
OPERATORS_WITH_ALTERNATIVE_REPRESENTATION
Constructor and Description |
---|
CsShallowParser() |
Modifier and Type | Method and Description |
---|---|
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 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 |
createTypeRules()
Parser rules for module/namespace and type creation.
|
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> |
getTypeModifier()
Returns the valid type modifiers for the language.
|
protected java.util.EnumSet<ETokenType> |
getValidIdentifiers()
Returns the set of all valid identifiers, i.e.
|
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, createSimpleStatementRule, createTypedefRules, skipOptionalParameters, typePatternInState
createRecognizer, endWithPossibleContinuation, filterTokens, inAnyState, inState, parse, parseFragment, parseTopLevel
public static final java.util.EnumSet<ETokenType> VALID_IDENTIFIERS
public CsShallowParser()
protected void createMetaRules()
createMetaRules
in class CStyleShallowParserBase
protected void createTypeRules()
createTypeRules
in class CStyleShallowParserBase
protected java.util.EnumSet<ETokenType> getTypeKeywords()
getTypeKeywords
in class CStyleShallowParserBase
protected java.util.EnumSet<ETokenType> getTypeModifier()
getTypeModifier
in class CStyleShallowParserBase
protected void createClassElementsRules()
createClassElementsRules
in class CStyleShallowParserBase
protected void createStatementRules()
CStyleShallowParserBase
createStatementRules
in class CStyleShallowParserBase
protected void createCaseRule()
createCaseRule
in class CStyleShallowParserBase
protected java.util.EnumSet<ETokenType> getValidIdentifiers()
Also returns all contextual keywords, as they are valid identifiers in the language. See http://msdn.microsoft.com/en-us/library/x53a06bb.aspx for the full list.
getValidIdentifiers
in class CStyleShallowParserBase
protected java.util.EnumSet<ETokenType> getSimpleBlockKeywordsWithParentheses()
getSimpleBlockKeywordsWithParentheses
in class CStyleShallowParserBase
protected java.util.EnumSet<ETokenType> getSimpleBlockKeywordsWithoutParentheses()
getSimpleBlockKeywordsWithoutParentheses
in class CStyleShallowParserBase
protected java.util.EnumSet<ETokenType> getStatementStartTokens()
CStyleShallowParserBase.typePatternInState(EGenericParserStates...)
and a literal.getStatementStartTokens
in class CStyleShallowParserBase
protected RecognizerBase<EGenericParserStates> typePattern(RecognizerBase<EGenericParserStates> currentState)
typePattern
in class CStyleShallowParserBase
protected void createSubExpressionRules()
createSubExpressionRules
in class CStyleShallowParserBase
protected RecognizerBase<EGenericParserStates> getSubExpressionRecognizer()
getSubExpressionRecognizer
in class CStyleShallowParserBase
protected boolean isFilteredToken(IToken token, IToken previousToken)
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.