Documentation ¶
Overview ¶
Package token contains types and functions dedicated for lexical tokens generated by lexer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsClosingFlowIndicator ¶
IsClosingFlowIndicator shows if provided token represents a closing flow object like mapping, sequence or their single element.
func IsNonBreak ¶
IsNonBreak shows if provided token is not a line-breaking token. EOF also considered line-breaking.
func IsOpeningFlowIndicator ¶
IsOpeningFlowIndicator shows if provided token represents an opening flow object like mapping, sequence or their single element.
func IsWhiteSpace ¶
IsWhiteSpace shows if provided token is whitespace (meaning space or tab)
func MayPrecedeWord ¶
MayPrecedeWord shows if given token may precede word (or string).
Types ¶
type Token ¶
type Token struct { Type Type Start Position End Position Origin string // contains filtered or unexported fields }
Token represents a lexical unit produced by lexer.
func (*Token) ConformsCharSet ¶
func (t *Token) ConformsCharSet(cst yamlchar.CharSetType) bool
type Type ¶
type Type uint8
Type defines token type.
const ( UnknownType Type = iota // SequenceEntryType represents a block style sequence entry indicator ("-") SequenceEntryType // MappingKeyType represents an explicit mapping key indicator ("?") MappingKeyType // MappingValueType represents a mapping value indicator (":") MappingValueType // CollectEntryType represents a flow style collect entry separator (",") CollectEntryType // SequenceStartType represents a flow style sequence start indicator ("[") SequenceStartType // SequenceEndType represents a flow style sequence end indicator ("]") SequenceEndType // MappingStartType represents a flow style mapping start indicator ("{") MappingStartType // MappingEndType represents a flow style mapping en indicator ("}") MappingEndType // CommentType represents a comment indicator ("#") CommentType // AnchorType represents an anchor indicator ("&") AnchorType // AliasType represents an alias indicator ("*") AliasType // TagType represents a tag indicator ("!") TagType // LiteralType represents a block style literal scalar start indicator ("|") LiteralType // FoldedType represents a block style folded scalar start indicator (">") FoldedType // SingleQuoteType represents a single quote ("'") SingleQuoteType // DoubleQuoteType represents a double quote ('"') DoubleQuoteType // DirectiveType represents a YAML directive indicator ("%") DirectiveType // LineBreakType represents a line break character sequence ("\n", "\r" or "\r\n") LineBreakType // SpaceType represents a single whitespace (" ") SpaceType // TabType represents a single tab ("\t") TabType // BOMType represents a byte-order mark BOMType // EOFType represents an end of file. EOFType // DocumentEndType represents a document end indicator ("...") DocumentEndType // DirectiveEndType represents a directive end indicator ("---") DirectiveEndType // StringType represents any string (like "key") StringType // StripChompingType represents a strip chomping indicator ("-") StripChompingType // KeepChompingType represents a keep chomping indicator ("+") KeepChompingType )