Class: Cassandra::Mocks::Statement::Tokenizer
- Inherits:
-
Object
- Object
- Cassandra::Mocks::Statement::Tokenizer
- Defined in:
- lib/cassandra_mocks/statement/tokenizer.rb
Constant Summary collapse
- KEYWORD_MAP =
noinspection RubyStringKeysInHashInspection
{ 'CREATE' => :create, 'DROP' => :drop, 'TRUNCATE' => :truncate, 'PRIMARY' => :primary, 'KEY' => :key, 'TABLE' => :table, 'KEYSPACE' => :keyspace, 'INSERT' => :insert, 'UPDATE' => :update, 'SET' => :set, 'VALUES' => :values, 'SELECT' => :select, 'DELETE' => :delete, 'FROM' => :from, 'WHERE' => :where, 'ORDER' => :order, 'BY' => :by, 'ASC' => :asc, 'DESC' => :desc, 'LIMIT' => :limit, 'AND' => :and, 'IN' => :in, 'IF' => :if, 'NOT' => :not, 'EXISTS' => :exists, '(' => :lparen, ')' => :rparen, '<' => :ltri, '>' => :rtri, ',' => :comma, '.' => :dot, '[' => :lbracket, ']' => :rbracket, '=' => :eql, '+' => :plus, '-' => :minus, '*' => :star, '?' => :parameter, }
Instance Attribute Summary collapse
-
#tokens ⇒ Object
readonly
Returns the value of attribute tokens.
Instance Method Summary collapse
-
#initialize(cql) ⇒ Tokenizer
constructor
A new instance of Tokenizer.
- #token_queue ⇒ Object
Constructor Details
#initialize(cql) ⇒ Tokenizer
Returns a new instance of Tokenizer.
49 50 51 52 53 54 55 56 57 |
# File 'lib/cassandra_mocks/statement/tokenizer.rb', line 49 def initialize(cql) @tokens = [] current_token = '' in_string = false in_name = false prev_char = nil tokenize(cql, current_token, in_name, in_string, prev_char) end |
Instance Attribute Details
#tokens ⇒ Object (readonly)
Returns the value of attribute tokens.
47 48 49 |
# File 'lib/cassandra_mocks/statement/tokenizer.rb', line 47 def tokens @tokens end |
Instance Method Details
#token_queue ⇒ Object
59 60 61 62 63 |
# File 'lib/cassandra_mocks/statement/tokenizer.rb', line 59 def token_queue Queue.new.tap do |queue| tokens.each { |token| queue << token } end end |