Class ParameterParser

java.lang.Object
org.parboiled.BaseActions<V>
org.parboiled.BaseParser<Object>
com.priint.pubserver.parameterparser.BaseParameterParser
com.priint.pubserver.parameterparser.ParameterParser
All Implemented Interfaces:
org.parboiled.ContextAware<Object>

public class ParameterParser extends BaseParameterParser

Parser containing rules for publishing server commands and param listings.

Additionally some static methods for calling the parser and caching the results.

Typically parse results are taken from a cache and new parser runs are only started if an item was not found in stack. Parsing itself is a synchronized - so it will block other threads to run a new parse. On typical systems a run may take less than 1 msec.

Developers will rarely use this class directly, but call any of the interpret methods of the ParameterInterpreter instead.

For more information, please refer to the ParameterInterpreter SDK documentation or to the Howto for the ParameterParser and related classes.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    A call for the parameter interpreter. static: call using java class name, i.e.
    static class 
    A parameter for the parameter interpreter.
  • Field Summary

    Fields inherited from class org.parboiled.BaseParser

    ANY, DEDENT, EMPTY, EOI, INDENT, NOTHING
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<Object>
    Retrieve a parsing result for the input string from the internal cache or create a new one.
    static void
    Clear the cache of already parsed params.
    static int
    Retrieve the size of internal cache for parsing results.
    static List<Object>
    parse(String paramString)
    Runs a parse and returns the result as list of Objects.

    Methods inherited from class com.priint.pubserver.parameterparser.BaseParameterParser

    FirstOf, fromStringLiteral, OneOrMore, OneOrMore, Optional, ZeroOrMore

    Methods inherited from class org.parboiled.BaseParser

    ACTION, AnyOf, AnyOf, AnyOf, Ch, CharRange, FirstOf, fromCharArray, fromCharLiteral, IgnoreCase, IgnoreCase, IgnoreCase, newInstance, NoneOf, NoneOf, NTimes, NTimes, Optional, Sequence, Sequence, String, String, Test, Test, TestNot, TestNot, toRule, toRules, ZeroOrMore

    Methods inherited from class org.parboiled.BaseActions

    currentChar, currentIndex, drop, drop, dup, getContext, hasError, inPredicate, match, matchedChar, matchEnd, matchLength, matchOrDefault, matchRange, matchStart, nodeSuppressed, peek, peek, poke, poke, pop, pop, position, push, push, pushAll, setContext, swap, swap3, swap4, swap5, swap6

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ParameterParser

      public ParameterParser()
  • Method Details

    • cacheParse

      public static List<Object> cacheParse(String input) throws ParameterInterpreterException
      Retrieve a parsing result for the input string from the internal cache or create a new one.

      If not found a new parse will be triggered and the result stored in the cache.

      Parameters:
      input - string of parameters to be parsed, typically a command to be interpreted
      Returns:
      List of Objects
      Throws:
      ParameterInterpreterException - when parse run fails
    • getCacheSize

      public static int getCacheSize()
      Retrieve the size of internal cache for parsing results.
      Returns:
      size
    • parse

      public static List<Object> parse(String paramString) throws ParameterInterpreterException
      Runs a parse and returns the result as list of Objects.

      Parsing errors will be written as warnings to the log.

      This method blocks other threads from executing it until it returns. Expect single parses to return in less than 1 msec.

      Parameters:
      paramString - input string to be parsed
      Returns:
      parse result
      Throws:
      ParameterInterpreterException - if the run returned no result, because the input is not valid
    • clearParsingResults

      public static void clearParsingResults()
      Clear the cache of already parsed params.