Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8955687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:36:32+00:00 2026-06-15T14:36:32+00:00

I’m new to Scala, and have been trying to use its excellent combinator parser

  • 0

I’m new to Scala, and have been trying to use its excellent combinator parser library. I’ve been trying to get this code to compile:

import scala.util.parsing.combinator._
...
val r:Parsers#ParseResult[Node] = parser.parseAll(parser.suite,reader)
r match {
  case Success(r, n) => println(r)
  case Failure(msg, n) => println(msg)
  case Error(msg, n) => println(msg)
}
...

But I keep getting these errors:

TowelParser.scala:97: error: not found: value Success
  case Success(r, n) => println(r)
       ^
TowelParser.scala:98: error: not found: value Failure
  case Failure(msg, n) => println(msg)

TowelParser.scala:99: error: object Error is not a case class constructor, nor does it have an unapply/unapplySeq method
  case Error(msg, n) => println(msg)

I’ve tried lots of different things like:

case Parsers#Success(r, n) => println(r)

and

case Parsers.Success(r, n) => println(r)

and

import scala.util.parsing.combinator.Parsers.Success

But I can’t seem to get this to compile. I’m sure there’s probably something obvious I’m missing, but I’ve been at it for a while, and google doesn’t seem to have any good examples of this.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:36:33+00:00Added an answer on June 15, 2026 at 2:36 pm

    You need to specify the full path for the ParseResult, which includes your Parsers instance. For example:

    import scala.util.parsing.combinator._
    
    object parser extends RegexParsers { def digits = "\\d+".r ^^ (_.toInt) }
    
    val res = parser.parseAll(parser.digits, "42")
    
    res match {
      case parser.Success(r, n) => println(r)
      case parser.Failure(msg, n) => println(msg)
      case parser.Error(msg, n) => println(msg)
    }
    

    Note that you could also import these if you want a little extra syntactic convenience:

    import parser.{ Error, Failure, Success }
    

    Now your original version will work as expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I'm trying to select an H1 element which is the second-child in its group

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.