dyaml.parser

YAML parser. Code based on PyYAML: http://www.pyyaml.org

class Parser

Types 1

classParser

Generates events from tokens provided by a Scanner.

While Parser receives tokens with non-const character slices, the events it produces are immutable strings, which are usually the same slices, cast to string. Parser is the last layer of D:YAML that may possibly do any modifications to these slices.

Fields
TagDirective[] defaultTagDirectives_Default tag handle shortcuts and replacements.
Scanner scanner_Scanner providing YAML tokens.
Event currentEvent_Event produced by the most recent state.
string YAMLVersion_YAML version string.
TagDirective[] tagDirectives_Tag handle shortcuts and replacements.
Appender!(Event delegate() @safe[]) states_Stack of states.
Appender!(Mark[]) marks_Stack of marks used to keep track of extents of e.g. YAML collections.
Event delegate() @safe state_Current state.
Methods
bool empty() @safeCheck if any events are left. May have side effects in some cases.
Event front() @safeReturn the current event.
void popFront() @safeSkip to the next event.
inout(string) name() ref inout @safe return pure nothrow @nogcSet file name.
Mark mark() const @safe pure nothrow @nogcGet a mark from the current reader position
void ensureState() @safeIf current event is invalid, load the next valid one if possible.
Event delegate() @safe popState() @safePop and return the newest state in states_.
Mark popMark() @safePop and return the newest mark in marks_.
void pushState(Event delegate() @safe state) @safePush a state on the stack
void pushMark(Mark mark) @safePush a mark on the stack
Event parseStreamStart() @safestream ::= STREAM-START implicitdocument? explicitdocument STREAM-END implicitdocument ::= blocknode DOCUMENT-END explicitdocument ::= DIRECTIVE DOCUMENT-START blocknode? DOCUMENT-END Parse stre...
Event parseImplicitDocumentStart() @safeParse implicit document start, unless explicit detected: if so, parse explicit.
Event parseDocumentStart() @safeParse explicit document start.
Event parseDocumentEnd() @safeParse document end (explicit or implicit).
Event parseDocumentContent() @safeParse document content.
TagDirective[] processDirectives() @safeProcess directives at the beginning of a document.
Event parseNode(const Flag!"block" block, const Flag!"indentlessSequence" indentlessSequence = No.indentlessSequence) @trustedblocknodeorindentlesssequence ::= ALIAS | properties (blockcontent | indentlessblocksequence)? | blockcontent | indentlessblocksequence blocknode ::= ALIAS | properties blockcontent? | blockcont...
string handleDoubleQuotedScalarEscapes(const(char)[] tokenValue) const @safeHandle escape sequences in a double quoted scalar.
string processTag(const string tag, const uint handleEnd, const Mark startMark, const Mark tagMark) const @safeProcess a tag string retrieved from a tag token.
Event parseBlockNode() @safeWrappers to parse nodes.
Event parseBlockSequenceEntry(Flag!"first" first)() @safeblocksequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY blocknode?)* BLOCK-END Parse an entry of a block sequence. If first is true, this is the first entry.
Event parseIndentlessSequenceEntry() @safeindentlesssequence ::= (BLOCK-ENTRY blocknode?)+ Parse an entry of an indentless sequence.
Event parseBlockMappingKey(Flag!"first" first)() @safeblockmapping ::= BLOCK-MAPPINGSTART ((KEY blocknodeorindentlesssequence?)? (VALUE blocknodeorindentlesssequence?)?)* BLOCK-END Parse a key in a block mapping. If first is true, this is the firs...
Event parseBlockMappingValue() @safeParse a value in a block mapping.
Event parseFlowSequenceEntry(Flag!"first" first)() @safeflowsequence ::= FLOW-SEQUENCE-START (flowsequenceentry FLOW-ENTRY)* flowsequenceentry? FLOW-SEQUENCE-END flowsequenceentry ::= flownode | KEY flownode? (VALUE flownode?)?
Event parseFlowKey(Event delegate() @safe nextState) @safeParse a key in flow context.
Event parseFlowSequenceEntryMappingKey() @safeParse a mapping key in an entry in a flow sequence.
Event parseFlowValue(TokenID checkId, Event delegate() @safe nextState) @safeParse a mapping value in a flow context.
Event parseFlowSequenceEntryMappingValue() @safeParse a mapping value in an entry in a flow sequence.
Event parseFlowSequenceEntryMappingEnd() @safeParse end of a mapping in a flow sequence entry.
Event parseFlowMappingKey(Flag!"first" first)() @safeflowmapping ::= FLOW-MAPPING-START (flowmappingentry FLOW-ENTRY)* flowmappingentry? FLOW-MAPPING-END flowmappingentry ::= flownode | KEY flownode? (VALUE flownode?)? Parse a key in a flow mapping.
Event parseFlowMappingValue() @safeParse a value in a flow mapping.
Event parseFlowMappingEmptyValue() @safeParse an empty value in a flow mapping.
Event processEmptyScalar(const Mark mark) @safe pure nothrow const @nogcReturn an empty scalar.
Constructors
this(Scanner scanner)Construct a Parser using specified Scanner.