class Gamefic::Scanner::Nesting
def denest
def denest near = selection far = selection parts = token.split(NEST_REGEXP) until parts.empty? current = parts.pop last_result = subprocessor.scan(near, current) last_result = subprocessor.scan(far, current) if last_result.matched.empty? && near != far return unmatched_result if last_result.matched.empty? || last_result.matched.length > 1 near = last_result.matched.first.children & selection far = last_result.matched.first.flatten & selection end last_result end