#include "fson/FsonParser.hh"

Recursive-descent parser built on fedem::parser::Parser (from cparse). Most code uses the Fson façade instead, which also resolves %include; use FsonParser directly when you need the parser object itself.

MemberDescription
parseFile(filename) → std::unique_ptr<Document>null only when the file cannot be opened; parse errors still yield a partial document
errors() → std::vector<ParseError> const& / hasErrors() → boolinherited diagnostics collector — check hasErrors() before trusting or re-writing the document

Behaviour

  • Collect-and-continue. On a syntax error the parser records a ParseError and resynchronises at the next , / } / ]; a failed member value becomes a Null placeholder.
  • Duplicate active keys are an error (Kind::Faulty); the duplicate is still stored structurally. Disabled duplicates are legal.
  • The document root may be any value (v0.9.0.0).
  • Trailing commas accepted in object and array bodies (v0.9.0.0).
  • Strings single- or double-quoted; escape set includes \xXX, \v, \0, line-continuation; any other char after \ is itself (v0.9.0.0).
  • Numbers accept a leading +, 0x / 0X hex, a leading or trailing ., and Infinity / -Infinity / NaN (v0.9.0.0).
  • Whitespace also recognises NBSP, BOM, U+2028 / U+2029, category Zs (v0.9.0.0).
  • \uXXXX decodes to UTF-8; surrogate pairs combine; invalid sequences are reported and replaced with U+FFFD.
  • Comments captured with attachment points; a comment starting on the same line as a value's end becomes that member's / element's trailing comment. Nested block comments remain supported.