Documentation ¶
Index ¶
- Constants
- Variables
- func DetectLineBreakCharacter(src string) string
- func IsNeedQuoted(value string) bool
- func LiteralBlockHeader(value string) string
- type Character
- type CharacterType
- type Indicator
- type Position
- type ReservedTagKeyword
- type Token
- func Alias(org string, pos *Position) *Token
- func Anchor(org string, pos *Position) *Token
- func CollectEntry(org string, pos *Position) *Token
- func Comment(value string, org string, pos *Position) *Token
- func Directive(org string, pos *Position) *Token
- func DocumentEnd(org string, pos *Position) *Token
- func DocumentHeader(org string, pos *Position) *Token
- func DoubleQuote(value string, org string, pos *Position) *Token
- func Folded(value string, org string, pos *Position) *Token
- func Literal(value string, org string, pos *Position) *Token
- func MappingEnd(org string, pos *Position) *Token
- func MappingKey(pos *Position) *Token
- func MappingStart(org string, pos *Position) *Token
- func MappingValue(pos *Position) *Token
- func MergeKey(org string, pos *Position) *Token
- func New(value string, org string, pos *Position) *Token
- func SequenceEnd(org string, pos *Position) *Token
- func SequenceEntry(org string, pos *Position) *Token
- func SequenceStart(org string, pos *Position) *Token
- func SingleQuote(value string, org string, pos *Position) *Token
- func Space(pos *Position) *Token
- func String(value string, org string, pos *Position) *Token
- func Tag(value string, org string, pos *Position) *Token
- type Tokens
- type Type
Constants ¶
const ( // SequenceEntryCharacter character for sequence entry SequenceEntryCharacter Character = '-' // MappingKeyCharacter character for mapping key MappingKeyCharacter = '?' // MappingValueCharacter character for mapping value MappingValueCharacter = ':' // CollectEntryCharacter character for collect entry CollectEntryCharacter = ',' // SequenceStartCharacter character for sequence start SequenceStartCharacter = '[' // SequenceEndCharacter character for sequence end SequenceEndCharacter = ']' // MappingStartCharacter character for mapping start MappingStartCharacter = '{' // MappingEndCharacter character for mapping end MappingEndCharacter = '}' // CommentCharacter character for comment CommentCharacter = '#' // AnchorCharacter character for anchor AnchorCharacter = '&' // AliasCharacter character for alias AliasCharacter = '*' // TagCharacter character for tag TagCharacter = '!' // LiteralCharacter character for literal LiteralCharacter = '|' // FoldedCharacter character for folded FoldedCharacter = '>' // SingleQuoteCharacter character for single quote SingleQuoteCharacter = '\'' // DoubleQuoteCharacter character for double quote DoubleQuoteCharacter = '"' // DirectiveCharacter character for directive DirectiveCharacter = '%' // SpaceCharacter character for space SpaceCharacter = ' ' // LineBreakCharacter character for line break LineBreakCharacter = '\n' )
Variables ¶
var ReservedTagKeywordMap = map[ReservedTagKeyword]func(string, string, *Position) *Token{ IntegerTag: func(value, org string, pos *Position) *Token { return &Token{ Type: TagType, CharacterType: CharacterTypeIndicator, Indicator: NodePropertyIndicator, Value: value, Origin: org, Position: pos, } }, FloatTag: func(value, org string, pos *Position) *Token { return &Token{ Type: TagType, CharacterType: CharacterTypeIndicator, Indicator: NodePropertyIndicator, Value: value, Origin: org, Position: pos, } }, NullTag: func(value, org string, pos *Position) *Token { return &Token{ Type: TagType, CharacterType: CharacterTypeIndicator, Indicator: NodePropertyIndicator, Value: value, Origin: org, Position: pos, } }, SequenceTag: func(value, org string, pos *Position) *Token { return &Token{ Type: TagType, CharacterType: CharacterTypeIndicator, Indicator: NodePropertyIndicator, Value: value, Origin: org, Position: pos, } }, MappingTag: func(value, org string, pos *Position) *Token { return &Token{ Type: TagType, CharacterType: CharacterTypeIndicator, Indicator: NodePropertyIndicator, Value: value, Origin: org, Position: pos, } }, StringTag: func(value, org string, pos *Position) *Token { return &Token{ Type: TagType, CharacterType: CharacterTypeIndicator, Indicator: NodePropertyIndicator, Value: value, Origin: org, Position: pos, } }, BinaryTag: func(value, org string, pos *Position) *Token { return &Token{ Type: TagType, CharacterType: CharacterTypeIndicator, Indicator: NodePropertyIndicator, Value: value, Origin: org, Position: pos, } }, OrderedMapTag: func(value, org string, pos *Position) *Token { return &Token{ Type: TagType, CharacterType: CharacterTypeIndicator, Indicator: NodePropertyIndicator, Value: value, Origin: org, Position: pos, } }, SetTag: func(value, org string, pos *Position) *Token { return &Token{ Type: TagType, CharacterType: CharacterTypeIndicator, Indicator: NodePropertyIndicator, Value: value, Origin: org, Position: pos, } }, TimestampTag: func(value, org string, pos *Position) *Token { return &Token{ Type: TagType, CharacterType: CharacterTypeIndicator, Indicator: NodePropertyIndicator, Value: value, Origin: org, Position: pos, } }, }
ReservedTagKeywordMap map for reserved tag keywords
Functions ¶
func DetectLineBreakCharacter ¶
DetectLineBreakCharacter detect line break character in only one inside scalar content scope.
func IsNeedQuoted ¶
IsNeedQuoted whether need quote for passed string or not
func LiteralBlockHeader ¶
LiteralBlockHeader detect literal block scalar header
Types ¶
type CharacterType ¶
type CharacterType int
CharacterType type for character category
const ( // CharacterTypeIndicator type of indicator character CharacterTypeIndicator CharacterType = iota // CharacterTypeWhiteSpace type of white space character CharacterTypeWhiteSpace // CharacterTypeMiscellaneous type of miscellaneous character CharacterTypeMiscellaneous // CharacterTypeEscaped type of escaped character CharacterTypeEscaped )
func (CharacterType) String ¶
func (c CharacterType) String() string
String character type identifier to text
type Indicator ¶
type Indicator int
Indicator type for indicator
const ( // NotIndicator not indicator NotIndicator Indicator = iota // BlockStructureIndicator indicator for block structure ( '-', '?', ':' ) BlockStructureIndicator // FlowCollectionIndicator indicator for flow collection ( '[', ']', '{', '}', ',' ) FlowCollectionIndicator // CommentIndicator indicator for comment ( '#' ) CommentIndicator // NodePropertyIndicator indicator for node property ( '!', '&', '*' ) NodePropertyIndicator // BlockScalarIndicator indicator for block scalar ( '|', '>' ) BlockScalarIndicator // QuotedScalarIndicator indicator for quoted scalar ( ”', '"' ) QuotedScalarIndicator // DirectiveIndicator indicator for directive ( '%' ) DirectiveIndicator // InvalidUseOfReservedIndicator indicator for invalid use of reserved keyword ( '@', '`' ) InvalidUseOfReservedIndicator )
type ReservedTagKeyword ¶
type ReservedTagKeyword string
ReservedTagKeyword type of reserved tag keyword
const ( // IntegerTag `!!int` tag IntegerTag ReservedTagKeyword = "!!int" // FloatTag `!!float` tag FloatTag ReservedTagKeyword = "!!float" // NullTag `!!null` tag NullTag ReservedTagKeyword = "!!null" // SequenceTag `!!seq` tag SequenceTag ReservedTagKeyword = "!!seq" // MappingTag `!!map` tag MappingTag ReservedTagKeyword = "!!map" // StringTag `!!str` tag StringTag ReservedTagKeyword = "!!str" // BinaryTag `!!binary` tag BinaryTag ReservedTagKeyword = "!!binary" // OrderedMapTag `!!omap` tag OrderedMapTag ReservedTagKeyword = "!!omap" // SetTag `!!set` tag SetTag ReservedTagKeyword = "!!set" // TimestampTag `!!timestamp` tag TimestampTag ReservedTagKeyword = "!!timestamp" )
type Token ¶
type Token struct { Type Type CharacterType CharacterType Indicator Indicator Value string Origin string Position *Position Next *Token Prev *Token }
Token type for token
func CollectEntry ¶
CollectEntry create token for CollectEntry
func DocumentEnd ¶
DocumentEnd create token for DocumentEnd
func DocumentHeader ¶
DocumentHeader create token for DocumentHeader
func DoubleQuote ¶
DoubleQuote create token for DoubleQuote
func MappingEnd ¶
MappingEnd create token for MappingEnd
func MappingStart ¶
MappingStart create token for MappingStart
func MappingValue ¶
MappingValue create token for MappingValue
func SequenceEnd ¶
SequenceEnd create token for SequenceEnd
func SequenceEntry ¶
SequenceEntry create token for SequenceEntry
func SequenceStart ¶
SequenceStart create token for SequenceStart
func SingleQuote ¶
SingleQuote create token for SingleQuote
type Type ¶
type Type int
Type type identifier for token
const ( // UnknownType reserve for invalid type UnknownType Type = iota // DocumentHeaderType type for DocumentHeader token DocumentHeaderType // DocumentEndType type for DocumentEnd token DocumentEndType // SequenceEntryType type for SequenceEntry token SequenceEntryType // MappingKeyType type for MappingKey token MappingKeyType // MappingValueType type for MappingValue token MappingValueType // MergeKeyType type for MergeKey token MergeKeyType // CollectEntryType type for CollectEntry token CollectEntryType // SequenceStartType type for SequenceStart token SequenceStartType // SequenceEndType type for SequenceEnd token SequenceEndType // MappingStartType type for MappingStart token MappingStartType // MappingEndType type for MappingEnd token MappingEndType // CommentType type for Comment token CommentType // AnchorType type for Anchor token AnchorType // AliasType type for Alias token AliasType // TagType type for Tag token TagType // LiteralType type for Literal token LiteralType // FoldedType type for Folded token FoldedType // SingleQuoteType type for SingleQuote token SingleQuoteType // DoubleQuoteType type for DoubleQuote token DoubleQuoteType // DirectiveType type for Directive token DirectiveType // SpaceType type for Space token SpaceType // NullType type for Null token NullType // InfinityType type for Infinity token InfinityType // NanType type for Nan token NanType // IntegerType type for Integer token IntegerType // BinaryIntegerType type for BinaryInteger token BinaryIntegerType // OctetIntegerType type for OctetInteger token OctetIntegerType // HexIntegerType type for HexInteger token HexIntegerType // FloatType type for Float token FloatType // StringType type for String token StringType // BoolType type for Bool token BoolType )