tidl

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

README

/*****************************************************************************/

Install antlr4 version 4.13.2

```bash
curl -O https://www.antlr.org/download/antlr-4.13.2-complete.jar
```

Then configure the tool directory according to the official website requirements

```bash
antlr413 -Dlanguage=Go -package parser *.g4
```

Execute the above command in the current directory to automatically generate parser code

/*****************************************************************************/

安装 antlr4 4.13.2 版本

```bash
curl -O https://www.antlr.org/download/antlr-4.13.2-complete.jar
```

然后按照官网要求配置好工具目录

```bash
antlr413 -Dlanguage=Go -package parser *.g4
```

在当前目录下执行上述命令即可自动生成 parser 代码

/*****************************************************************************/

Documentation

Index

Constants

View Source
const (
	TLexerKW_CONST            = 1
	TLexerKW_ENUM             = 2
	TLexerKW_TYPE             = 3
	TLexerKW_RPC              = 4
	TLexerKW_TRUE             = 5
	TLexerKW_FALSE            = 6
	TLexerTYPE_ANY            = 7
	TLexerTYPE_BOOL           = 8
	TLexerTYPE_INT            = 9
	TLexerTYPE_FLOAT          = 10
	TLexerTYPE_STRING         = 11
	TLexerTYPE_BINARY         = 12
	TLexerTYPE_STREAM         = 13
	TLexerTYPE_MAP            = 14
	TLexerTYPE_LIST           = 15
	TLexerLESS_THAN           = 16
	TLexerGREATER_THAN        = 17
	TLexerLEFT_PAREN          = 18
	TLexerRIGHT_PAREN         = 19
	TLexerLEFT_BRACE          = 20
	TLexerRIGHT_BRACE         = 21
	TLexerEQUAL               = 22
	TLexerCOMMA               = 23
	TLexerQUESTION            = 24
	TLexerSTRING              = 25
	TLexerIDENTIFIER          = 26
	TLexerINTEGER             = 27
	TLexerFLOAT               = 28
	TLexerWHITESPACE          = 29
	TLexerSINGLE_LINE_COMMENT = 30
	TLexerMULTI_LINE_COMMENT  = 31
)

TLexer tokens.

View Source
const (
	TLexerWS_CHAN         = 2
	TLexerSL_COMMENT_CHAN = 3
	TLexerML_COMMENT_CHAN = 4
)

TLexer escapedChannels.

View Source
const (
	TParserEOF                 = antlr.TokenEOF
	TParserKW_CONST            = 1
	TParserKW_ENUM             = 2
	TParserKW_TYPE             = 3
	TParserKW_RPC              = 4
	TParserKW_TRUE             = 5
	TParserKW_FALSE            = 6
	TParserTYPE_ANY            = 7
	TParserTYPE_BOOL           = 8
	TParserTYPE_INT            = 9
	TParserTYPE_FLOAT          = 10
	TParserTYPE_STRING         = 11
	TParserTYPE_BINARY         = 12
	TParserTYPE_STREAM         = 13
	TParserTYPE_MAP            = 14
	TParserTYPE_LIST           = 15
	TParserLESS_THAN           = 16
	TParserGREATER_THAN        = 17
	TParserLEFT_PAREN          = 18
	TParserRIGHT_PAREN         = 19
	TParserLEFT_BRACE          = 20
	TParserRIGHT_BRACE         = 21
	TParserEQUAL               = 22
	TParserCOMMA               = 23
	TParserQUESTION            = 24
	TParserSTRING              = 25
	TParserIDENTIFIER          = 26
	TParserINTEGER             = 27
	TParserFLOAT               = 28
	TParserWHITESPACE          = 29
	TParserSINGLE_LINE_COMMENT = 30
	TParserMULTI_LINE_COMMENT  = 31
)

TParser tokens.

View Source
const (
	TParserRULE_document          = 0
	TParserRULE_definition        = 1
	TParserRULE_const_def         = 2
	TParserRULE_const_type        = 3
	TParserRULE_enum_def          = 4
	TParserRULE_enum_field        = 5
	TParserRULE_type_def          = 6
	TParserRULE_type_field        = 7
	TParserRULE_embed_type_field  = 8
	TParserRULE_common_type_field = 9
	TParserRULE_common_field_type = 10
	TParserRULE_generic_type      = 11
	TParserRULE_type_annotations  = 12
	TParserRULE_rpc_def           = 13
	TParserRULE_rpc_req           = 14
	TParserRULE_rpc_resp          = 15
	TParserRULE_rpc_annotations   = 16
	TParserRULE_annotation        = 17
	TParserRULE_base_type         = 18
	TParserRULE_user_type         = 19
	TParserRULE_container_type    = 20
	TParserRULE_map_type          = 21
	TParserRULE_key_type          = 22
	TParserRULE_list_type         = 23
	TParserRULE_value_type        = 24
	TParserRULE_const_value       = 25
)

TParser rules.

Variables

View Source
var TLexerLexerStaticData struct {
	ChannelNames           []string
	ModeNames              []string
	LiteralNames           []string
	SymbolicNames          []string
	RuleNames              []string
	PredictionContextCache *antlr.PredictionContextCache
	// contains filtered or unexported fields
}
View Source
var TParserParserStaticData struct {
	LiteralNames           []string
	SymbolicNames          []string
	RuleNames              []string
	PredictionContextCache *antlr.PredictionContextCache
	// contains filtered or unexported fields
}

Functions

func Dump

func Dump(doc Document) string

Dump takes a Document AST and converts it into a formatted string. It preserves ordering and attaches comments correctly.

func Format

func Format(s string) (string, error)

Format parses the input string into a Document and then pretty-prints (dumps) it back into a normalized string form.

func InitEmptyAnnotationContext

func InitEmptyAnnotationContext(p *AnnotationContext)

func InitEmptyBase_typeContext

func InitEmptyBase_typeContext(p *Base_typeContext)

func InitEmptyCommon_field_typeContext

func InitEmptyCommon_field_typeContext(p *Common_field_typeContext)

func InitEmptyCommon_type_fieldContext

func InitEmptyCommon_type_fieldContext(p *Common_type_fieldContext)

func InitEmptyConst_defContext

func InitEmptyConst_defContext(p *Const_defContext)

func InitEmptyConst_typeContext

func InitEmptyConst_typeContext(p *Const_typeContext)

func InitEmptyConst_valueContext

func InitEmptyConst_valueContext(p *Const_valueContext)

func InitEmptyContainer_typeContext

func InitEmptyContainer_typeContext(p *Container_typeContext)

func InitEmptyDefinitionContext

func InitEmptyDefinitionContext(p *DefinitionContext)

func InitEmptyDocumentContext

func InitEmptyDocumentContext(p *DocumentContext)

func InitEmptyEmbed_type_fieldContext

func InitEmptyEmbed_type_fieldContext(p *Embed_type_fieldContext)

func InitEmptyEnum_defContext

func InitEmptyEnum_defContext(p *Enum_defContext)

func InitEmptyEnum_fieldContext

func InitEmptyEnum_fieldContext(p *Enum_fieldContext)

func InitEmptyGeneric_typeContext

func InitEmptyGeneric_typeContext(p *Generic_typeContext)

func InitEmptyKey_typeContext

func InitEmptyKey_typeContext(p *Key_typeContext)

func InitEmptyList_typeContext

func InitEmptyList_typeContext(p *List_typeContext)

func InitEmptyMap_typeContext

func InitEmptyMap_typeContext(p *Map_typeContext)

func InitEmptyRpc_annotationsContext

func InitEmptyRpc_annotationsContext(p *Rpc_annotationsContext)

func InitEmptyRpc_defContext

func InitEmptyRpc_defContext(p *Rpc_defContext)

func InitEmptyRpc_reqContext

func InitEmptyRpc_reqContext(p *Rpc_reqContext)

func InitEmptyRpc_respContext

func InitEmptyRpc_respContext(p *Rpc_respContext)

func InitEmptyType_annotationsContext

func InitEmptyType_annotationsContext(p *Type_annotationsContext)

func InitEmptyType_defContext

func InitEmptyType_defContext(p *Type_defContext)

func InitEmptyType_fieldContext

func InitEmptyType_fieldContext(p *Type_fieldContext)

func InitEmptyUser_typeContext

func InitEmptyUser_typeContext(p *User_typeContext)

func InitEmptyValue_typeContext

func InitEmptyValue_typeContext(p *Value_typeContext)

func TLexerInit

func TLexerInit()

TLexerInit initializes any static state used to implement TLexer. By default the static state used to implement the lexer is lazily initialized during the first call to NewTLexer(). You can call this function if you wish to initialize the static state ahead of time.

func TParserInit

func TParserInit()

TParserInit initializes any static state used to implement TParser. By default the static state used to implement the parser is lazily initialized during the first call to NewTParser(). You can call this function if you wish to initialize the static state ahead of time.

Types

type Annotation

type Annotation struct {
	Key      string   // Annotation key
	Value    *string  // Optional value
	Position Position // Location in source code
	Comments Comments // Associated comments
}

Annotation represents metadata attached to types, fields, or RPCs.

func GetOneOfAnnotation

func GetOneOfAnnotation(arr []Annotation, names ...string) (Annotation, bool)

GetOneOfAnnotation searches through a slice of annotations and returns the first annotation whose key matches any of the provided names.

type AnnotationContext

type AnnotationContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewAnnotationContext

func NewAnnotationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AnnotationContext

func NewEmptyAnnotationContext

func NewEmptyAnnotationContext() *AnnotationContext

func (*AnnotationContext) Const_value

func (s *AnnotationContext) Const_value() IConst_valueContext

func (*AnnotationContext) EQUAL

func (s *AnnotationContext) EQUAL() antlr.TerminalNode

func (*AnnotationContext) EnterRule

func (s *AnnotationContext) EnterRule(listener antlr.ParseTreeListener)

func (*AnnotationContext) ExitRule

func (s *AnnotationContext) ExitRule(listener antlr.ParseTreeListener)

func (*AnnotationContext) GetParser

func (s *AnnotationContext) GetParser() antlr.Parser

func (*AnnotationContext) GetRuleContext

func (s *AnnotationContext) GetRuleContext() antlr.RuleContext

func (*AnnotationContext) IDENTIFIER

func (s *AnnotationContext) IDENTIFIER() antlr.TerminalNode

func (*AnnotationContext) IsAnnotationContext

func (*AnnotationContext) IsAnnotationContext()

func (*AnnotationContext) ToStringTree

func (s *AnnotationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type AnyType

type AnyType struct{}

AnyType represents the special "any" type.

func (AnyType) MarshalText

func (t AnyType) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler for AnyType.

func (AnyType) Text

func (t AnyType) Text() string

type BaseTParserListener

type BaseTParserListener struct{}

BaseTParserListener is a complete listener for a parse tree produced by TParser.

func (*BaseTParserListener) EnterAnnotation

func (s *BaseTParserListener) EnterAnnotation(ctx *AnnotationContext)

EnterAnnotation is called when production annotation is entered.

func (*BaseTParserListener) EnterBase_type

func (s *BaseTParserListener) EnterBase_type(ctx *Base_typeContext)

EnterBase_type is called when production base_type is entered.

func (*BaseTParserListener) EnterCommon_field_type

func (s *BaseTParserListener) EnterCommon_field_type(ctx *Common_field_typeContext)

EnterCommon_field_type is called when production common_field_type is entered.

func (*BaseTParserListener) EnterCommon_type_field

func (s *BaseTParserListener) EnterCommon_type_field(ctx *Common_type_fieldContext)

EnterCommon_type_field is called when production common_type_field is entered.

func (*BaseTParserListener) EnterConst_def

func (s *BaseTParserListener) EnterConst_def(ctx *Const_defContext)

EnterConst_def is called when production const_def is entered.

func (*BaseTParserListener) EnterConst_type

func (s *BaseTParserListener) EnterConst_type(ctx *Const_typeContext)

EnterConst_type is called when production const_type is entered.

func (*BaseTParserListener) EnterConst_value

func (s *BaseTParserListener) EnterConst_value(ctx *Const_valueContext)

EnterConst_value is called when production const_value is entered.

func (*BaseTParserListener) EnterContainer_type

func (s *BaseTParserListener) EnterContainer_type(ctx *Container_typeContext)

EnterContainer_type is called when production container_type is entered.

func (*BaseTParserListener) EnterDefinition

func (s *BaseTParserListener) EnterDefinition(ctx *DefinitionContext)

EnterDefinition is called when production definition is entered.

func (*BaseTParserListener) EnterDocument

func (s *BaseTParserListener) EnterDocument(ctx *DocumentContext)

EnterDocument is called when production document is entered.

func (*BaseTParserListener) EnterEmbed_type_field

func (s *BaseTParserListener) EnterEmbed_type_field(ctx *Embed_type_fieldContext)

EnterEmbed_type_field is called when production embed_type_field is entered.

func (*BaseTParserListener) EnterEnum_def

func (s *BaseTParserListener) EnterEnum_def(ctx *Enum_defContext)

EnterEnum_def is called when production enum_def is entered.

func (*BaseTParserListener) EnterEnum_field

func (s *BaseTParserListener) EnterEnum_field(ctx *Enum_fieldContext)

EnterEnum_field is called when production enum_field is entered.

func (*BaseTParserListener) EnterEveryRule

func (s *BaseTParserListener) EnterEveryRule(ctx antlr.ParserRuleContext)

EnterEveryRule is called when any rule is entered.

func (*BaseTParserListener) EnterGeneric_type

func (s *BaseTParserListener) EnterGeneric_type(ctx *Generic_typeContext)

EnterGeneric_type is called when production generic_type is entered.

func (*BaseTParserListener) EnterKey_type

func (s *BaseTParserListener) EnterKey_type(ctx *Key_typeContext)

EnterKey_type is called when production key_type is entered.

func (*BaseTParserListener) EnterList_type

func (s *BaseTParserListener) EnterList_type(ctx *List_typeContext)

EnterList_type is called when production list_type is entered.

func (*BaseTParserListener) EnterMap_type

func (s *BaseTParserListener) EnterMap_type(ctx *Map_typeContext)

EnterMap_type is called when production map_type is entered.

func (*BaseTParserListener) EnterRpc_annotations

func (s *BaseTParserListener) EnterRpc_annotations(ctx *Rpc_annotationsContext)

EnterRpc_annotations is called when production rpc_annotations is entered.

func (*BaseTParserListener) EnterRpc_def

func (s *BaseTParserListener) EnterRpc_def(ctx *Rpc_defContext)

EnterRpc_def is called when production rpc_def is entered.

func (*BaseTParserListener) EnterRpc_req

func (s *BaseTParserListener) EnterRpc_req(ctx *Rpc_reqContext)

EnterRpc_req is called when production rpc_req is entered.

func (*BaseTParserListener) EnterRpc_resp

func (s *BaseTParserListener) EnterRpc_resp(ctx *Rpc_respContext)

EnterRpc_resp is called when production rpc_resp is entered.

func (*BaseTParserListener) EnterType_annotations

func (s *BaseTParserListener) EnterType_annotations(ctx *Type_annotationsContext)

EnterType_annotations is called when production type_annotations is entered.

func (*BaseTParserListener) EnterType_def

func (s *BaseTParserListener) EnterType_def(ctx *Type_defContext)

EnterType_def is called when production type_def is entered.

func (*BaseTParserListener) EnterType_field

func (s *BaseTParserListener) EnterType_field(ctx *Type_fieldContext)

EnterType_field is called when production type_field is entered.

func (*BaseTParserListener) EnterUser_type

func (s *BaseTParserListener) EnterUser_type(ctx *User_typeContext)

EnterUser_type is called when production user_type is entered.

func (*BaseTParserListener) EnterValue_type

func (s *BaseTParserListener) EnterValue_type(ctx *Value_typeContext)

EnterValue_type is called when production value_type is entered.

func (*BaseTParserListener) ExitAnnotation

func (s *BaseTParserListener) ExitAnnotation(ctx *AnnotationContext)

ExitAnnotation is called when production annotation is exited.

func (*BaseTParserListener) ExitBase_type

func (s *BaseTParserListener) ExitBase_type(ctx *Base_typeContext)

ExitBase_type is called when production base_type is exited.

func (*BaseTParserListener) ExitCommon_field_type

func (s *BaseTParserListener) ExitCommon_field_type(ctx *Common_field_typeContext)

ExitCommon_field_type is called when production common_field_type is exited.

func (*BaseTParserListener) ExitCommon_type_field

func (s *BaseTParserListener) ExitCommon_type_field(ctx *Common_type_fieldContext)

ExitCommon_type_field is called when production common_type_field is exited.

func (*BaseTParserListener) ExitConst_def

func (s *BaseTParserListener) ExitConst_def(ctx *Const_defContext)

ExitConst_def is called when production const_def is exited.

func (*BaseTParserListener) ExitConst_type

func (s *BaseTParserListener) ExitConst_type(ctx *Const_typeContext)

ExitConst_type is called when production const_type is exited.

func (*BaseTParserListener) ExitConst_value

func (s *BaseTParserListener) ExitConst_value(ctx *Const_valueContext)

ExitConst_value is called when production const_value is exited.

func (*BaseTParserListener) ExitContainer_type

func (s *BaseTParserListener) ExitContainer_type(ctx *Container_typeContext)

ExitContainer_type is called when production container_type is exited.

func (*BaseTParserListener) ExitDefinition

func (s *BaseTParserListener) ExitDefinition(ctx *DefinitionContext)

ExitDefinition is called when production definition is exited.

func (*BaseTParserListener) ExitDocument

func (s *BaseTParserListener) ExitDocument(ctx *DocumentContext)

ExitDocument is called when production document is exited.

func (*BaseTParserListener) ExitEmbed_type_field

func (s *BaseTParserListener) ExitEmbed_type_field(ctx *Embed_type_fieldContext)

ExitEmbed_type_field is called when production embed_type_field is exited.

func (*BaseTParserListener) ExitEnum_def

func (s *BaseTParserListener) ExitEnum_def(ctx *Enum_defContext)

ExitEnum_def is called when production enum_def is exited.

func (*BaseTParserListener) ExitEnum_field

func (s *BaseTParserListener) ExitEnum_field(ctx *Enum_fieldContext)

ExitEnum_field is called when production enum_field is exited.

func (*BaseTParserListener) ExitEveryRule

func (s *BaseTParserListener) ExitEveryRule(ctx antlr.ParserRuleContext)

ExitEveryRule is called when any rule is exited.

func (*BaseTParserListener) ExitGeneric_type

func (s *BaseTParserListener) ExitGeneric_type(ctx *Generic_typeContext)

ExitGeneric_type is called when production generic_type is exited.

func (*BaseTParserListener) ExitKey_type

func (s *BaseTParserListener) ExitKey_type(ctx *Key_typeContext)

ExitKey_type is called when production key_type is exited.

func (*BaseTParserListener) ExitList_type

func (s *BaseTParserListener) ExitList_type(ctx *List_typeContext)

ExitList_type is called when production list_type is exited.

func (*BaseTParserListener) ExitMap_type

func (s *BaseTParserListener) ExitMap_type(ctx *Map_typeContext)

ExitMap_type is called when production map_type is exited.

func (*BaseTParserListener) ExitRpc_annotations

func (s *BaseTParserListener) ExitRpc_annotations(ctx *Rpc_annotationsContext)

ExitRpc_annotations is called when production rpc_annotations is exited.

func (*BaseTParserListener) ExitRpc_def

func (s *BaseTParserListener) ExitRpc_def(ctx *Rpc_defContext)

ExitRpc_def is called when production rpc_def is exited.

func (*BaseTParserListener) ExitRpc_req

func (s *BaseTParserListener) ExitRpc_req(ctx *Rpc_reqContext)

ExitRpc_req is called when production rpc_req is exited.

func (*BaseTParserListener) ExitRpc_resp

func (s *BaseTParserListener) ExitRpc_resp(ctx *Rpc_respContext)

ExitRpc_resp is called when production rpc_resp is exited.

func (*BaseTParserListener) ExitType_annotations

func (s *BaseTParserListener) ExitType_annotations(ctx *Type_annotationsContext)

ExitType_annotations is called when production type_annotations is exited.

func (*BaseTParserListener) ExitType_def

func (s *BaseTParserListener) ExitType_def(ctx *Type_defContext)

ExitType_def is called when production type_def is exited.

func (*BaseTParserListener) ExitType_field

func (s *BaseTParserListener) ExitType_field(ctx *Type_fieldContext)

ExitType_field is called when production type_field is exited.

func (*BaseTParserListener) ExitUser_type

func (s *BaseTParserListener) ExitUser_type(ctx *User_typeContext)

ExitUser_type is called when production user_type is exited.

func (*BaseTParserListener) ExitValue_type

func (s *BaseTParserListener) ExitValue_type(ctx *Value_typeContext)

ExitValue_type is called when production value_type is exited.

func (*BaseTParserListener) VisitErrorNode

func (s *BaseTParserListener) VisitErrorNode(node antlr.ErrorNode)

VisitErrorNode is called when an error node is visited.

func (*BaseTParserListener) VisitTerminal

func (s *BaseTParserListener) VisitTerminal(node antlr.TerminalNode)

VisitTerminal is called when a terminal node is visited.

type BaseType

type BaseType struct {
	Name     string // Type name
	Optional bool   // Whether the type is optional (nullable)
}

BaseType represents a primitive type (e.g., int, string, bool).

func (BaseType) Text

func (t BaseType) Text() string

type Base_typeContext

type Base_typeContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewBase_typeContext

func NewBase_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Base_typeContext

func NewEmptyBase_typeContext

func NewEmptyBase_typeContext() *Base_typeContext

func (*Base_typeContext) EnterRule

func (s *Base_typeContext) EnterRule(listener antlr.ParseTreeListener)

func (*Base_typeContext) ExitRule

func (s *Base_typeContext) ExitRule(listener antlr.ParseTreeListener)

func (*Base_typeContext) GetParser

func (s *Base_typeContext) GetParser() antlr.Parser

func (*Base_typeContext) GetRuleContext

func (s *Base_typeContext) GetRuleContext() antlr.RuleContext

func (*Base_typeContext) IsBase_typeContext

func (*Base_typeContext) IsBase_typeContext()

func (*Base_typeContext) QUESTION

func (s *Base_typeContext) QUESTION() antlr.TerminalNode

func (*Base_typeContext) TYPE_BOOL

func (s *Base_typeContext) TYPE_BOOL() antlr.TerminalNode

func (*Base_typeContext) TYPE_FLOAT

func (s *Base_typeContext) TYPE_FLOAT() antlr.TerminalNode

func (*Base_typeContext) TYPE_INT

func (s *Base_typeContext) TYPE_INT() antlr.TerminalNode

func (*Base_typeContext) TYPE_STRING

func (s *Base_typeContext) TYPE_STRING() antlr.TerminalNode

func (*Base_typeContext) ToStringTree

func (s *Base_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type BinaryType

type BinaryType struct{}

BinaryType represents the "binary" type (raw bytes).

func (BinaryType) MarshalText

func (t BinaryType) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler for BinaryType.

func (BinaryType) Text

func (t BinaryType) Text() string

type Comment

type Comment struct {
	Text     string
	Single   bool
	Position Position
}

Comment represents a single comment block or line. Single == true means it was parsed from a single-line comment (e.g. //). Single == false means it was parsed from a multi-line block comment (e.g. /* ... */).

type Comments

type Comments struct {
	Top   []Comment
	Right *Comment
}

Comments groups the two major comment placements:

  • Top: comments located above a declaration.
  • Right: comments located at the end of a declaration's line.

type Common_field_typeContext

type Common_field_typeContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewCommon_field_typeContext

func NewCommon_field_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Common_field_typeContext

func NewEmptyCommon_field_typeContext

func NewEmptyCommon_field_typeContext() *Common_field_typeContext

func (*Common_field_typeContext) Base_type

func (*Common_field_typeContext) Container_type

func (*Common_field_typeContext) EnterRule

func (s *Common_field_typeContext) EnterRule(listener antlr.ParseTreeListener)

func (*Common_field_typeContext) ExitRule

func (s *Common_field_typeContext) ExitRule(listener antlr.ParseTreeListener)

func (*Common_field_typeContext) GetParser

func (s *Common_field_typeContext) GetParser() antlr.Parser

func (*Common_field_typeContext) GetRuleContext

func (s *Common_field_typeContext) GetRuleContext() antlr.RuleContext

func (*Common_field_typeContext) IsCommon_field_typeContext

func (*Common_field_typeContext) IsCommon_field_typeContext()

func (*Common_field_typeContext) TYPE_ANY

func (s *Common_field_typeContext) TYPE_ANY() antlr.TerminalNode

func (*Common_field_typeContext) TYPE_BINARY

func (s *Common_field_typeContext) TYPE_BINARY() antlr.TerminalNode

func (*Common_field_typeContext) ToStringTree

func (s *Common_field_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

func (*Common_field_typeContext) User_type

type Common_type_fieldContext

type Common_type_fieldContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewCommon_type_fieldContext

func NewCommon_type_fieldContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Common_type_fieldContext

func NewEmptyCommon_type_fieldContext

func NewEmptyCommon_type_fieldContext() *Common_type_fieldContext

func (*Common_type_fieldContext) Common_field_type

func (s *Common_type_fieldContext) Common_field_type() ICommon_field_typeContext

func (*Common_type_fieldContext) Const_value

func (*Common_type_fieldContext) EQUAL

func (s *Common_type_fieldContext) EQUAL() antlr.TerminalNode

func (*Common_type_fieldContext) EnterRule

func (s *Common_type_fieldContext) EnterRule(listener antlr.ParseTreeListener)

func (*Common_type_fieldContext) ExitRule

func (s *Common_type_fieldContext) ExitRule(listener antlr.ParseTreeListener)

func (*Common_type_fieldContext) GetParser

func (s *Common_type_fieldContext) GetParser() antlr.Parser

func (*Common_type_fieldContext) GetRuleContext

func (s *Common_type_fieldContext) GetRuleContext() antlr.RuleContext

func (*Common_type_fieldContext) IDENTIFIER

func (s *Common_type_fieldContext) IDENTIFIER() antlr.TerminalNode

func (*Common_type_fieldContext) IsCommon_type_fieldContext

func (*Common_type_fieldContext) IsCommon_type_fieldContext()

func (*Common_type_fieldContext) ToStringTree

func (s *Common_type_fieldContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

func (*Common_type_fieldContext) Type_annotations

func (s *Common_type_fieldContext) Type_annotations() IType_annotationsContext

type Const

type Const struct {
	Type     string   // Data type of the constant
	Name     string   // Constant name
	Value    string   // Literal value
	Position Position // Location in source code
	Comments Comments // Associated comments
}

Const represents a constant definition in the parsed document.

type Const_defContext

type Const_defContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewConst_defContext

func NewConst_defContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Const_defContext

func NewEmptyConst_defContext

func NewEmptyConst_defContext() *Const_defContext

func (*Const_defContext) Const_type

func (s *Const_defContext) Const_type() IConst_typeContext

func (*Const_defContext) Const_value

func (s *Const_defContext) Const_value() IConst_valueContext

func (*Const_defContext) EQUAL

func (s *Const_defContext) EQUAL() antlr.TerminalNode

func (*Const_defContext) EnterRule

func (s *Const_defContext) EnterRule(listener antlr.ParseTreeListener)

func (*Const_defContext) ExitRule

func (s *Const_defContext) ExitRule(listener antlr.ParseTreeListener)

func (*Const_defContext) GetParser

func (s *Const_defContext) GetParser() antlr.Parser

func (*Const_defContext) GetRuleContext

func (s *Const_defContext) GetRuleContext() antlr.RuleContext

func (*Const_defContext) IDENTIFIER

func (s *Const_defContext) IDENTIFIER() antlr.TerminalNode

func (*Const_defContext) IsConst_defContext

func (*Const_defContext) IsConst_defContext()

func (*Const_defContext) KW_CONST

func (s *Const_defContext) KW_CONST() antlr.TerminalNode

func (*Const_defContext) ToStringTree

func (s *Const_defContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type Const_typeContext

type Const_typeContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewConst_typeContext

func NewConst_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Const_typeContext

func NewEmptyConst_typeContext

func NewEmptyConst_typeContext() *Const_typeContext

func (*Const_typeContext) EnterRule

func (s *Const_typeContext) EnterRule(listener antlr.ParseTreeListener)

func (*Const_typeContext) ExitRule

func (s *Const_typeContext) ExitRule(listener antlr.ParseTreeListener)

func (*Const_typeContext) GetParser

func (s *Const_typeContext) GetParser() antlr.Parser

func (*Const_typeContext) GetRuleContext

func (s *Const_typeContext) GetRuleContext() antlr.RuleContext

func (*Const_typeContext) IsConst_typeContext

func (*Const_typeContext) IsConst_typeContext()

func (*Const_typeContext) TYPE_BOOL

func (s *Const_typeContext) TYPE_BOOL() antlr.TerminalNode

func (*Const_typeContext) TYPE_FLOAT

func (s *Const_typeContext) TYPE_FLOAT() antlr.TerminalNode

func (*Const_typeContext) TYPE_INT

func (s *Const_typeContext) TYPE_INT() antlr.TerminalNode

func (*Const_typeContext) TYPE_STRING

func (s *Const_typeContext) TYPE_STRING() antlr.TerminalNode

func (*Const_typeContext) ToStringTree

func (s *Const_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type Const_valueContext

type Const_valueContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewConst_valueContext

func NewConst_valueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Const_valueContext

func NewEmptyConst_valueContext

func NewEmptyConst_valueContext() *Const_valueContext

func (*Const_valueContext) EnterRule

func (s *Const_valueContext) EnterRule(listener antlr.ParseTreeListener)

func (*Const_valueContext) ExitRule

func (s *Const_valueContext) ExitRule(listener antlr.ParseTreeListener)

func (*Const_valueContext) FLOAT

func (s *Const_valueContext) FLOAT() antlr.TerminalNode

func (*Const_valueContext) GetParser

func (s *Const_valueContext) GetParser() antlr.Parser

func (*Const_valueContext) GetRuleContext

func (s *Const_valueContext) GetRuleContext() antlr.RuleContext

func (*Const_valueContext) IDENTIFIER

func (s *Const_valueContext) IDENTIFIER() antlr.TerminalNode

func (*Const_valueContext) INTEGER

func (s *Const_valueContext) INTEGER() antlr.TerminalNode

func (*Const_valueContext) IsConst_valueContext

func (*Const_valueContext) IsConst_valueContext()

func (*Const_valueContext) KW_FALSE

func (s *Const_valueContext) KW_FALSE() antlr.TerminalNode

func (*Const_valueContext) KW_TRUE

func (s *Const_valueContext) KW_TRUE() antlr.TerminalNode

func (*Const_valueContext) STRING

func (s *Const_valueContext) STRING() antlr.TerminalNode

func (*Const_valueContext) ToStringTree

func (s *Const_valueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type Container_typeContext

type Container_typeContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewContainer_typeContext

func NewContainer_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Container_typeContext

func NewEmptyContainer_typeContext

func NewEmptyContainer_typeContext() *Container_typeContext

func (*Container_typeContext) EnterRule

func (s *Container_typeContext) EnterRule(listener antlr.ParseTreeListener)

func (*Container_typeContext) ExitRule

func (s *Container_typeContext) ExitRule(listener antlr.ParseTreeListener)

func (*Container_typeContext) GetParser

func (s *Container_typeContext) GetParser() antlr.Parser

func (*Container_typeContext) GetRuleContext

func (s *Container_typeContext) GetRuleContext() antlr.RuleContext

func (*Container_typeContext) IsContainer_typeContext

func (*Container_typeContext) IsContainer_typeContext()

func (*Container_typeContext) List_type

func (*Container_typeContext) Map_type

func (*Container_typeContext) ToStringTree

func (s *Container_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type DefinitionContext

type DefinitionContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewDefinitionContext

func NewDefinitionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DefinitionContext

func NewEmptyDefinitionContext

func NewEmptyDefinitionContext() *DefinitionContext

func (*DefinitionContext) Const_def

func (s *DefinitionContext) Const_def() IConst_defContext

func (*DefinitionContext) EnterRule

func (s *DefinitionContext) EnterRule(listener antlr.ParseTreeListener)

func (*DefinitionContext) Enum_def

func (s *DefinitionContext) Enum_def() IEnum_defContext

func (*DefinitionContext) ExitRule

func (s *DefinitionContext) ExitRule(listener antlr.ParseTreeListener)

func (*DefinitionContext) GetParser

func (s *DefinitionContext) GetParser() antlr.Parser

func (*DefinitionContext) GetRuleContext

func (s *DefinitionContext) GetRuleContext() antlr.RuleContext

func (*DefinitionContext) IsDefinitionContext

func (*DefinitionContext) IsDefinitionContext()

func (*DefinitionContext) Rpc_def

func (s *DefinitionContext) Rpc_def() IRpc_defContext

func (*DefinitionContext) ToStringTree

func (s *DefinitionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

func (*DefinitionContext) Type_def

func (s *DefinitionContext) Type_def() IType_defContext

type Document

type Document struct {
	Comments []Comment
	Consts   []Const
	Enums    []Enum
	Types    []Type
	RPCs     []RPC
}

Document represents the root node of the parsed file. It contains all top-level definitions such as constants, enums, types, and RPCs. Additionally, it stores any global comments that are not attached to specific nodes.

func Parse

func Parse(s string) (doc Document, err error)

Parse runs the parsing pipeline for the given input string.

type DocumentContext

type DocumentContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewDocumentContext

func NewDocumentContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DocumentContext

func NewEmptyDocumentContext

func NewEmptyDocumentContext() *DocumentContext

func (*DocumentContext) AllDefinition

func (s *DocumentContext) AllDefinition() []IDefinitionContext

func (*DocumentContext) Definition

func (s *DocumentContext) Definition(i int) IDefinitionContext

func (*DocumentContext) EOF

func (s *DocumentContext) EOF() antlr.TerminalNode

func (*DocumentContext) EnterRule

func (s *DocumentContext) EnterRule(listener antlr.ParseTreeListener)

func (*DocumentContext) ExitRule

func (s *DocumentContext) ExitRule(listener antlr.ParseTreeListener)

func (*DocumentContext) GetParser

func (s *DocumentContext) GetParser() antlr.Parser

func (*DocumentContext) GetRuleContext

func (s *DocumentContext) GetRuleContext() antlr.RuleContext

func (*DocumentContext) IsDocumentContext

func (*DocumentContext) IsDocumentContext()

func (*DocumentContext) ToStringTree

func (s *DocumentContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type EmbedType

type EmbedType struct {
	Name     string // Embedded type name
	Optional bool   // Whether the type is optional (nullable)
}

EmbedType represents an embedded type field (similar to composition in Go).

func (EmbedType) Text

func (t EmbedType) Text() string

type Embed_type_fieldContext

type Embed_type_fieldContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmbed_type_fieldContext

func NewEmbed_type_fieldContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Embed_type_fieldContext

func NewEmptyEmbed_type_fieldContext

func NewEmptyEmbed_type_fieldContext() *Embed_type_fieldContext

func (*Embed_type_fieldContext) EnterRule

func (s *Embed_type_fieldContext) EnterRule(listener antlr.ParseTreeListener)

func (*Embed_type_fieldContext) ExitRule

func (s *Embed_type_fieldContext) ExitRule(listener antlr.ParseTreeListener)

func (*Embed_type_fieldContext) GetParser

func (s *Embed_type_fieldContext) GetParser() antlr.Parser

func (*Embed_type_fieldContext) GetRuleContext

func (s *Embed_type_fieldContext) GetRuleContext() antlr.RuleContext

func (*Embed_type_fieldContext) IsEmbed_type_fieldContext

func (*Embed_type_fieldContext) IsEmbed_type_fieldContext()

func (*Embed_type_fieldContext) ToStringTree

func (s *Embed_type_fieldContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

func (*Embed_type_fieldContext) User_type

type Enum

type Enum struct {
	Name     string      // Enum name
	Fields   []EnumField // Enum fields
	Position Position    // Location in source code
	Comments Comments    // Associated comments
}

Enum represents an enum type definition.

type EnumField

type EnumField struct {
	Name     string   // Field name
	Value    int64    // Enum constant value
	Position Position // Location in source code
	Comments Comments // Associated comments
}

EnumField represents a single field inside an enum definition.

type Enum_defContext

type Enum_defContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyEnum_defContext

func NewEmptyEnum_defContext() *Enum_defContext

func NewEnum_defContext

func NewEnum_defContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Enum_defContext

func (*Enum_defContext) AllEnum_field

func (s *Enum_defContext) AllEnum_field() []IEnum_fieldContext

func (*Enum_defContext) EnterRule

func (s *Enum_defContext) EnterRule(listener antlr.ParseTreeListener)

func (*Enum_defContext) Enum_field

func (s *Enum_defContext) Enum_field(i int) IEnum_fieldContext

func (*Enum_defContext) ExitRule

func (s *Enum_defContext) ExitRule(listener antlr.ParseTreeListener)

func (*Enum_defContext) GetParser

func (s *Enum_defContext) GetParser() antlr.Parser

func (*Enum_defContext) GetRuleContext

func (s *Enum_defContext) GetRuleContext() antlr.RuleContext

func (*Enum_defContext) IDENTIFIER

func (s *Enum_defContext) IDENTIFIER() antlr.TerminalNode

func (*Enum_defContext) IsEnum_defContext

func (*Enum_defContext) IsEnum_defContext()

func (*Enum_defContext) KW_ENUM

func (s *Enum_defContext) KW_ENUM() antlr.TerminalNode

func (*Enum_defContext) LEFT_BRACE

func (s *Enum_defContext) LEFT_BRACE() antlr.TerminalNode

func (*Enum_defContext) RIGHT_BRACE

func (s *Enum_defContext) RIGHT_BRACE() antlr.TerminalNode

func (*Enum_defContext) ToStringTree

func (s *Enum_defContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type Enum_fieldContext

type Enum_fieldContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyEnum_fieldContext

func NewEmptyEnum_fieldContext() *Enum_fieldContext

func NewEnum_fieldContext

func NewEnum_fieldContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Enum_fieldContext

func (*Enum_fieldContext) EQUAL

func (s *Enum_fieldContext) EQUAL() antlr.TerminalNode

func (*Enum_fieldContext) EnterRule

func (s *Enum_fieldContext) EnterRule(listener antlr.ParseTreeListener)

func (*Enum_fieldContext) ExitRule

func (s *Enum_fieldContext) ExitRule(listener antlr.ParseTreeListener)

func (*Enum_fieldContext) GetParser

func (s *Enum_fieldContext) GetParser() antlr.Parser

func (*Enum_fieldContext) GetRuleContext

func (s *Enum_fieldContext) GetRuleContext() antlr.RuleContext

func (*Enum_fieldContext) IDENTIFIER

func (s *Enum_fieldContext) IDENTIFIER() antlr.TerminalNode

func (*Enum_fieldContext) INTEGER

func (s *Enum_fieldContext) INTEGER() antlr.TerminalNode

func (*Enum_fieldContext) IsEnum_fieldContext

func (*Enum_fieldContext) IsEnum_fieldContext()

func (*Enum_fieldContext) ToStringTree

func (s *Enum_fieldContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type ErrorListener

type ErrorListener struct {
	*antlr.DefaultErrorListener
	// contains filtered or unexported fields
}

ErrorListener implements a custom ANTLR error listener.

func (*ErrorListener) SyntaxError

func (l *ErrorListener) SyntaxError(_ antlr.Recognizer, _ any, line, column int, msg string, e antlr.RecognitionException)

SyntaxError is called by ANTLR when a syntax error is encountered.

type Generic_typeContext

type Generic_typeContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyGeneric_typeContext

func NewEmptyGeneric_typeContext() *Generic_typeContext

func NewGeneric_typeContext

func NewGeneric_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Generic_typeContext

func (*Generic_typeContext) Base_type

func (s *Generic_typeContext) Base_type() IBase_typeContext

func (*Generic_typeContext) Container_type

func (s *Generic_typeContext) Container_type() IContainer_typeContext

func (*Generic_typeContext) EnterRule

func (s *Generic_typeContext) EnterRule(listener antlr.ParseTreeListener)

func (*Generic_typeContext) ExitRule

func (s *Generic_typeContext) ExitRule(listener antlr.ParseTreeListener)

func (*Generic_typeContext) GetParser

func (s *Generic_typeContext) GetParser() antlr.Parser

func (*Generic_typeContext) GetRuleContext

func (s *Generic_typeContext) GetRuleContext() antlr.RuleContext

func (*Generic_typeContext) IsGeneric_typeContext

func (*Generic_typeContext) IsGeneric_typeContext()

func (*Generic_typeContext) ToStringTree

func (s *Generic_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

func (*Generic_typeContext) User_type

func (s *Generic_typeContext) User_type() IUser_typeContext

type IAnnotationContext

type IAnnotationContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	IDENTIFIER() antlr.TerminalNode
	EQUAL() antlr.TerminalNode
	Const_value() IConst_valueContext

	// IsAnnotationContext differentiates from other interfaces.
	IsAnnotationContext()
}

IAnnotationContext is an interface to support dynamic dispatch.

type IBase_typeContext

type IBase_typeContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	TYPE_BOOL() antlr.TerminalNode
	TYPE_INT() antlr.TerminalNode
	TYPE_FLOAT() antlr.TerminalNode
	TYPE_STRING() antlr.TerminalNode
	QUESTION() antlr.TerminalNode

	// IsBase_typeContext differentiates from other interfaces.
	IsBase_typeContext()
}

IBase_typeContext is an interface to support dynamic dispatch.

type ICommon_field_typeContext

type ICommon_field_typeContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	TYPE_ANY() antlr.TerminalNode
	Base_type() IBase_typeContext
	User_type() IUser_typeContext
	Container_type() IContainer_typeContext
	TYPE_BINARY() antlr.TerminalNode

	// IsCommon_field_typeContext differentiates from other interfaces.
	IsCommon_field_typeContext()
}

ICommon_field_typeContext is an interface to support dynamic dispatch.

type ICommon_type_fieldContext

type ICommon_type_fieldContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	Common_field_type() ICommon_field_typeContext
	IDENTIFIER() antlr.TerminalNode
	EQUAL() antlr.TerminalNode
	Const_value() IConst_valueContext
	Type_annotations() IType_annotationsContext

	// IsCommon_type_fieldContext differentiates from other interfaces.
	IsCommon_type_fieldContext()
}

ICommon_type_fieldContext is an interface to support dynamic dispatch.

type IConst_defContext

type IConst_defContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	KW_CONST() antlr.TerminalNode
	Const_type() IConst_typeContext
	IDENTIFIER() antlr.TerminalNode
	EQUAL() antlr.TerminalNode
	Const_value() IConst_valueContext

	// IsConst_defContext differentiates from other interfaces.
	IsConst_defContext()
}

IConst_defContext is an interface to support dynamic dispatch.

type IConst_typeContext

type IConst_typeContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	TYPE_BOOL() antlr.TerminalNode
	TYPE_INT() antlr.TerminalNode
	TYPE_FLOAT() antlr.TerminalNode
	TYPE_STRING() antlr.TerminalNode

	// IsConst_typeContext differentiates from other interfaces.
	IsConst_typeContext()
}

IConst_typeContext is an interface to support dynamic dispatch.

type IConst_valueContext

type IConst_valueContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	KW_TRUE() antlr.TerminalNode
	KW_FALSE() antlr.TerminalNode
	INTEGER() antlr.TerminalNode
	FLOAT() antlr.TerminalNode
	STRING() antlr.TerminalNode
	IDENTIFIER() antlr.TerminalNode

	// IsConst_valueContext differentiates from other interfaces.
	IsConst_valueContext()
}

IConst_valueContext is an interface to support dynamic dispatch.

type IContainer_typeContext

type IContainer_typeContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	Map_type() IMap_typeContext
	List_type() IList_typeContext

	// IsContainer_typeContext differentiates from other interfaces.
	IsContainer_typeContext()
}

IContainer_typeContext is an interface to support dynamic dispatch.

type IDefinitionContext

type IDefinitionContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	Const_def() IConst_defContext
	Enum_def() IEnum_defContext
	Type_def() IType_defContext
	Rpc_def() IRpc_defContext

	// IsDefinitionContext differentiates from other interfaces.
	IsDefinitionContext()
}

IDefinitionContext is an interface to support dynamic dispatch.

type IDocumentContext

type IDocumentContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	EOF() antlr.TerminalNode
	AllDefinition() []IDefinitionContext
	Definition(i int) IDefinitionContext

	// IsDocumentContext differentiates from other interfaces.
	IsDocumentContext()
}

IDocumentContext is an interface to support dynamic dispatch.

type IEmbed_type_fieldContext

type IEmbed_type_fieldContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	User_type() IUser_typeContext

	// IsEmbed_type_fieldContext differentiates from other interfaces.
	IsEmbed_type_fieldContext()
}

IEmbed_type_fieldContext is an interface to support dynamic dispatch.

type IEnum_defContext

type IEnum_defContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	KW_ENUM() antlr.TerminalNode
	IDENTIFIER() antlr.TerminalNode
	LEFT_BRACE() antlr.TerminalNode
	RIGHT_BRACE() antlr.TerminalNode
	AllEnum_field() []IEnum_fieldContext
	Enum_field(i int) IEnum_fieldContext

	// IsEnum_defContext differentiates from other interfaces.
	IsEnum_defContext()
}

IEnum_defContext is an interface to support dynamic dispatch.

type IEnum_fieldContext

type IEnum_fieldContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	IDENTIFIER() antlr.TerminalNode
	EQUAL() antlr.TerminalNode
	INTEGER() antlr.TerminalNode

	// IsEnum_fieldContext differentiates from other interfaces.
	IsEnum_fieldContext()
}

IEnum_fieldContext is an interface to support dynamic dispatch.

type IGeneric_typeContext

type IGeneric_typeContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	Base_type() IBase_typeContext
	User_type() IUser_typeContext
	Container_type() IContainer_typeContext

	// IsGeneric_typeContext differentiates from other interfaces.
	IsGeneric_typeContext()
}

IGeneric_typeContext is an interface to support dynamic dispatch.

type IKey_typeContext

type IKey_typeContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	TYPE_STRING() antlr.TerminalNode
	TYPE_INT() antlr.TerminalNode

	// IsKey_typeContext differentiates from other interfaces.
	IsKey_typeContext()
}

IKey_typeContext is an interface to support dynamic dispatch.

type IList_typeContext

type IList_typeContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	TYPE_LIST() antlr.TerminalNode
	LESS_THAN() antlr.TerminalNode
	Value_type() IValue_typeContext
	GREATER_THAN() antlr.TerminalNode

	// IsList_typeContext differentiates from other interfaces.
	IsList_typeContext()
}

IList_typeContext is an interface to support dynamic dispatch.

type IMap_typeContext

type IMap_typeContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	TYPE_MAP() antlr.TerminalNode
	LESS_THAN() antlr.TerminalNode
	Key_type() IKey_typeContext
	COMMA() antlr.TerminalNode
	Value_type() IValue_typeContext
	GREATER_THAN() antlr.TerminalNode

	// IsMap_typeContext differentiates from other interfaces.
	IsMap_typeContext()
}

IMap_typeContext is an interface to support dynamic dispatch.

type IRpc_annotationsContext

type IRpc_annotationsContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	LEFT_BRACE() antlr.TerminalNode
	RIGHT_BRACE() antlr.TerminalNode
	AllAnnotation() []IAnnotationContext
	Annotation(i int) IAnnotationContext

	// IsRpc_annotationsContext differentiates from other interfaces.
	IsRpc_annotationsContext()
}

IRpc_annotationsContext is an interface to support dynamic dispatch.

type IRpc_defContext

type IRpc_defContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	KW_RPC() antlr.TerminalNode
	IDENTIFIER() antlr.TerminalNode
	LEFT_PAREN() antlr.TerminalNode
	Rpc_req() IRpc_reqContext
	RIGHT_PAREN() antlr.TerminalNode
	Rpc_resp() IRpc_respContext
	Rpc_annotations() IRpc_annotationsContext

	// IsRpc_defContext differentiates from other interfaces.
	IsRpc_defContext()
}

IRpc_defContext is an interface to support dynamic dispatch.

type IRpc_reqContext

type IRpc_reqContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	IDENTIFIER() antlr.TerminalNode

	// IsRpc_reqContext differentiates from other interfaces.
	IsRpc_reqContext()
}

IRpc_reqContext is an interface to support dynamic dispatch.

type IRpc_respContext

type IRpc_respContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	IDENTIFIER() antlr.TerminalNode
	TYPE_STREAM() antlr.TerminalNode
	LESS_THAN() antlr.TerminalNode
	User_type() IUser_typeContext
	GREATER_THAN() antlr.TerminalNode

	// IsRpc_respContext differentiates from other interfaces.
	IsRpc_respContext()
}

IRpc_respContext is an interface to support dynamic dispatch.

type IType_annotationsContext

type IType_annotationsContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	LEFT_PAREN() antlr.TerminalNode
	AllAnnotation() []IAnnotationContext
	Annotation(i int) IAnnotationContext
	RIGHT_PAREN() antlr.TerminalNode
	AllCOMMA() []antlr.TerminalNode
	COMMA(i int) antlr.TerminalNode

	// IsType_annotationsContext differentiates from other interfaces.
	IsType_annotationsContext()
}

IType_annotationsContext is an interface to support dynamic dispatch.

type IType_defContext

type IType_defContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	KW_TYPE() antlr.TerminalNode
	AllIDENTIFIER() []antlr.TerminalNode
	IDENTIFIER(i int) antlr.TerminalNode
	LEFT_BRACE() antlr.TerminalNode
	RIGHT_BRACE() antlr.TerminalNode
	LESS_THAN() antlr.TerminalNode
	GREATER_THAN() antlr.TerminalNode
	AllType_field() []IType_fieldContext
	Type_field(i int) IType_fieldContext
	Generic_type() IGeneric_typeContext

	// IsType_defContext differentiates from other interfaces.
	IsType_defContext()
}

IType_defContext is an interface to support dynamic dispatch.

type IType_fieldContext

type IType_fieldContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	Common_type_field() ICommon_type_fieldContext
	Embed_type_field() IEmbed_type_fieldContext

	// IsType_fieldContext differentiates from other interfaces.
	IsType_fieldContext()
}

IType_fieldContext is an interface to support dynamic dispatch.

type IUser_typeContext

type IUser_typeContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	IDENTIFIER() antlr.TerminalNode
	QUESTION() antlr.TerminalNode

	// IsUser_typeContext differentiates from other interfaces.
	IsUser_typeContext()
}

IUser_typeContext is an interface to support dynamic dispatch.

type IValue_typeContext

type IValue_typeContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// Getter signatures
	Base_type() IBase_typeContext
	User_type() IUser_typeContext
	Container_type() IContainer_typeContext

	// IsValue_typeContext differentiates from other interfaces.
	IsValue_typeContext()
}

IValue_typeContext is an interface to support dynamic dispatch.

type Key_typeContext

type Key_typeContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyKey_typeContext

func NewEmptyKey_typeContext() *Key_typeContext

func NewKey_typeContext

func NewKey_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Key_typeContext

func (*Key_typeContext) EnterRule

func (s *Key_typeContext) EnterRule(listener antlr.ParseTreeListener)

func (*Key_typeContext) ExitRule

func (s *Key_typeContext) ExitRule(listener antlr.ParseTreeListener)

func (*Key_typeContext) GetParser

func (s *Key_typeContext) GetParser() antlr.Parser

func (*Key_typeContext) GetRuleContext

func (s *Key_typeContext) GetRuleContext() antlr.RuleContext

func (*Key_typeContext) IsKey_typeContext

func (*Key_typeContext) IsKey_typeContext()

func (*Key_typeContext) TYPE_INT

func (s *Key_typeContext) TYPE_INT() antlr.TerminalNode

func (*Key_typeContext) TYPE_STRING

func (s *Key_typeContext) TYPE_STRING() antlr.TerminalNode

func (*Key_typeContext) ToStringTree

func (s *Key_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type ListType

type ListType struct {
	Item TypeDefinition // Element type
}

ListType represents a list container type (list<T>).

func (ListType) Text

func (t ListType) Text() string

type List_typeContext

type List_typeContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyList_typeContext

func NewEmptyList_typeContext() *List_typeContext

func NewList_typeContext

func NewList_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *List_typeContext

func (*List_typeContext) EnterRule

func (s *List_typeContext) EnterRule(listener antlr.ParseTreeListener)

func (*List_typeContext) ExitRule

func (s *List_typeContext) ExitRule(listener antlr.ParseTreeListener)

func (*List_typeContext) GREATER_THAN

func (s *List_typeContext) GREATER_THAN() antlr.TerminalNode

func (*List_typeContext) GetParser

func (s *List_typeContext) GetParser() antlr.Parser

func (*List_typeContext) GetRuleContext

func (s *List_typeContext) GetRuleContext() antlr.RuleContext

func (*List_typeContext) IsList_typeContext

func (*List_typeContext) IsList_typeContext()

func (*List_typeContext) LESS_THAN

func (s *List_typeContext) LESS_THAN() antlr.TerminalNode

func (*List_typeContext) TYPE_LIST

func (s *List_typeContext) TYPE_LIST() antlr.TerminalNode

func (*List_typeContext) ToStringTree

func (s *List_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

func (*List_typeContext) Value_type

func (s *List_typeContext) Value_type() IValue_typeContext

type MapType

type MapType struct {
	Key   string         // Key type
	Value TypeDefinition // Value type
}

MapType represents a key-value container type (map<K,V>).

func (MapType) Text

func (t MapType) Text() string

type Map_typeContext

type Map_typeContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyMap_typeContext

func NewEmptyMap_typeContext() *Map_typeContext

func NewMap_typeContext

func NewMap_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Map_typeContext

func (*Map_typeContext) COMMA

func (s *Map_typeContext) COMMA() antlr.TerminalNode

func (*Map_typeContext) EnterRule

func (s *Map_typeContext) EnterRule(listener antlr.ParseTreeListener)

func (*Map_typeContext) ExitRule

func (s *Map_typeContext) ExitRule(listener antlr.ParseTreeListener)

func (*Map_typeContext) GREATER_THAN

func (s *Map_typeContext) GREATER_THAN() antlr.TerminalNode

func (*Map_typeContext) GetParser

func (s *Map_typeContext) GetParser() antlr.Parser

func (*Map_typeContext) GetRuleContext

func (s *Map_typeContext) GetRuleContext() antlr.RuleContext

func (*Map_typeContext) IsMap_typeContext

func (*Map_typeContext) IsMap_typeContext()

func (*Map_typeContext) Key_type

func (s *Map_typeContext) Key_type() IKey_typeContext

func (*Map_typeContext) LESS_THAN

func (s *Map_typeContext) LESS_THAN() antlr.TerminalNode

func (*Map_typeContext) TYPE_MAP

func (s *Map_typeContext) TYPE_MAP() antlr.TerminalNode

func (*Map_typeContext) ToStringTree

func (s *Map_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

func (*Map_typeContext) Value_type

func (s *Map_typeContext) Value_type() IValue_typeContext

type MetaInfo

type MetaInfo struct {
	Name    string         `json:"name"`
	Version string         `json:"version"`
	Config  map[string]any `json:"config"`
}

MetaInfo represents metadata about the parsed document. It contains information about the document's metadata, such as its name, version, and configuration.

func ParseMeta

func ParseMeta(s string) (*MetaInfo, error)

ParseMeta parses meta information from the given input string.

type ParseTreeListener

type ParseTreeListener struct {
	BaseTParserListener
	Tokens   *antlr.CommonTokenStream
	Document Document

	// Attached stores lines that already have "right-side" comments
	// to prevent re-using them as "top" comments.
	Attached map[int]struct{}
}

ParseTreeListener extends the auto-generated base listener. It captures parsed constructs (const, enum, type, rpc, etc.) and collects associated comments.

func (*ParseTreeListener) ExitConst_def

func (l *ParseTreeListener) ExitConst_def(ctx *Const_defContext)

ExitConst_def handles const definitions in the parse tree.

func (*ParseTreeListener) ExitEnum_def

func (l *ParseTreeListener) ExitEnum_def(ctx *Enum_defContext)

ExitEnum_def handles enum definitions and their fields.

func (*ParseTreeListener) ExitRpc_def

func (l *ParseTreeListener) ExitRpc_def(ctx *Rpc_defContext)

ExitRpc_def handles RPC definitions, including request/response types and annotations.

func (*ParseTreeListener) ExitType_def

func (l *ParseTreeListener) ExitType_def(ctx *Type_defContext)

ExitType_def handles type definitions, including generic parameters, fields, and annotations.

type Position

type Position struct {
	Start int
	Stop  int
}

Position represents the start and stop line numbers of a parsed element. This allows tracing back to the original source code location.

type RPC

type RPC struct {
	Name        string       // RPC name
	Request     string       // Request type (raw string)
	Response    RespType     // Response type
	Annotations []Annotation // RPC annotations (metadata)
	Position    Position     // Location in source code
	Comments    Comments     // Associated comments
}

RPC represents a remote procedure call definition.

type RedefinedType

type RedefinedType struct {
	Name        string
	GenericType TypeDefinition
}

func (RedefinedType) Text

func (t RedefinedType) Text() string

type RespType

type RespType struct {
	Stream   bool   // Whether the response is a stream
	TypeName string // Base type name
	UserType *UserType
}

RespType represents the response type of an RPC. It supports both streaming and generic forms.

func (RespType) Text

func (t RespType) Text() string

Text returns a human-readable representation of the response type.

type Rpc_annotationsContext

type Rpc_annotationsContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyRpc_annotationsContext

func NewEmptyRpc_annotationsContext() *Rpc_annotationsContext

func NewRpc_annotationsContext

func NewRpc_annotationsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Rpc_annotationsContext

func (*Rpc_annotationsContext) AllAnnotation

func (s *Rpc_annotationsContext) AllAnnotation() []IAnnotationContext

func (*Rpc_annotationsContext) Annotation

func (*Rpc_annotationsContext) EnterRule

func (s *Rpc_annotationsContext) EnterRule(listener antlr.ParseTreeListener)

func (*Rpc_annotationsContext) ExitRule

func (s *Rpc_annotationsContext) ExitRule(listener antlr.ParseTreeListener)

func (*Rpc_annotationsContext) GetParser

func (s *Rpc_annotationsContext) GetParser() antlr.Parser

func (*Rpc_annotationsContext) GetRuleContext

func (s *Rpc_annotationsContext) GetRuleContext() antlr.RuleContext

func (*Rpc_annotationsContext) IsRpc_annotationsContext

func (*Rpc_annotationsContext) IsRpc_annotationsContext()

func (*Rpc_annotationsContext) LEFT_BRACE

func (s *Rpc_annotationsContext) LEFT_BRACE() antlr.TerminalNode

func (*Rpc_annotationsContext) RIGHT_BRACE

func (s *Rpc_annotationsContext) RIGHT_BRACE() antlr.TerminalNode

func (*Rpc_annotationsContext) ToStringTree

func (s *Rpc_annotationsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type Rpc_defContext

type Rpc_defContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyRpc_defContext

func NewEmptyRpc_defContext() *Rpc_defContext

func NewRpc_defContext

func NewRpc_defContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Rpc_defContext

func (*Rpc_defContext) EnterRule

func (s *Rpc_defContext) EnterRule(listener antlr.ParseTreeListener)

func (*Rpc_defContext) ExitRule

func (s *Rpc_defContext) ExitRule(listener antlr.ParseTreeListener)

func (*Rpc_defContext) GetParser

func (s *Rpc_defContext) GetParser() antlr.Parser

func (*Rpc_defContext) GetRuleContext

func (s *Rpc_defContext) GetRuleContext() antlr.RuleContext

func (*Rpc_defContext) IDENTIFIER

func (s *Rpc_defContext) IDENTIFIER() antlr.TerminalNode

func (*Rpc_defContext) IsRpc_defContext

func (*Rpc_defContext) IsRpc_defContext()

func (*Rpc_defContext) KW_RPC

func (s *Rpc_defContext) KW_RPC() antlr.TerminalNode

func (*Rpc_defContext) LEFT_PAREN

func (s *Rpc_defContext) LEFT_PAREN() antlr.TerminalNode

func (*Rpc_defContext) RIGHT_PAREN

func (s *Rpc_defContext) RIGHT_PAREN() antlr.TerminalNode

func (*Rpc_defContext) Rpc_annotations

func (s *Rpc_defContext) Rpc_annotations() IRpc_annotationsContext

func (*Rpc_defContext) Rpc_req

func (s *Rpc_defContext) Rpc_req() IRpc_reqContext

func (*Rpc_defContext) Rpc_resp

func (s *Rpc_defContext) Rpc_resp() IRpc_respContext

func (*Rpc_defContext) ToStringTree

func (s *Rpc_defContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type Rpc_reqContext

type Rpc_reqContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyRpc_reqContext

func NewEmptyRpc_reqContext() *Rpc_reqContext

func NewRpc_reqContext

func NewRpc_reqContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Rpc_reqContext

func (*Rpc_reqContext) EnterRule

func (s *Rpc_reqContext) EnterRule(listener antlr.ParseTreeListener)

func (*Rpc_reqContext) ExitRule

func (s *Rpc_reqContext) ExitRule(listener antlr.ParseTreeListener)

func (*Rpc_reqContext) GetParser

func (s *Rpc_reqContext) GetParser() antlr.Parser

func (*Rpc_reqContext) GetRuleContext

func (s *Rpc_reqContext) GetRuleContext() antlr.RuleContext

func (*Rpc_reqContext) IDENTIFIER

func (s *Rpc_reqContext) IDENTIFIER() antlr.TerminalNode

func (*Rpc_reqContext) IsRpc_reqContext

func (*Rpc_reqContext) IsRpc_reqContext()

func (*Rpc_reqContext) ToStringTree

func (s *Rpc_reqContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type Rpc_respContext

type Rpc_respContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyRpc_respContext

func NewEmptyRpc_respContext() *Rpc_respContext

func NewRpc_respContext

func NewRpc_respContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Rpc_respContext

func (*Rpc_respContext) EnterRule

func (s *Rpc_respContext) EnterRule(listener antlr.ParseTreeListener)

func (*Rpc_respContext) ExitRule

func (s *Rpc_respContext) ExitRule(listener antlr.ParseTreeListener)

func (*Rpc_respContext) GREATER_THAN

func (s *Rpc_respContext) GREATER_THAN() antlr.TerminalNode

func (*Rpc_respContext) GetParser

func (s *Rpc_respContext) GetParser() antlr.Parser

func (*Rpc_respContext) GetRuleContext

func (s *Rpc_respContext) GetRuleContext() antlr.RuleContext

func (*Rpc_respContext) IDENTIFIER

func (s *Rpc_respContext) IDENTIFIER() antlr.TerminalNode

func (*Rpc_respContext) IsRpc_respContext

func (*Rpc_respContext) IsRpc_respContext()

func (*Rpc_respContext) LESS_THAN

func (s *Rpc_respContext) LESS_THAN() antlr.TerminalNode

func (*Rpc_respContext) TYPE_STREAM

func (s *Rpc_respContext) TYPE_STREAM() antlr.TerminalNode

func (*Rpc_respContext) ToStringTree

func (s *Rpc_respContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

func (*Rpc_respContext) User_type

func (s *Rpc_respContext) User_type() IUser_typeContext

type TLexer

type TLexer struct {
	*antlr.BaseLexer
	// contains filtered or unexported fields
}

func NewTLexer

func NewTLexer(input antlr.CharStream) *TLexer

NewTLexer produces a new lexer instance for the optional input antlr.CharStream.

type TParser

type TParser struct {
	*antlr.BaseParser
}

func NewTParser

func NewTParser(input antlr.TokenStream) *TParser

NewTParser produces a new parser instance for the optional input antlr.TokenStream.

func (*TParser) Annotation

func (p *TParser) Annotation() (localctx IAnnotationContext)

func (*TParser) Base_type

func (p *TParser) Base_type() (localctx IBase_typeContext)

func (*TParser) Common_field_type

func (p *TParser) Common_field_type() (localctx ICommon_field_typeContext)

func (*TParser) Common_type_field

func (p *TParser) Common_type_field() (localctx ICommon_type_fieldContext)

func (*TParser) Const_def

func (p *TParser) Const_def() (localctx IConst_defContext)

func (*TParser) Const_type

func (p *TParser) Const_type() (localctx IConst_typeContext)

func (*TParser) Const_value

func (p *TParser) Const_value() (localctx IConst_valueContext)

func (*TParser) Container_type

func (p *TParser) Container_type() (localctx IContainer_typeContext)

func (*TParser) Definition

func (p *TParser) Definition() (localctx IDefinitionContext)

func (*TParser) Document

func (p *TParser) Document() (localctx IDocumentContext)

func (*TParser) Embed_type_field

func (p *TParser) Embed_type_field() (localctx IEmbed_type_fieldContext)

func (*TParser) Enum_def

func (p *TParser) Enum_def() (localctx IEnum_defContext)

func (*TParser) Enum_field

func (p *TParser) Enum_field() (localctx IEnum_fieldContext)

func (*TParser) Generic_type

func (p *TParser) Generic_type() (localctx IGeneric_typeContext)

func (*TParser) Key_type

func (p *TParser) Key_type() (localctx IKey_typeContext)

func (*TParser) List_type

func (p *TParser) List_type() (localctx IList_typeContext)

func (*TParser) Map_type

func (p *TParser) Map_type() (localctx IMap_typeContext)

func (*TParser) Rpc_annotations

func (p *TParser) Rpc_annotations() (localctx IRpc_annotationsContext)

func (*TParser) Rpc_def

func (p *TParser) Rpc_def() (localctx IRpc_defContext)

func (*TParser) Rpc_req

func (p *TParser) Rpc_req() (localctx IRpc_reqContext)

func (*TParser) Rpc_resp

func (p *TParser) Rpc_resp() (localctx IRpc_respContext)

func (*TParser) Type_annotations

func (p *TParser) Type_annotations() (localctx IType_annotationsContext)

func (*TParser) Type_def

func (p *TParser) Type_def() (localctx IType_defContext)

func (*TParser) Type_field

func (p *TParser) Type_field() (localctx IType_fieldContext)

func (*TParser) User_type

func (p *TParser) User_type() (localctx IUser_typeContext)

func (*TParser) Value_type

func (p *TParser) Value_type() (localctx IValue_typeContext)

type TParserListener

type TParserListener interface {
	antlr.ParseTreeListener

	// EnterDocument is called when entering the document production.
	EnterDocument(c *DocumentContext)

	// EnterDefinition is called when entering the definition production.
	EnterDefinition(c *DefinitionContext)

	// EnterConst_def is called when entering the const_def production.
	EnterConst_def(c *Const_defContext)

	// EnterConst_type is called when entering the const_type production.
	EnterConst_type(c *Const_typeContext)

	// EnterEnum_def is called when entering the enum_def production.
	EnterEnum_def(c *Enum_defContext)

	// EnterEnum_field is called when entering the enum_field production.
	EnterEnum_field(c *Enum_fieldContext)

	// EnterType_def is called when entering the type_def production.
	EnterType_def(c *Type_defContext)

	// EnterType_field is called when entering the type_field production.
	EnterType_field(c *Type_fieldContext)

	// EnterEmbed_type_field is called when entering the embed_type_field production.
	EnterEmbed_type_field(c *Embed_type_fieldContext)

	// EnterCommon_type_field is called when entering the common_type_field production.
	EnterCommon_type_field(c *Common_type_fieldContext)

	// EnterCommon_field_type is called when entering the common_field_type production.
	EnterCommon_field_type(c *Common_field_typeContext)

	// EnterGeneric_type is called when entering the generic_type production.
	EnterGeneric_type(c *Generic_typeContext)

	// EnterType_annotations is called when entering the type_annotations production.
	EnterType_annotations(c *Type_annotationsContext)

	// EnterRpc_def is called when entering the rpc_def production.
	EnterRpc_def(c *Rpc_defContext)

	// EnterRpc_req is called when entering the rpc_req production.
	EnterRpc_req(c *Rpc_reqContext)

	// EnterRpc_resp is called when entering the rpc_resp production.
	EnterRpc_resp(c *Rpc_respContext)

	// EnterRpc_annotations is called when entering the rpc_annotations production.
	EnterRpc_annotations(c *Rpc_annotationsContext)

	// EnterAnnotation is called when entering the annotation production.
	EnterAnnotation(c *AnnotationContext)

	// EnterBase_type is called when entering the base_type production.
	EnterBase_type(c *Base_typeContext)

	// EnterUser_type is called when entering the user_type production.
	EnterUser_type(c *User_typeContext)

	// EnterContainer_type is called when entering the container_type production.
	EnterContainer_type(c *Container_typeContext)

	// EnterMap_type is called when entering the map_type production.
	EnterMap_type(c *Map_typeContext)

	// EnterKey_type is called when entering the key_type production.
	EnterKey_type(c *Key_typeContext)

	// EnterList_type is called when entering the list_type production.
	EnterList_type(c *List_typeContext)

	// EnterValue_type is called when entering the value_type production.
	EnterValue_type(c *Value_typeContext)

	// EnterConst_value is called when entering the const_value production.
	EnterConst_value(c *Const_valueContext)

	// ExitDocument is called when exiting the document production.
	ExitDocument(c *DocumentContext)

	// ExitDefinition is called when exiting the definition production.
	ExitDefinition(c *DefinitionContext)

	// ExitConst_def is called when exiting the const_def production.
	ExitConst_def(c *Const_defContext)

	// ExitConst_type is called when exiting the const_type production.
	ExitConst_type(c *Const_typeContext)

	// ExitEnum_def is called when exiting the enum_def production.
	ExitEnum_def(c *Enum_defContext)

	// ExitEnum_field is called when exiting the enum_field production.
	ExitEnum_field(c *Enum_fieldContext)

	// ExitType_def is called when exiting the type_def production.
	ExitType_def(c *Type_defContext)

	// ExitType_field is called when exiting the type_field production.
	ExitType_field(c *Type_fieldContext)

	// ExitEmbed_type_field is called when exiting the embed_type_field production.
	ExitEmbed_type_field(c *Embed_type_fieldContext)

	// ExitCommon_type_field is called when exiting the common_type_field production.
	ExitCommon_type_field(c *Common_type_fieldContext)

	// ExitCommon_field_type is called when exiting the common_field_type production.
	ExitCommon_field_type(c *Common_field_typeContext)

	// ExitGeneric_type is called when exiting the generic_type production.
	ExitGeneric_type(c *Generic_typeContext)

	// ExitType_annotations is called when exiting the type_annotations production.
	ExitType_annotations(c *Type_annotationsContext)

	// ExitRpc_def is called when exiting the rpc_def production.
	ExitRpc_def(c *Rpc_defContext)

	// ExitRpc_req is called when exiting the rpc_req production.
	ExitRpc_req(c *Rpc_reqContext)

	// ExitRpc_resp is called when exiting the rpc_resp production.
	ExitRpc_resp(c *Rpc_respContext)

	// ExitRpc_annotations is called when exiting the rpc_annotations production.
	ExitRpc_annotations(c *Rpc_annotationsContext)

	// ExitAnnotation is called when exiting the annotation production.
	ExitAnnotation(c *AnnotationContext)

	// ExitBase_type is called when exiting the base_type production.
	ExitBase_type(c *Base_typeContext)

	// ExitUser_type is called when exiting the user_type production.
	ExitUser_type(c *User_typeContext)

	// ExitContainer_type is called when exiting the container_type production.
	ExitContainer_type(c *Container_typeContext)

	// ExitMap_type is called when exiting the map_type production.
	ExitMap_type(c *Map_typeContext)

	// ExitKey_type is called when exiting the key_type production.
	ExitKey_type(c *Key_typeContext)

	// ExitList_type is called when exiting the list_type production.
	ExitList_type(c *List_typeContext)

	// ExitValue_type is called when exiting the value_type production.
	ExitValue_type(c *Value_typeContext)

	// ExitConst_value is called when exiting the const_value production.
	ExitConst_value(c *Const_valueContext)
}

TParserListener is a complete listener for a parse tree produced by TParser.

type Type

type Type struct {
	Name        string // Type name
	Redefined   *RedefinedType
	GenericName *string     // Optional generic type parameter (if present)
	Fields      []TypeField // Type fields
	Position    Position    // Location in source code
	Comments    Comments    // Associated comments
}

Type represents a custom user-defined type (struct-like).

type TypeDefinition

type TypeDefinition interface {
	Text() string
}

TypeDefinition is the interface implemented by all type representations. The Text() method provides a human-readable representation of the type.

type TypeField

type TypeField struct {
	FieldType   TypeDefinition // The type of the field (primitive, user, container, etc.)
	Name        string         // Field name (maybe empty for embedded types)
	Default     *string        // Optional default value (if specified)
	Annotations []Annotation   // Field annotations (key-value metadata)
	Position    Position       // Location in source code
	Comments    Comments       // Associated comments
}

TypeField represents a single field inside a user-defined type.

type Type_annotationsContext

type Type_annotationsContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyType_annotationsContext

func NewEmptyType_annotationsContext() *Type_annotationsContext

func NewType_annotationsContext

func NewType_annotationsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Type_annotationsContext

func (*Type_annotationsContext) AllAnnotation

func (s *Type_annotationsContext) AllAnnotation() []IAnnotationContext

func (*Type_annotationsContext) AllCOMMA

func (s *Type_annotationsContext) AllCOMMA() []antlr.TerminalNode

func (*Type_annotationsContext) Annotation

func (*Type_annotationsContext) COMMA

func (s *Type_annotationsContext) COMMA(i int) antlr.TerminalNode

func (*Type_annotationsContext) EnterRule

func (s *Type_annotationsContext) EnterRule(listener antlr.ParseTreeListener)

func (*Type_annotationsContext) ExitRule

func (s *Type_annotationsContext) ExitRule(listener antlr.ParseTreeListener)

func (*Type_annotationsContext) GetParser

func (s *Type_annotationsContext) GetParser() antlr.Parser

func (*Type_annotationsContext) GetRuleContext

func (s *Type_annotationsContext) GetRuleContext() antlr.RuleContext

func (*Type_annotationsContext) IsType_annotationsContext

func (*Type_annotationsContext) IsType_annotationsContext()

func (*Type_annotationsContext) LEFT_PAREN

func (s *Type_annotationsContext) LEFT_PAREN() antlr.TerminalNode

func (*Type_annotationsContext) RIGHT_PAREN

func (s *Type_annotationsContext) RIGHT_PAREN() antlr.TerminalNode

func (*Type_annotationsContext) ToStringTree

func (s *Type_annotationsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type Type_defContext

type Type_defContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyType_defContext

func NewEmptyType_defContext() *Type_defContext

func NewType_defContext

func NewType_defContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Type_defContext

func (*Type_defContext) AllIDENTIFIER

func (s *Type_defContext) AllIDENTIFIER() []antlr.TerminalNode

func (*Type_defContext) AllType_field

func (s *Type_defContext) AllType_field() []IType_fieldContext

func (*Type_defContext) EnterRule

func (s *Type_defContext) EnterRule(listener antlr.ParseTreeListener)

func (*Type_defContext) ExitRule

func (s *Type_defContext) ExitRule(listener antlr.ParseTreeListener)

func (*Type_defContext) GREATER_THAN

func (s *Type_defContext) GREATER_THAN() antlr.TerminalNode

func (*Type_defContext) Generic_type

func (s *Type_defContext) Generic_type() IGeneric_typeContext

func (*Type_defContext) GetParser

func (s *Type_defContext) GetParser() antlr.Parser

func (*Type_defContext) GetRuleContext

func (s *Type_defContext) GetRuleContext() antlr.RuleContext

func (*Type_defContext) IDENTIFIER

func (s *Type_defContext) IDENTIFIER(i int) antlr.TerminalNode

func (*Type_defContext) IsType_defContext

func (*Type_defContext) IsType_defContext()

func (*Type_defContext) KW_TYPE

func (s *Type_defContext) KW_TYPE() antlr.TerminalNode

func (*Type_defContext) LEFT_BRACE

func (s *Type_defContext) LEFT_BRACE() antlr.TerminalNode

func (*Type_defContext) LESS_THAN

func (s *Type_defContext) LESS_THAN() antlr.TerminalNode

func (*Type_defContext) RIGHT_BRACE

func (s *Type_defContext) RIGHT_BRACE() antlr.TerminalNode

func (*Type_defContext) ToStringTree

func (s *Type_defContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

func (*Type_defContext) Type_field

func (s *Type_defContext) Type_field(i int) IType_fieldContext

type Type_fieldContext

type Type_fieldContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyType_fieldContext

func NewEmptyType_fieldContext() *Type_fieldContext

func NewType_fieldContext

func NewType_fieldContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Type_fieldContext

func (*Type_fieldContext) Common_type_field

func (s *Type_fieldContext) Common_type_field() ICommon_type_fieldContext

func (*Type_fieldContext) Embed_type_field

func (s *Type_fieldContext) Embed_type_field() IEmbed_type_fieldContext

func (*Type_fieldContext) EnterRule

func (s *Type_fieldContext) EnterRule(listener antlr.ParseTreeListener)

func (*Type_fieldContext) ExitRule

func (s *Type_fieldContext) ExitRule(listener antlr.ParseTreeListener)

func (*Type_fieldContext) GetParser

func (s *Type_fieldContext) GetParser() antlr.Parser

func (*Type_fieldContext) GetRuleContext

func (s *Type_fieldContext) GetRuleContext() antlr.RuleContext

func (*Type_fieldContext) IsType_fieldContext

func (*Type_fieldContext) IsType_fieldContext()

func (*Type_fieldContext) ToStringTree

func (s *Type_fieldContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type UserType

type UserType struct {
	Name     string // Type name
	Optional bool   // Whether the type is optional (nullable)
}

UserType represents a reference to a user-defined type.

func (UserType) Text

func (t UserType) Text() string

type User_typeContext

type User_typeContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyUser_typeContext

func NewEmptyUser_typeContext() *User_typeContext

func NewUser_typeContext

func NewUser_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *User_typeContext

func (*User_typeContext) EnterRule

func (s *User_typeContext) EnterRule(listener antlr.ParseTreeListener)

func (*User_typeContext) ExitRule

func (s *User_typeContext) ExitRule(listener antlr.ParseTreeListener)

func (*User_typeContext) GetParser

func (s *User_typeContext) GetParser() antlr.Parser

func (*User_typeContext) GetRuleContext

func (s *User_typeContext) GetRuleContext() antlr.RuleContext

func (*User_typeContext) IDENTIFIER

func (s *User_typeContext) IDENTIFIER() antlr.TerminalNode

func (*User_typeContext) IsUser_typeContext

func (*User_typeContext) IsUser_typeContext()

func (*User_typeContext) QUESTION

func (s *User_typeContext) QUESTION() antlr.TerminalNode

func (*User_typeContext) ToStringTree

func (s *User_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type Value_typeContext

type Value_typeContext struct {
	antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyValue_typeContext

func NewEmptyValue_typeContext() *Value_typeContext

func NewValue_typeContext

func NewValue_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Value_typeContext

func (*Value_typeContext) Base_type

func (s *Value_typeContext) Base_type() IBase_typeContext

func (*Value_typeContext) Container_type

func (s *Value_typeContext) Container_type() IContainer_typeContext

func (*Value_typeContext) EnterRule

func (s *Value_typeContext) EnterRule(listener antlr.ParseTreeListener)

func (*Value_typeContext) ExitRule

func (s *Value_typeContext) ExitRule(listener antlr.ParseTreeListener)

func (*Value_typeContext) GetParser

func (s *Value_typeContext) GetParser() antlr.Parser

func (*Value_typeContext) GetRuleContext

func (s *Value_typeContext) GetRuleContext() antlr.RuleContext

func (*Value_typeContext) IsValue_typeContext

func (*Value_typeContext) IsValue_typeContext()

func (*Value_typeContext) ToStringTree

func (s *Value_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

func (*Value_typeContext) User_type

func (s *Value_typeContext) User_type() IUser_typeContext

Jump to

Keyboard shortcuts

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