dsl

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lex

func Lex(input string) <-chan Token

Types

type AST

type AST Node

func Parse

func Parse(input string) (AST, error)

type ActivateStatementNode

type ActivateStatementNode struct {
	Position
	Scene Token
	Start *TimeNode
	Stop  *TimeNode
}

type AtStatementNode

type AtStatementNode struct {
	Position
	Time  *TimeNode
	Block *BlockNode
}

type BlockNode

type BlockNode struct {
	Position
	Statements []Node
}

type DurationNode

type DurationNode struct {
	Position
	Duration time.Duration
	Literal  string
}

type GetStatementNode

type GetStatementNode struct {
	Position
	Path *PathNode
}

type Node

type Node interface {
	Pos() Position
}

type PathMatchNode

type PathMatchNode struct {
	Position
	Path string
}

type PathNode

type PathNode struct {
	Position
	Path string
}

type Position

type Position struct {
	Line int
	Char int
}

func (Position) Pos

func (p Position) Pos() Position

type ProgramNode

type ProgramNode struct {
	Position

	Statements []Node
}

type SceneStatementNode

type SceneStatementNode struct {
	Position
	Identifier Token
	Block      *BlockNode
}

type SetStatementNode

type SetStatementNode struct {
	Position
	DeviceMatch *PathMatchNode
	Value       *ValueNode
}

type StartStatementNode

type StartStatementNode struct {
	Position
	Identifier Token
}

type StopStatementNode

type StopStatementNode struct {
	Position
	Identifier Token
}

type TimeNode

type TimeNode struct {
	Position
	Hour    int
	Minute  int
	AM      bool
	Keyword bool
	Literal string
}

type Token

type Token struct {
	Pos   Position
	Type  TokenType
	Value string
}

type TokenType

type TokenType int
const (
	TokenError TokenType = iota
	TokenEOF

	TokenList
	TokenSet
	TokenGet
	TokenVar
	TokenScene
	TokenAt
	TokenWhen
	TokenWait
	TokenIs
	TokenAM
	TokenPM
	TokenStart
	TokenStop
	TokenActivate

	TokenWord
	TokenString
	TokenNumber
	TokenDuration
	TokenTime
	TokenAsign
	TokenStar
	TokenPathSeparator
	TokenDollar

	TokenOpenBracket
	TokenCloseBracket
)

func (TokenType) String

func (tt TokenType) String() string

type ValueNode

type ValueNode struct {
	Position
	Value   string
	Literal string
}

type VarStatementNode

type VarStatementNode struct {
	Position
	Identifier Token
	Get        *GetStatementNode
}

type WhenStatementNode

type WhenStatementNode struct {
	Position
	Path         *PathMatchNode
	IsValue      *ValueNode
	WaitDuration *DurationNode
	Block        *BlockNode
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL