org.unitils.dbmaintainer.script.parsingstate.impl
Class InSingleQuotesParsingState

java.lang.Object
  extended by org.unitils.dbmaintainer.script.parsingstate.impl.BaseParsingState
      extended by org.unitils.dbmaintainer.script.parsingstate.impl.InSingleQuotesParsingState
All Implemented Interfaces:
ParsingState

public class InSingleQuotesParsingState
extends BaseParsingState

A state for parsing single quotes ('text') part of a script.

Author:
Tim Ducheyne, Filip Neven

Field Summary
protected  boolean backSlashEscapingEnabled
          Determines whether backslashes can be used to escape characters, e.g. \' for a single quote (= '')
protected  boolean escaping
          True if the next character should be escaped
protected  ParsingState normalParsingState
          The normal, not in quotes, not in comment state.
 
Constructor Summary
InSingleQuotesParsingState()
           
 
Method Summary
protected  ParsingState getNextParsingState(char previousChar, char currentChar, char nextChar, StatementBuilder statementBuilder)
          Determines whether the end of the literal is reached.
 void init(ParsingState normalParsingState, boolean backSlashEscapingEnabled)
          Initializes the state with the normal parsing state, that should be returned when the end of the literal is reached..
 
Methods inherited from class org.unitils.dbmaintainer.script.parsingstate.impl.BaseParsingState
handleNextChar
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

normalParsingState

protected ParsingState normalParsingState
The normal, not in quotes, not in comment state.


backSlashEscapingEnabled

protected boolean backSlashEscapingEnabled
Determines whether backslashes can be used to escape characters, e.g. \' for a single quote (= '')


escaping

protected boolean escaping
True if the next character should be escaped

Constructor Detail

InSingleQuotesParsingState

public InSingleQuotesParsingState()
Method Detail

init

public void init(ParsingState normalParsingState,
                 boolean backSlashEscapingEnabled)
Initializes the state with the normal parsing state, that should be returned when the end of the literal is reached..

Parameters:
normalParsingState - The normal state, not null
backSlashEscapingEnabled - True if backslashes can be used for escaping

getNextParsingState

protected ParsingState getNextParsingState(char previousChar,
                                           char currentChar,
                                           char nextChar,
                                           StatementBuilder statementBuilder)
Determines whether the end of the literal is reached. If that is the case, the normal parsing state is returned.

Specified by:
getNextParsingState in class BaseParsingState
Parameters:
previousChar - The previous char, 0 if none
currentChar - The current char
nextChar - The next char, 0 if none
statementBuilder - The statement builder, not null
Returns:
The next parsing state, null if the end of the statement is reached


Copyright © 2011. All Rights Reserved.