msg

package
v1.36.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

README

  • \n: 改行
  • [p]: 改ページクリック待ち
  • [l]: 行末クリック待ち
  • [image source"test.png" page="fore" layer="base"]: 背景表示

Documentation

Index

Constants

View Source
const (
	QueueStateNone   = QueueState("NONE")
	QueueStateFinish = QueueState("FINISH")
)
View Source
const (
	LOWEST int
	CMD    // [...]
)
View Source
const (
	ILLEGAL = "ILLEGAL"
	EOF     = "EOF"

	// 識別子 + リテラル。数値や変数名など、予約語ではないもの。
	STRING = "STRING"
	IDENT  = "IDENT"
	TEXT   = "TEXT"

	LBRACKET = "["
	RBRACKET = "]"
	COMMA    = ","
	EQUAL    = "="

	CMD_FLUSH         = "p"
	CMD_LINE_END_WAIT = "l"
	CMD_IMAGE         = "image"
	CMD_WAIT          = "wait"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeBg

type ChangeBg struct {
	Source string
}

func (*ChangeBg) PreHook

func (c *ChangeBg) PreHook()

func (*ChangeBg) Run

func (c *ChangeBg) Run(q *Queue)

type CmdExpression

type CmdExpression struct {
	Token      Token // '['トークン
	Expression Expression
	Cmd        Event
}

func (*CmdExpression) String

func (ie *CmdExpression) String() string

func (*CmdExpression) TokenLiteral

func (ie *CmdExpression) TokenLiteral() string

type Evaluator

type Evaluator struct {
	Events []Event
}

func NewEvaluator added in v1.16.0

func NewEvaluator(node Node) *Evaluator

func (*Evaluator) Eval

func (e *Evaluator) Eval(node Node) Event

type Event

type Event interface {
	PreHook()
	Run(*Queue)
}

type Expression

type Expression interface {
	Node
	// contains filtered or unexported methods
}

type ExpressionStatement

type ExpressionStatement struct {
	Token      Token      // 式の最初のトークン
	Expression Expression // 式を保持
}

func (*ExpressionStatement) String

func (es *ExpressionStatement) String() string

func (*ExpressionStatement) TokenLiteral

func (es *ExpressionStatement) TokenLiteral() string

type FunctionLiteral

type FunctionLiteral struct {
	Token      Token
	FuncName   Identifier
	Parameters NamedParams
}

func (*FunctionLiteral) String

func (fl *FunctionLiteral) String() string

func (*FunctionLiteral) TokenLiteral

func (fl *FunctionLiteral) TokenLiteral() string

type Identifier

type Identifier struct {
	Token Token // token.IDENT トークン
	Value string
}

func (*Identifier) String

func (i *Identifier) String() string

func (*Identifier) TokenLiteral

func (i *Identifier) TokenLiteral() string

type Lexer

type Lexer struct {
	OnIdent bool
	// contains filtered or unexported fields
}

func NewLexer

func NewLexer(input string) *Lexer

func (*Lexer) NextToken

func (l *Lexer) NextToken() Token

現在の1文字を読みこんでトークンを返す

type NamedParams

type NamedParams struct {
	Map map[string]string
}

func (*NamedParams) String

func (n *NamedParams) String() string

type Node

type Node interface {
	TokenLiteral() string
	String() string
}

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser(l *Lexer) *Parser

字句解析器を受け取って初期化する

func (*Parser) Errors

func (p *Parser) Errors() []string

エラーのアクセサ

func (*Parser) ParseProgram

func (p *Parser) ParseProgram() *Program

パースを開始する。トークンを1つずつ辿る

type Program

type Program struct {
	Statements []Statement
}

構文解析器が生成する全てのASTのルートノードになる

func (*Program) String

func (p *Program) String() string

インターフェースで定義されている関数の1つ 文字列表示してデバッグしやすいようにする

func (*Program) TokenLiteral

func (p *Program) TokenLiteral() string

インターフェースで定義されている関数の1つ

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue(events []Event) Queue

func NewQueueFromText added in v1.16.0

func NewQueueFromText(text string) Queue

func (*Queue) Display

func (q *Queue) Display() string

func (*Queue) Head

func (q *Queue) Head() Event

func (*Queue) Pop

func (q *Queue) Pop() QueueState

キューの先端を消して先に進める

func (*Queue) RunHead

func (q *Queue) RunHead() QueueState

キューの先端にあるイベントを実行する

func (*Queue) SetEvents

func (q *Queue) SetEvents(es []Event)

type QueueState

type QueueState string

type Statement

type Statement interface {
	Node
	// contains filtered or unexported methods
}

type TextLiteral

type TextLiteral struct {
	Token Token
	Value string
}

func (*TextLiteral) String

func (sl *TextLiteral) String() string

func (*TextLiteral) TokenLiteral

func (sl *TextLiteral) TokenLiteral() string

type Token

type Token struct {
	Type    TokenType
	Literal string
}

type TokenType

type TokenType string

func LookupIdent

func LookupIdent(ident string) TokenType

予約語の場合はその種類を、それ以外の場合はIDENTを返す

Jump to

Keyboard shortcuts

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