annotation

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 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 {
	Identifier string       `parser:"'#' '[' @Ident"`
	Attrs      []*NameValue `parser:"('(' (@@ (',' @@)*)? ')')?"`
	Empty      struct{}     `parser:"']'"`
}

Annotation an specified identifier and it's attribute list. `#[ident]` `#[ident(k1=v1,k2=v2)]`

func Match

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

Match 匹配注解 `#[ident]` `#[ident(k1=v1,k2=v2)]`

func (*Annotation) IsHeadless

func (a *Annotation) IsHeadless() bool

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

type Annotations

type Annotations []*Annotation

func (Annotations) ContainHeadless

func (a Annotations) ContainHeadless(identifier string) bool

ContainHeadless contain headless

func (Annotations) Find

func (a Annotations) Find(identifier string) Annotations

func (Annotations) FindValue

func (a Annotations) FindValue(identifier, name string) []Value

type Bool

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

type BoolList

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

type Boolean

type Boolean bool

func (*Boolean) Capture

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

type Float

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

type FloatList

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

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

type Integer

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

type IntegerList

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

type NameValue

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

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

type String

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

type StringList

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

type Value

type Value interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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