Class Expansion

java.lang.Object
org.javacc.parser.Expansion
Direct Known Subclasses:
Action, CharacterRange, Choice, Lookahead, NonTerminal, NormalProduction, OneOrMore, RegularExpression, Sequence, SingleCharacter, TryBlock, ZeroOrMore, ZeroOrOne

public class Expansion extends Object
Describes expansions - entities that may occur on the right hand sides of productions. This is the base class of a bunch of other more specific classes.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private int
     
    protected static final String
     
    boolean
    This flag is used for bookkeeping by the minimumSize method in class ParseEngine.
    private int
    The line and column number of the construct that corresponds most closely to this node.
    (package private) long
    To avoid right-recursive loops when calculating follow sets, we use a generation number which indicates if this expansion was visited by LookaheadWalk.genFollowSet in the same generation.
    (package private) int
    The ordinal of this node with respect to its parent.
    The parent of this expansion node.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    dump(int indent, Set<Expansion> alreadyDumped)
     
    protected StringBuffer
    dumpPrefix(int indent)
     
    final int
     
    final int
     
     
    private String
     
    int
    A reimplementing of Object.hashCode() to be deterministic.
    (package private) final void
    setColumn(int column)
     
    (package private) final void
    setLine(int line)
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • eol

      protected static final String eol
    • line

      private int line
      The line and column number of the construct that corresponds most closely to this node.
    • column

      private int column
    • parent

      public Object parent
      The parent of this expansion node. In case this is the top level expansion of the production it is a reference to the production node otherwise it is a reference to another Expansion node. In case this is the top level of a lookahead expansion,then the parent is null.
    • ordinal

      int ordinal
      The ordinal of this node with respect to its parent.
    • myGeneration

      long myGeneration
      To avoid right-recursive loops when calculating follow sets, we use a generation number which indicates if this expansion was visited by LookaheadWalk.genFollowSet in the same generation. New generations are obtained by incrementing the static counter below, and the current generation is stored in the non-static variable below.
    • inMinimumSize

      public boolean inMinimumSize
      This flag is used for bookkeeping by the minimumSize method in class ParseEngine.
  • Constructor Details

    • Expansion

      public Expansion()
  • Method Details

    • hashCode

      public int hashCode()
      A reimplementing of Object.hashCode() to be deterministic. This uses the line and column fields to generate an arbitrary number - we assume that this method is called only after line and column are set to their actual values.
      Overrides:
      hashCode in class Object
    • getLine

      public final int getLine()
      Returns:
      the line
    • getColumn

      public final int getColumn()
      Returns:
      the column
    • setLine

      final void setLine(int line)
      Parameters:
      line - the line to set
    • setColumn

      final void setColumn(int column)
      Parameters:
      column - the column to set
    • dumpPrefix

      protected StringBuffer dumpPrefix(int indent)
    • dump

      public StringBuffer dump(int indent, Set<Expansion> alreadyDumped)
    • getProductionName

      public String getProductionName()
    • getSimpleName

      private String getSimpleName()
    • toString

      public String toString()
      Overrides:
      toString in class Object