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,283 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Call extends yy_Base
|
6
|
+
{
|
7
|
+
public $children = array('variable', 'args');
|
8
|
+
|
9
|
+
private $is_new;
|
10
|
+
private $is_super;
|
11
|
+
|
12
|
+
function constructor($variable = NULL, $args = array(), $soak = FALSE)
|
13
|
+
{
|
14
|
+
$this->args = $args;
|
15
|
+
$this->is_new = FALSE;
|
16
|
+
$this->is_super = $variable === 'super';
|
17
|
+
$this->variable = $this->is_super() ? NULL : $variable;
|
18
|
+
$this->soak = $soak;
|
19
|
+
|
20
|
+
return $this;
|
21
|
+
}
|
22
|
+
|
23
|
+
function compile_node($options)
|
24
|
+
{
|
25
|
+
if ($this->variable)
|
26
|
+
{
|
27
|
+
$this->variable->front = $this->front;
|
28
|
+
}
|
29
|
+
|
30
|
+
if (($code = yy_Splat::compile_splatted_array($options, $this->args, TRUE)))
|
31
|
+
{
|
32
|
+
return $this->compile_splat($options, $code);
|
33
|
+
}
|
34
|
+
|
35
|
+
$args = $this->filter_implicit_objects($this->args);
|
36
|
+
$tmp = array();
|
37
|
+
|
38
|
+
foreach ($args as $arg)
|
39
|
+
{
|
40
|
+
$tmp[] = $arg->compile($options, LEVEL_LIST);
|
41
|
+
}
|
42
|
+
|
43
|
+
$args = implode(', ', $tmp);
|
44
|
+
|
45
|
+
if ($this->is_super())
|
46
|
+
{
|
47
|
+
return $this->super_reference($options).'.call(this'.($args ? ', '.$args : '').')';
|
48
|
+
}
|
49
|
+
else
|
50
|
+
{
|
51
|
+
return ($this->is_new() ? 'new ' : '').$this->variable->compile($options, LEVEL_ACCESS)."({$args})";
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
function compile_super($args, $options)
|
56
|
+
{
|
57
|
+
return $this->super_reference($options).'.call(this'.(count($args) ? ', ' : '').$args.')';
|
58
|
+
}
|
59
|
+
|
60
|
+
function compile_splat($options, $splat_args)
|
61
|
+
{
|
62
|
+
if ($this->is_super())
|
63
|
+
{
|
64
|
+
return $this->super_reference($options).'.apply(this, '.$splat_args.')';
|
65
|
+
}
|
66
|
+
|
67
|
+
if ($this->is_new())
|
68
|
+
{
|
69
|
+
$idt = $this->tab.TAB;
|
70
|
+
|
71
|
+
return
|
72
|
+
"(function(func, args, ctor) {\n"
|
73
|
+
. "{$idt}ctor.prototype = func.prototype;\n"
|
74
|
+
. "{$idt}var child = new ctor, result = func.apply(child, args), t = typeof result;\n"
|
75
|
+
. "{$idt}return t == \"object\" || t == \"function\" ? result || child : child;\n"
|
76
|
+
. "{$this->tab}})(".$this->variable->compile($options, LEVEL_LIST).", $splat_args, function(){})";
|
77
|
+
}
|
78
|
+
|
79
|
+
$base = yy('Value', $this->variable);
|
80
|
+
|
81
|
+
if (($name = array_pop($base->properties)) && $base->is_complex())
|
82
|
+
{
|
83
|
+
$ref = $options['scope']->free_variable('ref');
|
84
|
+
$fun = "($ref = ".$base->compile($options, LEVEL_LIST).')'.$name->compile($options).'';
|
85
|
+
}
|
86
|
+
else
|
87
|
+
{
|
88
|
+
$fun = $base->compile($options, LEVEL_ACCESS);
|
89
|
+
$fun = preg_match(SIMPLENUM, $fun) ? "($fun)" : $fun;
|
90
|
+
|
91
|
+
if ($name)
|
92
|
+
{
|
93
|
+
$ref = $fun;
|
94
|
+
$fun .= $name->compile($options);
|
95
|
+
}
|
96
|
+
else
|
97
|
+
{
|
98
|
+
$ref = NULL;
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
$ref = $ref === NULL ? 'null' : $ref;
|
103
|
+
|
104
|
+
return "{$fun}.apply({$ref}, {$splat_args})";
|
105
|
+
}
|
106
|
+
|
107
|
+
function is_new($set = NULL)
|
108
|
+
{
|
109
|
+
if ($set !== NULL)
|
110
|
+
{
|
111
|
+
$this->is_new = !! $set;
|
112
|
+
}
|
113
|
+
|
114
|
+
return $this->is_new;
|
115
|
+
}
|
116
|
+
|
117
|
+
function is_super()
|
118
|
+
{
|
119
|
+
return $this->is_super;
|
120
|
+
}
|
121
|
+
|
122
|
+
function filter_implicit_objects($list)
|
123
|
+
{
|
124
|
+
$nodes = array();
|
125
|
+
|
126
|
+
foreach ($list as $node)
|
127
|
+
{
|
128
|
+
if ( ! ($node->is_object() && $node->base->generated))
|
129
|
+
{
|
130
|
+
$nodes[] = $node;
|
131
|
+
continue;
|
132
|
+
}
|
133
|
+
|
134
|
+
$obj = NULL;
|
135
|
+
|
136
|
+
foreach ($node->base->properties as $prop)
|
137
|
+
{
|
138
|
+
if (($prop instanceof yy_Assign) || $prop instanceof yy_Comment)
|
139
|
+
{
|
140
|
+
if ( ! $obj)
|
141
|
+
{
|
142
|
+
$nodes[] = ($obj = yy('Obj', array(), TRUE));
|
143
|
+
}
|
144
|
+
|
145
|
+
$obj->properties[] = $prop;
|
146
|
+
}
|
147
|
+
else
|
148
|
+
{
|
149
|
+
$nodes[] = $prop;
|
150
|
+
$obj = NULL;
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
return $nodes;
|
156
|
+
}
|
157
|
+
|
158
|
+
function new_instance()
|
159
|
+
{
|
160
|
+
$base = isset($this->variable->base) ? $this->variable->base : $this->variable;
|
161
|
+
|
162
|
+
if (($base instanceof yy_Call) && ! $base->is_new())
|
163
|
+
{
|
164
|
+
$base->new_instance();
|
165
|
+
}
|
166
|
+
else
|
167
|
+
{
|
168
|
+
$this->is_new = TRUE;
|
169
|
+
}
|
170
|
+
|
171
|
+
return $this;
|
172
|
+
}
|
173
|
+
|
174
|
+
function super_reference($options)
|
175
|
+
{
|
176
|
+
$method = $options['scope']->method;
|
177
|
+
|
178
|
+
if ($method === NULL)
|
179
|
+
{
|
180
|
+
throw new SyntaxError('cannot call super outside of a function.');
|
181
|
+
}
|
182
|
+
|
183
|
+
$name = isset($method->name) ? $method->name : NULL;
|
184
|
+
|
185
|
+
if ($name === NULL)
|
186
|
+
{
|
187
|
+
throw new SyntaxError('cannot call super on an anonymous function.');
|
188
|
+
}
|
189
|
+
|
190
|
+
if (isset($method->klass) && $method->klass)
|
191
|
+
{
|
192
|
+
$accesses = array(yy('Access', yy('Literal', '__super__')));
|
193
|
+
|
194
|
+
if (isset($method->static) && $method->static)
|
195
|
+
{
|
196
|
+
$accesses[] = yy('Access', yy('Literal', 'constructor'));
|
197
|
+
}
|
198
|
+
|
199
|
+
$accesses[] = yy('Access', yy('Literal', $name));
|
200
|
+
|
201
|
+
return yy('Value', yy('Literal', $method->klass), $accesses)->compile($options);
|
202
|
+
}
|
203
|
+
else
|
204
|
+
{
|
205
|
+
return $name.'.__super__.constructor';
|
206
|
+
}
|
207
|
+
}
|
208
|
+
|
209
|
+
function unfold_soak($options = NULL)
|
210
|
+
{
|
211
|
+
if ($this->soak)
|
212
|
+
{
|
213
|
+
if ($this->variable)
|
214
|
+
{
|
215
|
+
if ($ifn = unfold_soak($options, $this, 'variable'))
|
216
|
+
{
|
217
|
+
return $ifn;
|
218
|
+
}
|
219
|
+
|
220
|
+
$tmp = yy('Value', $this->variable);
|
221
|
+
list($left, $rite) = $tmp->cache_reference($options);
|
222
|
+
}
|
223
|
+
else
|
224
|
+
{
|
225
|
+
$left = yy('Literal', $this->super_reference($options));
|
226
|
+
$rite = yy('Value', $left);
|
227
|
+
}
|
228
|
+
|
229
|
+
$rite = yy('Call', $rite, $this->args);
|
230
|
+
$rite->is_new($this->is_new());
|
231
|
+
$left = yy('Literal', 'typeof '.$left->compile($options).' === "function"');
|
232
|
+
|
233
|
+
return yy('If', $left, yy('Value', $rite), array('soak' => TRUE));
|
234
|
+
}
|
235
|
+
|
236
|
+
$call = $this;
|
237
|
+
$list = array();
|
238
|
+
|
239
|
+
while (TRUE)
|
240
|
+
{
|
241
|
+
if ($call->variable instanceof yy_Call)
|
242
|
+
{
|
243
|
+
$list[] = $call;
|
244
|
+
$call = $call->variable;
|
245
|
+
|
246
|
+
continue;
|
247
|
+
}
|
248
|
+
|
249
|
+
if ( ! ($call->variable instanceof yy_Value))
|
250
|
+
{
|
251
|
+
break;
|
252
|
+
}
|
253
|
+
|
254
|
+
$list[] = $call;
|
255
|
+
|
256
|
+
if ( ! (($call = $call->variable->base) instanceof yy_Call))
|
257
|
+
{
|
258
|
+
break;
|
259
|
+
}
|
260
|
+
}
|
261
|
+
|
262
|
+
foreach (array_reverse($list) as $call)
|
263
|
+
{
|
264
|
+
if (isset($ifn))
|
265
|
+
{
|
266
|
+
if ($call->variable instanceof yy_Call)
|
267
|
+
{
|
268
|
+
$call->variable = $ifn;
|
269
|
+
}
|
270
|
+
else
|
271
|
+
{
|
272
|
+
$call->variable->base = $ifn;
|
273
|
+
}
|
274
|
+
}
|
275
|
+
|
276
|
+
$ifn = unfold_soak($options, $call, 'variable');
|
277
|
+
}
|
278
|
+
|
279
|
+
return isset($ifn) ? $ifn : NULL;
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
283
|
+
?>
|
@@ -0,0 +1,282 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Class extends yy_Base
|
6
|
+
{
|
7
|
+
public $children = array('variable', 'parent', 'body');
|
8
|
+
|
9
|
+
function constructor($variable = NULL, $parent = NULL, $body = NULL)
|
10
|
+
{
|
11
|
+
$this->variable = $variable;
|
12
|
+
$this->parent = $parent;
|
13
|
+
|
14
|
+
$this->body = $body === NULL ? yy('Block') : $body;
|
15
|
+
$this->body->class_body = TRUE;
|
16
|
+
|
17
|
+
$this->bound_funcs = array();
|
18
|
+
|
19
|
+
return $this;
|
20
|
+
}
|
21
|
+
|
22
|
+
function add_bound_functions($options)
|
23
|
+
{
|
24
|
+
if ($this->bound_funcs)
|
25
|
+
{
|
26
|
+
foreach ($this->bound_funcs as $bvar)
|
27
|
+
{
|
28
|
+
$lhs = yy('Value', yy('Literal', 'this'), array(yy('Access', $bvar)))->compile($options);
|
29
|
+
$this->ctor->body->unshift(yy('Literal', "{$lhs} = ".utility('bind')."({$lhs}, this)"));
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
function add_properties($node, $name, $options)
|
35
|
+
{
|
36
|
+
$props = array_slice($node->base->properties, 0);
|
37
|
+
$exprs = array();
|
38
|
+
|
39
|
+
while ($assign = array_shift($props))
|
40
|
+
{
|
41
|
+
if ($assign instanceof yy_Assign)
|
42
|
+
{
|
43
|
+
$base = $assign->variable->base;
|
44
|
+
$func = $assign->value;
|
45
|
+
|
46
|
+
$assign->context = NULL;
|
47
|
+
|
48
|
+
if ($base->value === 'constructor')
|
49
|
+
{
|
50
|
+
if ($this->ctor)
|
51
|
+
{
|
52
|
+
throw new Error('cannot define more than one constructor in a class');
|
53
|
+
}
|
54
|
+
|
55
|
+
if (isset($func->bound) && $func->bound)
|
56
|
+
{
|
57
|
+
throw new Error('cannot define a constructor as a bound functions');
|
58
|
+
}
|
59
|
+
|
60
|
+
if ($func instanceof yy_Code)
|
61
|
+
{
|
62
|
+
$assign = $this->ctor = $func;
|
63
|
+
}
|
64
|
+
else
|
65
|
+
{
|
66
|
+
$this->external_ctor = $options['scope']->free_variable('class');
|
67
|
+
$assign = yy('Assign', yy('Literal', $this->external_ctor), $func);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
else
|
71
|
+
{
|
72
|
+
if (isset($assign->variable->this) && $assign->variable->this)
|
73
|
+
{
|
74
|
+
$func->static = TRUE;
|
75
|
+
|
76
|
+
if (isset($func->bound) && $func->bound)
|
77
|
+
{
|
78
|
+
$func->context = $name;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
else
|
82
|
+
{
|
83
|
+
$assign->variable = yy('Value', yy('Literal', $name), array( yy('Access', yy('Literal', 'prototype')), yy('Access', $base) ));
|
84
|
+
|
85
|
+
if ($func instanceof yy_Code && isset($func->bound) && $func->bound)
|
86
|
+
{
|
87
|
+
$this->bound_funcs[] = $base;
|
88
|
+
$func->bound = FALSE;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
$exprs[] = $assign;
|
95
|
+
}
|
96
|
+
|
97
|
+
return compact($exprs);
|
98
|
+
}
|
99
|
+
|
100
|
+
function compile_node($options)
|
101
|
+
{
|
102
|
+
$decl = $this->determine_name();
|
103
|
+
|
104
|
+
$name = $decl ? $decl : '_Class';
|
105
|
+
|
106
|
+
if (isset($name->reserved) && $name->reserved)
|
107
|
+
{
|
108
|
+
$name = '_'.$name;
|
109
|
+
}
|
110
|
+
|
111
|
+
$lname = yy('Literal', $name);
|
112
|
+
|
113
|
+
$this->hoist_directive_prologue();
|
114
|
+
$this->set_context($name);
|
115
|
+
$this->walk_body($name, $options);
|
116
|
+
$this->ensure_constructor($name);
|
117
|
+
$this->body->spaced = TRUE;
|
118
|
+
|
119
|
+
if ( ! ($this->ctor instanceof yy_Code))
|
120
|
+
{
|
121
|
+
array_unshift($this->body->expressions, $this->ctor);
|
122
|
+
}
|
123
|
+
|
124
|
+
if ($decl)
|
125
|
+
{
|
126
|
+
array_unshift($this->body->expressions, yy('Assign', yy('Value', yy('Literal', $name), array(yy('Access', yy('Literal', 'name')))), yy('Literal', "'{$name}'")));
|
127
|
+
}
|
128
|
+
|
129
|
+
$this->body->expressions[] = $lname;
|
130
|
+
$this->body->expressions = array_merge($this->directives, $this->body->expressions);
|
131
|
+
|
132
|
+
$this->add_bound_functions($options);
|
133
|
+
|
134
|
+
$call = yy_Closure::wrap($this->body);
|
135
|
+
|
136
|
+
if ($this->parent)
|
137
|
+
{
|
138
|
+
$this->super_class = yy('Literal', $options['scope']->free_variable('super', FALSE));
|
139
|
+
array_unshift($this->body->expressions, yy('Extends', $lname, $this->super_class));
|
140
|
+
$call->args[] = $this->parent;
|
141
|
+
|
142
|
+
if (isset($call->variable->params))
|
143
|
+
{
|
144
|
+
$params = & $call->variable->params;
|
145
|
+
}
|
146
|
+
else
|
147
|
+
{
|
148
|
+
$params = & $call->variable->base->params;
|
149
|
+
}
|
150
|
+
|
151
|
+
$params[] = yy('Param', $this->super_class);
|
152
|
+
}
|
153
|
+
|
154
|
+
$klass = yy('Parens', $call, TRUE);
|
155
|
+
|
156
|
+
if ($this->variable)
|
157
|
+
{
|
158
|
+
$klass = yy('Assign', $this->variable, $klass);
|
159
|
+
}
|
160
|
+
|
161
|
+
return $klass->compile($options);
|
162
|
+
}
|
163
|
+
|
164
|
+
function determine_name()
|
165
|
+
{
|
166
|
+
if ( ! (isset($this->variable) && $this->variable))
|
167
|
+
{
|
168
|
+
return NULL;
|
169
|
+
}
|
170
|
+
|
171
|
+
if (($tail = last($this->variable->properties)))
|
172
|
+
{
|
173
|
+
$decl = $tail instanceof yy_Access ? $tail->name->value : NULL;
|
174
|
+
}
|
175
|
+
else
|
176
|
+
{
|
177
|
+
$decl = $this->variable->base->value;
|
178
|
+
}
|
179
|
+
|
180
|
+
if (in_array($decl, Lexer::$STRICT_PROSCRIBED, TRUE))
|
181
|
+
{
|
182
|
+
throw new SyntaxError("variable name may not be $decl");
|
183
|
+
}
|
184
|
+
|
185
|
+
$decl = $decl ? (preg_match(IDENTIFIER, $decl) ? $decl : NULL) : NULL;
|
186
|
+
|
187
|
+
return $decl;
|
188
|
+
}
|
189
|
+
|
190
|
+
function ensure_constructor($name)
|
191
|
+
{
|
192
|
+
if ( ! (isset($this->ctor) && $this->ctor))
|
193
|
+
{
|
194
|
+
$this->ctor = yy('Code');
|
195
|
+
|
196
|
+
if ($this->parent)
|
197
|
+
{
|
198
|
+
$this->ctor->body->push(yy('Literal', "{$name}.__super__.constructor.apply(this, arguments)"));
|
199
|
+
}
|
200
|
+
|
201
|
+
if (isset($this->external_ctor) && $this->external_ctor)
|
202
|
+
{
|
203
|
+
$this->ctor->body->push(yy('Literal', "{$this->external_ctor}.apply(this, arguments)"));
|
204
|
+
}
|
205
|
+
|
206
|
+
$this->ctor->body->make_return();
|
207
|
+
|
208
|
+
array_unshift($this->body->expressions, $this->ctor);
|
209
|
+
}
|
210
|
+
|
211
|
+
$this->ctor->ctor = $this->ctor->name = $name;
|
212
|
+
|
213
|
+
$this->ctor->klass = NULL;
|
214
|
+
$this->ctor->no_return = TRUE;
|
215
|
+
}
|
216
|
+
|
217
|
+
function hoist_directive_prologue()
|
218
|
+
{
|
219
|
+
$index = 0;
|
220
|
+
$expressions = $this->body->expressions;
|
221
|
+
|
222
|
+
while (isset($expressions[$index]) && ($node = $expressions[$index]) && ( ($node instanceof yy_Comment) || ($node instanceof yy_Value) && $node->is_string() ))
|
223
|
+
{
|
224
|
+
$index++;
|
225
|
+
}
|
226
|
+
|
227
|
+
$this->directives = array_slice($expressions, 0, $index);
|
228
|
+
}
|
229
|
+
|
230
|
+
function set_context($name)
|
231
|
+
{
|
232
|
+
$this->body->traverse_children(FALSE, function($node) use ($name)
|
233
|
+
{
|
234
|
+
if (isset($node->class_body) && $node->class_body)
|
235
|
+
{
|
236
|
+
return FALSE;
|
237
|
+
}
|
238
|
+
|
239
|
+
if ($node instanceof yy_Literal && ''.$node->value === 'this')
|
240
|
+
{
|
241
|
+
$node->value = $name;
|
242
|
+
}
|
243
|
+
else if ($node instanceof yy_Code)
|
244
|
+
{
|
245
|
+
$node->klass = $name;
|
246
|
+
|
247
|
+
if ($node->bound)
|
248
|
+
{
|
249
|
+
$node->context = $name;
|
250
|
+
}
|
251
|
+
}
|
252
|
+
});
|
253
|
+
}
|
254
|
+
|
255
|
+
function walk_body($name, $options)
|
256
|
+
{
|
257
|
+
$self = $this;
|
258
|
+
|
259
|
+
$this->traverse_children(FALSE, function($child) use ($name, $options, & $self)
|
260
|
+
{
|
261
|
+
if ($child instanceof yy_Class)
|
262
|
+
{
|
263
|
+
return FALSE;
|
264
|
+
}
|
265
|
+
|
266
|
+
if ($child instanceof yy_Block)
|
267
|
+
{
|
268
|
+
foreach (($exps = $child->expressions) as $i => $node)
|
269
|
+
{
|
270
|
+
if ($node instanceof yy_Value && $node->is_object(TRUE))
|
271
|
+
{
|
272
|
+
$exps[$i] = $self->add_properties($node, $name, $options);
|
273
|
+
}
|
274
|
+
}
|
275
|
+
|
276
|
+
$child->expressions = $exps = flatten($exps);
|
277
|
+
}
|
278
|
+
});
|
279
|
+
}
|
280
|
+
}
|
281
|
+
|
282
|
+
?>
|