関数型プログラミング言語Haskell Part11
■ このスレッドは過去ログ倉庫に格納されています
0732デフォルトの名無しさん
2010/03/31(水) 03:24:15import Text.Parsec.String
main = do
parseTest myp "abc\ndef"
parseTest myp' "abc\ndef"
myp = do
ret <- many $ holdLine $ oneOf "abc\nde"
eof
return ret
string' s = mapM (holdLine . char) s
myp' = do
ret <- string' "abc\nde"
eof
return ret
holdLine parser = do
pos <- getPosition
ret <- parser
setPosition $ flip incSourceColumn 1
$ setSourceLine pos $ sourceLine pos
return ret
■ このスレッドは過去ログ倉庫に格納されています