class RuboCop::AST::NodePattern::Compiler

def compile_union

def compile_union
  # we need to ensure that each branch of the {} contains the same
  # number of captures (since only one branch of the {} can actually
  # match, the same variables are used to hold the captures for each
  # branch)
  enum = tokens_until('}', 'union')
  enum = unify_in_union(enum)
  terms = insure_same_captures(enum, 'branch of {}')
          .map { compile_expr }
  "(#{terms.join(' || ')})"
end