class Regexp::Expression::Conditional::Expression
def <<(exp)
def <<(exp) @expressions.last << exp end
def branch(exp = nil)
def branch(exp = nil) raise TooManyBranches.new if @branches.length == 2 sequence = Branch.new(level, set_level, conditional_level + 1) @expressions << sequence @branches << @expressions.last end
def branches
def branches @branches end
def condition(exp = nil)
def condition(exp = nil) return @condition unless exp @condition = exp @expressions << exp end
def initialize(token, options = {})
def initialize(token, options = {}) super @condition = nil @branches = [] end
def quantify(token, text, min = nil, max = nil, mode = :greedy)
def quantify(token, text, min = nil, max = nil, mode = :greedy) branches.last.last.quantify(token, text, min, max, mode) end
def to_s
def to_s s = @text.dup s << @condition.text s << branches.map{|e| e.to_s}.join('|') s << ')' end