Package snap.parse
Class ParseRule
java.lang.Object
snap.parse.ParseRule
A class to represent a parse rule.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ParseRule
protected ParseRule
protected int
protected ParseRule.Op
protected String
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor for given nameParseRule
(String aName, ParseRule.Op anOp, ParseRule aPR1, ParseRule aPR2) Constructor for given name, op and child rules.ParseRule
(ParseRule.Op anOp, ParseRule aPR) Constructor for op and child ruleParseRule
(ParseRule.Op anOp, ParseRule aPR1, ParseRule aPR2) Constructor for given op and child rules. -
Method Summary
Modifier and TypeMethodDescriptionReturns the first child.Returns the second child.ParseHandler<?>
Returns the handler for this rule.getId()
Returns an identifier string for this rule - either the name or the pattern or null.int
Returns the look ahead count.getName()
Returns rule name.getOp()
Returns the op.Returns the rule pattern if simple pattern.boolean
Returns whether rule is anonymous - true if rule has no name and no pattern.boolean
Returns whether rule is look ahead.boolean
Returns whether rule is optional.setHandler
(ParseHandler<?> aHandler) Sets the handler for this rule.protected void
setLookAheadCount
(int aValue) Sets the look ahead count.protected void
Sets rule name.protected ParseRule
setPattern
(String anPattern) Sets the rule pattern if simple pattern.toString()
Returns a string representation.
-
Field Details
-
_op
-
_child0
-
_child1
-
_pattern
-
_lookAheadCount
protected int _lookAheadCount
-
-
Constructor Details
-
ParseRule
public ParseRule()Constructor. -
ParseRule
Constructor for given name -
ParseRule
Constructor for op and child rule -
ParseRule
Constructor for given op and child rules. -
ParseRule
Constructor for given name, op and child rules.
-
-
Method Details
-
getName
Returns rule name. -
setName
Sets rule name. -
getId
Returns an identifier string for this rule - either the name or the pattern or null. -
getOp
Returns the op. -
getChild0
Returns the first child. -
getChild1
Returns the second child. -
getPattern
Returns the rule pattern if simple pattern. -
setPattern
Sets the rule pattern if simple pattern. -
isAnonymous
public boolean isAnonymous()Returns whether rule is anonymous - true if rule has no name and no pattern. -
isOptional
public boolean isOptional()Returns whether rule is optional. -
getHandler
Returns the handler for this rule. -
setHandler
Sets the handler for this rule. -
isLookAhead
public boolean isLookAhead()Returns whether rule is look ahead. -
getLookAheadCount
public int getLookAheadCount()Returns the look ahead count. -
setLookAheadCount
protected void setLookAheadCount(int aValue) Sets the look ahead count. -
toString
Returns a string representation.
-