Merge pull request #599 from phadej/blockstring
Blockstring
commit531e1e3806158d531c0cf64c4035ef6fd210082b
authorPhil Freeman <paf31@cantab.net>
dateFri 19 Sep 2014, 09:39 (12 years ago)
parent1bf7686ad2988d
examples/passing/BlockString.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+foreign import foo """
4+ function foo(s) {
5+ return s;
6+ }
7+""" :: String -> String
8+
9+bar :: String -> String
10+bar _ = foo "test"
11+
12+main = Debug.Trace.trace "Done"
src/Language/PureScript/Parser/Common.hs+3−1
@@ -155,7 +155,9 @@ operator = PT.operator tokenParser
155155-- Parse a string literal
156156--
157157stringLiteral :: P.Parsec String u String
158−stringLiteral = PT.stringLiteral tokenParser
158+stringLiteral = lexeme blockString <|> PT.stringLiteral tokenParser
159+ where delimeter = P.try (P.string "\"\"\"")
160+ blockString = delimeter >> P.manyTill P.anyChar delimeter
159161
160162-- |
161163-- Parse whitespace