Documentation ¶
Index ¶
- func EqualDoc(spec1, spec2 Spec) bool
- func NewTextExpr(v string) *defaultExpr
- type Api
- type ApiVisitor
- func (v *ApiVisitor) VisitAnonymousFiled(ctx *api.AnonymousFiledContext) interface{}
- func (v *ApiVisitor) VisitApi(ctx *api.ApiContext) interface{}
- func (v *ApiVisitor) VisitArrayType(ctx *api.ArrayTypeContext) interface{}
- func (v *ApiVisitor) VisitAtDoc(ctx *api.AtDocContext) interface{}
- func (v *ApiVisitor) VisitAtHandler(ctx *api.AtHandlerContext) interface{}
- func (v *ApiVisitor) VisitAtServer(ctx *api.AtServerContext) interface{}
- func (v *ApiVisitor) VisitBody(ctx *api.BodyContext) interface{}
- func (v *ApiVisitor) VisitDataType(ctx *api.DataTypeContext) interface{}
- func (v *ApiVisitor) VisitField(ctx *api.FieldContext) interface{}
- func (v *ApiVisitor) VisitImportBlock(ctx *api.ImportBlockContext) interface{}
- func (v *ApiVisitor) VisitImportBlockValue(ctx *api.ImportBlockValueContext) interface{}
- func (v *ApiVisitor) VisitImportLit(ctx *api.ImportLitContext) interface{}
- func (v *ApiVisitor) VisitImportSpec(ctx *api.ImportSpecContext) interface{}
- func (v *ApiVisitor) VisitImportValue(ctx *api.ImportValueContext) interface{}
- func (v *ApiVisitor) VisitInfoSpec(ctx *api.InfoSpecContext) interface{}
- func (v *ApiVisitor) VisitKvLit(ctx *api.KvLitContext) interface{}
- func (v *ApiVisitor) VisitMapType(ctx *api.MapTypeContext) interface{}
- func (v *ApiVisitor) VisitNormalField(ctx *api.NormalFieldContext) interface{}
- func (v *ApiVisitor) VisitPointerType(ctx *api.PointerTypeContext) interface{}
- func (v *ApiVisitor) VisitReplybody(ctx *api.ReplybodyContext) interface{}
- func (v *ApiVisitor) VisitRoute(ctx *api.RouteContext) interface{}
- func (v *ApiVisitor) VisitServiceApi(ctx *api.ServiceApiContext) interface{}
- func (v *ApiVisitor) VisitServiceRoute(ctx *api.ServiceRouteContext) interface{}
- func (v *ApiVisitor) VisitServiceSpec(ctx *api.ServiceSpecContext) interface{}
- func (v *ApiVisitor) VisitSpec(ctx *api.SpecContext) interface{}
- func (v *ApiVisitor) VisitSyntaxLit(ctx *api.SyntaxLitContext) interface{}
- func (v *ApiVisitor) VisitTypeAlias(ctx *api.TypeAliasContext) interface{}
- func (v *ApiVisitor) VisitTypeBlock(ctx *api.TypeBlockContext) interface{}
- func (v *ApiVisitor) VisitTypeBlockAlias(ctx *api.TypeBlockAliasContext) interface{}
- func (v *ApiVisitor) VisitTypeBlockBody(ctx *api.TypeBlockBodyContext) interface{}
- func (v *ApiVisitor) VisitTypeBlockStruct(ctx *api.TypeBlockStructContext) interface{}
- func (v *ApiVisitor) VisitTypeLit(ctx *api.TypeLitContext) interface{}
- func (v *ApiVisitor) VisitTypeLitBody(ctx *api.TypeLitBodyContext) interface{}
- func (v *ApiVisitor) VisitTypeSpec(ctx *api.TypeSpecContext) interface{}
- func (v *ApiVisitor) VisitTypeStruct(ctx *api.TypeStructContext) interface{}
- type Array
- type AtDoc
- type AtHandler
- type AtServer
- type Body
- type DataType
- type Expr
- type ImportExpr
- type InfoExpr
- type Interface
- type KV
- type KvExpr
- type Literal
- type Map
- type Parser
- func (p *Parser) Accept(fn func(p *api.ApiParserParser, visitor *ApiVisitor) interface{}, ...) (v interface{}, err error)
- func (p *Parser) Parse(filename string) (*Api, error)
- func (p *Parser) ParseContent(content string) (*Api, error)
- func (p *Parser) SyntaxError(_ antlr.Recognizer, _ interface{}, line, column int, msg string, ...)
- type ParserOption
- type PlaceHolder
- type Pointer
- type Route
- type Service
- type ServiceApi
- type ServiceRoute
- type Spec
- type SyntaxExpr
- type Time
- type TokenStream
- type TypeAlias
- type TypeExpr
- type TypeField
- type TypeStruct
- type VisitorOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTextExpr ¶
func NewTextExpr(v string) *defaultExpr
Types ¶
type Api ¶
type Api struct { LinePrefix string Syntax *SyntaxExpr Import []*ImportExpr Info *InfoExpr Type []TypeExpr Service []*Service // contains filtered or unexported fields }
type ApiVisitor ¶
type ApiVisitor struct { api.BaseApiParserVisitor // contains filtered or unexported fields }
func NewApiVisitor ¶
func NewApiVisitor(options ...VisitorOption) *ApiVisitor
func (*ApiVisitor) VisitAnonymousFiled ¶
func (v *ApiVisitor) VisitAnonymousFiled(ctx *api.AnonymousFiledContext) interface{}
func (*ApiVisitor) VisitApi ¶
func (v *ApiVisitor) VisitApi(ctx *api.ApiContext) interface{}
func (*ApiVisitor) VisitArrayType ¶
func (v *ApiVisitor) VisitArrayType(ctx *api.ArrayTypeContext) interface{}
func (*ApiVisitor) VisitAtDoc ¶
func (v *ApiVisitor) VisitAtDoc(ctx *api.AtDocContext) interface{}
func (*ApiVisitor) VisitAtHandler ¶
func (v *ApiVisitor) VisitAtHandler(ctx *api.AtHandlerContext) interface{}
func (*ApiVisitor) VisitAtServer ¶
func (v *ApiVisitor) VisitAtServer(ctx *api.AtServerContext) interface{}
func (*ApiVisitor) VisitBody ¶
func (v *ApiVisitor) VisitBody(ctx *api.BodyContext) interface{}
func (*ApiVisitor) VisitDataType ¶
func (v *ApiVisitor) VisitDataType(ctx *api.DataTypeContext) interface{}
func (*ApiVisitor) VisitField ¶
func (v *ApiVisitor) VisitField(ctx *api.FieldContext) interface{}
func (*ApiVisitor) VisitImportBlock ¶
func (v *ApiVisitor) VisitImportBlock(ctx *api.ImportBlockContext) interface{}
func (*ApiVisitor) VisitImportBlockValue ¶
func (v *ApiVisitor) VisitImportBlockValue(ctx *api.ImportBlockValueContext) interface{}
func (*ApiVisitor) VisitImportLit ¶
func (v *ApiVisitor) VisitImportLit(ctx *api.ImportLitContext) interface{}
func (*ApiVisitor) VisitImportSpec ¶
func (v *ApiVisitor) VisitImportSpec(ctx *api.ImportSpecContext) interface{}
func (*ApiVisitor) VisitImportValue ¶
func (v *ApiVisitor) VisitImportValue(ctx *api.ImportValueContext) interface{}
func (*ApiVisitor) VisitInfoSpec ¶
func (v *ApiVisitor) VisitInfoSpec(ctx *api.InfoSpecContext) interface{}
func (*ApiVisitor) VisitKvLit ¶
func (v *ApiVisitor) VisitKvLit(ctx *api.KvLitContext) interface{}
func (*ApiVisitor) VisitMapType ¶
func (v *ApiVisitor) VisitMapType(ctx *api.MapTypeContext) interface{}
func (*ApiVisitor) VisitNormalField ¶
func (v *ApiVisitor) VisitNormalField(ctx *api.NormalFieldContext) interface{}
func (*ApiVisitor) VisitPointerType ¶
func (v *ApiVisitor) VisitPointerType(ctx *api.PointerTypeContext) interface{}
func (*ApiVisitor) VisitReplybody ¶
func (v *ApiVisitor) VisitReplybody(ctx *api.ReplybodyContext) interface{}
note: forward compatible
func (*ApiVisitor) VisitRoute ¶
func (v *ApiVisitor) VisitRoute(ctx *api.RouteContext) interface{}
func (*ApiVisitor) VisitServiceApi ¶
func (v *ApiVisitor) VisitServiceApi(ctx *api.ServiceApiContext) interface{}
func (*ApiVisitor) VisitServiceRoute ¶
func (v *ApiVisitor) VisitServiceRoute(ctx *api.ServiceRouteContext) interface{}
func (*ApiVisitor) VisitServiceSpec ¶
func (v *ApiVisitor) VisitServiceSpec(ctx *api.ServiceSpecContext) interface{}
func (*ApiVisitor) VisitSpec ¶
func (v *ApiVisitor) VisitSpec(ctx *api.SpecContext) interface{}
func (*ApiVisitor) VisitSyntaxLit ¶
func (v *ApiVisitor) VisitSyntaxLit(ctx *api.SyntaxLitContext) interface{}
func (*ApiVisitor) VisitTypeAlias ¶
func (v *ApiVisitor) VisitTypeAlias(ctx *api.TypeAliasContext) interface{}
func (*ApiVisitor) VisitTypeBlock ¶
func (v *ApiVisitor) VisitTypeBlock(ctx *api.TypeBlockContext) interface{}
func (*ApiVisitor) VisitTypeBlockAlias ¶
func (v *ApiVisitor) VisitTypeBlockAlias(ctx *api.TypeBlockAliasContext) interface{}
func (*ApiVisitor) VisitTypeBlockBody ¶
func (v *ApiVisitor) VisitTypeBlockBody(ctx *api.TypeBlockBodyContext) interface{}
func (*ApiVisitor) VisitTypeBlockStruct ¶
func (v *ApiVisitor) VisitTypeBlockStruct(ctx *api.TypeBlockStructContext) interface{}
func (*ApiVisitor) VisitTypeLit ¶
func (v *ApiVisitor) VisitTypeLit(ctx *api.TypeLitContext) interface{}
func (*ApiVisitor) VisitTypeLitBody ¶
func (v *ApiVisitor) VisitTypeLitBody(ctx *api.TypeLitBodyContext) interface{}
func (*ApiVisitor) VisitTypeSpec ¶
func (v *ApiVisitor) VisitTypeSpec(ctx *api.TypeSpecContext) interface{}
func (*ApiVisitor) VisitTypeStruct ¶
func (v *ApiVisitor) VisitTypeStruct(ctx *api.TypeStructContext) interface{}
type ImportExpr ¶
func (*ImportExpr) Comment ¶
func (i *ImportExpr) Comment() Expr
func (*ImportExpr) Doc ¶
func (i *ImportExpr) Doc() []Expr
func (*ImportExpr) Equal ¶
func (i *ImportExpr) Equal(v interface{}) bool
func (*ImportExpr) Format ¶
func (i *ImportExpr) Format() error
type Parser ¶
type Parser struct { antlr.DefaultErrorListener // contains filtered or unexported fields }
func NewParser ¶
func NewParser(options ...ParserOption) *Parser
func (*Parser) Accept ¶
func (p *Parser) Accept(fn func(p *api.ApiParserParser, visitor *ApiVisitor) interface{}, content string) (v interface{}, err error)
Accept can parse any terminalNode of api tree by fn. -- for debug
func (*Parser) ParseContent ¶
ParseContent is used to parse the api from the specified content
func (*Parser) SyntaxError ¶
func (p *Parser) SyntaxError(_ antlr.Recognizer, _ interface{}, line, column int, msg string, _ antlr.RecognitionException)
type ParserOption ¶
type ParserOption func(p *Parser)
func WithParserDebug ¶
func WithParserDebug() ParserOption
func WithParserPrefix ¶
func WithParserPrefix(prefix string) ParserOption
type Route ¶
type Service ¶
type Service struct { AtServer *AtServer ServiceApi *ServiceApi }
type ServiceApi ¶
type ServiceApi struct { ServiceToken Expr Name Expr Lbrace Expr Rbrace Expr ServiceRoute []*ServiceRoute }
func (*ServiceApi) Equal ¶
func (a *ServiceApi) Equal(v interface{}) bool
func (*ServiceApi) Format ¶
func (a *ServiceApi) Format() error
type ServiceRoute ¶
func (*ServiceRoute) Equal ¶
func (s *ServiceRoute) Equal(v interface{}) bool
func (*ServiceRoute) Format ¶
func (s *ServiceRoute) Format() error
func (*ServiceRoute) GetHandler ¶
func (s *ServiceRoute) GetHandler() Expr
type SyntaxExpr ¶
func (*SyntaxExpr) Comment ¶
func (s *SyntaxExpr) Comment() Expr
func (*SyntaxExpr) Doc ¶
func (s *SyntaxExpr) Doc() []Expr
func (*SyntaxExpr) Equal ¶
func (s *SyntaxExpr) Equal(v interface{}) bool
func (*SyntaxExpr) Format ¶
func (s *SyntaxExpr) Format() error
type TokenStream ¶
type TypeField ¶
type TypeStruct ¶
type TypeStruct struct { Name Expr Struct Expr LBrace Expr RBrace Expr DocExpr []Expr Fields []*TypeField }
func (*TypeStruct) Doc ¶
func (s *TypeStruct) Doc() []Expr
func (*TypeStruct) Equal ¶
func (s *TypeStruct) Equal(dt interface{}) bool
func (*TypeStruct) Format ¶
func (s *TypeStruct) Format() error
func (*TypeStruct) NameExpr ¶
func (s *TypeStruct) NameExpr() Expr
type VisitorOption ¶
type VisitorOption func(v *ApiVisitor)
func WithVisitorDebug ¶
func WithVisitorDebug() VisitorOption
func WithVisitorPrefix ¶
func WithVisitorPrefix(prefix string) VisitorOption
Click to show internal directories.
Click to hide internal directories.