macros

package
v0.0.9-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const LurkFileExtension = ".lurk"

Variables

View Source
var ErrCircularImports = errors.New("circular imports")

Functions

func IsValidLurk

func IsValidLurk(s string) bool

Types

type Macro

type Macro string
const (
	Def      Macro = "def"
	Defrec   Macro = "defrec"
	Defun    Macro = "defun"
	List     Macro = "list"
	Param    Macro = "param"
	Assert   Macro = "assert"
	AssertEq Macro = "assert-eq"
	Import   Macro = "import"
)

func IsMacro

func IsMacro(s string) (Macro, bool)

func (Macro) Expand

func (m Macro) Expand(program string) string

func (Macro) IsNested

func (m Macro) IsNested() bool

func (Macro) String

func (m Macro) String() string

type MacroPreprocessor

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

func NewMacroPreprocessor

func NewMacroPreprocessor(opts ...Option) (*MacroPreprocessor, error)

func (*MacroPreprocessor) Preprocess

func (p *MacroPreprocessor) Preprocess(lurkProgram string) (string, error)

type Option

type Option func(cfg *config) error

Option is configuration option function for the MacroPreprocessor

func DependencyDir

func DependencyDir(depDir string) Option

DependencyDir sets the dependency directory that is used to look up imported modules.

func RemoveComments

func RemoveComments() Option

func WithStandardLib

func WithStandardLib() Option

WithStandardLib creates an embedded dependency directory containing only the standard library. This is not compatible with DependencyDir.

type Parser

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

func NewParser

func NewParser(input string) *Parser

func (*Parser) Consume

func (p *Parser) Consume() byte

func (*Parser) ParseSExpr

func (p *Parser) ParseSExpr() string

func (*Parser) Peek

func (p *Parser) Peek() byte

func (*Parser) ReadUntil

func (p *Parser) ReadUntil(c byte) string

Jump to

Keyboard shortcuts

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