jabl

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Code generated by goyacc -l -o parser.go jabl.y. DO NOT EDIT.

Index

Constants

View Source
const BOOLEAN = 57367
View Source
const CHOICE = 57353
View Source
const CMP_AND = 57361
View Source
const CMP_EQ = 57359
View Source
const CMP_GT = 57356
View Source
const CMP_GTE = 57358
View Source
const CMP_LT = 57355
View Source
const CMP_LTE = 57357
View Source
const CMP_NEQ = 57360
View Source
const CMP_NOT = 57363
View Source
const CMP_OR = 57362
View Source
const DICE = 57366
View Source
const ELSE = 57349
View Source
const END = 57347
View Source
const EOF = 0

The parser expects the lexer to return 0 on EOF. Give it a name for clarity.

View Source
const GET = 57350
View Source
const GOTO = 57354
View Source
const IF = 57348
View Source
const NUMBER = 57365
View Source
const PRINT = 57352
View Source
const SET = 57351
View Source
const START = 57346
View Source
const STRING = 57364

Variables

This section is empty.

Functions

This section is empty.

Types

type Character

type Character struct {
	Name string
}

type Choice

type Choice struct {
	Text string `json:"text"`
	Code string `json:"code"`
}

type Interpreter

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

func NewInterpreter

func NewInterpreter(loader SectionLoader, options ...InterpreterOption) *Interpreter

func (*Interpreter) Evaluate

func (i *Interpreter) Evaluate(code string, state State, callback func(result *Result, err error))

func (*Interpreter) Execute

func (i *Interpreter) Execute(identifier SectionId, state State, callback func(result *Result, err error))

type InterpreterOption

type InterpreterOption func(*Interpreter)

func WithRandomNumberGenerator

func WithRandomNumberGenerator(rng RandomNumberGenerator) InterpreterOption

type RandomNumberGenerator

type RandomNumberGenerator interface {
	Float64() float64
}

type Result

type Result struct {
	Output     string    `json:"output"`
	Choices    []*Choice `json:"choices"`
	Transition SectionId `json:"transition"`
}

type SectionId

type SectionId string

type SectionLoader

type SectionLoader interface {
	LoadSection(identifier SectionId, onLoad func(code string, err error))
}

type State

type State interface {
	Get(key string) (float64, error)
	Set(key string, value float64) error
}

Jump to

Keyboard shortcuts

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