Documentation ¶
Index ¶
- func AssertNotSymbol(t Token) error
- func AssertNotWord(t Token) error
- func AssertOperable(t Token) error
- func ChangeOperator(t Token, newName string)
- func ChangeSymbol(t Token, newValue string, newIsKeyWord bool)
- func ContainsSymbol(ts []Token, s string) bool
- func ContainsSymbolThatEndsWith(ts []Token, s string) bool
- func FindFirstBracesGroup(ts []Token, istart int) int
- func FindFirstParensGroup(ts []Token, istart int) int
- func FindGroupStop(ts []Token, istart int, tstart Token) ([2]int, bool)
- func IsAngledGroup(t Token) bool
- func IsAnyBinaryOperator(t Token) bool
- func IsAnyGroup(t Token) bool
- func IsAnyNonAngledGroupStart(t Token) bool
- func IsAnyNonAngledGroupStop(t Token) bool
- func IsAnyNonWordSymbol(t Token) bool
- func IsAnyOperator(t Token) bool
- func IsAnySingularOperator(t Token) bool
- func IsAnySymbol(t Token) bool
- func IsAnyTernaryOperator(t Token) bool
- func IsAnyUnaryOperator(t Token) bool
- func IsAnyWord(t Token) bool
- func IsBinaryOperator(t Token, name string) bool
- func IsBracesGroup(t Token) bool
- func IsBracketsGroup(t Token) bool
- func IsDummySymbol(t Token) bool
- func IsGroup(t Token) bool
- func IsIndent(t Token) bool
- func IsLiteral(t Token) bool
- func IsLiteralBool(t Token) bool
- func IsLiteralColor(t Token) bool
- func IsLiteralFloat(t Token) bool
- func IsLiteralInt(t Token) bool
- func IsLiteralNull(t Token) bool
- func IsLiteralString(t Token) bool
- func IsNL(t Token) bool
- func IsOperable(t Token) bool
- func IsOperator(t Token, name string) bool
- func IsParensGroup(t Token) bool
- func IsSingularOperator(t Token, name string) bool
- func IsSpecialNumber(t Token) bool
- func IsSymbol(t Token, value string) bool
- func IsSymbolThatEndsWith(t Token, value string) bool
- func IsTemplateGroup(t Token) bool
- func IsTernaryOperator(t Token, name string) bool
- func IsTmpGroup(t Token) bool
- func IsUnaryOperator(t Token, name string) bool
- func IsWhitespace(t Token) bool
- func IsWord(t Token, s string) bool
- func MergeContexts(ts ...Token) context.Context
- func ShortHash(content string) string
- func SplitByFirstSymbol(ts []Token, s string) ([]Token, []Token)
- func SplitBySymbol(ts []Token, s string) [][]Token
- type ContentType
- type Group
- func AssertAngledGroup(t Token) (*Group, error)
- func AssertBracesGroup(t Token) (*Group, error)
- func AssertBracketsGroup(t Token) (*Group, error)
- func AssertGroup(t Token) (*Group, error)
- func AssertParensGroup(t Token) (*Group, error)
- func NewEmptyBracesGroup(ctx context.Context) *Group
- func NewGroupFromTokens(raw []Token) (*Group, error)
- func NewTemplateGroup(ctx context.Context) *Group
- func NewTmpGroup(raw []Token) *Group
- func (t *Group) Dump(indent string) string
- func (t *Group) ExpandOnce() []Token
- func (t *Group) FlattenCommas() ([]Token, error)
- func (t *Group) IsAngled() bool
- func (t *Group) IsBraces() bool
- func (t *Group) IsBrackets() bool
- func (t *Group) IsComma() bool
- func (t *Group) IsEmpty() bool
- func (t *Group) IsParens() bool
- func (t *Group) IsSemiColon() bool
- func (t *Group) IsSingle() bool
- func (t *Group) IsTemplate() bool
- func (t *Group) IsTmp() bool
- type GroupType
- type Indent
- type LiteralBool
- type LiteralColor
- type LiteralFloat
- func AssertLiteralFloat(t Token, unit string) (*LiteralFloat, error)
- func NewLiteralFloat(s string, ctx context.Context) (*LiteralFloat, error)
- func NewValueLiteralFloat(value float64, ctx context.Context) (*LiteralFloat, error)
- func NewValueUnitLiteralFloat(value float64, unit string, ctx context.Context) (*LiteralFloat, error)
- type LiteralInt
- type LiteralNull
- type LiteralString
- type NL
- type Operator
- func AssertAnyBinaryOperator(t Token) (*Operator, error)
- func AssertAnyOperator(t Token) (*Operator, error)
- func AssertAnySingularOperator(t Token) (*Operator, error)
- func AssertAnyTernaryOperator(t Token) (*Operator, error)
- func AssertAnyUnaryOperator(t Token) (*Operator, error)
- func AssertBinaryOperator(t Token, name string) (*Operator, error)
- func AssertSingularOperator(t Token, name string) (*Operator, error)
- func AssertTernaryOperator(t Token, name string) (*Operator, error)
- func AssertUnaryOperator(t Token, name string) (*Operator, error)
- func NewBinaryOperator(name string, a Token, b Token, ctx context.Context) *Operator
- func NewSingularOperator(name string, ctx context.Context) *Operator
- func NewTernaryOperator(name string, a Token, b Token, c Token, ctx context.Context) *Operator
- func NewUnaryOperator(name string, a Token, ctx context.Context) *Operator
- type SpecialNumber
- type Symbol
- type Token
- type TokenData
- type Word
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertNotSymbol ¶
func AssertNotWord ¶
func AssertOperable ¶
func ChangeOperator ¶
func ChangeSymbol ¶
func ContainsSymbol ¶
func FindFirstBracesGroup ¶ added in v0.4.0
func FindFirstParensGroup ¶
func IsAngledGroup ¶
func IsAnyBinaryOperator ¶
func IsAnyGroup ¶
func IsAnyNonAngledGroupStop ¶
func IsAnyNonWordSymbol ¶
func IsAnyOperator ¶
func IsAnySingularOperator ¶
func IsAnySymbol ¶
func IsAnyTernaryOperator ¶
func IsAnyUnaryOperator ¶
func IsBinaryOperator ¶
func IsBracesGroup ¶
func IsBracketsGroup ¶
func IsDummySymbol ¶
func IsLiteralBool ¶
func IsLiteralColor ¶
func IsLiteralFloat ¶
func IsLiteralInt ¶
func IsLiteralNull ¶
func IsLiteralString ¶
func IsOperable ¶
func IsOperator ¶
func IsParensGroup ¶
func IsSingularOperator ¶
func IsSpecialNumber ¶
func IsSymbolThatEndsWith ¶
func IsTemplateGroup ¶
func IsTernaryOperator ¶
func IsTmpGroup ¶
func IsUnaryOperator ¶
func IsWhitespace ¶ added in v0.3.0
func MergeContexts ¶
func SplitByFirstSymbol ¶
first part includes the symbol
func SplitBySymbol ¶ added in v0.4.0
Types ¶
type ContentType ¶
type ContentType int
const ( EMPTY ContentType = iota SINGLE COMMA SEMICOLON TMPCONTENT )
type Group ¶
func AssertAngledGroup ¶
func AssertBracesGroup ¶
func AssertBracketsGroup ¶
func AssertGroup ¶
func AssertParensGroup ¶
func NewEmptyBracesGroup ¶
eg. empty function body for abstract functions
func NewGroupFromTokens ¶
func NewTemplateGroup ¶
func NewTmpGroup ¶
func (*Group) ExpandOnce ¶ added in v0.4.0
func (*Group) FlattenCommas ¶
func (*Group) IsBrackets ¶
func (*Group) IsSemiColon ¶
func (*Group) IsTemplate ¶
type Indent ¶ added in v0.3.0
type Indent struct { TokenData // contains filtered or unexported fields }
func AssertIndent ¶ added in v0.3.0
type LiteralBool ¶
type LiteralBool struct { TokenData // contains filtered or unexported fields }
func AssertLiteralBool ¶
func AssertLiteralBool(t Token) (*LiteralBool, error)
func NewLiteralBool ¶
func NewLiteralBool(x interface{}, ctx context.Context) (*LiteralBool, error)
func NewValueLiteralBool ¶
func NewValueLiteralBool(b bool, ctx context.Context) *LiteralBool
func (*LiteralBool) Dump ¶
func (t *LiteralBool) Dump(indent string) string
func (*LiteralBool) Value ¶
func (t *LiteralBool) Value() bool
type LiteralColor ¶
type LiteralColor struct { TokenData // contains filtered or unexported fields }
func AssertLiteralColor ¶
func AssertLiteralColor(t Token) (*LiteralColor, error)
func NewLiteralColor ¶
func NewLiteralColor(s string, ctx context.Context) (*LiteralColor, error)
func (*LiteralColor) Dump ¶
func (t *LiteralColor) Dump(indent string) string
func (*LiteralColor) Values ¶
func (t *LiteralColor) Values() (r, g, b, a int)
type LiteralFloat ¶
type LiteralFloat struct { TokenData // contains filtered or unexported fields }
func AssertLiteralFloat ¶
func AssertLiteralFloat(t Token, unit string) (*LiteralFloat, error)
unit can be '*' wild card
func NewLiteralFloat ¶
func NewLiteralFloat(s string, ctx context.Context) (*LiteralFloat, error)
func NewValueLiteralFloat ¶
func NewValueLiteralFloat(value float64, ctx context.Context) (*LiteralFloat, error)
func (*LiteralFloat) Dump ¶
func (t *LiteralFloat) Dump(indent string) string
func (*LiteralFloat) Unit ¶
func (t *LiteralFloat) Unit() string
func (*LiteralFloat) Value ¶
func (t *LiteralFloat) Value() float64
type LiteralInt ¶
type LiteralInt struct { TokenData // contains filtered or unexported fields }
distinct from Float because it is used for indexing in lists
func AssertLiteralInt ¶
func AssertLiteralInt(t Token) (*LiteralInt, error)
func NewHexLiteralInt ¶
func NewHexLiteralInt(x string, ctx context.Context) (*LiteralInt, error)
func NewLiteralInt ¶
func NewLiteralInt(x interface{}, ctx context.Context) (*LiteralInt, error)
func NewValueLiteralInt ¶
func NewValueLiteralInt(v int, ctx context.Context) *LiteralInt
func (*LiteralInt) Dump ¶
func (t *LiteralInt) Dump(indent string) string
func (*LiteralInt) Value ¶
func (t *LiteralInt) Value() int
type LiteralNull ¶
type LiteralNull struct {
TokenData
}
func NewLiteralNull ¶
func NewLiteralNull(ctx context.Context) *LiteralNull
func (*LiteralNull) Dump ¶
func (t *LiteralNull) Dump(indent string) string
type LiteralString ¶
type LiteralString struct { TokenData // contains filtered or unexported fields }
func AssertLiteralString ¶
func AssertLiteralString(t Token) (*LiteralString, error)
func NewLiteralString ¶
func NewLiteralString(value string, ctx context.Context) (*LiteralString, error)
func NewValueLiteralString ¶
func NewValueLiteralString(value string, ctx context.Context) *LiteralString
func NewWordLiteralString ¶
func NewWordLiteralString(value string, ctx context.Context) *LiteralString
used by ui
func (*LiteralString) Dump ¶
func (t *LiteralString) Dump(indent string) string
func (*LiteralString) InnerContext ¶
func (t *LiteralString) InnerContext() context.Context
func (*LiteralString) Value ¶
func (t *LiteralString) Value() string
func (*LiteralString) WasWord ¶
func (t *LiteralString) WasWord() bool
type Operator ¶
type Operator struct { TokenData // contains filtered or unexported fields }
func AssertAnyBinaryOperator ¶
func AssertAnyOperator ¶
func AssertAnyUnaryOperator ¶
func NewBinaryOperator ¶
func NewTernaryOperator ¶
type SpecialNumber ¶
type SpecialNumber struct { TokenData // contains filtered or unexported fields }
func AssertSpecialNumber ¶
func AssertSpecialNumber(t Token) (*SpecialNumber, error)
func NewSpecialNumber ¶
func NewSpecialNumber(value string, ctx context.Context) *SpecialNumber
func (*SpecialNumber) Dump ¶
func (t *SpecialNumber) Dump(indent string) string
func (*SpecialNumber) Value ¶
func (t *SpecialNumber) Value() string
type Symbol ¶
type Symbol struct { TokenData // contains filtered or unexported fields }
this is a temporary token, and shouldnt be available outside the parser package
func AssertAnySymbol ¶
type Token ¶
type Token interface { Dump(indent string) string // to inspect the syntax-tree Context() context.Context }
func ExpandAngledGroups ¶
func ExpandParensGroup ¶
func ExpandTmpGroups ¶
func RemoveWhitespace ¶ added in v0.3.0
type Word ¶
type Word struct { TokenData // contains filtered or unexported fields }
use Symbol for KeyWords!
func AssertWord ¶
Click to show internal directories.
Click to hide internal directories.