grammar

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	Pos lexer.Position

	Elements []*Value `"[" ( @@ ( ","? @@ )* )? "]"`
}

type Entry

type Entry struct {
	Pos lexer.Position

	Package string  `"pkg" @Ident`
	Option  *Option `|@@`
	Type    *Type   `|@@`
	Node    *Node   `|@@`
	Impl    *Impl   `|@@`
}

type Field

type Field struct {
	Pos lexer.Position

	Name     string    `(@Ident":"`
	Repeated bool      `(@"~")?`
	Type     *ItemType `@@)`
}

type FieldImplEntry

type FieldImplEntry struct {
	Pos lexer.Position

	Name  string `(@Ident":"`
	Value string `@String)`
}

type Impl

type Impl struct {
	Pos lexer.Position

	Name     string       `"impl" @Ident`
	Input    *ItemType    `"(" @@ ")"`
	Repeated bool         `@"~"?`
	Output   *ItemType    `@@?`
	Entry    []*ImplEntry `"{" @@* "}"`
}

type ImplEntry

type ImplEntry struct {
	Pos lexer.Position

	Name  string `(@Ident":"`
	Value string `@String)`
}

type ItemType

type ItemType struct {
	Pos lexer.Position

	Scalar    Scalar   `  @@`
	Map       *MapType `| @@`
	Reference string   `| @(Ident ( "." Ident )*)`
}

type Juaz

type Juaz struct {
	Pos     lexer.Position
	Entries []*Entry `(@@*)*`
}

type Map

type Map struct {
	Pos lexer.Position

	Entries []*MapEntry `"{" ( @@ ( ( "," )? @@ )* )? "}"`
}

type MapEntry

type MapEntry struct {
	Pos lexer.Position

	Key   *Value `@@`
	Value *Value `":"? @@`
}

type MapType

type MapType struct {
	Pos lexer.Position

	Key   *ItemType `"map" "[" @@`
	Value *ItemType `"]" @@`
}

type ModelEntry

type ModelEntry struct {
	Pos lexer.Position

	Field *Field ` ( @@ )`
}

type Node

type Node struct {
	Pos lexer.Position

	Name    string        `"node" @Ident`
	Entries []*ModelEntry `"{" @@* "}"`
}

type Option

type Option struct {
	Pos lexer.Position

	Name  string `"option" (@Ident `
	Value string `@String)`
}

type Scalar

type Scalar int
const (
	None Scalar = iota
	Float32
	Float64
	Int
	Int32
	Int64
	Uint32
	Uint64
	Bool
	String
	Byte
	Time
)

func (Scalar) GoString

func (s Scalar) GoString() string

func (*Scalar) Parse

func (s *Scalar) Parse(lex *lexer.PeekingLexer) error

type Type

type Type struct {
	Pos lexer.Position

	Name   *string      `"type" @Ident`
	Values []*TypeEntry `"{" ( @@ ( ";" )* )* "}"`
}

type TypeEntry

type TypeEntry struct {
	Pos lexer.Position

	Value *TypeValue `  @@`
}

type TypeValue

type TypeValue struct {
	Pos lexer.Position

	Key string `@Ident`
}

type Value

type Value struct {
	Pos lexer.Position

	String    *string  `  @String`
	Number    *float64 `| @Float`
	Int       *int64   `| @Int`
	Bool      *bool    `| (@"true" | "false")`
	Reference *string  `| @Ident @( "." Ident )*`
	Map       *Map     `| @@`
	Array     *Array   `| @@`
}

Jump to

Keyboard shortcuts

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