File 'convert.tcl' (part of 'ParseTools')


Home | Packages | Files | Procedures | Keywords


Written by
Andreas Kupries (a.kupries@westend.com)
Description
Conversion of the syntax tree into several other representations.
Keywords
replication

::parsetools::ast::RepStr (n text)

Replicates n times the string text. Originally from Pool, copied here to avoid the dependency.
Notes: This algorithm proved to be rather fast, even in the small range of n in {60..90}. An alternative definition using regsub and format with O(n) complexity, thus doing most things at C-level is beaten regularly for n > 74!
Argument: n Number of replications. A value < 0 is handled as 0
Argument: text string to replicate.
Returns: The text, replicated n times.

::parsetools::ast::TtoNestedList (tree)

Converts the syntax tree in question into a nested listed representation.
Argument: tree The handle/name of the tree to manipulate.
Returns: a nested listed

::parsetools::ast::TtoTypedNestedList (tree)

Converts the syntax tree in question into a nested listed representation using the associated 'type' as main element of each node.
Argument: tree The handle/name of the tree to manipulate.
Returns: a nested listed

::parsetools::ast::TtoTypedXML (tree)

Converts the syntax tree in question into XML using the associated 'type' as tag name for each node.
Argument: tree The handle/name of the tree to manipulate.
Returns: a string containing XML structures.

::parsetools::ast::TtoXML (tree)

Converts the syntax tree in question into XML.
Argument: tree The handle/name of the tree to manipulate.
Returns: a string containing XML structures.

::parsetools::ast::_toNestedList (type obj op args)

See ::parsetools::ast::TtoNestedList.
Argument: type The type of the object we are processing, either 'tree' or 'node'.
Argument: obj The handle of the current object.
Argument: op Either 'enter' or 'leave', allowing us to distinguish between the two calls beforee and after processing the children of the object in question.
Argument: args Additional arguments. For nodes the first of them contains the nesting level of node in the tree.

::parsetools::ast::_toTypedNL (type obj op args)

See ::parsetools::ast::TtoTypedNestedList.
Argument: type The type of the object we are processing, either 'tree' or 'node'.
Argument: obj The handle of the current object.
Argument: op Either 'enter' or 'leave', allowing us to distinguish between the two calls beforee and after processing the children of the object in question.
Argument: args Additional arguments. For nodes the first of them contains the nesting level of node in the tree.

::parsetools::ast::_toTypedXML (type obj op args)

See ::parsetools::ast::TtoTypedXML.
Argument: type The type of the object we are processing, either 'tree' or 'node'.
Argument: obj The handle of the current object.
Argument: op Either 'enter' or 'leave', allowing us to distinguish between the two calls beforee and after processing the children of the object in question.
Argument: args Additional arguments. For nodes the first of them contains the nesting level of node in the tree.

::parsetools::ast::_toXML (type obj op args)

See ::parsetools::ast::TtoXML.
Argument: type The type of the object we are processing, either 'tree' or 'node'.
Argument: obj The handle of the current object.
Argument: op Either 'enter' or 'leave', allowing us to distinguish between the two calls beforee and after processing the children of the object in question.
Argument: args Additional arguments. For nodes the first of them contains the nesting level of node in the tree.


Home | Packages | Files | Procedures | Keywords



Generated by AutoDoc 2.3 at 04/27/2001, invoked by Andreas Kupries,,,