Created
December 5, 2016 17:08
-
-
Save philwills/d52701819f07284bc720ab1a91da74a0 to your computer and use it in GitHub Desktop.
Everything except a suffix in fastparse
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 fastparse.all._ | |
val suffix = P(" end" ~ End) | |
val parser = P((!suffix ~ AnyChar).rep.! ~ suffix) | |
parser.parse("start end") | |
// fastparse.core.Parsed[String,Char,String] = Success(start,9) | |
parser.parse("start end ") | |
// fastparse.core.Parsed[String,Char,String] = Failure(" end":1:11 ..."") | |
parser.parse("start en") | |
// fastparse.core.Parsed[String,Char,String] = Failure(" end":1:9 ..."") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment