Class Expansion

java.lang.Object
com.javacc.parser.BaseNode
com.javacc.core.Expansion
All Implemented Interfaces:
JavaCCConstants, Node, freemarker.template.TemplateHashModel, freemarker.template.TemplateModel, freemarker.template.TemplateNodeModel, freemarker.template.TemplateScalarModel, Comparable<Node>
Direct Known Subclasses:
AttemptBlock, EmptyExpansion, ExpansionChoice, ExpansionSequence, ExpansionWithParentheses, NonTerminal, RegularExpression, TryBlock

public abstract class Expansion extends BaseNode
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 Details

    • firstSet

      protected TokenSet firstSet
  • Constructor Details

    • Expansion

      public Expansion(Grammar grammar)
    • Expansion

      public Expansion()
  • Method Details

    • getIndex

      public int getIndex()
    • getContainingProduction

      public BNFProduction getContainingProduction()
    • getLabel

      public String getLabel()
    • setLabel

      public void setLabel(String label)
    • isTolerantParsing

      public boolean isTolerantParsing()
      If we hit a parsing error in this expansion, do we try to recover? This is only used in fault-tolerant mode, of course!
    • setTolerantParsing

      public void setTolerantParsing(boolean tolerantParsing)
    • toString

      public String toString()
      Overrides:
      toString in class BaseNode
    • getNestedExpansion

      public Expansion getNestedExpansion()
    • getIsRegexp

      public boolean getIsRegexp()
    • getTreeNodeBehavior

      public TreeBuildingAnnotation getTreeNodeBehavior()
    • setTreeNodeBehavior

      public void setTreeNodeBehavior(TreeBuildingAnnotation treeNodeBehavior)
    • isAtChoicePoint

      public boolean isAtChoicePoint()
    • getNonSuperfluousParent

      public Node getNonSuperfluousParent()
      Returns:
      the first ancestor that is not (directly) inside superfluous parentheses. (Yes, this is a bit hairy and I'm not 100% sure it's correct!) I really need to take a good look at all this handling of expansions inside parentheses.
    • getSpecifiedLexicalState

      public String getSpecifiedLexicalState()
      Returns:
      the lexical state to switch into to parse this expansion.
    • getTokenActivation

      public TokenActivation getTokenActivation()
    • getCustomErrorRecoveryBlock

      public CodeBlock getCustomErrorRecoveryBlock()
    • setCustomErrorRecoveryBlock

      public void setCustomErrorRecoveryBlock(CodeBlock customErrorRecoveryBlock)
    • superfluousParentheses

      public final boolean superfluousParentheses()
      Is this expansion superfluous parentheses?
    • beginsSequence

      public boolean beginsSequence()
    • isInsideLookahead

      public boolean isInsideLookahead()
    • getLookahead

      public Lookahead getLookahead()
    • getHasExplicitLookahead

      public boolean getHasExplicitLookahead()
    • getHasExplicitNumericalLookahead

      public boolean getHasExplicitNumericalLookahead()
    • getHasSeparateSyntacticLookahead

      public boolean getHasSeparateSyntacticLookahead()
      Does this expansion have a separate lookahead expansion?
    • getHasImplicitSyntacticLookahead

      public boolean getHasImplicitSyntacticLookahead()
      Do we do a syntactic lookahead using this expansion itself as the lookahead expansion?
    • isScanLimit

      public boolean isScanLimit()
    • setScanLimit

      public void setScanLimit(boolean scanLimit)
    • getScanLimitPlus

      public int getScanLimitPlus()
    • setScanLimitPlus

      public void setScanLimitPlus(int scanLimitPlus)
    • getRequiresScanAhead

      public boolean getRequiresScanAhead()
    • getRequiresPredicateMethod

      public final boolean getRequiresPredicateMethod()
    • getLookaheadExpansion

      public Expansion getLookaheadExpansion()
    • isAlwaysSuccessful

      public boolean isAlwaysSuccessful()
    • getHasGlobalSemanticActions

      public boolean getHasGlobalSemanticActions()
    • getLookaheadAmount

      public int getLookaheadAmount()
    • getHasSemanticLookahead

      public boolean getHasSemanticLookahead()
    • getHasScanLimit

      public boolean getHasScanLimit()
    • getHasInnerScanLimit

      public boolean getHasInnerScanLimit()
    • getUpToExpansion

      public Expansion getUpToExpansion()
    • getSemanticLookahead

      public Expression getSemanticLookahead()
    • getHasLookBehind

      public boolean getHasLookBehind()
    • getLookBehind

      public LookBehind getLookBehind()
    • isNegated

      public boolean isNegated()
    • getFirstSetVarName

      public String getFirstSetVarName()
    • getFinalSetVarName

      public String getFinalSetVarName()
    • getFollowSetVarName

      public String getFollowSetVarName()
    • getScanRoutineName

      public String getScanRoutineName()
    • getPredicateMethodName

      public String getPredicateMethodName()
    • getRecoverMethodName

      public String getRecoverMethodName()
    • getRecoverToMethodName

      public String getRecoverToMethodName()
    • getFinalSetSize

      public int getFinalSetSize()
    • getFirstSet

      public abstract TokenSet getFirstSet()
    • getFinalSet

      public abstract TokenSet getFinalSet()
    • getHasFullFollowSet

      public boolean getHasFullFollowSet()
    • getSpecifiesLexicalStateSwitch

      public boolean getSpecifiesLexicalStateSwitch()
    • getHasTokenActivation

      public boolean getHasTokenActivation()
    • isPossiblyEmpty

      public abstract boolean isPossiblyEmpty()
      Returns:
      Can this expansion be matched by the empty string.
    • isSingleToken

      public final boolean isSingleToken()
      Returns:
      whether this Expansion is always matched by exactly one token AND there is no funny business like lexical state switches a FAIL or an up-to-here marker
    • getMinimumSize

      public abstract int getMinimumSize()
      Returns:
      the minimum number of tokens that this expansion consumes.
    • getMaximumSize

      public abstract int getMaximumSize()
      Returns:
      the maximum number of tokens that this expansion consumes.
    • getFollowingExpansion

      public Expansion getFollowingExpansion()
    • getFollowSet

      public TokenSet getFollowSet()
    • isBeforeLexicalStateSwitch

      public Boolean isBeforeLexicalStateSwitch()
    • getRequiresRecoverMethod

      public boolean getRequiresRecoverMethod()