cmdutils

package
v0.624.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MatchSymbol = iota + 1
	MatchWord
	MatchLookahead
)
View Source
const (
	UpTo                 = 0
	BBApplication        = 1
	BBEndpointCollection = 2
	BBCommandLine        = 3
)

Variables

View Source
var (
	ItemReDefault    = regexp.MustCompile(`((?:[^%]|%[^(\n]|\n)*?)($|%\()`)
	ItemReStatement  = regexp.MustCompile(`((?:[^%]|%[^(\n]|\n)*?)($|[|)]|%\()`)
	ItemReEnd        = regexp.MustCompile(`((?:[^%]|%[^(\n]|\n)*?)($|\)|%\()`)
	ItemReVarStart   = regexp.MustCompile(`^%\(`)
	ItemReVar        = regexp.MustCompile(`^(@?\w+)`)
	ItemReCondOper   = regexp.MustCompile(`^[!=]=`)
	ItemReSearch     = regexp.MustCompile(`^~/([^/]+)/`)
	ItemReCondVal    = regexp.MustCompile(`^\'([\w ]+)\'`)
	ItemReStmtOper   = regexp.MustCompile(`^[=?]`)
	ItemReNoStmtOper = regexp.MustCompile(`^\|`)
	ItemReStmtEnd    = regexp.MustCompile(`^\)`)
)
View Source
var (
	IsoCtrlRE                = regexp.MustCompile("^iso_ctrl_(.*)_txt$")
	ReturnTypeValueSpliterRE = regexp.MustCompile(`\s*<:\s*`)
	TypeSetOfRE              = regexp.MustCompile(`set\s+of\s+(.+)$`)
	TypeOneOfRE              = regexp.MustCompile(`one\s+of\s*{(.+)}$`)
	TypeListSpliterRE        = regexp.MustCompile(`\s*,\s*`)
	EndpointLabelReplaceRE   = regexp.MustCompile(`^.*? -> `)
	EndpointParserRE         = regexp.MustCompile(
		`(?P<appname>.*?)\s*<-\s*(?P<epname>.*?)(?:\s*\[upto\s+(?P<upto>.*)\])*$`)
)

Functions

func FormatArgs

func FormatArgs(s *sysl.Module, appName, parameterTypeName string) string

func FormatReturnParam

func FormatReturnParam(s *sysl.Module, payload string) []string

func GetAndFmtParam

func GetAndFmtParam(s *sysl.Module, params []*sysl.Param) []string

func GetApplicationAttrs

func GetApplicationAttrs(m *sysl.Module, appName string) map[string]*sysl.Attribute

func GetReturnPayload

func GetReturnPayload(stmts []*sysl.Statement) string

func GetSortedISOCtrlSlice

func GetSortedISOCtrlSlice(attrs map[string]*sysl.Attribute) []string

func GetSortedISOCtrlStr

func GetSortedISOCtrlStr(attrs map[string]*sysl.Attribute) string

func MergeAttributes

func MergeAttributes(app, edpnt map[string]*sysl.Attribute) map[string]*sysl.Attribute

func MergeAttributesMap

func MergeAttributesMap(val map[string]string, attrs map[string]*sysl.Attribute)

func NormalizeEndpointName

func NormalizeEndpointName(endpointName string) string

func ParseBlackBoxesFromArgument

func ParseBlackBoxesFromArgument(blackboxFlags map[string]string) [][]string

func RemovePercentSymbol

func RemovePercentSymbol(src string) string

func TransformBlackBoxes

func TransformBlackBoxes(blackboxes []*sysl.Attribute) [][]string

func TransformBlackboxesToUptos

func TransformBlackboxesToUptos(m map[string]*Upto, bbs [][]string, uptoType UptoType)

Types

type Agent

type Agent struct {
	Category int
	Name     string
}

func MakeAgent

func MakeAgent(attrs map[string]*sysl.Attribute) Agent

type AppLabeler

type AppLabeler interface {
	LabelApp(appName, controls string, attrs map[string]*sysl.Attribute) string
}

type ClassLabeler

type ClassLabeler interface {
	LabelClass(className string) string
}

type CmdContextParamCodegen

type CmdContextParamCodegen struct {
	RootTransform    string
	Transform        string
	Grammar          string
	Start            string
	DepPath          string
	BasePath         string
	DisableValidator bool
}

type CmdContextParamDatagen

type CmdContextParamDatagen struct {
	Title       string
	Output      string
	Project     string
	Direct      bool
	Filter      string
	ClassFormat string
}

type CmdContextParamIntgen

type CmdContextParamIntgen struct {
	Title     string
	Output    string
	Project   string
	Filter    string
	Exclude   []string
	Clustered bool
	EPA       bool
}

type CmdContextParamSeqgen

type CmdContextParamSeqgen struct {
	EndpointFormat string
	AppFormat      string
	Title          string
	Output         string
	EndpointsFlag  []string
	AppsFlag       []string
	BlackboxesFlag map[string]string
	Blackboxes     [][]string
	Group          string
}

type CmdDatabaseScriptParams

type CmdDatabaseScriptParams struct {
	Title     string
	OutputDir string
	AppNames  string
	DBType    string
}

type Command

type Command interface {
	Configure(*kingpin.Application) *kingpin.CmdClause
	Execute(ExecuteArgs) error
	Name() string
	MaxSyslModule() int
}

type DiagramCmd added in v0.77.0

type DiagramCmd struct {
	AppName            string
	Endpoint           string
	Output             string
	IntegrationDiagram bool
	SequenceDiagram    bool
	EndpointAnalysis   bool
	DataDiagram        bool
}

type Element

type Element interface {
	Accept(Visitor) error
}

type EndpointCollectionElement

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

func MakeEndpointCollectionElement

func MakeEndpointCollectionElement(
	title string,
	endpoints []string,
	blackboxes map[string]*Upto,
) *EndpointCollectionElement

func (*EndpointCollectionElement) Accept

type EndpointElement

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

func (*EndpointElement) Accept

func (e *EndpointElement) Accept(v Visitor) error

type EndpointLabeler

type EndpointLabeler interface {
	LabelEndpoint(*EndpointLabelerParam) string
}

type EndpointLabelerParam

type EndpointLabelerParam struct {
	EndpointName string
	Human        string
	HumanSender  string
	NeedsInt     string
	Args         string
	Patterns     string
	Controls     string
	Attrs        map[string]*sysl.Attribute
}

type ExecuteArgs

type ExecuteArgs struct {
	Command        string
	Modules        []*sysl.Module
	Filesystem     afero.Fs
	Logger         *logrus.Logger
	DefaultAppName string
	ModulePaths    []string
	Root           string
	Stdin          io.Reader
}

type FormatParser

type FormatParser struct {
	Self   string
	CurPos int
	Stk    []string
	Result string
	Oper   string
}

func MakeFormatParser

func MakeFormatParser(fmtStr string) *FormatParser

func (*FormatParser) Clear

func (fp *FormatParser) Clear()

func (*FormatParser) Eat

func (fp *FormatParser) Eat(re *regexp.Regexp) bool

func (*FormatParser) Expansions

func (fp *FormatParser) Expansions(re *regexp.Regexp, attrs map[string]string)

func (*FormatParser) FmtOutput

func (fp *FormatParser) FmtOutput(appname, epname, eplongname string, attrs map[string]*sysl.Attribute) string

func (*FormatParser) FmtSeq

func (fp *FormatParser) FmtSeq(epname, eplongname string, attrs map[string]*sysl.Attribute) string

func (*FormatParser) LabelApp

func (fp *FormatParser) LabelApp(appname, controls string, attrs map[string]*sysl.Attribute) string

func (*FormatParser) LabelClass

func (fp *FormatParser) LabelClass(classname string) string

func (*FormatParser) LabelEndpoint

func (fp *FormatParser) LabelEndpoint(p *EndpointLabelerParam) string

func (*FormatParser) Parse

func (fp *FormatParser) Parse(attrs map[string]string) string

func (*FormatParser) Pop

func (fp *FormatParser) Pop() string

type Labeler

type Labeler struct{}

func (*Labeler) LabelApp

func (l *Labeler) LabelApp(appName, controls string, attrs map[string]*sysl.Attribute) string

func (*Labeler) LabelEndpoint

func (l *Labeler) LabelEndpoint(p *EndpointLabelerParam) string

type SequenceDiagramVisitor

type SequenceDiagramVisitor struct {
	AppLabeler
	EndpointLabeler

	Groupboxes map[string]syslutil.StrSet
	// contains filtered or unexported fields
}

func MakeSequenceDiagramVisitor

func MakeSequenceDiagramVisitor(
	a AppLabeler,
	e EndpointLabeler,
	w *SequenceDiagramWriter,
	m *sysl.Module,
	appName string,
	group string,
	logger *logrus.Logger,
) *SequenceDiagramVisitor

func (*SequenceDiagramVisitor) UniqueVarForAppName

func (v *SequenceDiagramVisitor) UniqueVarForAppName(appName string) string

func (*SequenceDiagramVisitor) Visit

func (v *SequenceDiagramVisitor) Visit(e Element) error

type SequenceDiagramWriter

type SequenceDiagramWriter struct {
	Ind            int
	AtBeginOfLine  bool
	AutogenWarning bool
	Active         map[string]int
	Properties     []string
	Head           bytes.Buffer
	Body           bytes.Buffer
}

func MakeSequenceDiagramWriter

func MakeSequenceDiagramWriter(autogenWarning bool, properties ...string) *SequenceDiagramWriter

func (*SequenceDiagramWriter) Activate

func (s *SequenceDiagramWriter) Activate(agent string)

func (*SequenceDiagramWriter) Activated

func (s *SequenceDiagramWriter) Activated(agent string, suppressed bool) func()

func (*SequenceDiagramWriter) Deactivate

func (s *SequenceDiagramWriter) Deactivate(agent string)

func (*SequenceDiagramWriter) Indent

func (s *SequenceDiagramWriter) Indent()

func (*SequenceDiagramWriter) String

func (s *SequenceDiagramWriter) String() string

func (*SequenceDiagramWriter) Unindent

func (s *SequenceDiagramWriter) Unindent()

func (*SequenceDiagramWriter) Write

func (s *SequenceDiagramWriter) Write(p []byte) (n int, err error)

func (*SequenceDiagramWriter) WriteByte

func (s *SequenceDiagramWriter) WriteByte(c byte) error

func (*SequenceDiagramWriter) WriteHead

func (s *SequenceDiagramWriter) WriteHead(v string) (int, error)

func (*SequenceDiagramWriter) WriteIndent

func (s *SequenceDiagramWriter) WriteIndent()

func (*SequenceDiagramWriter) WriteString

func (s *SequenceDiagramWriter) WriteString(v string) (n int, err error)

func (*SequenceDiagramWriter) WriteTo

func (s *SequenceDiagramWriter) WriteTo(w io.Writer) (n int64, err error)

type StatementElement

type StatementElement struct {
	EndpointElement
	// contains filtered or unexported fields
}

func (*StatementElement) Accept

func (e *StatementElement) Accept(v Visitor) error

type Upto

type Upto struct {
	VisitCount int
	Comment    string
	ValueType  UptoType
}

type UptoType

type UptoType int

type Var

type Var struct {
	Agent
	Order int
	Label string
	Alias string
}

func (Var) String

func (s Var) String() string

type VarManager

type VarManager interface {
	UniqueVarForAppName(appName string) string
}

type Visitor

type Visitor interface {
	Visit(Element) error
}

Jump to

Keyboard shortcuts

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