<Comment># This file is a testcase for the highlighting of Ruby code</Comment><br/>
<Comment># It's not executable code, but a collection of code snippets</Comment><br/>
<Comment>#</Comment><br/>
<Normal Text></Normal Text><br/>
<Kernel methods>require</Kernel methods><Normal Text> </Normal Text><Raw String>'Config'</Raw String><br/>
<Kernel methods>require</Kernel methods><Normal Text> </Normal Text><Raw String>'DO/Clients'</Raw String><br/>
<Kernel methods>require</Kernel methods><Normal Text> </Normal Text><Raw String>'DO/DBClients'</Raw String><br/>
<Normal Text></Normal Text><br/>
<Normal Text>  </Normal Text><Keyword>def</Keyword><Normal Text> </Normal Text><Global Constant>CGI</Global Constant><Operator>::</Operator><Message>escapeElement</Message><Normal Text>(string, </Normal Text><Operator>*</Operator><Normal Text>elements)</Normal Text><br/>
<Normal Text>    elements </Normal Text><Operator>=</Operator><Normal Text> elements</Normal Text><Delimiter>[</Delimiter><Dec>0</Dec><Delimiter>]</Delimiter><Normal Text> </Normal Text><Keyword>if</Keyword><Normal Text> elements</Normal Text><Delimiter>[</Delimiter><Dec>0</Dec><Delimiter>]</Delimiter><Message>.kind_of?</Message><Normal Text>(</Normal Text><Constant>Array</Constant><Normal Text>)</Normal Text><br/>
<Normal Text>    </Normal Text><Keyword>unless</Keyword><Normal Text> elements</Normal Text><Message>.empty?</Message><br/>
<Normal Text>      string</Normal Text><Message>.gsub</Message><Normal Text>(</Normal Text><Regular Expression>/<\/?(?:</Regular Expression><Substitution>#{</Substitution><Normal Text>elements</Normal Text><Message>.join</Message><Normal Text>(</Normal Text><String>"|"</String><Normal Text>)</Normal Text><Substitution>}</Substitution><Regular Expression>)(?!\w)(?:.|\n)*?>/ni</Regular Expression><Normal Text>) </Normal Text><Keyword>do</Keyword><br/>
<Normal Text>        </Normal Text><Global Constant>CGI</Global Constant><Operator>::</Operator><Message>escapeHTML</Message><Normal Text>(</Normal Text><Default globals>$&</Default globals><Normal Text>)</Normal Text><br/>
<Normal Text>      </Normal Text><Keyword>end</Keyword><br/>
<Normal Text>    </Normal Text><Keyword>else</Keyword><br/>
<Normal Text>      string</Normal Text><br/>
<Normal Text>    </Normal Text><Keyword>end</Keyword><br/>
<Normal Text>  </Normal Text><Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Keyword>case</Keyword><Normal Text> inputLine</Normal Text><br/>
<Normal Text>  </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><String>"debug"</String><br/>
<Normal Text>    dumpDebugInfo</Normal Text><br/>
<Normal Text>    dumpSymbols</Normal Text><br/>
<Normal Text>  </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Regular Expression>/p\s+(\w+)/</Regular Expression><br/>
<Normal Text>    dumpVariable(</Normal Text><Global Variable>$1</Global Variable><Normal Text>)</Normal Text><br/>
<Normal Text>  </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><String>"quit"</String><Normal Text>, </Normal Text><String>"exit"</String><br/>
<Normal Text>    </Normal Text><Kernel methods>exit</Kernel methods><br/>
<Normal Text>  </Normal Text><Keyword>else</Keyword><br/>
<Normal Text>    </Normal Text><Kernel methods>print</Kernel methods><Normal Text> </Normal Text><String>"Illegal command: </String><Substitution>#{</Substitution><Normal Text>inputLine</Normal Text><Substitution>}</Substitution><String>"</String><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Normal Text></Normal Text><br/>
<Normal Text>kind </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Keyword>case</Keyword><Normal Text> year </Normal Text><Comment>#hi there</Comment><br/>
<Normal Text>         </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Dec>1850</Dec><Operator>..</Operator><Dec>1889</Dec><Normal Text> </Normal Text><Keyword>then</Keyword><Normal Text> </Normal Text><String>"Blues"</String><br/>
<Normal Text>         </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Dec>1890</Dec><Operator>..</Operator><Dec>1909</Dec><Normal Text> </Normal Text><Keyword>then</Keyword><Normal Text> </Normal Text><String>"Ragtime"</String><br/>
<Normal Text>         </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Dec>1910</Dec><Operator>..</Operator><Dec>1929</Dec><Normal Text> </Normal Text><Keyword>then</Keyword><Normal Text> </Normal Text><String>"New Orleans Jazz"</String><br/>
<Normal Text>         </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Dec>1930</Dec><Operator>..</Operator><Dec>1939</Dec><Normal Text> </Normal Text><Keyword>then</Keyword><Normal Text> </Normal Text><String>"Swing"</String><br/>
<Normal Text>         </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Dec>1940</Dec><Operator>..</Operator><Dec>1950</Dec><Normal Text> </Normal Text><Keyword>then</Keyword><Normal Text> </Normal Text><String>"Bebop"</String><br/>
<Normal Text>         </Normal Text><Keyword>else</Keyword><Normal Text>                 </Normal Text><String>"Jazz"</String><br/>
<Normal Text>       </Normal Text><Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Normal Text>  </Normal Text><Comment># URL-encode a string.</Comment><br/>
<Normal Text>  </Normal Text><Comment>#   url_encoded_string = CGI::escape("'Stop!' said Fred")</Comment><br/>
<Normal Text>  </Normal Text><Comment>#      # => "%27Stop%21%27+said+Fred"</Comment><br/>
<Normal Text>  </Normal Text><Keyword>def</Keyword><Normal Text> </Normal Text><Global Constant>CGI</Global Constant><Operator>::</Operator><Message>escape</Message><Normal Text>(string)</Normal Text><br/>
<Normal Text>    string</Normal Text><Message>.gsub</Message><Normal Text>(</Normal Text><Regular Expression>/([^ a-zA-Z0-9_.-]+)/n</Regular Expression><Normal Text>) </Normal Text><Keyword>do</Keyword><br/>
<Normal Text>      </Normal Text><Char>'%'</Char><Normal Text> </Normal Text><Operator>+</Operator><Normal Text> </Normal Text><Global Variable>$1</Global Variable><Message>.unpack</Message><Normal Text>(</Normal Text><Raw String>'H2'</Raw String><Normal Text> </Normal Text><Operator>*</Operator><Normal Text> </Normal Text><Global Variable>$1</Global Variable><Message>.size</Message><Normal Text>)</Normal Text><Message>.join</Message><Normal Text>(</Normal Text><Char>'%'</Char><Normal Text>)</Normal Text><Message>.upcase</Message><br/>
<Normal Text>    </Normal Text><Keyword>end</Keyword><Message>.tr</Message><Normal Text>(</Normal Text><Char>' '</Char><Normal Text>, </Normal Text><Char>'+'</Char><Normal Text>)</Normal Text><br/>
<Normal Text>  </Normal Text><Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Normal Text></Normal Text><br/>
<Comment># Class ClientManager</Comment><br/>
<Comment>#</Comment><br/>
<Comment># definition : Import, store and export the various data used by the application.</Comment><br/>
<Comment># This class is the sole interface between the application and the underlying database.</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text>mon, day, year </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Global Variable>$1</Global Variable><Normal Text>, </Normal Text><Global Variable>$2</Global Variable><Normal Text>, </Normal Text><Global Variable>$3</Global Variable><Normal Text> </Normal Text><Keyword>if</Keyword><Normal Text> </Normal Text><Regular Expression>/(\d\d)-(\d\d)-(\d\d)/</Regular Expression><br/>
<Kernel methods>puts</Kernel methods><Normal Text> </Normal Text><String>"a = </String><Substitution>#{</Substitution><Normal Text>a</Normal Text><Substitution>}</Substitution><String>"</String><Normal Text> </Normal Text><Keyword>if</Keyword><Normal Text> fDebug</Normal Text><br/>
<Kernel methods>print</Kernel methods><Normal Text> total </Normal Text><Keyword>unless</Keyword><Normal Text> total </Normal Text><Operator>==</Operator><Normal Text> </Normal Text><Dec>0</Dec><br/>
<Normal Text></Normal Text><br/>
<Keyword>while</Keyword><Normal Text> </Normal Text><Kernel methods>gets</Kernel methods><br/>
<Normal Text>  </Normal Text><Keyword>next</Keyword><Normal Text> </Normal Text><Keyword>if</Keyword><Normal Text> </Normal Text><Regular Expression>/^#/</Regular Expression><Normal Text>            </Normal Text><Comment># Skip comments</Comment><br/>
<Normal Text>  parseLine </Normal Text><Keyword>unless</Keyword><Normal Text> </Normal Text><Regular Expression>/^$/</Regular Expression><Normal Text>   </Normal Text><Comment># Don't parse empty lines</Comment><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Keyword>if</Keyword><Normal Text> artist </Normal Text><Operator>==</Operator><Normal Text> </Normal Text><String>"John Coltrane"</String><Normal Text> </Normal Text><Comment>#hi there</Comment><br/>
<Normal Text>  artist </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>"'Trane"</String><Normal Text> </Normal Text><Comment>#hi there</Comment><br/>
<Keyword>end</Keyword><Normal Text> </Normal Text><Keyword>unless</Keyword><Normal Text> nicknames </Normal Text><Operator>==</Operator><Normal Text> </Normal Text><String>"no"</String><Normal Text> </Normal Text><Comment>#hi there</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text>handle </Normal Text><Keyword>= if</Keyword><Normal Text> aSong</Normal Text><Message>.artist</Message><Normal Text> </Normal Text><Operator>==</Operator><Normal Text> </Normal Text><String>"Gillespie"</String><Normal Text> </Normal Text><Keyword>then</Keyword><Normal Text> </Normal Text><Comment>#hi there</Comment><br/>
<Normal Text>           </Normal Text><String>"Dizzy"</String><br/>
<Normal Text>         </Normal Text><Keyword>elsif</Keyword><Normal Text> aSong</Normal Text><Message>.artist</Message><Normal Text> </Normal Text><Operator>==</Operator><Normal Text> </Normal Text><String>"Parker"</String><Normal Text> </Normal Text><Keyword>then</Keyword><br/>
<Normal Text>           </Normal Text><String>"Bird"</String><br/>
<Normal Text>         </Normal Text><Keyword>else</Keyword><Normal Text> </Normal Text><Comment>#hi there</Comment><br/>
<Normal Text>           </Normal Text><String>"unknown"</String><br/>
<Normal Text>         </Normal Text><Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Keyword>if</Keyword><Normal Text> aSong</Normal Text><Message>.artist</Message><Normal Text> </Normal Text><Operator>==</Operator><Normal Text> </Normal Text><String>"Gillespie"</String><Normal Text> </Normal Text><Keyword>then</Keyword><Normal Text>  handle </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>"Dizzy"</String><br/>
<Keyword>elsif</Keyword><Normal Text> aSong</Normal Text><Message>.artist</Message><Normal Text> </Normal Text><Operator>==</Operator><Normal Text> </Normal Text><String>"Parker"</String><Normal Text> </Normal Text><Keyword>then</Keyword><Normal Text>  handle </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>"Bird"</String><br/>
<Keyword>else</Keyword><Normal Text>  handle </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>"unknown"</String><br/>
<Keyword>end</Keyword><Normal Text> </Normal Text><Comment>#hi there</Comment><br/>
<Normal Text></Normal Text><br/>
<Keyword>if</Keyword><Normal Text> aSong</Normal Text><Message>.artist</Message><Normal Text> </Normal Text><Operator>==</Operator><Normal Text> </Normal Text><String>"Gillespie"</String><Normal Text> </Normal Text><Keyword>then</Keyword><br/>
<Normal Text>  handle </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>"Dizzy"</String><br/>
<Keyword>elsif</Keyword><Normal Text> aSong</Normal Text><Message>.artist</Message><Normal Text> </Normal Text><Operator>==</Operator><Normal Text> </Normal Text><String>"Parker"</String><Normal Text> </Normal Text><Keyword>then</Keyword><br/>
<Normal Text>  handle </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>"Bird"</String><br/>
<Keyword>else</Keyword><br/>
<Normal Text>  handle </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>"unknown"</String><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Keyword>if</Keyword><Normal Text> aSong</Normal Text><Message>.artist</Message><Normal Text> </Normal Text><Operator>==</Operator><Normal Text> </Normal Text><String>"Gillespie"</String><br/>
<Normal Text>  handle </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>"Dizzy"</String><br/>
<Keyword>elsif</Keyword><Normal Text> aSong</Normal Text><Message>.artist</Message><Normal Text> </Normal Text><Operator>==</Operator><Normal Text> </Normal Text><String>"Parker"</String><br/>
<Normal Text>  handle </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>"Bird"</String><br/>
<Keyword>else</Keyword><br/>
<Normal Text>  handle </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>"unknown"</String><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Normal Text> </Normal Text><Keyword>case</Keyword><Normal Text> line</Normal Text><br/>
<Normal Text>  </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Regular Expression>/title=(.*)/</Regular Expression><br/>
<Normal Text>    </Normal Text><Kernel methods>puts</Kernel methods><Normal Text> </Normal Text><String>"Title is #$1"</String><br/>
<Normal Text>  </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Regular Expression>/track=(.*)/</Regular Expression><br/>
<Normal Text>    </Normal Text><Kernel methods>puts</Kernel methods><Normal Text> </Normal Text><String>"Track is #$1"</String><br/>
<Normal Text>  </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Regular Expression>/artist=(.*)/</Regular Expression><br/>
<Normal Text>    </Normal Text><Kernel methods>puts</Kernel methods><Normal Text> </Normal Text><String>"Artist is #$1"</String><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Keyword>case</Keyword><Normal Text> shape</Normal Text><br/>
<Normal Text>  </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Constant>Square</Constant><Normal Text>, </Normal Text><Constant>Rectangle</Constant><br/>
<Normal Text>    </Normal Text><Comment># ...</Comment><br/>
<Normal Text>  </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Constant>Circle</Constant><br/>
<Normal Text>    </Normal Text><Comment># ...</Comment><br/>
<Normal Text>  </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Constant>Triangle</Constant><br/>
<Normal Text>    </Normal Text><Comment># ...</Comment><br/>
<Normal Text>  </Normal Text><Keyword>else</Keyword><br/>
<Normal Text>    </Normal Text><Comment># ...</Comment><br/>
<Keyword>end</Keyword><Normal Text> </Normal Text><br/>
<Normal Text></Normal Text><br/>
<Normal Text></Normal Text><br/>
<Keyword>until</Keyword><Normal Text> playList</Normal Text><Message>.duration</Message><Normal Text> </Normal Text><Operator>></Operator><Normal Text> </Normal Text><Dec>60</Dec><Normal Text> </Normal Text><Comment>#hi there</Comment><br/>
<Normal Text>  playList</Normal Text><Message>.add</Message><Normal Text>(songList</Normal Text><Message>.pop</Message><Normal Text>)</Normal Text><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Dec>3</Dec><Message>.times</Message><Normal Text> </Normal Text><Keyword>do</Keyword><br/>
<Normal Text>  </Normal Text><Kernel methods>print</Kernel methods><Normal Text> </Normal Text><String>"Ho! "</String><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Kernel methods>loop</Kernel methods><Normal Text> </Normal Text><Operator>{</Operator><br/>
<Normal Text>  </Normal Text><Comment># block ...</Comment><br/>
<Operator>}</Operator><br/>
<Normal Text></Normal Text><br/>
<Normal Text>songList</Normal Text><Message>.each</Message><Normal Text> </Normal Text><Keyword>do</Keyword><Normal Text> </Normal Text><Operator>|</Operator><Normal Text>aSong</Normal Text><Operator>|</Operator><br/>
<Normal Text>  aSong</Normal Text><Message>.play</Message><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Keyword>for</Keyword><Normal Text> aSong </Normal Text><Keyword>in</Keyword><Normal Text> songList</Normal Text><br/>
<Normal Text>  aSong</Normal Text><Message>.play</Message><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Keyword>for</Keyword><Normal Text> i </Normal Text><Keyword>in</Keyword><Normal Text> </Normal Text><Delimiter>[</Delimiter><Raw String>'fee'</Raw String><Normal Text>, </Normal Text><Raw String>'fi'</Raw String><Normal Text>, </Normal Text><Raw String>'fo'</Raw String><Normal Text>, </Normal Text><Raw String>'fum'</Raw String><Delimiter>]</Delimiter><br/>
<Normal Text>  </Normal Text><Kernel methods>print</Kernel methods><Normal Text> i, </Normal Text><String>" "</String><br/>
<Keyword>end</Keyword><br/>
<Keyword>for</Keyword><Normal Text> i </Normal Text><Keyword>in</Keyword><Normal Text> </Normal Text><Dec>1</Dec><Operator>..</Operator><Dec>3</Dec><br/>
<Normal Text>  </Normal Text><Kernel methods>print</Kernel methods><Normal Text> i, </Normal Text><String>" "</String><br/>
<Keyword>end</Keyword><br/>
<Keyword>for</Keyword><Normal Text> i </Normal Text><Keyword>in</Keyword><Normal Text> </Normal Text><Constant>File</Constant><Message>.open</Message><Normal Text>(</Normal Text><String>"ordinal"</String><Normal Text>)</Normal Text><Message>.find_all</Message><Normal Text> </Normal Text><Operator>{</Operator><Normal Text> </Normal Text><Operator>|</Operator><Normal Text>l</Normal Text><Operator>|</Operator><Normal Text> l </Normal Text><Operator>=~</Operator><Normal Text> </Normal Text><Regular Expression>/d$/</Regular Expression><Operator>}</Operator><br/>
<Normal Text>  </Normal Text><Kernel methods>print</Kernel methods><Normal Text> i</Normal Text><Message>.chomp</Message><Normal Text>, </Normal Text><String>" "</String><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Keyword>class</Keyword><Normal Text> </Normal Text><Constant>Periods</Constant><br/>
<Normal Text>  </Normal Text><Keyword>def</Keyword><Normal Text> each</Normal Text><br/>
<Normal Text>    </Normal Text><Keyword>yield</Keyword><Normal Text> </Normal Text><String>"Classical"</String><br/>
<Normal Text>    </Normal Text><Keyword>yield</Keyword><Normal Text> </Normal Text><String>"Jazz"</String><br/>
<Normal Text>    </Normal Text><Keyword>yield</Keyword><Normal Text> </Normal Text><String>"Rock"</String><br/>
<Normal Text>  </Normal Text><Keyword>end</Keyword><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Normal Text></Normal Text><br/>
<Normal Text>periods </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Constant>Periods</Constant><Message>.new</Message><br/>
<Keyword>for</Keyword><Normal Text> genre </Normal Text><Keyword>in</Keyword><Normal Text> periods</Normal Text><br/>
<Normal Text>  </Normal Text><Kernel methods>print</Kernel methods><Normal Text> genre, </Normal Text><String>" "</String><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Keyword>while</Keyword><Normal Text> </Normal Text><Kernel methods>gets</Kernel methods><br/>
<Normal Text>  </Normal Text><Keyword>next</Keyword><Normal Text> </Normal Text><Keyword>if</Keyword><Normal Text> </Normal Text><Regular Expression>/^\s*#/</Regular Expression><Normal Text>   </Normal Text><Comment># skip comments</Comment><br/>
<Normal Text>  </Normal Text><Keyword>break</Keyword><Normal Text> </Normal Text><Keyword>if</Keyword><Normal Text> </Normal Text><Regular Expression>/^END/</Regular Expression><Normal Text>   </Normal Text><Comment># stop at end</Comment><br/>
<Normal Text>                    </Normal Text><Comment># substitute stuff in backticks and try again</Comment><br/>
<Normal Text>  </Normal Text><Keyword>redo</Keyword><Normal Text> </Normal Text><Keyword>if</Keyword><Normal Text> </Normal Text><Kernel methods>gsub!</Kernel methods><Normal Text>(</Normal Text><Regular Expression>/`(.*?)`/</Regular Expression><Normal Text>) </Normal Text><Operator>{</Operator><Normal Text> </Normal Text><Kernel methods>eval</Kernel methods><Normal Text>(</Normal Text><Global Variable>$1</Global Variable><Normal Text>) </Normal Text><Operator>}</Operator><br/>
<Normal Text>  </Normal Text><Comment># process line ...</Comment><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Normal Text>i</Normal Text><Operator>=</Operator><Dec>0</Dec><br/>
<Kernel methods>loop</Kernel methods><Normal Text> </Normal Text><Keyword>do</Keyword><br/>
<Normal Text>  i </Normal Text><Operator>+=</Operator><Normal Text> </Normal Text><Dec>1</Dec><br/>
<Normal Text>  </Normal Text><Keyword>next</Keyword><Normal Text> </Normal Text><Keyword>if</Keyword><Normal Text> i </Normal Text><Operator><</Operator><Normal Text> </Normal Text><Dec>3</Dec><br/>
<Normal Text>  </Normal Text><Kernel methods>print</Kernel methods><Normal Text> i</Normal Text><br/>
<Normal Text>  </Normal Text><Keyword>break</Keyword><Normal Text> </Normal Text><Keyword>if</Keyword><Normal Text> i </Normal Text><Operator>></Operator><Normal Text> </Normal Text><Dec>4</Dec><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Keyword>for</Keyword><Normal Text> i </Normal Text><Keyword>in</Keyword><Normal Text> </Normal Text><Dec>1</Dec><Operator>..</Operator><Dec>100</Dec><br/>
<Normal Text>  </Normal Text><Kernel methods>print</Kernel methods><Normal Text> </Normal Text><String>"Now at </String><Substitution>#{</Substitution><Normal Text>i</Normal Text><Substitution>}</Substitution><String>. Restart? "</String><br/>
<Normal Text>  </Normal Text><Keyword>retry</Keyword><Normal Text> </Normal Text><Keyword>if</Keyword><Normal Text> </Normal Text><Kernel methods>gets</Kernel methods><Normal Text> </Normal Text><Operator>=~</Operator><Normal Text> </Normal Text><Regular Expression>/^y/i</Regular Expression><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Keyword>def</Keyword><Normal Text> doUntil(cond)</Normal Text><br/>
<Normal Text>  </Normal Text><Keyword>yield</Keyword><br/>
<Normal Text>  </Normal Text><Keyword>retry</Keyword><Normal Text> </Normal Text><Keyword>unless</Keyword><Normal Text> cond</Normal Text><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Normal Text>i </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Dec>0</Dec><br/>
<Normal Text>doUntil(i </Normal Text><Operator>></Operator><Normal Text> </Normal Text><Dec>3</Dec><Normal Text>) </Normal Text><Operator>{</Operator><br/>
<Normal Text>  </Normal Text><Kernel methods>print</Kernel methods><Normal Text> i, </Normal Text><String>" "</String><br/>
<Normal Text>  i </Normal Text><Operator>+=</Operator><Normal Text> </Normal Text><Dec>1</Dec><br/>
<Operator>}</Operator><br/>
<Normal Text></Normal Text><br/>
<Keyword>def</Keyword><Normal Text> system_call</Normal Text><br/>
<Normal Text>	</Normal Text><Comment># ... code which throws SystemCallError</Comment><br/>
<Keyword>rescue</Keyword><Normal Text> </Normal Text><Constant>SystemCallError</Constant><br/>
<Normal Text>	</Normal Text><Default globals>$stderr</Default globals><Message>.print</Message><Normal Text> </Normal Text><String>"IO failed: "</String><Normal Text> </Normal Text><Operator>+</Operator><Normal Text> </Normal Text><Default globals>$!</Default globals><br/>
<Normal Text>	opFile</Normal Text><Message>.close</Message><br/>
<Normal Text>	</Normal Text><Constant>File</Constant><Message>.delete</Message><Normal Text>(opName)</Normal Text><br/>
<Normal Text>	</Normal Text><Kernel methods>raise</Kernel methods><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Keyword>class</Keyword><Normal Text> </Normal Text><Constant>ClientManager</Constant><br/>
<Normal Text>	</Normal Text><br/>
<Normal Text>	</Normal Text><Comment># constructor</Comment><br/>
<Normal Text>	</Normal Text><Keyword>def</Keyword><Normal Text> initialize(dbase)</Normal Text><br/>
<Normal Text>		</Normal Text><Instance Variable>@dbClient</Instance Variable><Normal Text> </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Constant>DBClient</Constant><Message>.new</Message><Normal Text>(dbase)</Normal Text><br/>
<Normal Text>		</Normal Text><Instance Variable>@clients</Instance Variable><Normal Text> </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Constant>Clients</Constant><Message>.new</Message><br/>
<Normal Text>	</Normal Text><Keyword>end</Keyword><br/>
<Normal Text>	</Normal Text><br/>
<Normal Text>	</Normal Text><Keyword>def</Keyword><Normal Text> prout(a, b, xy</Normal Text><Operator>=</Operator><String>"jj"</String><Normal Text>) </Normal Text><Dec>24</Dec><Normal Text> </Normal Text><Keyword>end</Keyword><Normal Text> </Normal Text><br/>
<Normal Text>	</Normal Text><Comment>###############################################################</Comment><br/>
<Normal Text>	</Normal Text><Comment>#</Comment><br/>
<Normal Text>	</Normal Text><Comment># CLIENTS SECTION</Comment><br/>
<Normal Text>	</Normal Text><Comment>#</Comment><br/>
<Normal Text>	</Normal Text><Comment>###############################################################</Comment><br/>
<Normal Text>	</Normal Text><br/>
<Normal Text>	</Normal Text><Comment># update the clients object by retrieving the related data from the database</Comment><br/>
<Normal Text>	</Normal Text><Comment># returns the number of clients</Comment><br/>
<Normal Text>	</Normal Text><Keyword>def</Keyword><Normal Text> refreshClients</Normal Text><br/>
<Normal Text>		</Normal Text><Instance Variable>@clients</Instance Variable><Message>.clean</Message><br/>
<Normal Text>		</Normal Text><Keyword>unless</Keyword><Normal Text> </Normal Text><Instance Variable>@sqlQuery</Instance Variable><Message>.nil?</Message><Normal Text> </Normal Text><Keyword>then</Keyword><br/>
<Normal Text>			</Normal Text><Instance Variable>@sqlQuery</Instance Variable><Message>.selectClient.each</Message><Normal Text> </Normal Text><Keyword>do</Keyword><Normal Text> </Normal Text><Operator>|</Operator><Normal Text>row</Normal Text><Operator>|</Operator><br/>
<Normal Text>				</Normal Text><Instance Variable>@clients</Instance Variable><Message>.addClient</Message><Normal Text>(row</Normal Text><Delimiter>[</Delimiter><Dec>0</Dec><Delimiter>]</Delimiter><Normal Text>,row</Normal Text><Delimiter>[</Delimiter><Dec>1</Dec><Delimiter>]</Delimiter><Normal Text>,row</Normal Text><Delimiter>[</Delimiter><Dec>2</Dec><Delimiter>]</Delimiter><Normal Text>,row</Normal Text><Delimiter>[</Delimiter><Dec>3</Dec><Delimiter>]</Delimiter><Normal Text>,row</Normal Text><Delimiter>[</Delimiter><Dec>4</Dec><Delimiter>]</Delimiter><Normal Text>,row</Normal Text><Delimiter>[</Delimiter><Dec>5</Dec><Delimiter>]</Delimiter><Normal Text>, row</Normal Text><Delimiter>[</Delimiter><Dec>6</Dec><Delimiter>]</Delimiter><Normal Text>, row</Normal Text><Delimiter>[</Delimiter><Dec>7</Dec><Delimiter>]</Delimiter><Normal Text>, row</Normal Text><Delimiter>[</Delimiter><Dec>8</Dec><Delimiter>]</Delimiter><Normal Text>)</Normal Text><br/>
<Normal Text>			</Normal Text><Keyword>end</Keyword><br/>
<Normal Text>		</Normal Text><Keyword>else</Keyword><br/>
<Normal Text>			</Normal Text><Kernel methods>puts</Kernel methods><Normal Text> </Normal Text><String>"SqlQuery wasn't created : cannot read data from database"</String><br/>
<Normal Text>		</Normal Text><Keyword>end</Keyword><br/>
<Normal Text>		</Normal Text><Keyword>return</Keyword><Normal Text> </Normal Text><Instance Variable>@clients</Instance Variable><Message>.length</Message><br/>
<Normal Text>	</Normal Text><Keyword>end</Keyword><br/>
<Normal Text>	</Normal Text><br/>
<Normal Text>	</Normal Text><Comment># insert a client in the database and refreshes the local clients object</Comment><br/>
<Normal Text>	</Normal Text><Comment># we assume that none of the arguments is null</Comment><br/>
<Normal Text>	</Normal Text><Comment># we assume that the client, identified by raison_sociale doesn't already exists</Comment><br/>
<Normal Text>	</Normal Text><Keyword>def</Keyword><Normal Text> addClient(raison_sociale, division, departement, adresse, cp, ville, nom_contact, tel_contact)</Normal Text><br/>
<Normal Text>		id </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>"0"</String><br/>
<Normal Text>		</Normal Text><Keyword>unless</Keyword><Normal Text> </Normal Text><Instance Variable>@sqlQuery</Instance Variable><Message>.nil?</Message><Normal Text> </Normal Text><Keyword>then</Keyword><br/>
<Normal Text>			id </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Instance Variable>@sqlQuery</Instance Variable><Message>.insertClient</Message><Normal Text>(raison_sociale, division, departement, adresse, cp, ville, nom_contact,tel_contact)</Normal Text><br/>
<Normal Text>		</Normal Text><Keyword>else</Keyword><br/>
<Normal Text>			</Normal Text><Kernel methods>puts</Kernel methods><Normal Text> </Normal Text><String>"SqlQuery wasn't created : database update cannot be performed"</String><br/>
<Normal Text>		</Normal Text><Keyword>end</Keyword><br/>
<Normal Text>		</Normal Text><Instance Variable>@clients</Instance Variable><Message>.addClient</Message><Normal Text>(id, raison_sociale, division, departement, adresse, cp, ville, nom_contact, tel_contact) </Normal Text><Comment># synchronize local object with DB</Comment><br/>
<Normal Text>	</Normal Text><Keyword>end</Keyword><br/>
<Normal Text>	</Normal Text><br/>
<Normal Text>	</Normal Text><Comment># deletes a client from the database and updates the local Clients object accordingly</Comment><br/>
<Normal Text>	</Normal Text><Keyword>def</Keyword><Normal Text> delClient(nomclient_brut)</Normal Text><br/>
<Normal Text>		raison_sociale, div, dep </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Constant>Clients</Constant><Message>.getIdentifiers</Message><Normal Text>(nomclient_brut)</Normal Text><br/>
<Normal Text>		listeContratsExp, listeContratsSup, listeContratsProd, listePropositionsExp, listePropositionsSup </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Delimiter>[]</Delimiter><br/>
<Normal Text></Normal Text><br/>
<Normal Text>		listeContratsExp </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Instance Variable>@contratsExpertise</Instance Variable><Message>.getContratsFromClient</Message><Normal Text>(nomclient_brut)</Normal Text><br/>
<Normal Text>		listeContratsSup </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Instance Variable>@contratsSupport</Instance Variable><Message>.getContratsFromClient</Message><Normal Text>(nomclient_brut)</Normal Text><br/>
<Normal Text>		listeContratsProd </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Instance Variable>@contratsProduits</Instance Variable><Message>.getContratsFromClient</Message><Normal Text>(nomclient_brut)</Normal Text><br/>
<Normal Text>		listePropositionsExp </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Instance Variable>@propositionsExpertise</Instance Variable><Message>.getPropositionsFromClient</Message><Normal Text>(nomclient_brut)</Normal Text><br/>
<Normal Text>		listePropositionsSup </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Instance Variable>@propositionsSupport</Instance Variable><Message>.getPropositionsFromClient</Message><Normal Text>(nomclient_brut)</Normal Text><br/>
<Normal Text>		</Normal Text><br/>
<Normal Text>		</Normal Text><Keyword>unless</Keyword><Normal Text> </Normal Text><Instance Variable>@sqlQuery</Instance Variable><Message>.nil?</Message><Normal Text> </Normal Text><Keyword>then</Keyword><br/>
<Normal Text>			</Normal Text><Instance Variable>@sqlQuery</Instance Variable><Message>.deleteClient</Message><Normal Text>(raison_sociale, div, dep)</Normal Text><br/>
<Normal Text>			</Normal Text><br/>
<Normal Text>			</Normal Text><Instance Variable>@sqlQuery</Instance Variable><Message>.deleteContracts</Message><Normal Text>(</Normal Text><Constant>Config</Constant><Operator>::</Operator><Constant Value>EXPERTISE</Constant Value><Normal Text>,listeContratsExp) </Normal Text><br/>
<Normal Text>			</Normal Text><Instance Variable>@sqlQuery</Instance Variable><Message>.deleteContracts</Message><Normal Text>(</Normal Text><Constant>Config</Constant><Operator>::</Operator><Constant Value>SUPPORT</Constant Value><Normal Text>,listeContratsSup)</Normal Text><br/>
<Normal Text>			</Normal Text><Instance Variable>@sqlQuery</Instance Variable><Message>.deleteContracts</Message><Normal Text>(</Normal Text><Constant>Config</Constant><Operator>::</Operator><Constant Value>PRODUIT</Constant Value><Normal Text>,listeContratsProd)</Normal Text><br/>
<Normal Text>			</Normal Text><Instance Variable>@sqlQuery</Instance Variable><Message>.deletePropositions</Message><Normal Text>(</Normal Text><Constant>Config</Constant><Operator>::</Operator><Constant Value>EXPERTISE</Constant Value><Normal Text>,listePropositionsExp)</Normal Text><br/>
<Normal Text>			</Normal Text><Instance Variable>@sqlQuery</Instance Variable><Message>.deletePropositions</Message><Normal Text>(</Normal Text><Constant>Config</Constant><Operator>::</Operator><Constant Value>SUPPORT</Constant Value><Normal Text>,listePropositionsSup)</Normal Text><br/>
<Normal Text>		</Normal Text><Keyword>else</Keyword><br/>
<Normal Text>			</Normal Text><Kernel methods>puts</Kernel methods><Normal Text> </Normal Text><String>"SqlQuery wasn't created : database update cannot be performed"</String><br/>
<Normal Text>		</Normal Text><Keyword>end</Keyword><br/>
<Normal Text>		</Normal Text><Instance Variable>@clients</Instance Variable><Message>.delClient</Message><Normal Text>(raison_sociale,div,dep)</Normal Text><br/>
<Normal Text>	</Normal Text><br/>
<Normal Text>		</Normal Text><Instance Variable>@contratsExpertise</Instance Variable><Message>.deleteContracts</Message><Normal Text>(listeContratsExp)</Normal Text><br/>
<Normal Text>		</Normal Text><Instance Variable>@contratsSupport</Instance Variable><Message>.deleteContracts</Message><Normal Text>(listeContratsSup)</Normal Text><br/>
<Normal Text>		</Normal Text><Instance Variable>@contratsProduits</Instance Variable><Message>.deleteContracts</Message><Normal Text>(listeContratsProd)</Normal Text><br/>
<Normal Text>		</Normal Text><Instance Variable>@propositionsExpertise</Instance Variable><Message>.deletePropositions</Message><Normal Text>(listePropositionsExp)</Normal Text><br/>
<Normal Text>		</Normal Text><Instance Variable>@propositionsSupport</Instance Variable><Message>.deletePropositions</Message><Normal Text>(listePropositionsSup)</Normal Text><br/>
<Normal Text>	</Normal Text><Keyword>end</Keyword><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Normal Text>  </Normal Text><Comment># Mixin module for HTML version 3 generation methods.</Comment><br/>
<Normal Text>  </Normal Text><Keyword>module</Keyword><Normal Text> </Normal Text><Constant>Html3</Constant><Normal Text> </Normal Text><Comment># :nodoc:</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text>    </Normal Text><Comment># The DOCTYPE declaration for this version of HTML</Comment><br/>
<Normal Text>    </Normal Text><Keyword>def</Keyword><Normal Text> doctype</Normal Text><br/>
<GDL input>      %|</GDL input><String><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"></String><GDL input>|</GDL input><br/>
<Normal Text>    </Normal Text><Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Normal Text>    </Normal Text><Comment># Initialise the HTML generation methods for this version.</Comment><br/>
<Normal Text>    </Normal Text><Keyword>def</Keyword><Normal Text> element_init</Normal Text><br/>
<Normal Text>      </Normal Text><Module mixin methods>extend</Module mixin methods><Normal Text> </Normal Text><Constant>TagMaker</Constant><br/>
<Normal Text>      methods </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>""</String><br/>
<Normal Text>      </Normal Text><Comment># - -</Comment><br/>
<Normal Text>      </Normal Text><Keyword>for</Keyword><Normal Text> element </Normal Text><Keyword>in</Keyword><GDL input> %w[</GDL input><String> A TT I B U STRIKE BIG SMALL SUB SUP EM STRONG</String><br/>
<String>          DFN CODE SAMP KBD VAR CITE FONT ADDRESS DIV center MAP</String><br/>
<String>          APPLET PRE XMP LISTING DL OL UL DIR MENU SELECT table TITLE</String><br/>
<String>          STYLE SCRIPT H1 H2 H3 H4 H5 H6 TEXTAREA FORM BLOCKQUOTE</String><br/>
<String>          CAPTION </String><GDL input>]</GDL input><br/>
<Normal Text>        methods </Normal Text><Operator>+= <<-</Operator><Keyword>BEGIN</Keyword><Here Document> + nn_element_def(element) + <<-END</Here Document><br/>
<Here Document>          def </Here Document><Substitution>#{</Substitution><Normal Text>element</Normal Text><Message>.downcase</Message><Substitution>}</Substitution><Here Document>(attributes = {})</Here Document><br/>
<Here Document>        </Here Document><Keyword>BEGIN</Keyword><br/>
<Normal Text>          </Normal Text><Keyword>end</Keyword><br/>
<Normal Text>        </Normal Text><Keyword>END</Keyword><br/>
<Normal Text>      </Normal Text><Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Normal Text>      </Normal Text><Comment># - O EMPTY</Comment><br/>
<Normal Text>      </Normal Text><Keyword>for</Keyword><Normal Text> element </Normal Text><Keyword>in</Keyword><GDL input> %w[</GDL input><String> IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT</String><br/>
<String>          ISINDEX META </String><GDL input>]</GDL input><br/>
<Normal Text>        methods </Normal Text><Operator>+= <<-</Operator><Keyword>BEGIN</Keyword><Here Document> + nOE_element_def(element) + <<-END</Here Document><br/>
<Here Document>          def </Here Document><Substitution>#{</Substitution><Normal Text>element</Normal Text><Message>.downcase</Message><Substitution>}</Substitution><Here Document>(attributes = {})</Here Document><br/>
<Here Document>        </Here Document><Keyword>BEGIN</Keyword><br/>
<Normal Text>          </Normal Text><Keyword>end</Keyword><br/>
<Normal Text>        </Normal Text><Keyword>END</Keyword><br/>
<Normal Text>      </Normal Text><Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Normal Text>      </Normal Text><Comment># O O or - O</Comment><br/>
<Normal Text>      </Normal Text><Keyword>for</Keyword><Normal Text> element </Normal Text><Keyword>in</Keyword><GDL input> %w[</GDL input><String> HTML HEAD BODY P PLAINTEXT DT DD LI OPTION tr</String><br/>
<String>          th td </String><GDL input>]</GDL input><br/>
<Normal Text>        methods </Normal Text><Operator>+= <<-</Operator><Keyword>BEGIN</Keyword><Here Document> + nO_element_def(element) + <<-END</Here Document><br/>
<Here Document>          def </Here Document><Substitution>#{</Substitution><Normal Text>element</Normal Text><Message>.downcase</Message><Substitution>}</Substitution><Here Document>(attributes = {})</Here Document><br/>
<Here Document>        </Here Document><Keyword>BEGIN</Keyword><br/>
<Normal Text>          </Normal Text><Keyword>end</Keyword><br/>
<Normal Text>        </Normal Text><Keyword>END</Keyword><br/>
<Normal Text>      </Normal Text><Keyword>end</Keyword><br/>
<Normal Text>      </Normal Text><Kernel methods>eval</Kernel methods><Normal Text>(methods)</Normal Text><br/>
<Normal Text>    </Normal Text><Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Normal Text>  </Normal Text><Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Comment># following snippet from Webrick's log.rb</Comment><br/>
<Comment># notice the erronous handling of the query method is_a?</Comment><br/>
<Keyword>def</Keyword><Normal Text> </Normal Text><Kernel methods>format</Kernel methods><Normal Text>(arg)</Normal Text><br/>
<Normal Text>     str </Normal Text><Keyword>= if</Keyword><Normal Text> arg</Normal Text><Message>.is_a?</Message><Normal Text>(</Normal Text><Constant>Exception</Constant><Normal Text>)</Normal Text><br/>
<Normal Text>        </Normal Text><String>"</String><Substitution>#{</Substitution><Normal Text>arg</Normal Text><Message>.class</Message><Substitution>}</Substitution><String>: </String><Substitution>#{</Substitution><Normal Text>arg</Normal Text><Message>.message</Message><Substitution>}</Substitution><String>\n\t"</String><Normal Text> </Normal Text><Operator><<</Operator><br/>
<Normal Text>        arg</Normal Text><Message>.backtrace.join</Message><Normal Text>(</Normal Text><String>"\n\t"</String><Normal Text>) </Normal Text><Operator><<</Operator><Normal Text> </Normal Text><String>"\n"</String><br/>
<Normal Text>      </Normal Text><Keyword>elsif</Keyword><Normal Text> arg</Normal Text><Message>.respond_to?</Message><Normal Text>(</Normal Text><Symbol>:to_str</Symbol><Normal Text>)</Normal Text><br/>
<Normal Text>        arg</Normal Text><Message>.to_str</Message><br/>
<Normal Text>      </Normal Text><Keyword>else</Keyword><br/>
<Normal Text>        arg</Normal Text><Message>.inspect</Message><br/>
<Normal Text>      </Normal Text><Keyword>end</Keyword><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Comment># following snippet from Webrick's httputils.rb</Comment><br/>
<Comment># Splitting regexps on several lines might be bad form,</Comment><br/>
<Comment># but not illegal in Ruby. </Comment><br/>
<Comment># This should probably be supported in the highlighting</Comment><br/>
<Keyword>def</Keyword><Normal Text> split_header_value(str)</Normal Text><br/>
<Normal Text>      str</Normal Text><Message>.scan</Message><Normal Text>(</Normal Text><Regular Expression>/((?:"(?:\\.|[^"])+?"|[^",]+)+)</Regular Expression><br/>
<Regular Expression>                (?:,\s*|\Z)/xn</Regular Expression><Normal Text>)</Normal Text><Message>.collect</Message><Operator>{|</Operator><Normal Text>v</Normal Text><Operator>|</Operator><Normal Text> v</Normal Text><Delimiter>[</Delimiter><Dec>0</Dec><Delimiter>]</Delimiter><Normal Text> </Normal Text><Operator>}</Operator><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Comment># snippet from Net::Telnet</Comment><br/>
<Normal Text>string</Normal Text><Message>.gsub</Message><Normal Text>(</Normal Text><Regular Expression>/</Regular Expression><Substitution>#{</Substitution><Global Constant>IAC</Global Constant><Substitution>}</Substitution><Regular Expression>(</Regular Expression><br/>
<Regular Expression>                   [</Regular Expression><Substitution>#{</Substitution><Global Constant>IAC</Global Constant><Substitution>}#{</Substitution><Global Constant>AO</Global Constant><Substitution>}#{</Substitution><Global Constant>AYT</Global Constant><Substitution>}#{</Substitution><Global Constant>DM</Global Constant><Substitution>}#{</Substitution><Global Constant>IP</Global Constant><Substitution>}#{</Substitution><Global Constant>NOP</Global Constant><Substitution>}</Substitution><Regular Expression>]|</Regular Expression><br/>
<Regular Expression>                   [</Regular Expression><Substitution>#{</Substitution><Global Constant>DO</Global Constant><Substitution>}#{</Substitution><Global Constant>DONT</Global Constant><Substitution>}#{</Substitution><Global Constant>WILL</Global Constant><Substitution>}#{</Substitution><Global Constant>WONT</Global Constant><Substitution>}</Substitution><Regular Expression>]</Regular Expression><br/>
<Regular Expression>                     [</Regular Expression><Substitution>#{</Substitution><Global Constant>OPT_BINARY</Global Constant><Substitution>}</Substitution><Regular Expression>-</Regular Expression><Substitution>#{</Substitution><Global Constant>OPT_NEW_ENVIRON</Global Constant><Substitution>}#{</Substitution><Global Constant>OPT_EXOPL</Global Constant><Substitution>}</Substitution><Regular Expression>]|</Regular Expression><br/>
<Regular Expression>                   </Regular Expression><Substitution>#{</Substitution><Global Constant>SB</Global Constant><Substitution>}</Substitution><Regular Expression>[^</Regular Expression><Substitution>#{</Substitution><Global Constant>IAC</Global Constant><Substitution>}</Substitution><Regular Expression>]*</Regular Expression><Substitution>#{</Substitution><Global Constant>IAC</Global Constant><Substitution>}#{</Substitution><Global Constant>SE</Global Constant><Substitution>}</Substitution><br/>
<Regular Expression>                 )/xno</Regular Expression><Normal Text>)</Normal Text><br/>
<Normal Text></Normal Text><br/>
<Comment># following snippet from Webrick's httpresponse.rb</Comment><br/>
<Comment># the HEREDOC is not recognized as such</Comment><br/>
<Instance Variable>@body</Instance Variable><Normal Text> </Normal Text><Operator><< <<-</Operator><Keyword>_end_of_html_</Keyword><br/>
<Here Document><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"></Here Document><br/>
<Here Document><HTML></Here Document><br/>
<Here Document>  <HEAD><TITLE></Here Document><Substitution>#{</Substitution><Constant>HTMLUtils</Constant><Operator>::</Operator><Message>escape</Message><Normal Text>(</Normal Text><Instance Variable>@reason_phrase</Instance Variable><Normal Text>)</Normal Text><Substitution>}</Substitution><Here Document></TITLE></HEAD></Here Document><br/>
<Here Document>  <BODY></Here Document><br/>
<Here Document>    <H1></Here Document><Substitution>#{</Substitution><Constant>HTMLUtils</Constant><Operator>::</Operator><Message>escape</Message><Normal Text>(</Normal Text><Instance Variable>@reason_phrase</Instance Variable><Normal Text>)</Normal Text><Substitution>}</Substitution><Here Document></H1></Here Document><br/>
<Here Document>    </Here Document><Substitution>#{</Substitution><Constant>HTMLUtils</Constant><Operator>::</Operator><Message>escape</Message><Normal Text>(ex</Normal Text><Message>.message</Message><Normal Text>)</Normal Text><Substitution>}</Substitution><br/>
<Here Document>    <HR></Here Document><br/>
<Keyword>_end_of_html_</Keyword><br/>
<Normal Text></Normal Text><br/>
<Normal Text></Normal Text><br/>
<Comment># snippet from Webrick's httpproxy.rb</Comment><br/>
<Comment># here we should make sure that the symbol definition ':' doesn't override</Comment><br/>
<Comment># the module operator '::'</Comment><br/>
<Constant>Net</Constant><Operator>::</Operator><Constant Value>HTTP</Constant Value><Operator>::</Operator><Message>version_1_2</Message><Normal Text> </Normal Text><Keyword>if</Keyword><Normal Text> </Normal Text><Global Constant>RUBY_VERSION</Global Constant><Normal Text> </Normal Text><Operator><</Operator><Normal Text> </Normal Text><String>"1.7"</String><br/>
<Normal Text></Normal Text><br/>
<Comment># snippet from Webrick's cookie.rb</Comment><br/>
<Comment># the beginning of the regexp is erronously highlighted like an operator</Comment><br/>
<Normal Text>key, val </Normal Text><Operator>=</Operator><Normal Text> x</Normal Text><Message>.split</Message><Normal Text>(</Normal Text><Regular Expression>/=/</Regular Expression><Normal Text>,</Normal Text><Dec>2</Dec><Normal Text>)</Normal Text><br/>
<Normal Text></Normal Text><br/>
<Comment># the following are division operators</Comment><br/>
<Comment># it's a bit tricky to keep the operator apart from the regexp</Comment><br/>
<Normal Text>result </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Dec>8</Dec><Normal Text> </Normal Text><Operator>/</Operator><Normal Text> </Normal Text><Dec>4</Dec><br/>
<Normal Text>result </Normal Text><Operator>/= </Operator><Normal Text>divisor</Normal Text><br/>
<Normal Text></Normal Text><br/>
<Comment># 2008-06-01 regexp and division operator syntax has been fixed:</Comment><br/>
<Normal Text>result </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Dec>8</Dec><Operator>/</Operator><Dec>4</Dec><Normal Text>    </Normal Text><Comment># division</Comment><br/>
<Normal Text>result </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Dec>8</Dec><Operator>/</Operator><Normal Text>foo  </Normal Text><Comment># division</Comment><br/>
<Normal Text>result </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Regular Expression>/8/</Regular Expression><Normal Text>    </Normal Text><Comment># regexp</Comment><br/>
<Normal Text>result </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Dec>8</Dec><Operator>/</Operator><Regular Expression>/4/</Regular Expression><Normal Text>  </Normal Text><Comment># division and regexp</Comment><br/>
<Normal Text></Normal Text><br/>
<Dec>10</Dec><Operator>/</Operator><Dec>10</Dec><Normal Text>           </Normal Text><Comment># division</Comment><br/>
<Dec>10</Dec><Operator>/</Operator><Normal Text> </Normal Text><Dec>10</Dec><Normal Text>          </Normal Text><Comment># division</Comment><br/>
<Dec>10</Dec><Normal Text> </Normal Text><Operator>/</Operator><Dec>10</Dec><Normal Text>          </Normal Text><Comment># division</Comment><br/>
<Dec>10</Dec><Normal Text> </Normal Text><Operator>/</Operator><Normal Text> </Normal Text><Dec>10</Dec><Normal Text>         </Normal Text><Comment># division</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text>foo</Normal Text><Operator>/</Operator><Dec>10</Dec><Normal Text>          </Normal Text><Comment># division</Comment><br/>
<Normal Text>foo</Normal Text><Operator>/</Operator><Normal Text> </Normal Text><Dec>10</Dec><Normal Text>         </Normal Text><Comment># division</Comment><br/>
<Normal Text>foo </Normal Text><Regular Expression>/10/</Regular Expression><Normal Text>        </Normal Text><Comment># regexp</Comment><br/>
<Normal Text>foo </Normal Text><Operator>/</Operator><Normal Text> </Normal Text><Dec>10</Dec><Normal Text>        </Normal Text><Comment># division</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text>foo</Normal Text><Operator>/</Operator><Dec>10</Dec><Operator>/</Operator><Dec>10</Dec><Normal Text>       </Normal Text><Comment># both division</Comment><br/>
<Normal Text>total</Normal Text><Operator>/</Operator><Normal Text>count</Normal Text><Operator>/</Operator><Dec>2</Dec><Normal Text>   </Normal Text><Comment># both division</Comment><br/>
<Normal Text>total</Normal Text><Operator>/</Operator><Normal Text>(count</Normal Text><Operator>/</Operator><Dec>2</Dec><Normal Text>) </Normal Text><Comment># both division</Comment><br/>
<Normal Text></Normal Text><br/>
<Instance Variable>@foo</Instance Variable><Operator>/</Operator><Dec>10</Dec><Normal Text>         </Normal Text><Comment># division</Comment><br/>
<Instance Variable>@foo</Instance Variable><Normal Text> </Normal Text><Operator>/</Operator><Dec>10</Dec><Normal Text>        </Normal Text><Comment># division</Comment><br/>
<Normal Text></Normal Text><br/>
<String>"hello"</String><Operator>/</Operator><Dec>10</Dec><Normal Text>      </Normal Text><Comment># division</Comment><br/>
<String>"hello"</String><Normal Text> </Normal Text><Operator>/</Operator><Normal Text> </Normal Text><Dec>10</Dec><Normal Text>    </Normal Text><Comment># division</Comment><br/>
<Normal Text></Normal Text><br/>
<Regular Expression>/regexp/</Regular Expression><Operator>/</Operator><Dec>10</Dec><Normal Text>     </Normal Text><Comment># division</Comment><br/>
<Regular Expression>/regexp/</Regular Expression><Normal Text> </Normal Text><Operator>/</Operator><Normal Text> </Normal Text><Dec>10</Dec><Normal Text>   </Normal Text><Comment># division</Comment><br/>
<Normal Text></Normal Text><br/>
<Constant>Math</Constant><Operator>::</Operator><Constant Value>PI</Constant Value><Operator>/</Operator><Dec>10</Dec><Normal Text>     </Normal Text><Comment># division</Comment><br/>
<Constant>Math</Constant><Operator>::</Operator><Message>foo</Message><Normal Text> </Normal Text><Regular Expression>/rx/</Regular Expression><Normal Text>  </Normal Text><Comment># regexp</Comment><br/>
<Normal Text></Normal Text><br/>
<Comment># 2008-06-05 similar fix for modulo operator:</Comment><br/>
<Normal Text></Normal Text><br/>
<Dec>10</Dec><Operator>%</Operator><Dec>4</Dec><Normal Text>            </Normal Text><Comment># modulo</Comment><br/>
<Dec>10</Dec><Normal Text> </Normal Text><Operator>%</Operator><Dec>4</Dec><Normal Text>           </Normal Text><Comment># modulo</Comment><br/>
<Dec>10</Dec><Operator>%</Operator><Normal Text> </Normal Text><Dec>4</Dec><Normal Text>           </Normal Text><Comment># modulo</Comment><br/>
<Dec>10</Dec><Normal Text> </Normal Text><Operator>%</Operator><Normal Text> </Normal Text><Dec>4</Dec><Normal Text>          </Normal Text><Comment># modulo</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text>foo</Normal Text><Operator>%</Operator><Dec>4</Dec><Normal Text>           </Normal Text><Comment># modulo</Comment><br/>
<Comment># foo %4          # illegal %string</Comment><br/>
<Normal Text>foo</Normal Text><Operator>%</Operator><Normal Text> </Normal Text><Dec>4</Dec><Normal Text>          </Normal Text><Comment># modulo</Comment><br/>
<Normal Text>foo </Normal Text><Operator>%</Operator><Normal Text> </Normal Text><Dec>4</Dec><Normal Text>         </Normal Text><Comment># modulo</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text>foo </Normal Text><Operator>%</Operator><Normal Text> (</Normal Text><Dec>4</Dec><Normal Text>)       </Normal Text><Comment># modulo</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text>foo </Normal Text><GDL input>%(</GDL input><String>4</String><GDL input>)</GDL input><Normal Text>        </Normal Text><Comment># %string</Comment><br/>
<Normal Text>foo </Normal Text><GDL input>%q(</GDL input><Raw String>4</Raw String><GDL input>)</GDL input><Normal Text>       </Normal Text><Comment># %string</Comment><br/>
<Normal Text>foo </Normal Text><GDL input>%Q(</GDL input><String>4</String><GDL input>)</GDL input><Normal Text>       </Normal Text><Comment># %string</Comment><br/>
<Normal Text>foo </Normal Text><GDL input>%%</GDL input><String>4</String><GDL input>%</GDL input><Normal Text>        </Normal Text><Comment># %string</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text>foo </Normal Text><Operator>=</Operator><GDL input> %|</GDL input><String>blah</String><GDL input>|</GDL input><Normal Text>   </Normal Text><Comment># GDL input</Comment><br/>
<Normal Text>foo </Normal Text><Operator>%</Operator><GDL input> %|</GDL input><String>blah</String><GDL input>|</GDL input><Normal Text>   </Normal Text><Comment># modulo and GDL</Comment><br/>
<Normal Text></Normal Text><br/>
<Comment># mix in any way you want</Comment><br/>
<Normal Text>result </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Dec>10</Dec><Operator>/</Operator><Regular Expression>/regexp/</Regular Expression><Operator>/</Operator><Dec>20</Dec><Operator>/</Operator><Normal Text>foo</Normal Text><Operator>/</Operator><Regular Expression>/regexp/</Regular Expression><Operator>/</Operator><Dec>20</Dec><br/>
<Normal Text></Normal Text><br/>
<Comment># test cases for general delimited input</Comment><br/>
<Comment># quoted strings</Comment><br/>
<GDL input>%Q|</GDL input><String>this is a string</String><GDL input>|</GDL input><br/>
<GDL input>%Q{</GDL input><String>this is a string</String><GDL input>}</GDL input><br/>
<GDL input>%Q(</GDL input><String>this is a string</String><GDL input>)</GDL input><br/>
<GDL input>%Q<</GDL input><String>this is a string</String><GDL input>></GDL input><br/>
<GDL input>%Q[</GDL input><String>this is a string</String><GDL input>]</GDL input><br/>
<Normal Text></Normal Text><br/>
<GDL input>%|</GDL input><String>also a string</String><GDL input>|</GDL input><br/>
<GDL input>%{</GDL input><String>also a string</String><GDL input>}</GDL input><br/>
<GDL input>%(</GDL input><String>also a string</String><GDL input>)</GDL input><br/>
<GDL input>%<</GDL input><String>also a string</String><GDL input>></GDL input><br/>
<GDL input>%[</GDL input><String>also a string</String><GDL input>]</GDL input><br/>
<Normal Text></Normal Text><br/>
<Comment># apostrophed strings</Comment><br/>
<GDL input>%q|</GDL input><Raw String>apostrophed</Raw String><GDL input>|</GDL input><br/>
<GDL input>%q{</GDL input><Raw String>apostrophed</Raw String><GDL input>}</GDL input><br/>
<GDL input>%q(</GDL input><Raw String>apostrophed</Raw String><GDL input>)</GDL input><br/>
<GDL input>%q<</GDL input><Raw String>apostrophed</Raw String><GDL input>></GDL input><br/>
<GDL input>%q[</GDL input><Raw String>apostrophed</Raw String><GDL input>]</GDL input><br/>
<Normal Text></Normal Text><br/>
<Comment># regular expressions</Comment><br/>
<GDL input>%r{</GDL input><Regular Expression>expression</Regular Expression><GDL input>}</GDL input><br/>
<GDL input>%r(</GDL input><Regular Expression>expression</Regular Expression><GDL input>)</GDL input><br/>
<GDL input>%r<</GDL input><Regular Expression>expression</Regular Expression><GDL input>></GDL input><br/>
<GDL input>%r[</GDL input><Regular Expression>expression</Regular Expression><GDL input>]</GDL input><br/>
<GDL input>%r|</GDL input><Regular Expression>expression</Regular Expression><GDL input>|</GDL input><br/>
<Normal Text></Normal Text><br/>
<Comment># shell commands</Comment><br/>
<GDL input>%x{</GDL input><Command>ls -l</Command><GDL input>}</GDL input><br/>
<GDL input>%x(</GDL input><Command>ls -l</Command><GDL input>)</GDL input><br/>
<GDL input>%x<</GDL input><Command>ls -l</Command><GDL input>></GDL input><br/>
<GDL input>%x[</GDL input><Command>ls -l</Command><GDL input>]</GDL input><br/>
<Normal Text></Normal Text><br/>
<Comment># sometimes it's useful to have the command on multiple lines</Comment><br/>
<GDL input>%x{</GDL input><Command>ls -l |</Command><br/>
<Command>grep test </Command><GDL input>}</GDL input><br/>
<Normal Text></Normal Text><br/>
<Comment># alternative syntax</Comment><br/>
<Command>`ls -l`</Command><br/>
<Command>`echo ' '`</Command><br/>
<Normal Text></Normal Text><br/>
<Comment># token array</Comment><br/>
<GDL input>%w{</GDL input><String>one two three</String><GDL input>}</GDL input><br/>
<GDL input>%w(</GDL input><String>one two three</String><GDL input>)</GDL input><br/>
<GDL input>%w<</GDL input><String>one two three</String><GDL input>></GDL input><br/>
<GDL input>%w[</GDL input><String>one two three</String><GDL input>]</GDL input><br/>
<Normal Text></Normal Text><br/>
<Comment># snippet from Net::IMAP</Comment><br/>
<Comment># I object to putting String, Integer and Array into kernel methods.</Comment><br/>
<Comment># While these classes are builtin in Ruby, this is an implementation detail</Comment><br/>
<Comment># that should not be exposed to the user.</Comment><br/>
<Comment># If we want to handle all std-lib classes, fine. But then they should be in their</Comment><br/>
<Comment># own std-lib keyword category.</Comment><br/>
<Normal Text></Normal Text><br/>
<Keyword>def</Keyword><Normal Text> send_data(data)</Normal Text><br/>
<Normal Text>      </Normal Text><Keyword>case</Keyword><Normal Text> data</Normal Text><br/>
<Normal Text>      </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Pseudo variable>nil</Pseudo variable><br/>
<Normal Text>        put_string(</Normal Text><String>"NIL"</String><Normal Text>)</Normal Text><br/>
<Normal Text>      </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Constant>String</Constant><br/>
<Normal Text>        send_string_data(data)</Normal Text><br/>
<Normal Text>      </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Constant>Integer</Constant><br/>
<Normal Text>        send_number_data(data)</Normal Text><br/>
<Normal Text>      </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Constant>Array</Constant><br/>
<Normal Text>        send_list_data(data)</Normal Text><br/>
<Normal Text>      </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Constant>Time</Constant><br/>
<Normal Text>        send_time_data(data)</Normal Text><br/>
<Normal Text>      </Normal Text><Keyword>when</Keyword><Normal Text> </Normal Text><Constant>Symbol</Constant><br/>
<Normal Text>        send_symbol_data(data)</Normal Text><br/>
<Normal Text>      </Normal Text><Keyword>else</Keyword><br/>
<Normal Text>        data</Normal Text><Message>.send_data</Message><Normal Text>(</Normal Text><Pseudo variable>self</Pseudo variable><Normal Text>)</Normal Text><br/>
<Normal Text>      </Normal Text><Keyword>end</Keyword><br/>
<Keyword>end</Keyword><br/>
<Normal Text></Normal Text><br/>
<Comment># snippet from Net::POP</Comment><br/>
<Comment># class names can have numbers in them as long as they don't begin with numbers</Comment><br/>
<Comment># Ruby doesn't internally really make much of a difference between a class name and a constant</Comment><br/>
<Normal Text></Normal Text><br/>
<Comment># class aliases</Comment><br/>
<Normal Text>  </Normal Text><Global Constant>POP</Global Constant><Normal Text> </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Global Constant>POP3</Global Constant><br/>
<Normal Text>  </Normal Text><Constant>POPSession</Constant><Normal Text>  </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Global Constant>POP3</Global Constant><br/>
<Normal Text>  </Normal Text><Constant>POP3Session</Constant><Normal Text> </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Global Constant>POP3</Global Constant><br/>
<Normal Text></Normal Text><br/>
<Comment># "member access"</Comment><br/>
<Global Constant>POP</Global Constant><Operator>::</Operator><Constant>Session</Constant><Member>.</Member><Constant Value>COUNT</Constant Value><Message>.attribute.calc_with</Message><Normal Text>(</Normal Text><Dec>2</Dec><Normal Text>)</Normal Text><Operator>{</Operator><Normal Text> </Normal Text><Operator>|</Operator><Normal Text>arg</Normal Text><Operator>|</Operator><Normal Text> </Normal Text><Kernel methods>puts</Kernel methods><Normal Text> arg </Normal Text><Operator>}</Operator><br/>
<Normal Text></Normal Text><br/>
<Comment># snippet from Net::SMTP</Comment><br/>
<Comment># This breaks the code folding. I think we would need to</Comment><br/>
<Comment># handle the '\' that continues the statement to the next line</Comment><br/>
<Comment># in some way to make these kind of things not break something.</Comment><br/>
<Kernel methods>raise</Kernel methods><Normal Text> </Normal Text><Constant>ArgumentError</Constant><Normal Text>, </Normal Text><Raw String>'both user and secret are required'</Raw String><Normal Text>\</Normal Text><br/>
<Normal Text>                      </Normal Text><Keyword>unless</Keyword><Normal Text> user </Normal Text><Keyword>and</Keyword><Normal Text> secret</Normal Text><br/>
<Normal Text> </Normal Text><br/>
<Comment># string escapes must detect escaping the escape char</Comment><br/>
<Normal Text>str </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>"\\"</String><br/>
<Normal Text>str </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>"\\\\"</String><br/>
<Comment># this is not part of the string</Comment><br/>
<GDL input>%x{</GDL input><Command>echo \\\}\\</Command><GDL input>}</GDL input><Normal Text>	</Normal Text><Comment># prints \}\</Comment><br/>
<Comment># this is not part of the command</Comment><br/>
<Normal Text></Normal Text><br/>
<Comment># these are all symbols</Comment><br/>
<Symbol>:abc</Symbol><br/>
<Symbol>:abc!</Symbol><br/>
<Symbol>:abc?</Symbol><br/>
<Symbol>:abc=</Symbol><br/>
<Symbol>:[]</Symbol><br/>
<Symbol>:[]=</Symbol><br/>
<Symbol>:@abc</Symbol><br/>
<Symbol>:@@abc</Symbol><br/>
<Symbol>:$abc</Symbol><br/>
