Text.ParserCombinators.Parsec.Language

parsec-3.1.9: Monadic parser combinators

Copyright | (c) Paolo Martini 2007
License | BSD-style (see the LICENSE file)
Maintainer | derek.a.elkins@gmail.com
Stability | provisional
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Text.ParserCombinators.Parsec.Language

Description

Parsec compatibility module

Synopsis

- haskellDef :: LanguageDef st
- haskell :: TokenParser st
- mondrianDef :: LanguageDef st
- mondrian :: TokenParser st
- emptyDef :: LanguageDef st
- haskellStyle :: LanguageDef st
- javaStyle :: LanguageDef st
- type LanguageDef st = GenLanguageDef String st Identity
- data GenLanguageDef s u m = LanguageDef {
  - commentStart :: String
  - commentEnd :: String
  - commentLine :: String
  - nestedComments :: Bool
  - identStart :: ParsecT s u m Char
  - identLetter :: ParsecT s u m Char
  - opStart :: ParsecT s u m Char
  - opLetter :: ParsecT s u m Char
  - reservedNames :: [String]
  - reservedOpNames :: [String]
  - caseSensitive :: Bool
  }

# Documentation

haskellDef :: LanguageDef st

The language definition for the Haskell language.

haskell :: TokenParser st

A lexer for the haskell language.

mondrianDef :: LanguageDef st

The language definition for the language Mondrian.

mondrian :: TokenParser st

A lexer for the mondrian language.

emptyDef :: LanguageDef st

haskellStyle :: LanguageDef st

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.

javaStyle :: LanguageDef st

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.

type LanguageDef st = GenLanguageDef String st Identity

data GenLanguageDef s u m

The `GenLanguageDef` type is a record that contains all parameterizable features of the Text.Parsec.Token module. The module Text.Parsec.Language contains some default definitions.

Constructors

LanguageDef |
Fields commentStart :: String Describes the start of a block comment. Use the empty string if the language doesn't support block comments. For example "/*". commentEnd :: String Describes the end of a block comment. Use the empty string if the language doesn't support block comments. For example "*/". commentLine :: String Describes the start of a line comment. Use the empty string if the language doesn't support line comments. For example "//". nestedComments :: Bool Set to `True` if the language supports nested block comments. identStart :: ParsecT s u m Char This parser should accept any start characters of identifiers. For example `letter <|> char '_'`. identLetter :: ParsecT s u m Char This parser should accept any legal tail characters of identifiers. For example `alphaNum <|> char '_'`. opStart :: ParsecT s u m Char This parser should accept any start characters of operators. For example `oneOf ":!#$%&*+./<=>?@\\^|-~"` opLetter :: ParsecT s u m Char This parser should accept any legal tail characters of operators. Note that this parser should even be defined if the language doesn't support user-defined operators, or otherwise the `reservedOp` parser won't work correctly. reservedNames :: [String] The list of reserved identifiers. reservedOpNames :: [String] The list of reserved operators. caseSensitive :: Bool Set to `True` if the language is case sensitive.