Skip to content
Snippets Groups Projects
Commit 0d38081b authored by Alexander Kaznacheev's avatar Alexander Kaznacheev
Browse files

MultilineStrings for interpolation

parent d726c19d
No related tags found
No related merge requests found
...@@ -17,10 +17,16 @@ convertMultilineStrings s = go s WaitingForString 0 ...@@ -17,10 +17,16 @@ convertMultilineStrings s = go s WaitingForString 0
InString -> case s of InString -> case s of
"" -> error "we are in a mutline string, but text ended unexpectedly" "" -> error "we are in a mutline string, but text ended unexpectedly"
'\n':'"':'"':'"':s -> '"':'\n' : go s WaitingForString 0 '\n':'"':'"':'"':s -> '"':'\n' : go s WaitingForString 0
'#':'{':s -> '#':'{' : go s InInterpolationSection charCnt
'"':s -> '\\':'"' : go s state charCnt '"':s -> '\\':'"' : go s state charCnt
'\\':s -> '\\':'\\' : go s state charCnt '\\':s -> '\\':'\\' : go s state charCnt
'\n':s -> "\\n\"\n" ++ replicate charCnt ' ' ++ "++ \"" ++ go s state charCnt '\n':s -> "\\n\"\n" ++ replicate charCnt ' ' ++ "++ \"" ++ go s state charCnt
c:s -> c : go s state charCnt c:s -> c : go s state charCnt
InInterpolationSection -> case s of
'\n':_ -> error "we are in an interpolation section in mutline string, but text line ended unexpectedly"
'}':s -> '}' : go s InString charCnt
c:s -> c : go s state charCnt
where where
skipOneLineComment "" = go "" state charCnt skipOneLineComment "" = go "" state charCnt
skipOneLineComment s@('\n':_) = go s state charCnt skipOneLineComment s@('\n':_) = go s state charCnt
...@@ -33,3 +39,4 @@ convertMultilineStrings s = go s WaitingForString 0 ...@@ -33,3 +39,4 @@ convertMultilineStrings s = go s WaitingForString 0
data State data State
= WaitingForString = WaitingForString
| InString | InString
| InInterpolationSection
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment