Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDefinition ¶
IsDefinition returns true if the current name is a CUE definition Pattern detected are: - #Foo - _#Foo It returns false if it's not a definition
func ParseDefs ¶
func ParseDefs(defs *Definitions, importAliases map[string]string, f *ast.File)
ParseDefs will fill Definitions data structure will all definitions found in the given ast.File There are two type of definitions declared in the AST - Ident: those are definitions from the package itself - SelectorExpr: those are definitions from external package they will be stored as <pkg>.<def> (E.g., foo.#Bar)
Types ¶
type Definitions ¶
Definitions is a map with the line number of a CUE file as key and a range of definition as value. Those Range are sorted in ascending order by start.Column() Definitions can hold 10 definition (so 10 Range) in a line.
func (Definitions) AppendRange ¶
AppendRange add a new definition to the line. Due to AST structure, it will always be sorted in ascending order by start.Column()
func (Definitions) Find ¶
func (def Definitions) Find(line int, column int) (string, error)
Find will search for a definition in the Definition object following line and column It will return the definition's name if found, or an error if not found Find function has a complexity of O(log(n)) thanks Definitions data structure that his a map.
func (Definitions) String ¶
func (def Definitions) String() string