Documentation
¶
Index ¶
- func Evaluate(expr ConstExpr) (any, error)
- type Annotation
- type BinaryExpr
- type BoolLiteral
- type CharLiteralExpr
- type ConstExpr
- type ConstantDecl
- type Definition
- type Direction
- type Document
- type EnumDecl
- type Enumerator
- type FieldDecl
- type FloatLiteral
- type IdentExpr
- type ImportDecl
- type IntegerLiteral
- type InterfaceDecl
- type JavaWireField
- type Lexer
- type MethodDecl
- type NullLiteral
- type PackageDecl
- type ParamDecl
- type ParcelableDecl
- type Position
- type StringLiteralExpr
- type TernaryExpr
- type Token
- type TokenKind
- type TypeSpecifier
- type UnaryExpr
- type UnionDecl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Annotation ¶
Annotation represents an AIDL annotation like @nullable or @Backing(type="int").
type BinaryExpr ¶
BinaryExpr represents a binary operator expression.
func (*BinaryExpr) ExprPos ¶
func (e *BinaryExpr) ExprPos() Position
ExprPos returns the position of this expression.
type BoolLiteral ¶
BoolLiteral represents a boolean constant.
func (*BoolLiteral) ExprPos ¶
func (e *BoolLiteral) ExprPos() Position
ExprPos returns the position of this expression.
type CharLiteralExpr ¶
CharLiteralExpr represents a character constant.
func (*CharLiteralExpr) ExprPos ¶
func (e *CharLiteralExpr) ExprPos() Position
ExprPos returns the position of this expression.
type ConstExpr ¶
type ConstExpr interface {
ExprPos() Position
// contains filtered or unexported methods
}
ConstExpr is implemented by all constant expression AST nodes.
type ConstantDecl ¶
type ConstantDecl struct {
Pos Position
Type *TypeSpecifier
ConstName string
Value ConstExpr
}
ConstantDecl represents a constant declaration inside an interface, parcelable, or union.
type Definition ¶
type Definition interface {
GetName() string
GetAnnotations() []*Annotation
// contains filtered or unexported methods
}
Definition is implemented by all top-level declarations.
type Direction ¶
type Direction int
Direction indicates the data flow direction for a method parameter.
type Document ¶
type Document struct {
Package *PackageDecl
Imports []*ImportDecl
Definitions []Definition
}
Document is the root AST node for an AIDL file.
type EnumDecl ¶
type EnumDecl struct {
Pos Position
Annots []*Annotation
EnumName string
BackingType *TypeSpecifier
Enumerators []*Enumerator
}
EnumDecl represents an AIDL enum declaration.
func (*EnumDecl) GetAnnotations ¶
func (d *EnumDecl) GetAnnotations() []*Annotation
GetAnnotations returns the annotations on this enum.
type Enumerator ¶
Enumerator represents a single enumerator within an enum declaration.
type FieldDecl ¶
type FieldDecl struct {
Pos Position
Annots []*Annotation
Type *TypeSpecifier
FieldName string
DefaultValue ConstExpr
}
FieldDecl represents a field in a parcelable or union.
type FloatLiteral ¶
FloatLiteral represents a floating-point constant.
func (*FloatLiteral) ExprPos ¶
func (e *FloatLiteral) ExprPos() Position
ExprPos returns the position of this expression.
type ImportDecl ¶
ImportDecl represents an import statement.
type IntegerLiteral ¶
IntegerLiteral represents an integer constant (decimal, hex, octal, binary).
func (*IntegerLiteral) ExprPos ¶
func (e *IntegerLiteral) ExprPos() Position
ExprPos returns the position of this expression.
type InterfaceDecl ¶
type InterfaceDecl struct {
Pos Position
Annots []*Annotation
IntfName string
Oneway bool
Methods []*MethodDecl
Constants []*ConstantDecl
// Nested type definitions inside this interface.
NestedTypes []Definition
}
InterfaceDecl represents an AIDL interface declaration.
func (*InterfaceDecl) GetAnnotations ¶
func (d *InterfaceDecl) GetAnnotations() []*Annotation
GetAnnotations returns the annotations on this interface.
func (*InterfaceDecl) GetName ¶
func (d *InterfaceDecl) GetName() string
GetName returns the interface name.
type JavaWireField ¶
type JavaWireField struct {
// Name is the PascalCase field name (matches the struct field name).
Name string
// WriteMethod is the spec type: bool, int32, int64, float32, float64,
// string8, string16, typed_object, or opaque.
WriteMethod string
// Condition, if non-empty, is a bitmask expression like "FieldsMask & 256"
// meaning the field is only serialized when that bit is set.
Condition string
// GoType, if non-empty, is the qualified Go type for a typed_object field
// whose parcelable was found in the spec registry (e.g., "os.WorkSource").
// The codegen uses this to generate a *GoType struct field with proper
// nullable marshal/unmarshal instead of an opaque null marker.
GoType string
}
JavaWireField describes one field's serialization in the Java writeToParcel() method. When present on a ParcelableDecl, the codegen uses this to produce marshal/unmarshal code that matches the Java wire format (including conditional fields).
type Lexer ¶
Lexer tokenizes AIDL source code.
type MethodDecl ¶
type MethodDecl struct {
Pos Position
Annots []*Annotation
Oneway bool
ReturnType *TypeSpecifier
MethodName string
Params []*ParamDecl
TransactionID int
}
MethodDecl represents a method declaration inside an interface.
type NullLiteral ¶
type NullLiteral struct {
TokenPos Position
}
NullLiteral represents the null constant.
func (*NullLiteral) ExprPos ¶
func (e *NullLiteral) ExprPos() Position
ExprPos returns the position of this expression.
type PackageDecl ¶
PackageDecl represents a package declaration.
type ParamDecl ¶
type ParamDecl struct {
Pos Position
Annots []*Annotation
Direction Direction
Type *TypeSpecifier
ParamName string
}
ParamDecl represents a method parameter.
type ParcelableDecl ¶
type ParcelableDecl struct {
Pos Position
Annots []*Annotation
ParcName string
Fields []*FieldDecl
Constants []*ConstantDecl
// Nested type definitions inside this parcelable.
NestedTypes []Definition
// CppHeader is set for forward-declared parcelables (cpp_header "...").
CppHeader string
// NdkHeader is set for forward-declared parcelables (ndk_header "...").
NdkHeader string
// RustType is set for forward-declared parcelables (rust_type "...").
RustType string
// JavaWireFormat, when non-nil, overrides the standard AIDL-field-based
// marshal/unmarshal with code matching the Java writeToParcel() layout.
// Fields are still populated for struct generation, but marshal/unmarshal
// uses this instead of the generic field-walking approach.
JavaWireFormat []JavaWireField
}
ParcelableDecl represents an AIDL parcelable declaration.
func (*ParcelableDecl) GetAnnotations ¶
func (d *ParcelableDecl) GetAnnotations() []*Annotation
GetAnnotations returns the annotations on this parcelable.
func (*ParcelableDecl) GetName ¶
func (d *ParcelableDecl) GetName() string
GetName returns the parcelable name.
type StringLiteralExpr ¶
StringLiteralExpr represents a string constant (unquoted value).
func (*StringLiteralExpr) ExprPos ¶
func (e *StringLiteralExpr) ExprPos() Position
ExprPos returns the position of this expression.
type TernaryExpr ¶
TernaryExpr represents a ternary (conditional) expression.
func (*TernaryExpr) ExprPos ¶
func (e *TernaryExpr) ExprPos() Position
ExprPos returns the position of this expression.
type TokenKind ¶
type TokenKind int
TokenKind identifies the type of a lexical token.
const ( TokenEOF TokenKind = iota TokenError TokenIdent TokenIntLiteral TokenFloatLiteral TokenStringLiteral TokenCharLiteral // Keywords. TokenPackage TokenImport TokenInterface TokenParcelable TokenEnum TokenUnion TokenConst TokenOneway TokenIn TokenOut TokenInout TokenTrue TokenFalse TokenVoid TokenNull // Punctuation. TokenLBrace TokenRBrace TokenLParen TokenRParen TokenLBracket TokenRBracket TokenSemicolon TokenComma TokenDot TokenAssign TokenLAngle TokenRAngle // Operators. TokenPlus TokenMinus TokenStar TokenSlash TokenPercent TokenAmp TokenPipe TokenCaret TokenTilde TokenBang TokenLShift TokenRShift TokenAmpAmp TokenPipePipe TokenEqEq TokenBangEq TokenLessEq TokenGreaterEq TokenQuestion TokenColon // Annotations. TokenAnnotation )
type TypeSpecifier ¶
type TypeSpecifier struct {
Pos Position
Annots []*Annotation
Name string
TypeArgs []*TypeSpecifier
IsArray bool
// FixedSize holds the fixed-size array dimension expression (e.g., "6"
// or "CONST_NAME") when the type uses fixed-size array syntax like
// byte[6]. Empty string means dynamic array or non-array.
FixedSize string
}
TypeSpecifier represents a type reference in AIDL.
type UnionDecl ¶
type UnionDecl struct {
Pos Position
Annots []*Annotation
UnionName string
Fields []*FieldDecl
Constants []*ConstantDecl
// Nested type definitions inside this union.
NestedTypes []Definition
}
UnionDecl represents an AIDL union declaration.
func (*UnionDecl) GetAnnotations ¶
func (d *UnionDecl) GetAnnotations() []*Annotation
GetAnnotations returns the annotations on this union.
Source Files
¶
- annotation.go
- ast.go
- binary_expr.go
- bool_literal.go
- char_literal_expr.go
- const_expr.go
- constant_decl.go
- consteval.go
- direction.go
- enum_decl.go
- enumerator.go
- field_decl.go
- float_literal.go
- ident_expr.go
- import_decl.go
- integer_literal.go
- interface_decl.go
- lexer.go
- method_decl.go
- null_literal.go
- package_decl.go
- param_decl.go
- parcelable_decl.go
- parser.go
- position.go
- string_literal_expr.go
- ternary_expr.go
- token.go
- token_kind.go
- type_specifier.go
- unary_expr.go
- union_decl.go