CodeInspector

The code inspector component is used to find things in the code. It is primarily used for scope checking, navigating the token tree, printing and copying subtrees.

findFunction()

  • Inputs: DanaToken tree, char name[]

  • Outputs: DanaToken functionHead

Returns the first token of the function requested from the tree.

printTree()

  • Inputs: DanaToken tree, int index

  • Outputs: None

Provides a readable print out of the provided tree. index should be set to 0 for the initial request. It is used in recursive calls.

checkScopeLocationNew()

  • Inputs: DanaToken tree, DanaToken end, DanaType typeset[]

  • Outputs: Variable scopeVariables[]

checkScopeLocation()

  • Inputs: DanaToken tree, DanaToken after, bool primary, DanaType typeset[]

  • Outputs: Variable scopeVariables[]

checkLocalScope()

  • Inputs: DanaToken tree, DanaToken after, DanaType typeset[]

  • Outputs: Variable scopeVariables[]

getTokenList()

  • Inputs: DanaToken tree, DanaToken tokens[]

  • **Outputs:**DanaToken tokenList[]

getChildren()

  • Inputs: DanaToken tree

  • Outputs: DanaToken childrenList[]

getPrev()

  • Inputs: DanaToken token, DanaToken tree

  • Outputs: DanaToken parent or previousChild

getParent()

  • Inputs: DanaToken child, DanaToken tree

  • Outputs: DanaToken parent

laterUsage()

  • Inputs: DanaToken declaration, DanaToken tree

  • Outputs: bool used

copyParsedFunction()

  • Inputs: char name[], DanaToken tree

  • Outputs: DanaToken copyOfFunction

getOperandCode()

  • Inputs: DanaToken where

  • Outputs: char operandCode[]