models

package
v0.0.0-...-d92998c Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Debug

type Debug struct {
	// Line represents the line of the node
	Line int `yaml:"line"`
	// Column represents the column of the node
	Column int `yaml:"column"`
	// File represents the file of the node
	File string `yaml:"file"`
	// Near represents the code near the node
	Near string `yaml:"near,omitempty"`
}

type Node

type Node struct {
	// Type represents the type of the node
	Type tokens.TokenType `yaml:"type"`
	// VariableType represents the type of the variable
	VariableType tokens.VariableType `yaml:"variableType"`

	// Content represents the content of the node
	Content string `yaml:"content"`
	// Value represents the value of the node
	Value any `yaml:"value"`

	// Reference is a bool to determine if the node is a reference
	Reference bool `yaml:"reference"`
	// Children represents the children of the node
	Children []*Node `yaml:"children,omitempty"`
	// Args represents the arguments of the node
	Args []*Node `yaml:"args,omitempty"`
	// ObjectAccessors represents the object accessors of the node like x[0]
	ObjectAccessors []*Node `yaml:"objectAccessors,omitempty"`

	// Map is a key value store for the node
	Map map[string]any `yaml:"map,omitempty"`

	// Flags are custom operations for a node
	Flags []string `yaml:"flags,omitempty"`

	// Debug represents the debug information of the node
	Debug *Debug `yaml:"-"`
}

Node represents a node in the AST

func (*Node) Assign

func (n *Node) Assign(node *Node)

func (*Node) Copy

func (n *Node) Copy() *Node

func (*Node) String

func (n *Node) String() string

type Token

type Token struct {
	// TokenType is the type of the token
	Type tokens.TokenType `yaml:"type"`
	// Value is the value of the token
	Value string `yaml:"value"`

	// Map is a map of key value pairs
	Map map[string]any `yaml:"map,omitempty"`
	// Debug is a debug object
	Debug *Debug `yaml:"-"`
}

Token represents a token in the lexer

Jump to

Keyboard shortcuts

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