mucl

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package mucl provides a parser for the MuCL (Micro Configuration Language) protocol.

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Broker

type Broker struct {
	Pos  lexer.Position
	Name string `  "broker" @Ident`
}

type Definition

type Definition struct {
	Pos     lexer.Position
	Service *Service `@@`

	Entries []*Entry `( @@ ";"* )*`
}

func (*Definition) Enums

func (d *Definition) Enums() []*Enum

func (*Definition) Import

func (d *Definition) Import() string

func (*Definition) Messages

func (d *Definition) Messages() []*Message

func (*Definition) Servers

func (d *Definition) Servers() []*Endpoint

func (*Definition) ServiceName

func (d *Definition) ServiceName() string

type Endpoint

type Endpoint struct {
	Pos lexer.Position

	Name  string           `"endpoint" @Ident`
	Entry []*EndpointEntry `"{" ( @@ ";"? )* "}"`
}

func (*Endpoint) ClientFileName

func (m *Endpoint) ClientFileName() string

func (*Endpoint) ClientStructName

func (m *Endpoint) ClientStructName() string

func (*Endpoint) DirectoryName

func (m *Endpoint) DirectoryName() string

func (*Endpoint) FileName

func (m *Endpoint) FileName() string

func (*Endpoint) Methods

func (m *Endpoint) Methods() []*Method

type EndpointEntry

type EndpointEntry struct {
	Pos lexer.Position

	//	Option *Option `  "option" @@`
	Method *Method ` @@`
}

type Entry

type Entry struct {
	Pos lexer.Position

	Import   string    ` "import" @String`
	Message  *Message  `| @@`
	Endpoint *Endpoint `| @@`
	Enum     *Enum     `| @@`
	Option   *Option   `| "option" @@`
}

type Enum

type Enum struct {
	Pos lexer.Position

	Name   string       `"enum" @Ident`
	Values []*EnumEntry `"{" ( @@ ( ";" )* )* "}"`
}

func (*Enum) FileName

func (m *Enum) FileName() string

type EnumEntry

type EnumEntry struct {
	Pos lexer.Position

	Value  *EnumValue `  @@`
	Option *Option    `| "option" @@`
}

type EnumValue

type EnumValue struct {
	Pos lexer.Position

	Key   string `@Ident`
	Value int    `"=" @( [ "-" ] Int )`

	Options []*Option `( "[" @@ ( "," @@ )* "]" )?`
}

func (*EnumValue) ExportedName

func (m *EnumValue) ExportedName() string

type Field

type Field struct {
	Pos lexer.Position

	Optional bool `(   @"optional"`
	Required bool `  | @"required"`
	Repeated bool `  | @"repeated" )?`

	Name string `@Ident`
	Type *Type  `@@`

	Options []*Option `( "[" @@ ( "," @@ )* "]" )?`
}

func (*Field) ExportedName

func (f *Field) ExportedName() string

type MServer

type MServer struct {
	Pos  lexer.Position
	Name string `  "server" @Ident`
}

type MapType

type MapType struct {
	Pos lexer.Position

	Key   *Type `"map" "<" @@`
	Value *Type `"," @@ ">"`
}

type Message

type Message struct {
	Pos lexer.Position

	Name    string          `"type" @Ident`
	Entries []*MessageEntry `"{" @@* "}"`
}

func (*Message) Enums

func (m *Message) Enums() []*Enum

func (*Message) Fields

func (m *Message) Fields() []*Field

func (*Message) FileName

func (m *Message) FileName() string

func (*Message) Messages

func (m *Message) Messages() []*Message

func (*Message) Options

func (m *Message) Options() []*Option

type MessageEntry

type MessageEntry struct {
	Pos lexer.Position

	Enum    *Enum    `( @@`
	Option  *Option  ` | "option" @@`
	Message *Message ` | @@`
	Field   *Field   ` | @@ ) ";"*`
}

type Method

type Method struct {
	Pos lexer.Position

	Name              string `"rpc" @Ident`
	StreamingRequest  bool   `"(" @"stream"?`
	Request           *Type  `    @@ ")"`
	StreamingResponse bool   `"returns" "(" @"stream"?`
	Response          *Type  `              @@ ")"`
}

func (*Method) FileName

func (m *Method) FileName() string

type Option

type Option struct {
	Pos lexer.Position

	Name  string  `( "(" @Ident @( "." Ident )* ")" | @Ident @( "." @Ident )* )`
	Attr  *string `( "." @Ident ( "." @Ident )* )?`
	Value *Value  `"=" @@`
}

type Protocol

type Protocol struct {
	Pos  lexer.Position
	Name string `  "protocol" @Ident`
}

type Registry

type Registry struct {
	Pos  lexer.Position
	Name string `  "registry" @Ident`
}

type Scalar

type Scalar int
const (
	None Scalar = iota
	Double
	Float
	Int32
	Int64
	Uint32
	Uint64
	Sint32
	Sint64
	Fixed32
	Fixed64
	SFixed32
	SFixed64
	Bool
	String
	Bytes
)

func (Scalar) GoString

func (s Scalar) GoString() string

func (*Scalar) Parse

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

type Service

type Service struct {
	Pos lexer.Position

	Name    string          `"service" @Ident`
	Entries []*ServiceEntry `"{" @@* "}"`
}

func (*Service) Broker

func (s *Service) Broker() string

func (*Service) Protocol

func (s *Service) Protocol() string

func (*Service) Registry

func (s *Service) Registry() string

func (*Service) Server

func (s *Service) Server() string

func (*Service) Transport

func (s *Service) Transport() string

type ServiceEntry

type ServiceEntry struct {
	Pos lexer.Position

	Broker    *Broker    `( @@`
	Protocol  *Protocol  ` | @@`
	Registry  *Registry  ` | @@`
	Server    *MServer   ` | @@`
	Transport *Transport ` | @@ ) ";"*`
}

type Transport

type Transport struct {
	Pos  lexer.Position
	Name string `  "transport" @Ident`
}

type Type

type Type struct {
	Pos lexer.Position

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

func (*Type) String

func (t *Type) String() string

type Value

type Value struct {
	Pos lexer.Position

	String *string  `  @String`
	Number *float64 `| @Float`
	Int    *int64   `| @Int`
	Bool   *bool    `| (@"true" | "false")`
}

Jump to

Keyboard shortcuts

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