Documentation
¶
Index ¶
- func Format(prog *Program) string
- func ValidateProgram(program *Program) []error
- type AssignmentStmt
- type CommentedNode
- type ConstDecl
- type Decl
- type DeclAnyType
- type DeclArrayType
- type DeclBoolType
- type DeclByteType
- type DeclCustomType
- type DeclEnum
- type DeclEnumSet
- type DeclError
- type DeclMapType
- type DeclModel
- type DeclModelField
- type DeclNameTypePair
- type DeclNumberType
- type DeclService
- type DeclServiceMethod
- type DeclStringType
- type DeclTimestampType
- type DeclType
- type Error
- type ErrorDisplay
- type Expr
- type GoGenerator
- type IdenExpr
- type Node
- type Parser
- type Pos
- type Program
- type RuneScanner
- func (r *RuneScanner) Accept(valid string) (rune, Pos, bool)
- func (r *RuneScanner) AcceptRun(valid string) (string, Pos, bool)
- func (r *RuneScanner) AcceptRunUntil(invalid string) (string, Pos, bool)
- func (r *RuneScanner) Backup()
- func (r *RuneScanner) Buffer() string
- func (r *RuneScanner) BufferLen() int
- func (r *RuneScanner) CleanBuffer()
- func (r *RuneScanner) Next() (rune, Pos)
- func (r *RuneScanner) Peek() rune
- type Scanner
- type Stmt
- type Token
- type TokenType
- type TypeScriptGenerator
- func (g *TypeScriptGenerator) Generate() (string, error)
- func (g *TypeScriptGenerator) GenerateClient() (string, error)
- func (g *TypeScriptGenerator) GenerateClientToWriter(w io.Writer) error
- func (g *TypeScriptGenerator) GenerateRuntimeConstsToWriter(w io.Writer) error
- func (g *TypeScriptGenerator) GenerateToWriter(w io.Writer) error
- type Validator
- type ValueExprBool
- type ValueExprNull
- type ValueExprNumber
- type ValueExprString
- type WasmGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateProgram ¶
ValidateProgram is a convenience function to validate a program
Types ¶
type AssignmentStmt ¶
func (*AssignmentStmt) String ¶
func (ae *AssignmentStmt) String() string
type CommentedNode ¶
type CommentedNode struct {
LeadingComments []*Token // Comments on lines before this node
Node Node
TrailingComment *Token // Comment on the same line after the node
}
CommentedNode wraps a Node with its associated comments
func AssociateComments ¶
func AssociateComments(prog *Program) []*CommentedNode
AssociateComments attaches comments to their nearest nodes
type ConstDecl ¶
type ConstDecl struct {
Token *Token // 'const' token
Assignment *AssignmentStmt
}
type DeclAnyType ¶
type DeclAnyType struct {
Name *IdenExpr
}
func (*DeclAnyType) String ¶
func (dat *DeclAnyType) String() string
type DeclArrayType ¶
func (*DeclArrayType) String ¶
func (dat *DeclArrayType) String() string
type DeclBoolType ¶
type DeclBoolType struct {
Name *IdenExpr
}
func (*DeclBoolType) String ¶
func (dbt *DeclBoolType) String() string
type DeclByteType ¶
type DeclByteType struct {
Name *IdenExpr
}
func (*DeclByteType) String ¶
func (dbt *DeclByteType) String() string
type DeclCustomType ¶
type DeclCustomType struct {
Name *IdenExpr
}
func (*DeclCustomType) String ¶
func (dct *DeclCustomType) String() string
type DeclEnum ¶
type DeclEnum struct {
Token *Token // 'enum' token
Name *IdenExpr
Values []*DeclEnumSet
CloseCurly *Token
}
type DeclEnumSet ¶
func (*DeclEnumSet) String ¶
func (des *DeclEnumSet) String() string
type DeclError ¶
type DeclError struct {
Token *Token
Name *IdenExpr
Code *ValueExprNumber
Msg *ValueExprString
CloseCurly *Token
}
type DeclMapType ¶
func (*DeclMapType) String ¶
func (dmt *DeclMapType) String() string
type DeclModel ¶
type DeclModel struct {
Token *Token
Name *IdenExpr
Extends []*IdenExpr
Fields []*DeclModelField
CloseCurly *Token
}
type DeclModelField ¶
type DeclModelField struct {
Name *IdenExpr
Type DeclType
Optional bool
Options []*AssignmentStmt
}
func (*DeclModelField) String ¶
func (dmf *DeclModelField) String() string
type DeclNameTypePair ¶
func (*DeclNameTypePair) String ¶
func (dntp *DeclNameTypePair) String() string
type DeclNumberType ¶
type DeclNumberType struct {
Name *IdenExpr
}
func (*DeclNumberType) String ¶
func (dnt *DeclNumberType) String() string
type DeclService ¶
type DeclService struct {
Token *Token
Name *IdenExpr
Methods []*DeclServiceMethod
CloseCurly *Token
}
func (*DeclService) String ¶
func (ds *DeclService) String() string
type DeclServiceMethod ¶
type DeclServiceMethod struct {
Name *IdenExpr
Args []*DeclNameTypePair
Returns []*DeclNameTypePair
Options []*AssignmentStmt
}
func (*DeclServiceMethod) String ¶
func (dsm *DeclServiceMethod) String() string
type DeclStringType ¶
type DeclStringType struct {
Name *IdenExpr
}
func (*DeclStringType) String ¶
func (dst *DeclStringType) String() string
type DeclTimestampType ¶
type DeclTimestampType struct {
Name *IdenExpr
}
func (*DeclTimestampType) String ¶
func (dtt *DeclTimestampType) String() string
type Error ¶
Error represents a unified error type for scanner, parser, and validation errors
type ErrorDisplay ¶
type ErrorDisplay struct {
// contains filtered or unexported fields
}
ErrorDisplay provides formatted error output with source context
func NewErrorDisplay ¶
func NewErrorDisplay(source string, filename string) *ErrorDisplay
NewErrorDisplay creates a new ErrorDisplay from source code
func (*ErrorDisplay) FormatCompilerError ¶
func (ed *ErrorDisplay) FormatCompilerError(err *Error) string
FormatCompilerError formats an Error with source context
func (*ErrorDisplay) FormatCompilerErrorPlain ¶
func (ed *ErrorDisplay) FormatCompilerErrorPlain(err *Error) string
FormatCompilerErrorPlain formats an Error without ANSI colors
func (*ErrorDisplay) FormatError ¶
func (ed *ErrorDisplay) FormatError(err error) string
FormatError formats an Error with source context for terminal display
func (*ErrorDisplay) FormatErrorPlain ¶
func (ed *ErrorDisplay) FormatErrorPlain(err error) string
FormatErrorPlain formats an error without ANSI colors (for non-terminal output)
type GoGenerator ¶
type GoGenerator struct {
// contains filtered or unexported fields
}
GoGenerator transforms Ella AST to Go source code
func NewGoGenerator ¶
func NewGoGenerator(program *Program, packageName string) *GoGenerator
NewGoGenerator creates a new Go code generator
func (*GoGenerator) Generate ¶
func (g *GoGenerator) Generate() (string, error)
Generate produces Go source code from the Ella program
func (*GoGenerator) GenerateHelperTypes ¶
func (g *GoGenerator) GenerateHelperTypes() string
GenerateHelperTypes generates common helper types like HandleRegistry and Error
func (*GoGenerator) GenerateToWriter ¶
func (g *GoGenerator) GenerateToWriter(w io.Writer) error
func (*GoGenerator) GenerateWithHelpers ¶
func (g *GoGenerator) GenerateWithHelpers() (string, error)
GenerateWithHelpers produces complete Go source with helper types
type RuneScanner ¶
type RuneScanner struct {
// contains filtered or unexported fields
}
func NewRuneScanner ¶
func NewRuneScanner(r io.Reader, src string) *RuneScanner
func (*RuneScanner) AcceptRunUntil ¶
func (r *RuneScanner) AcceptRunUntil(invalid string) (string, Pos, bool)
func (*RuneScanner) Backup ¶
func (r *RuneScanner) Backup()
func (*RuneScanner) Buffer ¶
func (r *RuneScanner) Buffer() string
func (*RuneScanner) BufferLen ¶
func (r *RuneScanner) BufferLen() int
func (*RuneScanner) CleanBuffer ¶
func (r *RuneScanner) CleanBuffer()
func (*RuneScanner) Next ¶
func (r *RuneScanner) Next() (rune, Pos)
func (*RuneScanner) Peek ¶
func (r *RuneScanner) Peek() rune
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
func (*Scanner) ScanNumber ¶
func (*Scanner) ScanReservedWord ¶
type Token ¶
func (*Token) IsInjected ¶
type TokenType ¶
type TokenType int
const ( EOF TokenType = iota UNKNOWN ERROR COMMENT IDENTIFIER CONST ENUM MODEL SERVICE BYTE BOOL INT8 INT16 INT32 INT64 UINT8 UINT16 UINT32 UINT64 FLOAT32 FLOAT64 TIMESTAMP STRING ANY MAP CONST_NUMBER CONST_STRING_SINGLE_QUOTE CONST_STRING_DOUBLE_QUOTE CONST_STRING_BACKTICK_QOUTE CONST_BOOL CONST_NULL EQUAL OPTIONAL COLON COMMA DOT OPEN_CURLY CLOSE_CURLY OPEN_PAREN CLOSE_PAREN OPEN_ANGLE CLOSE_ANGLE OPEN_SQURE CLOSE_SQURE CUSTOM_ERROR )
type TypeScriptGenerator ¶
type TypeScriptGenerator struct {
// contains filtered or unexported fields
}
TypeScriptGenerator generates TypeScript definitions for Ella schemas
func NewTypeScriptGenerator ¶
func NewTypeScriptGenerator(program *Program) *TypeScriptGenerator
NewTypeScriptGenerator creates a new TypeScript code generator
func (*TypeScriptGenerator) Generate ¶
func (g *TypeScriptGenerator) Generate() (string, error)
Generate produces TypeScript definition source code
func (*TypeScriptGenerator) GenerateClient ¶
func (g *TypeScriptGenerator) GenerateClient() (string, error)
GenerateClient produces runtime TypeScript client source code.
func (*TypeScriptGenerator) GenerateClientToWriter ¶
func (g *TypeScriptGenerator) GenerateClientToWriter(w io.Writer) error
GenerateClientToWriter writes runtime TypeScript client code (.ts) to the writer.
func (*TypeScriptGenerator) GenerateRuntimeConstsToWriter ¶
func (g *TypeScriptGenerator) GenerateRuntimeConstsToWriter(w io.Writer) error
GenerateRuntimeConstsToWriter writes runtime TypeScript exports. It emits schema const declarations and error code constants so values are available at runtime.
func (*TypeScriptGenerator) GenerateToWriter ¶
func (g *TypeScriptGenerator) GenerateToWriter(w io.Writer) error
GenerateToWriter writes the TypeScript definitions to the writer
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator validates an Ella AST
func NewValidator ¶
NewValidator creates a new validator
type ValueExprBool ¶
type ValueExprBool struct {
Token *Token
}
func (*ValueExprBool) String ¶
func (veb *ValueExprBool) String() string
type ValueExprNull ¶
type ValueExprNull struct {
Token *Token
}
func (*ValueExprNull) String ¶
func (ven *ValueExprNull) String() string
type ValueExprNumber ¶
func (*ValueExprNumber) String ¶
func (ven *ValueExprNumber) String() string
type ValueExprString ¶
type ValueExprString struct {
Token *Token
}
func (*ValueExprString) String ¶
func (ves *ValueExprString) String() string
type WasmGenerator ¶
type WasmGenerator struct {
// contains filtered or unexported fields
}
WasmGenerator generates JavaScript/WASM bindings for Ella services
func NewWasmGenerator ¶
func NewWasmGenerator(program *Program, packageName string, allowExtensions bool) *WasmGenerator
NewWasmGenerator creates a new WASM code generator
func (*WasmGenerator) Generate ¶
func (g *WasmGenerator) Generate() (string, error)
Generate produces WASM binding source code
func (*WasmGenerator) GenerateToWriter ¶
func (g *WasmGenerator) GenerateToWriter(w io.Writer) error
GenerateToWriter writes the WASM bindings to the writer