diff options
author | Johannes Rudolph <johannes.rudolph@gmail.com> | 2014-07-08 15:57:16 +0200 |
---|---|---|
committer | Johannes Rudolph <johannes.rudolph@gmail.com> | 2014-07-08 15:57:16 +0200 |
commit | aed51e8962105a4163e38b2b2ba5651e57c468cb (patch) | |
tree | 065c47741bb4d02cb87a68c40d4036714cf814df /src/main/scala | |
parent | df2ad7c83b8cc1ef00e1e0fc446121879057d77d (diff) | |
download | sbt-boilerplate-aed51e8962105a4163e38b2b2ba5651e57c468cb.tar.gz sbt-boilerplate-aed51e8962105a4163e38b2b2ba5651e57c468cb.tar.bz2 sbt-boilerplate-aed51e8962105a4163e38b2b2ba5651e57c468cb.zip |
adapt outside parser to latest changes
Diffstat (limited to 'src/main/scala')
-rw-r--r-- | src/main/scala/spray/boilerplate/TemplateParser.scala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/scala/spray/boilerplate/TemplateParser.scala b/src/main/scala/spray/boilerplate/TemplateParser.scala index 8808bc8..2d186c7 100644 --- a/src/main/scala/spray/boilerplate/TemplateParser.scala +++ b/src/main/scala/spray/boilerplate/TemplateParser.scala @@ -48,7 +48,8 @@ object TemplateParser extends RegexParsers { def escapedLiteralNumber: Parser[Char] = "##" ~> offsetChars ^^ (_.head) - def outsideTemplate: Parser[LiteralString] = """(?s).+?(?=(\[#)|(\z))""".r ^^ (LiteralString(_)) + def outsideLiteralString: Parser[LiteralString] = rep1(outsideLiteralChar) ^^ (chs ⇒ LiteralString(chs.mkString)) + def outsideLiteralChar: Parser[Char] = not(expandStart | """#[^\]]*\]""".r) ~> elem("Any character", _ ⇒ true) def expand: Parser[Expand] = expandStart ~ elements ~ "#" ~ separatorChars <~ "]" ^^ { case range ~ els ~ x ~ sep ⇒ Expand(els, sep.getOrElse(Expand.defaultSeparator), range) @@ -61,7 +62,7 @@ object TemplateParser extends RegexParsers { }) | success(Range()) def outsideElements: Parser[TemplateElement] = - rep1(expand | outsideTemplate) ^^ maybeSequence + rep1(expand | outsideLiteralString) ^^ maybeSequence def separatorChars: Parser[Option[String]] = rep("""[^\]]""".r) ^^ (_.reduceLeftOption(_ + _)) |