Documentation ¶
Index ¶
- func Parse(tokens token.Tokens, mode Mode, opts ...Option) (*ast.File, error)
- func ParseBytes(bytes []byte, mode Mode, opts ...Option) (*ast.File, error)
- func ParseFile(filename string, mode Mode, opts ...Option) (*ast.File, error)
- type Mode
- type Option
- type Token
- type TokenGroup
- type TokenGroupType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseBytes ¶
ParseBytes parse from byte slice, and returns ast.File
Types ¶
type Option ¶
type Option func(p *parser)
Option represents parser's option.
func AllowDuplicateMapKey ¶
func AllowDuplicateMapKey() Option
AllowDuplicateMapKey allow the use of keys with the same name in the same map, but by default, this is not permitted.
type Token ¶
type Token struct { Token *token.Token Group *TokenGroup LineComment *token.Token }
func (*Token) GroupType ¶
func (t *Token) GroupType() TokenGroupType
func (*Token) SetGroupType ¶
func (t *Token) SetGroupType(typ TokenGroupType)
type TokenGroup ¶
type TokenGroup struct { Type TokenGroupType Tokens []*Token }
func (*TokenGroup) Column ¶
func (g *TokenGroup) Column() int
func (*TokenGroup) First ¶
func (g *TokenGroup) First() *Token
func (*TokenGroup) Last ¶
func (g *TokenGroup) Last() *Token
func (*TokenGroup) Line ¶
func (g *TokenGroup) Line() int
func (*TokenGroup) RawToken ¶
func (g *TokenGroup) RawToken() *token.Token
func (*TokenGroup) TokenType ¶
func (g *TokenGroup) TokenType() token.Type
type TokenGroupType ¶
type TokenGroupType int
const ( TokenGroupNone TokenGroupType = iota TokenGroupDirective TokenGroupDocument TokenGroupDocumentBody TokenGroupAnchor TokenGroupAnchorName TokenGroupAlias TokenGroupLiteral TokenGroupFolded TokenGroupScalarTag TokenGroupMapKey TokenGroupMapKeyValue )
func (TokenGroupType) String ¶
func (t TokenGroupType) String() string
Click to show internal directories.
Click to hide internal directories.