lib/qlang/lexer/base.rb in qlang-0.0.27 vs lib/qlang/lexer/base.rb in qlang-0.0.141
- old
+ new
@@ -1,14 +1,10 @@
require 'strscan'
-require 'qlang/lexer/tokens'
-
module Qlang
module Lexer
class Base
- attr_accessor :lexeds
- include Tokens
class << self
attr_reader :token_hash
def rule(pattern, &token)
token ||= proc { :NULL }
@@ -98,20 +94,12 @@
end
hash
end
end
- # NEW APIs
- def parsed!(token_position, parsed)
- @lexeds.delete_at(token_position)
- @lexeds.insert(token_position, { R: parsed })
+ private def to_num(token_with_num)
+ token_with_num =~ /\d+/
+ $&.to_i
end
-
- private
-
- def to_num(token_with_num)
- token_with_num =~ /\d+/
- $&.to_i
- end
end
end
end