guard-mthaml 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +34 -0
- data/lib/guard/mthaml.rb +140 -0
- data/lib/guard/mthaml/compiler/MtHaml.php +255 -0
- data/lib/guard/mthaml/templates/Guardfile +12 -0
- data/lib/guard/mthaml/version.rb +5 -0
- data/vendor/autoload.php +7 -0
- data/vendor/coffeescript/coffeescript/LICENSE +22 -0
- data/vendor/coffeescript/coffeescript/README.md +96 -0
- data/vendor/coffeescript/coffeescript/composer.json +23 -0
- data/vendor/coffeescript/coffeescript/grammar.y +309 -0
- data/vendor/coffeescript/coffeescript/make.php +115 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Compiler.php +76 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Error.php +15 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Helpers.php +116 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Init.php +96 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Lexer.php +1356 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Nodes.php +105 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Parser.php +3326 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Rewriter.php +552 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Scope.php +196 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/SyntaxError.php +9 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/Value.php +20 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Access.php +31 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Arr.php +69 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Assign.php +353 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Base.php +288 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Block.php +294 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Call.php +283 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Class.php +282 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Closure.php +49 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Code.php +203 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Comment.php +39 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Existence.php +42 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Extends.php +26 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/For.php +250 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/If.php +161 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/In.php +99 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Index.php +27 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Literal.php +96 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Obj.php +126 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Op.php +292 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Param.php +119 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Parens.php +45 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Range.php +225 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Return.php +56 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Slice.php +47 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Splat.php +100 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Switch.php +121 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Throw.php +37 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Try.php +79 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Value.php +210 -0
- data/vendor/coffeescript/coffeescript/src/CoffeeScript/yy/While.php +112 -0
- data/vendor/coffeescript/coffeescript/tests/cases/arrays.coffee +77 -0
- data/vendor/coffeescript/coffeescript/tests/cases/assignment.coffee +352 -0
- data/vendor/coffeescript/coffeescript/tests/cases/booleans.coffee +21 -0
- data/vendor/coffeescript/coffeescript/tests/cases/classes.coffee +681 -0
- data/vendor/coffeescript/coffeescript/tests/cases/comments.coffee +207 -0
- data/vendor/coffeescript/coffeescript/tests/cases/compilation.coffee +72 -0
- data/vendor/coffeescript/coffeescript/tests/cases/comprehensions.coffee +501 -0
- data/vendor/coffeescript/coffeescript/tests/cases/control_flow.coffee +430 -0
- data/vendor/coffeescript/coffeescript/tests/cases/eval.coffee +29 -0
- data/vendor/coffeescript/coffeescript/tests/cases/exception_handling.coffee +102 -0
- data/vendor/coffeescript/coffeescript/tests/cases/formatting.coffee +146 -0
- data/vendor/coffeescript/coffeescript/tests/cases/function_invocation.coffee +552 -0
- data/vendor/coffeescript/coffeescript/tests/cases/functions.coffee +188 -0
- data/vendor/coffeescript/coffeescript/tests/cases/helpers.coffee +96 -0
- data/vendor/coffeescript/coffeescript/tests/cases/importing.coffee +18 -0
- data/vendor/coffeescript/coffeescript/tests/cases/interpolation.coffee +138 -0
- data/vendor/coffeescript/coffeescript/tests/cases/javascript_literals.coffee +10 -0
- data/vendor/coffeescript/coffeescript/tests/cases/numbers.coffee +76 -0
- data/vendor/coffeescript/coffeescript/tests/cases/objects.coffee +271 -0
- data/vendor/coffeescript/coffeescript/tests/cases/operators.coffee +277 -0
- data/vendor/coffeescript/coffeescript/tests/cases/option_parser.coffee +43 -0
- data/vendor/coffeescript/coffeescript/tests/cases/ranges.coffee +88 -0
- data/vendor/coffeescript/coffeescript/tests/cases/regexps.coffee +63 -0
- data/vendor/coffeescript/coffeescript/tests/cases/scope.coffee +43 -0
- data/vendor/coffeescript/coffeescript/tests/cases/slicing_and_splicing.coffee +143 -0
- data/vendor/coffeescript/coffeescript/tests/cases/soaks.coffee +134 -0
- data/vendor/coffeescript/coffeescript/tests/cases/strict.coffee +155 -0
- data/vendor/coffeescript/coffeescript/tests/cases/strings.coffee +107 -0
- data/vendor/coffeescript/coffeescript/tests/css/style.css +43 -0
- data/vendor/coffeescript/coffeescript/tests/index.php +119 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.1.1.js +8 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.2.0.js +8 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.3.0.js +8 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/coffeescript_1.3.1.js +8 -0
- data/vendor/coffeescript/coffeescript/tests/js/lib/diff.js +276 -0
- data/vendor/coffeescript/coffeescript/tests/js/main.js +123 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/LICENSE.txt +10 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/Lempar.php +948 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Action.php +257 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/ActionTable.php +299 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Config.php +574 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Data.php +1857 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Parser.php +851 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/PropagationLink.php +126 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Rule.php +144 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/State.php +283 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/Symbol.php +288 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/PHP/ParserGenerator/cli.php +5 -0
- data/vendor/coffeescript/coffeescript/vendor/ParserGenerator/ParserGenerator.php +811 -0
- data/vendor/composer/ClassLoader.php +383 -0
- data/vendor/composer/autoload_classmap.php +9 -0
- data/vendor/composer/autoload_namespaces.php +12 -0
- data/vendor/composer/autoload_psr4.php +10 -0
- data/vendor/composer/autoload_real.php +50 -0
- data/vendor/composer/installed.json +166 -0
- data/vendor/michelf/php-markdown/License.md +36 -0
- data/vendor/michelf/php-markdown/Michelf/Markdown.inc.php +10 -0
- data/vendor/michelf/php-markdown/Michelf/Markdown.php +3117 -0
- data/vendor/michelf/php-markdown/Michelf/MarkdownExtra.inc.php +11 -0
- data/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php +38 -0
- data/vendor/michelf/php-markdown/Michelf/MarkdownInterface.inc.php +9 -0
- data/vendor/michelf/php-markdown/Michelf/MarkdownInterface.php +37 -0
- data/vendor/michelf/php-markdown/Readme.md +305 -0
- data/vendor/michelf/php-markdown/Readme.php +31 -0
- data/vendor/michelf/php-markdown/composer.json +31 -0
- data/vendor/mthaml/mthaml/CHANGELOG +48 -0
- data/vendor/mthaml/mthaml/LICENSE +44 -0
- data/vendor/mthaml/mthaml/README.markdown +262 -0
- data/vendor/mthaml/mthaml/composer.json +45 -0
- data/vendor/mthaml/mthaml/docs/Makefile +153 -0
- data/vendor/mthaml/mthaml/docs/_static/mthaml.css +30 -0
- data/vendor/mthaml/mthaml/docs/_theme/mthaml/theme.conf +4 -0
- data/vendor/mthaml/mthaml/docs/conf.py +242 -0
- data/vendor/mthaml/mthaml/docs/index.rst +18 -0
- data/vendor/mthaml/mthaml/docs/twig-syntax.rst +274 -0
- data/vendor/mthaml/mthaml/examples/README.md +5 -0
- data/vendor/mthaml/mthaml/examples/autoload.php +8 -0
- data/vendor/mthaml/mthaml/examples/example-php.haml +5 -0
- data/vendor/mthaml/mthaml/examples/example-php.php +37 -0
- data/vendor/mthaml/mthaml/examples/example-twig-noext.twig +11 -0
- data/vendor/mthaml/mthaml/examples/example-twig.haml +9 -0
- data/vendor/mthaml/mthaml/examples/example-twig.php +60 -0
- data/vendor/mthaml/mthaml/examples/example.twig.haml +8 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Autoloader.php +22 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Environment.php +178 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Escaping.php +33 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Exception.php +9 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Exception/SyntaxErrorException.php +9 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/AbstractFilter.php +43 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Cdata.php +16 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/CoffeeScript.php +33 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Css.php +26 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Escaped.php +22 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/FilterInterface.php +15 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Javascript.php +26 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less.php +27 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less/LeafoLess.php +20 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Less/OyejorgeLess.php +23 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown.php +58 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/CebeMarkdown.php +22 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/Ciconia.php +21 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/MichelfMarkdown.php +21 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Markdown/Parsedown.php +21 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Php.php +37 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Plain.php +24 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Preserve.php +19 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Scss.php +37 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Filter/Twig.php +47 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/Indentation.php +96 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/IndentationException.php +9 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/IndentationInterface.php +50 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Indentation/Undefined.php +41 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Comment.php +71 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Doctype.php +96 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/EscapableAbstract.php +19 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Filter.php +51 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Insert.php +42 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/InterpolatedString.php +73 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/NestAbstract.php +117 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/NestInterface.php +10 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/NodeAbstract.php +77 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/ObjectRefClass.php +42 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/ObjectRefId.php +42 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Root.php +35 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Run.php +71 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Statement.php +45 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Tag.php +90 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttribute.php +62 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttributeInterpolation.php +24 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/TagAttributeList.php +24 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Node/Text.php +37 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Autoclose.php +25 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Escaping.php +105 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/MergeAttrs.php +110 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Midblock.php +37 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/NodeVisitorAbstract.php +226 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/NodeVisitorInterface.php +97 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/PhpRenderer.php +288 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Printer.php +265 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/RendererAbstract.php +581 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/TwigRenderer.php +252 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Parser.php +862 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Parser/Buffer.php +147 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Runtime.php +218 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Runtime/AttributeInterpolation.php +16 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Runtime/AttributeList.php +16 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Support/Php/Executor.php +157 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Extension.php +47 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Lexer.php +48 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Support/Twig/Loader.php +81 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Target/Php.php +23 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Target/TargetAbstract.php +87 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Target/TargetInterface.php +12 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/Target/Twig.php +23 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/TreeBuilder.php +100 -0
- data/vendor/mthaml/mthaml/lib/MtHaml/TreeBuilderException.php +9 -0
- data/vendor/mthaml/mthaml/phpunit.xml +25 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/EnvironmentTest.php +59 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/HamlSpecTest.php +83 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/IndentationTest.php +140 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Node/DoctypeTest.php +51 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Node/NodeTest.php +110 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitor/PhpRendererTest.php +113 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitor/TwigRendererTest.php +68 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/NodeVisitorsTest.php +44 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Parser/BufferTest.php +77 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/ParserTest.php +47 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/RuntimeTest.php +356 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Support/Php/ExecutorTest.php +83 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/Support/Twig/LoaderTest.php +65 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/TestCase.php +49 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/TestCaseTest.php +50 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/Support/Php/Executor.001.haml +1 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/attr_list_php.test +20 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/attr_list_twig.test +12 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/boolean_attr_php.test +16 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/boolean_attr_twig.test +16 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug28_php.test +15 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug28_twig.test +15 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug42.test +13 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/bug8_twig.test +10 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/coffeescript_filter.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/comments.test +26 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/cond_cmt.test +25 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype.test +18 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_html4.test +20 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_invalid.test +12 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_invalid_xhtml.test +12 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_php.test +18 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/doctype_xhtml.test +30 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/filters.test +51 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/insert_non_echo_php.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/insert_non_echo_twig.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/interpolation_in_html_attrs_php.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/interpolation_in_html_attrs_twig.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/less_filter_leafo.test +33 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/less_filter_oyejorge.test +49 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_cebemarkdown.test +35 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_ciconia.test +36 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_michelf.test +34 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_filter_parsedown.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/markdown_optimization_filter_michelf.test +23 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/mergeattrs.test +18 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/nuke_inner_whitespace.test +77 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/nuke_outer_whitespace.test +122 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/object_ref_php.test +14 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/object_ref_twig.test +14 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php.test +109 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_autoescaping.test +22 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_autoescaping_once.test +25 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_blocks.test +29 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/php_filters.test +42 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/scss_filter.test +32 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/strip_inline_comments_php.test +22 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/test.test +24 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/trailing_semicolon_php.test +14 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/try_catch_php.test +17 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig.test +112 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_blocks.test +29 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_filters.test +37 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/twig_whitespace.test +32 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/environment/whitespace.test +63 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/autoclose.test +30 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping.test +52 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping_attr_once.test +52 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/escaping_html_false.test +52 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/mergeattrs.test +26 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/midblock.test +54 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/nodevisitors/midblock_002.test +32 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attr_list.test +14 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs.test +42 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_002.test +35 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_003.test +30 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/attrs_html_linebreak.test +17 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/blocks.test +27 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/blocks_002.test +15 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/boolean_attr.test +19 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/bug28.test +15 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/bug8.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/cond_cmt.test +23 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/doctype.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/double_equal.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/empty_line_after_multiline.test +10 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_001.test +8 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_002.test +8 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_003.test +8 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_004.test +6 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_005.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_006.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_007.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_008.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_009.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_010.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_013.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_016.test +7 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_017.test +8 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_018.test +6 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_019.test +6 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/errors_020.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters.test +20 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_002.test +19 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_003.test +13 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_004.test +21 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_005.test +22 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/filters_006.test +23 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/insertflags.test +17 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/interpolation.test +36 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/interpolation_in_html_attrs.test +17 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiline.test +18 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiline_code.test +59 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/multiple_attr_kinds.test +47 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/non_rendered_comment.test +31 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ns.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref.test +22 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref_error1.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/object_ref_error2.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/quotes_in_haml.test +10 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby19_attrs.test +11 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma.test +23 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_001.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_002.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/ruby_attrs_comma_errors_003.test +5 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/standard.test +114 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/parser/tagflags.test +39 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/runtime/php_filters.test +28 -0
- data/vendor/mthaml/mthaml/test/MtHaml/Tests/fixtures/runtime/twig_filters.test +31 -0
- data/vendor/mthaml/mthaml/test/bootstrap.php +3 -0
- metadata +398 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Closure
|
6
|
+
{
|
7
|
+
static function wrap($expressions, $statement = NULL, $no_return = FALSE)
|
8
|
+
{
|
9
|
+
if ($expressions->jumps())
|
10
|
+
{
|
11
|
+
return $expressions;
|
12
|
+
}
|
13
|
+
|
14
|
+
$func = yy('Code', array(), yy_Block::wrap(array($expressions)));
|
15
|
+
$args = array();
|
16
|
+
|
17
|
+
if (($mentions_args = $expressions->contains('yy_Closure::literal_args')) ||
|
18
|
+
$expressions->contains('yy_Closure::literal_this'))
|
19
|
+
{
|
20
|
+
$meth = yy('Literal', $mentions_args ? 'apply' : 'call');
|
21
|
+
$args = array(yy('Literal', 'this'));
|
22
|
+
|
23
|
+
if ($mentions_args)
|
24
|
+
{
|
25
|
+
$args[] = yy('Literal', 'arguments');
|
26
|
+
}
|
27
|
+
|
28
|
+
$func = yy('Value', $func, array(yy('Access', $meth)));
|
29
|
+
}
|
30
|
+
|
31
|
+
$func->no_return = $no_return;
|
32
|
+
$call = yy('Call', $func, $args);
|
33
|
+
|
34
|
+
return $statement ? yy_Block::wrap(array($call)) : $call;
|
35
|
+
}
|
36
|
+
|
37
|
+
static function literal_args($node)
|
38
|
+
{
|
39
|
+
return ($node instanceof yy_Literal) && (''.$node->value === 'arguments') && ! $node->as_key;
|
40
|
+
}
|
41
|
+
|
42
|
+
static function literal_this($node)
|
43
|
+
{
|
44
|
+
return (($node instanceof yy_Literal) && (''.$node->value === 'this') && ! $node->as_key) ||
|
45
|
+
($node instanceof yy_Code && $node->bound);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
?>
|
@@ -0,0 +1,203 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Code extends yy_Base
|
6
|
+
{
|
7
|
+
public $children = array('params', 'body');
|
8
|
+
|
9
|
+
function constructor($params = NULL, $body = NULL, $tag = NULL)
|
10
|
+
{
|
11
|
+
$this->params = $params ? $params : array();
|
12
|
+
$this->body = $body ? $body : yy('Block');
|
13
|
+
$this->bound = $tag === 'boundfunc';
|
14
|
+
$this->context = $this->bound ? '_this' : NULL;
|
15
|
+
|
16
|
+
return $this;
|
17
|
+
}
|
18
|
+
|
19
|
+
function compile_node($options)
|
20
|
+
{
|
21
|
+
$options['scope'] = new Scope($options['scope'], $this->body, $this);
|
22
|
+
$options['scope']->shared = del($options, 'sharedScope');
|
23
|
+
$options['indent'] .= TAB;
|
24
|
+
|
25
|
+
unset($options['bare']);
|
26
|
+
unset($options['isExistentialEquals']);
|
27
|
+
|
28
|
+
$params = array();
|
29
|
+
$exprs = array();
|
30
|
+
|
31
|
+
foreach ($this->param_names() as $name)
|
32
|
+
{
|
33
|
+
if ( ! $options['scope']->check($name))
|
34
|
+
{
|
35
|
+
$options['scope']->parameter($name);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
foreach ($this->params as $param)
|
40
|
+
{
|
41
|
+
if ($param->splat)
|
42
|
+
{
|
43
|
+
foreach ($this->params as $p)
|
44
|
+
{
|
45
|
+
if (isset($p->name->value) && $p->name->value)
|
46
|
+
{
|
47
|
+
$options['scope']->add($p->name->value, 'var', TRUE);
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
$tmp = array();
|
52
|
+
|
53
|
+
foreach ($this->params as $p)
|
54
|
+
{
|
55
|
+
$tmp[] = $p->as_reference($options);
|
56
|
+
}
|
57
|
+
|
58
|
+
$splats = yy('Assign', yy('Value', yy('Arr', $tmp)), yy('Value', yy('Literal', 'arguments')));
|
59
|
+
|
60
|
+
break;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
foreach ($this->params as $param)
|
65
|
+
{
|
66
|
+
if ($param->is_complex())
|
67
|
+
{
|
68
|
+
$val = $ref = $param->as_reference($options);
|
69
|
+
|
70
|
+
if (isset($param->value) && $param->value)
|
71
|
+
{
|
72
|
+
$val = yy('Op', '?', $ref, $param->value);
|
73
|
+
}
|
74
|
+
|
75
|
+
$exprs[] = yy('Assign', yy('Value', $param->name), $val, '=', array('param' => TRUE));
|
76
|
+
}
|
77
|
+
else
|
78
|
+
{
|
79
|
+
$ref = $param;
|
80
|
+
|
81
|
+
if (isset($param->value) && $param->value)
|
82
|
+
{
|
83
|
+
$lit = yy('Literal', $ref->name->value.' == null');
|
84
|
+
$val = yy('Assign', yy('Value', $param->name), $param->value, '=');
|
85
|
+
|
86
|
+
$exprs[] = yy('If', $lit, $val);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
if ( ! (isset($splats) && $splats))
|
91
|
+
{
|
92
|
+
$params[] = $ref;
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
$was_empty = $this->body->is_empty();
|
97
|
+
|
98
|
+
if (isset($splats) && $splats)
|
99
|
+
{
|
100
|
+
array_unshift($exprs, $splats);
|
101
|
+
}
|
102
|
+
|
103
|
+
if ($exprs)
|
104
|
+
{
|
105
|
+
foreach (array_reverse($exprs) as $expr)
|
106
|
+
{
|
107
|
+
array_unshift($this->body->expressions, $expr);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
foreach ($params as $i => $p)
|
112
|
+
{
|
113
|
+
$options['scope']->parameter(($params[$i] = $p->compile($options)));
|
114
|
+
}
|
115
|
+
|
116
|
+
$uniqs = array();
|
117
|
+
|
118
|
+
foreach ($this->param_names() as $name)
|
119
|
+
{
|
120
|
+
if (in_array($name, $uniqs))
|
121
|
+
{
|
122
|
+
throw new SyntaxError("multiple parameters named $name");
|
123
|
+
}
|
124
|
+
|
125
|
+
$uniqs[] = $name;
|
126
|
+
}
|
127
|
+
|
128
|
+
if ( ! ($was_empty || $this->no_return))
|
129
|
+
{
|
130
|
+
$this->body->make_return();
|
131
|
+
}
|
132
|
+
|
133
|
+
if ($this->bound)
|
134
|
+
{
|
135
|
+
if (isset($options['scope']->parent->method->bound) && $options['scope']->parent->method->bound)
|
136
|
+
{
|
137
|
+
$this->bound = $this->context = $options['scope']->parent->method->context;
|
138
|
+
}
|
139
|
+
else if ( ! (isset($this->static) && $this->static))
|
140
|
+
{
|
141
|
+
$options['scope']->parent->assign('_this', 'this');
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
$idt = $options['indent'];
|
146
|
+
$code = 'function';
|
147
|
+
|
148
|
+
if ($this->ctor)
|
149
|
+
{
|
150
|
+
$code .= ' '.$this->name;
|
151
|
+
}
|
152
|
+
|
153
|
+
$code .= '('.implode(', ', $params).') {';
|
154
|
+
|
155
|
+
if ( ! $this->body->is_empty())
|
156
|
+
{
|
157
|
+
$code .= "\n".$this->body->compile_with_declarations($options)."\n{$this->tab}";
|
158
|
+
}
|
159
|
+
|
160
|
+
$code .= '}';
|
161
|
+
|
162
|
+
if ($this->ctor)
|
163
|
+
{
|
164
|
+
return $this->tab.$code;
|
165
|
+
}
|
166
|
+
|
167
|
+
return ($this->front || $options['level'] >= LEVEL_ACCESS) ? "({$code})" : $code;
|
168
|
+
}
|
169
|
+
|
170
|
+
function param_names()
|
171
|
+
{
|
172
|
+
$names = array();
|
173
|
+
|
174
|
+
foreach ($this->params as $param)
|
175
|
+
{
|
176
|
+
$names = array_merge($names, (array) $param->names());
|
177
|
+
}
|
178
|
+
|
179
|
+
return $names;
|
180
|
+
}
|
181
|
+
|
182
|
+
function is_statement($options = NULL)
|
183
|
+
{
|
184
|
+
return !! $this->ctor;
|
185
|
+
}
|
186
|
+
|
187
|
+
function jumps()
|
188
|
+
{
|
189
|
+
return FALSE;
|
190
|
+
}
|
191
|
+
|
192
|
+
function traverse_children($cross_scope, $func)
|
193
|
+
{
|
194
|
+
if ($cross_scope)
|
195
|
+
{
|
196
|
+
return parent::traverse_children($cross_scope, $func);
|
197
|
+
}
|
198
|
+
|
199
|
+
return NULL;
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
?>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Comment extends yy_Base
|
6
|
+
{
|
7
|
+
function constructor()
|
8
|
+
{
|
9
|
+
list($comment) = args(func_get_args(), 1);
|
10
|
+
|
11
|
+
$this->comment = $comment;
|
12
|
+
|
13
|
+
return $this;
|
14
|
+
}
|
15
|
+
|
16
|
+
function compile_node($options, $level = NULL)
|
17
|
+
{
|
18
|
+
$code = '/*'.multident($this->comment, $this->tab)."\n{$this->tab}*/\n";
|
19
|
+
|
20
|
+
if ($level === LEVEL_TOP || $options['level'] === LEVEL_TOP)
|
21
|
+
{
|
22
|
+
$code = $options['indent'].$code;
|
23
|
+
}
|
24
|
+
|
25
|
+
return $code;
|
26
|
+
}
|
27
|
+
|
28
|
+
function is_statement($options = NULL)
|
29
|
+
{
|
30
|
+
return TRUE;
|
31
|
+
}
|
32
|
+
|
33
|
+
function make_return($res = NULL)
|
34
|
+
{
|
35
|
+
return $this;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
?>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Existence extends yy_Base
|
6
|
+
{
|
7
|
+
public $children = array('expression');
|
8
|
+
|
9
|
+
function constructor($expression)
|
10
|
+
{
|
11
|
+
$this->expression = $expression;
|
12
|
+
|
13
|
+
return $this;
|
14
|
+
}
|
15
|
+
|
16
|
+
function compile_node($options = array())
|
17
|
+
{
|
18
|
+
$this->expression->front = $this->front;
|
19
|
+
$code = $this->expression->compile($options, LEVEL_OP);
|
20
|
+
|
21
|
+
if (preg_match(IDENTIFIER, $code) && ! $options['scope']->check($code))
|
22
|
+
{
|
23
|
+
list($cmp, $cnj) = $this->negated ? array('===', '||') : array('!==', '&&');
|
24
|
+
|
25
|
+
$code = "typeof {$code} {$cmp} \"undefined\" {$cnj} {$code} {$cmp} null";
|
26
|
+
}
|
27
|
+
else
|
28
|
+
{
|
29
|
+
$code = "{$code} ".($this->negated ? '==' : '!=').' null';
|
30
|
+
}
|
31
|
+
|
32
|
+
return (isset($options['level']) && $options['level'] <= LEVEL_COND) ? $code : "({$code})";
|
33
|
+
}
|
34
|
+
|
35
|
+
function invert()
|
36
|
+
{
|
37
|
+
$this->negated = ! $this->negated;
|
38
|
+
return $this;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
?>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Extends extends yy_Base
|
6
|
+
{
|
7
|
+
public $children = array('child', 'parent');
|
8
|
+
|
9
|
+
function constructor($child, $parent)
|
10
|
+
{
|
11
|
+
$this->child = $child;
|
12
|
+
$this->parent = $parent;
|
13
|
+
|
14
|
+
return $this;
|
15
|
+
}
|
16
|
+
|
17
|
+
function compile($options, $level = NULL)
|
18
|
+
{
|
19
|
+
$tmp = yy('Call', yy('Value', yy('Literal', utility('extends'))),
|
20
|
+
array($this->child, $this->parent));
|
21
|
+
|
22
|
+
return $tmp->compile($options);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
?>
|
@@ -0,0 +1,250 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_For extends yy_While
|
6
|
+
{
|
7
|
+
public $children = array('body', 'source', 'guard', 'step');
|
8
|
+
|
9
|
+
function constructor()
|
10
|
+
{
|
11
|
+
list($body, $source) = args(func_get_args(), 2);
|
12
|
+
|
13
|
+
$this->source = $source['source'];
|
14
|
+
$this->guard = isset($source['guard']) ? $source['guard'] : NULL;
|
15
|
+
$this->step = isset($source['step']) ? $source['step'] : NULL;
|
16
|
+
$this->name = isset($source['name']) ? $source['name'] : NULL;
|
17
|
+
$this->index = isset($source['index']) ? $source['index'] : NULL;
|
18
|
+
|
19
|
+
$this->body = yy_Block::wrap(array($body));
|
20
|
+
|
21
|
+
$this->own = (isset($source['own']) && $source['own']);
|
22
|
+
$this->object = (isset($source['object']) && $source['object']);
|
23
|
+
|
24
|
+
if ($this->object)
|
25
|
+
{
|
26
|
+
$tmp = $this->name;
|
27
|
+
$this->name = $this->index;
|
28
|
+
$this->index = $tmp;
|
29
|
+
}
|
30
|
+
|
31
|
+
if ($this->index instanceof yy_Value)
|
32
|
+
{
|
33
|
+
throw SyntaxError('index cannot be a pattern matching expression');
|
34
|
+
}
|
35
|
+
|
36
|
+
$this->range = $this->source instanceof yy_Value && $this->source->base instanceof yy_Range &&
|
37
|
+
! count($this->source->properties);
|
38
|
+
|
39
|
+
$this->pattern = $this->name instanceof yy_Value;
|
40
|
+
|
41
|
+
if ($this->range && $this->index)
|
42
|
+
{
|
43
|
+
throw SyntaxError('indexes do not apply to range loops');
|
44
|
+
}
|
45
|
+
|
46
|
+
if ($this->range && $this->pattern)
|
47
|
+
{
|
48
|
+
throw SyntaxError('cannot pattern match over range loops');
|
49
|
+
}
|
50
|
+
|
51
|
+
$this->returns = FALSE;
|
52
|
+
|
53
|
+
return $this;
|
54
|
+
}
|
55
|
+
|
56
|
+
function compile_node($options)
|
57
|
+
{
|
58
|
+
$body = yy_Block::wrap(array($this->body));
|
59
|
+
|
60
|
+
$last_jumps = last($body->expressions);
|
61
|
+
$last_jumps = $last_jumps ? $last_jumps->jumps() : FALSE;
|
62
|
+
|
63
|
+
if ($last_jumps && $last_jumps instanceof yy_Return)
|
64
|
+
{
|
65
|
+
$this->returns = FALSE;
|
66
|
+
}
|
67
|
+
|
68
|
+
if ($this->range)
|
69
|
+
{
|
70
|
+
$source = $this->source->base;
|
71
|
+
}
|
72
|
+
else
|
73
|
+
{
|
74
|
+
$source = $this->source;
|
75
|
+
}
|
76
|
+
|
77
|
+
$scope = $options['scope'];
|
78
|
+
|
79
|
+
$name = $this->name ? $this->name->compile($options, LEVEL_LIST) : FALSE;
|
80
|
+
$index = $this->index ? $this->index->compile($options, LEVEL_LIST) : FALSE;
|
81
|
+
|
82
|
+
if ($name && ! $this->pattern)
|
83
|
+
{
|
84
|
+
$scope->find($name, array('immediate' => TRUE));
|
85
|
+
}
|
86
|
+
|
87
|
+
if ($index)
|
88
|
+
{
|
89
|
+
$scope->find($index, array('immediate' => TRUE));
|
90
|
+
}
|
91
|
+
|
92
|
+
if ($this->returns)
|
93
|
+
{
|
94
|
+
$rvar = $scope->free_variable('results');
|
95
|
+
}
|
96
|
+
|
97
|
+
$ivar = $this->object ? $index : $scope->free_variable('i');
|
98
|
+
$kvar = $this->range ? ($name ? $name : ($index ? $index : $ivar)) : ($index ? $index : $ivar);
|
99
|
+
$kvar_assign = $kvar !== $ivar ? "{$kvar} = " : '';
|
100
|
+
|
101
|
+
if ($this->step && ! $this->range)
|
102
|
+
{
|
103
|
+
$stepvar = $scope->free_variable('step');
|
104
|
+
}
|
105
|
+
|
106
|
+
if ($this->pattern)
|
107
|
+
{
|
108
|
+
$name = $ivar;
|
109
|
+
}
|
110
|
+
|
111
|
+
$var_part = '';
|
112
|
+
$guard_part = '';
|
113
|
+
$def_part = '';
|
114
|
+
|
115
|
+
$idt1 = $this->tab.TAB;
|
116
|
+
|
117
|
+
if ($this->range)
|
118
|
+
{
|
119
|
+
$for_part = $source->compile(array_merge($options, array('index' => $ivar, 'name' => $name, 'step' => $this->step)));
|
120
|
+
}
|
121
|
+
else
|
122
|
+
{
|
123
|
+
$svar = $this->source->compile($options, LEVEL_LIST);
|
124
|
+
|
125
|
+
if (($name || $this->own) && ! preg_match(IDENTIFIER, $svar))
|
126
|
+
{
|
127
|
+
$ref = $scope->free_variable('ref');
|
128
|
+
$def_part = "{$this->tab}{$ref} = {$svar};\n";
|
129
|
+
$svar = $ref;
|
130
|
+
}
|
131
|
+
|
132
|
+
if ($name && ! $this->pattern)
|
133
|
+
{
|
134
|
+
$name_part = "{$name} = {$svar}[{$kvar}]";
|
135
|
+
}
|
136
|
+
|
137
|
+
if ( ! $this->object)
|
138
|
+
{
|
139
|
+
$lvar = $scope->free_variable('len');
|
140
|
+
$for_var_part = "{$kvar_assign}{$ivar} = 0, {$lvar} = {$svar}.length";
|
141
|
+
|
142
|
+
if ($this->step)
|
143
|
+
{
|
144
|
+
$for_var_part .= ", {$stepvar} = ".$this->step->compile($options, LEVEL_OP);
|
145
|
+
}
|
146
|
+
|
147
|
+
$step_part = $kvar_assign.($this->step ? "{$ivar} += {$stepvar}" : ($kvar !== $ivar ? "++{$ivar}" : "{$ivar}++"));
|
148
|
+
$for_part = "{$for_var_part}; {$ivar} < {$lvar}; {$step_part}";
|
149
|
+
}
|
150
|
+
}
|
151
|
+
|
152
|
+
if ($this->returns)
|
153
|
+
{
|
154
|
+
$result_part = "{$this->tab}{$rvar} = [];\n";
|
155
|
+
$return_result = "\n{$this->tab}return {$rvar};";
|
156
|
+
$body->make_return($rvar);
|
157
|
+
}
|
158
|
+
|
159
|
+
if ($this->guard)
|
160
|
+
{
|
161
|
+
if (count($body->expressions) > 1)
|
162
|
+
{
|
163
|
+
array_unshift($body->expressions, yy('If', yy('Parens', $this->guard)->invert(), yy('Literal', 'continue')));
|
164
|
+
}
|
165
|
+
else
|
166
|
+
{
|
167
|
+
$body = yy_Block::wrap(array(yy('If', $this->guard, $body)));
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
if ($this->pattern)
|
172
|
+
{
|
173
|
+
array_unshift($body->expressions, yy('Assign', $this->name, yy('Literal', "{$svar}[{$kvar}]")));
|
174
|
+
}
|
175
|
+
|
176
|
+
$def_part .= $this->pluck_direct_call($options, $body);
|
177
|
+
|
178
|
+
if (isset($name_part) && $name_part)
|
179
|
+
{
|
180
|
+
$var_part = "\n{$idt1}{$name_part};";
|
181
|
+
}
|
182
|
+
|
183
|
+
if ($this->object)
|
184
|
+
{
|
185
|
+
$for_part = "{$kvar} in {$svar}";
|
186
|
+
|
187
|
+
if ($this->own)
|
188
|
+
{
|
189
|
+
$guard_part = "\n{$idt1}if (!".utility('hasProp').".call({$svar}, {$kvar})) continue;";
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
$body = $body->compile(array_merge($options, array('indent' => $idt1)), LEVEL_TOP);
|
194
|
+
|
195
|
+
if ($body)
|
196
|
+
{
|
197
|
+
$body = "\n{$body}\n";
|
198
|
+
}
|
199
|
+
|
200
|
+
return
|
201
|
+
"{$def_part}"
|
202
|
+
. (isset($result_part) ? $result_part : '')
|
203
|
+
. "{$this->tab}for ({$for_part}) {{$guard_part}{$var_part}{$body}{$this->tab}}"
|
204
|
+
. (isset($return_result) ? $return_result : '');
|
205
|
+
}
|
206
|
+
|
207
|
+
function pluck_direct_call($options, $body)
|
208
|
+
{
|
209
|
+
$defs = '';
|
210
|
+
|
211
|
+
foreach ($body->expressions as $idx => $expr)
|
212
|
+
{
|
213
|
+
$expr = $expr->unwrap_all();
|
214
|
+
|
215
|
+
if ( ! ($expr instanceof yy_Call))
|
216
|
+
{
|
217
|
+
continue;
|
218
|
+
}
|
219
|
+
|
220
|
+
$val = $expr->variable->unwrap_all();
|
221
|
+
|
222
|
+
if ( ! ( ($val instanceof yy_Code) ||
|
223
|
+
($val instanceof yy_Value) &&
|
224
|
+
(isset($val->base) && $val->base && ($val->base->unwrap_all() instanceof yy_Code) &&
|
225
|
+
count($val->properties) === 1 &&
|
226
|
+
isset($val->properties[0]->name) &&
|
227
|
+
in_array($val->properties[0]->name['value'], array('call', 'apply'), TRUE))))
|
228
|
+
{
|
229
|
+
continue;
|
230
|
+
}
|
231
|
+
|
232
|
+
$fn = (isset($val->base) && $val->base) ? $val->base->unwrap_all() : $val;
|
233
|
+
$ref = yy('Literal', $options['scope']->free_variable('fn'));
|
234
|
+
$base = yy('Value', $ref);
|
235
|
+
|
236
|
+
if (isset($val->base) && $val->base)
|
237
|
+
{
|
238
|
+
list($val->base, $base) = array($base, $val);
|
239
|
+
}
|
240
|
+
|
241
|
+
$body->expressions[$idx] = yy('Call', $base, $expr->args);
|
242
|
+
$tmp = yy('Assign', $ref, $fn);
|
243
|
+
$defs .= $this->tab.$tmp->compile($options, LEVEL_TOP).";\n";
|
244
|
+
}
|
245
|
+
|
246
|
+
return $defs;
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
250
|
+
?>
|