......
あ、今気付いたけどString内で
- -
や
{-
を使った場合の処理を書いてないや笑
なんてこったーー
まあ、同様の処理を書き加えるだけ
というわけで
delcomment :: String -> String delcomment [] = "" delcomment (a:b:fs) | a == '"' = literal (b:fs) | a == '{' && b == '-' = delcomment $ delcomment' fs | a == '-' && b == '-' = delcomment $ delcomment'' fs | otherwise = a:(delcomment (b:fs)) where delcomment' (_:[]) = "" delcomment' (x:y:ys) | x == '-' && y== '}' = ys | otherwise = delcomment' (y:ys) delcomment'' [] = "" delcomment'' (x:xs) = if x == '\n' then xs else delcomment'' xs literal(b:fs)= if b == '"' then fs else literal fs
とまあ、literal関数を付け加えて、文字列リストを処理
ただ、そのリスト内で再び’とか”を使われると辛い笑
そのときはliteral内での条件を足してやればいいだけなんですが。