Data & serialization

CSONParser

Parse CSON text or files into Catalyst values and expression trees.

C++23 mc/CSONParser.h
#include <mc/CSONParser.h>

Parsing produces cvar data; it does not execute expressions. Parse failures are reported as CParseError.

Jump to a declaration · 8

CSONParser

Types, constants & data

using Tokens = CVector<CToken>;

Methods

CSONParser

CSONParser();
CSONParser(const CSONParser&) = delete;

Creates a reusable CSON parser with its own token storage. Parsing returns independent values while token information remains parser-owned.

parse

cvar parse(const char* code, bool config = false);
cvar parse(const cstr& code, bool config = false);

Parses CSON text. config=true enables the configuration form.

parseFile

cvar parseFile(const cstr& path, bool config = false);

Reads and parses a file; config=true enables configuration parsing.

tokens

Tokens& tokens();

Borrows the token list from the most recent parse. Keep the parser alive and expect subsequent parses to replace that list.