lib/qlang/lexer/base.rb in qlang-0.0.14142135 vs lib/qlang/lexer/base.rb in qlang-0.0.27000000
- old
+ new
@@ -1,10 +1,14 @@
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 }
@@ -92,9 +96,15 @@
ary[1] = value.gsub(/:%\|/,'').gsub(/\|%:/,'')
hash = Hash[*ary]
end
hash
end
+ end
+
+ # NEW APIs
+ def parsed!(token_position, parsed)
+ @lexeds.delete_at(token_position)
+ @lexeds.insert(token_position, { R: parsed })
end
private
def to_num(token_with_num)