Package snap.parse

Class ParseUtils

java.lang.Object
snap.parse.ParseUtils

public class ParseUtils extends Object
Reads/Writes ParseRules from/to file.
  • Constructor Details

    • ParseUtils

      public ParseUtils()
  • Method Details

    • getAllRulesForRule

      public static ParseRule[] getAllRulesForRule(ParseRule aRule)
      Returns all unique rules nested in given rule.
    • getNamedRulesForRule

      public static ParseRule[] getNamedRulesForRule(ParseRule aRule)
      Returns all rules with a name for given top level rule.
    • getPatternRulesForRule

      public static ParseRule[] getPatternRulesForRule(ParseRule aRule)
      Returns all rules with a pattern for given top level rule.
    • printAllRuleNames

      public static void printAllRuleNames(ParseRule aRule, int namesPerLine)
      Prints the names of all rules.
    • writeAllRulesForRuleToFile

      public static void writeAllRulesForRuleToFile(ParseRule aRule, WebFile aFile)
      Writes a rule to a file.
    • getStringForRules

      public static String getStringForRules(ParseRule[] theRules)
      Returns a string for the currently loaded set of rules.
    • getString

      public static String getString(ParseRule aRule)
      Returns string definition of rule.
    • loadRule

      public static ParseRule loadRule(Class<?> aClass, String aName)
      Loads a rule for a class.
    • installHandlersForParentClass

      public static void installHandlersForParentClass(Class<?> aClass, ParseRule aRule)
      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

      public static void printHandlerClassesForParentClass(Class<?> aClass, int classesPerLine)
      Prints handler classes so parsers can include as constant and avoid reflection for handler install.