ast

package
v0.0.0-...-b90f4af Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package ast declares the types used to represent syntax trees for Netspoc files.

Sort list elements of AST before printing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OrderElements

func OrderElements(l []Element)

Types

type AggAuto

type AggAuto struct {
	SimpleAuto
	Net string
}

func (*AggAuto) String

func (a *AggAuto) String() string

type Area

type Area struct {
	TopStruct
	Border          *NamedUnion
	InclusiveBorder *NamedUnion
}

type Attribute

type Attribute struct {
	Base
	Name string
	// Only one of those fields may be filled.
	ValueList    []*Value
	ComplexValue []*Attribute
}

func CreateAttr

func CreateAttr(name string, l []string) *Attribute

func CreateAttr1

func CreateAttr1(k, v string) *Attribute

func (*Attribute) Change

func (obj *Attribute) Change(name, value string)

func (*Attribute) GetAttr

func (obj *Attribute) GetAttr(name string) *Attribute

func (*Attribute) Order

func (a *Attribute) Order()

func (*Attribute) Remove

func (obj *Attribute) Remove(name string)

func (*Attribute) Replace

func (obj *Attribute) Replace(attr *Attribute)

type AutoElem

type AutoElem interface {
	GetType() string
	GetElements() []Element
	SetElements([]Element)
}

type Base

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

func (*Base) Order

func (a *Base) Order()

func (*Base) PostComment

func (a *Base) PostComment() string

func (*Base) PreComment

func (a *Base) PreComment() string

func (*Base) SetPostComment

func (a *Base) SetPostComment(c string)

func (*Base) SetPreComment

func (a *Base) SetPreComment(c string)

type Complement

type Complement struct {
	Base
	Element Element
}

func (*Complement) GetType

func (a *Complement) GetType() string

func (*Complement) Order

func (a *Complement) Order()

func (*Complement) String

func (a *Complement) String() string

type Description

type Description struct {
	Base
	Text string
}

type Element

type Element interface {
	Node
	GetType() string
	String() string
}

type File

type File struct {
	Nodes     []Toplevel
	BottomCmt string
}

type Intersection

type Intersection struct {
	Base
	Elements []Element
}

func (*Intersection) GetType

func (a *Intersection) GetType() string

func (*Intersection) Order

func (a *Intersection) Order()

func (*Intersection) String

func (a *Intersection) String() string

type IntfAuto

type IntfAuto struct {
	SimpleAuto
	Managed  bool
	Selector string
}

func (*IntfAuto) String

func (a *IntfAuto) String() string

type IntfRef

type IntfRef struct {
	TypedElt
	Router    string
	Network   string
	Extension string
}

func (*IntfRef) GetName

func (a *IntfRef) GetName() string

func (*IntfRef) String

func (a *IntfRef) String() string

type NamedElem

type NamedElem interface {
	GetType() string
	GetName() string
}

type NamedRef

type NamedRef struct {
	TypedElt
	Name string
}

func (*NamedRef) GetName

func (a *NamedRef) GetName() string

func (*NamedRef) String

func (a *NamedRef) String() string

type NamedUnion

type NamedUnion struct {
	Base
	Name     string
	Elements []Element
}

func (*NamedUnion) Order

func (a *NamedUnion) Order()

type Network

type Network struct {
	TopStruct
	Hosts []*Attribute
}

func (*Network) Order

func (a *Network) Order()

type Node

type Node interface {
	PreComment() string  // Comment in line(s) before node, if available.
	PostComment() string // Trailing comment, if available.
	SetPreComment(string)
	SetPostComment(string)
	Order()
}

type Protocol

type Protocol struct {
	TopBase
	Value string
}

type Protocolgroup

type Protocolgroup struct {
	TopBase
	ValueList []*Value
}

func (*Protocolgroup) Order

func (a *Protocolgroup) Order()

type Router

type Router struct {
	TopStruct
	Interfaces []*Attribute
}

func (*Router) Order

func (a *Router) Order()

Only sort successive vip interfaces.

type Rule

type Rule struct {
	Base
	Deny bool
	Src  *NamedUnion
	Dst  *NamedUnion
	Prt  *Attribute
	Log  *Attribute
}

func (*Rule) Order

func (a *Rule) Order()

type Service

type Service struct {
	TopStruct
	User    *NamedUnion
	Foreach bool
	Rules   []*Rule
}

func (*Service) Order

func (a *Service) Order()

type SimpleAuto

type SimpleAuto struct {
	TypedElt
	Elements []Element
}

func (*SimpleAuto) GetElements

func (a *SimpleAuto) GetElements() []Element

func (*SimpleAuto) Order

func (a *SimpleAuto) Order()

func (*SimpleAuto) SetElements

func (a *SimpleAuto) SetElements(l []Element)

func (*SimpleAuto) String

func (a *SimpleAuto) String() string

type TopBase

type TopBase struct {
	Base
	Name        string
	Description *Description

	IPV6 bool
	// contains filtered or unexported fields
}

func (*TopBase) FileName

func (a *TopBase) FileName() string

func (*TopBase) GetDescription

func (a *TopBase) GetDescription() *Description

func (*TopBase) GetIPV6

func (a *TopBase) GetIPV6() bool

func (*TopBase) GetName

func (a *TopBase) GetName() string

func (*TopBase) SetFileName

func (a *TopBase) SetFileName(n string)

func (*TopBase) SetIPV6

func (a *TopBase) SetIPV6()

func (*TopBase) SetName

func (a *TopBase) SetName(n string)

type TopList

type TopList struct {
	TopBase
	Elements []Element
}

func (*TopList) Order

func (a *TopList) Order()

type TopStruct

type TopStruct struct {
	TopBase
	Attributes []*Attribute
}

func (*TopStruct) GetAttr

func (n *TopStruct) GetAttr(name string) *Attribute

func (*TopStruct) GetAttr1

func (n *TopStruct) GetAttr1(name string) string

func (*TopStruct) Order

func (a *TopStruct) Order()

func (*TopStruct) RemoveAttr

func (obj *TopStruct) RemoveAttr(name string)

type Toplevel

type Toplevel interface {
	Node
	GetName() string
	SetName(string)
	GetDescription() *Description
	FileName() string
	SetFileName(string)
	GetIPV6() bool
	SetIPV6()
}

type ToplevelWithAttr

type ToplevelWithAttr interface {
	Toplevel
	GetAttr(string) *Attribute
	RemoveAttr(string)
}

type TypedElt

type TypedElt struct {
	Base
	Type string
}

func (*TypedElt) GetType

func (a *TypedElt) GetType() string

type User

type User struct {
	Base
}

func (*User) GetType

func (a *User) GetType() string

func (*User) String

func (a *User) String() string

type Value

type Value struct {
	Base
	Value string
}

Jump to

Keyboard shortcuts

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