Package com.javacc.core
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.javacc.parser.JavaCCConstants
JavaCCConstants.LexicalState, JavaCCConstants.TokenType
-
Nested classes/interfaces inherited from interface com.javacc.parser.Node
Node.Visitor
-
-
Field Summary
Fields Modifier and Type Field Description protected TokenSetfirstSet-
Fields inherited from interface com.javacc.parser.JavaCCConstants
BUF_SIZE
-
-
Method Summary
-
Methods inherited from class com.javacc.parser.BaseNode
addChild, addChild, children, clearChildren, get, getAsString, getBeginOffset, getChild, getChildCount, getChildNodes, getEndOffset, getGrammar, getInnerText, getLiteralText, getNodeName, getNodeNamespace, getNodeType, getParent, getParentNode, getSimpleName, getTokenSource, hasKeyWord, isEmpty, isUnparsed, prepend, removeChild, setBeginOffset, setChild, setEndOffset, setGrammar, setListClass, setParent, setTokenSource, setUnparsed
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.javacc.parser.Node
appendChild, children, childrenOfType, close, compareTo, copyLocationInfo, copyLocationInfo, descendants, descendants, descendants, descendants, descendantsOfType, dump, dump, firstAncestorOfType, firstChildOfType, firstChildOfType, firstChildOfType, firstDescendantOfType, firstDescendantOfType, getAllTokens, getBeginColumn, getBeginLine, getEndColumn, getEndLine, getFirstChild, getFirstToken, getInputSource, getLastChild, getLastToken, getLocation, getRealTokens, getRoot, getSource, getTokenType, hasChildNodes, indexOf, iterator, nextSibling, open, prependChild, previousSibling, removeChild, replace, replaceChild
-
-
-
-
Field Detail
-
firstSet
protected TokenSet firstSet
-
-
Constructor Detail
-
Expansion
public Expansion(Grammar grammar)
-
Expansion
public Expansion()
-
-
Method Detail
-
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)
-
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()
-
-