1page_util_flow(n) Parser generator tools page_util_flow(n)
2
3
4
5______________________________________________________________________________
6
8 page_util_flow - page dataflow/treewalker utility
9
11 package require page::util::flow ?0.1?
12
13 package require snit
14
15 ::page::util::flow start flowvar nodevar script
16
17 flow visit node
18
19 flow visitl nodelist
20
21 flow visita node...
22
23______________________________________________________________________________
24
26 This package provides a single utility command for easy dataflow based
27 manipulation of arbitrary data structures, especially abstract syntax
28 trees.
29
31 ::page::util::flow start flowvar nodevar script
32 This command contains the core logic to drive the walking of an
33 arbitrary data structure which can partitioned into separate
34 parts. Examples of such structures are trees and graphs.
35
36 The command makes no assumptions at all about the API of the
37 structure to be walked, except that that its parts, here called
38 nodes, are identified by strings. These strings are taken as is,
39 from the arguments, and the body, and handed back to the body,
40 without modification.
41
42 Access to the actual data structure, and all decisions regarding
43 which nodes to visit in what order are delegated to the body of
44 the loop, i.e. the script.
45
46 The body is invoked first for the nodes in the start-set speci‐
47 fied via start), and from then on for the nodes the body has
48 requested to be visited. The command stops when the set of nodes
49 to visit becomes empty. Note that a node can be visited more
50 than once. The body has complete control about this.
51
52 The body is invoked in the context of the caller. The variable
53 named by nodevar will be set to the current node, and the vari‐
54 able named by flowvar will be set to the command of the flow
55 object through which the body can request the nodes to visit
56 next. The API provided by this object is described in the next
57 section, FLOW API.
58
59 Note that the command makes no promises regarding the order in
60 which nodes are visited, excpt that the nodes requested to be
61 visited by the current iteration will be visited afterward, in
62 some order.
63
65 This section describes the API provided by the flow object made acces‐
66 sible to the body script of ::page::util::flow.
67
68 flow visit node
69 Invoking this method requests that the node n is visited after
70 the current iteration.
71
72 flow visitl nodelist
73 Invoking this method requests that all the nodes found in the
74 list nodelist are visited after the current iteration.
75
76 flow visita node...
77 This is the variadic arguments form of the method visitl, see
78 above.
79
81 This document, and the package it describes, will undoubtedly contain
82 bugs and other problems. Please report such in the category page of
83 the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please
84 also report any ideas for enhancements you may have for either package
85 and/or documentation.
86
87 When proposing code changes, please provide unified diffs, i.e the out‐
88 put of diff -u.
89
90 Note further that attachments are strongly preferred over inlined
91 patches. Attachments can be made by going to the Edit form of the
92 ticket immediately after its creation, and then using the left-most
93 button in the secondary navigation bar.
94
96 dataflow, graph walking, page, parser generator, text processing, tree
97 walking
98
100 Page Parser Generator
101
103 Copyright (c) 2007 Andreas Kupries <andreas_kupries@users.sourceforge.net>
104
105
106
107
108tcllib 1.0 page_util_flow(n)