Documentation
¶
Index ¶
- Variables
- type BasicType
- type Collection
- type CompoundStatement
- type Decorator
- type DecoratorName
- type Expression
- type Field
- type For
- type ForInitial
- type Function
- type If
- type Index
- type IndexField
- type Item
- type Let
- type Map
- type Node
- type Operator
- type Order
- type Program
- type SimpleStatement
- type SmallStatement
- type Statement
- type StatementsOrSimple
- type Type
- type Value
- type While
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DecoratorNameToString = map[DecoratorName]string{ Public: "public", Read: "read", Call: "call", Delegate: "delegate", } StringToDecoratorName = map[string]DecoratorName{ "public": Public, "read": Read, "call": Call, "delegate": Delegate, } )
View Source
var ( OperatorToString = map[Operator]string{ Not: "!", BitNot: "~", Exponent: "**", Multiply: "*", Divide: "/", Modulo: "%", Add: "+", Subtract: "-", ShiftLeft: "<<", ShiftRight: ">>", BitAnd: "&", BitXor: "^", BitOr: "|", LessThan: "<", GreaterThan: ">", LessThanOrEqual: "<=", GreaterThanOrEqual: ">=", Equal: "==", NotEqual: "!=", And: "&&", Or: "||", AssignSub: "-=", AssignAdd: "+=", Assign: "=", } StringToOperator = map[string]Operator{ "!": Not, "~": BitNot, "**": Exponent, "*": Multiply, "/": Divide, "%": Modulo, "+": Add, "-": Subtract, "<<": ShiftLeft, ">>": ShiftRight, "&": BitAnd, "^": BitXor, "|": BitOr, "<": LessThan, ">": GreaterThan, "<=": LessThanOrEqual, ">=": GreaterThanOrEqual, "==": Equal, "!=": NotEqual, "&&": And, "||": Or, "-=": AssignSub, "+=": AssignAdd, "=": Assign, } )
View Source
var ( OrderToString = map[Order]string{Asc: "asc", Desc: "desc"} StringToOrder = map[string]Order{"asc": Asc, "desc": Desc} )
View Source
var ( TypeToString = map[BasicType]string{ String: "string", Number: "number", Boolean: "boolean", Bytes: "bytes", PublicKey: "PublicKey", Record: "record", } StringToType = map[string]BasicType{ "string": String, "number": Number, "boolean": Boolean, "bytes": Bytes, "PublicKey": PublicKey, "record": Record, } )
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type CompoundStatement ¶
type Decorator ¶ added in v0.0.2
type Decorator struct { Name DecoratorName `parser:"'@' @@"` Arguments []string `parser:"( '(' @Ident ')' )?"` }
type DecoratorName ¶ added in v0.0.2
type DecoratorName int
const ( Public DecoratorName = iota + 1 Read Call Delegate )
func (*DecoratorName) Parse ¶ added in v0.0.2
func (d *DecoratorName) Parse(lex *lexer.PeekingLexer) error
func (DecoratorName) String ¶ added in v0.0.2
func (d DecoratorName) String() string
type Expression ¶
type For ¶
type For struct { Initial *ForInitial `parser:"'for' '(' @@ ';'"` Condition *Expression `parser:"@@ ';'"` Post *Expression `parser:"@@ ')'"` Statements []*Statement `parser:"'{' @@* '}'"` }
type ForInitial ¶
type ForInitial struct { Let *Let `parser:"@@"` Expression *Expression `parser:"| @@"` }
type If ¶
type If struct { Condition *Expression `parser:"'if' '(' @@ ')'"` Statement *StatementsOrSimple `parser:"( @@ )?"` Else *StatementsOrSimple `parser:"( 'else' @@ )?"` }
type Index ¶
type Index struct {
Fields []*IndexField `parser:"'@' 'index' '(' ( @@ ( ',' @@ )* )? ')'"`
}
type IndexField ¶
type Let ¶
type Let struct { Ident string `parser:"'let' @Ident '='"` Expression *Expression `parser:"@@"` }
type Node ¶ added in v0.0.3
type Node struct { Collection *Collection `parser:"@@" json:"collection,omitempty"` Function *Function `parser:"| @@" json:"function,omitempty"` }
type SimpleStatement ¶
type SimpleStatement struct {
Small *SmallStatement `parser:"@@ ';'"`
}
type SmallStatement ¶
type SmallStatement struct { Break bool `parser:"( @'break'? )!"` Return *Expression `parser:"| 'return' @@"` Throw *Expression `parser:"| 'throw' @@"` Let *Let `parser:"| @@"` Expression *Expression `parser:"| @@"` }
type Statement ¶
type Statement struct { Compound *CompoundStatement `parser:"@@"` Simple *SimpleStatement `parser:"| @@"` }
type StatementsOrSimple ¶ added in v0.0.2
type StatementsOrSimple struct { Statements []*Statement `parser:"'{' @@* '}'"` Simple *SimpleStatement `parser:"| @@"` }
type Value ¶ added in v0.0.2
type Value struct { Number *int `parser:"@Number"` String *string `parser:"| @String"` Boolean bool `parser:"| ( @'true' | 'false' )"` Ident *string `parser:"| @Ident"` Sub *Expression `parser:"| '(' ( @@ )? ')'"` }
type While ¶
type While struct { Condition *Expression `parser:"'while' '(' @@ ')'"` Statements []*Statement `parser:"'{' @@* '}'"` }
Click to show internal directories.
Click to hide internal directories.