Documentation
¶
Overview ¶
Example ¶
package main import ( "fmt" "kusionstack.io/kclvm-go/pkg/ast" ) func main() { m, err := ast.DecodeModule("../compiler/parser/testdata/a.k.ast.json", nil) if err != nil { panic(err) } fmt.Println(ast.JSONString(m)) }
Output:
Index ¶
- Constants
- Variables
- func JSONMap(x interface{}) map[string]interface{}
- func JSONString(v interface{}) string
- func LoadJson(filename string, src interface{}) (map[string]interface{}, error)
- type Arguments
- type AssertStmt
- type AssignStmt
- type AstType
- type AugAssignStmt
- type BasicType
- type BinaryExpr
- type CallExpr
- type CheckExpr
- type CmdArgSpec
- type CmdOverrideSpec
- type Comment
- type CommentGroup
- type CompClause
- type Compare
- type ConfigEntry
- type ConfigExpr
- type ConfigIfEntryExpr
- type Decorator
- type DictComp
- type DictType
- type Expr
- type ExprStmt
- type File
- type FormattedValue
- type Identifier
- type IfExpr
- type IfStmt
- type ImportStmt
- type JoinedString
- type Keyword
- type LambdaExpr
- type ListComp
- type ListExpr
- type ListIfItemExpr
- type ListType
- type Literal
- type LiteralType
- type Meta
- type Module
- type Name
- type NameConstantLit
- type Node
- type NumberLit
- type ParenExpr
- type Program
- type QuantExpr
- type RuleStmt
- type SchemaAttr
- type SchemaExpr
- type SchemaIndexSignature
- type SchemaStmt
- type SelectorExpr
- type StarredExpr
- type Stmt
- type StringLit
- type Subscript
- type Type
- type TypeAliasStmt
- type TypeInterface
- type UnaryExpr
- type UnificationStmt
Examples ¶
Constants ¶
View Source
const PyAstMD5 = "1ce576862325454fa47ad18736de06cb" // file: ${KCLVM_SRC_ROOT}/kclvm/kcl/ast/ast.py
Variables ¶
View Source
var DebugMode bool
Functions ¶
func JSONString ¶
func JSONString(v interface{}) string
Types ¶
type Arguments ¶
type Arguments struct { *Meta `json:",omitempty"` Args []*Identifier `json:"args"` Defaults []Expr `json:"defaults"` TypeAnnotationList []string `json:"type_annotation_list,omitempty"` TypeAnnotationNodeList []*Type `json:"type_annotation_node_list,omitempty"` }
func (*Arguments) GetNodeType ¶
func (*Arguments) GetPosition ¶
func (*Arguments) JSONString ¶
type AssertStmt ¶
type AssertStmt struct { *Meta `json:",omitempty"` Test Expr `json:"test"` IfCond Expr `json:"if_cond"` Msg Expr `json:"msg"` }
func (*AssertStmt) GetMeta ¶
func (p *AssertStmt) GetMeta() *Meta
func (*AssertStmt) GetNodeType ¶
func (p *AssertStmt) GetNodeType() AstType
func (*AssertStmt) GetPosition ¶
func (p *AssertStmt) GetPosition() (_pos, line, column int)
func (*AssertStmt) JSONMap ¶
func (p *AssertStmt) JSONMap() map[string]interface{}
func (*AssertStmt) JSONString ¶
func (p *AssertStmt) JSONString() string
type AssignStmt ¶
type AssignStmt struct { *Meta `json:",omitempty"` Targets []*Identifier `json:"targets"` Value Expr `json:"value"` TypeAnnotation string `json:"type_annotation"` TypeAnnotationNode *Type `json:"type_annotation_node"` }
func (*AssignStmt) GetMeta ¶
func (p *AssignStmt) GetMeta() *Meta
func (*AssignStmt) GetNodeType ¶
func (p *AssignStmt) GetNodeType() AstType
func (*AssignStmt) GetPosition ¶
func (p *AssignStmt) GetPosition() (_pos, line, column int)
func (*AssignStmt) JSONMap ¶
func (p *AssignStmt) JSONMap() map[string]interface{}
func (*AssignStmt) JSONString ¶
func (p *AssignStmt) JSONString() string
type AstType ¶
type AstType string
const ( Arguments_TypeName AstType = "Arguments" AssertStmt_TypeName AstType = "AssertStmt" AssignStmt_TypeName AstType = "AssignStmt" AugAssignStmt_TypeName AstType = "AugAssignStmt" BasicType_TypeName AstType = "BasicType" BinaryExpr_TypeName AstType = "BinaryExpr" CallExpr_TypeName AstType = "CallExpr" CheckExpr_TypeName AstType = "CheckExpr" Comment_TypeName AstType = "Comment" CommentGroup_TypeName AstType = "CommentGroup" CompClause_TypeName AstType = "CompClause" Compare_TypeName AstType = "Compare" ConfigEntry_TypeName AstType = "ConfigEntry" ConfigExpr_TypeName AstType = "ConfigExpr" ConfigIfEntryExpr_TypeName AstType = "ConfigIfEntryExpr" Decorator_TypeName AstType = "Decorator" DictComp_TypeName AstType = "DictComp" DictType_TypeName AstType = "DictType" ExprStmt_TypeName AstType = "ExprStmt" FormattedValue_TypeName AstType = "FormattedValue" Identifier_TypeName AstType = "Identifier" IfExpr_TypeName AstType = "IfExpr" IfStmt_TypeName AstType = "IfStmt" ImportStmt_TypeName AstType = "ImportStmt" JoinedString_TypeName AstType = "JoinedString" Keyword_TypeName AstType = "Keyword" LambdaExpr_TypeName AstType = "LambdaExpr" ListComp_TypeName AstType = "ListComp" ListExpr_TypeName AstType = "ListExpr" ListIfItemExpr_TypeName AstType = "ListIfItemExpr" ListType_TypeName AstType = "ListType" Literal_TypeName AstType = "Literal" LiteralType_TypeName AstType = "LiteralType" Module_TypeName AstType = "Module" Name_TypeName AstType = "Name" NameConstantLit_TypeName AstType = "NameConstantLit" NumberLit_TypeName AstType = "NumberLit" ParenExpr_TypeName AstType = "ParenExpr" QuantExpr_TypeName AstType = "QuantExpr" RuleStmt_TypeName AstType = "RuleStmt" SchemaAttr_TypeName AstType = "SchemaAttr" SchemaExpr_TypeName AstType = "SchemaExpr" SchemaIndexSignature_TypeName AstType = "SchemaIndexSignature" SchemaStmt_TypeName AstType = "SchemaStmt" SelectorExpr_TypeName AstType = "SelectorExpr" StarredExpr_TypeName AstType = "StarredExpr" StringLit_TypeName AstType = "StringLit" Subscript_TypeName AstType = "Subscript" Type_TypeName AstType = "Type" TypeAliasStmt_TypeName AstType = "TypeAliasStmt" UnaryExpr_TypeName AstType = "UnaryExpr" UnificationStmt_TypeName AstType = "UnificationStmt" )
func GetTypeNameList ¶
func GetTypeNameList() []AstType
type AugAssignStmt ¶
type AugAssignStmt struct { *Meta `json:",omitempty"` Op string `json:"op"` Target *Identifier `json:"target"` Value Expr `json:"value"` }
func (*AugAssignStmt) GetMeta ¶
func (p *AugAssignStmt) GetMeta() *Meta
func (*AugAssignStmt) GetNodeType ¶
func (p *AugAssignStmt) GetNodeType() AstType
func (*AugAssignStmt) GetPosition ¶
func (p *AugAssignStmt) GetPosition() (_pos, line, column int)
func (*AugAssignStmt) JSONMap ¶
func (p *AugAssignStmt) JSONMap() map[string]interface{}
func (*AugAssignStmt) JSONString ¶
func (p *AugAssignStmt) JSONString() string
type BasicType ¶
type BasicType struct { *Meta `json:",omitempty"` TypeElements []TypeInterface `json:"type_elements,omitempty"` TypeName string `json:"type_name"` }
func (*BasicType) GetNodeType ¶
func (*BasicType) GetPosition ¶
func (*BasicType) JSONString ¶
type BinaryExpr ¶
type BinaryExpr struct { *Meta `json:",omitempty"` Left Expr `json:"left"` Op string `json:"op"` Right Expr `json:"right"` }
func (*BinaryExpr) GetMeta ¶
func (p *BinaryExpr) GetMeta() *Meta
func (*BinaryExpr) GetNodeType ¶
func (p *BinaryExpr) GetNodeType() AstType
func (*BinaryExpr) GetPosition ¶
func (p *BinaryExpr) GetPosition() (_pos, line, column int)
func (*BinaryExpr) JSONMap ¶
func (p *BinaryExpr) JSONMap() map[string]interface{}
func (*BinaryExpr) JSONString ¶
func (p *BinaryExpr) JSONString() string
type CallExpr ¶
type CallExpr struct { *Meta `json:",omitempty"` Func Expr `json:"func"` Args []Expr `json:"args"` Keywords []*Keyword `json:"keywords"` }
func (*CallExpr) GetNodeType ¶
func (*CallExpr) GetPosition ¶
func (*CallExpr) JSONString ¶
type CheckExpr ¶
type CheckExpr struct { *Meta `json:",omitempty"` CheckTest Expr `json:"check_test"` IfCond Expr `json:"if_cond"` Msg Expr `json:"msg"` }
func (*CheckExpr) GetNodeType ¶
func (*CheckExpr) GetPosition ¶
func (*CheckExpr) JSONString ¶
type CmdOverrideSpec ¶
type CmdOverrideSpec struct { Pkgpath string `json:"value"` FieldPath string `json:"field_path"` FieldValue string `json:"field_value"` }
kcl main.k -O pkgpath:path.to.field=field_value
type Comment ¶
func (*Comment) GetNodeType ¶
func (*Comment) GetPosition ¶
func (*Comment) JSONString ¶
type CommentGroup ¶
func (*CommentGroup) GetMeta ¶
func (p *CommentGroup) GetMeta() *Meta
func (*CommentGroup) GetNodeType ¶
func (p *CommentGroup) GetNodeType() AstType
func (*CommentGroup) GetPosition ¶
func (p *CommentGroup) GetPosition() (_pos, line, column int)
func (*CommentGroup) JSONMap ¶
func (p *CommentGroup) JSONMap() map[string]interface{}
func (*CommentGroup) JSONString ¶
func (p *CommentGroup) JSONString() string
type CompClause ¶
type CompClause struct { *Meta `json:",omitempty"` Targets []*Identifier `json:"targets"` Iter Expr `json:"iter"` Ifs []Expr `json:"ifs"` }
func (*CompClause) GetMeta ¶
func (p *CompClause) GetMeta() *Meta
func (*CompClause) GetNodeType ¶
func (p *CompClause) GetNodeType() AstType
func (*CompClause) GetPosition ¶
func (p *CompClause) GetPosition() (_pos, line, column int)
func (*CompClause) JSONMap ¶
func (p *CompClause) JSONMap() map[string]interface{}
func (*CompClause) JSONString ¶
func (p *CompClause) JSONString() string
type Compare ¶
type Compare struct { *Meta `json:",omitempty"` Left Expr `json:"left"` Ops []string `json:"ops"` Comparators []Expr `json:"comparators"` }
func (*Compare) GetNodeType ¶
func (*Compare) GetPosition ¶
func (*Compare) JSONString ¶
type ConfigEntry ¶
type ConfigEntry struct { *Meta `json:",omitempty"` Key Expr `json:"key"` Value Expr `json:"value"` Operation int `json:"operation"` InsertIndex int `json:"insert_index"` }
func (*ConfigEntry) GetMeta ¶
func (p *ConfigEntry) GetMeta() *Meta
func (*ConfigEntry) GetNodeType ¶
func (p *ConfigEntry) GetNodeType() AstType
func (*ConfigEntry) GetPosition ¶
func (p *ConfigEntry) GetPosition() (_pos, line, column int)
func (*ConfigEntry) JSONMap ¶
func (p *ConfigEntry) JSONMap() map[string]interface{}
func (*ConfigEntry) JSONString ¶
func (p *ConfigEntry) JSONString() string
type ConfigExpr ¶
type ConfigExpr struct { *Meta `json:",omitempty"` Items []*ConfigEntry `json:"items"` }
func (*ConfigExpr) GetMeta ¶
func (p *ConfigExpr) GetMeta() *Meta
func (*ConfigExpr) GetNodeType ¶
func (p *ConfigExpr) GetNodeType() AstType
func (*ConfigExpr) GetPosition ¶
func (p *ConfigExpr) GetPosition() (_pos, line, column int)
func (*ConfigExpr) JSONMap ¶
func (p *ConfigExpr) JSONMap() map[string]interface{}
func (*ConfigExpr) JSONString ¶
func (p *ConfigExpr) JSONString() string
type ConfigIfEntryExpr ¶
type ConfigIfEntryExpr struct { *Meta `json:",omitempty"` IfCond Expr `json:"if_cond"` Keys []Expr `json:"keys"` Values []Expr `json:"values"` Operations []int `json:"operations"` // string? Orelse Expr `json:"orelse"` }
func (*ConfigIfEntryExpr) GetMeta ¶
func (p *ConfigIfEntryExpr) GetMeta() *Meta
func (*ConfigIfEntryExpr) GetNodeType ¶
func (p *ConfigIfEntryExpr) GetNodeType() AstType
func (*ConfigIfEntryExpr) GetPosition ¶
func (p *ConfigIfEntryExpr) GetPosition() (_pos, line, column int)
func (*ConfigIfEntryExpr) JSONMap ¶
func (p *ConfigIfEntryExpr) JSONMap() map[string]interface{}
func (*ConfigIfEntryExpr) JSONString ¶
func (p *ConfigIfEntryExpr) JSONString() string
type Decorator ¶
type Decorator struct { *Meta `json:",omitempty"` Name *Identifier `json:"name"` Args *CallExpr `json:"args"` }
func (*Decorator) GetNodeType ¶
func (*Decorator) GetPosition ¶
func (*Decorator) JSONString ¶
type DictComp ¶
type DictComp struct { *Meta `json:",omitempty"` Key Expr `json:"key"` Value Expr `json:"value"` Generators []*CompClause `json:"generators"` }
func (*DictComp) GetNodeType ¶
func (*DictComp) GetPosition ¶
func (*DictComp) JSONString ¶
type DictType ¶
type DictType struct { *Meta `json:",omitempty"` KeyType TypeInterface `json:"key_type"` ValueType TypeInterface `json:"value_type"` PlainTypeStr string `json:"plain_type_str"` }
func (*DictType) GetNodeType ¶
func (*DictType) GetPosition ¶
func (*DictType) JSONString ¶
type ExprStmt ¶
func (*ExprStmt) GetNodeType ¶
func (*ExprStmt) GetPosition ¶
func (*ExprStmt) JSONString ¶
type FormattedValue ¶
type FormattedValue struct { *Meta `json:",omitempty"` IsLongString bool `json:"is_long_string"` Value Expr `json:"value"` FormatSpec string `json:"format_spec"` }
func (*FormattedValue) GetMeta ¶
func (p *FormattedValue) GetMeta() *Meta
func (*FormattedValue) GetNodeType ¶
func (p *FormattedValue) GetNodeType() AstType
func (*FormattedValue) GetPosition ¶
func (p *FormattedValue) GetPosition() (_pos, line, column int)
func (*FormattedValue) JSONMap ¶
func (p *FormattedValue) JSONMap() map[string]interface{}
func (*FormattedValue) JSONString ¶
func (p *FormattedValue) JSONString() string
type Identifier ¶
type Identifier struct { *Meta `json:",omitempty"` Names []string `json:"names"` Pkgpath string `json:"pkgpath"` Ctx string `json:"ctx"` NameNodes []*Name `json:"name_nodes,omitempty"` }
func (*Identifier) GetMeta ¶
func (p *Identifier) GetMeta() *Meta
func (*Identifier) GetNodeType ¶
func (p *Identifier) GetNodeType() AstType
func (*Identifier) GetPosition ¶
func (p *Identifier) GetPosition() (_pos, line, column int)
func (*Identifier) JSONMap ¶
func (p *Identifier) JSONMap() map[string]interface{}
func (*Identifier) JSONString ¶
func (p *Identifier) JSONString() string
type IfExpr ¶
type IfExpr struct { *Meta `json:",omitempty"` Body Expr `json:"body"` Cond Expr `json:"cond"` OrElse Expr `json:"orelse"` }
func (*IfExpr) GetNodeType ¶
func (*IfExpr) GetPosition ¶
func (*IfExpr) JSONString ¶
type IfStmt ¶
type IfStmt struct { *Meta `json:",omitempty"` Cond Expr `json:"cond"` Body []Stmt `json:"body"` ElifCond []Expr `json:"elif_cond"` ElifBody [][]Stmt `json:"elif_body"` ElseBody []Stmt `json:"else_body"` }
func (*IfStmt) GetNodeType ¶
func (*IfStmt) GetPosition ¶
func (*IfStmt) JSONString ¶
type ImportStmt ¶
type ImportStmt struct { *Meta `json:",omitempty"` Path string `json:"path"` Name string `json:"name"` AsName string `json:"asname"` PathNodes []*Name `json:"path_nodes,omitempty"` AsNameNode *Name `json:"as_name_node,omitempty"` RawPath string `json:"rawpath"` }
func (*ImportStmt) GetMeta ¶
func (p *ImportStmt) GetMeta() *Meta
func (*ImportStmt) GetNodeType ¶
func (p *ImportStmt) GetNodeType() AstType
func (*ImportStmt) GetPosition ¶
func (p *ImportStmt) GetPosition() (_pos, line, column int)
func (*ImportStmt) JSONMap ¶
func (p *ImportStmt) JSONMap() map[string]interface{}
func (*ImportStmt) JSONString ¶
func (p *ImportStmt) JSONString() string
type JoinedString ¶
type JoinedString struct { *Meta `json:",omitempty"` IsLongString bool `json:"is_long_string"` Values []Expr `json:"values"` // StringLit, FormattedValue RawValue string `json:"raw_value"` }
func (*JoinedString) GetMeta ¶
func (p *JoinedString) GetMeta() *Meta
func (*JoinedString) GetNodeType ¶
func (p *JoinedString) GetNodeType() AstType
func (*JoinedString) GetPosition ¶
func (p *JoinedString) GetPosition() (_pos, line, column int)
func (*JoinedString) JSONMap ¶
func (p *JoinedString) JSONMap() map[string]interface{}
func (*JoinedString) JSONString ¶
func (p *JoinedString) JSONString() string
type Keyword ¶
type Keyword struct { *Meta `json:",omitempty"` Arg *Identifier `json:"arg"` Value Expr `json:"value"` }
func (*Keyword) GetNodeType ¶
func (*Keyword) GetPosition ¶
func (*Keyword) JSONString ¶
type LambdaExpr ¶
type LambdaExpr struct { *Meta `json:",omitempty"` Args *Arguments `json:"args"` ReturnTypeStr string `json:"return_type_str"` ReturnTypeNode *Type `json:"return_type_node"` Body []Stmt `json:"body"` }
func (*LambdaExpr) GetMeta ¶
func (p *LambdaExpr) GetMeta() *Meta
func (*LambdaExpr) GetNodeType ¶
func (p *LambdaExpr) GetNodeType() AstType
func (*LambdaExpr) GetPosition ¶
func (p *LambdaExpr) GetPosition() (_pos, line, column int)
func (*LambdaExpr) JSONMap ¶
func (p *LambdaExpr) JSONMap() map[string]interface{}
func (*LambdaExpr) JSONString ¶
func (p *LambdaExpr) JSONString() string
type ListComp ¶
type ListComp struct { *Meta `json:",omitempty"` Elt Expr `json:"elt"` Generators []*CompClause `json:"generators"` }
func (*ListComp) GetNodeType ¶
func (*ListComp) GetPosition ¶
func (*ListComp) JSONString ¶
type ListExpr ¶
type ListExpr struct { *Meta `json:",omitempty"` Elts []Expr `json:"elts"` Ctx string `json:"ctx"` }
func (*ListExpr) GetNodeType ¶
func (*ListExpr) GetPosition ¶
func (*ListExpr) JSONString ¶
type ListIfItemExpr ¶
type ListIfItemExpr struct { *Meta `json:",omitempty"` IfCond Expr `json:"if_cond"` Exprs []Expr `json:"exprs"` Orelse Expr `json:"orelse"` }
func (*ListIfItemExpr) GetMeta ¶
func (p *ListIfItemExpr) GetMeta() *Meta
func (*ListIfItemExpr) GetNodeType ¶
func (p *ListIfItemExpr) GetNodeType() AstType
func (*ListIfItemExpr) GetPosition ¶
func (p *ListIfItemExpr) GetPosition() (_pos, line, column int)
func (*ListIfItemExpr) JSONMap ¶
func (p *ListIfItemExpr) JSONMap() map[string]interface{}
func (*ListIfItemExpr) JSONString ¶
func (p *ListIfItemExpr) JSONString() string
type ListType ¶
type ListType struct { *Meta `json:",omitempty"` InnerType TypeInterface `json:"inner_type"` PlainTypeStr string `json:"plain_type_str"` }
func (*ListType) GetNodeType ¶
func (*ListType) GetPosition ¶
func (*ListType) JSONString ¶
type Literal ¶
type Literal struct { *Meta `json:",omitempty"` Value interface{} `json:"value"` }
func (*Literal) GetNodeType ¶
func (*Literal) GetPosition ¶
func (*Literal) JSONString ¶
type LiteralType ¶
type LiteralType struct { *Meta `json:",omitempty"` PlainValue string `json:"plain_value"` ValueType string `json:"value_type"` StringValue *StringLit `json:"string_value"` NumberValue *NumberLit `json:"number_value"` }
func (*LiteralType) GetMeta ¶
func (p *LiteralType) GetMeta() *Meta
func (*LiteralType) GetNodeType ¶
func (p *LiteralType) GetNodeType() AstType
func (*LiteralType) GetPosition ¶
func (p *LiteralType) GetPosition() (_pos, line, column int)
func (*LiteralType) JSONMap ¶
func (p *LiteralType) JSONMap() map[string]interface{}
func (*LiteralType) JSONString ¶
func (p *LiteralType) JSONString() string
type Meta ¶
type Meta struct { AstType AstType `json:"_ast_type,omitempty"` Filename string `json:"filename,omitempty"` RelativeFilename string `json:"relative_filename"` Line int `json:"line,omitempty"` Column int `json:"column,omitempty"` EndLine int `json:"end_line,omitempty"` EndColumn int `json:"end_column,omitempty"` }
type Module ¶
type Module struct { *Meta `json:",omitempty"` Pkg string `json:"pkg"` Body []Stmt `json:"body"` Doc string `json:"doc"` Name string `json:"name"` GlobalNames []string `json:"global_names"` LocalNames map[string][]string `json:"local_names"` Comments []*Comment `json:"comments"` }
func DecodeModule ¶
func (*Module) GetNodeType ¶
func (*Module) GetPosition ¶
func (*Module) JSONString ¶
type NameConstantLit ¶
type NameConstantLit struct { *Meta `json:",omitempty"` Value string `json:"value"` // True, False, None }
func (*NameConstantLit) GetMeta ¶
func (p *NameConstantLit) GetMeta() *Meta
func (*NameConstantLit) GetNodeType ¶
func (p *NameConstantLit) GetNodeType() AstType
func (*NameConstantLit) GetPosition ¶
func (p *NameConstantLit) GetPosition() (_pos, line, column int)
func (*NameConstantLit) JSONMap ¶
func (p *NameConstantLit) JSONMap() map[string]interface{}
func (*NameConstantLit) JSONString ¶
func (p *NameConstantLit) JSONString() string
type Node ¶
type Node interface { GetNodeType() AstType GetMeta() *Meta JSONString() string JSONMap() map[string]interface{} GetPosition() (_pos, line, column int) }
func MustNewNode ¶
type NumberLit ¶
type NumberLit struct { *Meta `json:",omitempty"` Value float64 `json:"value"` BinarySuffix string `json:"binary_suffix"` }
func (*NumberLit) GetNodeType ¶
func (*NumberLit) GetPosition ¶
func (*NumberLit) JSONString ¶
type ParenExpr ¶
func (*ParenExpr) GetNodeType ¶
func (*ParenExpr) GetPosition ¶
func (*ParenExpr) JSONString ¶
type Program ¶
type Program struct { Root string `json:"root"` Main string `json:"main"` Pkgs map[string][]*Module `json:"pkgs"` CmdArgs []*CmdArgSpec `json:"cmd_args"` CmdOverrides []*CmdOverrideSpec `json:"cmd_overrides"` }
type QuantExpr ¶
type QuantExpr struct { *Meta `json:",omitempty"` Target Expr `json:"target"` Variables []*Identifier `json:"variables"` Op int `json:"op"` // string? CheckTest Expr `json:"check_test"` IfCond Expr `json:"if_cond"` Ctx string `json:"ctx"` }
func (*QuantExpr) GetNodeType ¶
func (*QuantExpr) GetPosition ¶
func (*QuantExpr) JSONString ¶
type RuleStmt ¶
type RuleStmt struct { *Meta `json:",omitempty"` Doc string `json:"doc"` Name string `json:"name"` ParentRules []*Identifier `json:"parent_rules"` Decorators []*Decorator `json:"decorators"` Checks []*CheckExpr `json:"checks"` NameNode *Name `json:"name_node,omitempty"` Args *Arguments `json:"args"` ForHostName *Identifier `json:"for_host_name"` }
func (*RuleStmt) GetNodeType ¶
func (*RuleStmt) GetPosition ¶
func (*RuleStmt) JSONString ¶
type SchemaAttr ¶
type SchemaAttr struct { *Meta `json:",omitempty"` Doc string `json:"doc"` Name string `json:"name"` TypeStr string `json:"type_str"` Op string `json:"op"` Value Expr `json:"value"` IsFinal bool `json:"is_final"` IsOptional bool `json:"is_optional"` Decorators []*Decorator `json:"decorators"` NameNode *Name `json:"name_node,omitempty"` TypeNode *Type `json:"type_node,omitempty"` }
func (*SchemaAttr) GetMeta ¶
func (p *SchemaAttr) GetMeta() *Meta
func (*SchemaAttr) GetNodeType ¶
func (p *SchemaAttr) GetNodeType() AstType
func (*SchemaAttr) GetPosition ¶
func (p *SchemaAttr) GetPosition() (_pos, line, column int)
func (*SchemaAttr) JSONMap ¶
func (p *SchemaAttr) JSONMap() map[string]interface{}
func (*SchemaAttr) JSONString ¶
func (p *SchemaAttr) JSONString() string
type SchemaExpr ¶
type SchemaExpr struct { *Meta `json:",omitempty"` Name *Identifier `json:"name"` Args []Expr `json:"args"` Kwargs []*Keyword `json:"kwargs"` Config *ConfigExpr `json:"config"` }
func (*SchemaExpr) GetMeta ¶
func (p *SchemaExpr) GetMeta() *Meta
func (*SchemaExpr) GetNodeType ¶
func (p *SchemaExpr) GetNodeType() AstType
func (*SchemaExpr) GetPosition ¶
func (p *SchemaExpr) GetPosition() (_pos, line, column int)
func (*SchemaExpr) JSONMap ¶
func (p *SchemaExpr) JSONMap() map[string]interface{}
func (*SchemaExpr) JSONString ¶
func (p *SchemaExpr) JSONString() string
type SchemaIndexSignature ¶
type SchemaIndexSignature struct { *Meta `json:",omitempty"` KeyName string `json:"key_name"` KeyType string `json:"key_type"` ValueType string `json:"value_type"` Value Expr `json:"value"` AnyOther bool `json:"any_other"` NameNode *Name `json:"name_node,omitempty"` ValueTypeNode *Type `json:"value_type_node"` }
func (*SchemaIndexSignature) GetMeta ¶
func (p *SchemaIndexSignature) GetMeta() *Meta
func (*SchemaIndexSignature) GetNodeType ¶
func (p *SchemaIndexSignature) GetNodeType() AstType
func (*SchemaIndexSignature) GetPosition ¶
func (p *SchemaIndexSignature) GetPosition() (_pos, line, column int)
func (*SchemaIndexSignature) JSONMap ¶
func (p *SchemaIndexSignature) JSONMap() map[string]interface{}
func (*SchemaIndexSignature) JSONString ¶
func (p *SchemaIndexSignature) JSONString() string
type SchemaStmt ¶
type SchemaStmt struct { *Meta `json:",omitempty"` Doc string `json:"doc"` Name string `json:"name"` ParentName *Identifier `json:"parent_name"` ForHostName *Identifier `json:"for_host_name"` IsRelaxed bool `json:"is_relaxed"` IsMixin bool `json:"is_mixin"` IsProtocol bool `json:"is_protocol"` Args *Arguments `json:"args"` Mixins []*Identifier `json:"mixins"` Body []Stmt `json:"body"` Decorators []*Decorator `json:"decorators"` Checks []*CheckExpr `json:"checks"` IndexSignature *SchemaIndexSignature `json:"index_signature"` NameNode *Name `json:"name_node,omitempty"` }
func (*SchemaStmt) GetMeta ¶
func (p *SchemaStmt) GetMeta() *Meta
func (*SchemaStmt) GetNodeType ¶
func (p *SchemaStmt) GetNodeType() AstType
func (*SchemaStmt) GetPosition ¶
func (p *SchemaStmt) GetPosition() (_pos, line, column int)
func (*SchemaStmt) JSONMap ¶
func (p *SchemaStmt) JSONMap() map[string]interface{}
func (*SchemaStmt) JSONString ¶
func (p *SchemaStmt) JSONString() string
type SelectorExpr ¶
type SelectorExpr struct { *Meta `json:",omitempty"` Value Expr `json:"value"` Attr *Identifier `json:"attr"` Ctx string `json:"ctx"` HasQuestion bool `json:"has_question"` }
func (*SelectorExpr) GetMeta ¶
func (p *SelectorExpr) GetMeta() *Meta
func (*SelectorExpr) GetNodeType ¶
func (p *SelectorExpr) GetNodeType() AstType
func (*SelectorExpr) GetPosition ¶
func (p *SelectorExpr) GetPosition() (_pos, line, column int)
func (*SelectorExpr) JSONMap ¶
func (p *SelectorExpr) JSONMap() map[string]interface{}
func (*SelectorExpr) JSONString ¶
func (p *SelectorExpr) JSONString() string
type StarredExpr ¶
type StarredExpr struct { *Meta `json:",omitempty"` Value Expr `json:"value"` Ctx string `json:"ctx"` }
func (*StarredExpr) GetMeta ¶
func (p *StarredExpr) GetMeta() *Meta
func (*StarredExpr) GetNodeType ¶
func (p *StarredExpr) GetNodeType() AstType
func (*StarredExpr) GetPosition ¶
func (p *StarredExpr) GetPosition() (_pos, line, column int)
func (*StarredExpr) JSONMap ¶
func (p *StarredExpr) JSONMap() map[string]interface{}
func (*StarredExpr) JSONString ¶
func (p *StarredExpr) JSONString() string
type StringLit ¶
type StringLit struct { *Meta `json:",omitempty"` Value string `json:"value"` IsLongString bool `json:"is_long_string"` RawValue string `json:"raw_value"` }
func (*StringLit) GetNodeType ¶
func (*StringLit) GetPosition ¶
func (*StringLit) JSONString ¶
type Subscript ¶
type Subscript struct { *Meta `json:",omitempty"` Value Expr `json:"value"` Index Expr `json:"index"` Lower Expr `json:"lower"` Upper Expr `json:"upper"` Step Expr `json:"step"` Ctx string `json:"ctx"` HasQuestion bool `json:"has_question"` }
func (*Subscript) GetNodeType ¶
func (*Subscript) GetPosition ¶
func (*Subscript) JSONString ¶
type Type ¶
type Type struct { *Meta `json:",omitempty"` TypeElements []TypeInterface `json:"type_elements,omitempty"` PlainTypeStr string `json:"plain_type_str"` }
func (*Type) GetNodeType ¶
func (*Type) GetPosition ¶
func (*Type) JSONString ¶
type TypeAliasStmt ¶
type TypeAliasStmt struct { *Meta `json:",omitempty"` TypeName string `json:"type_name"` TypeValue *Type `json:"type_value"` }
func (*TypeAliasStmt) GetMeta ¶
func (p *TypeAliasStmt) GetMeta() *Meta
func (*TypeAliasStmt) GetNodeType ¶
func (p *TypeAliasStmt) GetNodeType() AstType
func (*TypeAliasStmt) GetPosition ¶
func (p *TypeAliasStmt) GetPosition() (_pos, line, column int)
func (*TypeAliasStmt) JSONMap ¶
func (p *TypeAliasStmt) JSONMap() map[string]interface{}
func (*TypeAliasStmt) JSONString ¶
func (p *TypeAliasStmt) JSONString() string
type TypeInterface ¶
type TypeInterface interface { Node // contains filtered or unexported methods }
type UnaryExpr ¶
type UnaryExpr struct { *Meta `json:",omitempty"` Op string `json:"op"` Operand Expr `json:"operand"` }
func (*UnaryExpr) GetNodeType ¶
func (*UnaryExpr) GetPosition ¶
func (*UnaryExpr) JSONString ¶
type UnificationStmt ¶
type UnificationStmt struct { *Meta `json:",omitempty"` Target *Identifier `json:"target"` Value *SchemaExpr `json:"value"` }
func (*UnificationStmt) GetMeta ¶
func (p *UnificationStmt) GetMeta() *Meta
func (*UnificationStmt) GetNodeType ¶
func (p *UnificationStmt) GetNodeType() AstType
func (*UnificationStmt) GetPosition ¶
func (p *UnificationStmt) GetPosition() (_pos, line, column int)
func (*UnificationStmt) JSONMap ¶
func (p *UnificationStmt) JSONMap() map[string]interface{}
func (*UnificationStmt) JSONString ¶
func (p *UnificationStmt) JSONString() string
Click to show internal directories.
Click to hide internal directories.