Enum Class EBNFModifier

java.lang.Object
java.lang.Enum<EBNFModifier>
eu.bandm.tools.util.EBNFModifier
All Implemented Interfaces:
Serializable, Comparable<EBNFModifier>, java.lang.constant.Constable

public enum EBNFModifier extends Enum<EBNFModifier>
Models the four regular-expression operators which are frequently used in extended Bakus-Naur-forms.
  • Enum Constant Details

    • none

      public static final EBNFModifier none
      Neutral case, that no modifier is appended to a sub-expression.
    • optional

      public static final EBNFModifier optional
      Operator which allows the decorated sub-expression to appear or not to appear.
    • star

      public static final EBNFModifier star
      Operator which allows the decorated sub-expression to appear zero to arbitrary many times.
    • plus

      public static final EBNFModifier plus
      Operator which allows the decorated sub-expression to appear arbitrary many times, but at least once
  • Method Details

    • values

      public static EBNFModifier[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static EBNFModifier valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • compose

      public static EBNFModifier compose(EBNFModifier... args)
      Calculate the effect of more than one modifier applied to the same sub-expression. The table is
                -  ?  *  + 
            -----------------
             -  -  ?  *  +
             ?  ?  ?  *  *
             *  *  *  *  *
             +  +  *  *  +
        
    • addsEpsilon

      public static boolean addsEpsilon(EBNFModifier arg)
      Whether the given modifier allows empty string.
    • addsRepetitions

      public static boolean addsRepetitions(EBNFModifier arg)
      Whether the given modifier allows using a sub-expression ore than once.