public class AbapLanguageFeatureParser extends java.lang.Object implements ILanguageFeatureParser
Modifier and Type | Field and Description |
---|---|
static java.util.EnumSet<ETokenType> |
PARAMETER_SECTION_TOKENS
EnumSet containing all token types which can appear as section headers in a
parameter declaration.
|
Constructor and Description |
---|
AbapLanguageFeatureParser() |
Modifier and Type | Method and Description |
---|---|
static ShallowEntity |
getClassDeclaration(java.util.List<ShallowEntity> rootEntities,
ShallowEntity classImplementation)
Gets the corresponding class declaration for the given class implementation.
|
java.util.List<IToken> |
getDeclarationTokensForMethod(java.util.List<ShallowEntity> rootEntities,
ShallowEntity methodEntity)
Returns the method declaration which belongs to the given method
implementation entity.
|
java.util.Optional<FunctionCallInfo> |
getFunctionCallInfo(ShallowEntity callFunctionStatement)
Parses a function call string.
|
ELanguage |
getLanguage()
Returns that language the feature parsers are implemented for.
|
static ShallowEntity |
getMethodDeclaration(java.util.List<ShallowEntity> rootEntities,
ShallowEntity methodImplementation)
Gets the corresponding method declaration for the given method implementation
implementation.
|
Pair<java.lang.String,java.lang.Integer> |
getNextTypeName(java.util.List<IToken> tokens,
int startIndex)
Gets the type name from the given list of tokens.
|
java.util.List<TypedVariable> |
getTypeInfoForMethodParameters(ShallowEntity entity,
java.util.List<IToken> tokens)
Gets type information from a list of tokens holding a method's parameter
declaration part, which may either use the
FOR EVENT ... |
static boolean |
isPossiblyIdentifier(IToken token)
Checks if a token is possibly an identifier.
|
static java.lang.String |
normalizeVariable(java.lang.String name)
Lower-cases and removes leading '!', since this does not belong to the
variable name.
|
public static final java.util.EnumSet<ETokenType> PARAMETER_SECTION_TOKENS
public AbapLanguageFeatureParser()
public ELanguage getLanguage()
getLanguage
in interface ILanguageFeatureParser
public Pair<java.lang.String,java.lang.Integer> getNextTypeName(java.util.List<IToken> tokens, int startIndex)
tokens
- List of tokens. For example v1 TYPE t value(v2) LIKE c v TYPE t
v3.public java.util.List<TypedVariable> getTypeInfoForMethodParameters(ShallowEntity entity, java.util.List<IToken> tokens)
FOR EVENT ... OF ... IMPORTING
or the normal sectioned parameter
style.
The given ShallowEntity
is stored as declaring entity in the returned
TypedVariable
s.public java.util.List<IToken> getDeclarationTokensForMethod(java.util.List<ShallowEntity> rootEntities, ShallowEntity methodEntity)
null
if the declaration was
not found, because the rootEntities given are incomplete.public static ShallowEntity getClassDeclaration(java.util.List<ShallowEntity> rootEntities, ShallowEntity classImplementation)
null
if the rootEntities are incomplete.public static ShallowEntity getMethodDeclaration(java.util.List<ShallowEntity> rootEntities, ShallowEntity methodImplementation)
null
if the rootEntities are
incomplete.public java.util.Optional<FunctionCallInfo> getFunctionCallInfo(ShallowEntity callFunctionStatement) throws CheckException
Optional
, empty if the given entity is not a CALL FUNCTION
statement otherwise containing a FunctionCallInfo
CheckException
- if the given statement can not be parsedpublic static java.lang.String normalizeVariable(java.lang.String name)
public static boolean isPossiblyIdentifier(IToken token)
true
if 1) the type of the given token is either an
identifier (regardless if the text is a valid ABAP identifier name)
2) the type is a keyword or an operator and the token text is a
possible variable name. false
otherwise.