Class ParseUtil


  • public class ParseUtil
    extends java.lang.Object
    This helper class parses a string into a SQL operation using the NanoSQL parser.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static org.apache.logging.log4j.Logger logger
      A logging object for reporting anything interesting that happens.
    • Constructor Summary

      Constructors 
      Constructor Description
      ParseUtil()  
    • Field Detail

      • logger

        private static org.apache.logging.log4j.Logger logger
        A logging object for reporting anything interesting that happens.
    • Constructor Detail

      • ParseUtil

        public ParseUtil()
    • Method Detail

      • appendSemicolon

        public static java.lang.String appendSemicolon​(java.lang.String command)
        This helper function conditionally appends a semicolon onto a command string if one is not already present. Note that leading and trailing whitespace are also trimmed by this function.
        Parameters:
        command - the SQL command to optionally append a semicolon to.
        Returns:
        a SQL command that is definitely terminated with a semicolon.
      • parseCommand

        public static Command parseCommand​(java.lang.String command,
                                           FunctionDirectory functionDirectory)
                                    throws org.antlr.v4.runtime.RecognitionException
        Parse an input string into some kind of Command.
        Parameters:
        command - the string representation of the command
        functionDirectory - a directory of functions to resolve function-calls against
        Returns:
        a Command object representing the command
        Throws:
        org.antlr.v4.runtime.RecognitionException - if the string could not be parsed
      • parseCommand

        public static Command parseCommand​(java.lang.String command)
                                    throws org.antlr.v4.runtime.RecognitionException
        Parse an input string into some kind of Command.
        Parameters:
        command - the string representation of the command
        Returns:
        a Command object representing the command
        Throws:
        org.antlr.v4.runtime.RecognitionException - if the string could not be parsed
      • parseCommands

        public static java.util.List<Command> parseCommands​(java.lang.String commands,
                                                            FunctionDirectory functionDirectory)
                                                     throws org.antlr.v4.runtime.RecognitionException
        Throws:
        org.antlr.v4.runtime.RecognitionException
      • parseExpression

        public static Expression parseExpression​(java.lang.String expression)