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
@@ -1,4 +1,11 @@
1
1
  <!--- cfcomment --->
2
+ <!--- nested <!--- cfcomment ---> --->
3
+ <!--- multi-line
4
+ nested
5
+ <!---
6
+ cfcomment
7
+ --->
8
+ --->
2
9
  <!-- html comment -->
3
10
  <html>
4
11
  <head>
@@ -17,6 +24,9 @@
17
24
  #IsDate("foo")#<br />
18
25
  #DaysInMonth(RightNow)#
19
26
  </cfoutput>
27
+ <cfset x="x">
28
+ <cfset y="y">
29
+ <cfset z="z">
20
30
  <cfoutput group="x">
21
31
  #x#
22
32
  <cfoutput>#y#</cfoutput>
@@ -29,10 +39,12 @@
29
39
  <cfset greeting = "Hello #person#">
30
40
 
31
41
  <cfset greeting = "Hello" & " world!">
42
+ <cfset a = 5>
43
+ <cfset b = 10>
32
44
  <cfset c = a^b>
33
45
  <cfset c = a MOD b>
34
46
  <cfset c = a / b>
35
47
  <cfset c = a * b>
36
48
  <cfset c = a + b>
37
49
  <cfset c = a - b>
38
-
50
+ <!--- <!-- another <!--- nested --> ---> comment --->
@@ -0,0 +1,12 @@
1
+ <!-- post.handlebars -->
2
+
3
+ <div class='intro'>
4
+ {{intro}}
5
+ </div>
6
+
7
+ {{#if isExpanded}}
8
+ <div class='body'>{{body}}</div>
9
+ <button {{action contract}}>Contract</button>
10
+ {{else}}
11
+ <button {{action expand}}>Show More...</button>
12
+ {{/if}}
@@ -0,0 +1,33 @@
1
+ {{#view EmberFirebaseChat.ChatView class="chat-container"}}
2
+ <div class="chat-messages-container">
3
+ <ul class="chat-messages">
4
+ {{#each message in content}}
5
+ <li>
6
+ [{{formatTimestamp "message.timestamp" fmtString="h:mm:ss A"}}]
7
+ <strong>{{message.sender}}</strong>: {{message.content}}
8
+ </li>
9
+ {{/each}}
10
+ </ul>
11
+ </div>
12
+
13
+ {{! Comment }}
14
+ {{{unescaped value}}}
15
+
16
+ {{#view EmberFirebaseChat.InputView class="chat-input-container"}}
17
+ <form class="form-inline">
18
+ {{#if "auth.authed"}}
19
+ {{#if "auth.hasName"}}
20
+ <input type="text" id="message" placeholder="Message">
21
+ <button {{action "postMessage" target="view"}} class="btn">Send</button>
22
+ {{else}}
23
+ <input type="text" id="username" placeholder="Enter your username...">
24
+ <button {{action "pickName" target="view"}} class="btn">Send</button>
25
+ {{/if}}
26
+ {{else}}
27
+ <input type="text" placeholder="Log in with Persona to chat!" disabled="disabled">
28
+ <button {{action "login"}} class="btn">Login</button>
29
+ {{/if}}
30
+ </form>
31
+ {{/view}}
32
+ {{/view}}
33
+
@@ -0,0 +1,217 @@
1
+ module examples/systems/views
2
+
3
+ /*
4
+ * Model of views in object-oriented programming.
5
+ *
6
+ * Two object references, called the view and the backing,
7
+ * are related by a view mechanism when changes to the
8
+ * backing are automatically propagated to the view. Note
9
+ * that the state of a view need not be a projection of the
10
+ * state of the backing; the keySet method of Map, for
11
+ * example, produces two view relationships, and for the
12
+ * one in which the map is modified by changes to the key
13
+ * set, the value of the new map cannot be determined from
14
+ * the key set. Note that in the iterator view mechanism,
15
+ * the iterator is by this definition the backing object,
16
+ * since changes are propagated from iterator to collection
17
+ * and not vice versa. Oddly, a reference may be a view of
18
+ * more than one backing: there can be two iterators on the
19
+ * same collection, eg. A reference cannot be a view under
20
+ * more than one view type.
21
+ *
22
+ * A reference is made dirty when it is a backing for a view
23
+ * with which it is no longer related by the view invariant.
24
+ * This usually happens when a view is modified, either
25
+ * directly or via another backing. For example, changing a
26
+ * collection directly when it has an iterator invalidates
27
+ * it, as does changing the collection through one iterator
28
+ * when there are others.
29
+ *
30
+ * More work is needed if we want to model more closely the
31
+ * failure of an iterator when its collection is invalidated.
32
+ *
33
+ * As a terminological convention, when there are two
34
+ * complementary view relationships, we will give them types
35
+ * t and t'. For example, KeySetView propagates from map to
36
+ * set, and KeySetView' propagates from set to map.
37
+ *
38
+ * author: Daniel Jackson
39
+ */
40
+
41
+ open util/ordering[State] as so
42
+ open util/relation as rel
43
+
44
+ sig Ref {}
45
+ sig Object {}
46
+
47
+ -- t->b->v in views when v is view of type t of backing b
48
+ -- dirty contains refs that have been invalidated
49
+ sig State {
50
+ refs: set Ref,
51
+ obj: refs -> one Object,
52
+ views: ViewType -> refs -> refs,
53
+ dirty: set refs
54
+ -- , anyviews: Ref -> Ref -- for visualization
55
+ }
56
+ -- {anyviews = ViewType.views}
57
+
58
+ sig Map extends Object {
59
+ keys: set Ref,
60
+ map: keys -> one Ref
61
+ }{all s: State | keys + Ref.map in s.refs}
62
+ sig MapRef extends Ref {}
63
+ fact {State.obj[MapRef] in Map}
64
+
65
+ sig Iterator extends Object {
66
+ left, done: set Ref,
67
+ lastRef: lone done
68
+ }{all s: State | done + left + lastRef in s.refs}
69
+ sig IteratorRef extends Ref {}
70
+ fact {State.obj[IteratorRef] in Iterator}
71
+
72
+ sig Set extends Object {
73
+ elts: set Ref
74
+ }{all s: State | elts in s.refs}
75
+ sig SetRef extends Ref {}
76
+ fact {State.obj[SetRef] in Set}
77
+
78
+ abstract sig ViewType {}
79
+ one sig KeySetView, KeySetView', IteratorView extends ViewType {}
80
+ fact ViewTypes {
81
+ State.views[KeySetView] in MapRef -> SetRef
82
+ State.views[KeySetView'] in SetRef -> MapRef
83
+ State.views[IteratorView] in IteratorRef -> SetRef
84
+ all s: State | s.views[KeySetView] = ~(s.views[KeySetView'])
85
+ }
86
+
87
+ /**
88
+ * mods is refs modified directly or by view mechanism
89
+ * doesn't handle possibility of modifying an object and its view at once?
90
+ * should we limit frame conds to non-dirty refs?
91
+ */
92
+ pred modifies [pre, post: State, rs: set Ref] {
93
+ let vr = pre.views[ViewType], mods = rs.*vr {
94
+ all r: pre.refs - mods | pre.obj[r] = post.obj[r]
95
+ all b: mods, v: pre.refs, t: ViewType |
96
+ b->v in pre.views[t] => viewFrame [t, pre.obj[v], post.obj[v], post.obj[b]]
97
+ post.dirty = pre.dirty +
98
+ {b: pre.refs | some v: Ref, t: ViewType |
99
+ b->v in pre.views[t] && !viewFrame [t, pre.obj[v], post.obj[v], post.obj[b]]
100
+ }
101
+ }
102
+ }
103
+
104
+ pred allocates [pre, post: State, rs: set Ref] {
105
+ no rs & pre.refs
106
+ post.refs = pre.refs + rs
107
+ }
108
+
109
+ /**
110
+ * models frame condition that limits change to view object from v to v' when backing object changes to b'
111
+ */
112
+ pred viewFrame [t: ViewType, v, v', b': Object] {
113
+ t in KeySetView => v'.elts = dom [b'.map]
114
+ t in KeySetView' => b'.elts = dom [v'.map]
115
+ t in KeySetView' => (b'.elts) <: (v.map) = (b'.elts) <: (v'.map)
116
+ t in IteratorView => v'.elts = b'.left + b'.done
117
+ }
118
+
119
+ pred MapRef.keySet [pre, post: State, setRefs: SetRef] {
120
+ post.obj[setRefs].elts = dom [pre.obj[this].map]
121
+ modifies [pre, post, none]
122
+ allocates [pre, post, setRefs]
123
+ post.views = pre.views + KeySetView->this->setRefs + KeySetView'->setRefs->this
124
+ }
125
+
126
+ pred MapRef.put [pre, post: State, k, v: Ref] {
127
+ post.obj[this].map = pre.obj[this].map ++ k->v
128
+ modifies [pre, post, this]
129
+ allocates [pre, post, none]
130
+ post.views = pre.views
131
+ }
132
+
133
+ pred SetRef.iterator [pre, post: State, iterRef: IteratorRef] {
134
+ let i = post.obj[iterRef] {
135
+ i.left = pre.obj[this].elts
136
+ no i.done + i.lastRef
137
+ }
138
+ modifies [pre,post,none]
139
+ allocates [pre, post, iterRef]
140
+ post.views = pre.views + IteratorView->iterRef->this
141
+ }
142
+
143
+ pred IteratorRef.remove [pre, post: State] {
144
+ let i = pre.obj[this], i' = post.obj[this] {
145
+ i'.left = i.left
146
+ i'.done = i.done - i.lastRef
147
+ no i'.lastRef
148
+ }
149
+ modifies [pre,post,this]
150
+ allocates [pre, post, none]
151
+ pre.views = post.views
152
+ }
153
+
154
+ pred IteratorRef.next [pre, post: State, ref: Ref] {
155
+ let i = pre.obj[this], i' = post.obj[this] {
156
+ ref in i.left
157
+ i'.left = i.left - ref
158
+ i'.done = i.done + ref
159
+ i'.lastRef = ref
160
+ }
161
+ modifies [pre, post, this]
162
+ allocates [pre, post, none]
163
+ pre.views = post.views
164
+ }
165
+
166
+ pred IteratorRef.hasNext [s: State] {
167
+ some s.obj[this].left
168
+ }
169
+
170
+ assert zippishOK {
171
+ all
172
+ ks, vs: SetRef,
173
+ m: MapRef,
174
+ ki, vi: IteratorRef,
175
+ k, v: Ref |
176
+ let s0=so/first,
177
+ s1=so/next[s0],
178
+ s2=so/next[s1],
179
+ s3=so/next[s2],
180
+ s4=so/next[s3],
181
+ s5=so/next[s4],
182
+ s6=so/next[s5],
183
+ s7=so/next[s6] |
184
+ ({
185
+ precondition [s0, ks, vs, m]
186
+ no s0.dirty
187
+ ks.iterator [s0, s1, ki]
188
+ vs.iterator [s1, s2, vi]
189
+ ki.hasNext [s2]
190
+ vi.hasNext [s2]
191
+ ki.this/next [s2, s3, k]
192
+ vi.this/next [s3, s4, v]
193
+ m.put [s4, s5, k, v]
194
+ ki.remove [s5, s6]
195
+ vi.remove [s6, s7]
196
+ } => no State.dirty)
197
+ }
198
+
199
+ pred precondition [pre: State, ks, vs, m: Ref] {
200
+ // all these conditions and other errors discovered in scope of 6 but 8,3
201
+ // in initial state, must have view invariants hold
202
+ (all t: ViewType, b, v: pre.refs |
203
+ b->v in pre.views[t] => viewFrame [t, pre.obj[v], pre.obj[v], pre.obj[b]])
204
+ // sets are not aliases
205
+ -- ks != vs
206
+ // sets are not views of map
207
+ -- no (ks+vs)->m & ViewType.pre.views
208
+ // no iterator currently on either set
209
+ -- no Ref->(ks+vs) & ViewType.pre.views
210
+ }
211
+
212
+ check zippishOK for 6 but 8 State, 3 ViewType expect 1
213
+
214
+ /**
215
+ * experiment with controlling heap size
216
+ */
217
+ fact {all s: State | #s.obj < 5}
@@ -195,7 +195,7 @@ char convertType(int type) {
195
195
  case TYPE_INT: return 'I';
196
196
  case TYPE_FLOAT: return 'F';
197
197
  case TYPE_BOOLEAN: return 'Z';
198
- default: yyerror("compiler-intern error in convertType().\n");
198
+ default : yyerror("compiler-intern error in convertType().\n");
199
199
  }
200
200
  return 0; /* to avoid compiler-warning */
201
201
  }
@@ -0,0 +1,6 @@
1
+ var f = fun(x) { x + 2; }
2
+ // comment
3
+ puts(someFunc(2 + 2 - 1 * 5 / 4));
4
+ var x = "str";
5
+ def dosomething(lhs, rhs) { print("lhs: ${lhs}, rhs: ${rhs}"); }
6
+ callfunc(`+`, 1, 4);
@@ -0,0 +1,27 @@
1
+ # function arrows
2
+
3
+ methodA:-> 'A'
4
+ methodB:=> 'B'
5
+ methodC:()=> 'C'
6
+ methodD:()-> 'D'
7
+ methodE:(a,b)-> 'E'
8
+ methodF:(c,d)-> 'F'
9
+ -> 'G'
10
+ => 'H'
11
+
12
+ (-> 'I')
13
+ (=> 'J')
14
+
15
+ # strings
16
+
17
+ "#{wow}"
18
+ "w#{wow}w"
19
+ "#wow"
20
+ "wow#"
21
+ "w#ow"
22
+
23
+ '#{wow}'
24
+ 'w#{wow}w'
25
+ '#wow'
26
+ 'wow#'
27
+ 'w#ow'
@@ -0,0 +1,124 @@
1
+ note
2
+ description : "[
3
+ This is use to have almost every language element."
4
+
5
+ That way, I can correctly test the lexer. %]"
6
+
7
+ Don't try to understand what it does. It's not even compilling.
8
+ ]"
9
+ date : "August 6, 2013"
10
+ revision : "0.1"
11
+
12
+ class
13
+ SAMPLE
14
+
15
+ inherit
16
+ ARGUMENTS
17
+ rename
18
+ Command_line as Caller_command,
19
+ command_name as Application_name
20
+ undefine
21
+ out
22
+ end
23
+ ANY
24
+ export
25
+ {ANY} out
26
+ redefine
27
+ out
28
+ end
29
+
30
+
31
+
32
+ create
33
+ make
34
+
35
+ convert
36
+ as_boolean: {BOOLEAN}
37
+
38
+ feature {NONE} -- Initialization
39
+
40
+ make
41
+ -- Run application.
42
+ local
43
+ i1_:expanded INTEGER
44
+ f_1:REAL_64
45
+ l_char:CHARACTER_8
46
+ do
47
+ l_char:='!'
48
+ l_char:='%''
49
+ l_char:='%%'
50
+ i1_:=80 - 0x2F0C // 0C70 \\ 0b10110 * 1;
51
+ f_1:=0.1 / .567
52
+ f_1:=34.
53
+ f_1:=12345.67890
54
+ inspect i1_
55
+ when 1 then
56
+ io.output.put_integer (i1_) -- Comment
57
+ else
58
+ io.output.put_real (f_1.truncated_to_real)
59
+ end
60
+ io.output.put_string (CuRrEnt.out) -- Comment
61
+ (agent funct_1).call([1,2,"Coucou"])
62
+ end
63
+
64
+ feature -- Access
65
+
66
+ funct_1(x,y:separate INTEGER;a_text:READABLE_STRING_GENERAL):detachable BOOLEAN
67
+ obsolete "This function is obsolete"
68
+ require
69
+ Is_Attached: AttAched a_text
70
+ local
71
+ l_list:LIST[like x]
72
+ do
73
+ if (NOT a_text.is_empty=TrUe or elSe ((x<0 aNd x>10) oR (y>0 and then y<10))) xor True thEn
74
+ ResuLT := FalSe
75
+ elseif (acROss l_list as la_list SoMe la_list.item<0 end) implies a_text.is_boolean then
76
+ ResuLT := FalSe
77
+ else
78
+ Result := TruE
79
+ eND
80
+ from
81
+ l_list.start
82
+ until
83
+ l_list.exhausted
84
+ loop
85
+ l_list.forth
86
+ variant
87
+ l_list.count - l_list.index
88
+ end
89
+ check Current /= Void end
90
+ debug print("%"Here%"%N") end
91
+ ensure
92
+ Is_Cool_Not_Change: is_cool = old is_cool
93
+ end
94
+
95
+ is_cool:BOOLEAN
96
+ attribute
97
+ Result:=False
98
+ end
99
+
100
+ froZen c_malloc: POINTER is
101
+ exTErnal
102
+ "C inline use <stdlib.h>"
103
+ alIAs
104
+ "malloc (1)"
105
+ end
106
+
107
+ as_boolean:BOOLEAN
108
+ do
109
+ Result:=True
110
+ rescue
111
+ retry
112
+ end
113
+
114
+ feature {ANY} -- The redefine feature
115
+
116
+ out:STRING_8
117
+ once
118
+ reSUlt:=PrecursOr {ANY}
119
+ Result := "Hello Worl"+('d').out
120
+ end
121
+
122
+ invariant
123
+ Always_Cool: is_cool
124
+ end