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:
- 12481 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::YAML</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::YAML</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/yaml_rb.html">lib/syntax/lang/yaml.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="YAML.html">YAML</a> lexer. It |
82 | handles most cases. It is not a validating lexer. |
83 | </p> |
84 | </div> |
85 | |
86 | |
87 | |
88 | <div class="sectiontitle">Methods</div> |
89 | <ul> |
90 | <li><a href="#M000019">step</a></li> |
91 | </ul> |
92 | |
93 | |
94 | |
95 | |
96 | |
97 | |
98 | <div class="sectiontitle">Public Instance methods</div> |
99 | <div class="method"> |
100 | <div class="title"> |
101 | <a name="M000019"></a><b>step</b>() |
102 | </div> |
103 | <div class="description"> |
104 | <p> |
105 | Step through a single iteration of the tokenization process. This will |
106 | yield (potentially) many tokens, and possibly zero tokens. |
107 | </p> |
108 | </div> |
109 | <div class="sourcecode"> |
110 | <p class="source-link">[ <a href="javascript:toggleSource('M000019_source')" id="l_M000019_source">show source</a> ]</p> |
111 | <div id="M000019_source" class="dyn-source"> |
112 | <pre> |
113 | <span class="ruby-comment cmt"># File lib/syntax/lang/yaml.rb, line 11</span> |
114 | 11: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">step</span> |
115 | 12: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">bol?</span> |
116 | 13: <span class="ruby-keyword kw">case</span> |
117 | 14: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/---(\s*.+)?$/</span>) |
118 | 15: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:document</span>, <span class="ruby-identifier">matched</span> |
119 | 16: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/(\s*)([a-zA-Z][-\w]*)(\s*):/</span>) |
120 | 17: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:normal</span>, <span class="ruby-identifier">subgroup</span>(<span class="ruby-value">1</span>) |
121 | 18: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:key</span>, <span class="ruby-identifier">subgroup</span>(<span class="ruby-value">2</span>) |
122 | 19: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:normal</span>, <span class="ruby-identifier">subgroup</span>(<span class="ruby-value">3</span>) |
123 | 20: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:punct</span>, <span class="ruby-value str">":"</span> |
124 | 21: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/(\s*)-/</span>) |
125 | 22: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:normal</span>, <span class="ruby-identifier">subgroup</span>(<span class="ruby-value">1</span>) |
126 | 23: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:punct</span>, <span class="ruby-value str">"-"</span> |
127 | 24: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/\s*$/</span>) |
128 | 25: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:normal</span>, <span class="ruby-identifier">matched</span> |
129 | 26: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/#.*$/</span>) |
130 | 27: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:comment</span>, <span class="ruby-identifier">matched</span> |
131 | 28: <span class="ruby-keyword kw">else</span> |
132 | 29: <span class="ruby-identifier">append</span> <span class="ruby-identifier">getch</span> |
133 | 30: <span class="ruby-keyword kw">end</span> |
134 | 31: <span class="ruby-keyword kw">else</span> |
135 | 32: <span class="ruby-keyword kw">case</span> |
136 | 33: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/[\n\r]+/</span>) |
137 | 34: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:normal</span>, <span class="ruby-identifier">matched</span> |
138 | 35: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/[ \t]+/</span>) |
139 | 36: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:normal</span>, <span class="ruby-identifier">matched</span> |
140 | 37: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/!+(.*?^)?\S+/</span>) |
141 | 38: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:type</span>, <span class="ruby-identifier">matched</span> |
142 | 39: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/&\S+/</span>) |
143 | 40: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:anchor</span>, <span class="ruby-identifier">matched</span> |
144 | 41: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/\*\S+/</span>) |
145 | 42: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:ref</span>, <span class="ruby-identifier">matched</span> |
146 | 43: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/\d\d:\d\d:\d\d/</span>) |
147 | 44: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:time</span>, <span class="ruby-identifier">matched</span> |
148 | 45: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d(\.\d+)? [-+]\d\d:\d\d/</span>) |
149 | 46: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:date</span>, <span class="ruby-identifier">matched</span> |
150 | 47: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/['"]/</span>) |
151 | 48: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:punct</span>, <span class="ruby-identifier">matched</span> |
152 | 49: <span class="ruby-identifier">scan_string</span> <span class="ruby-identifier">matched</span> |
153 | 50: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/:\w+/</span>) |
154 | 51: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:symbol</span>, <span class="ruby-identifier">matched</span> |
155 | 52: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/[:]/</span>) |
156 | 53: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:punct</span>, <span class="ruby-identifier">matched</span> |
157 | 54: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/#.*$/</span>) |
158 | 55: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:comment</span>, <span class="ruby-identifier">matched</span> |
159 | 56: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/>-?/</span>) |
160 | 57: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:punct</span>, <span class="ruby-identifier">matched</span> |
161 | 58: <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>) |
162 | 59: <span class="ruby-identifier">append</span> <span class="ruby-identifier">getch</span> <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">eos?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">bol?</span> |
163 | 60: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">eos?</span> |
164 | 61: <span class="ruby-identifier">indent</span> = <span class="ruby-identifier">check</span>(<span class="ruby-regexp re">/ */</span>) |
165 | 62: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:string</span> |
166 | 63: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span> |
167 | 64: <span class="ruby-identifier">line</span> = <span class="ruby-identifier">check_until</span>(<span class="ruby-regexp re">/[\n\r]|\Z/</span>) |
168 | 65: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">nil?</span> |
169 | 66: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> |
170 | 67: <span class="ruby-identifier">this_indent</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">match</span>( <span class="ruby-regexp re">/^\s*/</span> )[<span class="ruby-value">0</span>] |
171 | 68: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">this_indent</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">indent</span>.<span class="ruby-identifier">length</span> |
172 | 69: <span class="ruby-keyword kw">end</span> |
173 | 70: <span class="ruby-identifier">append</span> <span class="ruby-identifier">scan_until</span>(<span class="ruby-regexp re">/[\n\r]|\Z/</span>) |
174 | 71: <span class="ruby-keyword kw">end</span> |
175 | 72: <span class="ruby-keyword kw">else</span> |
176 | 73: <span class="ruby-identifier">start_group</span> <span class="ruby-identifier">:normal</span>, <span class="ruby-identifier">scan_until</span>(<span class="ruby-regexp re">/(?=$|#)/</span>) |
177 | 74: <span class="ruby-keyword kw">end</span> |
178 | 75: <span class="ruby-keyword kw">end</span> |
179 | 76: <span class="ruby-keyword kw">end</span> |
180 | </pre> |
181 | </div> |
182 | </div> |
183 | </div> |
184 | </div> |
185 | |
186 | </div> |
187 | |
188 | </body> |
189 | </html> |