Class IvmlIdentifierCheck
java.lang.Object
net.ssehub.easy.varModel.validation.IvmlIdentifierCheck
Provides methods to identify correct IVML identifiers.
- Author:
- Holger Eichelberger
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static final voidHashes the names of all public constants infieldsintoRESERVED.private static booleanisLetter(char character) Returns whether the given character is a valid IVML identifier letter.static final booleanisReservedName(String name) Returns whether the givennameis reserved.static final booleanReturns whether the givennameis a structural valid identifier.static final booleanisValidIdentifier(String name) Returns whether the givennameis a structurally and semantically valid identifier in IVML.
-
Field Details
-
RESERVED
Stores reserved keywords and operator names.
-
-
Constructor Details
-
IvmlIdentifierCheck
public IvmlIdentifierCheck()
-
-
Method Details
-
hash
Hashes the names of all public constants infieldsintoRESERVED.- Parameters:
fields- the fields to be hashedcheckAnnotation-falseeach field will be added toRESERVEDwhich marks them as reserved keyword,trueonly fields annotated withIVMLKeyWordwill be added toRESERVED. This is useful for inherited keywords as not all of them are also reserved in IVML.
-
isValidIdentifier
Returns whether the givennameis a structurally and semantically valid identifier in IVML.- Parameters:
name- the identifier to test (may be null)- Returns:
trueifnameis a valid IVML identifier,falseifidentifieris null or not a valid IVML identifier- See Also:
-
isStructuralValidIdentifier
Returns whether the givennameis a structural valid identifier.- Parameters:
name- the name to be checked- Returns:
trueifnameis a reserved name,falseelse
-
isLetter
private static boolean isLetter(char character) Returns whether the given character is a valid IVML identifier letter.- Parameters:
character- the character to be checked- Returns:
trueif it is a character,falseelse
-
isReservedName
Returns whether the givennameis reserved.- Parameters:
name- the name to be checked- Returns:
trueifnameis a reserved name,falseelse
-