Documentation ¶
Overview ¶
The scanner package is responsible for parsing a YAML document and transforming it into a sequence of events. This corresponds to the parsing stage in the YAML 1.2 specification.
Index ¶
Constants ¶
const ( AnyScalarStyle = iota PlainScalarStyle SingleQuotedScalarStyle DoubleQuotedScalarStyle LiteralScalarStyle FoldedScalarStyle )
Scalar styles
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicToken ¶
BasicToken holds the essential information for a Token.
func (BasicToken) GetEnd ¶
func (t BasicToken) GetEnd() token.Position
func (BasicToken) GetKind ¶
func (t BasicToken) GetKind() token.Token
func (BasicToken) GetStart ¶
func (t BasicToken) GetStart() token.Position
func (BasicToken) String ¶
func (t BasicToken) String() string
type ScalarToken ¶
type ScalarToken struct { ValueToken Style int }
A ScalarToken holds a value and the style as it appeared in the YAML document.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
A Scanner generates a sequence of lexical tokens from a reader containing YAML data.
func (*Scanner) GetPosition ¶
GetPosition returns the position of the first unread byte from the underlying reader.
This does not necessarily correspond to the starting position of the token that will be returned next by Scan, nor does it even correspond to the position in the reader (more bytes may have actually been read). The Scanner has to do some look-ahead to do its job.
type TagDirective ¶
type TagDirective struct { BasicToken Handle string Prefix string }
TagDirective stores a %TAG directive.
func (TagDirective) String ¶
func (td TagDirective) String() string
type TagToken ¶
type TagToken struct { BasicToken Handle string Suffix string }
TagToken holds information for a token of TAG type (i.e. a tag property).
type Token ¶
type Token interface { GetKind() token.Token GetStart() token.Position GetEnd() token.Position String() string }
Token holds data for a single lexical unit in a YAML document.
type ValueToken ¶
type ValueToken struct { BasicToken Value string }
ValueToken defines a token that holds a string value. It is used for anchors, aliases, and scalars.
func (ValueToken) String ¶
func (t ValueToken) String() string
type VersionDirective ¶
type VersionDirective struct { BasicToken Major, Minor int }
VersionDirective stores a %YAML directive.
func (VersionDirective) String ¶
func (vd VersionDirective) String() string