How can I create a parser combinator in which line endings are significant?

前端 未结 2 1945
名媛妹妹
名媛妹妹 2020-12-31 04:51

I am creating a DSL, and using Scala\'s parser combinator library to parse the DSL. The DSL follows a simple, Ruby-like syntax. A source file can contain a series of blocks

2条回答
  •  臣服心动
    2020-12-31 05:30

    You can either override the protected val whiteSpace (a Regex) whose default is """\s+""".r or override the protected def handleWhiteSpace(...) method if you need more control than is readily achieved with a regular expression. Both these members orginate in RegexParsers, which is the base class for JavaTokenParsers.

提交回复
热议问题