Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 15
- Log:
Attempt to update Typo to a Typo SVN HEAD release from around the
time the prototype installation was set up on the RISC OS Open Limited
web site. Timestamps place this at 04-Jul so a revision from 05-Jul or
earlier was pulled and copied over the 2.6.0 tarball stable code.
- Author:
- adh
- Date:
- Sat Jul 22 23:27:35 +0100 2006
- Size:
- 11603 Bytes
1 | <?xml version="1.0" encoding="iso-8859-1"?> |
2 | <!DOCTYPE html |
3 | PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
4 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
5 | <html> |
6 | <head> |
7 | <title>Class: Syntax::XML</title> |
8 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> |
9 | <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> |
10 | |
11 | <script language="JavaScript" type="text/javascript"> |
12 | // <![CDATA[ |
13 | |
14 | function toggleSource( id ) |
15 | { |
16 | var elem |
17 | var link |
18 | |
19 | if( document.getElementById ) |
20 | { |
21 | elem = document.getElementById( id ) |
22 | link = document.getElementById( "l_" + id ) |
23 | } |
24 | else if ( document.all ) |
25 | { |
26 | elem = eval( "document.all." + id ) |
27 | link = eval( "document.all.l_" + id ) |
28 | } |
29 | else |
30 | return false; |
31 | |
32 | if( elem.style.display == "block" ) |
33 | { |
34 | elem.style.display = "none" |
35 | link.innerHTML = "show source" |
36 | } |
37 | else |
38 | { |
39 | elem.style.display = "block" |
40 | link.innerHTML = "hide source" |
41 | } |
42 | } |
43 | |
44 | function openCode( url ) |
45 | { |
46 | window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" ) |
47 | } |
48 | // ]]> |
49 | </script> |
50 | </head> |
51 | |
52 | <body> |
53 | <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr> |
54 | <td class="file-title"><span class="file-title-prefix">Class</span><br />Syntax::XML</td> |
55 | <td align="right"> |
56 | <table cellspacing=0 cellpadding=2> |
57 | <tr valign="top"> |
58 | <td>In:</td> |
59 | <td> |
60 | <a href="../../files/lib/syntax/lang/xml_rb.html">lib/syntax/lang/xml.rb</a> |
61 | </td> |
62 | </tr> |
63 | <tr> |
64 | <td>Parent:</td> |
65 | <td> |
66 | <a href="Tokenizer.html"> |
67 | Tokenizer |
68 | </a> |
69 | </td> |
70 | </tr> |
71 | </table> |
72 | </td> |
73 | </tr> |
74 | </table> |
75 | <!-- banner header --> |
76 | |
77 | <div id="bodyContent"> |
78 | <div id="content"> |
79 | |
80 | <div class="description"><p> |
81 | A simple implementation of an <a href="XML.html">XML</a> lexer. It handles |
82 | most cases. It is not a validating lexer, meaning it will happily process |
83 | invalid <a href="XML.html">XML</a> without complaining. |
84 | </p> |
85 | </div> |
86 | |
87 | |
88 | |
89 | <div class="sectiontitle">Methods</div> |
90 | <ul> |
91 | <li><a href="#M000006">setup</a></li> |
92 | <li><a href="#M000007">step</a></li> |
93 | </ul> |
94 | |
95 | |
96 | |
97 | |
98 | |
99 | |
100 | <div class="sectiontitle">Public Instance methods</div> |
101 | <div class="method"> |
102 | <div class="title"> |
103 | <a name="M000006"></a><b>setup</b>() |
104 | </div> |
105 | <div class="description"> |
106 | <p> |
107 | Initialize the lexer. |
108 | </p> |
109 | </div> |
110 | <div class="sourcecode"> |
111 | <p class="source-link">[ <a href="javascript:toggleSource('M000006_source')" id="l_M000006_source">show source</a> ]</p> |
112 | <div id="M000006_source" class="dyn-source"> |
113 | <pre> |
114 | <span class="ruby-comment cmt"># File lib/syntax/lang/xml.rb, line 11</span> |
115 | 11: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span> |
116 | 12: <span class="ruby-ivar">@in_tag</span> = <span class="ruby-keyword kw">false</span> |
117 | 13: <span class="ruby-keyword kw">end</span> |
118 | </pre> |
119 | </div> |
120 | </div> |
121 | </div> |
122 | <div class="method"> |
123 | <div class="title"> |
124 | <a name="M000007"></a><b>step</b>() |
125 | </div> |
126 | <div class="description"> |
127 | <p> |
128 | Step through a single iteration of the tokenization process. This will |
129 | yield (potentially) many tokens, and possibly zero tokens. |
130 | </p> |
131 | </div> |
132 | <div class="sourcecode"> |
133 | <p class="source-link">[ <a href="javascript:toggleSource('M000007_source')" id="l_M000007_source">show source</a> ]</p> |
134 | <div id="M000007_source" class="dyn-source"> |
135 | <pre> |
136 | <span class="ruby-comment cmt"># File lib/syntax/lang/xml.rb, line 17</span> |
137 | 17: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">step</span> |
138 | 18: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:normal</span>, <span class="ruby-identifier">matched</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">scan</span>( <span class="ruby-regexp re">/\s+/</span> ) |
139 | 19: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@in_tag</span> |
140 | 20: <span class="ruby-keyword kw">case</span> |
141 | 21: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>( <span class="ruby-regexp re">/([-\w]+):([-\w]+)/</span> ) |
142 | 22: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:namespace</span>, <span class="ruby-identifier">subgroup</span>(<span class="ruby-value">1</span>) |
143 | 23: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:punct</span>, <span class="ruby-value str">":"</span> |
144 | 24: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:attribute</span>, <span class="ruby-identifier">subgroup</span>(<span class="ruby-value">2</span>) |
145 | 25: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>( <span class="ruby-regexp re">/\d+/</span> ) |
146 | 26: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:number</span>, <span class="ruby-identifier">matched</span> |
147 | 27: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>( <span class="ruby-regexp re">/[-\w]+/</span> ) |
148 | 28: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:attribute</span>, <span class="ruby-identifier">matched</span> |
149 | 29: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>( <span class="ruby-regexp re">%r{[/?]?>}</span> ) |
150 | 30: <span class="ruby-ivar">@in_tag</span> = <span class="ruby-keyword kw">false</span> |
151 | 31: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:punct</span>, <span class="ruby-identifier">matched</span> |
152 | 32: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>( <span class="ruby-regexp re">/=/</span> ) |
153 | 33: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:punct</span>, <span class="ruby-identifier">matched</span> |
154 | 34: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>( <span class="ruby-regexp re">/["']/</span> ) |
155 | 35: <span class="ruby-identifier">scan_string</span> <span class="ruby-identifier">matched</span> |
156 | 36: <span class="ruby-keyword kw">else</span> |
157 | 37: <span class="ruby-identifier">append</span> <span class="ruby-identifier">getch</span> |
158 | 38: <span class="ruby-keyword kw">end</span> |
159 | 39: <span class="ruby-keyword kw">elsif</span> ( <span class="ruby-identifier">text</span> = <span class="ruby-identifier">scan_until</span>( <span class="ruby-regexp re">/(?=[<&])/</span> ) ) |
160 | 40: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:normal</span>, <span class="ruby-identifier">text</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span> |
161 | 41: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/<!--.*?(-->|\Z)/</span><span class="ruby-identifier">m</span>) |
162 | 42: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:comment</span>, <span class="ruby-identifier">matched</span> |
163 | 43: <span class="ruby-keyword kw">else</span> |
164 | 44: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">peek</span>(<span class="ruby-value">1</span>) |
165 | 45: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"<"</span> |
166 | 46: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:punct</span>, <span class="ruby-identifier">getch</span> |
167 | 47: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">peek</span>(<span class="ruby-value">1</span>) |
168 | 48: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"?"</span> |
169 | 49: <span class="ruby-identifier">append</span> <span class="ruby-identifier">getch</span> |
170 | 50: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"/"</span> |
171 | 51: <span class="ruby-identifier">append</span> <span class="ruby-identifier">getch</span> |
172 | 52: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"!"</span> |
173 | 53: <span class="ruby-identifier">append</span> <span class="ruby-identifier">getch</span> |
174 | 54: <span class="ruby-keyword kw">end</span> |
175 | 55: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:normal</span>, <span class="ruby-identifier">matched</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">scan</span>( <span class="ruby-regexp re">/\s+/</span> ) |
176 | 56: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">scan</span>( <span class="ruby-regexp re">/([-\w]+):([-\w]+)/</span> ) |
177 | 57: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:namespace</span>, <span class="ruby-identifier">subgroup</span>(<span class="ruby-value">1</span>) |
178 | 58: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:punct</span>, <span class="ruby-value str">":"</span> |
179 | 59: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:tag</span>, <span class="ruby-identifier">subgroup</span>(<span class="ruby-value">2</span>) |
180 | 60: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">scan</span>( <span class="ruby-regexp re">/[-\w]+/</span> ) |
181 | 61: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:tag</span>, <span class="ruby-identifier">matched</span> |
182 | 62: <span class="ruby-keyword kw">end</span> |
183 | 63: <span class="ruby-ivar">@in_tag</span> = <span class="ruby-keyword kw">true</span> |
184 | 64: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"&"</span> |
185 | 65: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">scan</span>( <span class="ruby-regexp re">/&\S{1,10};/</span> ) |
186 | 66: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:entity</span>, <span class="ruby-identifier">matched</span> |
187 | 67: <span class="ruby-keyword kw">else</span> |
188 | 68: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:normal</span>, <span class="ruby-identifier">scan</span>( <span class="ruby-regexp re">/&/</span> ) |
189 | 69: <span class="ruby-keyword kw">end</span> |
190 | 70: <span class="ruby-keyword kw">end</span> |
191 | 71: <span class="ruby-keyword kw">end</span> |
192 | 72: <span class="ruby-keyword kw">else</span> |
193 | 73: <span class="ruby-identifier">append</span> <span class="ruby-identifier">scan_until</span>( <span class="ruby-regexp re">/\Z/</span> ) |
194 | 74: <span class="ruby-keyword kw">end</span> |
195 | 75: <span class="ruby-keyword kw">end</span> |
196 | </pre> |
197 | </div> |
198 | </div> |
199 | </div> |
200 | </div> |
201 | |
202 | </div> |
203 | |
204 | </body> |
205 | </html> |