Documentation ¶
Index ¶
- Variables
- func REPL(env *Env) error
- type Array
- type Assign
- type Block
- type BlockNode
- type Bool
- type Branch
- type Builtin
- type Call
- type Callable
- type Const
- type ConstNode
- type Env
- type Expander
- type Func
- type Macro
- type Nil
- type Node
- type Number
- type Ref
- type Scope
- type SexprNode
- type StatementNode
- type String
- type Switch
- type TagNode
- type Value
Constants ¶
This section is empty.
Variables ¶
View Source
var Lexer = lexer.MustSimple([]lexer.Rule{
{Name: "WS", Pattern: `\s+`},
{Name: "Open", Pattern: `\(`},
{Name: "Close", Pattern: `\)`},
{Name: "String", Pattern: `"([^"]*)"`},
{Name: "Number", Pattern: `\d+`},
{Name: "Ident", Pattern: `[a-zA-Z_][a-zA-Z0-9_]*`},
{Name: "Op", Pattern: `[-+*/%<>=!&|^]+`},
{Name: "Semi", Pattern: `;`},
})
View Source
var Parser = participle.MustBuild(&BlockNode{}, participle.Lexer(Lexer), participle.Elide("WS"))
Functions ¶
Types ¶
type BlockNode ¶
type BlockNode struct {
Statements []StatementNode `parser:"(@@ ';'?)*"`
}
type SexprNode ¶
type SexprNode struct { Tag TagNode `parser:"@@"` Args []StatementNode `parser:"@@*"` }
type StatementNode ¶
type StatementNode struct { Sexpr *SexprNode `parser:" '(' @@ ')'"` Const *ConstNode `parser:"| @@"` Tag *TagNode `parser:"| @@"` }
func (StatementNode) Parse ¶
func (n StatementNode) Parse() Node
Click to show internal directories.
Click to hide internal directories.