Package jflex

Class RegExp

  • Direct Known Subclasses:
    RegExp1, RegExp2

    public class RegExp
    extends java.lang.Object
    Stores a regular expression of rules section in a JFlex-specification.

    This base class has no content other than its type.

    Version:
    JFlex 1.7.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) int type
      The type of the regular expression.
    • Constructor Summary

      Constructors 
      Constructor Description
      RegExp​(int type)
      Create a new regular expression of the specified type.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      RegExp anyChar()
      Returns a regexp that matches any character: [^]
      boolean isCharClass​(Macros macros)
      Find out if this regexp is a char class or equivalent to one.
      java.lang.String print​(java.lang.String tab)
      Returns a String-representation of this regular expression with the specified indentation.
      RegExp resolveTilde​(Macros macros)
      Recursively convert tilde (upto) expressions into negation and star.
      RegExp rev​(Macros macros)
      Create a new regexp that matches the reverse text of this one.
      static java.lang.String revString​(java.lang.String s)
      revString.
      int size​(Macros macros)
      The approximate number of NFA states this expression will need (only works correctly after macro expansion and without negation)
      java.lang.String toString()
      Returns a String-representation of this regular expression
      • Methods inherited from class java.lang.Object

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

      • type

        int type
        The type of the regular expression. This field will be filled with values from class sym.java (generated by cup)
    • Constructor Detail

      • RegExp

        public RegExp​(int type)
        Create a new regular expression of the specified type.
        Parameters:
        type - a value from the cup generated class sym.
        See Also:
        sym
    • Method Detail

      • print

        public java.lang.String print​(java.lang.String tab)
        Returns a String-representation of this regular expression with the specified indentation.
        Parameters:
        tab - a String that should contain only space characters and that is inserted in front of standard String-representation pf this object.
        Returns:
        a String object.
      • toString

        public java.lang.String toString()
        Returns a String-representation of this regular expression
        Overrides:
        toString in class java.lang.Object
        Returns:
        a String object.
      • isCharClass

        public boolean isCharClass​(Macros macros)
        Find out if this regexp is a char class or equivalent to one.
        Parameters:
        macros - for macro expansion
        Returns:
        true if the regexp is equivalent to a char class.
      • size

        public int size​(Macros macros)
        The approximate number of NFA states this expression will need (only works correctly after macro expansion and without negation)
        Parameters:
        macros - macro table for expansion
        Returns:
        a int.
      • revString

        public static final java.lang.String revString​(java.lang.String s)
        revString.
        Parameters:
        s - a String object.
        Returns:
        a String object.
      • resolveTilde

        public final RegExp resolveTilde​(Macros macros)
        Recursively convert tilde (upto) expressions into negation and star.
        Parameters:
        macros - the macro table for expansion.
        Returns:
        new RegExp equivalent to the current one, but without upto expressions.
      • anyChar

        public RegExp anyChar()
        Returns a regexp that matches any character: [^]
        Returns:
        the regexp for [^]
      • rev

        public final RegExp rev​(Macros macros)
        Create a new regexp that matches the reverse text of this one.
        Parameters:
        macros - a Macros object.
        Returns:
        the reverse regexp