Last active
December 12, 2015 08:18
-
-
Save Blaisorblade/4743188 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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