Package sqlline

Class SqlLineParser

java.lang.Object
org.jline.reader.impl.DefaultParser
sqlline.SqlLineParser
All Implemented Interfaces:
org.jline.reader.Parser

public class SqlLineParser
extends org.jline.reader.impl.DefaultParser
SqlLineParser implements multi-line for sql, !sql, !all while it's not ended with a non-commented ';'.

The following table shows each of the prompts you may see and summarizes what they mean about the state that sqlline is in.

SQLLine continuation prompts
Prompt Meaning
sqlline> Ready for a new query
semicolon> Waiting for next line of multiple-line query, waiting for completion of query with semicolon (;)
quote> Waiting for next line, waiting for completion of a string that began with a single quote (')
dquote> Waiting for next line, waiting for completion of a string that began with a double quote (")
`> Waiting for next line, waiting for completion of a string that began with (`)
*\/> Waiting for next line, waiting for completion of a multi-line comment that began with "/*"
)> Waiting for next line, waiting for completion of a string that began with a round bracket, "("
]> Waiting for next line, waiting for completion of a string that began with a square bracket, "["
extra ')'> There is an extra round bracket, ")", that is not opened with "("
extra ']'> There is an extra square bracket "]" that is not opened with "["
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    class  SqlLineParser.SqlLineArgumentList  
    static class  SqlLineParser.SqlParserState  

    Nested classes/interfaces inherited from class org.jline.reader.impl.DefaultParser

    org.jline.reader.impl.DefaultParser.ArgumentList, org.jline.reader.impl.DefaultParser.Bracket

    Nested classes/interfaces inherited from interface org.jline.reader.Parser

    org.jline.reader.Parser.ParseContext
  • Field Summary

    Fields inherited from interface org.jline.reader.Parser

    REGEX_COMMAND, REGEX_VARIABLE
  • Constructor Summary

    Constructors 
    Constructor Description
    SqlLineParser​(SqlLine sqlLine)  
  • Method Summary

    Modifier and Type Method Description
    java.lang.String getQuoteWaitingPattern​(java.lang.String line, int quoteStart)  
    org.jline.reader.ParsedLine parse​(java.lang.String line, int cursor, org.jline.reader.Parser.ParseContext context)  
    SqlLineParser.SqlLineArgumentList parseState​(java.lang.String line, int cursor, org.jline.reader.Parser.ParseContext context)  
    static java.lang.String trimLeadingSpacesIfPossible​(java.lang.String line, org.jline.reader.Parser.ParseContext context)  

    Methods inherited from class org.jline.reader.impl.DefaultParser

    commandGroup, eofOnEscapedNewLine, eofOnUnclosedBracket, eofOnUnclosedQuote, escapeChars, getCommand, getEscapeChars, getQuoteChars, getVariable, isDelimiter, isDelimiterChar, isEofOnEscapedNewLine, isEofOnUnclosedQuote, isEscapeChar, isEscapeChar, isEscaped, isQuoteChar, isQuoted, quoteChars, regexCommand, regexVariable, setCommandGroup, setEofOnEscapedNewLine, setEofOnUnclosedBracket, setEofOnUnclosedQuote, setEscapeChars, setQuoteChars, setRegexCommand, setRegexVariable, validCommandName, validVariableName

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.jline.reader.Parser

    parse
  • Constructor Details

  • Method Details

    • parse

      public org.jline.reader.ParsedLine parse​(java.lang.String line, int cursor, org.jline.reader.Parser.ParseContext context)
      Specified by:
      parse in interface org.jline.reader.Parser
      Overrides:
      parse in class org.jline.reader.impl.DefaultParser
    • parseState

      public SqlLineParser.SqlLineArgumentList parseState​(java.lang.String line, int cursor, org.jline.reader.Parser.ParseContext context)
    • getQuoteWaitingPattern

      public java.lang.String getQuoteWaitingPattern​(java.lang.String line, int quoteStart)
    • trimLeadingSpacesIfPossible

      public static java.lang.String trimLeadingSpacesIfPossible​(java.lang.String line, org.jline.reader.Parser.ParseContext context)