dsl

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LeftParen  = "("
	RightParen = ")"
	Colon      = ":"
	And        = "and"
	Or         = "or"
	Not        = "not"
	Identifier = "identifier"
	EOF        = "eof"
)

Variables

View Source
var AttrHashKey = []byte("attribute value hashing")

Functions

func Run

func Run(source string) (*tkn.Policy, error)

Types

type Ast

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

func (*Ast) RunPasses

func (t *Ast) RunPasses() (*tkn.Policy, error)

type Binary

type Binary struct {
	Left     Expr
	Operator Token
	Right    Expr
	Output   attr
}

Binary is used for And, Or

func (Binary) Accept

func (b Binary) Accept(visitor ExprVisitor)

type Expr

type Expr interface {
	Accept(ExprVisitor)
}

type ExprVisitor

type ExprVisitor interface {
	// contains filtered or unexported methods
}

type Grouping

type Grouping struct {
	Expr Expr
}

Grouping is used for LeftParen, RightParen

func (Grouping) Accept

func (g Grouping) Accept(visitor ExprVisitor)

type Interpreter

type Interpreter struct {
	Literal
}

func (*Interpreter) Evaluate

func (i *Interpreter) Evaluate(expr Expr) Literal

type Lexer

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

type Literal

type Literal struct {
	Key   attr
	Value attrValue
}

func (Literal) Accept

func (l Literal) Accept(visitor ExprVisitor)

type Parser

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

type Token

type Token struct {
	Type   string
	Lexeme string
	Line   int
}

type Unary

type Unary struct {
	Operator Token
	Right    Expr
}

Unary is used for Not

func (Unary) Accept

func (u Unary) Accept(visitor ExprVisitor)

Jump to

Keyboard shortcuts

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