A pull parser allows parsing a YAML document by events.
When creating an instance, the parser is positioned in the first event. To get the event kind invoke #kind
. If the event is a scalar you can invoke #value
to get its string value. Other methods like #tag
, #anchor
and #scalar_style
let you inspect other information from events.
Invoking #read_next
reads the next event.
Creates a parser, yields it to the block, and closes the parser at the end of it.
Returns the anchor associated to the current event, or nil
if there's no anchor.
Raises if the current kind is not the expected one.
The current event kind.
Returns the mapping style, assuming the pull parser is located at a mapping begin event.
Reads an expected event kind.
Reads an alias event, returning its anchor.
Reads a "document start" event, yields to the block, and then reads a "document end" event.
Reads a "document end" event.
Reads a "document start" event.
Reads a "mapping start" event, yields to the block, and then reads a "mapping end" event.
Reads a "mapping end" event.
Reads a "mapping start" event.
Reads the next event.
Reads a scalar, returning its value.
Reads a "sequence start" event, yields to the block, and then reads a "sequence end" event.
Reads a "sequence end" event.
Reads a "sequence start" event.
Reads a "stream start" event, yields to the block, and then reads a "stream end" event.
Reads a "stream end" event.
Reads a "stream start" event.
Returns the scalar style, assuming the pull parser is located at a scalar event.
Returns the sequence style, assuming the pull parser is located at a sequence begin event.
Returns the tag associated to the current event, or nil
if there's no tag.
Returns the scalar value, assuming the pull parser is located at a scalar.
Reference
Reference
Object
Object
Creates a parser, yields it to the block, and closes the parser at the end of it.
Returns the anchor associated to the current event, or nil
if there's no anchor.
Returns the mapping style, assuming the pull parser is located at a mapping begin event. Raises otherwise.
Reads an alias event, returning its anchor.
Reads a "document start" event, yields to the block, and then reads a "document end" event.
Reads a "document end" event.
Reads a "document start" event.
Reads a "mapping start" event, yields to the block, and then reads a "mapping end" event.
Reads a "mapping end" event.
Reads a "mapping start" event.
Reads a scalar, returning its value.
Reads a "sequence start" event, yields to the block, and then reads a "sequence end" event.
Reads a "sequence end" event.
Reads a "sequence start" event.
Reads a "stream start" event, yields to the block, and then reads a "stream end" event.
Reads a "stream end" event.
Reads a "stream start" event.
Returns the scalar style, assuming the pull parser is located at a scalar event. Raises otherwise.
Returns the sequence style, assuming the pull parser is located at a sequence begin event. Raises otherwise.
Returns the scalar value, assuming the pull parser is located at a scalar. Raises otherwise.
© 2012–2020 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.35.1/YAML/PullParser.html