annotation

package
v0.12.10 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation

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

type Bool

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

func (Bool) Type added in v0.12.3

func (Bool) Type() string

type BoolList

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

func (BoolList) Type added in v0.12.3

func (BoolList) Type() string

type Boolean

type Boolean bool

func (*Boolean) Capture

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

type Derive added in v0.12.2

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) IsHeadless added in v0.12.2

func (d *Derive) IsHeadless() bool

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

type Derives added in v0.12.2

type Derives []*Derive

func (Derives) ContainHeadless added in v0.12.2

func (ds Derives) ContainHeadless(identity string) bool

ContainHeadless contain headless

func (Derives) Find added in v0.12.2

func (ds Derives) Find(identity string) Derives

func (Derives) FindValue added in v0.12.2

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

type Float

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

func (Float) Type added in v0.12.3

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 added in v0.12.3

func (FloatList) Type() string

type Integer

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

func (Integer) Type added in v0.12.3

func (Integer) Type() string

type IntegerList

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

func (IntegerList) Type added in v0.12.3

func (IntegerList) 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 String

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

func (String) Type added in v0.12.3

func (String) Type() string

type StringList

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

func (StringList) Type added in v0.12.3

func (StringList) Type() string

type ValueType added in v0.12.3

type ValueType interface {
	Type() string
}

Jump to

Keyboard shortcuts

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