dex.cf.common

Common Types for CF Parser

This module defines shared types used across the lexer, parser, document model, and writer components of the CF (Configuration File) implementation.

Types 8

Token types for CF lexical analysis.

These represent all possible token kinds that the lexer can produce, following the CF-SPEC.md specification.

STRINGString literal (any quote style)
INTEGERInteger literal
FLOATFloating-point literal
DATEDate literal (YYYY-MM-DD)
TIMETime literal (HH:MM:SS)
DATETIMEDateTime literal (ISO 8601)
TRUEBoolean true
FALSEBoolean false
NULLNull value
INFPositive infinity
NEG_INFNegative infinity
NANNot-a-number
INCLUDEFile inclusion directive
ENV_VAREnvironment variable reference `${VAR}`
LBRACELeft brace `{`
RBRACERight brace `}`
LBRACKETLeft bracket `[`
RBRACKETRight bracket `]`
EQUALSEquals sign `=`
COLONColon `:`
COMMAComma `,`
SEMICOLONSemicolon `;`
IDENTIFIERIdentifier (unquoted key)
NEWLINENewline (significant in some contexts)
EOFEnd of file
COMMENTLine comment (`#` or `//`)
BLOCK_COMMENTBlock comment (`/ /`)
ERRORLexical error
structLocation

Source location information.

Tracks the position of tokens and nodes within the source file for error reporting and roundtrip preservation.

Fields
size_t lineLine number (1-based)
size_t colColumn number (1-based)
string sourceSource filename or identifier
Methods
string toString() const @safe pureCreates a human-readable string representation of the location.
structToken

A lexical token from CF source.

Represents a single token produced by the lexer, including its type, raw text value, and source location.

Fields
TokenType typeThe type of this token
string valueRaw text of the token as it appears in source
Location locSource location of the token
Methods
string toString() const @safe pureCreates a human-readable string representation of the token.

Quote style for string literals.

Tracks which quote style was used in the original source, enabling roundtrip preservation of formatting.

DOUBLEDouble-quoted string `"..."`
SINGLESingle-quoted string `'...'`
TRIPLETriple-double-quoted string `"""..."""`
TRIPLE_SINGLETriple-single-quoted string `'''...'''`
RAW_DOUBLERaw double-quoted string `r"..."`
RAW_SINGLERaw single-quoted string `r'...'`

Separator style between object members or array elements.

Tracks which separator style was used in the original source, enabling roundtrip preservation of formatting.

COMMAComma separator `,`
SEMICOLONSemicolon separator `;`
NEWLINENewline separator
NONENo separator (e.g., last element)
classCfException : Exception

Base exception class for CF parsing and processing errors.

Includes source location information for precise error reporting.

Fields
Location locationSource location where the error occurred
Constructors
this(string msg, Location loc = Location.init, string file = __FILE__, size_t line = __LINE__)Constructs a CfException with the given message and location.

Exception class for CF parse errors.

Thrown when the parser encounters invalid syntax or unexpected tokens.

Constructors
this(string msg, Location loc = Location.init, string file = __FILE__, size_t line = __LINE__)Constructs a CfParseException with the given message and location.

Exception class for CF lexical errors.

Thrown when the lexer encounters invalid character sequences.

Constructors
this(string msg, Location loc = Location.init, string file = __FILE__, size_t line = __LINE__)Constructs a CfLexerException with the given message and location.