saiast

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package saiast contains information parsed from AST of the SAI header.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TrimSAIName

func TrimSAIName(name string, makeCamel, makeUpper bool) string

TrimSAIName trims sai_ prefix and _t from the string

Types

type FuncMetadata

type FuncMetadata struct {
	// Name is the name of the function: create_acl_table
	Name string
	// Operation is the action to take: create
	Operation string
	// TypeName is the name of the type: acl_table
	TypeName string
	// Entry is the name of the entry using the instead of id.
	Entry string
	// IsSwitchScoped is whether the API take a switch id as a parameter.
	IsSwitchScoped bool
}

FuncMetadata contains additional information derived from a func definition.

type SAIAPI

type SAIAPI struct {
	Ifaces []*SAIInterface
	Funcs  map[string]*SAIFunc
}

SAIAPI contains the information retreived from the AST.

func Get

func Get(ast *cc.AST) *SAIAPI

Get returns the information parses from the AST.

func (*SAIAPI) GetFuncMeta

func (sai *SAIAPI) GetFuncMeta(fn *TypeDecl) *FuncMetadata

GetFuncMeta returns the metadata for a SAI func.

type SAIFunc

type SAIFunc struct {
	Name       string
	ReturnType string
	Params     []TypeDecl
}

SAIFunc is a function definition.

type SAIInterface

type SAIInterface struct {
	Name  string
	Funcs []*TypeDecl
}

SAIInterface contains the functions contained in the interface.

type TypeDecl

type TypeDecl struct {
	Name string
	Typ  string
}

TypeDecl stores the name and type of a declation.

Jump to

Keyboard shortcuts

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