ToonEx.Constants (toon_ex v1.1.0)

Copy Markdown View Source

Constants used throughout the TOON encoder and decoder.

This module defines all the string literals, delimiters, and special characters used in the TOON format.

Performance

Constants are defined as module attributes and exposed via @compile {:inline} functions. This allows the compiler to inline constant access at call sites, avoiding function call overhead in the hot encoding path.

For use in @compile {:inline} contexts, the attribute values can be referenced directly via the zero-arity functions, which the compiler will inline.

Summary

Functions

Returns the list of control characters that need escaping.

Returns the list of structure characters that require quoting in keys and values. Note: Comma is NOT included here as it's only special when it's the active delimiter.

Checks if a delimiter is valid.

Returns the list of valid delimiter values.

Functions

backslash()

close_brace()

close_bracket()

close_paren()

colon()

comma()

control_chars()

@spec control_chars() :: [String.t()]

Returns the list of control characters that need escaping.

default_delimiter()

default_indent()

delimiters()

double_quote()

escape_sequences()

false_literal()

list_item_marker()

list_item_prefix()

newline()

null_literal()

open_brace()

open_bracket()

open_paren()

pipe()

space()

structure_chars()

@spec structure_chars() :: [String.t()]

Returns the list of structure characters that require quoting in keys and values. Note: Comma is NOT included here as it's only special when it's the active delimiter.

tab()

true_literal()

unescape_sequences()

valid_delimiter?(delimiter)

@spec valid_delimiter?(String.t()) :: boolean()

Checks if a delimiter is valid.

valid_delimiters()

@spec valid_delimiters() :: [String.t()]

Returns the list of valid delimiter values.