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

Fix MultilineStrings

parent ed14fc1c
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,8 @@ convertMultilineStrings s = go s WaitingForString ...@@ -8,6 +8,8 @@ convertMultilineStrings s = go s WaitingForString
go s state = case state of go s state = case state of
WaitingForString -> case s of WaitingForString -> case s of
"" -> "" "" -> ""
'-':'-':s -> '-':'-': skipOneLineComment s
'{':'-':s -> '{':'-': skipComment s
'"':'"':'"':'\n':'"':'"':'"':s -> '"':'"': go s state '"':'"':'"':'\n':'"':'"':'"':s -> '"':'"': go s state
'"':'"':'"':'\n':s -> '\n':' ':'"' : go s InString '"':'"':'"':'\n':s -> '\n':' ':'"' : go s InString
c:s -> c : go s state c:s -> c : go s state
...@@ -15,9 +17,17 @@ convertMultilineStrings s = go s WaitingForString ...@@ -15,9 +17,17 @@ convertMultilineStrings s = go s WaitingForString
"" -> 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 '\n':'"':'"':'"':s -> '"':'\n' : go s WaitingForString
'"':s -> '\\':'"' : go s state '"':s -> '\\':'"' : go s state
'\\':s -> '\\':'\\':'"' : go s state '\\':s -> '\\':'\\' : go s state
'\n':s -> '"':'\n':' ':'+':'+':' ':'"' : go s state '\n':s -> '\\':'n':'"':'\n':' ':'+':'+':' ':'"' : go s state
c:s -> c : go s state c:s -> c : go s state
where
skipOneLineComment "" = go "" state
skipOneLineComment s@('\n':_) = go s state
skipOneLineComment (c:s) = c : skipOneLineComment s
skipComment "" = go "" state
skipComment ('-':'}':s) = '-':'}': go s state
skipComment (c:s) = c : skipComment s
data State data State
= WaitingForString = WaitingForString
......
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