org.dbmaintain.script.parser.parsingstate.impl
Class BaseNormalParsingState
java.lang.Object
org.dbmaintain.script.parser.parsingstate.impl.BaseNormalParsingState
- All Implemented Interfaces:
- ParsingState
- Direct Known Subclasses:
- PlSqlBlockNormalParsingState, SqlStatementNormalParsingState
public abstract class BaseNormalParsingState
- extends Object
- implements ParsingState
The default initial parsing state that is able to recognize the beginning of line comments, block comments,
single and double quote literals and the ending of a statement.
- Author:
- Tim Ducheyne, Filip Neven
Method Summary |
HandleNextCharacterResult |
getNextParsingState(Character previousChar,
Character currentChar,
Character nextChar,
StatementBuilder statementBuilder)
Determines the next state. |
protected abstract boolean |
isEndOfStatement(Character previousChar,
Character currentChar,
StatementBuilder statementBuilder)
|
protected abstract boolean |
isStatementSeparator(Character currentChar)
|
protected boolean |
isWhitespace(Character character)
|
void |
linkParsingStates(ParsingState inLineCommentParsingState,
ParsingState inBlockCommentParsingState,
ParsingState inCurlyBraceBlockCommentParsingState,
ParsingState inSingleQuotesParsingState,
ParsingState inDoubleQuotesParsingState,
ParsingState escapingParsingState,
ParsingState plSqlBlockNormalParsingState)
Initializes the state with the given parsing states. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BACKSLASH
protected static final Character BACKSLASH
DASH
protected static final Character DASH
SLASH
protected static final Character SLASH
ASTERIX
protected static final Character ASTERIX
SINGLE_QUOTE
protected static final Character SINGLE_QUOTE
DOUBLE_QUOTE
protected static final Character DOUBLE_QUOTE
SEMICOLON
protected static final Character SEMICOLON
OPEN_CURLY_BRACE
protected static final Character OPEN_CURLY_BRACE
backSlashEscapingEnabled
protected boolean backSlashEscapingEnabled
curlyBraceBlockCommentSupported
protected boolean curlyBraceBlockCommentSupported
plSqlBlockMatcher
protected PlSqlBlockMatcher plSqlBlockMatcher
endOfStatementResult
protected HandleNextCharacterResult endOfStatementResult
stayInNormalNotExecutableResult
protected HandleNextCharacterResult stayInNormalNotExecutableResult
stayInNormalExecutableResult
protected HandleNextCharacterResult stayInNormalExecutableResult
toEscapingParsingStateResult
protected HandleNextCharacterResult toEscapingParsingStateResult
toInLineCommentResult
protected HandleNextCharacterResult toInLineCommentResult
toInBlockCommentResult
protected HandleNextCharacterResult toInBlockCommentResult
toCurlyBraceBlockCommentResult
protected HandleNextCharacterResult toCurlyBraceBlockCommentResult
toInSingleQuotesStateResult
protected HandleNextCharacterResult toInSingleQuotesStateResult
toInDoubleQuotesStateResult
protected HandleNextCharacterResult toInDoubleQuotesStateResult
toInPlSqlBlockStateResult
protected HandleNextCharacterResult toInPlSqlBlockStateResult
BaseNormalParsingState
protected BaseNormalParsingState(boolean backSlashEscapingEnabled,
boolean curlyBraceBlockCommentSupported,
PlSqlBlockMatcher plSqlBlockMatcher)
linkParsingStates
public void linkParsingStates(ParsingState inLineCommentParsingState,
ParsingState inBlockCommentParsingState,
ParsingState inCurlyBraceBlockCommentParsingState,
ParsingState inSingleQuotesParsingState,
ParsingState inDoubleQuotesParsingState,
ParsingState escapingParsingState,
ParsingState plSqlBlockNormalParsingState)
- Initializes the state with the given parsing states.
- Parameters:
inLineCommentParsingState
- the inline comment state, not nullinBlockCommentParsingState
- the block comment state, not nullinCurlyBraceBlockCommentParsingState
- the curly brace block comment state, not nullinSingleQuotesParsingState
- the single quote literal state, not nullinDoubleQuotesParsingState
- the double quote literal state, not nullescapingParsingState
- the escaping parsing state, not nullplSqlBlockNormalParsingState
- the pl-sql block parsing state, not null
getNextParsingState
public HandleNextCharacterResult getNextParsingState(Character previousChar,
Character currentChar,
Character nextChar,
StatementBuilder statementBuilder)
- Determines the next state. This will look for the beginning of a line comment, a block comment, a single quote
literal and a double quote literal. A semi-colon indicates the end of the statement.
- Specified by:
getNextParsingState
in interface ParsingState
- Parameters:
previousChar
- The previous char, null if nonecurrentChar
- The current charnextChar
- The next char, null if nonestatementBuilder
- The statement builder, not null
- Returns:
- The next parsing state, null if the end of the statement is reached
isStatementSeparator
protected abstract boolean isStatementSeparator(Character currentChar)
isEndOfStatement
protected abstract boolean isEndOfStatement(Character previousChar,
Character currentChar,
StatementBuilder statementBuilder)
isWhitespace
protected boolean isWhitespace(Character character)
Copyright © 2011. All Rights Reserved.