The syntax layer is designed for scenarios where you need:
using SharpYaml.Syntax;
var text = "a: 1\n";
var tree = YamlSyntaxTree.Parse(text);
To include or exclude trivia tokens (whitespace/newlines/comments), use YamlSyntaxOptions:
var tree = YamlSyntaxTree.Parse(text, new YamlSyntaxOptions { IncludeTrivia = false });
SharpYaml uses source locations for errors and editor integrations.
Mark captures index, line, and column.YamlSourceSpan captures a start/end mark.Parse errors throw YamlException with location information.
The syntax tree exposes a flat list of YamlSyntaxToken with spans and text.
This is useful for: