Package snap.parse
Class ParseUtils
java.lang.Object
snap.parse.ParseUtils
Reads/Writes ParseRules from/to file.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ParseRule[]
getAllRulesForRule
(ParseRule aRule) Returns all unique rules nested in given rule.static ParseRule[]
getNamedRulesForRule
(ParseRule aRule) Returns all rules with a name for given top level rule.static ParseRule[]
getPatternRulesForRule
(ParseRule aRule) Returns all rules with a pattern for given top level rule.static String
Returns string definition of rule.static String
getStringForRules
(ParseRule[] theRules) Returns a string for the currently loaded set of rules.static void
installHandlerForClass
(Class<? extends ParseHandler<?>> handlerClass, ParseRule aRule) Searches given class for inner handler classes and installs instance in rule.static void
installHandlersForParentClass
(Class<?> aClass, ParseRule aRule) Searches given class for inner handler classes and installs instance in rule.static ParseRule
Loads a rule for a class.static void
printAllRuleNames
(ParseRule aRule, int namesPerLine) Prints the names of all rules.static void
printHandlerClassesForParentClass
(Class<?> aClass, int classesPerLine) Prints handler classes so parsers can include as constant and avoid reflection for handler install.static void
writeAllRulesForRuleToFile
(ParseRule aRule, WebFile aFile) Writes a rule to a file.
-
Constructor Details
-
ParseUtils
public ParseUtils()
-
-
Method Details
-
getAllRulesForRule
Returns all unique rules nested in given rule. -
getNamedRulesForRule
Returns all rules with a name for given top level rule. -
getPatternRulesForRule
Returns all rules with a pattern for given top level rule. -
printAllRuleNames
Prints the names of all rules. -
writeAllRulesForRuleToFile
Writes a rule to a file. -
getStringForRules
Returns a string for the currently loaded set of rules. -
getString
Returns string definition of rule. -
loadRule
Loads a rule for a class. -
installHandlersForParentClass
Searches given class for inner handler classes and installs instance in rule. -
installHandlerForClass
public static void installHandlerForClass(Class<? extends ParseHandler<?>> handlerClass, ParseRule aRule) Searches given class for inner handler classes and installs instance in rule. -
printHandlerClassesForParentClass
Prints handler classes so parsers can include as constant and avoid reflection for handler install.
-