toml-parser-1.1.0.0: TOML 1.0.0 parser
Copyright(c) Eric Mertens 2023
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Toml.Lexer.Token

Description

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

Synopsis

Types

data Token Source #

Lexical token

Constructors

TokTrue
true
TokFalse
false
TokComma
','
TokEquals
'='
TokNewline
'\n'
TokPeriod
.
TokSquareO
'['
TokSquareC
']'
Tok2SquareO
'[['
Tok2SquareC
']]'
TokCurlyO
'{'
TokCurlyC
'}'
TokBareKey String

bare key

TokString String

string literal

TokMlString String

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

TokError String

lexical error

TokEOF

end of file

Instances

Instances details
Read Token Source # 
Instance details

Defined in Toml.Lexer.Token

Show Token Source # 
Instance details

Defined in Toml.Lexer.Token

Methods

showsPrec :: Int -> Token -> ShowS #

show :: Token -> String #

showList :: [Token] -> ShowS #

String literals

mkLiteralString :: String -> Token Source #

Construct a TokString from a literal string lexeme.

mkMlLiteralString :: String -> Token Source #

Construct a TokMlString from a literal multi-line string lexeme.

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.

Errors

mkError :: String -> Token Source #

Make a TokError from a lexical error message.