guard-mthaml 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +34 -0
  3. data/lib/guard/mthaml.rb +140 -0
  4. data/lib/guard/mthaml/compiler/MtHaml.php +255 -0
  5. data/lib/guard/mthaml/templates/Guardfile +12 -0
  6. data/lib/guard/mthaml/version.rb +5 -0
  7. data/vendor/autoload.php +7 -0
  8. data/vendor/coffeescript/coffeescript/LICENSE +22 -0
  9. data/vendor/coffeescript/coffeescript/README.md +96 -0
  10. data/vendor/coffeescript/coffeescript/composer.json +23 -0
  11. data/vendor/coffeescript/coffeescript/grammar.y +309 -0
  12. data/vendor/coffeescript/coffeescript/make.php +115 -0
  13. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Compiler.php +76 -0
  14. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Error.php +15 -0
  15. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Helpers.php +116 -0
  16. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Init.php +96 -0
  17. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Lexer.php +1356 -0
  18. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Nodes.php +105 -0
  19. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Parser.php +3326 -0
  20. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Rewriter.php +552 -0
  21. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Scope.php +196 -0
  22. data/vendor/coffeescript/coffeescript/src/CoffeeScript/SyntaxError.php +9 -0
  23. data/vendor/coffeescript/coffeescript/src/CoffeeScript/Value.php +20 -0
  24. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Access.php +31 -0
  25. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Arr.php +69 -0
  26. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Assign.php +353 -0
  27. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Base.php +288 -0
  28. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Block.php +294 -0
  29. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Call.php +283 -0
  30. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Class.php +282 -0
  31. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Closure.php +49 -0
  32. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Code.php +203 -0
  33. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Comment.php +39 -0
  34. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Existence.php +42 -0
  35. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Extends.php +26 -0
  36. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/For.php +250 -0
  37. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/If.php +161 -0
  38. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/In.php +99 -0
  39. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Index.php +27 -0
  40. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Literal.php +96 -0
  41. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Obj.php +126 -0
  42. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Op.php +292 -0
  43. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Param.php +119 -0
  44. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Parens.php +45 -0
  45. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Range.php +225 -0
  46. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Return.php +56 -0
  47. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Slice.php +47 -0
  48. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Splat.php +100 -0
  49. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Switch.php +121 -0
  50. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Throw.php +37 -0
  51. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Try.php +79 -0
  52. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Value.php +210 -0
  53. data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/While.php +112 -0
  54. data/vendor/coffeescript/coffeescript/tests/cases/arrays.coffee +77 -0
  55. data/vendor/coffeescript/coffeescript/tests/cases/assignment.coffee +352 -0
  56. data/vendor/coffeescript/coffeescript/tests/cases/booleans.coffee +21 -0
  57. data/vendor/coffeescript/coffeescript/tests/cases/classes.coffee +681 -0
  58. data/vendor/coffeescript/coffeescript/tests/cases/comments.coffee +207 -0
  59. data/vendor/coffeescript/coffeescript/tests/cases/compilation.coffee +72 -0
  60. data/vendor/coffeescript/coffeescript/tests/cases/comprehensions.coffee +501 -0
  61. data/vendor/coffeescript/coffeescript/tests/cases/control_flow.coffee +430 -0
  62. data/vendor/coffeescript/coffeescript/tests/cases/eval.coffee +29 -0
  63. data/vendor/coffeescript/coffeescript/tests/cases/exception_handling.coffee +102 -0
  64. data/vendor/coffeescript/coffeescript/tests/cases/formatting.coffee +146 -0
  65. data/vendor/coffeescript/coffeescript/tests/cases/function_invocation.coffee +552 -0
  66. data/vendor/coffeescript/coffeescript/tests/cases/functions.coffee +188 -0
  67. data/vendor/coffeescript/coffeescript/tests/cases/helpers.coffee +96 -0
  68. data/vendor/coffeescript/coffeescript/tests/cases/importing.coffee +18 -0
  69. data/vendor/coffeescript/coffeescript/tests/cases/interpolation.coffee +138 -0
  70. data/vendor/coffeescript/coffeescript/tests/cases/javascript_literals.coffee +10 -0
  71. data/vendor/coffeescript/coffeescript/tests/cases/numbers.coffee +76 -0
  72. data/vendor/coffeescript/coffeescript/tests/cases/objects.coffee +271 -0
  73. data/vendor/coffeescript/coffeescript/tests/cases/operators.coffee +277 -0
  74. data/vendor/coffeescript/coffeescript/tests/cases/option_parser.coffee +43 -0
  75. data/vendor/coffeescript/coffeescript/tests/cases/ranges.coffee +88 -0
  76. data/vendor/coffeescript/coffeescript/tests/cases/regexps.coffee +63 -0
  77. data/vendor/coffeescript/coffeescript/tests/cases/scope.coffee +43 -0
  78. data/vendor/coffeescript/coffeescript/tests/cases/slicing_and_splicing.coffee +143 -0
  79. data/vendor/coffeescript/coffeescript/tests/cases/soaks.coffee +134 -0
  80. data/vendor/coffeescript/coffeescript/tests/cases/strict.coffee +155 -0
  81. data/vendor/coffeescript/coffeescript/tests/cases/strings.coffee +107 -0
  82. data/vendor/coffeescript/coffeescript/tests/css/style.css +43 -0
  83. data/vendor/coffeescript/coffeescript/tests/index.php +119 -0
  84. data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.1.1.js +8 -0
  85. data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.2.0.js +8 -0
  86. data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.3.0.js +8 -0
  87. data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.3.1.js +8 -0
  88. data/vendor/coffeescript/coffeescript/tests/js/lib/diff.js +276 -0
  89. data/vendor/coffeescript/coffeescript/tests/js/main.js +123 -0
  90. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/LICENSE.txt +10 -0
  91. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/Lempar.php +948 -0
  92. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Action.php +257 -0
  93. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/ActionTable.php +299 -0
  94. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Config.php +574 -0
  95. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Data.php +1857 -0
  96. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Parser.php +851 -0
  97. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/PropagationLink.php +126 -0
  98. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Rule.php +144 -0
  99. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/State.php +283 -0
  100. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Symbol.php +288 -0
  101. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/cli.php +5 -0
  102. data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/ParserGenerator.php +811 -0
  103. data/vendor/composer/ClassLoader.php +383 -0
  104. data/vendor/composer/autoload_classmap.php +9 -0
  105. data/vendor/composer/autoload_namespaces.php +12 -0
  106. data/vendor/composer/autoload_psr4.php +10 -0
  107. data/vendor/composer/autoload_real.php +50 -0
  108. data/vendor/composer/installed.json +166 -0
  109. data/vendor/michelf/php-markdown/License.md +36 -0
  110. data/vendor/michelf/php-markdown/Michelf/Markdown.inc.php +10 -0
  111. data/vendor/michelf/php-markdown/Michelf/Markdown.php +3117 -0
  112. data/vendor/michelf/php-markdown/Michelf/MarkdownExtra.inc.php +11 -0
  113. data/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php +38 -0
  114. data/vendor/michelf/php-markdown/Michelf/MarkdownInterface.inc.php +9 -0
  115. data/vendor/michelf/php-markdown/Michelf/MarkdownInterface.php +37 -0
  116. data/vendor/michelf/php-markdown/Readme.md +305 -0
  117. data/vendor/michelf/php-markdown/Readme.php +31 -0
  118. data/vendor/michelf/php-markdown/composer.json +31 -0
  119. data/vendor/mthaml/mthaml/CHANGELOG +48 -0
  120. data/vendor/mthaml/mthaml/LICENSE +44 -0
  121. data/vendor/mthaml/mthaml/README.markdown +262 -0
  122. data/vendor/mthaml/mthaml/composer.json +45 -0
  123. data/vendor/mthaml/mthaml/docs/Makefile +153 -0
  124. data/vendor/mthaml/mthaml/docs/_static/mthaml.css +30 -0
  125. data/vendor/mthaml/mthaml/docs/_theme/mthaml/theme.conf +4 -0
  126. data/vendor/mthaml/mthaml/docs/conf.py +242 -0
  127. data/vendor/mthaml/mthaml/docs/index.rst +18 -0
  128. data/vendor/mthaml/mthaml/docs/twig-syntax.rst +274 -0
  129. data/vendor/mthaml/mthaml/examples/README.md +5 -0
  130. data/vendor/mthaml/mthaml/examples/autoload.php +8 -0
  131. data/vendor/mthaml/mthaml/examples/example-php.haml +5 -0
  132. data/vendor/mthaml/mthaml/examples/example-php.php +37 -0
  133. data/vendor/mthaml/mthaml/examples/example-twig-noext.twig +11 -0
  134. data/vendor/mthaml/mthaml/examples/example-twig.haml +9 -0
  135. data/vendor/mthaml/mthaml/examples/example-twig.php +60 -0
  136. data/vendor/mthaml/mthaml/examples/example.twig.haml +8 -0
  137. data/vendor/mthaml/mthaml/lib/MtHaml/Autoloader.php +22 -0
  138. data/vendor/mthaml/mthaml/lib/MtHaml/Environment.php +178 -0
  139. data/vendor/mthaml/mthaml/lib/MtHaml/Escaping.php +33 -0
  140. data/vendor/mthaml/mthaml/lib/MtHaml/Exception.php +9 -0
  141. data/vendor/mthaml/mthaml/lib/MtHaml/Exception/SyntaxErrorException.php +9 -0
  142. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/AbstractFilter.php +43 -0
  143. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Cdata.php +16 -0
  144. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/CoffeeScript.php +33 -0
  145. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Css.php +26 -0
  146. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Escaped.php +22 -0
  147. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/FilterInterface.php +15 -0
  148. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Javascript.php +26 -0
  149. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less.php +27 -0
  150. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less/LeafoLess.php +20 -0
  151. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less/OyejorgeLess.php +23 -0
  152. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown.php +58 -0
  153. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/CebeMarkdown.php +22 -0
  154. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/Ciconia.php +21 -0
  155. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/MichelfMarkdown.php +21 -0
  156. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/Parsedown.php +21 -0
  157. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Php.php +37 -0
  158. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Plain.php +24 -0
  159. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Preserve.php +19 -0
  160. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Scss.php +37 -0
  161. data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Twig.php +47 -0
  162. data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/Indentation.php +96 -0
  163. data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/IndentationException.php +9 -0
  164. data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/IndentationInterface.php +50 -0
  165. data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/Undefined.php +41 -0
  166. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Comment.php +71 -0
  167. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Doctype.php +96 -0
  168. data/vendor/mthaml/mthaml/lib/MtHaml/Node/EscapableAbstract.php +19 -0
  169. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Filter.php +51 -0
  170. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Insert.php +42 -0
  171. data/vendor/mthaml/mthaml/lib/MtHaml/Node/InterpolatedString.php +73 -0
  172. data/vendor/mthaml/mthaml/lib/MtHaml/Node/NestAbstract.php +117 -0
  173. data/vendor/mthaml/mthaml/lib/MtHaml/Node/NestInterface.php +10 -0
  174. data/vendor/mthaml/mthaml/lib/MtHaml/Node/NodeAbstract.php +77 -0
  175. data/vendor/mthaml/mthaml/lib/MtHaml/Node/ObjectRefClass.php +42 -0
  176. data/vendor/mthaml/mthaml/lib/MtHaml/Node/ObjectRefId.php +42 -0
  177. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Root.php +35 -0
  178. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Run.php +71 -0
  179. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Statement.php +45 -0
  180. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Tag.php +90 -0
  181. data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttribute.php +62 -0
  182. data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttributeInterpolation.php +24 -0
  183. data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttributeList.php +24 -0
  184. data/vendor/mthaml/mthaml/lib/MtHaml/Node/Text.php +37 -0
  185. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Autoclose.php +25 -0
  186. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Escaping.php +105 -0
  187. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/MergeAttrs.php +110 -0
  188. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Midblock.php +37 -0
  189. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/NodeVisitorAbstract.php +226 -0
  190. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/NodeVisitorInterface.php +97 -0
  191. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/PhpRenderer.php +288 -0
  192. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Printer.php +265 -0
  193. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/RendererAbstract.php +581 -0
  194. data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/TwigRenderer.php +252 -0
  195. data/vendor/mthaml/mthaml/lib/MtHaml/Parser.php +862 -0
  196. data/vendor/mthaml/mthaml/lib/MtHaml/Parser/Buffer.php +147 -0
  197. data/vendor/mthaml/mthaml/lib/MtHaml/Runtime.php +218 -0
  198. data/vendor/mthaml/mthaml/lib/MtHaml/Runtime/AttributeInterpolation.php +16 -0
  199. data/vendor/mthaml/mthaml/lib/MtHaml/Runtime/AttributeList.php +16 -0
  200. data/vendor/mthaml/mthaml/lib/MtHaml/Support/Php/Executor.php +157 -0
  201. data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Extension.php +47 -0
  202. data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Lexer.php +48 -0
  203. data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Loader.php +81 -0
  204. data/vendor/mthaml/mthaml/lib/MtHaml/Target/Php.php +23 -0
  205. data/vendor/mthaml/mthaml/lib/MtHaml/Target/TargetAbstract.php +87 -0
  206. data/vendor/mthaml/mthaml/lib/MtHaml/Target/TargetInterface.php +12 -0
  207. data/vendor/mthaml/mthaml/lib/MtHaml/Target/Twig.php +23 -0
  208. data/vendor/mthaml/mthaml/lib/MtHaml/TreeBuilder.php +100 -0
  209. data/vendor/mthaml/mthaml/lib/MtHaml/TreeBuilderException.php +9 -0
  210. data/vendor/mthaml/mthaml/phpunit.xml +25 -0
  211. data/vendor/mthaml/mthaml/test/MtHaml/Tests/EnvironmentTest.php +59 -0
  212. data/vendor/mthaml/mthaml/test/MtHaml/Tests/HamlSpecTest.php +83 -0
  213. data/vendor/mthaml/mthaml/test/MtHaml/Tests/IndentationTest.php +140 -0
  214. data/vendor/mthaml/mthaml/test/MtHaml/Tests/Node/DoctypeTest.php +51 -0
  215. data/vendor/mthaml/mthaml/test/MtHaml/Tests/Node/NodeTest.php +110 -0
  216. data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitor/PhpRendererTest.php +113 -0
  217. data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitor/TwigRendererTest.php +68 -0
  218. data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitorsTest.php +44 -0
  219. data/vendor/mthaml/mthaml/test/MtHaml/Tests/Parser/BufferTest.php +77 -0
  220. data/vendor/mthaml/mthaml/test/MtHaml/Tests/ParserTest.php +47 -0
  221. data/vendor/mthaml/mthaml/test/MtHaml/Tests/RuntimeTest.php +356 -0
  222. data/vendor/mthaml/mthaml/test/MtHaml/Tests/Support/Php/ExecutorTest.php +83 -0
  223. data/vendor/mthaml/mthaml/test/MtHaml/Tests/Support/Twig/LoaderTest.php +65 -0
  224. data/vendor/mthaml/mthaml/test/MtHaml/Tests/TestCase.php +49 -0
  225. data/vendor/mthaml/mthaml/test/MtHaml/Tests/TestCaseTest.php +50 -0
  226. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/Support/Php/Executor.001.haml +1 -0
  227. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/attr_list_php.test +20 -0
  228. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/attr_list_twig.test +12 -0
  229. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/boolean_attr_php.test +16 -0
  230. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/boolean_attr_twig.test +16 -0
  231. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug28_php.test +15 -0
  232. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug28_twig.test +15 -0
  233. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug42.test +13 -0
  234. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug8_twig.test +10 -0
  235. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/coffeescript_filter.test +31 -0
  236. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/comments.test +26 -0
  237. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/cond_cmt.test +25 -0
  238. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype.test +18 -0
  239. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_html4.test +20 -0
  240. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_invalid.test +12 -0
  241. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_invalid_xhtml.test +12 -0
  242. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_php.test +18 -0
  243. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_xhtml.test +30 -0
  244. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/filters.test +51 -0
  245. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/insert_non_echo_php.test +11 -0
  246. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/insert_non_echo_twig.test +11 -0
  247. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/interpolation_in_html_attrs_php.test +31 -0
  248. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/interpolation_in_html_attrs_twig.test +31 -0
  249. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/less_filter_leafo.test +33 -0
  250. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/less_filter_oyejorge.test +49 -0
  251. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_cebemarkdown.test +35 -0
  252. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_ciconia.test +36 -0
  253. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_michelf.test +34 -0
  254. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_parsedown.test +31 -0
  255. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_optimization_filter_michelf.test +23 -0
  256. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/mergeattrs.test +18 -0
  257. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/nuke_inner_whitespace.test +77 -0
  258. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/nuke_outer_whitespace.test +122 -0
  259. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/object_ref_php.test +14 -0
  260. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/object_ref_twig.test +14 -0
  261. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php.test +109 -0
  262. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_autoescaping.test +22 -0
  263. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_autoescaping_once.test +25 -0
  264. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_blocks.test +29 -0
  265. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_filters.test +42 -0
  266. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/scss_filter.test +32 -0
  267. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/strip_inline_comments_php.test +22 -0
  268. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/test.test +24 -0
  269. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/trailing_semicolon_php.test +14 -0
  270. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/try_catch_php.test +17 -0
  271. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig.test +112 -0
  272. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_blocks.test +29 -0
  273. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_filters.test +37 -0
  274. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_whitespace.test +32 -0
  275. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/whitespace.test +63 -0
  276. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/autoclose.test +30 -0
  277. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping.test +52 -0
  278. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping_attr_once.test +52 -0
  279. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping_html_false.test +52 -0
  280. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/mergeattrs.test +26 -0
  281. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/midblock.test +54 -0
  282. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/midblock_002.test +32 -0
  283. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attr_list.test +14 -0
  284. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs.test +42 -0
  285. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_002.test +35 -0
  286. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_003.test +30 -0
  287. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_html_linebreak.test +17 -0
  288. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/blocks.test +27 -0
  289. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/blocks_002.test +15 -0
  290. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/boolean_attr.test +19 -0
  291. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/bug28.test +15 -0
  292. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/bug8.test +11 -0
  293. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/cond_cmt.test +23 -0
  294. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/doctype.test +11 -0
  295. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/double_equal.test +7 -0
  296. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/empty_line_after_multiline.test +10 -0
  297. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_001.test +8 -0
  298. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_002.test +8 -0
  299. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_003.test +8 -0
  300. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_004.test +6 -0
  301. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_005.test +5 -0
  302. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_006.test +7 -0
  303. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_007.test +7 -0
  304. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_008.test +7 -0
  305. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_009.test +5 -0
  306. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_010.test +5 -0
  307. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_013.test +5 -0
  308. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_016.test +7 -0
  309. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_017.test +8 -0
  310. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_018.test +6 -0
  311. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_019.test +6 -0
  312. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_020.test +5 -0
  313. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters.test +20 -0
  314. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_002.test +19 -0
  315. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_003.test +13 -0
  316. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_004.test +21 -0
  317. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_005.test +22 -0
  318. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_006.test +23 -0
  319. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/insertflags.test +17 -0
  320. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/interpolation.test +36 -0
  321. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/interpolation_in_html_attrs.test +17 -0
  322. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiline.test +18 -0
  323. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiline_code.test +59 -0
  324. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiple_attr_kinds.test +47 -0
  325. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/non_rendered_comment.test +31 -0
  326. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ns.test +11 -0
  327. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref.test +22 -0
  328. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref_error1.test +5 -0
  329. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref_error2.test +5 -0
  330. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/quotes_in_haml.test +10 -0
  331. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby19_attrs.test +11 -0
  332. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma.test +23 -0
  333. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_001.test +5 -0
  334. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_002.test +5 -0
  335. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_003.test +5 -0
  336. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/standard.test +114 -0
  337. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/tagflags.test +39 -0
  338. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/runtime/php_filters.test +28 -0
  339. data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/runtime/twig_filters.test +31 -0
  340. data/vendor/mthaml/mthaml/test/bootstrap.php +3 -0
  341. metadata +398 -0
@@ -0,0 +1,257 @@
1
+ <?php
2
+ /**
3
+ * PHP_ParserGenerator, a php 5 parser generator.
4
+ *
5
+ * This is a direct port of the Lemon parser generator, found at
6
+ * {@link http://www.hwaci.com/sw/lemon/}
7
+ *
8
+ * PHP version 5
9
+ *
10
+ * LICENSE:
11
+ *
12
+ * Copyright (c) 2006, Gregory Beaver <cellog@php.net>
13
+ * All rights reserved.
14
+ *
15
+ * Redistribution and use in source and binary forms, with or without
16
+ * modification, are permitted provided that the following conditions
17
+ * are met:
18
+ *
19
+ * * Redistributions of source code must retain the above copyright
20
+ * notice, this list of conditions and the following disclaimer.
21
+ * * Redistributions in binary form must reproduce the above copyright
22
+ * notice, this list of conditions and the following disclaimer in
23
+ * the documentation and/or other materials provided with the distribution.
24
+ * * Neither the name of the PHP_ParserGenerator nor the names of its
25
+ * contributors may be used to endorse or promote products derived
26
+ * from this software without specific prior written permission.
27
+ *
28
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
29
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
30
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
32
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
33
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
34
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
35
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
36
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
37
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
+ *
40
+ * @category PHP
41
+ * @package PHP_ParserGenerator
42
+ * @author Gregory Beaver <cellog@php.net>
43
+ * @copyright 2006 Gregory Beaver
44
+ * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
45
+ * @version CVS: $Id: Action.php 302382 2010-08-17 06:08:09Z jespino $
46
+ * @link http://pear.php.net/package/PHP_ParserGenerator
47
+ * @since File available since Release 0.1.0
48
+ */
49
+
50
+ /**
51
+ * Every shift or reduce operation is stored as one of the following objects.
52
+ *
53
+ * @category PHP
54
+ * @package PHP_ParserGenerator
55
+ * @author Gregory Beaver <cellog@php.net>
56
+ * @copyright 2006 Gregory Beaver
57
+ * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
58
+ * @version Release: @package_version@
59
+ * @link http://pear.php.net/package/PHP_ParserGenerator
60
+ * @since Class available since Release 0.1.0
61
+ */
62
+ class PHP_ParserGenerator_Action
63
+ {
64
+ const SHIFT = 1,
65
+ ACCEPT = 2,
66
+ REDUCE = 3,
67
+ ERROR = 4,
68
+ /**
69
+ * Was a reduce, but part of a conflict
70
+ */
71
+ CONFLICT = 5,
72
+ /**
73
+ * Was a shift. Precedence resolved conflict
74
+ */
75
+ SH_RESOLVED = 6,
76
+ /**
77
+ * Was a reduce. Precedence resolved conflict
78
+ */
79
+ RD_RESOLVED = 7,
80
+ /**
81
+ * Deleted by compression
82
+ * @see PHP_ParserGenerator::CompressTables()
83
+ */
84
+ NOT_USED = 8;
85
+ /**
86
+ * The look-ahead symbol that triggers this action
87
+ * @var PHP_ParserGenerator_Symbol
88
+ */
89
+ public $sp; /* The look-ahead symbol */
90
+ /**
91
+ * This defines the kind of action, and must be one
92
+ * of the class constants.
93
+ *
94
+ * - {@link PHP_ParserGenerator_Action::SHIFT}
95
+ * - {@link PHP_ParserGenerator_Action::ACCEPT}
96
+ * - {@link PHP_ParserGenerator_Action::REDUCE}
97
+ * - {@link PHP_ParserGenerator_Action::ERROR}
98
+ * - {@link PHP_ParserGenerator_Action::CONFLICT}
99
+ * - {@link PHP_ParserGenerator_Action::SH_RESOLVED}
100
+ * - {@link PHP_ParserGenerator_Action:: RD_RESOLVED}
101
+ * - {@link PHP_ParserGenerator_Action::NOT_USED}
102
+ */
103
+ public $type;
104
+ /**
105
+ * The new state, if this is a shift,
106
+ * the parser rule index, if this is a reduce.
107
+ *
108
+ * @var PHP_ParserGenerator_State|PHP_ParserGenerator_Rule
109
+ */
110
+ public $x;
111
+ /**
112
+ * The next action for this state.
113
+ * @var PHP_ParserGenerator_Action
114
+ */
115
+ public $next;
116
+
117
+ /**
118
+ * Compare two actions
119
+ *
120
+ * This is used by {@link Action_sort()} to compare actions
121
+ */
122
+ static function actioncmp(PHP_ParserGenerator_Action $ap1, PHP_ParserGenerator_Action $ap2)
123
+ {
124
+ $rc = $ap1->sp->index - $ap2->sp->index;
125
+ if ($rc === 0) {
126
+ $rc = $ap1->type - $ap2->type;
127
+ }
128
+ if ($rc === 0) {
129
+ if ($ap1->type == self::SHIFT) {
130
+ if ($ap1->x->statenum != $ap2->x->statenum) {
131
+ throw new Exception('Shift conflict: ' . $ap1->sp->name .
132
+ ' shifts both to state ' . $ap1->x->statenum . ' (rule ' .
133
+ $ap1->x->cfp->rp->lhs->name . ' on line ' .
134
+ $ap1->x->cfp->rp->ruleline . ') and to state ' .
135
+ $ap2->x->statenum . ' (rule ' .
136
+ $ap2->x->cfp->rp->lhs->name . ' on line ' .
137
+ $ap2->x->cfp->rp->ruleline . ')');
138
+ }
139
+ }
140
+ if ($ap1->type != self::REDUCE
141
+ && $ap1->type != self::RD_RESOLVED
142
+ && $ap1->type != self::CONFLICT
143
+ ) {
144
+ throw new Exception('action has not been processed: ' .
145
+ $ap1->sp->name . ' on line ' . $ap1->x->cfp->rp->ruleline .
146
+ ', rule ' . $ap1->x->cfp->rp->lhs->name);
147
+ }
148
+ if ($ap2->type != self::REDUCE
149
+ && $ap2->type != self::RD_RESOLVED
150
+ && $ap2->type != self::CONFLICT
151
+ ) {
152
+ throw new Exception('action has not been processed: ' .
153
+ $ap2->sp->name . ' on line ' . $ap2->x->cfp->rp->ruleline .
154
+ ', rule ' . $ap2->x->cfp->rp->lhs->name);
155
+ }
156
+ $rc = $ap1->x->index - $ap2->x->index;
157
+ }
158
+ return $rc;
159
+ }
160
+
161
+ function display($processed = false)
162
+ {
163
+ $map = array(
164
+ self::ACCEPT => 'ACCEPT',
165
+ self::CONFLICT => 'CONFLICT',
166
+ self::REDUCE => 'REDUCE',
167
+ self::SHIFT => 'SHIFT'
168
+ );
169
+ echo $map[$this->type] . ' for ' . $this->sp->name;
170
+ if ($this->type == self::REDUCE) {
171
+ echo ' - rule ' . $this->x->lhs->name . "\n";
172
+ } elseif ($this->type == self::SHIFT) {
173
+ echo ' - state ' . $this->x->statenum . ', basis ' . $this->x->cfp->rp->lhs->name . "\n";
174
+ } else {
175
+ echo "\n";
176
+ }
177
+ }
178
+
179
+ /**
180
+ * create linked list of PHP_ParserGenerator_Actions
181
+ *
182
+ * @param PHP_ParserGenerator_Action|null $app
183
+ * @param int $type one of the class constants from PHP_ParserGenerator_Action
184
+ * @param PHP_ParserGenerator_Symbol $sp
185
+ * @param PHP_ParserGenerator_State|PHP_ParserGenerator_Rule $arg
186
+ */
187
+ static function Action_add(&$app, $type, PHP_ParserGenerator_Symbol $sp, $arg)
188
+ {
189
+ $new = new PHP_ParserGenerator_Action;
190
+ $new->next = $app;
191
+ $app = $new;
192
+ $new->type = $type;
193
+ $new->sp = $sp;
194
+ $new->x = $arg;
195
+ echo ' Adding ';
196
+ $new->display();
197
+ }
198
+
199
+ /**
200
+ * Sort parser actions
201
+ *
202
+ * @param PHP_ParserGenerator_Action $ap a parser action
203
+ *
204
+ * @see PHP_ParserGenerator_Data::FindActions()
205
+ *
206
+ * @return PHP_ParserGenerator_Action
207
+ */
208
+ static function Action_sort(PHP_ParserGenerator_Action $ap)
209
+ {
210
+ $ap = PHP_ParserGenerator::msort($ap, 'next', array('PHP_ParserGenerator_Action', 'actioncmp'));
211
+ return $ap;
212
+ }
213
+
214
+ /**
215
+ * Print an action to the given file descriptor. Return FALSE if
216
+ * nothing was actually printed.
217
+ *
218
+ * @param resource $fp File descriptor to print on
219
+ * @param integer $indent Number of indents
220
+ *
221
+ * @see PHP_ParserGenerator_Data::ReportOutput()
222
+ *
223
+ * @return int|false
224
+ */
225
+ function PrintAction($fp, $indent)
226
+ {
227
+ if (!$fp) {
228
+ $fp = STDOUT;
229
+ }
230
+ $result = 1;
231
+ switch ($this->type)
232
+ {
233
+ case self::SHIFT:
234
+ fprintf($fp, "%${indent}s shift %d", $this->sp->name, $this->x->statenum);
235
+ break;
236
+ case self::REDUCE:
237
+ fprintf($fp, "%${indent}s reduce %d", $this->sp->name, $this->x->index);
238
+ break;
239
+ case self::ACCEPT:
240
+ fprintf($fp, "%${indent}s accept", $this->sp->name);
241
+ break;
242
+ case self::ERROR:
243
+ fprintf($fp, "%${indent}s error", $this->sp->name);
244
+ break;
245
+ case self::CONFLICT:
246
+ fprintf($fp, "%${indent}s reduce %-3d ** Parsing conflict **", $this->sp->name, $this->x->index);
247
+ break;
248
+ case self::SH_RESOLVED:
249
+ case self::RD_RESOLVED:
250
+ case self::NOT_USED:
251
+ $result = 0;
252
+ break;
253
+ }
254
+ return $result;
255
+ }
256
+ }
257
+ ?>
@@ -0,0 +1,299 @@
1
+ <?php
2
+ /**
3
+ * PHP_ParserGenerator, a php 5 parser generator.
4
+ *
5
+ * This is a direct port of the Lemon parser generator, found at
6
+ * {@link http://www.hwaci.com/sw/lemon/}
7
+ *
8
+ * PHP version 5
9
+ *
10
+ * LICENSE:
11
+ *
12
+ * Copyright (c) 2006, Gregory Beaver <cellog@php.net>
13
+ * All rights reserved.
14
+ *
15
+ * Redistribution and use in source and binary forms, with or without
16
+ * modification, are permitted provided that the following conditions
17
+ * are met:
18
+ *
19
+ * * Redistributions of source code must retain the above copyright
20
+ * notice, this list of conditions and the following disclaimer.
21
+ * * Redistributions in binary form must reproduce the above copyright
22
+ * notice, this list of conditions and the following disclaimer in
23
+ * the documentation and/or other materials provided with the distribution.
24
+ * * Neither the name of the PHP_ParserGenerator nor the names of its
25
+ * contributors may be used to endorse or promote products derived
26
+ * from this software without specific prior written permission.
27
+ *
28
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
29
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
30
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
32
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
33
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
34
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
35
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
36
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
37
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
+ *
40
+ * @category PHP
41
+ * @package PHP_ParserGenerator
42
+ * @author Gregory Beaver <cellog@php.net>
43
+ * @copyright 2006 Gregory Beaver
44
+ * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
45
+ * @version CVS: $Id: ActionTable.php 302382 2010-08-17 06:08:09Z jespino $
46
+ * @link http://pear.php.net/package/PHP_ParserGenerator
47
+ * @since File available since Release 0.1.0
48
+ */
49
+ /**
50
+ * The state of the yy_action table under construction is an instance of
51
+ * the following structure
52
+ *
53
+ * @category PHP
54
+ * @package PHP_ParserGenerator
55
+ * @author Gregory Beaver <cellog@php.net>
56
+ * @copyright 2006 Gregory Beaver
57
+ * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
58
+ * @version Release: @package_version@
59
+ * @link http://pear.php.net/package/PHP_ParserGenerator
60
+ * @since Class available since Release 0.1.0
61
+ */
62
+ class PHP_ParserGenerator_ActionTable
63
+ {
64
+ /**
65
+ * Number of used slots in {@link $aAction}
66
+ * @var int
67
+ */
68
+ public $nAction = 0;
69
+ /**
70
+ * The $yy_action table under construction.
71
+ *
72
+ * Each entry is of format:
73
+ * <code>
74
+ * array(
75
+ * 'lookahead' => -1, // Value of the lookahead token (symbol index)
76
+ * 'action' => -1 // Action to take on the given lookahead (action index)
77
+ * );
78
+ * </code>
79
+ * @see PHP_ParserGenerator_Data::compute_action()
80
+ * @var array
81
+ */
82
+ public $aAction = array(
83
+ array(
84
+ 'lookahead' => -1,
85
+ 'action' => -1
86
+ )
87
+ );
88
+ /**
89
+ * A single new transaction set.
90
+ *
91
+ * @see $aAction format of the internal array is described here
92
+ * @var array
93
+ */
94
+ public $aLookahead = array(
95
+ array(
96
+ 'lookahead' => 0,
97
+ 'action' => 0
98
+ )
99
+ );
100
+ /**
101
+ * The smallest (minimum) value of any lookahead token in {@link $aLookahead}
102
+ *
103
+ * The lowest non-terminal is always introduced earlier in the parser file,
104
+ * and is therefore a more significant token.
105
+ * @var int
106
+ */
107
+ public $mnLookahead = 0;
108
+ /**
109
+ * The action associated with the smallest lookahead token.
110
+ * @see $mnLookahead
111
+ * @var int
112
+ */
113
+ public $mnAction = 0;
114
+ /**
115
+ * The largest (maximum) value of any lookahead token in {@link $aLookahead}
116
+ * @var int
117
+ */
118
+ public $mxLookahead = 0;
119
+ /**
120
+ * The number of slots used in {@link $aLookahead}.
121
+ *
122
+ * This is the same as count($aLookahead), but there was no pressing reason
123
+ * to change this when porting from C.
124
+ * @see $mnLookahead
125
+ * @var int
126
+ */
127
+ public $nLookahead = 0;
128
+
129
+ /**
130
+ * Add a new action to the current transaction set
131
+ *
132
+ * @param int $lookahead
133
+ * @param int $action
134
+ *
135
+ * @return void
136
+ */
137
+ function acttab_action($lookahead, $action)
138
+ {
139
+ if ($this->nLookahead === 0) {
140
+ $this->aLookahead = array();
141
+ $this->mxLookahead = $lookahead;
142
+ $this->mnLookahead = $lookahead;
143
+ $this->mnAction = $action;
144
+ } else {
145
+ if ($this->mxLookahead < $lookahead) {
146
+ $this->mxLookahead = $lookahead;
147
+ }
148
+ if ($this->mnLookahead > $lookahead) {
149
+ $this->mnLookahead = $lookahead;
150
+ $this->mnAction = $action;
151
+ }
152
+ }
153
+ $this->aLookahead[$this->nLookahead] = array(
154
+ 'lookahead' => $lookahead,
155
+ 'action' => $action);
156
+ $this->nLookahead++;
157
+ }
158
+
159
+ /**
160
+ * Add the transaction set built up with prior calls to acttab_action()
161
+ * into the current action table. Then reset the transaction set back
162
+ * to an empty set in preparation for a new round of acttab_action() calls.
163
+ *
164
+ * Return the offset into the action table of the new transaction.
165
+ *
166
+ * @return int Return the offset that should be added to the lookahead in
167
+ * order to get the index into $yy_action of the action. This will be used
168
+ * in generation of $yy_ofst tables (reduce and shift)
169
+ * @throws Exception
170
+ */
171
+ function acttab_insert()
172
+ {
173
+ if ($this->nLookahead <= 0) {
174
+ throw new Exception('nLookahead is not set up?');
175
+ }
176
+
177
+ /* Scan the existing action table looking for an offset where we can
178
+ ** insert the current transaction set. Fall out of the loop when that
179
+ ** offset is found. In the worst case, we fall out of the loop when
180
+ ** i reaches $this->nAction, which means we append the new transaction set.
181
+ **
182
+ ** i is the index in $this->aAction[] where $this->mnLookahead is inserted.
183
+ */
184
+ for ($i = 0; $i < $this->nAction + $this->mnLookahead; $i++) {
185
+ if (!isset($this->aAction[$i])) {
186
+ $this->aAction[$i] = array(
187
+ 'lookahead' => -1,
188
+ 'action' => -1,
189
+ );
190
+ }
191
+ if ($this->aAction[$i]['lookahead'] < 0) {
192
+ for ($j = 0; $j < $this->nLookahead; $j++) {
193
+ if (!isset($this->aLookahead[$j])) {
194
+ $this->aLookahead[$j] = array(
195
+ 'lookahead' => 0,
196
+ 'action' => 0,
197
+ );
198
+ }
199
+ $k = $this->aLookahead[$j]['lookahead'] -
200
+ $this->mnLookahead + $i;
201
+ if ($k < 0) {
202
+ break;
203
+ }
204
+ if (!isset($this->aAction[$k])) {
205
+ $this->aAction[$k] = array(
206
+ 'lookahead' => -1,
207
+ 'action' => -1,
208
+ );
209
+ }
210
+ if ($this->aAction[$k]['lookahead'] >= 0) {
211
+ break;
212
+ }
213
+ }
214
+ if ($j < $this->nLookahead ) {
215
+ continue;
216
+ }
217
+ for ($j = 0; $j < $this->nAction; $j++) {
218
+ if (!isset($this->aAction[$j])) {
219
+ $this->aAction[$j] = array(
220
+ 'lookahead' => -1,
221
+ 'action' => -1,
222
+ );
223
+ }
224
+ if ($this->aAction[$j]['lookahead'] == $j + $this->mnLookahead - $i) {
225
+ break;
226
+ }
227
+ }
228
+ if ($j == $this->nAction) {
229
+ break; /* Fits in empty slots */
230
+ }
231
+ } elseif ($this->aAction[$i]['lookahead'] == $this->mnLookahead) {
232
+ if ($this->aAction[$i]['action'] != $this->mnAction) {
233
+ continue;
234
+ }
235
+ for ($j = 0; $j < $this->nLookahead; $j++) {
236
+ $k = $this->aLookahead[$j]['lookahead'] -
237
+ $this->mnLookahead + $i;
238
+ if ($k < 0 || $k >= $this->nAction) {
239
+ break;
240
+ }
241
+ if (!isset($this->aAction[$k])) {
242
+ $this->aAction[$k] = array(
243
+ 'lookahead' => -1,
244
+ 'action' => -1,
245
+ );
246
+ }
247
+ if ($this->aLookahead[$j]['lookahead'] != $this->aAction[$k]['lookahead']) {
248
+ break;
249
+ }
250
+ if ($this->aLookahead[$j]['action'] != $this->aAction[$k]['action']) {
251
+ break;
252
+ }
253
+ }
254
+ if ($j < $this->nLookahead) {
255
+ continue;
256
+ }
257
+ $n = 0;
258
+ for ($j = 0; $j < $this->nAction; $j++) {
259
+ if (!isset($this->aAction[$j])) {
260
+ $this->aAction[$j] = array(
261
+ 'lookahead' => -1,
262
+ 'action' => -1,
263
+ );
264
+ }
265
+ if ($this->aAction[$j]['lookahead'] < 0) {
266
+ continue;
267
+ }
268
+ if ($this->aAction[$j]['lookahead'] == $j + $this->mnLookahead - $i) {
269
+ $n++;
270
+ }
271
+ }
272
+ if ($n == $this->nLookahead) {
273
+ break; /* Same as a prior transaction set */
274
+ }
275
+ }
276
+ }
277
+ /* Insert transaction set at index i. */
278
+ for ($j = 0; $j < $this->nLookahead; $j++) {
279
+ if (!isset($this->aLookahead[$j])) {
280
+ $this->aLookahead[$j] = array(
281
+ 'lookahead' => 0,
282
+ 'action' => 0,
283
+ );
284
+ }
285
+ $k = $this->aLookahead[$j]['lookahead'] - $this->mnLookahead + $i;
286
+ $this->aAction[$k] = $this->aLookahead[$j];
287
+ if ($k >= $this->nAction) {
288
+ $this->nAction = $k + 1;
289
+ }
290
+ }
291
+ $this->nLookahead = 0;
292
+ $this->aLookahead = array();
293
+
294
+ /* Return the offset that is added to the lookahead in order to get the
295
+ ** index into yy_action of the action */
296
+ return $i - $this->mnLookahead;
297
+ }
298
+ }
299
+ ?>