pygments.rb 0.5.4 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +40 -0
  3. data/README.md +3 -0
  4. data/lexers +0 -0
  5. data/lib/pygments/popen.rb +3 -2
  6. data/lib/pygments/version.rb +1 -1
  7. data/pygments.rb.gemspec +2 -1
  8. data/vendor/pygments-main/AUTHORS +20 -1
  9. data/vendor/pygments-main/CHANGES +55 -3
  10. data/vendor/pygments-main/LICENSE +1 -1
  11. data/vendor/pygments-main/MANIFEST.in +1 -1
  12. data/vendor/pygments-main/Makefile +5 -8
  13. data/vendor/pygments-main/REVISION +1 -1
  14. data/vendor/pygments-main/doc/Makefile +153 -0
  15. data/vendor/pygments-main/doc/_static/favicon.ico +0 -0
  16. data/vendor/pygments-main/doc/_static/logo_new.png +0 -0
  17. data/vendor/pygments-main/doc/_static/logo_only.png +0 -0
  18. data/vendor/pygments-main/doc/_templates/docssidebar.html +3 -0
  19. data/vendor/pygments-main/doc/_templates/indexsidebar.html +25 -0
  20. data/vendor/pygments-main/doc/_themes/pygments14/layout.html +98 -0
  21. data/vendor/pygments-main/doc/_themes/pygments14/static/bodybg.png +0 -0
  22. data/vendor/pygments-main/doc/_themes/pygments14/static/docbg.png +0 -0
  23. data/vendor/pygments-main/doc/_themes/pygments14/static/listitem.png +0 -0
  24. data/vendor/pygments-main/doc/_themes/pygments14/static/logo.png +0 -0
  25. data/vendor/pygments-main/doc/_themes/pygments14/static/pocoo.png +0 -0
  26. data/vendor/pygments-main/doc/_themes/pygments14/static/pygments14.css_t +401 -0
  27. data/vendor/pygments-main/doc/_themes/pygments14/theme.conf +15 -0
  28. data/vendor/pygments-main/doc/conf.py +249 -0
  29. data/vendor/pygments-main/doc/docs/api.rst +316 -0
  30. data/vendor/pygments-main/doc/docs/authors.rst +4 -0
  31. data/vendor/pygments-main/doc/docs/changelog.rst +1 -0
  32. data/vendor/pygments-main/{docs/src/cmdline.txt → doc/docs/cmdline.rst} +9 -11
  33. data/vendor/pygments-main/{docs/src/filterdevelopment.txt → doc/docs/filterdevelopment.rst} +1 -1
  34. data/vendor/pygments-main/{docs/src/filters.txt → doc/docs/filters.rst} +4 -5
  35. data/vendor/pygments-main/{docs/src/formatterdevelopment.txt → doc/docs/formatterdevelopment.rst} +1 -1
  36. data/vendor/pygments-main/{docs/src/formatters.txt → doc/docs/formatters.rst} +6 -6
  37. data/vendor/pygments-main/doc/docs/index.rst +66 -0
  38. data/vendor/pygments-main/{docs/src/integrate.txt → doc/docs/integrate.rst} +3 -7
  39. data/vendor/pygments-main/{docs/src/java.txt → doc/docs/java.rst} +0 -0
  40. data/vendor/pygments-main/{docs/src/lexerdevelopment.txt → doc/docs/lexerdevelopment.rst} +13 -14
  41. data/vendor/pygments-main/{docs/src/lexers.txt → doc/docs/lexers.rst} +7 -5
  42. data/vendor/pygments-main/{docs/src/moinmoin.txt → doc/docs/moinmoin.rst} +0 -0
  43. data/vendor/pygments-main/{docs/src/plugins.txt → doc/docs/plugins.rst} +0 -0
  44. data/vendor/pygments-main/{docs/src/quickstart.txt → doc/docs/quickstart.rst} +22 -19
  45. data/vendor/pygments-main/{docs/src/rstdirective.txt → doc/docs/rstdirective.rst} +0 -0
  46. data/vendor/pygments-main/{docs/src/styles.txt → doc/docs/styles.rst} +2 -2
  47. data/vendor/pygments-main/{docs/src/tokens.txt → doc/docs/tokens.rst} +10 -7
  48. data/vendor/pygments-main/{docs/src/unicode.txt → doc/docs/unicode.rst} +8 -7
  49. data/vendor/pygments-main/doc/download.rst +41 -0
  50. data/vendor/pygments-main/doc/faq.rst +143 -0
  51. data/vendor/pygments-main/doc/index.rst +53 -0
  52. data/vendor/pygments-main/doc/languages.rst +151 -0
  53. data/vendor/pygments-main/doc/make.bat +190 -0
  54. data/vendor/pygments-main/{docs → doc}/pygmentize.1 +0 -0
  55. data/vendor/pygments-main/external/autopygmentize +65 -48
  56. data/vendor/pygments-main/external/markdown-processor.py +15 -15
  57. data/vendor/pygments-main/external/moin-parser.py +1 -1
  58. data/vendor/pygments-main/external/rst-directive.py +2 -3
  59. data/vendor/pygments-main/ez_setup.py +340 -234
  60. data/vendor/pygments-main/pygments/__init__.py +4 -4
  61. data/vendor/pygments-main/pygments/cmdline.py +81 -68
  62. data/vendor/pygments-main/pygments/console.py +1 -1
  63. data/vendor/pygments-main/pygments/filter.py +1 -1
  64. data/vendor/pygments-main/pygments/filters/__init__.py +11 -9
  65. data/vendor/pygments-main/pygments/formatter.py +3 -3
  66. data/vendor/pygments-main/pygments/formatters/__init__.py +5 -3
  67. data/vendor/pygments-main/pygments/formatters/_mapping.py +16 -5
  68. data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
  69. data/vendor/pygments-main/pygments/formatters/html.py +44 -26
  70. data/vendor/pygments-main/pygments/formatters/img.py +21 -14
  71. data/vendor/pygments-main/pygments/formatters/latex.py +104 -12
  72. data/vendor/pygments-main/pygments/formatters/other.py +53 -6
  73. data/vendor/pygments-main/pygments/formatters/rtf.py +30 -16
  74. data/vendor/pygments-main/pygments/formatters/svg.py +2 -2
  75. data/vendor/pygments-main/pygments/formatters/terminal.py +41 -1
  76. data/vendor/pygments-main/pygments/formatters/terminal256.py +2 -2
  77. data/vendor/pygments-main/pygments/lexer.py +59 -39
  78. data/vendor/pygments-main/pygments/lexers/__init__.py +38 -15
  79. data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1 -1
  80. data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +15 -15
  81. data/vendor/pygments-main/pygments/lexers/_cocoabuiltins.py +73 -0
  82. data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +11 -1
  83. data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +14 -8
  84. data/vendor/pygments-main/pygments/lexers/_mapping.py +81 -30
  85. data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +1 -1
  86. data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +1067 -95
  87. data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +7 -7
  88. data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +5 -4
  89. data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +1 -1
  90. data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +12 -7
  91. data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +112 -18
  92. data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +1 -1
  93. data/vendor/pygments-main/pygments/lexers/agile.py +644 -382
  94. data/vendor/pygments-main/pygments/lexers/asm.py +66 -29
  95. data/vendor/pygments-main/pygments/lexers/compiled.py +1643 -174
  96. data/vendor/pygments-main/pygments/lexers/dalvik.py +27 -6
  97. data/vendor/pygments-main/pygments/lexers/dotnet.py +45 -33
  98. data/vendor/pygments-main/pygments/lexers/foxpro.py +3 -3
  99. data/vendor/pygments-main/pygments/lexers/functional.py +1510 -570
  100. data/vendor/pygments-main/pygments/lexers/graph.py +81 -0
  101. data/vendor/pygments-main/pygments/lexers/hdl.py +29 -30
  102. data/vendor/pygments-main/pygments/lexers/inferno.py +96 -0
  103. data/vendor/pygments-main/pygments/lexers/jvm.py +622 -207
  104. data/vendor/pygments-main/pygments/lexers/math.py +438 -70
  105. data/vendor/pygments-main/pygments/lexers/other.py +885 -171
  106. data/vendor/pygments-main/pygments/lexers/parsers.py +24 -24
  107. data/vendor/pygments-main/pygments/lexers/qbasic.py +157 -0
  108. data/vendor/pygments-main/pygments/lexers/rdf.py +99 -0
  109. data/vendor/pygments-main/pygments/lexers/shell.py +28 -25
  110. data/vendor/pygments-main/pygments/lexers/special.py +7 -8
  111. data/vendor/pygments-main/pygments/lexers/sql.py +56 -23
  112. data/vendor/pygments-main/pygments/lexers/templates.py +377 -59
  113. data/vendor/pygments-main/pygments/lexers/text.py +208 -46
  114. data/vendor/pygments-main/pygments/lexers/web.py +729 -264
  115. data/vendor/pygments-main/pygments/modeline.py +1 -1
  116. data/vendor/pygments-main/pygments/plugin.py +1 -1
  117. data/vendor/pygments-main/pygments/scanner.py +1 -1
  118. data/vendor/pygments-main/pygments/sphinxext.py +153 -0
  119. data/vendor/pygments-main/pygments/style.py +3 -2
  120. data/vendor/pygments-main/pygments/styles/__init__.py +5 -1
  121. data/vendor/pygments-main/pygments/styles/autumn.py +1 -1
  122. data/vendor/pygments-main/pygments/styles/borland.py +1 -1
  123. data/vendor/pygments-main/pygments/styles/bw.py +1 -1
  124. data/vendor/pygments-main/pygments/styles/colorful.py +1 -1
  125. data/vendor/pygments-main/pygments/styles/default.py +1 -1
  126. data/vendor/pygments-main/pygments/styles/emacs.py +1 -1
  127. data/vendor/pygments-main/pygments/styles/friendly.py +1 -1
  128. data/vendor/pygments-main/pygments/styles/fruity.py +1 -1
  129. data/vendor/pygments-main/pygments/styles/igor.py +29 -0
  130. data/vendor/pygments-main/pygments/styles/manni.py +1 -1
  131. data/vendor/pygments-main/pygments/styles/monokai.py +4 -4
  132. data/vendor/pygments-main/pygments/styles/murphy.py +1 -1
  133. data/vendor/pygments-main/pygments/styles/native.py +1 -1
  134. data/vendor/pygments-main/pygments/styles/paraiso_dark.py +125 -0
  135. data/vendor/pygments-main/pygments/styles/paraiso_light.py +125 -0
  136. data/vendor/pygments-main/pygments/styles/pastie.py +1 -1
  137. data/vendor/pygments-main/pygments/styles/perldoc.py +1 -1
  138. data/vendor/pygments-main/pygments/styles/rrt.py +1 -1
  139. data/vendor/pygments-main/pygments/styles/tango.py +1 -1
  140. data/vendor/pygments-main/pygments/styles/trac.py +1 -1
  141. data/vendor/pygments-main/pygments/styles/vim.py +1 -1
  142. data/vendor/pygments-main/pygments/styles/vs.py +1 -1
  143. data/vendor/pygments-main/pygments/styles/xcode.py +51 -0
  144. data/vendor/pygments-main/pygments/token.py +4 -1
  145. data/vendor/pygments-main/pygments/unistring.py +6 -5
  146. data/vendor/pygments-main/pygments/util.py +35 -21
  147. data/vendor/pygments-main/scripts/check_sources.py +28 -44
  148. data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +5 -4
  149. data/vendor/pygments-main/scripts/find_codetags.py +27 -19
  150. data/vendor/pygments-main/scripts/find_error.py +16 -13
  151. data/vendor/pygments-main/scripts/get_vimkw.py +3 -3
  152. data/vendor/pygments-main/scripts/vim2pygments.py +9 -7
  153. data/vendor/pygments-main/setup.py +19 -19
  154. data/vendor/pygments-main/tests/examplefiles/99_bottles_of_beer.chpl +118 -0
  155. data/vendor/pygments-main/tests/examplefiles/Error.pmod +38 -0
  156. data/vendor/pygments-main/tests/examplefiles/FakeFile.pike +360 -0
  157. data/vendor/pygments-main/tests/examplefiles/{ANTLRv3.g → antlr_ANTLRv3.g} +0 -0
  158. data/vendor/pygments-main/tests/examplefiles/clojure-weird-keywords.clj +5 -0
  159. data/vendor/pygments-main/tests/examplefiles/core.cljs +52 -0
  160. data/vendor/pygments-main/tests/examplefiles/demo.cfm +13 -1
  161. data/vendor/pygments-main/tests/examplefiles/demo.hbs +12 -0
  162. data/vendor/pygments-main/tests/examplefiles/ember.handlebars +33 -0
  163. data/vendor/pygments-main/tests/examplefiles/example.als +217 -0
  164. data/vendor/pygments-main/tests/examplefiles/example.c +1 -1
  165. data/vendor/pygments-main/tests/examplefiles/example.chai +6 -0
  166. data/vendor/pygments-main/tests/examplefiles/example.coffee +27 -0
  167. data/vendor/pygments-main/tests/examplefiles/example.e +124 -0
  168. data/vendor/pygments-main/tests/examplefiles/example.f90 +8 -0
  169. data/vendor/pygments-main/tests/examplefiles/example.feature +16 -0
  170. data/vendor/pygments-main/tests/examplefiles/example.gd +23 -0
  171. data/vendor/pygments-main/tests/examplefiles/example.gi +64 -0
  172. data/vendor/pygments-main/tests/examplefiles/example.groovy +2 -0
  173. data/vendor/pygments-main/tests/examplefiles/example.hs +27 -0
  174. data/vendor/pygments-main/tests/examplefiles/example.hx +44 -1
  175. data/vendor/pygments-main/tests/examplefiles/example.i6t +32 -0
  176. data/vendor/pygments-main/tests/examplefiles/example.i7x +45 -0
  177. data/vendor/pygments-main/tests/examplefiles/example.inf +374 -0
  178. data/vendor/pygments-main/tests/examplefiles/example.j +564 -0
  179. data/vendor/pygments-main/tests/examplefiles/example.java +16 -0
  180. data/vendor/pygments-main/tests/examplefiles/example.kal +75 -0
  181. data/vendor/pygments-main/tests/examplefiles/example.liquid +42 -0
  182. data/vendor/pygments-main/tests/examplefiles/example.ma +8 -0
  183. data/vendor/pygments-main/tests/examplefiles/example.mq4 +187 -0
  184. data/vendor/pygments-main/tests/examplefiles/example.mqh +123 -0
  185. data/vendor/pygments-main/tests/examplefiles/example.ni +57 -0
  186. data/vendor/pygments-main/tests/examplefiles/example.nix +80 -0
  187. data/vendor/pygments-main/tests/examplefiles/example.pp +8 -0
  188. data/vendor/pygments-main/tests/examplefiles/example.red +257 -0
  189. data/vendor/pygments-main/tests/examplefiles/example.reds +150 -0
  190. data/vendor/pygments-main/tests/examplefiles/example.rkt +677 -29
  191. data/vendor/pygments-main/tests/examplefiles/example.sh +22 -0
  192. data/vendor/pygments-main/tests/examplefiles/example.slim +31 -0
  193. data/vendor/pygments-main/tests/examplefiles/example.sls +51 -0
  194. data/vendor/pygments-main/tests/examplefiles/example.stan +2 -0
  195. data/vendor/pygments-main/tests/examplefiles/example.todotxt +9 -0
  196. data/vendor/pygments-main/tests/examplefiles/exampleScript.cfc +241 -0
  197. data/vendor/pygments-main/tests/examplefiles/exampleTag.cfc +18 -0
  198. data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +192 -350
  199. data/vendor/pygments-main/tests/examplefiles/hash_syntax.rb +5 -0
  200. data/vendor/pygments-main/tests/examplefiles/hello.at +6 -0
  201. data/vendor/pygments-main/tests/examplefiles/hello.golo +5 -0
  202. data/vendor/pygments-main/tests/examplefiles/hello.lsl +12 -0
  203. data/vendor/pygments-main/tests/examplefiles/{File.hy → hybris_File.hy} +0 -0
  204. data/vendor/pygments-main/tests/examplefiles/{mg_sample.pro → idl_sample.pro} +0 -0
  205. data/vendor/pygments-main/tests/examplefiles/iex_example +23 -0
  206. data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +24 -24
  207. data/vendor/pygments-main/tests/examplefiles/language.hy +165 -0
  208. data/vendor/pygments-main/tests/examplefiles/limbo.b +456 -0
  209. data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +3 -1
  210. data/vendor/pygments-main/tests/examplefiles/main.cmake +2 -0
  211. data/vendor/pygments-main/tests/examplefiles/objc_example.m +163 -16
  212. data/vendor/pygments-main/tests/examplefiles/{example.p → openedge_example} +0 -0
  213. data/vendor/pygments-main/tests/examplefiles/pawn_example +25 -0
  214. data/vendor/pygments-main/tests/examplefiles/qbasic_example +2 -0
  215. data/vendor/pygments-main/tests/examplefiles/r6rs-comments.scm +23 -0
  216. data/vendor/pygments-main/tests/examplefiles/{robotframework.txt → robotframework_test.txt} +0 -0
  217. data/vendor/pygments-main/tests/examplefiles/rql-queries.rql +34 -0
  218. data/vendor/pygments-main/tests/examplefiles/scope.cirru +43 -0
  219. data/vendor/pygments-main/tests/examplefiles/sparql.rq +23 -0
  220. data/vendor/pygments-main/tests/examplefiles/test.R +37 -5
  221. data/vendor/pygments-main/tests/examplefiles/test.apl +26 -0
  222. data/vendor/pygments-main/tests/examplefiles/test.cyp +123 -0
  223. data/vendor/pygments-main/tests/examplefiles/test.idr +93 -0
  224. data/vendor/pygments-main/tests/examplefiles/test.mask +41 -0
  225. data/vendor/pygments-main/tests/examplefiles/test.pan +54 -0
  226. data/vendor/pygments-main/tests/examplefiles/test.php +3 -1
  227. data/vendor/pygments-main/tests/examplefiles/test.pig +148 -0
  228. data/vendor/pygments-main/tests/examplefiles/test.pwn +253 -0
  229. data/vendor/pygments-main/tests/examplefiles/test.r3 +27 -7
  230. data/vendor/pygments-main/tests/examplefiles/test.rsl +111 -0
  231. data/vendor/pygments-main/tests/examplefiles/test.swift +65 -0
  232. data/vendor/pygments-main/tests/examplefiles/test.zep +33 -0
  233. data/vendor/pygments-main/tests/examplefiles/unicode.go +10 -0
  234. data/vendor/pygments-main/tests/examplefiles/{test.bas → vbnet_test.bas} +0 -0
  235. data/vendor/pygments-main/tests/examplefiles/vctreestatus_hg +4 -0
  236. data/vendor/pygments-main/tests/examplefiles/vimrc +21 -0
  237. data/vendor/pygments-main/tests/run.py +14 -19
  238. data/vendor/pygments-main/tests/string_asserts.py +22 -0
  239. data/vendor/pygments-main/tests/test_basic_api.py +28 -14
  240. data/vendor/pygments-main/tests/test_cfm.py +46 -0
  241. data/vendor/pygments-main/tests/test_clexer.py +208 -3
  242. data/vendor/pygments-main/tests/test_cmdline.py +6 -5
  243. data/vendor/pygments-main/tests/test_examplefiles.py +30 -19
  244. data/vendor/pygments-main/tests/test_html_formatter.py +15 -13
  245. data/vendor/pygments-main/tests/test_latex_formatter.py +4 -2
  246. data/vendor/pygments-main/tests/test_lexers_other.py +11 -11
  247. data/vendor/pygments-main/tests/test_objectiveclexer.py +81 -0
  248. data/vendor/pygments-main/tests/test_perllexer.py +1 -1
  249. data/vendor/pygments-main/tests/test_qbasiclexer.py +43 -0
  250. data/vendor/pygments-main/tests/test_regexlexer.py +8 -1
  251. data/vendor/pygments-main/tests/test_rtf_formatter.py +109 -0
  252. data/vendor/pygments-main/tests/test_string_asserts.py +39 -0
  253. data/vendor/pygments-main/tests/test_token.py +3 -3
  254. data/vendor/pygments-main/tests/test_using_api.py +1 -1
  255. data/vendor/pygments-main/tests/test_util.py +1 -1
  256. metadata +138 -51
  257. data/vendor/pygments-main/docs/generate.py +0 -472
  258. data/vendor/pygments-main/docs/src/api.txt +0 -270
  259. data/vendor/pygments-main/docs/src/authors.txt +0 -5
  260. data/vendor/pygments-main/docs/src/changelog.txt +0 -5
  261. data/vendor/pygments-main/docs/src/index.txt +0 -69
  262. data/vendor/pygments-main/docs/src/installation.txt +0 -71
  263. data/vendor/pygments-main/external/rst-directive-old.py +0 -77
  264. data/vendor/pygments-main/scripts/reindent.py +0 -291
  265. data/vendor/pygments-main/tests/examplefiles/import.hs +0 -4
  266. data/vendor/pygments-main/tests/examplefiles/objc_example2.m +0 -24
  267. data/vendor/pygments-main/tests/old_run.py +0 -138
@@ -0,0 +1,8 @@
1
+ program main
2
+ integer, parameter :: mykind = selected_real_kind()
3
+ print *, 1
4
+ print *, 1_mykind
5
+ print *, 1.
6
+ print *, 1._mykind
7
+ print *, (1., 1._mykind)
8
+ end program main
@@ -0,0 +1,16 @@
1
+ # First comment
2
+ Feature: My amazing feature
3
+ Feature description line 1
4
+ Feature description line 2
5
+
6
+ #comment
7
+ Scenario Outline: My detailed scenario #string
8
+ Given That <x> is set
9
+ When When I <subtract>
10
+ Then I should get the <remain#der>
11
+
12
+ # indented comment
13
+ Examples:
14
+ | x | subtract | remain#der |
15
+ | 12 | 5\|3 | #73 |
16
+ | #the | 10 | 15 |
@@ -0,0 +1,23 @@
1
+ #############################################################################
2
+ ##
3
+ #W example.gd
4
+ ##
5
+ ## This file contains a sample of a GAP declaration file.
6
+ ##
7
+ DeclareProperty( "SomeProperty", IsLeftModule );
8
+ DeclareGlobalFunction( "SomeGlobalFunction" );
9
+
10
+
11
+ #############################################################################
12
+ ##
13
+ #C IsQuuxFrobnicator(<R>)
14
+ ##
15
+ ## <ManSection>
16
+ ## <Filt Name="IsQuuxFrobnicator" Arg='R' Type='Category'/>
17
+ ##
18
+ ## <Description>
19
+ ## Tests whether R is a quux frobnicator.
20
+ ## </Description>
21
+ ## </ManSection>
22
+ ##
23
+ DeclareSynonym( "IsQuuxFrobnicator", IsField and IsGroup );
@@ -0,0 +1,64 @@
1
+ #############################################################################
2
+ ##
3
+ #W example.gd
4
+ ##
5
+ ## This file contains a sample of a GAP implementation file.
6
+ ##
7
+
8
+
9
+ #############################################################################
10
+ ##
11
+ #M SomeOperation( <val> )
12
+ ##
13
+ ## performs some operation on <val>
14
+ ##
15
+ InstallMethod( SomeProperty,
16
+ "for left modules",
17
+ [ IsLeftModule ], 0,
18
+ function( M )
19
+ if IsFreeLeftModule( M ) and not IsTrivial( M ) then
20
+ return true;
21
+ fi;
22
+ TryNextMethod();
23
+ end );
24
+
25
+
26
+
27
+ #############################################################################
28
+ ##
29
+ #F SomeGlobalFunction( )
30
+ ##
31
+ ## A global variadic funfion.
32
+ ##
33
+ InstallGlobalFunction( SomeGlobalFunction, function( arg )
34
+ if Length( arg ) = 3 then
35
+ return arg[1] + arg[2] * arg[3];
36
+ elif Length( arg ) = 2 then
37
+ return arg[1] - arg[2]
38
+ else
39
+ Error( "usage: SomeGlobalFunction( <x>, <y>[, <z>] )" );
40
+ fi;
41
+ end );
42
+
43
+
44
+ #
45
+ # A plain function.
46
+ #
47
+ SomeFunc := function(x, y)
48
+ local z, func, tmp, j;
49
+ z := x * 1.0;
50
+ y := 17^17 - y;
51
+ func := a -> a mod 5;
52
+ tmp := List( [1..50], func );
53
+ while y > 0 do
54
+ for j in tmp do
55
+ Print(j, "\n");
56
+ od;
57
+ repeat
58
+ y := y - 1;
59
+ until 0 < 1;
60
+ y := y -1;
61
+ od;
62
+ return z;
63
+ end;
64
+
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env groovy
2
+ println "Hello World"
@@ -0,0 +1,27 @@
1
+ module ĈrazyThings where
2
+
3
+ import "base" Data.Char
4
+ import "base" Data.Char (isControl, isSpace)
5
+ import "base" Data.Char (isControl, --isSpace)
6
+ isSpace)
7
+ import "base" Data.Char (isControl, -- isSpace)
8
+ isSpace)
9
+
10
+ (-->) :: Num a => a -- signature
11
+ (-->) = 2 -- >implementation
12
+
13
+ --test comment
14
+ -- test comment
15
+
16
+ main :: IO ()
17
+ main = putStrLn "hello world"
18
+
19
+ gádd x y = x + y
20
+ ádd x y = x + y
21
+
22
+
23
+ data ĈrazyThings =
24
+ Ĉar |
25
+ House |
26
+ Peár
27
+ deriving (Show, Eq)
@@ -139,4 +139,47 @@ typedef Pt2 = {
139
139
  y:Float,
140
140
  ?z:Float, //optional z
141
141
  add : Point -> Void,
142
- }
142
+ }
143
+
144
+
145
+ //top-level class members
146
+ public function test();
147
+ private var attr(get, set) = 1;
148
+
149
+
150
+ //pre-proc number
151
+ public static inline function indexOf<T>(arr:Array<T>, v:T) : Int
152
+ {
153
+ #if (haxe_ver >= 3.1)
154
+ return arr.indexOf(v);
155
+ #else
156
+ #if (flash || js)
157
+ return untyped arr.indexOf(v);
158
+ #else
159
+ return std.Lambda.indexOf(arr, v);
160
+ #end
161
+ #end
162
+ }
163
+
164
+ //macro reification
165
+ var e = macro var $myVar = 0;
166
+ var e = macro ${v}.toLowerCase();
167
+ var e = macro o.$myField;
168
+ var e = macro { $myField : 0 };
169
+ var e = macro $i{varName}++;
170
+ var e = macro $v{myStr};
171
+ var args = [macro "sub", macro 3];
172
+ var e = macro "Hello".toLowerCase($a{args});
173
+ (macro $i{tmp}.addAtom($v{name}, $atom)).finalize(op.pos);
174
+
175
+ var c = macro class MyClass {
176
+ public function new() { }
177
+ public function $funcName() {
178
+ trace($v{funcName} + " was called");
179
+ }
180
+ }
181
+
182
+ var c = macro interface IClass {};
183
+
184
+ //ECheckType
185
+ var f = (123:Float);
@@ -0,0 +1,32 @@
1
+ B/examt: Example Template.
2
+
3
+ @Purpose: To show the syntax of I6T, specifically the parts relating to the
4
+ inclusion of I7 and at signs in the first column.
5
+
6
+ @-------------------------------------------------------------------------------
7
+
8
+ @p Lines.
9
+
10
+ @c
11
+ {-lines:type}
12
+ ! This is a comment.
13
+ {-endlines}
14
+
15
+ @-This line begins with @-, so it is ignored.
16
+
17
+ @p Paragraph.
18
+ This is a paragraph.
19
+ @p Another paragraph.
20
+ So
21
+
22
+ is
23
+
24
+ this.
25
+
26
+ @Purpose: This purpose line is ignored.
27
+
28
+ @c At signs and (+ +).
29
+ [ Foo i;
30
+ print (+score [an I7 value]+), "^";
31
+ @add sp 1 -> i; ! Assembly works even in the first column.
32
+ ];
@@ -0,0 +1,45 @@
1
+ example by David Corbett begins here.
2
+
3
+ "Implements testable examples."
4
+
5
+ An example is a kind of thing. An example can be tested. An example is seldom tested.
6
+
7
+ example ends here.
8
+
9
+ ----
10
+ [The] documentation [starts here.]
11
+ ----
12
+
13
+ This extension adds examples, which may be tested.
14
+
15
+ Chapter: Usage
16
+
17
+ To add an example to the story, we write:
18
+
19
+ The foobar is an example.
20
+
21
+ To interact with it in Inform 6, we write something like:
22
+
23
+ To say (E - example): (-
24
+ print (object) {E};
25
+ -).
26
+ [The IDE's documentation viewer does not display the closing -). I don't know how to fix that.]
27
+
28
+ Section: Testing
29
+
30
+ We can make an example be tested using:
31
+
32
+ now the foobar is tested;
33
+
34
+ Example: * Exempli Gratia - A simple example.
35
+
36
+ *: "Exempli Gratia"
37
+
38
+ Include example by David Corbett.
39
+
40
+ The Kitchen is a room. The egg is an example, here.
41
+
42
+ Before dropping the egg:
43
+ now the egg is tested.
44
+
45
+ Test me with "get egg / drop egg".
@@ -0,0 +1,374 @@
1
+ !% $SMALL ! This is ICL, not a comment.
2
+ !% -w
3
+
4
+ !% A comprehensive test of Inform6Lexer.
5
+
6
+ Switches d2SDq;
7
+
8
+ Constant Story "Informal Testing";
9
+ Constant Headline "^Not a game.^";!% This is a comment, not ICL.
10
+
11
+ Release 2;
12
+ Serial "140308";
13
+ Version 5;
14
+
15
+ Ifndef TARGET_ZCODE;
16
+ Ifndef TARGET_GLULX;
17
+ Ifndef WORDSIZE;
18
+ Default WORDSIZE 2;
19
+ Constant TARGET_ZCODE;
20
+ Endif;
21
+ Endif;
22
+ Endif;
23
+
24
+ Ifv3; Message "Compiling to version 3"; Endif;
25
+ Ifv5; Message "Not compiling to version 3"; endif;
26
+ ifdef TARGET_ZCODE;
27
+ #IFTRUE (#version_number == 5);
28
+ Message "Compiling to version 5";
29
+ #ENDIF;
30
+ endif ;
31
+
32
+ Replace CreatureTest;
33
+
34
+ Include "Parser";
35
+ Include "VerbLib";
36
+
37
+ # ! A hash is optional at the top level.
38
+ Object kitchen "Kitchen"
39
+ with description "You are in a kitchen.",
40
+ arr 1 2 3 4,
41
+ has light;
42
+
43
+ #[ Initialise;
44
+ location = kitchen;
45
+ print "v"; inversion; "^";
46
+ ];
47
+
48
+ Ifdef VN_1633;
49
+ Replace IsSeeThrough IsSeeThroughOrig;
50
+ [ IsSeeThrough * o;
51
+ return o hasnt opaque || IsSeeThroughOrig(o);
52
+ ];
53
+ Endif;
54
+
55
+ Abbreviate "test";
56
+
57
+ Array table buffer 260;
58
+
59
+ Attribute reversed;
60
+ Attribute opaque alias locked;
61
+ Constant to reversed;
62
+
63
+ Property long additive additive long alias;
64
+ Property long long long wingspan alias alias;
65
+
66
+ Class Flier with wingspan 5;
67
+ Class Bird(10) has animate class Flier with wingspan 2;
68
+
69
+ Constant Constant1;
70
+ Constant Constant2 Constant1;
71
+ Constant Constant3 = Constant2;
72
+ Ifdef VN_1633; Undef Constant; Endif;
73
+
74
+ Ifdef VN_1633;
75
+ Dictionary 'word' 1 2;
76
+ Ifnot;
77
+ Dictionary dict_word "word";
78
+ Endif;
79
+
80
+ Fake_action NotReal;
81
+
82
+ Global global1;
83
+ Global global2 = 69105;
84
+
85
+ Lowstring low_string "low string";
86
+
87
+ Iftrue false;
88
+ Message error "Uh-oh!^~false~ shouldn't be ~true~.";
89
+ Endif;
90
+ Iffalse true;
91
+ Message fatalerror "Uh-oh!^~true~ shouldn't be ~false~.";
92
+ Endif;
93
+
94
+ Nearby person "person"
95
+ with name 'person',
96
+ description "This person is barely implemented.",
97
+ life [ * x y z;
98
+ Ask: print_ret (The) self, " says nothing.";
99
+ Answer: print (The) self, " didn't say anything.^"; rfalse;
100
+ ]
101
+ has has animate transparent;
102
+
103
+ Object -> -> test_tube "test tube"
104
+ with name 'test' "tube" 'testtube',
105
+ has ~openable ~opaque container;
106
+
107
+ Bird -> pigeon
108
+ with name 'pigeon',
109
+ description [;
110
+ "The pigeon has a wingspan of ", self.&wingspan-->0, " wing units.";
111
+ ];
112
+
113
+ Object -> "thimble" with name 'thimble';
114
+
115
+ Object -> pebble "pebble" with name 'pebble';
116
+
117
+ Ifdef TARGET_ZCODE; Trace objects; Endif;
118
+
119
+ Statusline score;
120
+
121
+ Stub StubR 3;
122
+
123
+ Ifdef TARGET_ZCODE;
124
+ Zcharacter "abcdefghijklmnopqrstuvwxyz"
125
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
126
+ "123456789.,!?_#'0/@{005C}-:()";
127
+ Zcharacter table '@!!' '@<<' '@'A';
128
+ Zcharacter table + '@AE' '@{dc}' '@et' '@:y';
129
+ Ifnot;
130
+ Ifdef TARGET_GLULX;
131
+ Message "Glulx doesn't use ~Zcharacter~.^Oh well."; ! '~' and '^' work here.
132
+ Ifnot;
133
+ Message warning "Uh-oh! ^~^"; ! They don't work in other Messages.
134
+ Endif;
135
+ Endif;
136
+
137
+ Include "Grammar";
138
+
139
+ Verb"acquire"'collect'='take';
140
+
141
+ [ NounFilter; return noun ofclass Bird; ];
142
+
143
+ [ ScopeFilter obj;
144
+ switch (scope_stage) {
145
+ 1: rtrue;
146
+ 2: objectloop (obj in compass) PlaceInScope(obj);
147
+ 3: "Nothing is in scope.";
148
+ }
149
+ ];
150
+
151
+ Verb meta "t" 'test'
152
+ * 'held' held -> TestHeld
153
+ * number -> TestNumber
154
+ * reversed -> TestAttribute
155
+ * 'creature' creature -> TestCreature
156
+ * 'multiheld' multiheld -> TestMultiheld
157
+ * 'm' multiexcept 'into'/"in" noun -> TestMultiexcept
158
+ * 'm' multiinside 'from' noun -> TestMultiinside
159
+ * multi -> TestMulti
160
+ * 'filter'/'f' noun=NounFilter -> TestNounFilter
161
+ * 'filter'/'f' scope=ScopeFilter -> TestScopeFilter
162
+ * 'special' special -> TestSpecial
163
+ * topic -> TestTopic;
164
+
165
+ Verb 'reverse' 'swap' 'exchange'
166
+ * held 'for' noun -> reverse
167
+ * noun 'with' noun -> reverse reverse;
168
+
169
+ Extend "t" last * noun -> TestNoun;
170
+
171
+ Extend 't' first * -> Test;
172
+
173
+ Extend 'wave' replace * -> NewWave;
174
+
175
+ Extend only 'feel' 'touch' replace * noun -> Feel;
176
+
177
+ [ TestSub a b o;
178
+ string 25 low_string;
179
+ print "Test what?> ";
180
+ table->0 = 260;
181
+ parse->0 = 61;
182
+ #Ifdef TARGET_ZCODE;
183
+ read buffer parse;
184
+ #Ifnot; ! TARGET_GLULX
185
+ KeyboardPrimitive(buffer, parse);
186
+ #Endif; ! TARGET_
187
+ switch (parse-->1) {
188
+ 'save':
189
+ #Ifdef TARGET_ZCODE;
190
+ #Ifv3;
191
+ @save ?saved;
192
+ #Ifnot;
193
+ save saved;
194
+ #Endif;
195
+ #Endif;
196
+ print "Saving failed.^";
197
+ 'restore':
198
+ #Ifdef TARGET_ZCODE;
199
+ restore saved;
200
+ #Endif;
201
+ print "Restoring failed.^";
202
+ 'restart':
203
+ @restart;
204
+ 'quit', 'q//':
205
+ quit;
206
+ return 2; rtrue; rfalse; return;
207
+ 'print', 'p//':
208
+ print "Print:^",
209
+ " (string): ", (string) "xyzzy^",
210
+ " (number): ", (number) 123, "^",
211
+ " (char): ", (char) 'x', "^",
212
+ " (address): ", (address) 'plugh//p', "^",
213
+ " (The): ", (The) person, "^",
214
+ " (the): ", (the) person, "^",
215
+ " (A): ", (A) person, "^",
216
+ " (a): ", (a) person, "^",
217
+ " (an): ", (an) person, "^",
218
+ " (name): ", (name) person, "^",
219
+ " (object): ", (object) person, "^",
220
+ " (property): ", (property) alias, "^",
221
+ " (<routine>): ", (LanguageNumber) 123, "^",
222
+ " <expression>: ", a * 2 - 1, "^",
223
+ " (<expression>): ", (a + person), "^";
224
+ print "Escapes:^",
225
+ " by mnemonic: @!! @<< @'A @AE @et @:y^",
226
+ " by decimal value: @@64 @@126^",
227
+ " by Unicode value: @{DC}@{002b}^",
228
+ " by string variable: @25^";
229
+ 'font', 'style':
230
+ font off; print "font off^";
231
+ font on; print "font on^";
232
+ style reverse; print "style reverse^"; style roman;
233
+ style bold; print "style bold^";
234
+ style underline; print "style underline^";
235
+ style fixed; print "style fixed^";
236
+ style roman; print "style roman^";
237
+ 'statements':
238
+ spaces 8;
239
+ objectloop (o) {
240
+ print "objectloop (o): ", (the) o, "^";
241
+ }
242
+ objectloop (o in compass) { ! 'in' is a keyword
243
+ print "objectloop (o in compass): ", (the) o, "^";
244
+ }
245
+ objectloop (o in compass && true) { ! 'in' is an operator
246
+ print "objectloop (o in compass && true): ", (the) o, "^";
247
+ }
248
+ objectloop (o from se_obj) {
249
+ print "objectloop (o from se_obj): ", (the) o, "^";
250
+ }
251
+ objectloop (o near person) {
252
+ print "objectloop (o near person): ", (the) o, "^";
253
+ }
254
+ #Ifdef TARGET_ZCODE;
255
+ #Trace assembly on;
256
+ @ ! This is assembly.
257
+ add -4 ($$1+$3)*2 -> b;
258
+ @get_sibling test_tube -> b ?saved;
259
+ @inc [b];
260
+ @je sp (1+3*0) ? equal;
261
+ @je 1 ((sp)) ?~ different;
262
+ .! This is a label:
263
+ equal;
264
+ print "sp == 1^";
265
+ jump label;
266
+ .different;
267
+ print "sp @@126= 1^";
268
+ .label;
269
+ #Trace off; #Endif; ! TARGET_ZCODE
270
+ a = random(10);
271
+ switch (a) {
272
+ 1, 9:
273
+ box "Testing oneself is best when done alone."
274
+ " -- Jimmy Carter";
275
+ 2, 6, to, 3 to 5, to to to:
276
+ <Take pigeon>;
277
+ #Ifdef VN_1633;
278
+ <Jump, person>;
279
+ #Endif;
280
+ a = ##Drop;
281
+ < ! The angle brackets may be separated by whitespace.
282
+ < (a) pigeon > >;
283
+ default:
284
+ do {
285
+ give person general ~general;
286
+ } until (person provides life && ~~false);
287
+ if (a == 7) a = 4;
288
+ else a = 5;
289
+ }
290
+ 'expressions':
291
+ a = 1+1-1*1/1%1&1|1&&1||1==(1~=(1>(1<(1>=(1<=1)))));
292
+ a++; ++a; a--; --a;
293
+ a = person.life;
294
+ a = kitchen.&arr;
295
+ a = kitchen.#arr;
296
+ a = Bird::wingspan;
297
+ a = kitchen has general;
298
+ a = kitchen hasnt general;
299
+ a = kitchen provides arr;
300
+ a = person in kitchen;
301
+ a = person notin kitchen;
302
+ a = person ofclass Bird;
303
+ a = a == 0 or 1;
304
+ a = StubR();
305
+ a = StubR(a);
306
+ a = StubR(, a);
307
+ a = "string";
308
+ a = 'word';
309
+ a = '''; ! character
310
+ a = $09afAF;
311
+ a = $$01;
312
+ a = ##Eat; a = #a$Eat;
313
+ a = #g$self;
314
+ a = #n$!word;
315
+ a = #r$StubR;
316
+ a = #dict_par1;
317
+ default:
318
+ for (a = 2, b = a; (a < buffer->1 + 2) && (Bird::wingspan): ++a, b--) {
319
+ print (char) buffer->a;
320
+ }
321
+ new_line;
322
+ for (::) break;
323
+ }
324
+ .saved;;
325
+ ];
326
+
327
+ [ TestNumberSub;
328
+ print_ret parsed_number, " is ", (number) parsed_number, ".";
329
+ ];
330
+
331
+ [ TestAttributeSub; print_ret (The) noun, " has been reversed."; ];
332
+
333
+ [ CreatureTest obj; return obj has animate; ];
334
+
335
+ [ TestCreatureSub; print_ret (The) noun, " is a creature."; ];
336
+
337
+ [ TestMultiheldSub; print_ret "You are holding ", (the) noun, "."; ];
338
+
339
+ [ TestMultiexceptSub; "You test ", (the) noun, " with ", (the) second, "."; ];
340
+
341
+ [ TestMultiinsideSub; "You test ", (the) noun, " from ", (the) second, "."; ];
342
+
343
+ [ TestMultiSub; print_ret (The) noun, " is a thing."; ];
344
+
345
+ [ TestNounFilterSub; print_ret (The) noun, " is a bird."; ];
346
+
347
+ [ TestScopeFilterSub; print_ret (The) noun, " is a direction."; ];
348
+
349
+ [ TestSpecialSub; "Your lucky number is ", parsed_number, "."; ];
350
+
351
+ [ TestTopicSub; "You discuss a topic."; ];
352
+
353
+ [ TestNounSub; "That is ", (a) noun, "."; ];
354
+
355
+ [ TestHeldSub; "You are holding ", (a) noun, "."; ];
356
+
357
+ [ NewWaveSub; "That would be foolish."; ];
358
+
359
+ [ FeelSub; print_ret (The) noun, " feels normal."; ];
360
+
361
+ [ ReverseSub from;
362
+ from = parent(noun);
363
+ move noun to parent(second);
364
+ if (from == to)
365
+ move second to to;
366
+ else
367
+ move second to from;
368
+ give noun to;
369
+ from = to;
370
+ give second from;
371
+ "You swap ", (the) noun, " and ", (the) second, ".";
372
+ ];
373
+
374
+ End: The End directive ends the source code.