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,37 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Throw 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
|
+
return $this->tab.'throw '.$this->expression->compile($options).';';
|
19
|
+
}
|
20
|
+
|
21
|
+
function is_statement($options = NULL)
|
22
|
+
{
|
23
|
+
return TRUE;
|
24
|
+
}
|
25
|
+
|
26
|
+
function jumps()
|
27
|
+
{
|
28
|
+
return FALSE;
|
29
|
+
}
|
30
|
+
|
31
|
+
function make_return($res = NULL)
|
32
|
+
{
|
33
|
+
return $this;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
?>
|
@@ -0,0 +1,79 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Try extends yy_Base
|
6
|
+
{
|
7
|
+
public $children = array('attempt', 'recovery', 'ensure');
|
8
|
+
|
9
|
+
function constructor($attempt = NULL, $error = NULL, $recovery = NULL, $ensure = NULL)
|
10
|
+
{
|
11
|
+
$this->attempt = $attempt;
|
12
|
+
$this->error = $error;
|
13
|
+
$this->recovery = $recovery;
|
14
|
+
$this->ensure = $ensure;
|
15
|
+
|
16
|
+
return $this;
|
17
|
+
}
|
18
|
+
|
19
|
+
function compile_node($options = array())
|
20
|
+
{
|
21
|
+
$options['indent'] .= TAB;
|
22
|
+
$error_part = $this->error ? ' ('.$this->error->compile($options).') ' : ' ';
|
23
|
+
$try_part = $this->attempt->compile($options, LEVEL_TOP);
|
24
|
+
$catch_part = '';
|
25
|
+
|
26
|
+
if ($this->recovery)
|
27
|
+
{
|
28
|
+
if (in_array($this->error, Lexer::$STRICT_PROSCRIBED))
|
29
|
+
{
|
30
|
+
throw new SyntaxError('catch variable may not be "'.$this->error->value.'"');
|
31
|
+
}
|
32
|
+
|
33
|
+
if ( ! $options['scope']->check($this->error->value))
|
34
|
+
{
|
35
|
+
$options['scope']->add($this->error->value, 'param');
|
36
|
+
}
|
37
|
+
|
38
|
+
$catch_part = " catch{$error_part}{\n".$this->recovery->compile($options, LEVEL_TOP)."\n{$this->tab}}";
|
39
|
+
}
|
40
|
+
else if ( ! ($this->ensure || $this->recovery))
|
41
|
+
{
|
42
|
+
$catch_part = ' catch (_error) {}';
|
43
|
+
}
|
44
|
+
|
45
|
+
$ensure_part = isset($this->ensure) && $this->ensure ? " finally {\n".$this->ensure->compile($options, LEVEL_TOP)."\n{$this->tab}}" : '';
|
46
|
+
|
47
|
+
return
|
48
|
+
"{$this->tab}try {\n"
|
49
|
+
. $try_part."\n"
|
50
|
+
. "{$this->tab}}{$catch_part}{$ensure_part}";
|
51
|
+
}
|
52
|
+
|
53
|
+
function is_statement($options = NULL)
|
54
|
+
{
|
55
|
+
return TRUE;
|
56
|
+
}
|
57
|
+
|
58
|
+
function jumps($options = array())
|
59
|
+
{
|
60
|
+
return $this->attempt->jumps($options) || (isset($this->recovery) && $this->recovery->jumps($options));
|
61
|
+
}
|
62
|
+
|
63
|
+
function make_return($res = NULL)
|
64
|
+
{
|
65
|
+
if ($this->attempt)
|
66
|
+
{
|
67
|
+
$this->attempt = $this->attempt->make_return($res);
|
68
|
+
}
|
69
|
+
|
70
|
+
if ($this->recovery)
|
71
|
+
{
|
72
|
+
$this->recovery = $this->recovery->make_return($res);
|
73
|
+
}
|
74
|
+
|
75
|
+
return $this;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
?>
|
@@ -0,0 +1,210 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Value extends yy_Base
|
6
|
+
{
|
7
|
+
public $children = array('base', 'properties');
|
8
|
+
|
9
|
+
function constructor($base = NULL, $props = NULL, $tag = NULL)
|
10
|
+
{
|
11
|
+
if ( ! $props && $base instanceof yy_Value)
|
12
|
+
{
|
13
|
+
return $base;
|
14
|
+
}
|
15
|
+
|
16
|
+
$this->base = $base;
|
17
|
+
$this->properties = $props ? $props : array();
|
18
|
+
|
19
|
+
if ($tag)
|
20
|
+
{
|
21
|
+
$this->{$tag} = TRUE;
|
22
|
+
}
|
23
|
+
|
24
|
+
return $this;
|
25
|
+
}
|
26
|
+
|
27
|
+
function add($prop)
|
28
|
+
{
|
29
|
+
$this->properties = array_merge($this->properties, is_object($prop) ? array($prop) : (array) $prop);
|
30
|
+
|
31
|
+
return $this;
|
32
|
+
}
|
33
|
+
|
34
|
+
function assigns($name)
|
35
|
+
{
|
36
|
+
return ! count($this->properties) && $this->base->assigns($name);
|
37
|
+
}
|
38
|
+
|
39
|
+
function cache_reference($options)
|
40
|
+
{
|
41
|
+
$name = last($this->properties);
|
42
|
+
|
43
|
+
if (count($this->properties) < 2 && ! $this->base->is_complex() && ! ($name && $name->is_complex()))
|
44
|
+
{
|
45
|
+
return array($this, $this);
|
46
|
+
}
|
47
|
+
|
48
|
+
$base = yy('Value', $this->base, array_slice($this->properties, 0, -1));
|
49
|
+
$bref = NULL;
|
50
|
+
|
51
|
+
if ($base->is_complex())
|
52
|
+
{
|
53
|
+
$bref = yy('Literal', $options['scope']->free_variable('base'));
|
54
|
+
$base = yy('Value', yy('Parens', yy('Assign', $bref, $base)));
|
55
|
+
}
|
56
|
+
|
57
|
+
if ( ! $name)
|
58
|
+
{
|
59
|
+
return array($base, $bref);
|
60
|
+
}
|
61
|
+
|
62
|
+
if ($name->is_complex())
|
63
|
+
{
|
64
|
+
$nref = yy('Literal', $options['scope']->free_variable('name'));
|
65
|
+
$name = yy('Index', yy('Assign', $nref, $name->index));
|
66
|
+
$nref = yy('Index', $nref);
|
67
|
+
}
|
68
|
+
|
69
|
+
$base->add($name);
|
70
|
+
|
71
|
+
return array($base, yy('Value', isset($bref) ? $bref : $base->base, array(isset($nref) ? $nref : $name)));
|
72
|
+
}
|
73
|
+
|
74
|
+
function compile_node($options)
|
75
|
+
{
|
76
|
+
$this->base->front = $this->front;
|
77
|
+
$props = $this->properties;
|
78
|
+
|
79
|
+
$code = $this->base->compile($options, count($props) ? LEVEL_ACCESS : NULL);
|
80
|
+
|
81
|
+
if ( (($this->base instanceof yy_Parens) || count($props)) && preg_match(SIMPLENUM, $code))
|
82
|
+
{
|
83
|
+
$code = $code.'.';
|
84
|
+
}
|
85
|
+
|
86
|
+
foreach ($props as $prop)
|
87
|
+
{
|
88
|
+
$code .= $prop->compile($options);
|
89
|
+
}
|
90
|
+
|
91
|
+
return $code;
|
92
|
+
}
|
93
|
+
|
94
|
+
function has_properties()
|
95
|
+
{
|
96
|
+
return !! count($this->properties);
|
97
|
+
}
|
98
|
+
|
99
|
+
function is_array()
|
100
|
+
{
|
101
|
+
return ! count($this->properties) && $this->base instanceof yy_Arr;
|
102
|
+
}
|
103
|
+
|
104
|
+
function is_assignable()
|
105
|
+
{
|
106
|
+
return $this->has_properties() || $this->base->is_assignable();
|
107
|
+
}
|
108
|
+
|
109
|
+
function is_atomic()
|
110
|
+
{
|
111
|
+
foreach (array_merge($this->properties, array($this->base)) as $node)
|
112
|
+
{
|
113
|
+
if ((isset($node->soak) && $node->soak) || $node instanceof yy_Call)
|
114
|
+
{
|
115
|
+
return FALSE;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
return TRUE;
|
120
|
+
}
|
121
|
+
|
122
|
+
function is_complex()
|
123
|
+
{
|
124
|
+
return $this->has_properties() || $this->base->is_complex();
|
125
|
+
}
|
126
|
+
|
127
|
+
function is_object($only_generated = FALSE)
|
128
|
+
{
|
129
|
+
if (count($this->properties))
|
130
|
+
{
|
131
|
+
return FALSE;
|
132
|
+
}
|
133
|
+
|
134
|
+
return ($this->base instanceof yy_Obj) && ( ! $only_generated || $this->base->generated);
|
135
|
+
}
|
136
|
+
|
137
|
+
function is_simple_number()
|
138
|
+
{
|
139
|
+
return ($this->base instanceof yy_Literal) && preg_match(SIMPLENUM, ''.$this->base->value);
|
140
|
+
}
|
141
|
+
|
142
|
+
function is_splice()
|
143
|
+
{
|
144
|
+
return last($this->properties) instanceof yy_Slice;
|
145
|
+
}
|
146
|
+
|
147
|
+
function is_string()
|
148
|
+
{
|
149
|
+
return ($this->base instanceof yy_Literal) && preg_match(IS_STRING, ''.$this->base->value);
|
150
|
+
}
|
151
|
+
|
152
|
+
function is_statement($options = NULL)
|
153
|
+
{
|
154
|
+
return ! count($this->properties) && $this->base->is_statement($options);
|
155
|
+
}
|
156
|
+
|
157
|
+
function jumps($options = array())
|
158
|
+
{
|
159
|
+
return ! count($this->properties) && $this->base->jumps($options);
|
160
|
+
}
|
161
|
+
|
162
|
+
function unfold_soak($options = NULL)
|
163
|
+
{
|
164
|
+
if (isset($this->unfolded_soak))
|
165
|
+
{
|
166
|
+
return $this->unfolded_soak;
|
167
|
+
}
|
168
|
+
|
169
|
+
if (($ifn = $this->base->unfold_soak($options)))
|
170
|
+
{
|
171
|
+
$ifn->body->properties = array_merge($ifn->body->properties, $this->properties);
|
172
|
+
$result = $ifn;
|
173
|
+
}
|
174
|
+
else
|
175
|
+
{
|
176
|
+
foreach ($this->properties as $i => $prop)
|
177
|
+
{
|
178
|
+
if (isset($prop->soak) && $prop->soak)
|
179
|
+
{
|
180
|
+
$prop->soak = FALSE;
|
181
|
+
|
182
|
+
$fst = yy('Value', $this->base, array_slice($this->properties, 0, $i));
|
183
|
+
$snd = yy('Value', $this->base, array_slice($this->properties, $i));
|
184
|
+
|
185
|
+
if ($fst->is_complex())
|
186
|
+
{
|
187
|
+
$ref = yy('Literal', $options['scope']->free_variable('ref'));
|
188
|
+
$fst = yy('Parens', yy('Assign', $ref, $fst));
|
189
|
+
$snd->base = $ref;
|
190
|
+
}
|
191
|
+
|
192
|
+
$result = yy('If', yy('Existence', $fst), $snd, array('soak' => TRUE));
|
193
|
+
|
194
|
+
break;
|
195
|
+
}
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
$this->unfolded_soak = isset($result) ? $result : FALSE;
|
200
|
+
|
201
|
+
return $this->unfolded_soak;
|
202
|
+
}
|
203
|
+
|
204
|
+
function unwrap()
|
205
|
+
{
|
206
|
+
return count($this->properties) ? $this : $this->base;
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
?>
|
@@ -0,0 +1,112 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_While extends yy_Base
|
6
|
+
{
|
7
|
+
public $children = array('condition', 'guard', 'body');
|
8
|
+
|
9
|
+
public $returns = FALSE;
|
10
|
+
|
11
|
+
function constructor()
|
12
|
+
{
|
13
|
+
list($condition, $options) = args(func_get_args(), 0, array(NULL, NULL));
|
14
|
+
|
15
|
+
$this->condition = (isset($options['invert']) && $options['invert']) ?
|
16
|
+
$condition->invert() : $condition;
|
17
|
+
|
18
|
+
$this->guard = isset($options['guard']) ? $options['guard'] : NULL;
|
19
|
+
|
20
|
+
return $this;
|
21
|
+
}
|
22
|
+
|
23
|
+
function add_body($body)
|
24
|
+
{
|
25
|
+
$this->body = $body;
|
26
|
+
return $this;
|
27
|
+
}
|
28
|
+
|
29
|
+
function compile_node($options)
|
30
|
+
{
|
31
|
+
$options['indent'] .= TAB;
|
32
|
+
$set = '';
|
33
|
+
$body = $this->body;
|
34
|
+
|
35
|
+
if ($body->is_empty())
|
36
|
+
{
|
37
|
+
$body = '';
|
38
|
+
}
|
39
|
+
else
|
40
|
+
{
|
41
|
+
if ($this->returns)
|
42
|
+
{
|
43
|
+
$body->make_return($rvar = $options['scope']->free_variable('results'));
|
44
|
+
$set = "{$this->tab}{$rvar} = [];\n";
|
45
|
+
}
|
46
|
+
|
47
|
+
if ($this->guard)
|
48
|
+
{
|
49
|
+
if (count($body->expressions) > 1)
|
50
|
+
{
|
51
|
+
array_unshift($body->expressions, yy('If', yy('Parens', $this->guard)->invert(), yy('Literal', 'continue')));
|
52
|
+
}
|
53
|
+
else
|
54
|
+
{
|
55
|
+
$body = yy_Block::wrap(array(yy('If', $this->guard, $body)));
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
$body = "\n".$body->compile($options, LEVEL_TOP)."\n{$this->tab}";
|
60
|
+
}
|
61
|
+
|
62
|
+
$code = $set.$this->tab.'while ('.$this->condition->compile($options, LEVEL_PAREN).") {{$body}}";
|
63
|
+
|
64
|
+
if ($this->returns)
|
65
|
+
{
|
66
|
+
$code .= "\n{$this->tab}return {$rvar};";
|
67
|
+
}
|
68
|
+
|
69
|
+
return $code;
|
70
|
+
}
|
71
|
+
|
72
|
+
function is_statement($options = NULL)
|
73
|
+
{
|
74
|
+
return TRUE;
|
75
|
+
}
|
76
|
+
|
77
|
+
function jumps()
|
78
|
+
{
|
79
|
+
$expressions = isset($this->body->expressions) ? $this->body->expressions : array();
|
80
|
+
|
81
|
+
if ( ! count($expressions))
|
82
|
+
{
|
83
|
+
return FALSE;
|
84
|
+
}
|
85
|
+
|
86
|
+
foreach ($expressions as $node)
|
87
|
+
{
|
88
|
+
if ($node->jumps(array('loop' => TRUE)))
|
89
|
+
{
|
90
|
+
return $node;
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
return FALSE;
|
95
|
+
}
|
96
|
+
|
97
|
+
function make_return($res = NULL)
|
98
|
+
{
|
99
|
+
if ($res)
|
100
|
+
{
|
101
|
+
return parent::make_return($res);
|
102
|
+
}
|
103
|
+
else
|
104
|
+
{
|
105
|
+
$this->returns = ! $this->jumps(array('loop' => TRUE));
|
106
|
+
}
|
107
|
+
|
108
|
+
return $this;
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
?>
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Array Literals
|
2
|
+
# --------------
|
3
|
+
|
4
|
+
# * Array Literals
|
5
|
+
# * Splats in Array Literals
|
6
|
+
|
7
|
+
# TODO: add indexing and method invocation tests: [1][0] is 1, [].toString()
|
8
|
+
|
9
|
+
test "trailing commas", ->
|
10
|
+
trailingComma = [1, 2, 3,]
|
11
|
+
ok (trailingComma[0] is 1) and (trailingComma[2] is 3) and (trailingComma.length is 3)
|
12
|
+
|
13
|
+
trailingComma = [
|
14
|
+
1, 2, 3,
|
15
|
+
4, 5, 6
|
16
|
+
7, 8, 9,
|
17
|
+
]
|
18
|
+
(sum = (sum or 0) + n) for n in trailingComma
|
19
|
+
|
20
|
+
a = [((x) -> x), ((x) -> x * x)]
|
21
|
+
ok a.length is 2
|
22
|
+
|
23
|
+
test "incorrect indentation without commas", ->
|
24
|
+
result = [['a']
|
25
|
+
{b: 'c'}]
|
26
|
+
ok result[0][0] is 'a'
|
27
|
+
ok result[1]['b'] is 'c'
|
28
|
+
|
29
|
+
|
30
|
+
# Splats in Array Literals
|
31
|
+
|
32
|
+
test "array splat expansions with assignments", ->
|
33
|
+
nums = [1, 2, 3]
|
34
|
+
list = [a = 0, nums..., b = 4]
|
35
|
+
eq 0, a
|
36
|
+
eq 4, b
|
37
|
+
arrayEq [0,1,2,3,4], list
|
38
|
+
|
39
|
+
|
40
|
+
test "mixed shorthand objects in array lists", ->
|
41
|
+
|
42
|
+
arr = [
|
43
|
+
a:1
|
44
|
+
'b'
|
45
|
+
c:1
|
46
|
+
]
|
47
|
+
ok arr.length is 3
|
48
|
+
ok arr[2].c is 1
|
49
|
+
|
50
|
+
arr = [b: 1, a: 2, 100]
|
51
|
+
eq arr[1], 100
|
52
|
+
|
53
|
+
arr = [a:0, b:1, (1 + 1)]
|
54
|
+
eq arr[1], 2
|
55
|
+
|
56
|
+
arr = [a:1, 'a', b:1, 'b']
|
57
|
+
eq arr.length, 4
|
58
|
+
eq arr[2].b, 1
|
59
|
+
eq arr[3], 'b'
|
60
|
+
|
61
|
+
|
62
|
+
test "array splats with nested arrays", ->
|
63
|
+
nonce = {}
|
64
|
+
a = [nonce]
|
65
|
+
list = [1, 2, a...]
|
66
|
+
eq list[0], 1
|
67
|
+
eq list[2], nonce
|
68
|
+
|
69
|
+
a = [[nonce]]
|
70
|
+
list = [1, 2, a...]
|
71
|
+
arrayEq list, [1, 2, [nonce]]
|
72
|
+
|
73
|
+
test "#1274: `[] = a()` compiles to `false` instead of `a()`", ->
|
74
|
+
a = false
|
75
|
+
fn = -> a = true
|
76
|
+
[] = fn()
|
77
|
+
ok a
|