toml-parser-2.0.2.0: TOML 1.1.0 parser

Copyright | (c) Eric Mertens 2023
License | ISC
Maintainer | emertens@gmail.com
Safe Haskell | None
Language | Haskell2010

Toml.Syntax.Token

Contents

- Types
- Integer literals
- Float literals
- Date and time patterns

Description

This module provides the datatype for the lexical syntax of TOML files. These tokens are generated by Toml.Syntax.Lexer and consumed in Toml.Syntax.Parser.

Synopsis

- data Token
  - = TokTrue
  - | TokFalse
  - | TokComma
  - | TokEquals
  - | TokNewline
  - | TokPeriod
  - | TokSquareO
  - | TokSquareC
  - | Tok2SquareO
  - | Tok2SquareC
  - | TokCurlyO
  - | TokCurlyC
  - | TokBareKey Text
  - | TokString Text
  - | TokMlString Text
  - | TokInteger !Integer
  - | TokFloat !Double
  - | TokOffsetDateTime !ZonedTime
  - | TokLocalDateTime !LocalTime
  - | TokLocalDate !Day
  - | TokLocalTime !TimeOfDay
  - | TokEOF
- mkBinInteger :: String -> Token
- mkDecInteger :: String -> Token
- mkOctInteger :: String -> Token
- mkHexInteger :: String -> Token
- mkFloat :: String -> Token
- localDatePatterns :: [String]
- localTimePatterns :: [String]
- localDateTimePatterns :: [String]
- offsetDateTimePatterns :: [String]

# Types

data Token Source #

Lexical token

Constructors

TokTrue

    true

TokFalse

    false

TokComma

    ','

TokEquals

    '='

TokNewline

    end-of-line

TokPeriod

    .

TokSquareO

    '['

TokSquareC

    ']'

Tok2SquareO

    '[['

Tok2SquareC

    ']]'

TokCurlyO

    '{'

TokCurlyC

    '}'

TokBareKey Text | bare key
TokString Text | string literal
TokMlString Text | multiline string literal
TokInteger !Integer | integer literal
TokFloat !Double | floating-point literal
TokOffsetDateTime !ZonedTime | date-time with timezone offset
TokLocalDateTime !LocalTime | local date-time
TokLocalDate !Day | local date
TokLocalTime !TimeOfDay | local time

TokEOF

    end-of-input

#### Instances

Instances details

Read Token Source # |
Instance details Defined in Toml.Syntax.Token Methods readsPrec :: Int -> ReadS Token Source # readList :: ReadS [Token] Source # readPrec :: ReadPrec Token Source # readListPrec :: ReadPrec [Token] Source #
Show Token Source # |
Instance details Defined in Toml.Syntax.Token Methods showsPrec :: Int -> Token -> ShowS Source # show :: Token -> String Source # showList :: [Token] -> ShowS Source #

# Integer literals

mkBinInteger :: String -> Token Source #

Construct a `TokInteger` from a binary integer literal lexeme.

mkDecInteger :: String -> Token Source #

Construct a `TokInteger` from a decimal integer literal lexeme.

mkOctInteger :: String -> Token Source #

Construct a `TokInteger` from a octal integer literal lexeme.

mkHexInteger :: String -> Token Source #

Construct a `TokInteger` from a hexadecimal integer literal lexeme.

# Float literals

mkFloat :: String -> Token Source #

Construct a `TokFloat` from a floating-point literal lexeme.

# Date and time patterns

localDatePatterns :: [String] Source #

Format strings for local date lexemes.

localTimePatterns :: [String] Source #

Format strings for local time lexemes.

localDateTimePatterns :: [String] Source #

Format strings for local datetime lexemes.

offsetDateTimePatterns :: [String] Source #

Format strings for offset datetime lexemes.