lib/raabro.rb in raabro-1.1.6 vs lib/raabro.rb in raabro-1.3.0

- old
+ new

@@ -1,9 +1,9 @@ module Raabro - VERSION = '1.1.6' + VERSION = '1.3.0' class Input attr_accessor :string, :offset attr_reader :options @@ -76,20 +76,15 @@ def prune! @children = successful_children end - def string + def string; @input.string[@offset, @length]; end + def strinp; @input.string[@offset, @length].strip; end + alias strim strinp + def nonstring(l=7); @input.string[@offset, l]; end - @input.string[@offset, @length] - end - - def nonstring(l=7) - - @input.string[@offset, l] - end - def lookup(name=nil) name = name ? name.to_s : nil return self if @name && name == nil @@ -406,9 +401,25 @@ r.name = name r end alias rename ren + + def nott(name, input, parser) + + start = input.offset + + r = ::Raabro::Tree.new(name, :nott, input) + c = _parse(parser, input) + r.children << c + + r.length = 0 + r.result = c.result == 1 ? 0 : 1 + + input.offset = start + + r + end def all(name, input, parser) start = input.offset length = input.string.length - input.offset