Skip to content

Instantly share code, notes, and snippets.

@Blaisorblade
Last active December 12, 2015 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Blaisorblade/4743188 to your computer and use it in GitHub Desktop.
Save Blaisorblade/4743188 to your computer and use it in GitHub Desktop.
import language.postfixOps
import com.codecommit.gll._
object GLLBugReport extends RegexParsers {
def quote(s: Any) = "\"" + s + "\""
def showResults[R](s: Stream[Result[R]]) =
((s map {
case f @ Failure(a , b) => ("Failure", a, quote(b))
case s @ Success(a, b) => ("Success", quote(a), quote(b))
}) toList)
def main(args: Array[String]) {
val smileyParen: Parser[String] = "(" | ")"
println(smileyParen)
println(showResults(smileyParen("(")))
println(showResults(smileyParen(")")))
}
}
/*
Output before the fix:
/(\\\()|(\))/
List((Failure,ExpectedRegex((\\\()|(\))),"("))
List((Success,")",""))
Output after the fix:
/(\()|(\))/
List((Success,"(",""))
List((Success,")",""))
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment