mirror of
https://github.com/mrkkrp/megaparsec.git
synced 2024-11-28 12:23:11 +03:00
Haddock documentation for Text.Parsec.Language
This commit is contained in:
parent
c544a22461
commit
fdf1dbfded
@ -29,8 +29,13 @@ import Text.Parsec.Token
|
|||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
-- Styles: haskellStyle, javaStyle
|
-- 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 :: LanguageDef st
|
||||||
haskellStyle= emptyDef
|
haskellStyle = emptyDef
|
||||||
{ commentStart = "{-"
|
{ commentStart = "{-"
|
||||||
, commentEnd = "-}"
|
, commentEnd = "-}"
|
||||||
, commentLine = "--"
|
, commentLine = "--"
|
||||||
@ -44,6 +49,10 @@ haskellStyle= emptyDef
|
|||||||
, caseSensitive = True
|
, 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 :: LanguageDef st
|
||||||
javaStyle = emptyDef
|
javaStyle = emptyDef
|
||||||
{ commentStart = "/*"
|
{ commentStart = "/*"
|
||||||
@ -59,7 +68,14 @@ javaStyle = emptyDef
|
|||||||
|
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
-- minimal language definition
|
-- 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 st
|
||||||
emptyDef = LanguageDef
|
emptyDef = LanguageDef
|
||||||
{ commentStart = ""
|
{ commentStart = ""
|
||||||
@ -80,9 +96,14 @@ emptyDef = LanguageDef
|
|||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
-- Haskell
|
-- Haskell
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
-- | A lexer for the haskell language.
|
||||||
|
|
||||||
haskell :: TokenParser st
|
haskell :: TokenParser st
|
||||||
haskell = makeTokenParser haskellDef
|
haskell = makeTokenParser haskellDef
|
||||||
|
|
||||||
|
-- | The language definition for the Haskell language.
|
||||||
|
|
||||||
haskellDef :: LanguageDef st
|
haskellDef :: LanguageDef st
|
||||||
haskellDef = haskell98Def
|
haskellDef = haskell98Def
|
||||||
{ identLetter = identLetter haskell98Def <|> char '#'
|
{ identLetter = identLetter haskell98Def <|> char '#'
|
||||||
@ -93,6 +114,8 @@ haskellDef = haskell98Def
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- | The language definition for the language Haskell98.
|
||||||
|
|
||||||
haskell98Def :: LanguageDef st
|
haskell98Def :: LanguageDef st
|
||||||
haskell98Def = haskellStyle
|
haskell98Def = haskellStyle
|
||||||
{ reservedOpNames= ["::","..","=","\\","|","<-","->","@","~","=>"]
|
{ reservedOpNames= ["::","..","=","\\","|","<-","->","@","~","=>"]
|
||||||
@ -110,9 +133,14 @@ haskell98Def = haskellStyle
|
|||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
-- Mondrian
|
-- Mondrian
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
-- | A lexer for the mondrian language.
|
||||||
|
|
||||||
mondrian :: TokenParser st
|
mondrian :: TokenParser st
|
||||||
mondrian = makeTokenParser mondrianDef
|
mondrian = makeTokenParser mondrianDef
|
||||||
|
|
||||||
|
-- | The language definition for the language Mondrian.
|
||||||
|
|
||||||
mondrianDef :: LanguageDef st
|
mondrianDef :: LanguageDef st
|
||||||
mondrianDef = javaStyle
|
mondrianDef = javaStyle
|
||||||
{ reservedNames = [ "case", "class", "default", "extends"
|
{ reservedNames = [ "case", "class", "default", "extends"
|
||||||
|
Loading…
Reference in New Issue
Block a user