ast

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AstTypeToDartType = map[Type]string{
	Uint64: "int",
	Uint32: "int",
	Uint16: "int",
	Uint8:  "int",
	Int64:  "int",
	Int32:  "int",
	Int16:  "int",
	Int8:   "int",
	Int:    "int",
	Byte:   "int",
	Bool:   "bool",
	String: "String",
}
View Source
var AstTypeToGoType = map[Type]string{
	Uint64: "uint64",
	Uint32: "uint32",
	Uint16: "uint16",
	Uint8:  "uint8",
	Int64:  "int64",
	Int32:  "int32",
	Int:    "int",
	Int16:  "int16",
	Int8:   "int8",
	Byte:   "byte",
	Bool:   "bool",
	String: "string",
	Object: "object",
}
View Source
var LexerTypeToAstType = map[string]Type{
	"uint64": Uint64,
	"uint32": Uint32,
	"uint16": Uint16,
	"uint8":  Uint8,
	"int64":  Int64,
	"int32":  Int32,
	"int16":  Int16,
	"int8":   Int8,
	"int":    Int,
	"byte":   Byte,
	"bool":   Bool,
	"string": String,
	"object": Object,
}

Functions

func FillDefaultObjectValues added in v0.5.0

func FillDefaultObjectValues(objectDefinitions map[string]*ObjectDefinition, objectName string) string

func FillDefaultObjectValuesGo added in v0.6.1

func FillDefaultObjectValuesGo(objectDefinitions map[string]*ObjectDefinition, objectName string) string

func FillTypeWithDefaultValue added in v0.5.0

func FillTypeWithDefaultValue(field *Field, isArrChecked bool, isWithFieldName bool) string

func FillTypeWithDefaultValueGo added in v0.6.1

func FillTypeWithDefaultValueGo(field *Field, isArrChecked bool, isWithFieldName bool) string

func FillWithDefaultValueType added in v0.5.0

func FillWithDefaultValueType(tp *TypeLink) string

func FillWithDefaultValueTypeGo added in v0.6.1

func FillWithDefaultValueTypeGo(tp *TypeLink) string

Types

type Ast

type Ast struct {
	Chateau *Chateau
}

func GenerateAst

func GenerateAst(lxs []*lexem2.Lexem) *Ast

type Chateau

type Chateau struct {
	PackageName                  string
	Services                     []*Service
	ObjectDefinitions            []*ObjectDefinition
	ObjectDefinitionByObjectName map[string]*ObjectDefinition
}

type Field

type Field struct {
	Name string
	Type TypeLink
}

type Method

type Method struct {
	Name       string
	Hash       hash.HandlerHash
	Params     []*Param
	Returns    []*Return
	MethodType MethodType
	Tags       []Tag
}

type MethodType

type MethodType string
var (
	Handler MethodType = "Handler"
	Stream  MethodType = "Stream"
)

type ObjectDefinition

type ObjectDefinition struct {
	Name   string
	Fields []*Field
}

type Param

type Param struct {
	Name string
	Type TypeLink
}

type Return

type Return struct {
	Name string
	Type TypeLink
}

type Service

type Service struct {
	Name    string
	Methods []*Method
}

type Tag

type Tag struct {
	Name  string
	Value string
}

type Type

type Type int
const (
	Uint64 Type = iota
	Uint32
	Uint16
	Uint8
	Int64
	Int32
	Int16
	Int8
	Int
	Byte
	Bool
	String
	Object
)
type TypeLink struct {
	Type Type

	ObjectName string
	ObjectLink *ObjectDefinition

	IsArray bool
	ArrSize int
}

Jump to

Keyboard shortcuts

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