/[suikacvs]/webroot/regexp/lib/Regexp/Visualize/Simple.html
Suika

Contents of /webroot/regexp/lib/Regexp/Visualize/Simple.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download) (as text)
Tue Jan 13 14:15:46 2009 UTC (15 years, 10 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/html
++ swe/lib/Regexp/Visualize/ChangeLog	13 Jan 2009 14:12:50 -0000
2009-01-13  Wakaba  <wakaba@suika.fam.cx>

	* Simple.pod: New file.

	* Makefile: New file.

	* Simple.pm: Added license section.

1 <?xml version="1.0" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>Regexp::Visualize::Simple - Regular expression visualization using Graph::Easy</title>
6 <link rel="stylesheet" href="http://suika.fam.cx/www/style/html/pod.css" type="text/css" />
7 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
8 <link rev="made" href="mailto:wakaba@suika.fam.cx" />
9 </head>
10
11 <body>
12
13
14 <!-- INDEX BEGIN -->
15 <div name="index">
16 <p><a name="__index__"></a></p>
17
18 <ul>
19
20 <li><a href="#name">NAME</a></li>
21 <li><a href="#synopsis">SYNOPSIS</a></li>
22 <li><a href="#description">DESCRIPTION</a></li>
23 <li><a href="#methods">METHODS</a></li>
24 <li><a href="#dependency">DEPENDENCY</a></li>
25 <li><a href="#see_also">SEE ALSO</a></li>
26 <li><a href="#development">DEVELOPMENT</a></li>
27 <ul>
28
29 <li><a href="#todo">TODO</a></li>
30 </ul>
31
32 <li><a href="#author">AUTHOR</a></li>
33 <li><a href="#license">LICENSE</a></li>
34 </ul>
35
36 <hr name="index" />
37 </div>
38 <!-- INDEX END -->
39
40 <p>
41 </p>
42 <h1><a name="name">NAME</a></h1>
43 <p>Regexp::Visualize::Simple - Regular expression visualization using Graph::Easy</p>
44 <p>
45 </p>
46 <hr />
47 <h1><a name="synopsis">SYNOPSIS</a></h1>
48 <pre>
49 use Regexp::Visualize::Simple
50
51 $parser = ... Regexp::Parser object ...;
52
53 my $v = Regexp::Visualize::Simple-&gt;new;
54 $v-&gt;push_regexp_node ($parser-&gt;root);
55
56 while ($v-&gt;has_regexp_node) {
57 my ($g, $index) = $v-&gt;next_graph;
58
59 # $g is a Graph::Easy object
60 print &quot;$index:\n&quot;;
61 print $g-&gt;as_svg;
62 }</pre>
63 <p>
64 </p>
65 <hr />
66 <h1><a name="description">DESCRIPTION</a></h1>
67 <p>The <code>Regexp::Visualize::Simple</code> generates a series of <code>Graph::Easy</code>
68 objects, which as a whole represents a regular expression parsed by
69 <code>Regexp::Parser</code>. Generated graphs can be exported to arbitrary
70 image format, such as PNG and SVG, supported by <code>Graph::Easy</code>. As an
71 input any regular expression dialect supported by <code>Regexp::Parser</code> or
72 its subclasses can be used.</p>
73 <p>It is sometimes impossible or undesired to represents a regular
74 expression as one complete graph. For example, if a regular
75 expression containing <code>(?!...)</code> segment were represented as a graph,
76 it would be difficult to understand. Therefore, the result
77 visualization might sometimes be split into multiple graphs. This is
78 why this module defines iterator methods <a href="#has_regexp_node"><code>has_regexp_node</code></a> and
79 <a href="#next_graph"><code>next_graph</code></a>.</p>
80 <p>
81 </p>
82 <hr />
83 <h1><a name="methods">METHODS</a></h1>
84 <dl>
85 <dt><strong><a name="new" class="item"><em>$v</em> = Regexp::Visualize::Simple-&gt;new;</a></strong>
86
87 <dd>
88 <p>Creates a new instance of the regular expression visualizer.</p>
89 </dd>
90 </li>
91 <dt><strong><a name="push_regexp_node" class="item"><em>$v</em>-&gt;push_regexp_node (<em>$node</em>);</a></strong>
92
93 <dd>
94 <p>Push a regular expression node that represents a subgraph to be
95 visualized.</p>
96 </dd>
97 </li>
98 <dt><strong><a name="shift_regexp_node" class="item"><em>$node</em> = <em>$v</em>-&gt;shift_regexp_node ();</a></strong>
99
100 <dd>
101 <p>Shifts a regular expression node from the queue hold by the visualizer
102 object, if any, or returns <code>undef</code>.</p>
103 </dd>
104 </li>
105 <dt><strong><a name="has_regexp_node" class="item"><em>$boolean</em> = <em>$v</em>-&gt;has_regexp_node ();</a></strong>
106
107 <dd>
108 <p>Returns whether the visualizer object contains one or more nodes in
109 the queue of regular expression nodes to be graphized.</p>
110 </dd>
111 </li>
112 <dt><strong><a name="next_graph" class="item">(<em>$g</em>, <em>$index</em>) = <em>$v</em>-&gt;next_graph ();</a></strong>
113
114 <dd>
115 <p>Generates a graph from the first node in the queue o the regular
116 expression node hold by the visualizer object.</p>
117 </dd>
118 <dd>
119 <p>If there is no node to be graphized in the queue, then a list of two
120 <code>undef</code> values is returned.</p>
121 </dd>
122 <dd>
123 <p>Otherwise, a list of the <code>Graph::Easy</code> object generated from the
124 regular expression node and the index number of the graph is returned.
125 The first graph generated by the visualizer object has the index of
126 zero (<code>0</code>), and the next graph has one (<code>1</code>).</p>
127 </dd>
128 </li>
129 </dl>
130 <p>
131 </p>
132 <hr />
133 <h1><a name="dependency">DEPENDENCY</a></h1>
134 <p>This module requires Perl 5.10.0 or later.</p>
135 <p>This module depends on the <code>Graph::Easy</code> module.</p>
136 <p>This module assumes the input regular expression nodes implementing
137 <code>Regexp::Parser</code>-compatible interface. Such modules include
138 <code>Regexp::Parser::Perl58</code> and <code>Regexp::Parser::JavaScript</code>.</p>
139 <p>
140 </p>
141 <hr />
142 <h1><a name="see_also">SEE ALSO</a></h1>
143 <p>The latest version of this module is available at
144 <a href="http://suika.fam.cx/regexp/">http://suika.fam.cx/regexp/</a>.</p>
145 <p>Regular expression visualizer
146 <a href="http://suika.fam.cx/regexp/visualizer/input">http://suika.fam.cx/regexp/visualizer/input</a>. This is a Web
147 interface for this module. Its source code is available at
148 <a href="http://suika.fam.cx/regexp/visualizer/regexp.cgi,cvslog">http://suika.fam.cx/regexp/visualizer/regexp.cgi,cvslog</a>.</p>
149 <p><a href="../../Regexp/Parser/Perl58.html">the Regexp::Parser::Perl58 manpage</a> - A subclass of <code>Regexp::Parser</code> supporting
150 Perl 5.8 regular expression syntax.</p>
151 <p><a href="../../Regexp/Parser/JavaScript.html">the Regexp::Parser::JavaScript manpage</a> - A subclass of <code>Regexp::Parser</code>
152 supporting JavaScript regular expression syntax.</p>
153 <p>These two modules above are available at
154 <a href="http://suika.fam.cx/regexp/">http://suika.fam.cx/regexp/</a>.</p>
155 <p><a href="../../Graph/Easy.html">the Graph::Easy manpage</a>. This module is available from CPAN.</p>
156 <p>
157 </p>
158 <hr />
159 <h1><a name="development">DEVELOPMENT</a></h1>
160 <p>CVS log:
161 <a href="http://suika.fam.cx/regexp/lib/Regexp/Visualize/Simple.pm,cvslog">http://suika.fam.cx/regexp/lib/Regexp/Visualize/Simple.pm,cvslog</a>.</p>
162 <p>Bug tracking system: <a href="http://manakai.g.hatena.ne.jp/task/7/">http://manakai.g.hatena.ne.jp/task/7/</a>.</p>
163 <p>
164 </p>
165 <h2><a name="todo">TODO</a></h2>
166 <p>Localization / customization support.</p>
167 <p>
168 </p>
169 <hr />
170 <h1><a name="author">AUTHOR</a></h1>
171 <p>Wakaba &lt;<a href="mailto:w@suika.fam.cx">w@suika.fam.cx</a>&gt;.</p>
172 <p>
173 </p>
174 <hr />
175 <h1><a name="license">LICENSE</a></h1>
176 <p>Copyright 2008-2009 Wakaba &lt;<a href="mailto:w@suika.fam.cx">w@suika.fam.cx</a>&gt;.</p>
177 <p>This library is free software; you can redistribute it and/or modify
178 it under the same terms as Perl itself.</p>
179
180 </body>
181
182 </html>

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24