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 implicit_document? explicit_document* STREAM-END implicit_document ::= block_node DOCUMENT-END* explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* ...
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) @trustedblock_node_or_indentless_sequence ::= ALIAS | properties (block_content | indentless_block_sequence)? | block_content | indentless_block_sequence block_node ::= ALIAS | properties block_content?...
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)() @safeblock_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END Parse an entry of a block sequence. If first is true, this is the first entry.
Event parseIndentlessSequenceEntry() @safeindentless_sequence ::= (BLOCK-ENTRY block_node?)+ Parse an entry of an indentless sequence.
Event parseBlockMappingKey(Flag!"first" first)() @safeblock_mapping ::= BLOCK-MAPPING_START ((KEY block_node_or_indentless_sequence?)? (VALUE block_node_or_indentless_sequence?)?)* BLOCK-END Parse a key in a block mapping. If first is true, this i...
Event parseBlockMappingValue() @safeParse a value in a block mapping.
Event parseFlowSequenceEntry(Flag!"first" first)() @safeflow_sequence ::= FLOW-SEQUENCE-START (flow_sequence_entry FLOW-ENTRY)* flow_sequence_entry? FLOW-SEQUENCE-END flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
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)() @safeflow_mapping ::= FLOW-MAPPING-START (flow_mapping_entry FLOW-ENTRY)* flow_mapping_entry? FLOW-MAPPING-END flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? Parse a key in a ...
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.