module Gecode::Util::Extensional
Public Instance Methods
parse_regexp(regexp)
click to toggle source
Parses a regular expression over the integer domain, returning an instance of Gecode::REG .
Pseudo-BNF of the integer regexp representation: regexp ::= <Fixnum> | <TrueClass> | <FalseClass> | <Gecode::Raw::REG>
| [<regexp>, ...]
# File lib/gecoder/interface/constraints/extensional_regexp.rb, line 65 def parse_regexp(regexp) # Check the involved types. unless regexp.kind_of? Enumerable regexp = [regexp] end regexp.to_a.flatten.each do |element| unless element.kind_of?(Fixnum) or element.kind_of?(Gecode::Raw::REG) or element.kind_of?(TrueClass) or element.kind_of?(FalseClass) raise TypeError, "Can't translate #{element.class} into integer or boolean regexp." end end # Convert it into a regexp. internal_parse_regexp(regexp) end