dbscheme

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AliasSpecType = SpecKind.NewBranch("@aliasspec", TypeSpecType)

AliasSpecType is the type of type declaration specification nodes corresponding to alias declarations

View Source
var ArithmeticBinaryExpr = NewUnionType("@arithmeticbinaryexpr", BinaryExpr, ArithmeticExpr)

ArithmeticBinaryExpr is the type of arithmetic binary operator expression AST nodes

View Source
var ArithmeticExpr = NewUnionType("@arithmeticexpr", OperatorExpr)

ArithmeticExpr is the type of arithmetic operator expression AST nodes

View Source
var ArithmeticUnaryExpr = NewUnionType("@arithmeticunaryexpr", UnaryExpr, ArithmeticExpr)

ArithmeticUnaryExpr is the type of arithmetic unary operator expression AST nodes

View Source
var ArrayLengthTable = NewTable("array_length",
	EntityColumn(ArrayType, "tp").Unique(),
	StringColumn("len"),
)

ArrayLengthTable is the table associating array types with their length (represented as a string since Go array lengths are 64-bit and hence do not always fit into a QL integer)

View Source
var ArrayType = TypeKind.NewBranch("@arraytype", ElementContainerType)

ArrayType is the type of array types

View Source
var ArrayTypeExpr = ExprKind.NewBranch("@arraytypeexpr")

ArrayTypeExpr is the type of array type AST nodes

View Source
var AssignStmtTypes = map[token.Token]*BranchType{
	token.ASSIGN:         StmtKind.NewBranch("@assignstmt", SimpleAssignStmtType),
	token.DEFINE:         StmtKind.NewBranch("@definestmt", SimpleAssignStmtType),
	token.ADD_ASSIGN:     StmtKind.NewBranch("@addassignstmt", CompoundAssignStmtType),
	token.SUB_ASSIGN:     StmtKind.NewBranch("@subassignstmt", CompoundAssignStmtType),
	token.MUL_ASSIGN:     StmtKind.NewBranch("@mulassignstmt", CompoundAssignStmtType),
	token.QUO_ASSIGN:     StmtKind.NewBranch("@quoassignstmt", CompoundAssignStmtType),
	token.REM_ASSIGN:     StmtKind.NewBranch("@remassignstmt", CompoundAssignStmtType),
	token.AND_ASSIGN:     StmtKind.NewBranch("@andassignstmt", CompoundAssignStmtType),
	token.OR_ASSIGN:      StmtKind.NewBranch("@orassignstmt", CompoundAssignStmtType),
	token.XOR_ASSIGN:     StmtKind.NewBranch("@xorassignstmt", CompoundAssignStmtType),
	token.SHL_ASSIGN:     StmtKind.NewBranch("@shlassignstmt", CompoundAssignStmtType),
	token.SHR_ASSIGN:     StmtKind.NewBranch("@shrassignstmt", CompoundAssignStmtType),
	token.AND_NOT_ASSIGN: StmtKind.NewBranch("@andnotassignstmt", CompoundAssignStmtType),
}

AssignStmtTypes is a map from assignmnt operator tokens to corresponding AST node types

View Source
var AssignmentType = NewUnionType("@assignment")

AssignmentType is the type of assignment statement AST nodes

View Source
var BadDeclType = DeclKind.NewBranch("@baddecl")

BadDeclType is the type of bad (that is, unparseable) declaration AST nodes

View Source
var BadExpr = ExprKind.NewBranch("@badexpr")

BadExpr is type of bad (that is, unparseable) expression AST nodes

View Source
var BadStmtType = StmtKind.NewBranch("@badstmt")

BadStmtType is the type of bad (that is, unparseable) statement AST nodes

View Source
var BaseTypeTable = NewTable("base_type",
	EntityColumn(PointerType, "ptr").Unique(),
	EntityColumn(TypeType, "tp"),
)

BaseTypeTable is the table associating pointer types with their base type

View Source
var BasicLitExpr = NewUnionType("@basiclit")

BasicLitExpr is the type of basic (that is, primitive) literal expression AST nodes

View Source
var BasicType = NewUnionType("@basictype")

BasicType is the union of all basic types

View Source
var BasicTypes = map[gotypes.BasicKind]*BranchType{
	gotypes.Invalid:        TypeKind.NewBranch("@invalidtype", BasicType),
	gotypes.Bool:           TypeKind.NewBranch("@boolexprtype", BoolType),
	gotypes.Int:            TypeKind.NewBranch("@inttype", SignedIntegerType),
	gotypes.Int8:           TypeKind.NewBranch("@int8type", SignedIntegerType),
	gotypes.Int16:          TypeKind.NewBranch("@int16type", SignedIntegerType),
	gotypes.Int32:          TypeKind.NewBranch("@int32type", SignedIntegerType),
	gotypes.Int64:          TypeKind.NewBranch("@int64type", SignedIntegerType),
	gotypes.Uint:           TypeKind.NewBranch("@uinttype", UnsignedIntegerType),
	gotypes.Uint8:          TypeKind.NewBranch("@uint8type", UnsignedIntegerType),
	gotypes.Uint16:         TypeKind.NewBranch("@uint16type", UnsignedIntegerType),
	gotypes.Uint32:         TypeKind.NewBranch("@uint32type", UnsignedIntegerType),
	gotypes.Uint64:         TypeKind.NewBranch("@uint64type", UnsignedIntegerType),
	gotypes.Uintptr:        TypeKind.NewBranch("@uintptrtype", UnsignedIntegerType),
	gotypes.Float32:        TypeKind.NewBranch("@float32type", FloatType),
	gotypes.Float64:        TypeKind.NewBranch("@float64type", FloatType),
	gotypes.Complex64:      TypeKind.NewBranch("@complex64type", ComplexType),
	gotypes.Complex128:     TypeKind.NewBranch("@complex128type", ComplexType),
	gotypes.String:         TypeKind.NewBranch("@stringexprtype", StringType),
	gotypes.UnsafePointer:  TypeKind.NewBranch("@unsafepointertype", BasicType),
	gotypes.UntypedBool:    TypeKind.NewBranch("@boolliteraltype", LiteralType, BoolType),
	gotypes.UntypedInt:     TypeKind.NewBranch("@intliteraltype", LiteralType, SignedIntegerType),
	gotypes.UntypedRune:    TypeKind.NewBranch("@runeliteraltype", LiteralType, SignedIntegerType),
	gotypes.UntypedFloat:   TypeKind.NewBranch("@floatliteraltype", LiteralType, FloatType),
	gotypes.UntypedComplex: TypeKind.NewBranch("@complexliteraltype", LiteralType, ComplexType),
	gotypes.UntypedString:  TypeKind.NewBranch("@stringliteraltype", LiteralType, StringType),
	gotypes.UntypedNil:     TypeKind.NewBranch("@nilliteraltype", LiteralType),
}

BasicTypes is a map from basic type kinds to the corresponding entity types

View Source
var BinaryExpr = NewUnionType("@binaryexpr", OperatorExpr)

BinaryExpr is the type of binary operator expression AST nodes

View Source
var BinaryExprs = map[token.Token]*BranchType{
	token.LOR:     ExprKind.NewBranch("@lorexpr", LogicalBinaryExpr),
	token.LAND:    ExprKind.NewBranch("@landexpr", LogicalBinaryExpr),
	token.EQL:     ExprKind.NewBranch("@eqlexpr", EqualityTest),
	token.NEQ:     ExprKind.NewBranch("@neqexpr", EqualityTest),
	token.LSS:     ExprKind.NewBranch("@lssexpr", RelationalComparison),
	token.LEQ:     ExprKind.NewBranch("@leqexpr", RelationalComparison),
	token.GTR:     ExprKind.NewBranch("@gtrexpr", RelationalComparison),
	token.GEQ:     ExprKind.NewBranch("@geqexpr", RelationalComparison),
	token.ADD:     ExprKind.NewBranch("@addexpr", ArithmeticBinaryExpr),
	token.SUB:     ExprKind.NewBranch("@subexpr", ArithmeticBinaryExpr),
	token.OR:      ExprKind.NewBranch("@orexpr", BitwiseBinaryExpr),
	token.XOR:     ExprKind.NewBranch("@xorexpr", BitwiseBinaryExpr),
	token.MUL:     ExprKind.NewBranch("@mulexpr", ArithmeticBinaryExpr),
	token.QUO:     ExprKind.NewBranch("@quoexpr", ArithmeticBinaryExpr),
	token.REM:     ExprKind.NewBranch("@remexpr", ArithmeticBinaryExpr),
	token.SHL:     ExprKind.NewBranch("@shlexpr", ShiftExpr),
	token.SHR:     ExprKind.NewBranch("@shrexpr", ShiftExpr),
	token.AND:     ExprKind.NewBranch("@andexpr", BitwiseBinaryExpr),
	token.AND_NOT: ExprKind.NewBranch("@andnotexpr", BitwiseBinaryExpr),
}

BinaryExprs is a map from binary operator tokens to the corresponding AST node type

View Source
var BitwiseBinaryExpr = NewUnionType("@bitwisebinaryexpr", BinaryExpr, BitwiseExpr)

BitwiseBinaryExpr is the type of bitwise binary operator expression AST nodes

View Source
var BitwiseExpr = NewUnionType("@bitwiseexpr", OperatorExpr)

BitwiseExpr is the type of bitwise operator expression AST nodes

View Source
var BitwiseUnaryExpr = NewUnionType("@bitwiseunaryexpr", UnaryExpr, BitwiseExpr)

BitwiseUnaryExpr is the type of bitwise unary operator expression AST nodes

View Source
var BlockStmtType = StmtKind.NewBranch("@blockstmt", ScopeNodeType)

BlockStmtType is the type of block statement AST nodes

View Source
var BoolType = NewUnionType("@booltype", BasicType)

BoolType is the union of the normal and literal bool types

View Source
var BranchStmtType = NewUnionType("@branchstmt")

BranchStmtType is the type of branch statement AST nodes

View Source
var BreakStmtType = StmtKind.NewBranch("@breakstmt", BranchStmtType)

BreakStmtType is the type of break statement AST nodes

View Source
var BuiltinConstObjectType = ObjectKind.NewBranch("@builtinconstobject", ConstObjectType, BuiltinObjectType)

BuiltinConstObjectType is the type of built-in constants

View Source
var BuiltinFuncObjectType = ObjectKind.NewBranch("@builtinfunctionobject", FunctionObjectType, BuiltinObjectType)

BuiltinFuncObjectType is the type of built-in functions

View Source
var BuiltinObjectType = NewUnionType("@builtinobject")

BuiltinObjectType is the type of built-in objects

View Source
var BuiltinTypeObjectType = ObjectKind.NewBranch("@builtintypeobject", TypeObjectType, BuiltinObjectType)

BuiltinTypeObjectType is the type of built-in named types

View Source
var CallOrConversionExpr = ExprKind.NewBranch("@callorconversionexpr")

CallOrConversionExpr is the type of call and conversion expression AST nodes (which cannot be distinguished by purely syntactic criteria)

View Source
var CaseClauseType = StmtKind.NewBranch("@caseclause", ScopeNodeType)

CaseClauseType is the type of case clause AST nodes

View Source
var ChanType = NewUnionType("@chantype", ElementContainerType)

ChanType is the type of channel types

View Source
var ChanTypeExpr = NewUnionType("@chantypeexpr")

ChanTypeExpr is the type of channel type AST nodes

View Source
var ChanTypeExprs = map[ast.ChanDir]*BranchType{
	ast.SEND:            ExprKind.NewBranch("@sendchantypeexpr", ChanTypeExpr),
	ast.RECV:            ExprKind.NewBranch("@recvchantypeexpr", ChanTypeExpr),
	ast.SEND | ast.RECV: ExprKind.NewBranch("@sendrcvchantypeexpr", ChanTypeExpr),
}

ChanTypeExprs is a map from channel type expressions to the corresponding AST node type

View Source
var ChanTypes = map[gotypes.ChanDir]*BranchType{
	gotypes.SendOnly: TypeKind.NewBranch("@sendchantype", ChanType),
	gotypes.RecvOnly: TypeKind.NewBranch("@recvchantype", ChanType),
	gotypes.SendRecv: TypeKind.NewBranch("@sendrcvchantype", ChanType),
}

ChanTypes is a map from channel type directions to the corresponding type

View Source
var CharLitExpr = ExprKind.NewBranch("@charlit", BasicLitExpr)

CharLitExpr is the type of character literal expression AST nodes

View Source
var CommClauseType = StmtKind.NewBranch("@commclause", ScopeNodeType)

CommClauseType is the type of comm clause AST ndoes

View Source
var CommentGroupType = NewPrimaryKeyType("@comment_group", NodeType)

CommentGroupType is the type of comment groups

View Source
var CommentGroupsTable = NewTable("comment_groups",
	EntityColumn(CommentGroupType, "id").Key(),
	EntityColumn(FileType, "parent"),
	IntColumn("idx"),
).KeySet("parent", "idx")

CommentGroupsTable is the table defining comment group entities

View Source
var CommentKind = NewCaseType(CommentType, "kind")

CommentKind is a case type for distinguishing different kinds of comments

View Source
var CommentType = NewPrimaryKeyType("@comment", NodeType)

CommentType is the type of comments

View Source
var CommentsTable = NewTable("comments",
	EntityColumn(CommentType, "id").Key(),
	IntColumn("kind"),
	EntityColumn(CommentGroupType, "parent"),
	IntColumn("idx"),
	StringColumn("text"),
)

CommentsTable is the table defining comment entities

View Source
var Comparison = NewUnionType("@comparison", BinaryExpr)

Comparison is the type of comparison operator expression AST nodes

View Source
var ComplexType = NewUnionType("@complextype", NumericType)

ComplexType is the union of complex types

View Source
var ComponentTypesTable = NewTable("component_types",
	EntityColumn(CompositeType, "parent"),
	IntColumn("index"),
	StringColumn("name"),
	EntityColumn(TypeType, "tp"),
).KeySet("parent", "index")

ComponentTypesTable is the table associating composite types with their component types

View Source
var CompositeLitExpr = ExprKind.NewBranch("@compositelit")

CompositeLitExpr is the type of composite literal expression AST nodes

View Source
var CompositeType = NewUnionType("@compositetype")

CompositeType is the type of all composite (that is, non-basic) types

View Source
var CompoundAssignStmtType = NewUnionType("@compoundassignstmt", AssignmentType)

CompoundAssignStmtType is the type of compound assignment statement AST nodes

View Source
var ConstDeclType = DeclKind.NewBranch("@constdecl", GenDeclType)

ConstDeclType is the type of constant declaration AST nodes

View Source
var ConstObjectType = NewUnionType("@constobject", ValueObjectType)

ConstObjectType is the type of declared or built-in constants

View Source
var ConstValuesTable = NewTable("constvalues",
	EntityColumn(ExprType, "expr").Unique(),
	StringColumn("value"),
	StringColumn("exact"),
)

ConstValuesTable is the table associating constant expressions with their values

View Source
var ContainerParentTable = NewTable("containerparent",
	EntityColumn(ContainerType, "parent"),
	EntityColumn(ContainerType, "child").Unique(),
)

ContainerParentTable is the table defining the parent-child relation among container entities

View Source
var ContainerType = NewUnionType("@container")

ContainerType is the type of files and folders

View Source
var ContinueStmtType = StmtKind.NewBranch("@continuestmt", BranchStmtType)

ContinueStmtType is the type of continue statement AST nodes

View Source
var DecStmtType = StmtKind.NewBranch("@decstmt", IncDecStmtType)

DecStmtType is the type of decrement statement AST nodes

View Source
var DeclConstObjectType = ObjectKind.NewBranch("@declconstobject", ConstObjectType, DeclObjectType)

DeclConstObjectType is the type of declared constants

View Source
var DeclFuncObjectType = ObjectKind.NewBranch("@declfunctionobject", FunctionObjectType, DeclObjectType)

DeclFuncObjectType is the type of declared functions, including (abstract and concrete) methods

View Source
var DeclKind = NewCaseType(DeclType, "kind")

DeclKind is a case type for distinguishing different kinds of declaration AST nodes

View Source
var DeclObjectType = NewUnionType("@declobject")

DeclObjectType is the type of declared objects

View Source
var DeclParentType = NewUnionType("@declparent", NodeType)

DeclParentType is the type of AST nodes that can have declarations as children

View Source
var DeclStmtType = StmtKind.NewBranch("@declstmt", DeclParentType)

DeclStmtType is the type of declaration statement AST nodes

DeclType is the type of declaration AST nodes

View Source
var DeclTypeObjectType = ObjectKind.NewBranch("@decltypeobject", TypeObjectType, DeclObjectType)

DeclTypeObjectType is the type of declared named types

View Source
var DeclVarObjectType = ObjectKind.NewBranch("@declvarobject", VarObjectType, DeclObjectType)

DeclVarObjectType is the type of declared variables including function parameters, results and struct fields

View Source
var DeclsTable = NewTable("decls",
	EntityColumn(DeclType, "id").Key(),
	IntColumn("kind"),
	EntityColumn(DeclParentType, "parent"),
	IntColumn("idx"),
).KeySet("parent", "idx")

DeclsTable is the table defining declaration AST nodes

View Source
var DeferStmtType = StmtKind.NewBranch("@deferstmt")

DeferStmtType is the type of defer statement AST nodes

View Source
var DefsTable = NewTable("defs",
	EntityColumn(IdentExpr, "ident"),
	EntityColumn(ObjectType, "object"),
)

DefsTable maps identifiers to the objects they define

View Source
var DocCommentsTable = NewTable("doc_comments",
	EntityColumn(DocumentableType, "node").Unique(),
	EntityColumn(CommentGroupType, "comment"),
)

DocCommentsTable is the table associating doc comments with the nodes they document

View Source
var DocumentableType = NewUnionType("@documentable", NodeType)

DocumentableType is the type of AST nodes to which documentation can be attached

View Source
var ElementContainerType = NewUnionType("@containertype", CompositeType)

ElementContainerType is the type of types that have elements, such as arrays and channels

View Source
var ElementTypeTable = NewTable("element_type",
	EntityColumn(ElementContainerType, "container").Unique(),
	EntityColumn(TypeType, "tp"),
)

ElementTypeTable is the table associating container types with their element type

View Source
var EllipsisExpr = ExprKind.NewBranch("@ellipsis")

EllipsisExpr is the type of ellipsis expression AST nodes

View Source
var EmptyStmtType = StmtKind.NewBranch("@emptystmt")

EmptyStmtType is the type of empty statement AST nodes

View Source
var EqualityTest = NewUnionType("@equalitytest", Comparison)

EqualityTest is the type of equality operator expression AST nodes

View Source
var ErrorKind = NewCaseType(ErrorType, "kind")

ErrorKind is a case type for distinguishing different kinds of frontend errors

View Source
var ErrorType = NewPrimaryKeyType("@error")

ErrorType is the type of frontend errors

View Source
var ErrorTypes = map[packages.ErrorKind]*BranchType{
	packages.UnknownError: ErrorKind.NewBranch("@unknownerror"),
	packages.ListError:    ErrorKind.NewBranch("@listerror"),
	packages.ParseError:   ErrorKind.NewBranch("@parseerror"),
	packages.TypeError:    ErrorKind.NewBranch("@typeerror"),
}

ErrorTypes is a map from error kinds to the corresponding type

View Source
var ErrorsTable = NewTable("errors",
	EntityColumn(ErrorType, "id").Key(),
	IntColumn("kind"),
	StringColumn("msg"),
	StringColumn("rawpos"),
	StringColumn("file"),
	IntColumn("line"),
	IntColumn("col"),
	EntityColumn(PackageType, "package"),
	IntColumn("idx"),
).KeySet("package", "idx")

ErrorsTable is the table describing frontend errors

View Source
var ExprKind = NewCaseType(ExprType, "kind")

ExprKind is a case type for distinguishing different kinds of expression AST nodes

View Source
var ExprParentType = NewUnionType("@exprparent", NodeType)

ExprParentType is the type of AST nodes that can have expressions as children

View Source
var ExprStmtType = StmtKind.NewBranch("@exprstmt")

ExprStmtType is the type of expressio statemement AST nodes

View Source
var ExprSwitchStmtType = StmtKind.NewBranch("@exprswitchstmt", SwitchStmtType)

ExprSwitchStmtType is the type of expression-switch statement AST nodes

View Source
var ExprType = NewPrimaryKeyType("@expr", ExprParentType)

ExprType is the type of expression AST nodes

View Source
var ExprsTable = NewTable("exprs",
	EntityColumn(ExprType, "id").Key(),
	IntColumn("kind"),
	EntityColumn(ExprParentType, "parent"),
	IntColumn("idx"),
).KeySet("parent", "idx")

ExprsTable is the table defining expression AST nodes

View Source
var FallthroughStmtType = StmtKind.NewBranch("@fallthroughstmt", BranchStmtType)

FallthroughStmtType is the type of fallthrough statement AST nodes

View Source
var FieldParentType = NewUnionType("@fieldparent", NodeType)

FieldParentType is the type of AST nodes that can have fields as children

View Source
var FieldStructsTable = NewTable("fieldstructs",
	EntityColumn(ObjectType, "field").Unique(),
	EntityColumn(StructType, "struct"),
)

FieldStructsTable maps fields to the structs they are in

FieldType is the type of field AST nodes

View Source
var FieldsTable = NewTable("fields",
	EntityColumn(FieldType, "id").Key(),
	EntityColumn(FieldParentType, "parent"),
	IntColumn("idx"),
)

FieldsTable is the table defining field AST nodes

FileType is the type of file AST nodes

View Source
var FilesTable = NewTable("files",
	EntityColumn(FileType, "id").Key(),
	StringColumn("name"),
	StringColumn("simple"),
	StringColumn("ext"),
	IntColumn("fromSource"),
)

FilesTable is the table defining file nodes

View Source
var FloatLitExpr = ExprKind.NewBranch("@floatlit", BasicLitExpr)

FloatLitExpr is the type of floating-point literal expression AST nodes

View Source
var FloatType = NewUnionType("@floattype", NumericType)

FloatType is the union of floating-point types

View Source
var FolderType = NewPrimaryKeyType("@folder", ContainerType)

FolderType is the type of folders

View Source
var FoldersTable = NewTable("folders",
	EntityColumn(FolderType, "id").Key(),
	StringColumn("name"),
	StringColumn("simple"),
)

FoldersTable is the table defining folder entities

View Source
var ForStmtType = StmtKind.NewBranch("@forstmt", LoopStmtType)

ForStmtType is the type of for statement AST nodes

View Source
var FuncDeclType = DeclKind.NewBranch("@funcdecl", DocumentableType, FuncDefType)

FuncDeclType is the type of function declaration AST nodes

View Source
var FuncDefType = NewUnionType("@funcdef", StmtParentType, ExprParentType)

FuncDefType is the type of AST nodes that define functions, that is, function declarations and function literals

View Source
var FuncLitExpr = ExprKind.NewBranch("@funclit", FuncDefType)

FuncLitExpr is the type of function literal expression AST nodes

View Source
var FuncTypeExpr = ExprKind.NewBranch("@functypeexpr", FieldParentType, ScopeNodeType)

FuncTypeExpr is the type of function type AST nodes

View Source
var FunctionObjectType = NewUnionType("@functionobject", ValueObjectType)

FunctionObjectType is the type of declared or built-in functions

View Source
var GenDeclType = NewUnionType("@gendecl", DocumentableType)

GenDeclType is the type of generic declaration AST nodes

View Source
var GoStmtType = StmtKind.NewBranch("@gostmt")

GoStmtType is the type of go statement AST nodes

View Source
var GotoStmtType = StmtKind.NewBranch("@gotostmt", BranchStmtType)

GotoStmtType is the type of goto statement AST nodes

View Source
var HasEllipsisTable = NewTable("has_ellipsis",
	EntityColumn(CallOrConversionExpr, "id"),
)
View Source
var HasLocationTable = NewTable("has_location",
	EntityColumn(LocatableType, "locatable").Unique(),
	EntityColumn(LocationType, "location"),
)

HasLocationTable is the table associating entities with their locations

View Source
var IdentExpr = ExprKind.NewBranch("@ident")

IdentExpr is the type of identifier expression AST nodes

View Source
var IfStmtType = StmtKind.NewBranch("@ifstmt", ScopeNodeType)

IfStmtType is the type of if statement AST nodes

View Source
var ImagLitExpr = ExprKind.NewBranch("@imaglit", BasicLitExpr)

ImagLitExpr is the type of imaginary literal expression AST nodes

View Source
var ImportDeclType = DeclKind.NewBranch("@importdecl", GenDeclType)

ImportDeclType is the type of import declaration AST nodes

View Source
var ImportSpecType = SpecKind.NewBranch("@importspec")

ImportSpecType is the type of import declaration specification nodes

View Source
var IncDecStmtType = NewUnionType("@incdecstmt")

IncDecStmtType is the type of increment/decrement statement AST nodes

View Source
var IncStmtType = StmtKind.NewBranch("@incstmt", IncDecStmtType)

IncStmtType is the type of increment statement AST nodes

View Source
var IndexExpr = ExprKind.NewBranch("@indexexpr")

IndexExpr is the type of index expression AST nodes

View Source
var IntLitExpr = ExprKind.NewBranch("@intlit", BasicLitExpr)

IntLitExpr is a case type for dishinguishing different kinds of literal expression AST nodes

View Source
var IntegerType = NewUnionType("@integertype", NumericType)

IntegerType is the union of integer types

View Source
var InterfaceType = TypeKind.NewBranch("@interfacetype", CompositeType)

InterfaceType is the type of interface types

View Source
var InterfaceTypeExpr = ExprKind.NewBranch("@interfacetypeexpr", FieldParentType)

InterfaceTypeExpr is the type of interface type AST nodes

View Source
var KeyTypeTable = NewTable("key_type",
	EntityColumn(MapType, "map").Unique(),
	EntityColumn(TypeType, "tp"),
)

KeyTypeTable is the table associating maps with their key type

View Source
var KeyValueExpr = ExprKind.NewBranch("@keyvalueexpr")

KeyValueExpr is the type of key-value expression AST nodes

View Source
var LabelObjectType = ObjectKind.NewBranch("@labelobject")

LabelObjectType is the type of statement labels

View Source
var LabeledStmtType = StmtKind.NewBranch("@labeledstmt")

LabeledStmtType is the type of labeled statement AST nodes

View Source
var LiteralType = NewUnionType("@literaltype", BasicType)

LiteralType is the union of literal types

View Source
var LiteralsTable = NewTable("literals",
	EntityColumn(ExprType, "expr").Unique(),
	StringColumn("value"),
	StringColumn("raw"),
)

LiteralsTable is the table associating literal expression AST nodes with their values

View Source
var LocalScopeType = ScopeKind.NewBranch("@localscope", LocatableType)

LocalScopeType is the type of local (that is, non-universe, non-package) scopes

View Source
var LocatableType = NewUnionType("@locatable")

LocatableType is the type of program entities that have locations

View Source
var LocationDefaultType = NewPrimaryKeyType("@location_default")

LocationDefaultType is the type of source locations

View Source
var LocationType = NewAliasType("@location", LocationDefaultType)

LocationType is an alias for LocationDefaultType

View Source
var LocationsDefaultTable = NewTable("locations_default",
	EntityColumn(LocationDefaultType, "id").Key(),
	EntityColumn(FileType, "file"),
	IntColumn("beginLine"),
	IntColumn("beginColumn"),
	IntColumn("endLine"),
	IntColumn("endColumn"),
)

LocationsDefaultTable is the table defining location objects

View Source
var LogicalBinaryExpr = NewUnionType("@logicalbinaryexpr", BinaryExpr, LogicalExpr)

LogicalBinaryExpr is the type of logical binary operator expression AST nodes

View Source
var LogicalExpr = NewUnionType("@logicalexpr", OperatorExpr)

LogicalExpr is the type of logical operator expression AST nodes

View Source
var LogicalUnaryExpr = NewUnionType("@logicalunaryexpr", UnaryExpr, LogicalExpr)

LogicalUnaryExpr is the type of logical unary operator expression AST nodes

View Source
var LoopStmtType = NewUnionType("@loopstmt", ScopeNodeType)

LoopStmtType is the type of loop statement AST nodes (including for statements and range statements)

View Source
var MapType = TypeKind.NewBranch("@maptype", ElementContainerType)

MapType is the type of map types

View Source
var MapTypeExpr = ExprKind.NewBranch("@maptypeexpr")

MapTypeExpr is the type of map type AST nodes

View Source
var MethodHostsTable = NewTable("methodhosts",
	EntityColumn(ObjectType, "method"),
	EntityColumn(NamedType, "host"),
)

MethodHostsTable maps interface methods to the named type they belong to

View Source
var MethodReceiversTable = NewTable("methodreceivers",
	EntityColumn(ObjectType, "method").Unique(),
	EntityColumn(ObjectType, "receiver"),
)

MethodReceiversTable maps methods to their receiver

View Source
var ModCommentBlockType = ModExprKind.NewBranch("@modcommentblock")

ModCommentBlockType is the type of go.mod comment block AST nodes

View Source
var ModExprKind = NewCaseType(ModExprType, "kind")

ModExprKind is a case type for distinguishing different kinds of go.mod expression nodes

View Source
var ModExprParentType = NewUnionType("@modexprparent", NodeType)

ModExprParentType is the type of go.mod nodes that can have go.mod expressions as children

ModExprType is the type of go.mod expression nodes

View Source
var ModExprsTable = NewTable("modexprs",
	EntityColumn(ModExprType, "id").Key(),
	IntColumn("kind"),
	EntityColumn(ModExprParentType, "parent"),
	IntColumn("idx"),
).KeySet("parent", "idx")

ModExprsTable is the table defining expression AST nodes for go.mod files

View Source
var ModLParenType = ModExprKind.NewBranch("@modlparen")

ModLParenType is the type of go.mod line block start AST nodes

View Source
var ModLineBlockType = ModExprKind.NewBranch("@modlineblock")

ModLineBlockType is the type of go.mod line block AST nodes

View Source
var ModLineType = ModExprKind.NewBranch("@modline")

ModLineType is the type of go.mod line AST nodes

View Source
var ModRParenType = ModExprKind.NewBranch("@modrparen")

ModRParenType is the type of go.mod line block end AST nodes

View Source
var ModTokensTable = NewTable("modtokens",
	StringColumn("token"),
	EntityColumn(ModExprType, "parent"),
	IntColumn("idx"),
).KeySet("parent", "idx")

ModTokensTable is the table associating go.mod tokens with their Line or LineBlock

View Source
var NamedType = TypeKind.NewBranch("@namedtype", CompositeType)

NamedType is the type of named types

View Source
var NodeType = NewUnionType("@node", LocatableType)

NodeType is the type of AST nodes

View Source
var NumericType = NewUnionType("@numerictype", BasicType)

NumericType is the union of numeric types

View Source
var NumlinesTable = NewTable("numlines",
	EntityColumn(SourceLineType, "element_id"),
	IntColumn("num_lines"),
	IntColumn("num_code"),
	IntColumn("num_comment"),
)

NumlinesTable is the table containing LoC information

View Source
var ObjectKind = NewCaseType(ObjectType, "kind")

ObjectKind is a case type for distinguishing different kinds of built-in and declared objects

View Source
var ObjectScopesTable = NewTable("objectscopes",
	EntityColumn(ObjectType, "object").Unique(),
	EntityColumn(ScopeType, "scope"),
)

ObjectScopesTable is the table describing the scope to which an object belongs (if any)

View Source
var ObjectType = NewPrimaryKeyType("@object")

ObjectType is the type of objects (that is, declared entities)

View Source
var ObjectTypesTable = NewTable("objecttypes",
	EntityColumn(ObjectType, "object").Unique(),
	EntityColumn(TypeType, "tp"),
)

ObjectTypesTable is the table describing the type of an object (if any)

View Source
var ObjectsTable = NewTable("objects",
	EntityColumn(ObjectType, "id").Key(),
	IntColumn("kind"),
	StringColumn("name"),
)

ObjectsTable is the table describing objects (that is, declared entities)

View Source
var OperatorExpr = NewUnionType("@operatorexpr")

OperatorExpr is the type of operator expression AST nodes

View Source
var PackageScopeType = ScopeKind.NewBranch("@packagescope")

PackageScopeType is the type of package scopes

View Source
var PackageType = NewPrimaryKeyType("@package")

PackageType is the type of packages

View Source
var PackagesTable = NewTable("packages",
	EntityColumn(PackageType, "id").Key(),
	StringColumn("name"),
	StringColumn("path"),
	EntityColumn(PackageScopeType, "scope"),
)

PackagesTable is the table describing packages

View Source
var ParenExpr = ExprKind.NewBranch("@parenexpr")

ParenExpr is the type of parenthesis expression AST nodes

View Source
var PkgObjectType = ObjectKind.NewBranch("@pkgobject")

PkgObjectType is the type of imported packages

View Source
var PointerType = TypeKind.NewBranch("@pointertype", CompositeType)

PointerType is the type of pointer types

View Source
var RangeStmtType = StmtKind.NewBranch("@rangestmt", LoopStmtType)

RangeStmtType is the type of range statement AST nodes

View Source
var RelationalComparison = NewUnionType("@relationalcomparison", Comparison)

RelationalComparison is the type of relational operator expression AST nodes

View Source
var ReturnStmtType = StmtKind.NewBranch("@returnstmt")

ReturnStmtType is the type of return statement AST nodes

View Source
var ScopeKind = NewCaseType(ScopeType, "kind")

ScopeKind is a case type for distinguishing different kinds of scopes

View Source
var ScopeNestingTable = NewTable("scopenesting",
	EntityColumn(ScopeType, "inner").Unique(),
	EntityColumn(ScopeType, "outer"),
)

ScopeNestingTable is the table describing scope nesting

View Source
var ScopeNodeType = NewUnionType("@scopenode", NodeType)

ScopeNodeType is the type of AST nodes that may have a scope attached to them

View Source
var ScopeNodesTable = NewTable("scopenodes",
	EntityColumn(ScopeNodeType, "node").Unique(),
	EntityColumn(LocalScopeType, "scope"),
)

ScopeNodesTable is the table associating local scopes with the AST nodes that induce them

View Source
var ScopeType = NewPrimaryKeyType("@scope")

ScopeType is the type of scopes

View Source
var ScopesTable = NewTable("scopes",
	EntityColumn(ScopeType, "id").Key(),
	IntColumn("kind"),
)

ScopesTable is the table defining scopes

View Source
var SelectStmtType = StmtKind.NewBranch("@selectstmt")

SelectStmtType is the type of select statement AST nodes

View Source
var SelectorExpr = ExprKind.NewBranch("@selectorexpr")

SelectorExpr is the type of selector expression AST nodes

View Source
var SendStmtType = StmtKind.NewBranch("@sendstmt")

SendStmtType is the type of send statement AST nodes

View Source
var ShiftExpr = NewUnionType("@shiftexpr", BitwiseBinaryExpr)

ShiftExpr is the type of shift operator expression AST nodes

View Source
var SignatureType = TypeKind.NewBranch("@signaturetype", CompositeType)

SignatureType is the type of signature types

View Source
var SignedIntegerType = NewUnionType("@signedintegertype", IntegerType)

SignedIntegerType is the union of signed integer types

View Source
var SimpleAssignStmtType = NewUnionType("@simpleassignstmt", AssignmentType)

SimpleAssignStmtType is the type of simple (i.e., non-compound) assignment statement AST nodes

View Source
var SlashSlashComment = CommentKind.NewBranch("@slashslashcomment")

SlashSlashComment is the type of single-line comments starting with a double slash

View Source
var SlashStarComment = CommentKind.NewBranch("@slashstarcomment")

SlashStarComment is the type of block comments delimited by stars and slashes

View Source
var SliceExpr = ExprKind.NewBranch("@sliceexpr")

SliceExpr is the type of slice expression AST nodes

View Source
var SliceType = TypeKind.NewBranch("@slicetype", ElementContainerType)

SliceType is the type of slice types

View Source
var SourceLineType = NewAliasType("@sourceline", LocatableType)

SourceLineType is an alias for LocatableType

View Source
var SpecKind = NewCaseType(SpecType, "kind")

SpecKind is a case type for distinguishing different kinds of declaration specification nodes

SpecType is the type of spec AST nodes

View Source
var SpecsTable = NewTable("specs",
	EntityColumn(SpecType, "id").Key(),
	IntColumn("kind"),
	EntityColumn(GenDeclType, "parent"),
	IntColumn("idx"),
).KeySet("parent", "idx")

SpecsTable is the table defining declaration specification AST nodes

View Source
var StarExpr = ExprKind.NewBranch("@starexpr")

StarExpr is the type of star expression AST nodes

View Source
var StmtKind = NewCaseType(StmtType, "kind")

StmtKind is a case type for distinguishing different kinds of statement AST nodes

View Source
var StmtParentType = NewUnionType("@stmtparent", NodeType)

StmtParentType is the type of AST nodes that can have statements as children

StmtType is the type of statement AST nodes

View Source
var StmtsTable = NewTable("stmts",
	EntityColumn(StmtType, "id").Key(),
	IntColumn("kind"),
	EntityColumn(StmtParentType, "parent"),
	IntColumn("idx"),
).KeySet("parent", "idx")

StmtsTable is the table defining statement AST nodes

View Source
var StringLitExpr = ExprKind.NewBranch("@stringlit", BasicLitExpr)

StringLitExpr is the type of string literal expression AST nodes

View Source
var StringType = NewUnionType("@stringtype", BasicType)

StringType is the union of the normal and literal string types

View Source
var StructType = TypeKind.NewBranch("@structtype", CompositeType)

StructType is the type of struct types

View Source
var StructTypeExpr = ExprKind.NewBranch("@structtypeexpr", FieldParentType)

StructTypeExpr is the type of struct type AST nodes

View Source
var SwitchStmtType = NewUnionType("@switchstmt", ScopeNodeType)

SwitchStmtType is the type of switch statement AST nodes, covering both expression switch and type switch

View Source
var TupleType = TypeKind.NewBranch("@tupletype", CompositeType)

TupleType is the type of tuple types

View Source
var TypeAssertExpr = ExprKind.NewBranch("@typeassertexpr")

TypeAssertExpr is the type of type assertion expression AST nodes

View Source
var TypeDeclType = DeclKind.NewBranch("@typedecl", GenDeclType)

TypeDeclType is the type of type declaration AST nodes

View Source
var TypeDefSpecType = SpecKind.NewBranch("@typedefspec", TypeSpecType)

TypeDefSpecType is the type of type declaration specification nodes corresponding to type definitions

View Source
var TypeKind = NewCaseType(TypeType, "kind")

TypeKind is a case type for distinguishing different kinds of types

View Source
var TypeNameTable = NewTable("typename",
	EntityColumn(TypeType, "tp").Unique(),
	StringColumn("name"),
)

TypeNameTable is the table associating named types with their names

View Source
var TypeObjectTable = NewTable("type_objects",
	EntityColumn(TypeType, "tp").Unique(),
	EntityColumn(ObjectType, "object"),
)

TypeObjectTable maps types to their corresponding objects, if any

View Source
var TypeObjectType = NewUnionType("@typeobject")

TypeObjectType is the type of declared or built-in named types

View Source
var TypeOfTable = NewTable("type_of",
	EntityColumn(ExprType, "expr").Unique(),
	EntityColumn(TypeType, "tp"),
)

TypeOfTable is the table associating expressions with their types (if known)

View Source
var TypeSpecType = NewUnionType("@typespec")

TypeSpecType is the type of type declaration specification nodes

View Source
var TypeSwitchStmtType = StmtKind.NewBranch("@typeswitchstmt", SwitchStmtType)

TypeSwitchStmtType is the type of type-switch statement AST nodes

View Source
var TypeType = NewPrimaryKeyType("@type")

TypeType is the type of types

View Source
var TypesTable = NewTable("types",
	EntityColumn(TypeType, "id").Key(),
	IntColumn("kind"),
)

TypesTable is the table describing types

View Source
var UnaryExpr = NewUnionType("@unaryexpr", OperatorExpr)

UnaryExpr is the type of unary operator expression AST nodes

View Source
var UnaryExprs = map[token.Token]*BranchType{
	token.ADD:   ExprKind.NewBranch("@plusexpr", ArithmeticUnaryExpr),
	token.SUB:   ExprKind.NewBranch("@minusexpr", ArithmeticUnaryExpr),
	token.NOT:   ExprKind.NewBranch("@notexpr", LogicalUnaryExpr),
	token.XOR:   ExprKind.NewBranch("@complementexpr", BitwiseUnaryExpr),
	token.MUL:   ExprKind.NewBranch("@derefexpr", UnaryExpr),
	token.AND:   ExprKind.NewBranch("@addressexpr", UnaryExpr),
	token.ARROW: ExprKind.NewBranch("@arrowexpr", UnaryExpr),
}

UnaryExprs is a map from unary operator tokens to the corresponding AST node type

View Source
var UnderlyingTypeTable = NewTable("underlying_type",
	EntityColumn(NamedType, "named").Unique(),
	EntityColumn(TypeType, "tp"),
)

UnderlyingTypeTable is the table associating named types with their underlying type

View Source
var UniverseScopeType = ScopeKind.NewBranch("@universescope")

UniverseScopeType is the type of the universe scope

View Source
var UnsignedIntegerType = NewUnionType("@unsignedintegertype", IntegerType)

UnsignedIntegerType is the union of unsigned integer types

View Source
var UsesTable = NewTable("uses",
	EntityColumn(IdentExpr, "ident"),
	EntityColumn(ObjectType, "object"),
)

UsesTable maps identifiers to the objects they denote

View Source
var ValueObjectType = NewUnionType("@valueobject")

ValueObjectType is the type of declared or built-in variables or constants

View Source
var ValueSpecType = SpecKind.NewBranch("@valuespec")

ValueSpecType is the type of value declaration specification nodes

View Source
var VarDeclType = DeclKind.NewBranch("@vardecl", GenDeclType)

VarDeclType is the type of variable declaration AST nodes

View Source
var VarObjectType = NewUnionType("@varobject", ValueObjectType)

VarObjectType is the type of declared or built-in variables (the latter do not currently exist)

Functions

func AddDefaultSnippet

func AddDefaultSnippet(snippet string) bool

AddDefaultSnippet adds the given text `snippet` to the schema of this database

func PrintDbScheme

func PrintDbScheme(w io.Writer)

PrintDbScheme prints the schema of this database to the writer `w`

Types

type AliasType

type AliasType struct {
	// contains filtered or unexported fields
}

An AliasType represents a database type which is an alias of another database type

func NewAliasType

func NewAliasType(name string, underlying Type) *AliasType

NewAliasType constructs a new alias type with the given `name` that aliases `underlying`

type BranchType

type BranchType struct {
	// contains filtered or unexported fields
}

A BranchType represents one branch of a case type

func (BranchType) Index

func (bt BranchType) Index() int

Index returns the numeric index of this branch type

type CaseType

type CaseType struct {
	// contains filtered or unexported fields
}

A CaseType represents a database type defined by a primary key column with a supplementary kind column

func NewCaseType

func NewCaseType(base Type, column string) *CaseType

NewCaseType constructs a new case type on the given `base` type whose discriminator values come from `column`

func (*CaseType) NewBranch

func (ct *CaseType) NewBranch(name string, parents ...*UnionType) *BranchType

NewBranch adds a new branch with the given `name` to this case type and adds it to the union types `parents` (if any)

type Column

type Column struct {
	// contains filtered or unexported fields
}

A Column represents a column in a database table

func EntityColumn

func EntityColumn(columnType Type, columnName string) Column

EntityColumn constructs a column with name `columnName` holding entities of type `columnType`

func IntColumn

func IntColumn(columnName string) Column

IntColumn constructs a column with name `columnName` holding integer values

func StringColumn

func StringColumn(columnName string) Column

StringColumn constructs a column with name `columnName` holding string values

func (Column) Key

func (col Column) Key() Column

Key returns a new column that is the same as this column, but has the `key` flag set to `true`

func (Column) String

func (col Column) String() string

func (Column) Unique

func (col Column) Unique() Column

Unique returns a new column that is the same as this column, but has the `unique` flag set to `true`

type PrimaryKeyType

type PrimaryKeyType struct {
	// contains filtered or unexported fields
}

A PrimaryKeyType represents a database type defined by a primary key column

func NewPrimaryKeyType

func NewPrimaryKeyType(name string, parents ...*UnionType) *PrimaryKeyType

NewPrimaryKeyType constructs a new primary key type with the given `name`, and adds it to the union types `parents` (if any)

type PrimitiveType

type PrimitiveType int

A PrimitiveType represents a primitive dataase type

const (
	// INT represents the primitive database type `int`
	INT PrimitiveType = iota
	// FLOAT represents the primitive database type `float`
	FLOAT
	// BOOLEAN represents the primitive database type `boolean`
	BOOLEAN
	// DATE represents the primitive database type `date`
	DATE
	// STRING represents the primitive database type `string`
	STRING
)

type Table

type Table struct {
	// contains filtered or unexported fields
}

A Table represents a database table

func NewTable

func NewTable(name string, columns ...Column) *Table

NewTable constructs a new table with the given `name` and `columns`

func (Table) Emit

func (tbl Table) Emit(tw *trap.Writer, values ...interface{})

Emit outputs a tuple of `values` for this table using trap writer `tw` and panicks if the tuple does not have the right schema

func (*Table) KeySet

func (tbl *Table) KeySet(keys ...string) *Table

KeySet adds `keys` as a keyset to this table

func (Table) String

func (tbl Table) String() string

type Type

type Type interface {
	// contains filtered or unexported methods
}

A Type represents a database type

type UnionType

type UnionType struct {
	// contains filtered or unexported fields
}

A UnionType represents a database type defined as the union of other database types

func NewUnionType

func NewUnionType(name string, parents ...*UnionType) *UnionType

NewUnionType constructs a new union type with the given `name`, and adds it to the union types `parents` (if any)

Jump to

Keyboard shortcuts

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