proc

package
v0.0.0-...-cced755 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NameValueMap

func NameValueMap(vs []*NameValue) map[string]ValueType

NameValueMap name:value map. NOTE: The same key pairs, later ones will override earlier ones.

Types

type Bool

type Bool struct {
	Value Boolean `parser:"@('true' | 'false')"`
}

func (Bool) Type

func (Bool) Type() string

type BoolList

type BoolList struct {
	Value []Boolean `parser:"'[' (@('true' | 'false') (',' @('true' | 'false'))*)? ']'"`
}

func (BoolList) Type

func (BoolList) Type() string

type Boolean

type Boolean bool

func (*Boolean) Capture

func (b *Boolean) Capture(values []string) error

type Derive

type Derive struct {
	Identity string       `parser:"@Ident"`
	Attrs    []*NameValue `parser:"('(' (@@ (',' @@)*)? ')')?"`
}

Derive an specified identity and it's attribute list. `#[ident]` `#[ident(k1=1,k2="2")]` `#[ident(k1=[1,2,3],k2=["1","2","3"])]`

func Match

func Match(s string) (*Derive, error)

Match 匹配注解 `#[ident]` `#[ident(k1=1,k2="2")]` `#[ident(k1=[1,2,3],k2=["1","2","3"])]`

func (*Derive) Attribute

func (d *Derive) Attribute() map[string]ValueType

Attribute attrs map NOTE: The same key pairs, later ones will override earlier ones.

func (*Derive) Headless

func (d *Derive) Headless() bool

`#[ident]` only, not contain any attributes.

type Derives

type Derives []*Derive

func (Derives) ContainHeadless

func (ds Derives) ContainHeadless(identity string) bool

ContainHeadless contain headless

func (Derives) Find

func (ds Derives) Find(identity string) Derives

func (Derives) FindValue

func (ds Derives) FindValue(identity, name string) []ValueType

type Float

type Float struct {
	Value float64 `parser:"@Float"`
}

func (Float) Type

func (Float) Type() string

type FloatList

type FloatList struct {
	Value []float64 `parser:"'[' (@Float (',' (@Float | @Int))*)? ']'"`
}

NOTE: FloatList float list. must be first is float.

func (FloatList) Type

func (FloatList) Type() string

type Integer

type Integer struct {
	Value int64 `parser:"@Int"`
}

func (Integer) Type

func (Integer) Type() string

type IntegerList

type IntegerList struct {
	Value []int64 `parser:"'[' (@Int (',' @Int)*)? ']'"`
}

func (IntegerList) Type

func (IntegerList) Type() string

type Map

type Map struct {
	Entries []*NameValue `parser:"'{' (@@ (',' @@)*)? '}'"`
}

func (*Map) EntryMap

func (d *Map) EntryMap() map[string]ValueType

EntryMap entry map NOTE: The same key pairs, later ones will override earlier ones.

func (Map) Type

func (Map) Type() string

type NameValue

type NameValue struct {
	// name
	Name string `parser:"@Ident '='"`
	// one of follow
	// String, Integer, Float, Bool,
	// StringList, IntegerList, FloatList, BoolList,
	Value ValueType `parser:"@@"`
}

NameValue like `#[ident(name=value]`

type Proc

type Proc struct {
	Derive Derive `parser:"'#' '[' @@ ']'"`
}

type String

type String struct {
	Value string `parser:"@String"`
}

func (String) Type

func (String) Type() string

type StringList

type StringList struct {
	Value []string `parser:"'[' (@String (',' @String)*)? ']'"`
}

func (StringList) Type

func (StringList) Type() string

type ValueType

type ValueType interface {
	Type() string
}

Jump to

Keyboard shortcuts

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