lib/ruby_ami/lexer.rb in ruby_ami-1.2.3 vs lib/ruby_ami/lexer.rb in ruby_ami-1.2.4
- old
+ new
@@ -1,7 +1,8 @@
# line 1 "lib/ruby_ami/lexer.rl.rb"
+# encoding: utf-8
module RubyAMI
class Lexer
KILOBYTE = 1024
BUFFER_SIZE = 128 * KILOBYTE unless defined? BUFFER_SIZE
@@ -25,24 +26,24 @@
:@current_syntax_error_start,
:@immediate_response_start
]
-# line 68 "lib/ruby_ami/lexer.rl.rb"
+# line 69 "lib/ruby_ami/lexer.rl.rb"
##
attr_accessor :ami_version
def initialize(delegate = nil)
@delegate = delegate
- @data = ""
+ @data = ''.encode('ISO-8859-1', 'ISO-8859-1')
@current_pointer = 0
@ragel_stack = []
@ami_version = 0.0
-# line 44 "lib/ruby_ami/lexer.rb"
+# line 45 "lib/ruby_ami/lexer.rb"
class << self
attr_accessor :_ami_protocol_parser_actions
private :_ami_protocol_parser_actions, :_ami_protocol_parser_actions=
end
self._ami_protocol_parser_actions = [
@@ -855,33 +856,33 @@
attr_accessor :ami_protocol_parser_en_response_follows
end
self.ami_protocol_parser_en_response_follows = 268;
-# line 861 "lib/ruby_ami/lexer.rb"
+# line 862 "lib/ruby_ami/lexer.rb"
begin
@current_pointer ||= 0
@data_ending_pointer ||= @data.length
@current_state = ami_protocol_parser_start
@ragel_stack_top = 0
@token_start = nil
@token_end = nil
@ragel_act = 0
end
-# line 96 "lib/ruby_ami/lexer.rl.rb"
+# line 97 "lib/ruby_ami/lexer.rl.rb"
##
end
def <<(new_data)
extend_buffer_with new_data
resume!
end
def resume!
-# line 883 "lib/ruby_ami/lexer.rb"
+# line 884 "lib/ruby_ami/lexer.rb"
begin
_klen, _trans, _keys, _acts, _nacts = nil
_goto_level = 0
_resume = 10
_eof_trans = 15
@@ -911,11 +912,11 @@
when 30 then
# line 1 "NONE"
begin
@token_start = @current_pointer
end
-# line 917 "lib/ruby_ami/lexer.rb"
+# line 918 "lib/ruby_ami/lexer.rb"
end # from state action switch
end
if _trigger_goto
next
end
@@ -979,91 +980,91 @@
while _nacts > 0
_nacts -= 1
_acts += 1
case _ami_protocol_parser_actions[_acts - 1]
when 0 then
-# line 33 "lib/ruby_ami/lexer.rl.rb"
+# line 34 "lib/ruby_ami/lexer.rl.rb"
begin
init_success end
when 1 then
-# line 35 "lib/ruby_ami/lexer.rl.rb"
+# line 36 "lib/ruby_ami/lexer.rl.rb"
begin
init_response_follows end
when 2 then
-# line 37 "lib/ruby_ami/lexer.rl.rb"
+# line 38 "lib/ruby_ami/lexer.rl.rb"
begin
init_error end
when 3 then
-# line 39 "lib/ruby_ami/lexer.rl.rb"
+# line 40 "lib/ruby_ami/lexer.rl.rb"
begin
message_received @current_message end
when 4 then
-# line 40 "lib/ruby_ami/lexer.rl.rb"
+# line 41 "lib/ruby_ami/lexer.rl.rb"
begin
error_received @current_message end
when 5 then
-# line 42 "lib/ruby_ami/lexer.rl.rb"
+# line 43 "lib/ruby_ami/lexer.rl.rb"
begin
version_starts end
when 6 then
-# line 43 "lib/ruby_ami/lexer.rl.rb"
+# line 44 "lib/ruby_ami/lexer.rl.rb"
begin
version_stops end
when 7 then
-# line 45 "lib/ruby_ami/lexer.rl.rb"
+# line 46 "lib/ruby_ami/lexer.rl.rb"
begin
key_starts end
when 8 then
-# line 46 "lib/ruby_ami/lexer.rl.rb"
+# line 47 "lib/ruby_ami/lexer.rl.rb"
begin
key_stops end
when 9 then
-# line 48 "lib/ruby_ami/lexer.rl.rb"
+# line 49 "lib/ruby_ami/lexer.rl.rb"
begin
value_starts end
when 10 then
-# line 49 "lib/ruby_ami/lexer.rl.rb"
+# line 50 "lib/ruby_ami/lexer.rl.rb"
begin
value_stops end
when 11 then
-# line 51 "lib/ruby_ami/lexer.rl.rb"
+# line 52 "lib/ruby_ami/lexer.rl.rb"
begin
error_reason_starts end
when 12 then
-# line 52 "lib/ruby_ami/lexer.rl.rb"
+# line 53 "lib/ruby_ami/lexer.rl.rb"
begin
error_reason_stops end
when 13 then
-# line 54 "lib/ruby_ami/lexer.rl.rb"
+# line 55 "lib/ruby_ami/lexer.rl.rb"
begin
syntax_error_starts end
when 14 then
-# line 55 "lib/ruby_ami/lexer.rl.rb"
+# line 56 "lib/ruby_ami/lexer.rl.rb"
begin
syntax_error_stops end
when 15 then
-# line 57 "lib/ruby_ami/lexer.rl.rb"
+# line 58 "lib/ruby_ami/lexer.rl.rb"
begin
immediate_response_starts end
when 16 then
-# line 58 "lib/ruby_ami/lexer.rl.rb"
+# line 59 "lib/ruby_ami/lexer.rl.rb"
begin
immediate_response_stops end
when 17 then
-# line 60 "lib/ruby_ami/lexer.rl.rb"
+# line 61 "lib/ruby_ami/lexer.rl.rb"
begin
follows_text_starts end
when 18 then
-# line 61 "lib/ruby_ami/lexer.rl.rb"
+# line 62 "lib/ruby_ami/lexer.rl.rb"
begin
follows_text_stops end
when 19 then
-# line 63 "lib/ruby_ami/lexer.rl.rb"
+# line 64 "lib/ruby_ami/lexer.rl.rb"
begin
event_name_starts end
when 20 then
-# line 64 "lib/ruby_ami/lexer.rl.rb"
+# line 65 "lib/ruby_ami/lexer.rl.rb"
begin
event_name_stops end
when 21 then
# line 34 "lib/ruby_ami/lexer_machine.rl"
begin
@@ -1383,11 +1384,11 @@
else
begin begin @current_pointer = (( @token_end))-1; end
end
end
end
-# line 1389 "lib/ruby_ami/lexer.rb"
+# line 1390 "lib/ruby_ami/lexer.rb"
end # action switch
end
end
if _trigger_goto
next
@@ -1408,11 +1409,11 @@
when 29 then
# line 1 "NONE"
begin
@ragel_act = 0
end
-# line 1414 "lib/ruby_ami/lexer.rb"
+# line 1415 "lib/ruby_ami/lexer.rb"
end # to state action switch
end
if _trigger_goto
next
end
@@ -1439,11 +1440,11 @@
break
end
end
end
-# line 105 "lib/ruby_ami/lexer.rl.rb"
+# line 106 "lib/ruby_ami/lexer.rl.rb"
##
end
def extend_buffer_with(new_data)
length = new_data.size
@@ -1462,10 +1463,10 @@
end
end
@data.slice! 0...length
adjust_pointers -length
end
- @data << new_data
+ @data << new_data.encode('ISO-8859-1', 'ISO-8859-1')
@data_ending_pointer = @data.size
end
protected