BlitzMax

BlitzMax

  • Downloads
  • Docs
  • API
  • Resources
  • About

›TOML

BlitzMax API

  • Introduction

BRL

    Audio

    • Introduction
    • TChannel
    • TSound

    AudioSample

    • Introduction
    • TAudioSample
    • TAudioSampleLoader

    Bank

    • Introduction
    • TBank

    BankStream

    • Introduction
    • TBankStream

    Base64

    • Introduction
    • TBase64

    Blitz

    • Introduction
    • TArrayBoundsException
    • TBlitzException
    • TNullFunctionException
    • TNullMethodException
    • TNullObjectException
    • TOutOfDataException
    • TRuntimeException
  • BRL.BMPLoader
  • Clipboard

    • Introduction
    • TClipboard
    • TClipboardOpts
    • TWin32ClipboardOpts
    • TX11ClipboardOpts
  • BRL.D3D7Max2D
  • BRL.D3D9Max2D
  • BRL.DirectSoundAudio
  • BRL.EndianStream
  • Event

    • Introduction
    • TEvent
  • BRL.EventQueue
  • BRL.FileSystem
  • BRL.FreeAudioAudio
  • BRL.GLGraphics
  • BRL.GLMax2D
  • BRL.GNet
  • BRL.Graphics
  • BRL.Hook
  • IO

    • Introduction
    • MaxIO
  • BRL.JPGLoader
  • BRL.KeyCodes
  • LinkedList

    • Introduction
    • TList
    • TListEnum
    • TLink

    Map

    • Introduction
    • TMap
    • TIntMap
    • TIntKey
    • TPtrMap
    • TPtrKey
    • TStringMap
  • BRL.Math
  • Matrix

    • Introduction
    • SMat2D
    • SMat2F
    • SMat2I
    • SMat3D
    • SMat3F
    • SMat3I
    • SMat4D
    • SMat4F
    • SMat4I

    Max2D

    • Introduction
    • TImage

    MaxLua

    • Introduction
    • TLuaClass
    • TLuaObject
  • BRL.OGGLoader
  • BRL.OpenALAudio
  • ObjectList

    • Introduction
    • TObjectList
    • TObjectListEnumerator
    • TObjectListReverseEnumerator

    Pixmap

    • Introduction
    • TPixmap
    • TPixmapLoader
  • BRL.PNGLoader
  • BRL.PolledInput
  • Quaternion

    • Introduction
    • SQuatD
    • SQuatF
    • SQuatI
  • BRL.RamStream
  • Random

    • Introduction
    • TRandom

    Reflection

    • Introduction
    • TTypeId
    • TMember
    • TConstant
    • TField
    • TGlobal
    • TFunction
    • TMethod
  • BRL.Retro
  • BRL.Socket
  • BRL.SocketStream
  • BRL.StandardIO
  • Stream

    • Introduction
    • TCStream
    • TIO
    • TStream
    • TStreamException
    • TStreamFactory
    • TStreamReadException
    • TStreamWrapper
    • TStreamWriteException

    StringBuilder

    • Introduction
    • TStringBuilder
    • TSplitBuffer
  • BRL.System
  • BRL.SystemDefault
  • BRL.TextStream
  • BRL.TGALoader
  • ThreadPool

    • Introduction
    • TRunnable
    • TThreadPoolExecutor

    Threads

    • Introduction
    • TThread
    • TThreadData
    • TMutex
    • TSemaphore
    • TCondVar

    Timer

    • Introduction
    • TChrono
  • BRL.TimerDefault
  • Vector

    • Introduction
    • SVec2D
    • SVec2F
    • SVec2I
    • SVec3D
    • SVec3F
    • SVec3I
    • SVec4D
    • SVec4F
    • SVec4I

    Volumes

    • Introduction
    • TVolume
  • BRL.WAVLoader

Text

    CSV

    • Introduction
    • TCsvParser
    • TCsvHeader
    • TCsvRow
    • TCsvOptions
    • SCsvColumn

    Format

    • Introduction
    • TFormatter

    Ini

    • Introduction
    • TIni
    • TIniProperty
    • TIniSection

    JConv

    • Introduction
    • TJConv
    • TJConvBuilder
    • TJConvSerializer

    Json

    • Introduction
    • TJSON
    • TJSONObject
    • TJSONString
    • TJSONInteger
    • TJSONReal
    • TJSONBool
    • TJSONArray
    • TJSONNull
    • TJSONError
    • TJSONNumber

    Regex

    • Introduction
    • TRegEx
    • TRegExMatch
    • TRegExOptions
    • TRegExException

    TOML

    • Introduction
    • ETomlNodeType
    • TToml
    • ITomlNode
    • STomlDate
    • STomlDateTime
    • STomlTime
    • TTomlArray
    • TTomlInteger
    • TTomlString
    • TTomlTable
    • TTomlBoolean

    Xml

    • Introduction
    • TxmlDoc
    • TxmlNode
    • TxmlAttribute

MaxGUI

  • MaxGUI.MaxGUI
  • MaxGUI.Drivers
  • MaxGUI.Localization
  • MaxGUI.ProxyGadgets
  • MaxGUI.CocoaMaxGUI
  • MaxGUI.Win32MaxGUIEx

PUB

  • Pub.FreeJoy
  • Pub.FreeProcess
  • Pub.Glad
  • Pub.Glew
  • Joystick

    • Introduction
    • TJoystickDriver
  • Pub.Lua
  • Pub.OpenAL
  • Pub.OpenGLES
  • Pub.xmmintrin
  • Pub.ZLib

Crypto

    Digest

    • Introduction
    • TMessageDigest
    • TDigestRegister
    • TNoSuchAlgorithmException

    Cipher

    • Introduction
    • TCipher
    • TCipherMode
    • Crypto.AESCipher
    • Crypto.AnubisCipher
    • Crypto.BlowfishCipher
    • Crypto.CamelliaCipher
    • Crypto.Cast5Cipher
    • Crypto.DESCipher
    • Crypto.IdeaCipher
    • Crypto.KasumiCipher
    • Crypto.KhazadCipher
    • Crypto.KSeedCipher
    • Crypto.NoekeonCipher
    • Crypto.SerpentCipher
    • Crypto.SkipjackCipher
    • Crypto.TwofishCipher
    • Crypto.XTeaCipher

    CBCMode

    • Introduction
    • TCBCCipherMode

    CFBMode

    • Introduction
    • TCFBCipherMode

    CTRMode

    • Introduction
    • TCTRCipherMode

    ECBMode

    • Introduction
    • TECBCipherMode

    F8Mode

    • Introduction
    • TF8CipherMode

    LRWMode

    • Introduction
    • TLRWCipherMode

    OFBMode

    • Introduction
    • TOFBCipherMode

    XTSMode

    • Introduction
    • TXTSCipherMode

    Blake2BDigest

    • Introduction
    • TBlake2B_512
    • TBlake2B_384
    • TBlake2B_256
    • TBlake2B_160

    CRC32

    • Introduction
    • TCRC32

    MD5Digest

    • Introduction
    • TMD5

    Ripemd320Digest

    • Introduction
    • TRipemd320

    Ripemd356Digest

    • Introduction
    • TRipemd256

    Ripemd160Digest

    • Introduction
    • TRipemd160

    Ripemd128Digest

    • Introduction
    • TRipemd128

    SHA1Digest

    • Introduction
    • TSHA1

    SHA256Digest

    • Introduction
    • TSHA256

    SHA512Digest

    • Introduction
    • TSHA512

    SHA3Digest

    • Introduction
    • TSHA3_512
    • TSHA3_384
    • TSHA3_256
    • TSHA3_224

    TigerDigest

    • Introduction
    • TTiger

    WhirlpoolDigest

    • Introduction
    • TWhirlpool

    Crypto

    • Introduction
    • TCryptoRandom
    • TCryptoSecretBox
    • TCryptoHash
    • TCryptoSign
    • TCryptoKeyExchange
    • TCryptoKey
    • TCryptoHashKey
    • TCryptoSecretBoxKey
    • TCryptoSignature
    • TCryptoExchangeKeyPair
    • TCryptoSessionKeyPair
    • TCryptoNPacket
    • TCryptoKK1Packet
    • TCryptoKK2Packet
    • TCryptoXX1Packet
    • TCryptoXX2Packet
    • TCryptoXX3Packet
    • TCryptoExchangeState
    • TCryptoPWHashMasterKey
    • TCryptoPWHashStoredKey
    • TCryptoPasswordHash

SDL

    SDL

    • Introduction
    • TSDLStream

    SDLSystem

    • Introduction
    • TSDLMultiGesture

    SDLVideo

    • Introduction
    • TSDLDisplay
    • TSDLDisplayMode
    • TSDLGLContext
    • TSDLWindow

    SDLRender

    • Introduction
    • TSDLRenderer
    • TSDLTexture

    SDLTimer

    • Introduction
    • TSDLTimer

    SDLHaptic

    • Introduction
    • TSDLHaptic
    • TSDLHapticCondition
    • TSDLHapticConstant
    • TSDLHapticCustom
    • TSDLHapticDirection
    • TSDLHapticEffect
    • TSDLHapticLeftRight
    • TSDLHapticPeriodic
    • TSDLHapticRamp

    SDLSensor

    • Introduction
    • TSDLSensor
  • SDL.SDLFreeAudio
  • SDL.GLSDLMax2D
  • SDL.GL2SDLMax2D
  • SDL.D3D9SDLMax2D
  • SDLVirtualJoystick

    • Introduction
    • TVirtualJoystick

Steam

    SteamSDK

    • Introduction
    • TSteamClient
    • TSteamUtils
    • TSteamUserStats
    • TSteamFriends
    • TSteamUGC
    • ISteamFriendsListener
    • ISteamUGCListener
    • ISteamUserStatsListener
    • ISteamUtilsListener
    • EItemPreviewType
    • EPersonaChange
    • EPersonaState
    • ERemoteStoragePublishedFileVisibility
    • EUGCMatchingUGCType
    • EUGCQuery
    • EUserRestriction
    • EUserUGCList
    • EWorkshopFileType
Edit

Text.Toml

The text.toml is a module designed for parsing TOML (Tom's Obvious, Minimal Language) documents. TOML is a human-readable data serialization format used for configuration files and data interchange between languages with different data structures. It is similar to JSON, YAML, and INI files but aims to be more minimal and easier to read and write.

TOML documents consist of key-value pairs, which are organized into sections called tables. Each key-value pair is represented by a key followed by an equals sign (=) and a value. Tables can be nested, allowing for a hierarchical structure. TOML supports several data types, including strings, integers, floating-point numbers, booleans, dates, times, and arrays.

Key-Value Pairs

In TOML, key-value pairs are the basic building blocks of the document. Each key-value pair is represented by a key followed by an equals sign (=) and a value. Here's a simple example:

key = "value"

Tables

Tables are sections within a TOML document used to organize key-value pairs. They are defined by square brackets [ and ]. Here's an example of a table:

[table]
key = "value"

Nested Tables

TOML allows for nesting tables to create a hierarchical structure. Nested tables are defined using dot notation within the square brackets. Here's an example of nested tables:

[table]
key = "value"

[table.subtable]
nested_key = "nested_value"

Data Types

TOML supports several data types, including:

Strings

Enclosed in double quotes ". They can be single-line or multi-line (using triple quotes """).

string_key = "This is a string"
multiline_string_key = """
This is a
multiline string
"""

Integers

Whole numbers without a decimal point.

integer_key = 42

Floating-point numbers

Numbers with a decimal point.

float_key = 3.14

Booleans

Represented as true or false.

boolean_key = true

Dates

Represented in the format YYYY-MM-DD.

date_key = 2021-09-01

Times

Represented in the format hh:mm:ss (optionally with fractional seconds).

time_key = 12:34:56
time_with_fractional_key = 12:34:56.789

Date-times

Represented as a combination of date and time, separated by a T or a space.

datetime_key = 2021-09-01T12:34:56
datetime_with_space_key = 2021-09-01 12:34:56

Arrays

A collection of values enclosed in square brackets and separated by commas.

array_key = [1, 2, 3]

Here's a complete example of a TOML document using various data types and tables:

title = "TOML Example"

[author]
name = "John Doe"
age = 35
is_member = true

[book]
title = "The TOML Guide"
published_date = 2022-03-15
price = 19.99
keywords = ["TOML", "guide", "configuration"]

[book.publication_time]
hour = 15
minute = 30

Working with TOML documents

The module is composed of several types and interfaces, including:

TToml: The main class responsible for parsing TOML documents. It provides functions for loading and parsing TOML files or strings, returning a TTomlTable object.

TTomlTable: Represents a TOML table and implements the ITomlNode interface. It offers methods for adding and retrieving nodes with specified keys and enumerating the keys.

TTomlArray: Represents a TOML array and implements the ITomlNode interface.

TTomlString, TTomlInteger, TTomlFloatingPoint, TTomlBoolean, TTomlDate, TTomlTime, and TTomlDateTime: Each represents a specific TOML data type and implements the ITomlNode interface.

ITomlNode: An interface implemented by all TOML nodes. It includes methods for determining the type of the node and converting it to the desired data type.

Types

TypeDescription
TTomlSourceRegionSource region, provided with parsing errors.
TTomlTOML loader.
TTomlTableA TOML table.
TTomlArrayA TOML array.
TTomlStringA TOML string.
TTomlIntegerA TOML integer number, represented as a Long.
TTomlFloatingPointA TOML floating point number, represented as a Double.
TTomlBooleanA TOML boolean.
TTomlDateA TOML date.
TTomlTimeA TOML time.
TTomlDateTimeA TOML date time.
TTomlParseErrorA toml parse error.

Interfaces

InterfaceDescription
ITomlNodeA toml node.

Structs

StructDescription
STomlDateA toml date representation.
STomlTimeA toml time representation.
STomlDateTimeA toml date time representation, with optional offset.

Enums

EnumDescription
ETomlNodeTypeToml node type.
← TRegExExceptionETomlNodeType →
  • Key-Value Pairs
  • Tables
  • Nested Tables
  • Data Types
    • Strings
    • Integers
    • Floating-point numbers
    • Booleans
    • Dates
    • Times
    • Date-times
    • Arrays
  • Working with TOML documents
  • Types
  • Interfaces
  • Structs
  • Enums
BlitzMax
Docs
Getting StartedDownloadsAbout
Community
ResourcesSyntaxBomb Forums
More
GitHubStarChat on Discord
Copyright © 2023 Bruce A Henderson