In such cases you may use
~! with production rules designed specifically to match the error.
I don't know yet how to deal with (1), but I was also looking for (2) when I found this webpage:
I'm just copying the information:
A useful enhancement is to record the input position (line number and column number) of the significant tokens. To do this, you must do three things:
- Make each output type extend scala.util.parsing.input.Positional
- invoke the Parsers.positioned() combinator
- Use a text source that records line and column positions
Finally, ensure that the source tracks positions. For streams, you can simply use scala.util.parsing.input.StreamReader; for Strings, use scala.util.parsing.input.CharArrayReader.
I'm currently playing with it so I'll try to add a simple example later
- How to further improve error messages in Scala parser-combinator based parsers?
- Scala Parser Combinator Custom Error Messages
- returning meaningful error messages from a parser written with Scala Parser Combinators
- Scala parser combinators: how to return the content of intermediate parsers when combined with "into"?
- How to test if Scala combinator parser matches a string
- SCALA: How to convert a Parser Combinator result to Scala List[String]?
- Scala parser combinator based calculator that can also take a dataRecord
- How do I get meaningful error messages for nested scala unit equality matchers?
- Use Scala parser combinator to parse CSV files
- How do the new Scala TypeTags improve the (deprecated) Manifests?
- How do Scala parser combinators compare to Haskell's Parsec?
- How can I create a parser combinator in which line endings are significant?
- How to improve the error message readability returned from JsError.toFlatJson or JsError.toJson in Play framework 2.x?
- How to debug a scala based Spark program on Intellij IDEA
- How do the Scala based frameworks stack up for a complete Scala newbie - Lift, Play, Circumflex, etc
- EBNF to Scala parser combinator
- Ignoring C-style comments in a Scala combinator parser
- how to make scala parser fail
- How to change code using Scala Parser Combinators to take operator precedence into account?
- Parsing an indentation based language using scala parser combinators
- How do I create a generic Scala function that returns an object based on the generic type?
- Parser combinator not terminating - how to log what is going on?
- how do i throw exceptions with meaningful messages with a scala combination parser?
- Scala combinator parsers - distinguish between number strings and variable strings
- How to pattern match on Scala's parser combinator result
- pattern match args and give error messages in a lightweight Scala script
- Scala - how to go resolve "Value is not a member of Nothing" error
- How to Merge or skip duplicate messages in a Scala Actor?
- How Scala achieve performance improvement for Map and Set by using different Class based on size?
- How to add a time based watcher to a Scala Future?
More Query from same tag
- In Java or Scala, how to define conditional control flow based on whether type bound is satisfied?
- Case with no return value
- Filter a scala dataset on a Option[timestamp] column to return dates that are within n days of current date
- Pattern match end/middle of list in Scala
- How number of tasks will get execute if file have 4 partitions?
- Does Akka Tcp support full-duplex communication?
- Defining case classes when the supervisor and child actor share same messages
- How do you call a function which takes a tuple of two as an argument and returns a tuple of two as a result in Scala?
- Spark: Distributed removal/addition of elements in a set?
- Removing values after particular character from rdd in scala
- Rewrite LogicalPlan to push down udf from aggregate
- Slick dynamically filter by a list of columns and values
- scala-arm. Return type
- In Scala is there a way to specify that the return type should match the type of the method caller?
- Count all occurrences of a char within a string
- How do I get unique incoming request IP address
- How to get absolute URL of action in controller via Scala Routing DSL?
- Akka.js TestKit: compilation error on simple example
- Ensure number of RDD elements are equal
- Slick: Default arguments in prepared query (for limit and range)
- Enumerator vs Iterator in scala and java
- Typecasting a Dataframe returns 'null' for empty fields
- What's the magic behind this flatMap code?
- How to run MLlib usage examples with Intellij IDE?
- cqlsh 'Select' statement does not return the data that exists
- Scala implicit parameter scope
- How to define a function that takes a function literal (with an implicit parameter) as an argument?
- Why is sbt using incorrect version number for declared dependencies?
- Forward reference extends over definition of value shapes
- Extractor for a shapeless HList that mimics parser concatenation `~`