codetree: Index | Files

package codetree

import ""


Package Files


type CodeTree Uses

type CodeTree struct {
    Line     string
    Children []*CodeTree
    Parent   *CodeTree
    Indent   int

CodeTree represents a tree structure for whitespace-significant, indented code. Each line of code is parsed and the indentation level of the line is stored in Indent. The root node having Indent set to -1 contains child nodes that can contain child nodes themselves, recursively. Each line is saved without whitespace characters at the start of the string.

func New Uses

func New(reader io.Reader) (*CodeTree, error)

New returns a tree structure if you feed it with indentantion based source code.

func (*CodeTree) Close Uses

func (tree *CodeTree) Close()

Close sends the tree and all of its children back to the memory pool. The resources are therefore freed up and the tree object should not be used after the final Close() call anymore.

Package codetree imports 3 packages (graph) and is imported by 2 packages. Updated 2019-11-28. Refresh now. Tools for package owners.