parser

package
v0.0.0-...-3bea39f Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBoolOp

func ParseBoolOp(v Value) string

ParseBoolOp parses boolean operation from value

Types

type Command

type Command struct {
	Name string
	Args []Value
}

Command represents a parsed command

type Parser

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

Parser parses Forth-style commands

func NewParser

func NewParser(reader io.Reader) (*Parser, error)

NewParser creates a new parser

func (*Parser) ParseCommand

func (p *Parser) ParseCommand() (*Command, error)

ParseCommand parses the next command from input

func (*Parser) ReadAllCommands

func (p *Parser) ReadAllCommands() ([]*Command, error)

ReadAllCommands reads all commands from the parser

type Value

type Value struct {
	Type ValueType
	Str  string
	Int  int64
	Bool bool
}

Value represents a value on the stack

type ValueType

type ValueType int

ValueType represents the type of a value on the stack

const (
	TypeString ValueType = iota
	TypeInt
	TypeBool
)

Jump to

Keyboard shortcuts

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