Documentation ¶
Index ¶
- Variables
- func Fmt(input string) (string, error)
- func IsIdentifier(name string) bool
- func IsKeyword(name string) bool
- type ASTValue
- type Assignment
- type Block
- type BlockHeader
- type Body
- type BoolValue
- func (uv BoolValue) AsArray() ([]ASTValue, bool)
- func (iv BoolValue) AsBool() (bool, error)
- func (uv BoolValue) AsFloat(size int) (float64, error)
- func (uv BoolValue) AsInt(size int) (int64, error)
- func (uv BoolValue) AsString() (string, error)
- func (uv BoolValue) AsUint(size int) (uint64, error)
- func (uv BoolValue) IsArray() bool
- func (iv BoolValue) IsScalar() bool
- type CloseBlock
- type Comment
- type Declaration
- type Description
- type Error
- type File
- type FmtDiff
- type Fragment
- type FragmentKind
- type Ident
- type IntValue
- func (uv IntValue) AsArray() ([]ASTValue, bool)
- func (uv IntValue) AsBool() (bool, error)
- func (uv IntValue) AsFloat(size int) (float64, error)
- func (iv IntValue) AsInt(size int) (int64, error)
- func (uv IntValue) AsString() (string, error)
- func (uv IntValue) AsUint(size int) (uint64, error)
- func (uv IntValue) IsArray() bool
- func (iv IntValue) IsScalar() bool
- type Lexer
- type Position
- type Reference
- func (uv Reference) AsArray() ([]ASTValue, bool)
- func (uv Reference) AsBool() (bool, error)
- func (uv Reference) AsFloat(size int) (float64, error)
- func (uv Reference) AsInt(size int) (int64, error)
- func (r Reference) AsString() (string, error)
- func (uv Reference) AsUint(size int) (uint64, error)
- func (r Reference) GoString() string
- func (uv Reference) IsArray() bool
- func (uv Reference) IsScalar() bool
- func (r Reference) String() string
- func (r Reference) Strings() []string
- type SourceNode
- type Statement
- type StatementType
- type StringValue
- func (uv StringValue) AsArray() ([]ASTValue, bool)
- func (uv StringValue) AsBool() (bool, error)
- func (uv StringValue) AsFloat(size int) (float64, error)
- func (uv StringValue) AsInt(size int) (int64, error)
- func (sv StringValue) AsString() (string, error)
- func (uv StringValue) AsUint(size int) (uint64, error)
- func (uv StringValue) IsArray() bool
- func (sv StringValue) IsScalar() bool
- type TagMark
- type TagValue
- func (uv TagValue) AsArray() ([]ASTValue, bool)
- func (uv TagValue) AsBool() (bool, error)
- func (uv TagValue) AsFloat(size int) (float64, error)
- func (uv TagValue) AsInt(size int) (int64, error)
- func (tv TagValue) AsString() (string, error)
- func (uv TagValue) AsUint(size int) (uint64, error)
- func (tv TagValue) GoString() string
- func (uv TagValue) IsArray() bool
- func (tv TagValue) IsScalar() bool
- type Token
- type TokenType
- type TypeError
- type Value
- func (v Value) AsArray() ([]ASTValue, bool)
- func (v Value) AsBool() (bool, error)
- func (v Value) AsFloat(size int) (float64, error)
- func (v Value) AsInt(size int) (int64, error)
- func (v Value) AsString() (string, error)
- func (v Value) AsUint(size int) (uint64, error)
- func (v Value) GoString() string
- func (v Value) IsArray() bool
- func (v Value) IsScalar() bool
- func (v Value) Position() errpos.Position
- type Walker
Constants ¶
This section is empty.
Variables ¶
View Source
var HadErrors = fmt.Errorf("had errors, see Walker.Errors")
Functions ¶
func IsIdentifier ¶
IsIdentifier reports whether name is a Go identifier, that is, a non-empty string made up of letters, digits, and underscores, where the first character is not a digit. Keywords are not identifiers.
Types ¶
type ASTValue ¶
type ASTValue interface { AsBool() (bool, error) AsString() (string, error) AsInt(bits int) (int64, error) AsUint(bits int) (uint64, error) AsFloat(bits int) (float64, error) Position() errpos.Position IsArray() bool IsScalar() bool AsArray() ([]ASTValue, bool) }
func NewBoolValue ¶
func NewIntValue ¶
func NewStringValue ¶
func NewStringValue(val string, src SourceNode) ASTValue
type Assignment ¶
type Assignment struct { Key Reference Value Value SourceNode Append bool // If += was used, otherwise = }
func (Assignment) GoString ¶
func (a Assignment) GoString() string
func (Assignment) Kind ¶
func (a Assignment) Kind() FragmentKind
func (*Assignment) StatementType ¶
func (a *Assignment) StatementType() StatementType
type Block ¶
type Block struct { BlockHeader Body Body }
func (*Block) StatementType ¶
func (b *Block) StatementType() StatementType
type BlockHeader ¶
type BlockHeader struct { Type Reference // all of the name tags, including the first 'type' tag Tags []TagValue Qualifiers []TagValue // Any of the `:qualifier` tags at the end Description *Description // A single | description block Open bool // 'block' is opened with a { SourceNode }
func (BlockHeader) DescriptionString ¶
func (bh BlockHeader) DescriptionString() string
func (BlockHeader) GoString ¶
func (bs BlockHeader) GoString() string
func (BlockHeader) Kind ¶
func (bh BlockHeader) Kind() FragmentKind
func (BlockHeader) RootName ¶
func (bs BlockHeader) RootName() string
type BoolValue ¶
type BoolValue struct { SourceNode // contains filtered or unexported fields }
type CloseBlock ¶
type CloseBlock struct { SourceNode Token Token }
func (CloseBlock) GoString ¶
func (cb CloseBlock) GoString() string
func (CloseBlock) Kind ¶
func (cb CloseBlock) Kind() FragmentKind
type Comment ¶
type Comment struct { Value string SourceNode Token Token }
func (Comment) Kind ¶
func (c Comment) Kind() FragmentKind
func (*Comment) StatementType ¶
func (c *Comment) StatementType() StatementType
type Declaration ¶
type Declaration struct {
BlockHeader
}
func (*Declaration) StatementType ¶
func (d *Declaration) StatementType() StatementType
type Description ¶
type Description struct { Value string SourceNode Tokens []Token }
func (Description) GoString ¶
func (d Description) GoString() string
func (Description) Kind ¶
func (d Description) Kind() FragmentKind
func (*Description) StatementType ¶
func (d *Description) StatementType() StatementType
type Fragment ¶
type Fragment interface { fmt.GoStringer Source() SourceNode Kind() FragmentKind }
type FragmentKind ¶
type FragmentKind int
const ( AssignmentFragment FragmentKind = iota BlockHeaderFragment BlockCloseFragment DescriptionFragment )
type Ident ¶
type Ident struct { Token Token Value string SourceNode }
Ident is a simple name used when declaring a type, or as parts of a reference.
func (Ident) AsStringValue ¶
type IntValue ¶
type IntValue struct { SourceNode // contains filtered or unexported fields }
type Reference ¶
type Reference struct { Idents []Ident SourceNode // contains filtered or unexported fields }
Reference is a dot separates set of Idents
func NewReference ¶
type SourceNode ¶
func (SourceNode) Position ¶
func (sn SourceNode) Position() errpos.Position
func (SourceNode) Source ¶
func (sn SourceNode) Source() SourceNode
type Statement ¶
type Statement interface { StatementType() StatementType Source() SourceNode }
type StatementType ¶
type StatementType string
const ( // Compound Statements, consist of multiple fragments BlockStatement StatementType = "block" DeclarationStatement StatementType = "declaration" // Fragments which are also Statements AssignmentStatement StatementType = "assignment" CommentStatement StatementType = "comment" DescriptionStatement StatementType = "description" )
type StringValue ¶
type StringValue struct { SourceNode // contains filtered or unexported fields }
func (StringValue) AsString ¶
func (sv StringValue) AsString() (string, error)
func (StringValue) IsScalar ¶
func (sv StringValue) IsScalar() bool
type TagValue ¶
type TagValue struct { Mark TagMark MarkToken Token Reference *Reference Value *Value SourceNode // contains filtered or unexported fields }
type TokenType ¶
type TokenType int
const ( INVALID TokenType = iota EOF EOL SPACE IDENT STRING // "abc" REGEX // /abc/ INT // 123 DECIMAL // 123.45 BOOL // true or false COMMENT // // ... BLOCK_COMMENT // /* ... */ DESCRIPTION // | ... ASSIGN // = LBRACE // { RBRACE // } LBRACK // [ RBRACK // ] DOT // . COMMA // , COLON // : PLUS // + BANG // ! QUESTION // ? AnyLiteral )
func (TokenType) CanStartTag ¶
func (TokenType) IsKeyword ¶
IsKeyword returns true for tokens corresponding to keywords; it returns false otherwise.
func (TokenType) IsLiteral ¶
IsLiteral returns true for tokens corresponding to identifiers, basic type literals; it returns false otherwise.
func (TokenType) IsOperator ¶
IsOperator returns true for tokens corresponding to operators; it returns false otherwise.
type Value ¶
type Value struct { SourceNode // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.