Haddock documentation for Text.Parsec.Language

This commit is contained in:
Derek Elkins 2008-01-22 04:06:32 +00:00
parent c544a22461
commit fdf1dbfded

View File

@ -29,6 +29,11 @@ import Text.Parsec.Token
-----------------------------------------------------------
-- Styles: haskellStyle, javaStyle
-----------------------------------------------------------
-- | This is a minimal token definition for Haskell style languages. It
-- defines the style of comments, valid identifiers and case
-- sensitivity. It does not define any reserved words or operators.
haskellStyle :: LanguageDef st
haskellStyle = emptyDef
{ commentStart = "{-"
@ -44,6 +49,10 @@ haskellStyle= emptyDef
, caseSensitive = True
}
-- | This is a minimal token definition for Java style languages. It
-- defines the style of comments, valid identifiers and case
-- sensitivity. It does not define any reserved words or operators.
javaStyle :: LanguageDef st
javaStyle = emptyDef
{ commentStart = "/*"
@ -59,7 +68,14 @@ javaStyle = emptyDef
-----------------------------------------------------------
-- minimal language definition
-----------------------------------------------------------
--------------------------------------------------------
-- TODO: This seems wrong
-- < This is the most minimal token definition. It is recommended to use
-- this definition as the basis for other definitions. @emptyDef@ has
-- no reserved names or operators, is case sensitive and doesn't accept
-- comments, identifiers or operators.
emptyDef :: LanguageDef st
emptyDef = LanguageDef
{ commentStart = ""
@ -80,9 +96,14 @@ emptyDef = LanguageDef
-----------------------------------------------------------
-- Haskell
-----------------------------------------------------------
-- | A lexer for the haskell language.
haskell :: TokenParser st
haskell = makeTokenParser haskellDef
-- | The language definition for the Haskell language.
haskellDef :: LanguageDef st
haskellDef = haskell98Def
{ identLetter = identLetter haskell98Def <|> char '#'
@ -93,6 +114,8 @@ haskellDef = haskell98Def
]
}
-- | The language definition for the language Haskell98.
haskell98Def :: LanguageDef st
haskell98Def = haskellStyle
{ reservedOpNames= ["::","..","=","\\","|","<-","->","@","~","=>"]
@ -110,9 +133,14 @@ haskell98Def = haskellStyle
-----------------------------------------------------------
-- Mondrian
-----------------------------------------------------------
-- | A lexer for the mondrian language.
mondrian :: TokenParser st
mondrian = makeTokenParser mondrianDef
-- | The language definition for the language Mondrian.
mondrianDef :: LanguageDef st
mondrianDef = javaStyle
{ reservedNames = [ "case", "class", "default", "extends"