mighttpd2-3.1.2: High performance web server on WAI/warp

Safe HaskellSafe-Inferred

Program.Mighty.Parser

Contents

Description

Parsers for Mighty

Synopsis

Utilities

parseFile :: Parser a -> FilePath -> IO aSource

Parsing a file. If parsing fails, an IOException is thrown.

Parsers

spcs :: Parser ()Source

Parser to consume zero or more white spaces

>>> parse spcs "" "    "
Right ()
>>> parse spcs "" ""
Right ()

spcs1 :: Parser ()Source

Parser to consume one or more white spaces

>>> parse spcs1 "" "    "
Right ()
>>> parse spcs1 "" " "
Right ()
>>> isLeft $ parse spcs1 "" ""
True

spc :: Parser CharSource

Parser to consume exactly one white space

>>> parse spc "" " "
Right ' '
>>> isLeft $ parse spc "" ""
True

commentLines :: Parser ()Source

Parser to consume one or more comment lines

>>> parse commentLines "" "# comments\n# comments\n# comments\n"
Right ()

trailing :: Parser ()Source

Parser to consume a trailing comment

>>> parse trailing "" "# comments\n"
Right ()
>>> isLeft $ parse trailing "" "X# comments\n"
True

comment :: Parser ()Source

Parser to consume a trailing comment

>>> parse comment "" "# comments"
Right ()
>>> isLeft $ parse comment "" "foo"
True