Coverage for core\test_leoColorizer.py: 100%

141 statements  

« prev     ^ index     » next       coverage.py v6.4, created at 2022-05-24 10:21 -0500

1# -*- coding: utf-8 -*- 

2#@+leo-ver=5-thin 

3#@+node:ekr.20210905151702.1: * @file ../unittests/core/test_leoColorizer.py 

4#@@first 

5"""Tests of leoColorizer.py""" 

6 

7import textwrap 

8from leo.core import leoGlobals as g 

9from leo.core.leoTest2 import LeoUnitTest 

10import leo.core.leoColorizer as leoColorizer 

11 

12#@+others 

13#@+node:ekr.20210905151702.2: ** class TestColorizer(LeoUnitTest) 

14class TestColorizer(LeoUnitTest): 

15 """Test cases for leoColorizer.py""" 

16 #@+others 

17 #@+node:ekr.20210905161336.1: *3* TestColorizer.color 

18 def color(self, language_name, text): 

19 """Run the test by colorizing a node with the given text.""" 

20 c = self.c 

21 c.p.b = text.replace('> >', '>>').replace('< <', '<<') 

22 c.recolor_now() 

23 #@+node:ekr.20210905170507.2: *3* TestColorizer.test__comment_after_language_plain 

24 def test__comment_after_language_plain(self): 

25 text = textwrap.dedent("""\ 

26 @comment # /* */ 

27 

28 This is plain text. 

29 

30 # This is a comment. 

31 

32 More plain text. 

33 

34 /* A block comment 

35 continues */ 

36 

37 More plain text. 

38 """) 

39 self.color('plain', text) 

40 #@+node:ekr.20210905170507.3: *3* TestColorizer.test_bc_scanLanguageDirectives 

41 def test_bc_scanLanguageDirectives(self): 

42 c = self.c 

43 c.target_language = 'python' # Set the default. 

44 widget = c.frame.body.widget 

45 x = leoColorizer.JEditColorizer(c, widget) 

46 child = c.rootPosition().insertAsLastChild() 

47 grand = child.insertAsLastChild() 

48 language_table = ( 

49 ('python', '@language rest\n@language python\n', ''), 

50 ('rest', '@language rest', ''), 

51 ('python', '@language rest\n@language python\n', ''), 

52 ) 

53 for i, data in enumerate(language_table): 

54 language, child_s, grand_s = data 

55 child.b = child_s 

56 grand.b = grand_s 

57 got = x.scanLanguageDirectives(grand) 

58 self.assertEqual(got, language, msg=f"i: {i} {language}") 

59 #@+node:ekr.20210905170507.4: *3* TestColorizer.test_bc_useSyntaxColoring 

60 def test_bc_useSyntaxColoring(self): 

61 c = self.c 

62 widget = c.frame.body.widget 

63 x = leoColorizer.JEditColorizer(c, widget) 

64 child = c.rootPosition().insertAsLastChild() 

65 grand = child.insertAsLastChild() 

66 language_table = [ 

67 (True, '', ''), 

68 # Ambiguous parent. 

69 (True, '@color \n@nocolor\n', ''), 

70 (True, '@nocolor \n@color\n', ''), 

71 # Unambiguous parent. 

72 (True, '@nocolor-node', ''), # Does not apply to descendants. 

73 (False, '@nocolor', ''), 

74 (False, '@killcolor', ''), 

75 # 

76 # Note: the following tests don't matter because 

77 # jedit.recolor ignores the self.enabled flag. 

78 # As a result, *all* color directives, including @nocolor-node, 

79 # Apply from the directive to the next color directive. 

80 # 

81 # Unambiguous child. 

82 (False, '', '@killcolor\n'), 

83 (True, '', '@color\n'), 

84 # @nocolor-node rules node. 

85 (False, '', '@nocolor-node\n'), 

86 (False, '', '@color\n@nocolor-node\n'), 

87 # Ambiguous node: defer to ancestors. 

88 (True, '', '@color\n@nocolor'), 

89 (True, '', '@nocolor\n@color'), 

90 ] 

91 language = 'python' 

92 for i, data in enumerate(language_table): 

93 expected, child_s, grand_s = data 

94 child.b = child_s 

95 grand.b = grand_s 

96 got = x.useSyntaxColoring(grand) 

97 self.assertEqual(got, expected, msg=f"i: {i} {language}") 

98 #@+node:ekr.20210905170507.5: *3* TestColorizer.test_colorizer_Actionscript 

99 def test_colorizer_Actionscript(self): 

100 text = textwrap.dedent("""\ 

101 break 

102 call, continue 

103 delete, do 

104 else 

105 false, for, function 

106 goto 

107 if, in 

108 new, null 

109 return 

110 true, typeof 

111 undefined 

112 var, void, while, with 

113 #include 

114 catch, constructor 

115 prototype 

116 this, try 

117 _parent, _root, __proto__ 

118 // Jeeze hasn't anyone ever heard of namespaces?? 

119 ASnative, abs, acos, appendChild, asfunction, asin, atan, atan2, attachMovie, attachSound, attributes 

120 BACKSPACE 

121 CAPSLOCK, CONTROL, ceil, charAt, charCodeAt, childNodes, chr, cloneNode, close, concat, connect, cos, createElement, createTextNode 

122 DELETEKEY, DOWN, docTypeDecl, duplicateMovieClip 

123 END, ENTER, ESCAPE, enterFrame, entry, equal, eval, evaluate, exp 

124 firstChild, floor, fromCharCode, fscommand, getAscii 

125 getBeginIndex, getBounds, getBytesLoaded, getBytesTotal, getCaretIndex, getCode, getDate, getDay, getEndIndex, getFocus, getFullYear, getHours, getMilliseconds, getMinutes, getMonth, getPan, getProperty, getRGB, getSeconds, getTime, getTimer, getTimezoneOffset, getTransform, getURL, getUTCDate, getUTCDay, getUTCFullYear, getUTCHours, getUTCMilliseconds, getUTCMinutes, getUTCMonth, getUTCSeconds, getVersion, getVolume, getYear, globalToLocal, gotoAndPlay, gotoAndStop 

126 HOME, haschildNodes, hide, hitTest 

127 INSERT, Infinity, ifFrameLoaded, ignoreWhite, indexOf, insertBefore, int, isDown, isFinite, isNaN, isToggled 

128 join 

129 keycode, keyDown, keyUp 

130 LEFT, LN10, LN2, LOG10E, LOG2E, lastChild, lastIndexOf, length, load, loaded, loadMovie, loadMovieNum, loadVariables, loadVariablesNum, localToGlobal, log 

131 MAX_VALUE, MIN_VALUE, max, maxscroll, mbchr, mblength, mbord, mbsubstring, min, 

132 NEGATIVE_INFINITY, NaN, newline, nextFrame, nextScene, nextSibling, nodeName, nodeType, nodeValue 

133 on, onClipEvent, onClose, onConnect, onData, onLoad, onXML, ord 

134 PGDN, PGUP, PI, POSITIVE_INFINITY, parentNode, parseFloat, parseInt, parseXML, play, pop, pow, press, prevFrame, previousSibling, prevScene, print, printAsBitmap, printAsBitmapNum, printNum, push 

135 RIGHT, random, release, removeMovieClip, removeNode, reverse, round 

136 SPACE, SQRT1_2, SQRT2, scroll, send, sendAndLoad, set, setDate, setFocus, setFullYear, setHours, setMilliseconds, setMinutes, setMonth, setPan, setProperty, setRGB, setSeconds, setSelection, setTime, setTransform, setUTCDate, setUTCFullYear, setUTCHours, setUTCMilliseconds, setUTCMinutes, setUTCMonth, setUTCSeconds, setVolume, setYear, shift, show, sin, slice, sort, start, startDrag, status, stop, stopAllSounds, stopDrag, substr, substring, swapDepths, splice, split, sqrt 

137 TAB, tan, targetPath, tellTarget, toggleHighQuality, toLowerCase, toString, toUpperCase, trace 

138 UP, UTC, unescape, unloadMovie, unLoadMovieNum, unshift, updateAfterEvent 

139 valueOf 

140 xmlDecl, _alpha 

141 _currentframe 

142 _droptarget 

143 _focusrect, _framesloaded 

144 _height, _highquality 

145 _name 

146 _quality 

147 _rotation 

148 _soundbuftime 

149 _target, _totalframes 

150 _url 

151 _visible 

152 _width 

153 _x, _xmouse, _xscale 

154 _y, _ymouse, _yscale 

155 and, add, eq, ge, gt, le, lt, ne, not, or, Array, Boolean, Color, Date, Key, Math, MovieClip, Mouse, Number, Object, Selection, Sound, String, XML, XMLSocket 

156 """) 

157 self.color('actionscript', text) 

158 #@+node:ekr.20210905170507.6: *3* TestColorizer.test_colorizer_C 

159 def test_colorizer_C(self): 

160 text = textwrap.dedent("""\ 

161 @comment /* */ 

162 

163 @ 

164 @c 

165 

166 #define WIPEOUT 0 /* 

167 * Causes database card number & flags to be set to zero. 

168 * This is so I don't need an infinite supply of cards! 

169 */ 

170 // Not colored (because of @language /* */) 

171 #include "equ.h" 

172 #include "cmn.h" 

173 #include "ramdef.h" 

174 #include "eeprom.h" 

175 #include <hpc_ram.h> 

176 #include <rlydef.h> 

177 """) 

178 self.color('c', text) 

179 #@+node:ekr.20210905170507.7: *3* TestColorizer.test_colorizer_C_ 

180 def test_colorizer_C_(self): 

181 text = textwrap.dedent("""\ 

182 @ comment 

183 @c 

184 

185 /* block 

186 comment */ 

187 

188 // test 

189 

190 id // not a keyword 

191 

192 abstract as 

193 base bool break byte 

194 case catch char checked class const continue 

195 decimal default delegate do double 

196 else enum event explicit extern 

197 false finally fixed float for foreach 

198 get goto 

199 if implicit in int interface internal is 

200 lock long 

201 namespace new null 

202 object operator out override 

203 params partial private protected public 

204 readonly ref return 

205 sbyte sealed set short sizeof stackalloc 

206 static string struct switch 

207 this throw true try typeof 

208 uint ulong unchecked unsafe ushort using 

209 value virtual void volatile 

210 where while 

211 yield 

212 """) 

213 self.color('csharp', text) 

214 #@+node:ekr.20210905170507.8: *3* TestColorizer.test_colorizer_css 

215 def test_colorizer_css(self): 

216 text = textwrap.dedent("""\ 

217 /* New in 4.2. */ 

218 

219 /*html tags*/ 

220 address, applet, area, a, base, basefont, 

221 big, blockquote, body, br, b, caption, center, 

222 cite, code, dd, dfn, dir, div, dl, dt, em, font, 

223 form, h1, h2, h3, h4, h5, h6, head, hr, html, img, 

224 input, isindex, i, kbd, link, li, link, map, menu, 

225 meta, ol, option, param, pre, p, samp, 

226 select, small, span, strike, strong, style, sub, sup, 

227 table, td, textarea, th, title, tr, tt, ul, u, var, 

228 /*units*/ 

229 mm, cm, in, pt, pc, em, ex, px, 

230 /*colors*/ 

231 aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, yellow, white, 

232 /*important directive*/ 

233 !important, 

234 /*font rules*/ 

235 font, font-family, font-style, font-variant, font-weight, font-size, 

236 /*font values*/ 

237 cursive, fantasy, monospace, normal, italic, oblique, small-caps, 

238 bold, bolder, lighter, medium, larger, smaller, 

239 serif, sans-serif, 

240 /*background rules*/ 

241 background, background-color, background-image, background-repeat, background-attachment, background-position, 

242 /*background values*/ 

243 contained, none, top, center, bottom, left, right, scroll, fixed, 

244 repeat, repeat-x, repeat-y, no-repeat, 

245 /*text rules*/ 

246 word-spacing, letter-spacing, text-decoration, vertical-align, text-transform, text-align, text-indent, text-transform, text-shadow, unicode-bidi, line-height, 

247 /*text values*/ 

248 normal, none, underline, overline, blink, sub, super, middle, top, text-top, text-bottom, 

249 capitalize, uppercase, lowercase, none, left, right, center, justify, 

250 line-through, 

251 /*box rules*/ 

252 margin, margin-top, margin-bottom, margin-left, margin-right, 

253 margin, padding-top, padding-bottom, padding-left, padding-right, 

254 border, border-width, border-style, border-top, border-top-width, border-top-style, border-bottom, border-bottom-width, border-bottom-style, border-left, border-left-width, border-left-style, border-right, border-right-width, border-right-style, border-color, 

255 /*box values*/ 

256 width, height, float, clear, 

257 auto, thin, medium, thick, left, right, none, both, 

258 none, dotted, dashed, solid, double, groove, ridge, inset, outset, 

259 /*display rules*/ 

260 display, white-space, 

261 min-width, max-width, min-height, max-height, 

262 outline-color, outline-style, outline-width, 

263 /*display values*/ 

264 run-in, inline-block, list-item, block, inline, none, normal, pre, nowrap, table-cell, table-row, table-row-group, table-header-group, inline-table, table-column, table-column-group, table-cell, table-caption 

265 /*list rules*/ 

266 list-style, list-style-type, list-style-image, list-style-position, 

267 /*list values*/ 

268 disc, circle, square, decimal, decimal-leading-zero, none, 

269 lower-roman, upper-roman, lower-alpha, upper-alpha, lower-latin, upper-latin, 

270 /*table rules*/ 

271 border-collapse, caption-side, 

272 /*table-values*/ 

273 empty-cells, table-layout, 

274 /*misc values/rules*/ 

275 counter-increment, counter-reset, 

276 marker-offset, z-index, 

277 cursor, direction, marks, quotes, 

278 clip, content, orphans, overflow, visibility, 

279 /*aural rules*/ 

280 pitch, range, pitch-during, cue-after, pause-after, cue-before, pause-before, speak-header, speak-numeral, speak-punctuation, speed-rate, play-during, voice-family, 

281 /*aural values*/ 

282 stress, azimuth, elevation, pitch, richness, volume, 

283 page-break, page-after, page-inside 

284 """) 

285 self.color('css', text) 

286 #@+node:ekr.20210905170507.9: *3* TestColorizer.test_colorizer_CWEB 

287 def test_colorizer_CWEB(self): 

288 text = textwrap.dedent(r"""\\\ 

289 % This is limbo in cweb mode... It should be in \LaTeX mode, not \c mode. 

290 % The following should not be colorized: class,if,else. 

291 

292 @* this is a _cweb_ comment. Code is written in \c. 

293 "strings" should not be colorized. 

294 It should be colored in \LaTeX mode. 

295 The following are not keywords in latex mode: if, else, etc. 

296 Noweb section references are _valid_ in cweb comments! 

297 < < section ref > > 

298 < < missing ref > > 

299 @c 

300 

301 and this is C code. // It is colored in \LaTeX mode by default. 

302 /* This is a C block comment. It may also be colored in restricted \LaTeX mode. */ 

303 

304 // Section refs are valid in code too, of course. 

305 < < section ref > > 

306 < < missing ref > > 

307 

308 \LaTeX and \c should not be colored. 

309 if else, while, do // C keywords. 

310 """) 

311 self.color('cweb', text) 

312 #@+node:ekr.20210905170507.10: *3* TestColorizer.test_colorizer_cython 

313 def test_colorizer_cython(self): 

314 text = textwrap.dedent("""\ 

315 by cdef cimport cpdef ctypedef enum except? 

316 extern gil include nogil property public 

317 readonly struct union DEF IF ELIF ELSE 

318 

319 NULL bint char dict double float int list 

320 long object Py_ssize_t short size_t void 

321 

322 try: 

323 pass 

324 except Exception: 

325 pass 

326 """) 

327 self.color('cython', text) 

328 #@+node:ekr.20210905170507.11: *3* TestColorizer.test_colorizer_elisp 

329 def test_colorizer_elisp(self): 

330 text = textwrap.dedent("""\ 

331 ; Maybe... 

332 error princ 

333 

334 ; More typical of other lisps... 

335 and apply 

336 car cdr cons cond 

337 defconst defun defvar 

338 eq equal eval 

339 gt ge 

340 if 

341 let le lt 

342 mapcar 

343 ne nil 

344 or not 

345 prog progn 

346 set setq 

347 t type-of 

348 unless 

349 when while 

350 """) 

351 self.color('elisp', text) 

352 #@+node:ekr.20210905170507.12: *3* TestColorizer.test_colorizer_erlang 

353 def test_colorizer_erlang(self): 

354 text = textwrap.dedent("""\ 

355 halt() 

356 

357 -module() 

358 """) 

359 self.color('erlang', text) 

360 #@+node:ekr.20210905170507.13: *3* TestColorizer.test_colorizer_forth 

361 def test_colorizer_forth(self): 

362 text = textwrap.dedent(r"""\\\ 

363 \ tiny demo of Leo forth syntax colouring 

364 

365 : some-forth-word ( x1 x2 -- x3 ) \ blue :, black/bold some-forth-word 

366 label: y \ blue label: 

367 asm[ s" some string" type ]asm cr 

368 asm[ abc ]asm 

369 a 

370 s" abc " 

371 s" abc" 

372 a 

373 tty" abc " 

374 lcd2" abc " 

375 until 

376 

377 @ test 

378 @c 

379 

380 { abc } 

381 

382 a b @ c 

383 

384 asm[ abc ]asm 

385 

386 .( ab ) \ a string 

387 

388 : foo [ .s ] ; 

389 

390 [ a b c 

391 x y z] 

392 ; 

393 """) 

394 self.color('forth', text) 

395 #@+node:ekr.20210905170507.14: *3* TestColorizer.test_colorizer_HTML_string_bug 

396 def test_colorizer_HTML_string_bug(self): 

397 text = textwrap.dedent("""\ 

398 b = "cd" 

399 d 

400 """) 

401 self.color('html', text) 

402 #@+node:ekr.20210905170507.15: *3* TestColorizer.test_colorizer_HTML1 

403 def test_colorizer_HTML1(self): 

404 text = textwrap.dedent("""\ 

405 <HTML> 

406 <!-- Author: Edward K. Ream, edream@tds.net --> 

407 <HEAD> 

408 <META NAME="GENERATOR" CONTENT="Microsoft FrontPage 4.0"> 

409 <TITLE> Leo's Home Page </TITLE> 

410 <META NAME="description" CONTENT="This page describes Leo. 

411 Leo adds powerful outlines to the noweb and CWEB literate programming languages."> 

412 <META NAME="keywords" CONTENT="LEO, LITERATE PROGRAMMING, OUTLINES, CWEB, 

413 NOWEB, OUTLINES, EDWARD K. REAM, DONALD E. KNUTH, SILVIO LEVY, OPEN SOFTWARE"> 

414 </HEAD> 

415 <!-- Last Modified: May 12, 2002 --> 

416 <BODY BGCOLOR="#fffbdc"> 

417 

418 <H1 ALIGN=CENTER><a NAME="top"></a><IMG SRC="Blank.gif" width= 

419 "32" height="32" ALIGN="BOTTOM" NATURALSIZEFLAG="3"><IMG SRC="leo.gif" 

420 WIDTH="32" HEIGHT="32" ALIGN="BOTTOM" NATURALSIZEFLAG="3"><a href="leo_TOC.html#top"><IMG SRC= 

421 "arrow_rt.gif" WIDTH="32" HEIGHT="32" ALIGN="BOTTOM" NATURALSIZEFLAG="3"></a> &nbsp;</H1> 

422 

423 <H1 ALIGN=CENTER> Leo's Home Page</H1> 

424 

425 <p align="center"><a href="http://www.python.org/"><img border="0" src="PythonPowered.gif" width="110" height="44"> </a> <A HREF="http://sourceforge.net/"><IMG SRC="http://sourceforge.net/sflogo.php?group_id=3458&type=1" NATURALSIZEFLAG="0" ALT="SourceForge Logo"></A>&nbsp;&nbsp;&nbsp; 

426 <A HREF="http://sourceforge.net/project/?group_id=3458">Leo at SourceForge</A>&nbsp;&nbsp; 

427 <a href="icons.html"><img border="0" src="LeoCodeGray.gif" width="77" height="42"></a>&nbsp;&nbsp; 

428 <a href="icons.html"><img border="0" src="LeoProse.gif" width="81" height="42"></a>&nbsp;&nbsp;&nbsp;&nbsp; 

429 

430 <H3><A NAME="anchor127554"></A>Summary</H3> 

431 

432 <UL> 

433 <LI>Leo is a <i> programmer's editor</i> and a flexible <i>browser</i> for 

434 projects, programs, classes or data. Leo clarifies design, coding, debugging, testing 

435 and maintenance. 

436 <LI>Leo is an <i>outlining editor</i>. Outlines clarify the big picture while 

437 providing unlimited space for details. 

438 <LI>Leo 

439 is a <a HREF="http://www.literateprogramming.com/"><i>literate 

440 programming</i></a> tool, compatible with <A HREF="http://www.eecs.harvard.edu/~nr/noweb/">noweb</A> 

441 and <a HREF="http://www-cs-faculty.stanford.edu/~knuth/cweb.html">CWEB</a>. 

442 Leo enhances any text-based 

443 programming language, from assembly language and C to Java, Python and XML. 

444 <LI>Leo is also a <i>data organizer</i>. A single Leo outline can generate complex 

445 data spanning many different files.&nbsp; Leo has been used to manage web sites. 

446 <LI>Leo is a <i> project manager</i>. Leo provides multiple views 

447 of a project within a single outline. Leo naturally represents tasks that remain 

448 up-to-date. 

449 <LI>Leo is fully <i> scriptable</i> using <A HREF="http://www.python.org/">Python</A> 

450 and saves its files in <A HREF="http://www.w3.org/XML/">XML</A> format. 

451 <LI>Leo is <i>portable</i>.&nbsp; Leo.py is 100% pure Python and will run on 

452 any platform supporting <A HREF="http://www.python.org/">Python</A> 

453 and <a href="http://tcl.activestate.com/">Tk/tcl</a>, including Windows, 

454 Linux and MacOS X.&nbsp; Leo.exe runs on any Windows platform. 

455 <LI>Leo is <a href="http://www.opensource.org/"> <i> Open Software</i></a>, distributed under 

456 the <a href="http://www.python.org/doc/Copyright.html"> Python License</a>. 

457 </UL> 

458 

459 <H3>More Information and downloads</H3> 

460 

461 <ul> 

462 <LI>An excellent <a href="http://www.3dtree.com/ev/e/sbooks/leo/sbframetoc_ie.htm">online 

463 tutorial</a> and <A HREF="http://www.jserv.com/jk_orr/xml/leo.htm">Leo resource 

464 page</A>, both written by <a href="http://www.jserv.com/jk_orr">Joe Orr</a>. 

465 <LI>My brother's <a href="SpeedReam.html">slashdot 

466 article about Leo</a>, the best description about why Leo is special. 

467 <LI><A HREF="testimonials.html#anchor104391">What people are saying about Leo</A> 

468 <LI><A HREF="leo_TOC.html#anchor964914">Complete users guide</A> 

469 and 

470 <A HREF="intro.html#anchor887874">tutorial introduction</A> with 

471 screen shots. 

472 <li><a href="FAQ.html">FAQ</a> and <a href="http://sourceforge.net/forum/?group_id=3458">help and discussion 

473 forums</a>, preferable to <A HREF="mailto:edream@tds.net">email</A> so others may join 

474 in.</li> 

475 <li><a href="icons.html">Icons</a> for bragging about Leo.</li> 

476 </ul> 

477 

478 <a href="http://sourceforge.net/project/showfiles.php?group_id=3458">Download 

479 Leo</a> from <A HREF="http://sourceforge.net/project/?group_id=3458">Leo's SourceForge 

480 site</A>. 

481 

482 <P ALIGN=left>Leo's author is <A HREF="http://personalpages.tds.net/~edream/index.html">Edward 

483 K. Ream</A> email: <A HREF="mailto:edream@tds.net">edream@tds.net</A> voice: (608) 231-0766 

484 

485 <HR ALIGN=LEFT> 

486 

487 <p align="center"> 

488 

489 <IMG SRC="Blank.gif" ALIGN="left" NATURALSIZEFLAG= 

490 "3" width="34" height="34"><IMG SRC="leo.gif" ALIGN="left" NATURALSIZEFLAG= 

491 "3" width="32" height="32"><a HREF="leo_TOC.html"><IMG SRC="arrow_rt.gif" WIDTH="32" 

492 HEIGHT="32" ALIGN="left" NATURALSIZEFLAG="3"> 

493 

494 </BODY> 

495 </HTML> 

496 """) 

497 self.color('html', text) 

498 #@+node:ekr.20210905170507.16: *3* TestColorizer.test_colorizer_HTML2 

499 def test_colorizer_HTML2(self): 

500 text = textwrap.dedent("""\ 

501 <? xml version="1.0"> 

502 <!-- test --> 

503 <project name="Converter" default="dist"> 

504 </project> 

505 """) 

506 self.color('html', text) 

507 #@+node:ekr.20210905170507.17: *3* TestColorizer.test_colorizer_Java 

508 def test_colorizer_Java(self): 

509 text = textwrap.dedent('''\ 

510 @ doc part 

511 @c 

512 

513 @language java /* Colored by match_leo_keyword: tag = leoKeyword. */ 

514 

515 @whatever /* Colored by java match_following rule: tag = keyword4. */ 

516 

517 /** A javadoc: tag = comment3 */ 

518 

519 /** <!-- comment --> tag = comment1. */ 

520 

521 /** @see tag = label */ 

522 ''') 

523 self.color('java', text) 

524 #@+node:ekr.20210905170507.18: *3* TestColorizer.test_colorizer_LaTex 

525 def test_colorizer_LaTex(self): 

526 text = textwrap.dedent(r"""\\\ 

527 % This is a \LaTeX mode comment. 

528 

529 This is a test of \LaTeX mode. 

530 

531 @ blah blah blah 

532 @c 

533 

534 \c and \LaTeX are latex keywords. 

535 

536 This is a keyword \% not the start of a comment. 

537 

538 More keywords: \@ and \( and \) and \{ and \} 

539 

540 The following should be colored: 

541 

542 \documentclass{report} 

543 

544 The following 2-letter words should be colored, regardless of what follows: 

545 

546 \(\)\{\}\@ 

547 \(abc\)abc\{abc\}abc\@abc 

548 """) 

549 self.color('latex', text) 

550 #@+node:ekr.20210905170507.19: *3* TestColorizer.test_colorizer_lisp 

551 def test_colorizer_lisp(self): 

552 text = textwrap.dedent("""\ 

553 ; Maybe... 

554 error princ 

555 

556 ; More typical of other lisps... 

557 and apply 

558 car cdr cons cond 

559 defconst defun defvar 

560 eq equal eval 

561 gt ge 

562 if 

563 let le lt 

564 mapcar 

565 ne nil 

566 or not 

567 prog progn 

568 set setq 

569 t type-of 

570 unless 

571 when while 

572 """) 

573 self.color('lisp', text) 

574 #@+node:ekr.20210905170507.20: *3* TestColorizer.test_colorizer_objective_c 

575 def test_colorizer_objective_c(self): 

576 text = textwrap.dedent("""\ 

577 @interface Application 

578 -(void) init; 

579 -(void) showMessage; 

580 @end 

581 

582 @implementation Application 

583 -(id) init { 

584 if (self = [super init]) { 

585 NSLog(@"Init ok"); 

586 return self; 

587 } 

588 return nil; 

589 } 

590 -(void) showMessage { 

591 NSLog(@"Hello there"); 

592 } 

593 @end 

594 

595 @"Hello there" 

596 

597 ,@interface 

598 , @interface 

599 the @interface 

600 

601 // By the way, I have noticed that such kind of words in doxygen block 

602 // are highlighted properly, but they are labels here, not keywords1 as in my case. 

603 /** 

604 @var test 

605 @todo 

606 */ 

607 """) 

608 self.color('objective_c', text) 

609 #@+node:ekr.20210905170507.21: *3* TestColorizer.test_colorizer_perl 

610 def test_colorizer_perl(self): 

611 text = textwrap.dedent("""\ 

612 # From a perl tutorial. 

613 

614 print 'Hello world.'; # Print a message 

615 

616 $a = $b; # Assign $b to $a 

617 

618 @food = ("apples", "pears", "eels"); 

619 

620 $grub = pop(@food); # Now $grub = "eels" 

621 

622 $#food 

623 

624 @lines = <INFO>; 

625 

626 #!/usr/local/bin/perl 

627 print "Password? "; # Ask for input 

628 $a = <STDIN>; # Get input 

629 chop $a; # Remove the newline at end 

630 while ($a ne "fred") # While input is wrong... 

631 { 

632 print "sorry. Again? "; # Ask again 

633 $a = <STDIN>; # Get input again 

634 chop $a; # Chop off newline again 

635 } 

636 

637 if ($sentence =~ /under/) 

638 { 

639 print "We're talking about rugby\\n"; 

640 } 

641 

642 $sentence =~ s/london/London/ 

643 

644 $_ = "Capes:Geoff::Shot putter:::Big Avenue"; 

645 @personal = split(/:/); 

646 

647 foreach $age (values %ages) 

648 { 

649 print "Somebody is $age\\n"; 

650 } 

651 

652 &mysubroutine; # Call the subroutine 

653 &mysubroutine($_); # Call it with a parameter 

654 &mysubroutine(1+2, $_); # Call it with two parameters 

655 

656 sub inside 

657 { 

658 local($a, $b); # Make local variables 

659 ($a, $b) = ($_[0], $_[1]); # Assign values 

660 $a =~ s/ //g; # Strip spaces from 

661 $b =~ s/ //g; # local variables 

662 ($a =~ /$b/ || $b =~ /$a/); # Is $b inside $a 

663 # or $a inside $b? 

664 } 

665 """) 

666 self.color('perl', text) 

667 #@+node:ekr.20210905170507.22: *3* TestColorizer.test_colorizer_PHP 

668 def test_colorizer_PHP(self): 

669 text = textwrap.dedent("""\ 

670 @ doc 

671 This is a doc part. 

672 @c 

673 

674 and or 

675 array 

676 array() 

677 /* Multi-line comment 

678 */ 

679 this is a test. 

680 __CLASS__ 

681 <?php and or array() ?> 

682 <?PHP and or array() ?> 

683 """) 

684 self.color('php', text) 

685 #@+node:ekr.20210905170507.23: *3* TestColorizer.test_colorizer_plsql 

686 def test_colorizer_plsql(self): 

687 text = textwrap.dedent("""\ 

688 "a string" 

689 -- reserved keywords 

690 ABORT, 

691 abort, 

692 ACceSS, 

693 access, 

694 add, 

695 all, 

696 allocate, 

697 alter, 

698 analyze, 

699 and, 

700 any, 

701 archive, 

702 archivelog, 

703 array, 

704 arraylen, 

705 as, 

706 asc, 

707 assert, 

708 assign, 

709 at, 

710 audit, 

711 authorization, 

712 avg, 

713 backup, 

714 base_table, 

715 become, 

716 before, 

717 begin, 

718 between, 

719 binary_integer, 

720 block, 

721 body, 

722 boolean, 

723 by, 

724 cache, 

725 cancel, 

726 cascade, 

727 case, 

728 change, 

729 char, 

730 char_base, 

731 character, 

732 check, 

733 checkpoint, 

734 close, 

735 cluster, 

736 clusters, 

737 cobol, 

738 colauth, 

739 column, 

740 columns, 

741 comment, 

742 commit, 

743 compile, 

744 compress, 

745 connect, 

746 constant, 

747 constraint, 

748 constraints, 

749 contents, 

750 continue, 

751 controlfile, 

752 count, 

753 crash, 

754 create, 

755 current, 

756 currval, 

757 cursor, 

758 cycle, 

759 data_base, 

760 database, 

761 datafile, 

762 date, 

763 dba, 

764 debugoff, 

765 debugon, 

766 dec, 

767 decimal, 

768 declare, 

769 default, 

770 definition, 

771 delay, 

772 delete, 

773 delta, 

774 desc, 

775 digits, 

776 disable, 

777 dismount, 

778 dispose, 

779 distinct, 

780 distinct, 

781 do, 

782 double, 

783 drop, 

784 drop, 

785 dump, 

786 each, 

787 else, 

788 else, 

789 elsif, 

790 enable, 

791 end, 

792 end, 

793 entry, 

794 escape, 

795 events, 

796 except, 

797 exception, 

798 exception_init, 

799 exceptions, 

800 exclusive, 

801 exec, 

802 execute, 

803 exists, 

804 exists, 

805 exit, 

806 explain, 

807 extent, 

808 externally, 

809 false, 

810 fetch, 

811 fetch, 

812 file, 

813 float, 

814 float, 

815 flush, 

816 for, 

817 for, 

818 force, 

819 foreign, 

820 form, 

821 fortran, 

822 found, 

823 freelist, 

824 freelists, 

825 from, 

826 from, 

827 function, 

828 generic, 

829 go, 

830 goto, 

831 grant, 

832 group, 

833 groups, 

834 having, 

835 identified, 

836 if, 

837 immediate, 

838 in, 

839 including, 

840 increment, 

841 index, 

842 indexes, 

843 indicator, 

844 initial, 

845 initrans, 

846 insert, 

847 instance, 

848 int, 

849 integer, 

850 intersect, 

851 into, 

852 is, 

853 key, 

854 language, 

855 layer, 

856 level, 

857 like, 

858 limited, 

859 link, 

860 lists, 

861 lock, 

862 logfile, 

863 long, 

864 loop, 

865 manage, 

866 manual, 

867 max, 

868 maxdatafiles, 

869 maxextents, 

870 maxinstances, 

871 maxlogfiles, 

872 maxloghistory, 

873 maxlogmembers, 

874 maxtrans, 

875 maxvalue, 

876 min, 

877 minextents, 

878 minus, 

879 minvalue, 

880 mlslabel, 

881 mod, 

882 mode, 

883 modify, 

884 module, 

885 mount, 

886 natural, 

887 new, 

888 new, 

889 next, 

890 nextval, 

891 noarchivelog, 

892 noaudit, 

893 nocache, 

894 nocompress, 

895 nocycle, 

896 nomaxvalue, 

897 nominvalue, 

898 none, 

899 noorder, 

900 noresetlogs, 

901 normal, 

902 nosort, 

903 not, 

904 notfound, 

905 nowait, 

906 null, 

907 number, 

908 number_base, 

909 numeric, 

910 of, 

911 off, 

912 offline, 

913 old, 

914 on, 

915 online, 

916 only, 

917 open, 

918 open, 

919 optimal, 

920 option, 

921 or, 

922 order, 

923 others, 

924 out, 

925 own, 

926 package, 

927 package, 

928 parallel, 

929 partition, 

930 pctfree, 

931 pctincrease, 

932 pctused, 

933 plan, 

934 pli, 

935 positive, 

936 pragma, 

937 precision, 

938 primary, 

939 prior, 

940 private, 

941 private, 

942 privileges, 

943 procedure, 

944 procedure, 

945 profile, 

946 public, 

947 quota, 

948 raise, 

949 range, 

950 raw, 

951 read, 

952 real, 

953 record, 

954 recover, 

955 references, 

956 referencing, 

957 release, 

958 remr, 

959 rename, 

960 resetlogs, 

961 resource, 

962 restricted, 

963 return, 

964 reuse, 

965 reverse, 

966 revoke, 

967 role, 

968 roles, 

969 rollback, 

970 row, 

971 rowid, 

972 rowlabel, 

973 rownum, 

974 rows, 

975 rowtype, 

976 run, 

977 savepoint, 

978 schema, 

979 scn, 

980 section, 

981 segment, 

982 select, 

983 select, 

984 separate, 

985 sequence, 

986 session, 

987 set, 

988 set, 

989 share, 

990 shared, 

991 size, 

992 size, 

993 smallint, 

994 smallint, 

995 snapshot, 

996 some, 

997 sort, 

998 space, 

999 sql, 

1000 sqlbuf, 

1001 sqlcode, 

1002 sqlerrm, 

1003 sqlerror, 

1004 sqlstate, 

1005 start, 

1006 start, 

1007 statement, 

1008 statement_id, 

1009 statistics, 

1010 stddev, 

1011 stop, 

1012 storage, 

1013 subtype, 

1014 successful, 

1015 sum, 

1016 sum, 

1017 switch, 

1018 synonym, 

1019 sysdate, 

1020 system, 

1021 tabauth, 

1022 table, 

1023 tables, 

1024 tables, 

1025 tablespace, 

1026 task, 

1027 temporary, 

1028 terminate, 

1029 then, 

1030 thread, 

1031 time, 

1032 to, 

1033 tracing, 

1034 transaction, 

1035 trigger, 

1036 triggers, 

1037 true, 

1038 truncate, 

1039 type, 

1040 uid, 

1041 under, 

1042 union, 

1043 unique, 

1044 unlimited, 

1045 until, 

1046 update, 

1047 use, 

1048 user, 

1049 using, 

1050 validate, 

1051 values, 

1052 varchar, 

1053 varchar2, 

1054 variance, 

1055 view, 

1056 views, 

1057 when, 

1058 whenever, 

1059 where, 

1060 while, 

1061 with, 

1062 work, 

1063 write, 

1064 xor 

1065 """) 

1066 self.color('plsql', text) 

1067 #@+node:ekr.20210905170507.24: *3* TestColorizer.test_colorizer_python_xml_jEdit_ 

1068 def test_colorizer_python_xml_jEdit_(self): 

1069 text = textwrap.dedent(r"""\\\ 

1070 <?xml version="1.0"?> 

1071 

1072 <!DOCTYPE MODE SYSTEM "xmode.dtd"> 

1073 < < remarks > > 

1074 

1075 <MODE> 

1076 <PROPS> 

1077 <PROPERTY NAME="indentPrevLine" VALUE="\s*.{3,}:\s*(#.*)?" /> 

1078 <PROPERTY NAME="lineComment" VALUE="#" /> 

1079 </PROPS> 

1080 <RULES ESCAPE="\" IGNORE_CASE="FALSE" HIGHLIGHT_DIGITS="TRUE"> 

1081 < < comments > > 

1082 < < literals > > 

1083 < < operators > > 

1084 <MARK_PREVIOUS TYPE="FUNCTION" EXCLUDE_MATCH="TRUE">(</MARK_PREVIOUS> 

1085 < < keywords > > 

1086 </RULES> 

1087 </MODE> 

1088 """) 

1089 self.color('html', text) 

1090 #@+node:ekr.20210905170507.25: *3* TestColorizer.test_colorizer_Python1 

1091 def test_colorizer_Python1(self): 

1092 text = textwrap.dedent("""\ 

1093 int 

1094 float 

1095 dict 

1096 """) 

1097 self.color('python', text) 

1098 #@+node:ekr.20210905170507.26: *3* TestColorizer.test_colorizer_Python2 

1099 def test_colorizer_Python2(self): 

1100 

1101 text = textwrap.dedent('''\ 

1102 """This creates a free-floating copy of v's tree for undo. 

1103 The copied trees must use different vnodes than the original.""" 

1104 

1105 def copyTree(self,root): 

1106 c = self 

1107 # Create the root VNode. 

1108 result = v = leoNodes.VNode(c) 

1109 # Copy the headline and icon values v.copyNode(root,v) 

1110 # Copy the rest of tree. 

1111 v.copyTree(root,v) 

1112 # Replace all vnodes in v by copies. 

1113 assert(v.nodeAfterTree() == None) 

1114 while v: 

1115 v = leoNodes.VNode(c) 

1116 v = v.threadNext() 

1117 return result 

1118 ''') 

1119 self.color('python', text) 

1120 

1121 #@+node:ekr.20210905170507.27: *3* TestColorizer.test_colorizer_r 

1122 def test_colorizer_r(self): 

1123 text = textwrap.dedent("""\ 

1124 x <- rnorm(10) 

1125 

1126 vv <- function(z) return(z) 

1127 

1128 def python_funct(uu): 

1129 return uu 

1130 """) 

1131 self.color('r', text) 

1132 #@+node:ekr.20210905170507.28: *3* TestColorizer.test_colorizer_rapidq 

1133 def test_colorizer_rapidq(self): 

1134 text = textwrap.dedent("""\ 

1135 ' New in 4.2. 

1136 ' a comment. 

1137 

1138 $APPTYPE,$DEFINE,$ELSE,$ENDIF,$ESCAPECHARS,$IFDEF,$IFNDEF, 

1139 $INCLUDE,$MACRO,$OPTIMIZE,$OPTION,$RESOURCE,$TYPECHECK,$UNDEF, 

1140 ABS,ACOS,ALIAS,AND,AS,ASC,ASIN,ATAN,ATN,BIN$,BIND,BYTE, 

1141 CALL,CALLBACK,CALLFUNC,CASE,CEIL,CHDIR,CHDRIVE,CHR$,CINT, 

1142 CLNG,CLS,CODEPTR,COMMAND$,COMMANDCOUNT,CONSOLE,CONST,CONSTRUCTOR, 

1143 CONVBASE$,COS,CREATE,CSRLIN,CURDIR$,DATA,DATE$,DEC,DECLARE, 

1144 DEFBYTE,DEFDBL,DEFDWORD,DEFINT,DEFLNG,DEFSHORT,DEFSNG,DEFSTR, 

1145 DEFWORD,DELETE$,DIM,DIR$,DIREXISTS,DO,DOEVENTS,DOUBLE,DWORD, 

1146 ELSE,ELSEIF,END,ENVIRON,ENVIRON$,EVENT,EXIT,EXP,EXTENDS, 

1147 EXTRACTRESOURCE,FIELD$,FILEEXISTS,FIX,FLOOR,FOR,FORMAT$,FRAC, 

1148 FUNCTION,FUNCTIONI,GET$,GOSUB,GOTO,HEX$,IF,INC,INITARRAY, 

1149 INKEY$,INP,INPUT,INPUT$,INPUTHANDLE,INSERT$,INSTR,INT,INTEGER, 

1150 INV,IS,ISCONSOLE,KILL,KILLMESSAGE,LBOUND,LCASE$,LEFT$,LEN, 

1151 LFLUSH,LIB,LIBRARYINST,LOCATE,LOG,LONG,LOOP,LPRINT,LTRIM$, 

1152 MEMCMP,MESSAGEBOX,MESSAGEDLG,MID$,MKDIR,MOD,MOUSEX,MOUSEY, 

1153 NEXT,NOT,OFF,ON,OR,OUT,OUTPUTHANDLE,PARAMSTR$,PARAMSTRCOUNT, 

1154 PARAMVAL,PARAMVALCOUNT,PCOPY,PEEK,PLAYWAV,POKE,POS,POSTMESSAGE, 

1155 PRINT,PROPERTY,QUICKSORT,RANDOMIZE,REDIM,RENAME,REPLACE$, 

1156 REPLACESUBSTR$,RESOURCE,RESOURCECOUNT,RESTORE,RESULT,RETURN, 

1157 REVERSE$,RGB,RIGHT$,RINSTR,RMDIR,RND,ROUND,RTRIM$,RUN, 

1158 SCREEN,SELECT,SENDER,SENDMESSAGE,SETCONSOLETITLE,SGN,SHELL, 

1159 SHL,SHORT,SHOWMESSAGE,SHR,SIN,SINGLE,SIZEOF,SLEEP,SOUND, 

1160 SPACE$,SQR,STACK,STATIC,STEP,STR$,STRF$,STRING,STRING$, 

1161 SUB,SUBI,SWAP,TALLY,TAN,THEN,TIME$,TIMER,TO,TYPE,UBOUND, 

1162 UCASE$,UNLOADLIBRARY,UNTIL,VAL,VARIANT,VARPTR,VARPTR$,VARTYPE, 

1163 WEND,WHILE,WITH,WORD,XOR 

1164 """) 

1165 self.color('rapidq', text) 

1166 #@+node:ekr.20210905170507.29: *3* TestColorizer.test_colorizer_Rebol 

1167 def test_colorizer_Rebol(self): 

1168 text = textwrap.dedent("""\ 

1169 ; a comment 

1170 about abs absolute add alert alias all alter and and~ any append arccosine arcsine arctangent array ask at 

1171 back bind boot-prefs break browse build-port build-tag 

1172 call caret-to-offset catch center-face change change-dir charset checksum choose clean-path clear clear-fields close comment complement compose compress confirm continue-post context copy cosine create-request crypt cvs-date cvs-version 

1173 debase decode-cgi decode-url decompress deflag-face dehex delete demo desktop detab dh-compute-key dh-generate-key dh-make-key difference dirize disarm dispatch divide do do-boot do-events do-face do-face-alt does dsa-generate-key dsa-make-key dsa-make-signature dsa-verify-signature 

1174 echo editor either else emailer enbase entab exclude exit exp extract 

1175 fifth find find-key-face find-window flag-face first flash focus for forall foreach forever form forskip fourth free func function 

1176 get get-modes get-net-info get-style 

1177 halt has head help hide hide-popup 

1178 if import-email in inform input insert insert-event-func intersect 

1179 join 

1180 last launch launch-thru layout license list-dir load load-image load-prefs load-thru log-10 log-2 log-e loop lowercase 

1181 make make-dir make-face max maximum maximum-of min minimum minimum-of mold multiply 

1182 negate net-error next not now 

1183 offset-to-caret open open-events or or~ 

1184 parse parse-email-addrs parse-header parse-header-date parse-xml path-thru pick poke power prin print probe protect protect-system 

1185 q query quit 

1186 random read read-io read-net read-thru reboot recycle reduce reform rejoin remainder remold remove remove-event-func rename repeat repend replace request request-color request-date request-download request-file request-list request-pass request-text resend return reverse rsa-encrypt rsa-generate-key rsa-make-key 

1187 save save-prefs save-user scroll-para second secure select send send-and-check set set-modes set-font set-net set-para set-style set-user set-user-name show show-popup sine size-text skip sort source split-path square-root stylize subtract switch 

1188 tail tangent textinfo third throw throw-on-error to to-binary to-bitset to-block to-char to-date to-decimal to-email to-event to-file to-get-word to-hash to-hex to-idate to-image to-integer to-issue to-list to-lit-path to-lit-word to-local-file to-logic to-money to-none to-pair to-paren to-path to-rebol-file to-refinement to-set-path to-set-word to-string to-tag to-time to-tuple to-url to-word trace trim try 

1189 unfocus union unique uninstall unprotect unset until unview update upgrade uppercase usage use 

1190 vbug view view-install view-prefs 

1191 wait what what-dir while write write-io 

1192 xor xor~ 

1193 action! any-block! any-function! any-string! any-type! any-word! 

1194 binary! bitset! block! 

1195 char! 

1196 datatype! date! decimal! 

1197 email! error! event! 

1198 file! function! 

1199 get-word! 

1200 hash! 

1201 image! integer! issue! 

1202 library! list! lit-path! lit-word! logic! 

1203 money! 

1204 native! none! number! 

1205 object! op! 

1206 pair! paren! path! port! 

1207 refinement! routine! 

1208 series! set-path! set-word! string! struct! symbol! 

1209 tag! time! tuple! 

1210 unset! url! 

1211 word! 

1212 any-block? any-function? any-string? any-type? any-word? 

1213 binary? bitset? block? 

1214 char? connected? crypt-strength? 

1215 datatype? date? decimal? dir? 

1216 email? empty? equal? error? even? event? exists? exists-key? 

1217 file? flag-face? found? function? 

1218 get-word? greater-or-equal? greater? 

1219 hash? head? 

1220 image? in-window? index? info? input? inside? integer? issue? 

1221 length? lesser-or-equal? lesser? library? link-app? link? list? lit-path? lit-word? logic? 

1222 modified? money? 

1223 native? negative? none? not-equal? number? 

1224 object? odd? offset? op? outside? 

1225 pair? paren? path? port? positive? 

1226 refinement? routine? 

1227 same? screen-offset? script? series? set-path? set-word? size? span? strict-equal? strict-not-equal? string? struct? 

1228 tag? tail? time? tuple? type? 

1229 unset? url? 

1230 value? view? 

1231 within? word? 

1232 zero? 

1233 """) 

1234 self.color('rebol', text) 

1235 #@+node:ekr.20210905170507.30: *3* TestColorizer.test_colorizer_rest 

1236 def test_colorizer_rest(self): 

1237 text = textwrap.dedent(r"""\\\ 

1238 @ @rst-options 

1239 code_mode=False 

1240 generate_rst=True 

1241 http_server_support = False 

1242 show_organizer_nodes=True 

1243 show_headlines=True 

1244 show_leo_directives=True 

1245 stylesheet_path=..\doc 

1246 write_intermediate_file = False 

1247 verbose=True 

1248 @c 

1249 

1250 . Links used in this document... 

1251 

1252 .. _`Pmw`: http://pmw.sourceforge.net/ 

1253 .. _run: `Running Leo`_ 

1254 

1255 .. WARNING: image targets may not have upper case letters! 

1256 

1257 .. |back| image:: arrow_lt.gif 

1258 :target: FAQ.html 

1259 

1260 .. |leo| image:: leo.gif 

1261 :target: front.html 

1262 

1263 .. |next| image:: arrow_rt.gif 

1264 :target: intro.html 

1265 

1266 |back| |leo| |next| 

1267 

1268 ########################### 

1269 Chapter 1: Installing Leo 

1270 ########################### 

1271 

1272 This chapter tells how to install and run Leo. 

1273 

1274 **Important**: 

1275 

1276 If you have *any* problems installing Leo, 

1277 please ask for help on Leo's help forum: 

1278 

1279 .. contents:: 

1280 

1281 **Windows** 

1282 If you have `associated .leo files with Leo`_ you may run Leo by double-clicking any .leo file. 

1283 You can also use a batch file. 

1284 Put the following .bat file in c:\\Windows:: 

1285 

1286 cd c:\prog\LeoCVS\leo 

1287 c:\python22\python c:\prog\LeoCVS\leo\leo.py %1 

1288 

1289 - Download the latest version of Leo from `Leo's download page`_. 

1290 

1291 - In Windows 2K or XP, go to ``Start->Settings->Control panel``, open the ``Folder Options`` tab. 

1292 

1293 **Warning**: When building Tcl on Linux, do **not** specify 

1294 "--enable-threads". 

1295 Only use Tcl with the default "threads not enabled" case. 

1296 

1297 ------------- 

1298 

1299 |back| |leo| |next| 

1300 """) 

1301 self.color('rest', text) 

1302 #@+node:ekr.20210905170507.31: *3* TestColorizer.test_colorizer_scala 

1303 def test_colorizer_scala(self): 

1304 text = textwrap.dedent("""\ 

1305 /* A comment */ 

1306 

1307 object HelloWorld { 

1308 def main(args: Array[String]) { 

1309 println("Hello, world!") 

1310 } 

1311 } 

1312 """) 

1313 self.color('scala', text) 

1314 #@+node:ekr.20210905170507.32: *3* TestColorizer.test_colorizer_shell 

1315 def test_colorizer_shell(self): 

1316 text = textwrap.dedent("""\ 

1317 # New in 4.2. 

1318 

1319 # comment 

1320 $# not a comment 

1321 break 

1322 case,continue, 

1323 do,done 

1324 elif,else,esac 

1325 fi,for 

1326 if,in 

1327 return, 

1328 then 

1329 until 

1330 while, 

1331 

1332 cd,chdir,eval,exec, 

1333 exit,kill,newgrp,pwd,read,readonly, 

1334 shift,test,trap,ulimit, 

1335 umask,wait 

1336 """) 

1337 self.color('shell', text) 

1338 #@+node:ekr.20210905170507.33: *3* TestColorizer.test_colorizer_shellscript 

1339 def test_colorizer_shellscript(self): 

1340 text = textwrap.dedent("""\ 

1341 # comment 

1342 $# not a comment 

1343 break 

1344 case,continue, 

1345 do,done 

1346 elif,else,esac 

1347 fi,for 

1348 if,in 

1349 return, 

1350 then 

1351 until 

1352 while, 

1353 

1354 cd,chdir,eval,exec, 

1355 exit,kill,newgrp,pwd,read,readonly, 

1356 shift,test,trap,ulimit, 

1357 umask,wait 

1358 """) 

1359 self.color('shellscript', text) 

1360 #@+node:ekr.20210905170507.34: *3* TestColorizer.test_colorizer_tex_xml_jEdit_ 

1361 def test_colorizer_tex_xml_jEdit_(self): 

1362 text = textwrap.dedent("""\ 

1363 <!-- ekr uses the MARK_FOLLOWING to mark _anything_ after \\ --> 

1364 

1365 <?xml version="1.0"?> 

1366 

1367 <!DOCTYPE MODE SYSTEM "xmode.dtd"> 

1368 

1369 <MODE> 

1370 <PROPS> 

1371 <PROPERTY NAME="lineComment" VALUE="%" /> 

1372 </PROPS> 

1373 

1374 <RULES> 

1375 < < general rules > > 

1376 </RULES> 

1377 

1378 <RULES SET="MATH" DEFAULT="MARKUP"> 

1379 < < math rules > > 

1380 </RULES> 

1381 </MODE> 

1382 """) 

1383 self.color('html', text) 

1384 #@+node:ekr.20210905170507.36: *3* TestColorizer.test_colorizer_wikiTest 

1385 def test_colorizer_wikiTest(self): 

1386 # both color_markup & add_directives plugins must be enabled. 

1387 text = textwrap.dedent('''\ 

1388 @markup wiki 

1389 

1390 """ text~~red:some text~~more text""" 

1391 

1392 """ text~~#ee0ff:some text~~more text""" 

1393 

1394 if 1 and 2: 

1395 pass 

1396 ''') 

1397 self.color('html', text) 

1398 #@+node:ekr.20210905170507.39: *3* TestColorizer.test_scanColorDirectives 

1399 def test_scanColorDirectives(self): 

1400 c = self.c 

1401 language = g.findLanguageDirectives(c, c.p) 

1402 self.assertEqual(language, 'python') 

1403 #@+node:ekr.20210905170507.40: *3* TestColorizer.test_vbscript 

1404 def test_vbscript(self): 

1405 text = textwrap.dedent("""\ 

1406 if 

1407 IF 

1408 """) 

1409 self.color('vbscript', text) 

1410 #@-others 

1411#@-others 

1412#@-leo