Class: LanguageParser::SQLT_State

Inherits:
Object
  • Object
show all
Defined in:
lib/cgialib/lp/SQLTokenizer.rb

Overview

class : SQLT_State

The base class state object for the SQL-Tokenizer state machine.

Constant Summary collapse

@@specials =

Special characters that are found as delineators in SQL

{ ";" => 1, "," => 1, ":" => 1, "{" => 1, "}" => 1,
"(" => 1, ")" => 1, "[" => 1, "]" => 1, "%" => 1,
"+" => 1, "-" => 1, "*" => 1, "." => 1 }

Instance Method Summary collapse

Constructor Details

#initialize(newstate, addtoken) ⇒ SQLT_State

initialize( newstate, addtoken )

newstate - A method to be called to change state addtoken - The method to be called to add a token

Intializes the state object



28
29
30
31
32
33
# File 'lib/cgialib/lp/SQLTokenizer.rb', line 28

def initialize( newstate, addtoken )
  
  @newstate = newstate
  @addtoken = addtoken
  
end

Instance Method Details

#next(ch) ⇒ Object

next( ch )

ch - The character

All states should override this method. This handles a character from the stream. Returning true means that the parsing should continue to the next character. Returning false means the parser should stay on the current character.



44
45
46
# File 'lib/cgialib/lp/SQLTokenizer.rb', line 44

def next( ch )
  true
end