Class ParseRule
java.lang.Object
com.inductiveautomation.snap.parse.ParseRule
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
JAnnotationParseRule
,JExprParseRule
,JFileParseRule
,JLiteralParseRule
,JStmtParseRule
A class to represent a parse rule.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new parse rule.Creates a new parse rule for given nameParseRule
(String aName, ParseHandler aHandler) Creates a new parse rule for given name and handler.Creates a new parse rule for given nameCreates a new parse rule for given name -
Method Summary
Modifier and TypeMethodDescriptionaddLookAhead
(int aCount) Adds a look ahead rule with given operator and count.addLookAhead
(ParseRule aRule) Adds a look ahead rule with given operator.addLookAhead
(ParseRule.Op anOp, int aCount) Adds a look ahead rule with given operator and count.addLookAhead
(ParseRule.Op anOp, ParseRule aRule) Adds a look ahead rule with given operator.Adds a child rule.addRule
(ParseRule.Count aCount, ParseRule aRule) Adds a child rule.addRule
(ParseRule.Count aCount, String aPattern) Adds a rule for pattern.addRule
(ParseRule.Count aCount, String aName, String aPattern) Adds a rule for name and pattern.addRule
(ParseRule.Op anOp, ParseRule aRule) Adds a child rule.addRule
(ParseRule.Op anOp, ParseRule.Count aCount, ParseRule aRule) Adds a child rule.addRule
(ParseRule.Op anOp, ParseRule.Count aCount, ParseRule aRule, int anIndex) Adds a child rule.addRule
(ParseRule.Op anOp, ParseRule.Count aCount, String aPattern) Adds a rule for pattern.addRule
(ParseRule.Op anOp, ParseRule.Count aCount, String aName, String aPattern) Adds a rule for name and pattern.addRule
(ParseRule.Op anOp, String aPattern) Adds a rule for pattern.addRule
(ParseRule.Op anOp, String aName, String aPattern) Adds a rule for name and pattern.Adds a rule for pattern.Adds a rule for name and pattern.void
Adds child rules.clone()
Standard clone implementation.Returns the handler for this rule.int
Returns the look ahead count.getName()
Returns rule name.Returns the rule pattern if simple pattern.Returns the pattern compiled.int
Returns pattern compile flags.getRule
(int anIndex) Returns the individual rule at index.int
Returns the number of rules.getRuleCount
(int anIndex) Returns the individual rule count at index.getRuleCount
(int aPathIndex, int aRuleIndex) Returns the rule count for a given rule path and index in that rule path.Returns the rule counts list.getRuleOp
(int anIndex) Returns the individual rule op at index.Returns the rule ops list.getRulePath
(int anIndex) Returns the individual rule path at given index.int
Returns the number of rule paths.Returns the rule paths.getRules()
Returns the child rules.boolean
Returns whether rule is anonymous - true if rule has no name and no pattern.boolean
Returns whether pattern is literal.boolean
Returns whether rule is look ahead.removeRule
(int anIndex) Removes a child rule.int
removeRule
(ParseRule aRule) Removes a child rule.void
setHandler
(ParseHandler aHandler) Sets the handler for this rule.setLiteral
(boolean aFlag) Sets whether pattern is literal.setLookAhead
(int aValue) Sets the look ahead count.void
Sets rule name.setPattern
(String anPattern) Sets the rule pattern if simple pattern.toString()
Returns a string representation.
-
Constructor Details
-
ParseRule
public ParseRule()Creates a new parse rule. -
ParseRule
Creates a new parse rule for given name -
ParseRule
Creates a new parse rule for given name -
ParseRule
Creates a new parse rule for given name -
ParseRule
Creates a new parse rule for given name and handler.
-
-
Method Details
-
getName
Returns rule name. -
setName
Sets rule name. -
getPattern
Returns the rule pattern if simple pattern. -
setPattern
Sets the rule pattern if simple pattern. -
isLiteral
public boolean isLiteral()Returns whether pattern is literal. -
setLiteral
Sets whether pattern is literal. -
getPatternCompiled
Returns the pattern compiled. -
getPatternCompileFlags
public int getPatternCompileFlags()Returns pattern compile flags. -
isAnonymous
public boolean isAnonymous()Returns whether rule is anonymous - true if rule has no name and no pattern. -
getHandler
Returns the handler for this rule. -
setHandler
Sets the handler for this rule. -
isLookAhead
public boolean isLookAhead()Returns whether rule is look ahead. -
getLookAhead
public int getLookAhead()Returns the look ahead count. -
setLookAhead
Sets the look ahead count. -
getRuleCount
public int getRuleCount()Returns the number of rules. -
getRule
Returns the individual rule at index. -
getRuleOp
Returns the individual rule op at index. -
getRuleCount
Returns the individual rule count at index. -
getRules
Returns the child rules. -
getRuleOps
Returns the rule ops list. -
getRuleCounts
Returns the rule counts list. -
addRule
Adds a child rule. -
addRule
Adds a child rule. -
addRule
Adds a child rule. -
addRule
Adds a child rule. -
addRule
Adds a child rule. -
removeRule
Removes a child rule. -
removeRule
Removes a child rule. -
addRule
Adds a rule for pattern. -
addRule
Adds a rule for pattern. -
addRule
Adds a rule for pattern. -
addRule
Adds a rule for pattern. -
addRule
Adds a rule for name and pattern. -
addRule
Adds a rule for name and pattern. -
addRule
Adds a rule for name and pattern. -
addRule
Adds a rule for name and pattern. -
addRules
Adds child rules. -
addLookAhead
Adds a look ahead rule with given operator and count. -
addLookAhead
Adds a look ahead rule with given operator and count. -
addLookAhead
Adds a look ahead rule with given operator. -
addLookAhead
Adds a look ahead rule with given operator. -
getRulePathCount
public int getRulePathCount()Returns the number of rule paths. -
getRulePath
Returns the individual rule path at given index. -
getRulePaths
Returns the rule paths. -
getRuleCount
Returns the rule count for a given rule path and index in that rule path. -
clone
Standard clone implementation. -
toString
Returns a string representation.
-