Okay… sooo….
While working on making things Travis-publishable I stumbled across a reproducible error where our Markdown parser probably isn’t working like we expect.
[info] BaseParsersTest:
[info] The BaseParsers
[info] - should parse a newline
[info] - should parse whitespace *** FAILED ***
[info] Expected exception java.lang.IllegalArgumentException to be thrown, but no exception was thrown. (BaseParsersTest.scala:50)
[info] - should be able to look behind
[info] - should parse chars in ranges
The problematic code is this:
/** accepts one or more spaces or tabs
* returns the matched whitespace
*/
def ws:Parser[String] = """( |\t|\v)+""”.r
For some reason, even though this regex won’t match against a \n character, the parser combinator implementation treats this as a parsing success
scala> val parsers = new BaseParsers {}
parsers: net.liftweb.markdown.BaseParsers = $anon$1@627a5dd4
res2: String =
"
"
res3: parsers.ParseResult[String] =
[2.1] parsed:
According to the spec this should not be the behavior. Anyone have a clue about what is going on here?
Cheers,
—
Matt Farmer |
Blog |
TwitterGPG: CD57 2E26 F60C 0A61 E6D8 FC72 4493 8917 D667 4D07