#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.
| Member | Description |
|---|---|
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() → bool | inherited diagnostics collector — check hasErrors() before trusting or re-writing the document |
Behaviour
- Collect-and-continue. On a syntax error the parser records a
ParseErrorand resynchronises at the next,/}/]; a failed member value becomes aNullplaceholder. - 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/0Xhex, a leading or trailing., andInfinity/-Infinity/NaN(v0.9.0.0). - Whitespace also recognises NBSP, BOM, U+2028 / U+2029, category Zs (v0.9.0.0).
\uXXXXdecodes 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.

