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

- old
+ new

@@ -1,9 +1,9 @@ module Raabro - VERSION = '1.3.0' + VERSION = '1.3.1' class Input attr_accessor :string, :offset attr_reader :options @@ -256,14 +256,15 @@ return nil if parser.is_a?(Symbol) && respond_to?(parser) # so that :plus and co can be overriden case parser - when '?', :q, :qmark then [ 0, 1 ] - when '*', :s, :star then [ 0, 0 ] - when '+', :p, :plus then [ 1, 0 ] - else nil + when '?', :q, :qmark then [ 0, 1 ] + when '*', :s, :star then [ 0, 0 ] + when '+', :p, :plus then [ 1, 0 ] + when '!' then :bang + else nil end end def _narrow(parser) @@ -291,10 +292,14 @@ loop do pa = parsers.shift break unless pa - if q = _quantify(parsers.first) + if parsers.first == '!' + parsers.shift + c = nott(nil, input, pa) + r.children << c + elsif q = _quantify(parsers.first) parsers.shift c = rep(nil, input, pa, *q) r.children.concat(c.children) else c = _parse(pa, input)