internal

package
v0.0.0-...-6066fb9 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultIndent = "    "

DefaultIndent is the default indentation string used by IndentWriter. It is set to four spaces.

Variables

This section is empty.

Functions

func AS3DefaultValue

func AS3DefaultValue(field *protogen.Field, currentProtoPackage string) string

AS3DefaultValue returns the default ActionScript expression for field.

func AS3Type

func AS3Type(field *protogen.Field, currentProtoPackage string) string

AS3Type returns the ActionScript type for a protobuf field.

func EnumClassName

func EnumClassName(enum *protogen.Enum) string

EnumClassName returns the AS3 class name for a protobuf enum.

func EnumName

func EnumName(enum *protogen.EnumValue) string

EnumName returns the AS3 enum value constant name for a protobuf enum value.

func FieldDefaultName

func FieldDefaultName(field *protogen.Field) string

FieldDefaultName returns the AS3 declared-default constant name for a field.

func FieldName

func FieldName(field *protogen.Field) string

FieldName returns the AS3 field identifier for a protobuf field.

func FieldNamePascal

func FieldNamePascal(field *protogen.Field) string

FieldNamePascal returns the AS3 PascalCase identifier for a protobuf field.

func FieldNumberName

func FieldNumberName(field *protogen.Field) string

FieldNumberName returns the AS3 field-number constant name for a protobuf field.

func IsAS3ReservedWord

func IsAS3ReservedWord(word string) bool

IsAS3ReservedWord reports whether word is reserved in ActionScript 3.

func MessageClassName

func MessageClassName(message *protogen.Message) string

MessageClassName returns the AS3 class name for a protobuf message.

func OneofCaseName

func OneofCaseName(oneof *protogen.Oneof) string

OneofCaseName returns the AS3 oneof case field name for a protobuf oneof.

func QualifiedMessageClassName

func QualifiedMessageClassName(message *protogen.Message) string

QualifiedMessageClassName returns the package-qualified AS3 class name, used for every reference to the class (its declaration stays bare): a bare name is ambiguous whenever it collides with a global like Date, even inside the class's own file.

func RPCMethodName

func RPCMethodName(method *protogen.Method) string

RPCMethodName returns the AS3 method name for a protobuf RPC method.

func ServiceClassName

func ServiceClassName(service *protogen.Service) string

ServiceClassName returns the AS3 RPC client class name for a protobuf service.

func WireTypeForField

func WireTypeForField(field *protogen.Field) protowire.Type

WireTypeForField returns the protobuf wire type used when writing a field tag.

Types

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator emits ActionScript 3 code from protobuf descriptors.

func NewGenerator

func NewGenerator(plugin *protogen.Plugin, opts Options) *Generator

NewGenerator creates a generator with normalized options.

func (*Generator) GenerateFile

func (g *Generator) GenerateFile(file *protogen.File) error

GenerateFile emits ActionScript 3 code for one protobuf file.

type IndentWriter

type IndentWriter struct {
	// contains filtered or unexported fields
}

func NewIndentWriter

func NewIndentWriter(dst io.Writer, indent string) IndentWriter

func (*IndentWriter) BlankLine

func (w *IndentWriter) BlankLine()

func (*IndentWriter) Dedent

func (w *IndentWriter) Dedent()

func (*IndentWriter) EnsureBlankLine

func (w *IndentWriter) EnsureBlankLine()

EnsureBlankLine pads the output until it ends with a blank line, so a caller can separate two sections without knowing whether either one wrote anything. It is a no-op at the start of the stream, which keeps leading blank lines out of a block.

func (*IndentWriter) Err

func (w *IndentWriter) Err() error

func (*IndentWriter) Indent

func (w *IndentWriter) Indent()

func (*IndentWriter) Line

func (w *IndentWriter) Line(format string, args ...any)

func (*IndentWriter) Reset

func (w *IndentWriter) Reset(dst io.Writer)

func (*IndentWriter) Write

func (w *IndentWriter) Write(format string, args ...any)

func (*IndentWriter) WriteIndent

func (w *IndentWriter) WriteIndent()

type MessageNames

type MessageNames struct {
	// contains filtered or unexported fields
}

MessageNames stores collision-safe generated names for one message.

func NewMessageNames

func NewMessageNames(message *protogen.Message) *MessageNames

NewMessageNames creates stable names for generated members in a message class.

func (*MessageNames) Default

func (n *MessageNames) Default(field *protogen.Field) string

Default returns the AS3 declared-default constant name for field.

func (*MessageNames) DefaultMaker

func (n *MessageNames) DefaultMaker(field *protogen.Field) string

DefaultMaker returns the builder function name for a bytes field's declared-default constant.

func (*MessageNames) Field

func (n *MessageNames) Field(field *protogen.Field) string

Field returns the AS3 instance field name for field.

func (*MessageNames) FieldNumber

func (n *MessageNames) FieldNumber(field *protogen.Field) string

FieldNumber returns the AS3 field-number constant name for field.

func (*MessageNames) OneofCase

func (n *MessageNames) OneofCase(oneof *protogen.Oneof) string

OneofCase returns the AS3 oneof case field name for oneof.

type Options

type Options struct {
	Debug               bool
	GenerateAlways      bool
	GenerateAny         *bool
	GenerateClone       *bool
	GenerateSerialize   *bool
	GenerateDeserialize *bool
	Indent              string
	InlineReset         *bool
	Logger              *slog.Logger
}

Options controls generator behavior.

Jump to

Keyboard shortcuts

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