Skip to content

Seq pattern match does not work in action #154

@Centaur

Description

@Centaur

Compile fails with message:
Error:scalac: unexpected UnApply collection.this.Seq.unapplySeq[String](<unapply-selector>) <unapply> ((single @ _))

import org.parboiled2.{Rule1, CharPredicate, ParserInput, Parser}

class SeqMatch(val input: ParserInput) extends Parser {
  def id: Rule1[String] = rule {
    capture(CharPredicate.Printable -- '.')
  }

  def root = rule {
    (id + '.') ~> {
      (ids: Seq[String]) =>
        ids match {
          case Seq(single) => MATCH
          case _ => MISMATCH
        }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions