class LineParser extends JavaTokenParsers

LineParser: class to parse lines of a CSV file. NOTE: list elements always appear as a string in the form { element0 , element1 , ... }

Linear Supertypes
JavaTokenParsers, RegexParsers, Parsers, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. LineParser
  2. JavaTokenParsers
  3. RegexParsers
  4. Parsers
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new LineParser(delimiter: Regex, string: Regex, enclosures: String, listSeparator: Char, quote: Char, verbose: Boolean = false)

    delimiter

    a Regex used to match a delimiter between cells in a row.

    string

    a Regex used to match the content of a cell.

    enclosures

    the enclosure characters around a list (if any).

    listSeparator

    the list separator character.

    quote

    the quote character which is able to preempt the string regex: between two quote characters, there can be any number of any character (other than quote).

    verbose

    will print the various parameters.

Type Members

  1. type Elem = Char
    Definition Classes
    RegexParsers → Parsers
  2. case class Error extends NoSuccess with Product with Serializable
    Definition Classes
    Parsers
  3. case class Failure extends NoSuccess with Product with Serializable
    Definition Classes
    Parsers
  4. type Input = Reader[Elem]
    Definition Classes
    Parsers
  5. sealed abstract class NoSuccess extends ParseResult[Nothing]
    Definition Classes
    Parsers
  6. trait OnceParser[+T] extends Parser[T]
    Definition Classes
    Parsers
  7. sealed abstract class ParseResult[+T] extends AnyRef
    Definition Classes
    Parsers
  8. abstract class Parser[+T] extends (Input) => ParseResult[T]
    Definition Classes
    Parsers
  9. case class Success[+T] extends ParseResult[T] with Product with Serializable
    Definition Classes
    Parsers
  10. case class ~[+a, +b] extends Product with Serializable
    Definition Classes
    Parsers

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def OnceParser[T](f: (Input) => ParseResult[T]): Parser[T] with OnceParser[T]
    Definition Classes
    Parsers
  5. def Parser[T](f: (Input) => ParseResult[T]): Parser[T]
    Definition Classes
    Parsers
  6. def accept[U](expected: String, f: PartialFunction[Elem, U]): Parser[U]
    Definition Classes
    Parsers
  7. def accept[ES](es: ES)(implicit f: (ES) => List[Elem]): Parser[List[Elem]]
    Definition Classes
    Parsers
  8. implicit def accept(e: Elem): Parser[Elem]
    Definition Classes
    Parsers
  9. def acceptIf(p: (Elem) => Boolean)(err: (Elem) => String): Parser[Elem]
    Definition Classes
    Parsers
  10. def acceptMatch[U](expected: String, f: PartialFunction[Elem, U]): Parser[U]
    Definition Classes
    Parsers
  11. def acceptSeq[ES](es: ES)(implicit f: (ES) => Iterable[Elem]): Parser[List[Elem]]
    Definition Classes
    Parsers
  12. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  13. lazy val cell: Parser[String]

    A Parser that attempts to parse a cell value in a variety of forms.

    A Parser that attempts to parse a cell value in a variety of forms.

    The cell parser evaluates different parsing strategies in sequence:

    • quotedString: Parses a string enclosed in quotation marks.
    • list: Parses a list structure.
    • string: Parses a generic string.
    • failure("invalid string"): Returns a parsing failure with the message "invalid string" if none of the other parsers are successful.

    This parser is declared as lazy to allow it to be initialized when first accessed, enabling any dependencies it might have to be resolved at runtime.

  14. def chainl1[T, U](first: => Parser[T], p: => Parser[U], q: => Parser[(T, U) => T]): Parser[T]
    Definition Classes
    Parsers
  15. def chainl1[T](p: => Parser[T], q: => Parser[(T, T) => T]): Parser[T]
    Definition Classes
    Parsers
  16. def chainr1[T, U](p: => Parser[T], q: => Parser[(T, U) => U], combine: (T, U) => U, first: U): Parser[U]
    Definition Classes
    Parsers
  17. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  18. def commit[T](p: => Parser[T]): Parser[T]
    Definition Classes
    Parsers
  19. def decimalNumber: Parser[String]
    Definition Classes
    JavaTokenParsers
  20. def elem(e: Elem): Parser[Elem]
    Definition Classes
    Parsers
  21. def elem(kind: String, p: (Elem) => Boolean): Parser[Elem]
    Definition Classes
    Parsers
  22. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  24. def err(msg: String): Parser[Nothing]
    Definition Classes
    RegexParsers → Parsers
  25. def failure(msg: String): Parser[Nothing]
    Definition Classes
    Parsers
  26. def floatingPointNumber: Parser[String]
    Definition Classes
    JavaTokenParsers
  27. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  28. def guard[T](p: => Parser[T]): Parser[T]
    Definition Classes
    Parsers
  29. def handleWhiteSpace(source: CharSequence, offset: Int): Int
    Attributes
    protected
    Definition Classes
    RegexParsers
  30. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  31. def ident: Parser[String]
    Definition Classes
    JavaTokenParsers
  32. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  33. lazy val list: Parser[String]

    A lazy val for a Parser that parses a list-like structure encapsulated by open and close characters.

    A lazy val for a Parser that parses a list-like structure encapsulated by open and close characters.

    The parser works as follows: 1. It expects an opening character (getOpenChar). 2. It parses a component followed by a listSeparator, and one or more components separated by listSeparator using rep1sep. 3. It concludes by expecting a closing character (getCloseChar). 4. Finally, it transforms the parsed elements into a String representation where the components are encapsulated by curly braces and separated by commas, e.g., "{component1,component2,...}".

    returns

    A Parser[String] that produces the string representation of the parsed list.

  34. implicit def literal(s: String): Parser[String]
    Definition Classes
    RegexParsers
  35. def log[T](p: => Parser[T])(name: String): Parser[T]
    Definition Classes
    Parsers
  36. def mkList[T]: (~[T, List[T]]) => List[T]
    Definition Classes
    Parsers
  37. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  38. def not[T](p: => Parser[T]): Parser[Unit]
    Definition Classes
    Parsers
  39. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  40. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  41. def opt[T](p: => Parser[T]): Parser[Option[T]]
    Definition Classes
    Parsers
  42. def parse[T](p: Parser[T], in: Reader): ParseResult[T]
    Definition Classes
    RegexParsers
  43. def parse[T](p: Parser[T], in: CharSequence): ParseResult[T]
    Definition Classes
    RegexParsers
  44. def parse[T](p: Parser[T], in: Reader[Char]): ParseResult[T]
    Definition Classes
    RegexParsers
  45. def parseAll[T](p: Parser[T], in: CharSequence): ParseResult[T]
    Definition Classes
    RegexParsers
  46. def parseAll[T](p: Parser[T], in: Reader): ParseResult[T]
    Definition Classes
    RegexParsers
  47. def parseAll[T](p: Parser[T], in: Reader[Char]): ParseResult[T]
    Definition Classes
    RegexParsers
  48. def parseRow(indexedString: (String, Int)): Try[Strings]

    Method to parse a Row.

    Method to parse a Row.

    NOTE: the expressions "end of input expected" and "end of input" are defined in (trait) Parsers: def phrase[T](p: Parser[T]): Parser[T] def acceptMatch[U]... def acceptIf... It's a shame that they didn't make it a constant in Parsers!

    CONSIDER checking that sequential lines really are sequential. Currently, no use is made of indexedString._2

    indexedString

    a tuple of String and Int denoting the line and its index in the file.

    returns

    a Try[Strings].

  49. def phrase[T](p: Parser[T]): Parser[T]
    Definition Classes
    RegexParsers → Parsers
  50. def positioned[T <: Positional](p: => Parser[T]): Parser[T]
    Definition Classes
    RegexParsers → Parsers
  51. lazy val pureQuotedString: Parser[String]

    A Parser that extracts a quoted string from the input.

    A Parser that extracts a quoted string from the input.

    The parser is defined as a combination of three elements: - quote: Matches the opening quote character. - stringInQuotes: Parses the content inside the quotes. - quote: Matches the closing quote character.

    This parser uses the sequence combinators (~> and <~) to drop the quote characters themselves.

    returns

    a Parser[String] that successfully parses a string enclosed in quotes and returns the content within the quotes as a String.

  52. lazy val quotedString: Parser[String]

    A parser for quoted strings in the input, using a combination of possible parsing strategies.

    A parser for quoted strings in the input, using a combination of possible parsing strategies.

    The quotedString method combines three different parsers to handle quoted strings: 1. quotedStringWithQuotes: Parses quoted strings that include surrounding quotation marks. 2. pureQuotedString: Parses quoted strings but may apply stricter conditions (e.g., specific delimiters or special characters). 3. failure("invalid quoted string"): Ensures that any string not following the valid quoted string format results in a failure.

    This is defined as a lazy val, meaning the parser's initialization is deferred until it is first accessed.

    returns

    A Parser[String] that matches valid quoted strings in the input.

  53. lazy val quotedStringWithQuotes: Parser[String]

    Parser for quoted strings that includes the surrounding quotes as part of the result.

    Parser for quoted strings that includes the surrounding quotes as part of the result.

    This lazy value utilizes quotedStringWithQuotesAsList, which parses the string components into a list of strings. It then combines those components into a single string by adding the surrounding quotes (as defined by the quote variable).

    The resulting parsed string includes both the content of the quoted string and the enclosing quote characters.

    For example: Input: "Hello, World!" Output: "Hello, World!" (as a single string, including the quotation marks)

    returns

    a parser that yields the entire quoted string, including the enclosing quotes.

  54. lazy val quotedStringWithQuotesAsList: Parser[Strings]

    A parser that extracts a sequence of strings (Strings) from a quoted string, interpreting quotes and escaped quotes appropriately.

    A parser that extracts a sequence of strings (Strings) from a quoted string, interpreting quotes and escaped quotes appropriately.

    The input is expected to start and end with a quote character. Inside the quotes, delimited substrings can be separated by pairs of quote characters.

    Example Input: "abc""def""ghi" Parsed Output: Seq("abc", "def", "ghi")

    The parser works as follows: - quote ~> ensures that the input starts with a single opening quote. - repsep(stringInQuotes, s"$quote$quote") parses a repetition of strings defined by stringInQuotes, with consecutive strings separated by double quotes (""). - <~ quote ensures the input ends with a single closing quote.

    returns

    a Parser[Strings] capable of parsing a quoted string into a sequence of substrings.

  55. implicit def regex(r: Regex): Parser[String]
    Definition Classes
    RegexParsers
  56. def rep[T](p: => Parser[T]): Parser[List[T]]
    Definition Classes
    Parsers
  57. def rep1[T](first: => Parser[T], p0: => Parser[T]): Parser[List[T]]
    Definition Classes
    Parsers
  58. def rep1[T](p: => Parser[T]): Parser[List[T]]
    Definition Classes
    Parsers
  59. def rep1sep[T](p: => Parser[T], q: => Parser[Any]): Parser[List[T]]
    Definition Classes
    Parsers
  60. def repN[T](num: Int, p: => Parser[T]): Parser[List[T]]
    Definition Classes
    Parsers
  61. def repNM[T](n: Int, m: Int, p: Parser[T], sep: Parser[Any]): Parser[List[T]]
    Definition Classes
    Parsers
  62. def repsep[T](p: => Parser[T], q: => Parser[Any]): Parser[List[T]]
    Definition Classes
    Parsers
  63. lazy val row: Parser[Strings]

    A parser for parsing a single row consisting of multiple cells separated by a delimiter.

    A parser for parsing a single row consisting of multiple cells separated by a delimiter.

    This parser matches and extracts repetitions of cells (parsed by the cell parser) separated by the specified delimiter. The result is returned as a sequence of strings (Strings).

    - The rep1sep combinator ensures that at least one cell is expected in the row. - The delimiter parser defines the separator between cells.

    This parser can be used in conjunction with other parsers to process row-based data with a specific format or structure.

  64. def skipWhitespace: Boolean
    Definition Classes
    LineParser → RegexParsers
  65. lazy val stringInQuotes: Parser[String]

    A Parser that matches a string that includes zero or more characters (other than quote characters as defined by the quote parameter).

    A Parser that matches a string that includes zero or more characters (other than quote characters as defined by the quote parameter).

    This parser specifically matches a sequence of characters that does not include the quote character ("). The quote character in this context is expected to be defined elsewhere in the class or inherited scope.

    Usage: This parser can be used to identify and extract substrings within a larger input that are enclosed in quotes, as part of a more complex parsing process.

    returns

    a string that matches the defined regular expression.

  66. def stringLiteral: Parser[String]
    Definition Classes
    JavaTokenParsers
  67. def success[T](v: T): Parser[T]
    Definition Classes
    Parsers
  68. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  69. def toString(): String
    Definition Classes
    LineParser → AnyRef → Any
  70. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  71. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  72. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  73. val whiteSpace: Regex
    Attributes
    protected
    Definition Classes
    RegexParsers
  74. def wholeNumber: Parser[String]
    Definition Classes
    JavaTokenParsers

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from JavaTokenParsers

Inherited from RegexParsers

Inherited from Parsers

Inherited from AnyRef

Inherited from Any

Ungrouped