ast

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package ast defines the Abstract Syntax Tree node types for ClassAds expressions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeAssignment

type AttributeAssignment struct {
	Name  string
	Value Expr
}

AttributeAssignment represents an attribute assignment (name = expr).

func (*AttributeAssignment) String

func (a *AttributeAssignment) String() string

type AttributeReference

type AttributeReference struct {
	Name  string
	Scope AttributeScope
}

AttributeReference represents a reference to an attribute by name.

func (*AttributeReference) String

func (a *AttributeReference) String() string

type AttributeScope

type AttributeScope int

AttributeScope represents the scope of an attribute reference.

const (
	// NoScope represents an unscoped attribute reference
	NoScope AttributeScope = iota
	// MyScope represents MY.attr (current ClassAd)
	MyScope
	// TargetScope represents TARGET.attr (target ClassAd in matching)
	TargetScope
	// ParentScope represents PARENT.attr (parent ClassAd)
	ParentScope
)

type BinaryOp

type BinaryOp struct {
	Op    string
	Left  Expr
	Right Expr
}

BinaryOp represents a binary operation (e.g., +, -, *, /, &&, ||, ==, etc.).

func (*BinaryOp) String

func (b *BinaryOp) String() string

type BooleanLiteral

type BooleanLiteral struct {
	Value bool
}

BooleanLiteral represents a boolean constant (true or false).

func (*BooleanLiteral) String

func (b *BooleanLiteral) String() string

type ClassAd

type ClassAd struct {
	Attributes []*AttributeAssignment
}

ClassAd represents a complete ClassAd (a record of attribute assignments).

func (*ClassAd) String

func (c *ClassAd) String() string

type ConditionalExpr

type ConditionalExpr struct {
	Condition Expr
	TrueExpr  Expr
	FalseExpr Expr
}

ConditionalExpr represents a ternary conditional expression (cond ? true_expr : false_expr).

func (*ConditionalExpr) String

func (c *ConditionalExpr) String() string

type ElvisExpr

type ElvisExpr struct {
	Left  Expr // The expression to test for undefined
	Right Expr // The fallback expression if Left is undefined
}

ElvisExpr represents the Elvis operator (expr1 ?: expr2). If expr1 evaluates to undefined, returns expr2; otherwise returns expr1.

func (*ElvisExpr) String

func (e *ElvisExpr) String() string

type ErrorLiteral

type ErrorLiteral struct{}

ErrorLiteral represents an error value.

func (*ErrorLiteral) String

func (e *ErrorLiteral) String() string

type Expr

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

Expr represents a ClassAd expression.

type FunctionCall

type FunctionCall struct {
	Name string
	Args []Expr
}

FunctionCall represents a function call with arguments.

func (*FunctionCall) String

func (f *FunctionCall) String() string

type IntegerLiteral

type IntegerLiteral struct {
	Value int64
}

IntegerLiteral represents an integer constant.

func (*IntegerLiteral) String

func (i *IntegerLiteral) String() string

type ListLiteral

type ListLiteral struct {
	Elements []Expr
}

ListLiteral represents a list of expressions.

func (*ListLiteral) String

func (l *ListLiteral) String() string

type Node

type Node interface {
	String() string
}

Node is the base interface for all AST nodes.

type RealLiteral

type RealLiteral struct {
	Value float64
}

RealLiteral represents a floating-point constant.

func (*RealLiteral) String

func (r *RealLiteral) String() string

type RecordLiteral

type RecordLiteral struct {
	ClassAd *ClassAd
}

RecordLiteral represents a record (nested ClassAd).

func (*RecordLiteral) String

func (r *RecordLiteral) String() string

type SelectExpr

type SelectExpr struct {
	Record Expr
	Attr   string
}

SelectExpr represents attribute selection (expr.attr).

func (*SelectExpr) String

func (s *SelectExpr) String() string

type StringLiteral

type StringLiteral struct {
	Value string
}

StringLiteral represents a string constant.

func (*StringLiteral) String

func (s *StringLiteral) String() string

type SubscriptExpr

type SubscriptExpr struct {
	Container Expr
	Index     Expr
}

SubscriptExpr represents list/record subscripting (expr[index]).

func (*SubscriptExpr) String

func (s *SubscriptExpr) String() string

type UnaryOp

type UnaryOp struct {
	Op   string
	Expr Expr
}

UnaryOp represents a unary operation (e.g., -, !, ~).

func (*UnaryOp) String

func (u *UnaryOp) String() string

type UndefinedLiteral

type UndefinedLiteral struct{}

UndefinedLiteral represents an undefined value.

func (*UndefinedLiteral) String

func (u *UndefinedLiteral) String() string

Jump to

Keyboard shortcuts

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