Class IvmlIdentifierCheck


  • public class IvmlIdentifierCheck
    extends java.lang.Object
    Provides methods to identify correct IVML identifiers.
    Author:
    Holger Eichelberger
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Set<java.lang.String> RESERVED
      Stores reserved keywords and operator names.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static void hash​(java.lang.reflect.Field[] fields, boolean checkAnnotation)
      Hashes the names of all public constants in fields into RESERVED.
      private static boolean isLetter​(char character)
      Returns whether the given character is a valid IVML identifier letter.
      static boolean isReservedName​(java.lang.String name)
      Returns whether the given name is reserved.
      static boolean isStructuralValidIdentifier​(java.lang.String name)
      Returns whether the given name is a structural valid identifier.
      static boolean isValidIdentifier​(java.lang.String name)
      Returns whether the given name is a structurally and semantically valid identifier in IVML.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • RESERVED

        private static final java.util.Set<java.lang.String> RESERVED
        Stores reserved keywords and operator names.
    • Constructor Detail

      • IvmlIdentifierCheck

        public IvmlIdentifierCheck()
    • Method Detail

      • hash

        private static final void hash​(java.lang.reflect.Field[] fields,
                                       boolean checkAnnotation)
        Hashes the names of all public constants in fields into RESERVED.
        Parameters:
        fields - the fields to be hashed
        checkAnnotation - false each field will be added to RESERVED which marks them as reserved keyword, true only fields annotated with IVMLKeyWord will be added to RESERVED. This is useful for inherited keywords as not all of them are also reserved in IVML.
      • isValidIdentifier

        public static final boolean isValidIdentifier​(java.lang.String name)
        Returns whether the given name is a structurally and semantically valid identifier in IVML.
        Parameters:
        name - the identifier to test (may be null)
        Returns:
        true if name is a valid IVML identifier, false if identifier is null or not a valid IVML identifier
        See Also:
        isReservedName(String), isStructuralValidIdentifier(String)
      • isStructuralValidIdentifier

        public static final boolean isStructuralValidIdentifier​(java.lang.String name)
        Returns whether the given name is a structural valid identifier.
        Parameters:
        name - the name to be checked
        Returns:
        true if name is a reserved name, false else
      • 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:
        true if it is a character, false else
      • isReservedName

        public static final boolean isReservedName​(java.lang.String name)
        Returns whether the given name is reserved.
        Parameters:
        name - the name to be checked
        Returns:
        true if name is a reserved name, false else