{"modulePath":"github.com/acoderup/goctl","version":"v1.1.7","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package ast\n\n## Constants\n\n```go\nconst (\n\tNilIndent  = \"\"\n\tWhiteSpace = \" \"\n\tIndent     = \"\\t\"\n\tNewLine    = \"\\n\"\n)\n```\n\n## Functions\n\n```go\nfunc DuplicateStmtError(pos token.Position, msg string) error\n```\nDuplicateStmtError represents a duplicate statement error.\n\n```go\nfunc Fprint(w io.Writer, x interface{}, f FieldFilter) error\n```\nFprint prints the value of x to the writer w.\n\n```go\nfunc NotNilFilter(_ string, v reflect.Value) bool\n```\nNotNilFilter returns true for field values that are not nil, it returns false otherwise.\n\n```go\nfunc Print(x interface{}) error\n```\n\n```go\nfunc SyntaxError(pos token.Position, format string, v ...interface{}) error\n```\nSyntaxError represents a syntax error.\n\n## Types\n\n```go\ntype AST struct {\n\tFilename string\n\tStmts    []Stmt\n\t// contains filtered or unexported fields\n}\n```\nAST represents a parsed API file.\n\n```go\nfunc (a *AST) Format(w io.Writer)\n```\nFormat formats the AST.\n\n```go\nfunc (a *AST) FormatForUnitTest(w io.Writer)\n```\nFormatForUnitTest formats the AST for unit test.\n\n```go\nfunc (a *AST) Print()\n```\nPrint prints the AST.\n\n```go\ntype AnyDataType struct {\n\t// Any is the any token node.\n\tAny *TokenNode\n\t// contains filtered or unexported fields\n}\n```\nAnyDataType is the any data type.\n\n```go\nfunc (t *AnyDataType) CanEqual() bool\n```\n\n```go\nfunc (t *AnyDataType) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (t *AnyDataType) ContainsStruct() bool\n```\n\n```go\nfunc (t *AnyDataType) End() token.Position\n```\n\n```go\nfunc (t *AnyDataType) Format(prefix ...string) string\n```\n\n```go\nfunc (t *AnyDataType) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (t *AnyDataType) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (t *AnyDataType) Pos() token.Position\n```\n\n```go\nfunc (t *AnyDataType) RawText() string\n```\n\n```go\ntype ArrayDataType struct {\n\t// LB is the left bracket token node.\n\tLBrack *TokenNode\n\t// Len is the array length.\n\tLength *TokenNode\n\t// RB is the right bracket token node.\n\tRBrack *TokenNode\n\t// DataType is the array data type.\n\tDataType DataType\n\t// contains filtered or unexported fields\n}\n```\nArrayDataType is the array data type.\n\n```go\nfunc (t *ArrayDataType) CanEqual() bool\n```\n\n```go\nfunc (t *ArrayDataType) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (t *ArrayDataType) ContainsStruct() bool\n```\n\n```go\nfunc (t *ArrayDataType) End() token.Position\n```\n\n```go\nfunc (t *ArrayDataType) Format(prefix ...string) string\n```\n\n```go\nfunc (t *ArrayDataType) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (t *ArrayDataType) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (t *ArrayDataType) Pos() token.Position\n```\n\n```go\nfunc (t *ArrayDataType) RawText() string\n```\n\n```go\ntype AtDocGroupStmt struct {\n\tAtDoc  *TokenNode\n\tLParen *TokenNode\n\tValues []*KVExpr\n\tRParen *TokenNode\n}\n```\n\n```go\nfunc (a *AtDocGroupStmt) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (a *AtDocGroupStmt) End() token.Position\n```\n\n```go\nfunc (a *AtDocGroupStmt) Format(prefix ...string) string\n```\n\n```go\nfunc (a *AtDocGroupStmt) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (a *AtDocGroupStmt) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (a *AtDocGroupStmt) Pos() token.Position\n```\n\n```go\ntype AtDocLiteralStmt struct {\n\tAtDoc *TokenNode\n\tValue *TokenNode\n}\n```\n\n```go\nfunc (a *AtDocLiteralStmt) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (a *AtDocLiteralStmt) End() token.Position\n```\n\n```go\nfunc (a *AtDocLiteralStmt) Format(prefix ...string) string\n```\n\n```go\nfunc (a *AtDocLiteralStmt) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (a *AtDocLiteralStmt) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (a *AtDocLiteralStmt) Pos() token.Position\n```\n\n```go\ntype AtDocStmt interface {\n\tStmt\n\t// contains filtered or unexported methods\n}\n```\n\n```go\ntype AtHandlerStmt struct {\n\tAtHandler *TokenNode\n\tName      *TokenNode\n}\n```\n\n```go\nfunc (a *AtHandlerStmt) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (a *AtHandlerStmt) End() token.Position\n```\n\n```go\nfunc (a *AtHandlerStmt) Format(prefix ...string) string\n```\n\n```go\nfunc (a *AtHandlerStmt) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (a *AtHandlerStmt) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (a *AtHandlerStmt) Pos() token.Position\n```\n\n```go\ntype AtServerStmt struct {\n\t// AtServer is the @server token.\n\tAtServer *TokenNode\n\t// LParen is the left parenthesis token.\n\tLParen *TokenNode\n\t// Values is the key-value pairs.\n\tValues []*KVExpr\n\t// RParen is the right parenthesis token.\n\tRParen *TokenNode\n}\n```\nAtServerStmt represents @server statement.\n\n```go\nfunc (a *AtServerStmt) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (a *AtServerStmt) End() token.Position\n```\n\n```go\nfunc (a *AtServerStmt) Format(prefix ...string) string\n```\n\n```go\nfunc (a *AtServerStmt) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (a *AtServerStmt) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (a *AtServerStmt) Pos() token.Position\n```\n\n```go\ntype BaseDataType struct {\n\t// Base is the base token node.\n\tBase *TokenNode\n\t// contains filtered or unexported fields\n}\n```\nBaseDataType is a common id type which contains bool, uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, float64, complex64, complex128, string, int, uint, uintptr, byte, rune, any.\n\n```go\nfunc (t *BaseDataType) CanEqual() bool\n```\n\n```go\nfunc (t *BaseDataType) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (t *BaseDataType) ContainsStruct() bool\n```\n\n```go\nfunc (t *BaseDataType) End() token.Position\n```\n\n```go\nfunc (t *BaseDataType) Format(prefix ...string) string\n```\n\n```go\nfunc (t *BaseDataType) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (t *BaseDataType) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (t *BaseDataType) Pos() token.Position\n```\n\n```go\nfunc (t *BaseDataType) RawText() string\n```\n\n```go\ntype BodyExpr struct {\n\tLBrack *TokenNode\n\tRBrack *TokenNode\n\tStar   *TokenNode\n\tValue  *TokenNode\n}\n```\n\n```go\nfunc (e *BodyExpr) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (e *BodyExpr) End() token.Position\n```\n\n```go\nfunc (e *BodyExpr) Format(...string) string\n```\n\n```go\nfunc (e *BodyExpr) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (e *BodyExpr) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (e *BodyExpr) IsArrayType() bool\n```\n\n```go\nfunc (e *BodyExpr) Pos() token.Position\n```\n\n```go\ntype BodyStmt struct {\n\tLParen *TokenNode\n\tBody   *BodyExpr\n\tRParen *TokenNode\n}\n```\n\n```go\nfunc (b *BodyStmt) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (b *BodyStmt) End() token.Position\n```\n\n```go\nfunc (b *BodyStmt) Format(...string) string\n```\n\n```go\nfunc (b *BodyStmt) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (b *BodyStmt) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (b *BodyStmt) Pos() token.Position\n```\n\n```go\ntype CommentGroup []*CommentStmt\n```\nCommentGroup represents a list of comments.\n\n```go\nfunc (cg CommentGroup) Join(sep string) string\n```\nJoin joins the comments with the given separator.\n\n```go\nfunc (cg CommentGroup) List() []string\n```\nList returns the list of comments.\n\n```go\nfunc (cg CommentGroup) String() string\n```\nString joins and returns the comment text.\n\n```go\nfunc (cg CommentGroup) Valid() bool\n```\nValid returns true if the comment is valid.\n\n```go\ntype CommentStmt struct {\n\t// Comment is the comment token.\n\tComment token.Token\n}\n```\nCommentStmt represents a comment statement.\n\n```go\nfunc (c *CommentStmt) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (c *CommentStmt) End() token.Position\n```\n\n```go\nfunc (c *CommentStmt) Format(prefix ...string) string\n```\n\n```go\nfunc (c *CommentStmt) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (c *CommentStmt) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (c *CommentStmt) Pos() token.Position\n```\n\n```go\ntype DataType interface {\n\tExpr\n\n\t// CanEqual returns true if the data type can be equal.\n\tCanEqual() bool\n\t// ContainsStruct returns true if the data type contains struct.\n\tContainsStruct() bool\n\t// RawText returns the raw text of the data type.\n\tRawText() string\n\t// contains filtered or unexported methods\n}\n```\nDataType represents the data type.\n\n```go\ntype ElemExpr struct {\n\t// Name is the field element name.\n\tName []*TokenNode\n\t// DataType is the field data type.\n\tDataType DataType\n\t// Tag is the field tag.\n\tTag *TokenNode\n}\n```\nElemExpr is the element expression.\n\n```go\nfunc (e *ElemExpr) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (e *ElemExpr) End() token.Position\n```\n\n```go\nfunc (e *ElemExpr) Format(prefix ...string) string\n```\n\n```go\nfunc (e *ElemExpr) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (e *ElemExpr) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (e *ElemExpr) IsAnonymous() bool\n```\nIsAnonymous returns true if the element is anonymous.\n\n```go\nfunc (e *ElemExpr) Pos() token.Position\n```\n\n```go\ntype ElemExprList []*ElemExpr\n```\nElemExprList is the element expression list.\n\n```go\ntype Expr interface {\n\tNode\n\t// contains filtered or unexported methods\n}\n```\nExpr represents an expression in the AST.\n\n```go\ntype FieldFilter func(name string, value reflect.Value) bool\n```\nA FieldFilter may be provided to Fprint to control the output.\n\n```go\ntype ImportGroupStmt struct {\n\t// Import is the import token.\n\tImport *TokenNode\n\t// LParen is the left parenthesis token.\n\tLParen *TokenNode\n\t// Values is the import values.\n\tValues []*TokenNode\n\t// RParen is the right parenthesis token.\n\tRParen *TokenNode\n}\n```\n\n```go\nfunc (i *ImportGroupStmt) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (i *ImportGroupStmt) End() token.Position\n```\n\n```go\nfunc (i *ImportGroupStmt) Format(prefix ...string) string\n```\n\n```go\nfunc (i *ImportGroupStmt) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (i *ImportGroupStmt) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (i *ImportGroupStmt) Pos() token.Position\n```\n\n```go\ntype ImportLiteralStmt struct {\n\t// Import is the import token.\n\tImport *TokenNode\n\t// Value is the import value.\n\tValue *TokenNode\n}\n```\nImportLiteralStmt represents an import literal statement.\n\n```go\nfunc (i *ImportLiteralStmt) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (i *ImportLiteralStmt) End() token.Position\n```\n\n```go\nfunc (i *ImportLiteralStmt) Format(prefix ...string) (result string)\n```\n\n```go\nfunc (i *ImportLiteralStmt) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (i *ImportLiteralStmt) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (i *ImportLiteralStmt) Pos() token.Position\n```\n\n```go\ntype ImportStmt interface {\n\tStmt\n\t// contains filtered or unexported methods\n}\n```\nImportStmt represents an import statement.\n\n```go\ntype InfoStmt struct {\n\t// Info is the info keyword.\n\tInfo *TokenNode\n\t// LParen is the left parenthesis.\n\tLParen *TokenNode\n\t// Values is the info values.\n\tValues []*KVExpr\n\t// RParen is the right parenthesis.\n\tRParen *TokenNode\n}\n```\nInfoStmt is the info statement.\n\n```go\nfunc (i *InfoStmt) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (i *InfoStmt) End() token.Position\n```\n\n```go\nfunc (i *InfoStmt) Format(prefix ...string) string\n```\n\n```go\nfunc (i *InfoStmt) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (i *InfoStmt) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (i *InfoStmt) Pos() token.Position\n```\n\n```go\ntype InterfaceDataType struct {\n\t// Interface is the interface token node.\n\tInterface *TokenNode\n\t// contains filtered or unexported fields\n}\n```\nInterfaceDataType is the interface data type.\n\n```go\nfunc (t *InterfaceDataType) CanEqual() bool\n```\n\n```go\nfunc (t *InterfaceDataType) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (t *InterfaceDataType) ContainsStruct() bool\n```\n\n```go\nfunc (t *InterfaceDataType) End() token.Position\n```\n\n```go\nfunc (t *InterfaceDataType) Format(prefix ...string) string\n```\n\n```go\nfunc (t *InterfaceDataType) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (t *InterfaceDataType) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (t *InterfaceDataType) Pos() token.Position\n```\n\n```go\nfunc (t *InterfaceDataType) RawText() string\n```\n\n```go\ntype KVExpr struct {\n\t// Key is the key of the key value expression.\n\tKey *TokenNode\n\t// Colon is the colon of the key value expression.\n\tColon *TokenNode\n\t// Value is the value of the key value expression.\n\tValue *TokenNode\n}\n```\nKVExpr is a key value expression.\n\n```go\nfunc (i *KVExpr) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (i *KVExpr) End() token.Position\n```\n\n```go\nfunc (i *KVExpr) Format(prefix ...string) string\n```\n\n```go\nfunc (i *KVExpr) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (i *KVExpr) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (i *KVExpr) Pos() token.Position\n```\n\n```go\ntype MapDataType struct {\n\t// Map is the map token node.\n\tMap *TokenNode\n\t// Lbrack is the left bracket token node.\n\tLBrack *TokenNode\n\t// Key is the map key data type.\n\tKey DataType\n\t// Rbrack is the right bracket token node.\n\tRBrack *TokenNode\n\t// Value is the map value data type.\n\tValue DataType\n\t// contains filtered or unexported fields\n}\n```\nMapDataType is the map data type.\n\n```go\nfunc (t *MapDataType) CanEqual() bool\n```\n\n```go\nfunc (t *MapDataType) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (t *MapDataType) ContainsStruct() bool\n```\n\n```go\nfunc (t *MapDataType) End() token.Position\n```\n\n```go\nfunc (t *MapDataType) Format(prefix ...string) string\n```\n\n```go\nfunc (t *MapDataType) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (t *MapDataType) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (t *MapDataType) Pos() token.Position\n```\n\n```go\nfunc (t *MapDataType) RawText() string\n```\n\n```go\ntype Node interface {\n\t// Pos returns the position of the first character belonging to the node.\n\tPos() token.Position\n\t// End returns the position of the first character immediately after the node.\n\tEnd() token.Position\n\t// Format returns the node's text after format.\n\tFormat(...string) string\n\t// HasHeadCommentGroup returns true if the node has head comment group.\n\tHasHeadCommentGroup() bool\n\t// HasLeadingCommentGroup returns true if the node has leading comment group.\n\tHasLeadingCommentGroup() bool\n\t// CommentGroup returns the node's head comment group and leading comment group.\n\tCommentGroup() (head, leading CommentGroup)\n}\n```\nNode represents a node in the AST.\n\n```go\ntype Option func(o *option)\n```\n\n```go\ntype PathExpr struct {\n\tValue *TokenNode\n}\n```\n\n```go\nfunc (p *PathExpr) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (p *PathExpr) End() token.Position\n```\n\n```go\nfunc (p *PathExpr) Format(prefix ...string) string\n```\n\n```go\nfunc (p *PathExpr) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (p *PathExpr) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (p *PathExpr) Pos() token.Position\n```\n\n```go\ntype PointerDataType struct {\n\t// Star is the star token node.\n\tStar *TokenNode\n\t// DataType is the pointer data type.\n\tDataType DataType\n\t// contains filtered or unexported fields\n}\n```\nPointerDataType is the pointer data type.\n\n```go\nfunc (t *PointerDataType) CanEqual() bool\n```\n\n```go\nfunc (t *PointerDataType) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (t *PointerDataType) ContainsStruct() bool\n```\n\n```go\nfunc (t *PointerDataType) End() token.Position\n```\n\n```go\nfunc (t *PointerDataType) Format(prefix ...string) string\n```\n\n```go\nfunc (t *PointerDataType) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (t *PointerDataType) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (t *PointerDataType) Pos() token.Position\n```\n\n```go\nfunc (t *PointerDataType) RawText() string\n```\n\n```go\ntype RouteStmt struct {\n\tMethod   *TokenNode\n\tPath     *PathExpr\n\tRequest  *BodyStmt\n\tReturns  *TokenNode\n\tResponse *BodyStmt\n}\n```\n\n```go\nfunc (r *RouteStmt) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (r *RouteStmt) End() token.Position\n```\n\n```go\nfunc (r *RouteStmt) Format(prefix ...string) string\n```\n\n```go\nfunc (r *RouteStmt) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (r *RouteStmt) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (r *RouteStmt) Pos() token.Position\n```\n\n```go\ntype ServiceItemStmt struct {\n\tAtDoc     AtDocStmt\n\tAtHandler *AtHandlerStmt\n\tRoute     *RouteStmt\n}\n```\n\n```go\nfunc (s *ServiceItemStmt) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (s *ServiceItemStmt) End() token.Position\n```\n\n```go\nfunc (s *ServiceItemStmt) Format(prefix ...string) string\n```\n\n```go\nfunc (s *ServiceItemStmt) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (s *ServiceItemStmt) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (s *ServiceItemStmt) Pos() token.Position\n```\n\n```go\ntype ServiceNameExpr struct {\n\tName *TokenNode\n}\n```\n\n```go\nfunc (s *ServiceNameExpr) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (s *ServiceNameExpr) End() token.Position\n```\n\n```go\nfunc (s *ServiceNameExpr) Format(...string) string\n```\n\n```go\nfunc (s *ServiceNameExpr) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (s *ServiceNameExpr) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (s *ServiceNameExpr) Pos() token.Position\n```\n\n```go\ntype ServiceStmt struct {\n\tAtServerStmt *AtServerStmt\n\tService      *TokenNode\n\tName         *ServiceNameExpr\n\tLBrace       *TokenNode\n\tRoutes       []*ServiceItemStmt\n\tRBrace       *TokenNode\n}\n```\n\n```go\nfunc (s *ServiceStmt) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (s *ServiceStmt) End() token.Position\n```\n\n```go\nfunc (s *ServiceStmt) Format(prefix ...string) string\n```\n\n```go\nfunc (s *ServiceStmt) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (s *ServiceStmt) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (s *ServiceStmt) Pos() token.Position\n```\n\n```go\ntype SliceDataType struct {\n\t// Lbrack is the left bracket token node.\n\tLBrack *TokenNode\n\t// Rbrack is the right bracket token node.\n\tRBrack *TokenNode\n\t// DataType is the slice data type.\n\tDataType DataType\n\t// contains filtered or unexported fields\n}\n```\nSliceDataType is the slice data type.\n\n```go\nfunc (t *SliceDataType) CanEqual() bool\n```\n\n```go\nfunc (t *SliceDataType) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (t *SliceDataType) ContainsStruct() bool\n```\n\n```go\nfunc (t *SliceDataType) End() token.Position\n```\n\n```go\nfunc (t *SliceDataType) Format(prefix ...string) string\n```\n\n```go\nfunc (t *SliceDataType) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (t *SliceDataType) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (t *SliceDataType) Pos() token.Position\n```\n\n```go\nfunc (t *SliceDataType) RawText() string\n```\n\n```go\ntype Stmt interface {\n\tNode\n\t// contains filtered or unexported methods\n}\n```\nStmt represents a statement in the AST.\n\n```go\ntype StructDataType struct {\n\t// Lbrace is the left brace token node.\n\tLBrace *TokenNode\n\t// Elements is the structure elements.\n\tElements ElemExprList\n\t// Rbrace is the right brace token node.\n\tRBrace *TokenNode\n\t// contains filtered or unexported fields\n}\n```\nStructDataType is the structure data type.\n\n```go\nfunc (t *StructDataType) CanEqual() bool\n```\n\n```go\nfunc (t *StructDataType) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (t *StructDataType) ContainsStruct() bool\n```\n\n```go\nfunc (t *StructDataType) End() token.Position\n```\n\n```go\nfunc (t *StructDataType) Format(prefix ...string) string\n```\n\n```go\nfunc (t *StructDataType) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (t *StructDataType) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (t *StructDataType) Pos() token.Position\n```\n\n```go\nfunc (t *StructDataType) RawText() string\n```\n\n```go\ntype SyntaxStmt struct {\n\t// Syntax is the syntax token.\n\tSyntax *TokenNode\n\t// Assign is the assign token.\n\tAssign *TokenNode\n\t// Value is the syntax value.\n\tValue *TokenNode\n}\n```\nSyntaxStmt represents a syntax statement.\n\n```go\nfunc (s *SyntaxStmt) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (s *SyntaxStmt) End() token.Position\n```\n\n```go\nfunc (s *SyntaxStmt) Format(prefix ...string) string\n```\n\n```go\nfunc (s *SyntaxStmt) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (s *SyntaxStmt) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (s *SyntaxStmt) Pos() token.Position\n```\n\n```go\ntype TokenNode struct {\n\t// HeadCommentGroup are the comments in prev lines.\n\tHeadCommentGroup CommentGroup\n\t// Token is the token of the node.\n\tToken token.Token\n\t// LeadingCommentGroup are the tail comments in same line.\n\tLeadingCommentGroup CommentGroup\n\t// contains filtered or unexported fields\n}\n```\nTokenNode represents a token node in the AST.\n\n```go\nfunc NewTokenNode(tok token.Token) *TokenNode\n```\nNewTokenNode creates and returns a new TokenNode.\n\n```go\nfunc (t *TokenNode) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (t *TokenNode) End() token.Position\n```\n\n```go\nfunc (t *TokenNode) Equal(s string) bool\n```\nEqual returns true if the node's text is equal to the given text.\n\n```go\nfunc (t *TokenNode) Format(prefix ...string) string\n```\n\n```go\nfunc (t *TokenNode) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (t *TokenNode) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (t *TokenNode) IsEmptyString() bool\n```\nIsEmptyString returns true if the node is empty string.\n\n```go\nfunc (t *TokenNode) IsZeroString() bool\n```\nIsZeroString returns true if the node is zero string.\n\n```go\nfunc (t *TokenNode) PeekFirstHeadComment() *CommentStmt\n```\nPeekFirstHeadComment returns the first head comment of the node.\n\n```go\nfunc (t *TokenNode) PeekFirstLeadingComment() *CommentStmt\n```\nPeekFirstLeadingComment returns the first leading comment of the node.\n\n```go\nfunc (t *TokenNode) Pos() token.Position\n```\n\n```go\nfunc (t *TokenNode) RawText() string\n```\nRawText returns the node's raw text.\n\n```go\nfunc (t *TokenNode) SetLeadingCommentGroup(cg CommentGroup)\n```\nSetLeadingCommentGroup sets the node's leading comment group.\n\n```go\ntype TypeExpr struct {\n\t// Name is the type name.\n\tName *TokenNode\n\t// Assign is the assign operator.\n\tAssign *TokenNode\n\t// DataType is the data type.\n\tDataType DataType\n}\n```\nTypeExpr is the type expression.\n\n```go\nfunc (e *TypeExpr) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (e *TypeExpr) End() token.Position\n```\n\n```go\nfunc (e *TypeExpr) Format(prefix ...string) string\n```\n\n```go\nfunc (e *TypeExpr) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (e *TypeExpr) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (e *TypeExpr) Pos() token.Position\n```\n\n```go\ntype TypeGroupStmt struct {\n\t// Type is the type keyword.\n\tType *TokenNode\n\t// LParen is the left parenthesis.\n\tLParen *TokenNode\n\t// ExprList is the type expression list.\n\tExprList []*TypeExpr\n\t// RParen is the right parenthesis.\n\tRParen *TokenNode\n}\n```\nTypeGroupStmt is the type statement for type group.\n\n```go\nfunc (t *TypeGroupStmt) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (t *TypeGroupStmt) End() token.Position\n```\n\n```go\nfunc (t *TypeGroupStmt) Format(prefix ...string) string\n```\n\n```go\nfunc (t *TypeGroupStmt) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (t *TypeGroupStmt) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (t *TypeGroupStmt) Pos() token.Position\n```\n\n```go\ntype TypeLiteralStmt struct {\n\t// Type is the type keyword.\n\tType *TokenNode\n\t// Expr is the type expression.\n\tExpr *TypeExpr\n}\n```\nTypeLiteralStmt is the type statement for type literal.\n\n```go\nfunc (t *TypeLiteralStmt) CommentGroup() (head, leading CommentGroup)\n```\n\n```go\nfunc (t *TypeLiteralStmt) End() token.Position\n```\n\n```go\nfunc (t *TypeLiteralStmt) Format(prefix ...string) string\n```\n\n```go\nfunc (t *TypeLiteralStmt) HasHeadCommentGroup() bool\n```\n\n```go\nfunc (t *TypeLiteralStmt) HasLeadingCommentGroup() bool\n```\n\n```go\nfunc (t *TypeLiteralStmt) Pos() token.Position\n```\n\n```go\ntype TypeStmt interface {\n\tStmt\n\t// contains filtered or unexported methods\n}\n```\nTypeStmt is the interface for type statement.\n\n```go\ntype WriteMode int\n```\nWriteMode is the mode of writing.\n\n```go\nconst (\n\n\t// ModeAuto is the default mode, which will automatically\n\t//determine whether to write a newline.\n\tModeAuto WriteMode\n\n\t// ModeExpectInSameLine will write in the same line.\n\tModeExpectInSameLine\n)\n```\n\n```go\ntype Writer struct {\n\t// contains filtered or unexported fields\n}\n```\nWriter is the writer of ast.\n\n```go\nfunc NewBufferWriter() *Writer\n```\nNewBufferWriter returns a new buffer Writer.\n\n```go\nfunc NewWriter(writer io.Writer) *Writer\n```\nNewWriter returns a new Writer.\n\n```go\nfunc (w *Writer) Flush()\n```\nFlush flushes the buffer.\n\n```go\nfunc (w *Writer) NewLine()\n```\nNewLine writes a new line.\n\n```go\nfunc (w *Writer) String() string\n```\nString returns the string of the buffer.\n\n```go\nfunc (w *Writer) Write(opts ...Option)\n```\nWrite writes the node.\n\n```go\nfunc (w *Writer) WriteText(text string)\n```\nWriteText writes the text.\n\n","path":"github.com/acoderup/goctl/pkg/parser/api/ast","name":"ast","synopsis":"","isRedistributable":true}
