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,288 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
Init::init();
|
6
|
+
|
7
|
+
abstract class yy_Base
|
8
|
+
{
|
9
|
+
public $as_key = FALSE;
|
10
|
+
public $children = array();
|
11
|
+
public $ctor = NULL;
|
12
|
+
public $exclusive = NULL;
|
13
|
+
public $expression = NULL;
|
14
|
+
public $from = NULL;
|
15
|
+
public $front = NULL;
|
16
|
+
public $namespaced = FALSE;
|
17
|
+
public $negated = FALSE;
|
18
|
+
public $no_return = FALSE;
|
19
|
+
public $proto = FALSE;
|
20
|
+
public $soak = FALSE;
|
21
|
+
public $this = NULL;
|
22
|
+
public $to = NULL;
|
23
|
+
|
24
|
+
function __construct() {}
|
25
|
+
|
26
|
+
function __toString()
|
27
|
+
{
|
28
|
+
return ''.$this->to_string();
|
29
|
+
}
|
30
|
+
|
31
|
+
function cache($options, $level = NULL, $reused = NULL)
|
32
|
+
{
|
33
|
+
if ( ! $this->is_complex())
|
34
|
+
{
|
35
|
+
$ref = $level ? $this->compile($options, $level) : $this;
|
36
|
+
return array($ref, $ref);
|
37
|
+
}
|
38
|
+
else
|
39
|
+
{
|
40
|
+
$ref = yy('Literal', $reused ? $reused : $options['scope']->free_variable('ref'));
|
41
|
+
$sub = yy('Assign', $ref, $this);
|
42
|
+
|
43
|
+
if ($level)
|
44
|
+
{
|
45
|
+
return array($sub->compile($options, $level), $ref->value);
|
46
|
+
}
|
47
|
+
else
|
48
|
+
{
|
49
|
+
return array($sub, $ref);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
function compile($options, $level = NULL)
|
55
|
+
{
|
56
|
+
if (isset($level))
|
57
|
+
{
|
58
|
+
$options['level'] = $level;
|
59
|
+
}
|
60
|
+
|
61
|
+
if ( ! ($node = $this->unfold_soak($options)))
|
62
|
+
{
|
63
|
+
$node = $this;
|
64
|
+
}
|
65
|
+
|
66
|
+
$node->tab = $options['indent'];
|
67
|
+
|
68
|
+
if ($options['level'] === LEVEL_TOP || ! $node->is_statement($options))
|
69
|
+
{
|
70
|
+
return $node->compile_node($options);
|
71
|
+
}
|
72
|
+
|
73
|
+
return $node->compile_closure($options);
|
74
|
+
}
|
75
|
+
|
76
|
+
function compile_closure($options)
|
77
|
+
{
|
78
|
+
if ($this->jumps())
|
79
|
+
{
|
80
|
+
throw new SyntaxError('cannot use a pure statement in an expression.');
|
81
|
+
}
|
82
|
+
|
83
|
+
$options['sharedScope'] = TRUE;
|
84
|
+
|
85
|
+
$closure = yy_Closure::wrap($this);
|
86
|
+
|
87
|
+
return $closure->compile_node($options);
|
88
|
+
}
|
89
|
+
|
90
|
+
function compile_loop_reference($options, $name)
|
91
|
+
{
|
92
|
+
$src = $tmp = $this->compile($options, LEVEL_LIST);
|
93
|
+
|
94
|
+
if ( ! ( ($src === 0 || $src === '') || preg_match(IDENTIFIER, $src) &&
|
95
|
+
$options['scope']->check($src, TRUE)))
|
96
|
+
{
|
97
|
+
$src = ($tmp = $options['scope']->free_variable($name)).' = '.$src;
|
98
|
+
}
|
99
|
+
|
100
|
+
return array($src, $tmp);
|
101
|
+
}
|
102
|
+
|
103
|
+
function contains($pred)
|
104
|
+
{
|
105
|
+
$contains = FALSE;
|
106
|
+
|
107
|
+
if (is_string($pred))
|
108
|
+
{
|
109
|
+
$tmp = __NAMESPACE__.'\\'.$pred;
|
110
|
+
|
111
|
+
$pred = function($node) use ($tmp)
|
112
|
+
{
|
113
|
+
return call_user_func($tmp, $node);
|
114
|
+
};
|
115
|
+
}
|
116
|
+
|
117
|
+
$this->traverse_children(FALSE, function($node) use ( & $contains, & $pred)
|
118
|
+
{
|
119
|
+
if ($pred($node))
|
120
|
+
{
|
121
|
+
$contains = TRUE;
|
122
|
+
return FALSE;
|
123
|
+
}
|
124
|
+
});
|
125
|
+
|
126
|
+
return $contains;
|
127
|
+
}
|
128
|
+
|
129
|
+
function contains_type($type)
|
130
|
+
{
|
131
|
+
return ($this instanceof $type) || $this->contains(function($node) use ( & $type)
|
132
|
+
{
|
133
|
+
return $node instanceof $type;
|
134
|
+
});
|
135
|
+
}
|
136
|
+
|
137
|
+
function each_child($func)
|
138
|
+
{
|
139
|
+
if ( ! ($this->children))
|
140
|
+
{
|
141
|
+
return $this;
|
142
|
+
}
|
143
|
+
|
144
|
+
foreach ($this->children as $i => $attr)
|
145
|
+
{
|
146
|
+
if (isset($this->{$attr}) && $this->{$attr})
|
147
|
+
{
|
148
|
+
foreach (flatten(array($this->{$attr})) as $i => $child)
|
149
|
+
{
|
150
|
+
if ($func($child) === FALSE)
|
151
|
+
{
|
152
|
+
break 2;
|
153
|
+
}
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
return $this;
|
159
|
+
}
|
160
|
+
|
161
|
+
function invert()
|
162
|
+
{
|
163
|
+
return yy('Op', '!', $this);
|
164
|
+
}
|
165
|
+
|
166
|
+
function is_assignable()
|
167
|
+
{
|
168
|
+
return FALSE;
|
169
|
+
}
|
170
|
+
|
171
|
+
function is_complex()
|
172
|
+
{
|
173
|
+
return TRUE;
|
174
|
+
}
|
175
|
+
|
176
|
+
function is_chainable()
|
177
|
+
{
|
178
|
+
return FALSE;
|
179
|
+
}
|
180
|
+
|
181
|
+
function is_object()
|
182
|
+
{
|
183
|
+
return FALSE;
|
184
|
+
}
|
185
|
+
|
186
|
+
function is_statement($options = NULL)
|
187
|
+
{
|
188
|
+
return FALSE;
|
189
|
+
}
|
190
|
+
|
191
|
+
function is_undefined()
|
192
|
+
{
|
193
|
+
return FALSE;
|
194
|
+
}
|
195
|
+
|
196
|
+
function jumps()
|
197
|
+
{
|
198
|
+
return FALSE;
|
199
|
+
}
|
200
|
+
|
201
|
+
function last_non_comment($list)
|
202
|
+
{
|
203
|
+
$i = count($list);
|
204
|
+
|
205
|
+
while ($i--)
|
206
|
+
{
|
207
|
+
if ( ! ($list[$i] instanceof yy_Comment))
|
208
|
+
{
|
209
|
+
return $list[$i];
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
return NULL;
|
214
|
+
}
|
215
|
+
|
216
|
+
function make_return($res = NULL)
|
217
|
+
{
|
218
|
+
$me = $this->unwrap_all();
|
219
|
+
|
220
|
+
if ($res)
|
221
|
+
{
|
222
|
+
return yy('Call', yy('Literal', "{$res}.push"), array($me));
|
223
|
+
}
|
224
|
+
else
|
225
|
+
{
|
226
|
+
return yy('Return', $me);
|
227
|
+
}
|
228
|
+
}
|
229
|
+
|
230
|
+
function to_string($idt = '', $name = NULL)
|
231
|
+
{
|
232
|
+
if ($name === NULL)
|
233
|
+
{
|
234
|
+
$name = get_class($this);
|
235
|
+
}
|
236
|
+
|
237
|
+
$tree = "\n{$idt}{$name}";
|
238
|
+
|
239
|
+
if ($this->soak)
|
240
|
+
{
|
241
|
+
$tree .= '?';
|
242
|
+
}
|
243
|
+
|
244
|
+
$this->each_child(function($node) use ($idt, & $tree)
|
245
|
+
{
|
246
|
+
$tree .= $node->to_string($idt.TAB);
|
247
|
+
});
|
248
|
+
|
249
|
+
return $tree;
|
250
|
+
}
|
251
|
+
|
252
|
+
function traverse_children($cross_scope, $func)
|
253
|
+
{
|
254
|
+
$this->each_child(function($child) use ($cross_scope, & $func)
|
255
|
+
{
|
256
|
+
if ($func($child) === FALSE)
|
257
|
+
{
|
258
|
+
return FALSE;
|
259
|
+
}
|
260
|
+
|
261
|
+
return $child->traverse_children($cross_scope, $func);
|
262
|
+
});
|
263
|
+
}
|
264
|
+
|
265
|
+
function unfold_soak($options = NULL)
|
266
|
+
{
|
267
|
+
return FALSE;
|
268
|
+
}
|
269
|
+
|
270
|
+
function unwrap()
|
271
|
+
{
|
272
|
+
return $this;
|
273
|
+
}
|
274
|
+
|
275
|
+
function unwrap_all()
|
276
|
+
{
|
277
|
+
$node = $this;
|
278
|
+
|
279
|
+
while ($node !== ($tmp = $node->unwrap()))
|
280
|
+
{
|
281
|
+
$node = $tmp;
|
282
|
+
}
|
283
|
+
|
284
|
+
return $node;
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
?>
|
@@ -0,0 +1,294 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Block extends yy_Base
|
6
|
+
{
|
7
|
+
public $children = array('expressions');
|
8
|
+
|
9
|
+
function constructor($nodes = array())
|
10
|
+
{
|
11
|
+
$this->expressions = compact(flatten($nodes));
|
12
|
+
|
13
|
+
return $this;
|
14
|
+
}
|
15
|
+
|
16
|
+
function compile($options, $level = NULL)
|
17
|
+
{
|
18
|
+
if (isset($options['scope']))
|
19
|
+
{
|
20
|
+
return parent::compile($options, $level);
|
21
|
+
}
|
22
|
+
else
|
23
|
+
{
|
24
|
+
return $this->compile_root($options);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
function compile_node($options)
|
29
|
+
{
|
30
|
+
$this->tab = $options['indent'];
|
31
|
+
|
32
|
+
$top = $options['level'] === LEVEL_TOP;
|
33
|
+
$codes = array();
|
34
|
+
|
35
|
+
foreach ($this->expressions as $i => $node)
|
36
|
+
{
|
37
|
+
$node = $node->unwrap_all();
|
38
|
+
$node = ($tmp = $node->unfold_soak($options)) ? $tmp : $node;
|
39
|
+
|
40
|
+
if ($node instanceof yy_Block)
|
41
|
+
{
|
42
|
+
$codes[] = $node->compile_node($options);
|
43
|
+
}
|
44
|
+
else if ($top)
|
45
|
+
{
|
46
|
+
$node->front = TRUE;
|
47
|
+
$code = $node->compile($options);
|
48
|
+
|
49
|
+
if ( ! $node->is_statement($options))
|
50
|
+
{
|
51
|
+
$code = "{$this->tab}{$code};";
|
52
|
+
|
53
|
+
if ($node instanceof yy_Literal)
|
54
|
+
{
|
55
|
+
$code = "{$code}\n";
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
$codes[] = $code;
|
60
|
+
}
|
61
|
+
else
|
62
|
+
{
|
63
|
+
$codes[] = $node->compile($options, LEVEL_LIST);
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
if ($top)
|
68
|
+
{
|
69
|
+
if (isset($this->spaced) && $this->spaced)
|
70
|
+
{
|
71
|
+
return "\n".implode("\n\n", $codes)."\n";
|
72
|
+
}
|
73
|
+
else
|
74
|
+
{
|
75
|
+
return implode("\n", $codes);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
$code = ($tmp = implode(', ', $codes)) ? $tmp : 'void 0';
|
80
|
+
|
81
|
+
if (count($codes) && $options['level'] >= LEVEL_LIST)
|
82
|
+
{
|
83
|
+
return "({$code})";
|
84
|
+
}
|
85
|
+
else
|
86
|
+
{
|
87
|
+
return $code;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
function compile_root($options)
|
92
|
+
{
|
93
|
+
$options['indent'] = isset($options['bare']) && $options['bare'] ? '' : TAB;
|
94
|
+
$options['scope'] = new Scope(NULL, $this, NULL);
|
95
|
+
$options['level'] = LEVEL_TOP;
|
96
|
+
|
97
|
+
$this->spaced = TRUE;
|
98
|
+
$prelude = '';
|
99
|
+
|
100
|
+
if ( ! (isset($options['bare']) && $options['bare']))
|
101
|
+
{
|
102
|
+
$prelude_exps = array();
|
103
|
+
|
104
|
+
foreach ($this->expressions as $i => $exp)
|
105
|
+
{
|
106
|
+
if ( ! ($exp->unwrap() instanceof yy_Comment))
|
107
|
+
{
|
108
|
+
break;
|
109
|
+
}
|
110
|
+
|
111
|
+
$prelude_exps[] = $exp;
|
112
|
+
}
|
113
|
+
|
114
|
+
$rest = array_slice($this->expressions, count($prelude_exps));
|
115
|
+
$this->expressions = $prelude_exps;
|
116
|
+
|
117
|
+
if ($prelude_exps)
|
118
|
+
{
|
119
|
+
$prelude = $this->compile_node(array_merge($options, array('indent' => '')))."\n";
|
120
|
+
}
|
121
|
+
|
122
|
+
$this->expressions = $rest;
|
123
|
+
}
|
124
|
+
|
125
|
+
$code = $this->compile_with_declarations($options);
|
126
|
+
|
127
|
+
if (isset($options['bare']) && $options['bare'])
|
128
|
+
{
|
129
|
+
return $code;
|
130
|
+
}
|
131
|
+
|
132
|
+
return "{$prelude}(function() {\n{$code}\n}).call(this);\n";
|
133
|
+
}
|
134
|
+
|
135
|
+
function compile_with_declarations($options)
|
136
|
+
{
|
137
|
+
$code = $post = '';
|
138
|
+
|
139
|
+
foreach ($this->expressions as $i => & $expr)
|
140
|
+
{
|
141
|
+
$expr = $expr->unwrap();
|
142
|
+
|
143
|
+
if ( ! ($expr instanceof yy_Comment || $expr instanceof yy_Literal))
|
144
|
+
{
|
145
|
+
break;
|
146
|
+
}
|
147
|
+
}
|
148
|
+
|
149
|
+
$options = array_merge($options, array('level' => LEVEL_TOP));
|
150
|
+
|
151
|
+
if ($i)
|
152
|
+
{
|
153
|
+
$rest = array_splice($this->expressions, $i, count($this->expressions));
|
154
|
+
|
155
|
+
list($spaced, $this->spaced) = array(isset($this->spaced) && $this->spaced, FALSE);
|
156
|
+
list($code, $this->spaced) = array($this->compile_node($options), $spaced);
|
157
|
+
|
158
|
+
$this->expressions = $rest;
|
159
|
+
}
|
160
|
+
|
161
|
+
$post = $this->compile_node($options);
|
162
|
+
|
163
|
+
$scope = $options['scope'];
|
164
|
+
|
165
|
+
if ($scope->expressions === $this)
|
166
|
+
{
|
167
|
+
$declars = $scope->has_declarations();
|
168
|
+
$assigns = $scope->has_assignments();
|
169
|
+
|
170
|
+
if ($declars or $assigns)
|
171
|
+
{
|
172
|
+
if ($i)
|
173
|
+
{
|
174
|
+
$code .= "\n";
|
175
|
+
}
|
176
|
+
|
177
|
+
$code .= $this->tab.'var ';
|
178
|
+
|
179
|
+
if ($declars)
|
180
|
+
{
|
181
|
+
$code .= implode(', ', $scope->declared_variables());
|
182
|
+
}
|
183
|
+
|
184
|
+
if ($assigns)
|
185
|
+
{
|
186
|
+
if ($declars)
|
187
|
+
{
|
188
|
+
$code .= ",\n{$this->tab}".TAB;
|
189
|
+
}
|
190
|
+
|
191
|
+
$code .= implode(",\n{$this->tab}".TAB, $scope->assigned_variables());
|
192
|
+
}
|
193
|
+
|
194
|
+
$code .= ";\n";
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
return $code.$post;
|
199
|
+
}
|
200
|
+
|
201
|
+
function is_empty()
|
202
|
+
{
|
203
|
+
return ! count($this->expressions);
|
204
|
+
}
|
205
|
+
|
206
|
+
function is_statement($options = NULL)
|
207
|
+
{
|
208
|
+
foreach ($this->expressions as $i => $expr)
|
209
|
+
{
|
210
|
+
if ($expr->is_statement($options))
|
211
|
+
{
|
212
|
+
return TRUE;
|
213
|
+
}
|
214
|
+
}
|
215
|
+
|
216
|
+
return FALSE;
|
217
|
+
}
|
218
|
+
|
219
|
+
function jumps($options = array())
|
220
|
+
{
|
221
|
+
foreach ($this->expressions as $i => $expr)
|
222
|
+
{
|
223
|
+
if ($expr->jumps($options))
|
224
|
+
{
|
225
|
+
return $expr;
|
226
|
+
}
|
227
|
+
}
|
228
|
+
|
229
|
+
return FALSE;
|
230
|
+
}
|
231
|
+
|
232
|
+
function make_return($res = NULL)
|
233
|
+
{
|
234
|
+
$len = count($this->expressions);
|
235
|
+
|
236
|
+
while ($len--)
|
237
|
+
{
|
238
|
+
$expr = $this->expressions[$len];
|
239
|
+
|
240
|
+
if ( ! ($expr instanceof yy_Comment))
|
241
|
+
{
|
242
|
+
$this->expressions[$len] = $expr->make_return($res);
|
243
|
+
|
244
|
+
if ($expr instanceof yy_Return && ! (isset($expr->expression) && $expr->expression))
|
245
|
+
{
|
246
|
+
array_splice($this->expressions, $len, 1);
|
247
|
+
}
|
248
|
+
|
249
|
+
break;
|
250
|
+
}
|
251
|
+
}
|
252
|
+
|
253
|
+
return $this;
|
254
|
+
}
|
255
|
+
|
256
|
+
function pop()
|
257
|
+
{
|
258
|
+
return array_pop($this->expressions);
|
259
|
+
}
|
260
|
+
|
261
|
+
function push($node)
|
262
|
+
{
|
263
|
+
$this->expressions[] = $node;
|
264
|
+
return $this;
|
265
|
+
}
|
266
|
+
|
267
|
+
function unshift($node)
|
268
|
+
{
|
269
|
+
array_unshift($this->expressions, $node);
|
270
|
+
return $this;
|
271
|
+
}
|
272
|
+
|
273
|
+
function unwrap()
|
274
|
+
{
|
275
|
+
return count($this->expressions) === 1 ? $this->expressions[0] : $this;
|
276
|
+
}
|
277
|
+
|
278
|
+
static function wrap($nodes)
|
279
|
+
{
|
280
|
+
if ( ! is_array($nodes))
|
281
|
+
{
|
282
|
+
$nodes = array($nodes);
|
283
|
+
}
|
284
|
+
|
285
|
+
if (count($nodes) === 1 && $nodes[0] instanceof yy_Block)
|
286
|
+
{
|
287
|
+
return $nodes[0];
|
288
|
+
}
|
289
|
+
|
290
|
+
return yy('Block', $nodes);
|
291
|
+
}
|
292
|
+
}
|
293
|
+
|
294
|
+
?>
|