Documentation
¶
Overview ¶
Package yaml12 ports the parts of eemeli/yaml 2.9.0 that Pi's frontmatter parser runs (lexer, parser, composer, core schema, error text), so frontmatter reads and fails as it does in Pi.
Ports yaml 2.9.0 src/parse/lexer.ts. Copyright Eemeli Aro, ISC licence: permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
Positions are byte offsets into the source; LineCounter reports UTF-16 columns, as the JavaScript library does. The lexer reads a complete source, so the incremental-input states of the original are absent.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
Parse is parse(source) of the yaml package: the JavaScript value of the single document in source, or the error the library throws. A parse error message already carries the line, column and source excerpt.
func ParseOrdered ¶
ParseOrdered is Parse with every object an *Object, which lists its keys in the order the library inserts them. A JavaScript object enumerates its array-index keys first, ascending, and the others in this order; the map Parse returns has no order at all.
Types ¶
type Date ¶
type Date struct{ MS float64 }
Date is a JavaScript Date; MS is its time value, NaN for an invalid date.
type Object ¶
Object is a JavaScript object ParseOrdered built: Keys are its own string keys in insertion order (a repeated key keeps its first position), and Values holds each key's value.
type Token ¶
type Token struct {
Type string
Offset int
Indent int
Source string
Message string
// Start is the props of a document.
Start []*Token
// StartTok is the opening bracket of a flow collection.
StartTok *Token
End []*Token
Props []*Token
Items []*Item
Value *Token
}
Token is a CST token. Field use follows the token type exactly as in the library: End and Sep are nil where the library leaves the property undefined.