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,196 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
Init::init();
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Lexical scope manager.
|
9
|
+
*/
|
10
|
+
class Scope
|
11
|
+
{
|
12
|
+
static $root = NULL;
|
13
|
+
|
14
|
+
public $shared = FALSE;
|
15
|
+
private $has_assignments = FALSE;
|
16
|
+
|
17
|
+
function __construct($parent, $expressions, $method)
|
18
|
+
{
|
19
|
+
$this->parent = $parent;
|
20
|
+
$this->expressions = $expressions;
|
21
|
+
$this->method = $method;
|
22
|
+
|
23
|
+
$this->variables = array(
|
24
|
+
array('name' => 'arguments', 'type' => 'arguments')
|
25
|
+
);
|
26
|
+
|
27
|
+
$this->positions = array();
|
28
|
+
|
29
|
+
if ( ! $this->parent)
|
30
|
+
{
|
31
|
+
self::$root = $this;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
function add($name, $type, $immediate = FALSE)
|
36
|
+
{
|
37
|
+
$name = ''.$name;
|
38
|
+
|
39
|
+
if ($this->shared && ! $immediate)
|
40
|
+
{
|
41
|
+
return $this->parent->add($name, $type, $immediate);
|
42
|
+
}
|
43
|
+
|
44
|
+
if (isset($this->positions[$name]))
|
45
|
+
{
|
46
|
+
$this->variables[$this->positions[$name]]['type'] = $type;
|
47
|
+
}
|
48
|
+
else
|
49
|
+
{
|
50
|
+
$this->variables[] = array('name' => $name, 'type' => $type);
|
51
|
+
$this->positions[$name] = count($this->variables) - 1;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
function assign($name, $value)
|
56
|
+
{
|
57
|
+
$this->add($name, array('value' => $value, 'assigned' => TRUE), TRUE);
|
58
|
+
$this->has_assignments = TRUE;
|
59
|
+
}
|
60
|
+
|
61
|
+
function assigned_variables()
|
62
|
+
{
|
63
|
+
$tmp = array();
|
64
|
+
|
65
|
+
foreach ($this->variables as $v)
|
66
|
+
{
|
67
|
+
$type = $v['type'];
|
68
|
+
|
69
|
+
if (is_array($type) && isset($type['assigned']) && $type['assigned'])
|
70
|
+
{
|
71
|
+
$tmp[] = "{$v['name']} = {$type['value']}";
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
return $tmp;
|
76
|
+
}
|
77
|
+
|
78
|
+
function check($name, $immediate = FALSE)
|
79
|
+
{
|
80
|
+
$name = ''.$name;
|
81
|
+
|
82
|
+
$found = !! $this->type($name);
|
83
|
+
|
84
|
+
if ($found || $immediate)
|
85
|
+
{
|
86
|
+
return $found;
|
87
|
+
}
|
88
|
+
|
89
|
+
return $this->parent ? $this->parent->check($name) : FALSE;
|
90
|
+
}
|
91
|
+
|
92
|
+
function declared_variables()
|
93
|
+
{
|
94
|
+
$real_vars = array();
|
95
|
+
$temp_vars = array();
|
96
|
+
|
97
|
+
foreach ($this->variables as $v)
|
98
|
+
{
|
99
|
+
if ($v['type'] === 'var')
|
100
|
+
{
|
101
|
+
if ($v['name']{0} === '_')
|
102
|
+
{
|
103
|
+
$temp_vars[] = $v['name'];
|
104
|
+
}
|
105
|
+
else
|
106
|
+
{
|
107
|
+
$real_vars[] = $v['name'];
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
asort($real_vars);
|
113
|
+
asort($temp_vars);
|
114
|
+
|
115
|
+
return array_merge($real_vars, $temp_vars);
|
116
|
+
}
|
117
|
+
|
118
|
+
function find($name, $options = array())
|
119
|
+
{
|
120
|
+
if ($this->check($name, $options))
|
121
|
+
{
|
122
|
+
return TRUE;
|
123
|
+
}
|
124
|
+
|
125
|
+
$this->add($name, 'var');
|
126
|
+
|
127
|
+
return FALSE;
|
128
|
+
}
|
129
|
+
|
130
|
+
function free_variable($name, $reserve = TRUE)
|
131
|
+
{
|
132
|
+
$index = 0;
|
133
|
+
|
134
|
+
while ($this->check(($temp = $this->temporary($name, $index))))
|
135
|
+
{
|
136
|
+
$index++;
|
137
|
+
}
|
138
|
+
|
139
|
+
if ($reserve)
|
140
|
+
{
|
141
|
+
$this->add($temp, 'var', TRUE);
|
142
|
+
}
|
143
|
+
|
144
|
+
return $temp;
|
145
|
+
}
|
146
|
+
|
147
|
+
function has_assignments()
|
148
|
+
{
|
149
|
+
return $this->has_assignments;
|
150
|
+
}
|
151
|
+
|
152
|
+
function has_declarations()
|
153
|
+
{
|
154
|
+
return !! count($this->declared_variables());
|
155
|
+
}
|
156
|
+
|
157
|
+
function parameter($name)
|
158
|
+
{
|
159
|
+
if ($this->shared && $this->parent->check($name, TRUE))
|
160
|
+
{
|
161
|
+
return;
|
162
|
+
}
|
163
|
+
|
164
|
+
$this->add($name, 'param');
|
165
|
+
}
|
166
|
+
|
167
|
+
function temporary($name, $index)
|
168
|
+
{
|
169
|
+
if (strlen($name) > 1)
|
170
|
+
{
|
171
|
+
return '_'.$name.($index > 1 ? $index - 1 : '');
|
172
|
+
}
|
173
|
+
else
|
174
|
+
{
|
175
|
+
$val = strval(base_convert($index + intval($name, 36), 10, 36));
|
176
|
+
$val = preg_replace('/\d/', 'a', $val);
|
177
|
+
|
178
|
+
return '_'.$val;
|
179
|
+
}
|
180
|
+
}
|
181
|
+
|
182
|
+
function type($name)
|
183
|
+
{
|
184
|
+
foreach ($this->variables as $v)
|
185
|
+
{
|
186
|
+
if ($v['name'] === $name)
|
187
|
+
{
|
188
|
+
return $v['type'];
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
192
|
+
return NULL;
|
193
|
+
}
|
194
|
+
}
|
195
|
+
|
196
|
+
?>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Access extends yy_Base
|
6
|
+
{
|
7
|
+
public $children = array('name');
|
8
|
+
|
9
|
+
function constructor($name, $tag = NULL)
|
10
|
+
{
|
11
|
+
$this->name = $name;
|
12
|
+
$this->name->as_key = TRUE;
|
13
|
+
|
14
|
+
$this->soak = $tag === 'soak';
|
15
|
+
|
16
|
+
return $this;
|
17
|
+
}
|
18
|
+
|
19
|
+
function compile($options, $level = NULL)
|
20
|
+
{
|
21
|
+
$name = $this->name->compile($options);
|
22
|
+
return preg_match(IDENTIFIER, $name) ? ".{$name}" : "[{$name}]";
|
23
|
+
}
|
24
|
+
|
25
|
+
function is_complex()
|
26
|
+
{
|
27
|
+
return FALSE;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
?>
|
@@ -0,0 +1,69 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Arr extends yy_Base
|
6
|
+
{
|
7
|
+
public $children = array('objects');
|
8
|
+
|
9
|
+
function constructor($objs)
|
10
|
+
{
|
11
|
+
$this->objects = $objs ? $objs : array();
|
12
|
+
|
13
|
+
return $this;
|
14
|
+
}
|
15
|
+
|
16
|
+
function assigns($name)
|
17
|
+
{
|
18
|
+
foreach ($this->objects as $obj)
|
19
|
+
{
|
20
|
+
if ($obj->assigns($name))
|
21
|
+
{
|
22
|
+
return TRUE;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
return FALSE;
|
27
|
+
}
|
28
|
+
|
29
|
+
function compile_node($options)
|
30
|
+
{
|
31
|
+
if ( ! count($options))
|
32
|
+
{
|
33
|
+
return '[]';
|
34
|
+
}
|
35
|
+
|
36
|
+
$options['indent'] .= TAB;
|
37
|
+
$objs = $this->filter_implicit_objects($this->objects);
|
38
|
+
|
39
|
+
if (($code = yy_Splat::compile_splatted_array($options, $objs)))
|
40
|
+
{
|
41
|
+
return $code;
|
42
|
+
}
|
43
|
+
|
44
|
+
$code = array();
|
45
|
+
|
46
|
+
foreach ($objs as $obj)
|
47
|
+
{
|
48
|
+
$code[] = $obj->compile($options);
|
49
|
+
}
|
50
|
+
|
51
|
+
$code = implode(', ', $code);
|
52
|
+
|
53
|
+
if (strpos($code, "\n") !== FALSE)
|
54
|
+
{
|
55
|
+
return "[\n{$options['indent']}{$code}\n{$this->tab}]";
|
56
|
+
}
|
57
|
+
else
|
58
|
+
{
|
59
|
+
return "[{$code}]";
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
function filter_implicit_objects()
|
64
|
+
{
|
65
|
+
return call_user_func_array(array(yy('Call'), __FUNCTION__), func_get_args());
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
?>
|
@@ -0,0 +1,353 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Assign extends yy_Base
|
6
|
+
{
|
7
|
+
public $children = array('variable', 'value');
|
8
|
+
|
9
|
+
function constructor($variable, $value, $context = '', $options = NULL)
|
10
|
+
{
|
11
|
+
$this->variable = $variable;
|
12
|
+
$this->value = $value;
|
13
|
+
$this->context = $context;
|
14
|
+
$this->param = $options ? $options['param'] : NULL;
|
15
|
+
|
16
|
+
$this->subpattern = isset($options['subpattern']) ? $options['subpattern'] : NULL;
|
17
|
+
|
18
|
+
$tmp = $this->variable->unwrap_all();
|
19
|
+
|
20
|
+
$forbidden = in_array($name = isset($tmp->value) ? $tmp->value : NULL, Lexer::$STRICT_PROSCRIBED);
|
21
|
+
|
22
|
+
if ($forbidden && $this->context !== 'object')
|
23
|
+
{
|
24
|
+
throw new SyntaxError("variable name may not be $name");
|
25
|
+
}
|
26
|
+
|
27
|
+
return $this;
|
28
|
+
}
|
29
|
+
|
30
|
+
function assigns()
|
31
|
+
{
|
32
|
+
list($name) = args(func_get_args(), 1);
|
33
|
+
|
34
|
+
if ($this->context === 'object')
|
35
|
+
{
|
36
|
+
return $this->value->assigns($name);
|
37
|
+
}
|
38
|
+
else
|
39
|
+
{
|
40
|
+
return $this->variable->assigns($name);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
function compile_conditional($options)
|
45
|
+
{
|
46
|
+
list($left, $right) = $this->variable->cache_reference($options);
|
47
|
+
|
48
|
+
if ( ! count($left->properties) && $left->base instanceof yy_Literal &&
|
49
|
+
$left->base->value !== 'this' && ! $options['scope']->check($left->base->value))
|
50
|
+
{
|
51
|
+
throw new Error('the variable "'.$left->base->value.'" can\'t be assigned with '.$this->context.' because it has not been defined.');
|
52
|
+
}
|
53
|
+
|
54
|
+
if (strpos($this->context, '?') > -1)
|
55
|
+
{
|
56
|
+
$options['isExistentialEquals'] = TRUE;
|
57
|
+
}
|
58
|
+
|
59
|
+
$tmp = yy('Op', substr($this->context, 0, -1), $left, yy('Assign', $right, $this->value, '='));
|
60
|
+
|
61
|
+
return $tmp->compile($options);
|
62
|
+
}
|
63
|
+
|
64
|
+
function compile_node($options)
|
65
|
+
{
|
66
|
+
if (($is_value = ($this->variable instanceof yy_Value)))
|
67
|
+
{
|
68
|
+
if ($this->variable->is_array() || $this->variable->is_object())
|
69
|
+
{
|
70
|
+
return $this->compile_pattern_match($options);
|
71
|
+
}
|
72
|
+
|
73
|
+
if ($this->variable->is_splice())
|
74
|
+
{
|
75
|
+
return $this->compile_splice($options);
|
76
|
+
}
|
77
|
+
|
78
|
+
if (in_array($this->context, array('||=', '&&=', '?='), TRUE))
|
79
|
+
{
|
80
|
+
return $this->compile_conditional($options);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
$name = $this->variable->compile($options, LEVEL_LIST);
|
85
|
+
|
86
|
+
if ( ! $this->context)
|
87
|
+
{
|
88
|
+
if ( ! ( ($var_base = $this->variable->unwrap_all()) && $var_base->is_assignable()))
|
89
|
+
{
|
90
|
+
throw new SyntaxError('"'.$this->variable->compile($options).'" cannot be assigned.');
|
91
|
+
}
|
92
|
+
|
93
|
+
if ( ! (is_callable(array($var_base, 'has_properties')) && $var_base->has_properties()))
|
94
|
+
{
|
95
|
+
if ($this->param)
|
96
|
+
{
|
97
|
+
$options['scope']->add($name, 'var');
|
98
|
+
}
|
99
|
+
else
|
100
|
+
{
|
101
|
+
$options['scope']->find($name);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
if ($this->value instanceof yy_Code && preg_match(METHOD_DEF, ''.$name, $match))
|
107
|
+
{
|
108
|
+
if (isset($match[1]) && $match[1] !== '')
|
109
|
+
{
|
110
|
+
$this->value->klass = $match[1];
|
111
|
+
}
|
112
|
+
|
113
|
+
foreach (range(2, 5) as $i)
|
114
|
+
{
|
115
|
+
if (isset($match[$i]) && $match[$i] !== '')
|
116
|
+
{
|
117
|
+
$this->value->name = $match[$i];
|
118
|
+
break;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
$val = $this->value->compile($options, LEVEL_LIST);
|
124
|
+
|
125
|
+
if ($this->context === 'object')
|
126
|
+
{
|
127
|
+
return "{$name}: {$val}";
|
128
|
+
}
|
129
|
+
|
130
|
+
$val = $name.' '.($this->context ? $this->context : '=').' '.$val;
|
131
|
+
|
132
|
+
return $options['level'] <= LEVEL_LIST ? $val : "({$val})";
|
133
|
+
}
|
134
|
+
|
135
|
+
function compile_pattern_match($options)
|
136
|
+
{
|
137
|
+
$top = $options['level'] === LEVEL_TOP;
|
138
|
+
$value = $this->value;
|
139
|
+
$objects = $this->variable->base->objects;
|
140
|
+
|
141
|
+
if ( ! ($olen = count($objects)))
|
142
|
+
{
|
143
|
+
$code = $value->compile($options);
|
144
|
+
return $options['level'] >= LEVEL_OP ? "({$code})" : $code;
|
145
|
+
}
|
146
|
+
|
147
|
+
$is_object = $this->variable->is_object();
|
148
|
+
|
149
|
+
if ($top && $olen === 1 && ! (($obj = $objects[0]) instanceof yy_Splat))
|
150
|
+
{
|
151
|
+
if ($obj instanceof yy_Assign)
|
152
|
+
{
|
153
|
+
$idx = $obj->variable->base;
|
154
|
+
$obj = $obj->value;
|
155
|
+
}
|
156
|
+
else
|
157
|
+
{
|
158
|
+
if ($obj->base instanceof yy_Parens)
|
159
|
+
{
|
160
|
+
$tmp = yy('Value', $obj->unwrap_all());
|
161
|
+
list($obj, $idx) = $tmp->cache_reference($options);
|
162
|
+
}
|
163
|
+
else
|
164
|
+
{
|
165
|
+
if ($is_object)
|
166
|
+
{
|
167
|
+
$idx = $obj->this ? $obj->properties[0]->name : $obj;
|
168
|
+
}
|
169
|
+
else
|
170
|
+
{
|
171
|
+
$idx = yy('Literal', 0);
|
172
|
+
}
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
$acc = preg_match(IDENTIFIER, $idx->unwrap()->value);
|
177
|
+
$value = yy('Value', $value);
|
178
|
+
|
179
|
+
if ($acc)
|
180
|
+
{
|
181
|
+
$value->properties[] = yy('Access', $idx);
|
182
|
+
}
|
183
|
+
else
|
184
|
+
{
|
185
|
+
$value->properties[] = yy('Index', $idx);
|
186
|
+
}
|
187
|
+
|
188
|
+
$tmp = $obj->unwrap();
|
189
|
+
$tmp = isset($tmp->value) ? $tmp->value : NULL;
|
190
|
+
|
191
|
+
if (in_array($tmp, Lexer::$COFFEE_RESERVED))
|
192
|
+
{
|
193
|
+
throw new SyntaxError('assignment to a reserved word: '.$obj->compile($options).' = '.$value->compile($options));
|
194
|
+
}
|
195
|
+
|
196
|
+
return yy('Assign', $obj, $value, NULL, array('param' => $this->param))->compile($options, LEVEL_TOP);
|
197
|
+
}
|
198
|
+
|
199
|
+
$vvar = $value->compile($options, LEVEL_LIST);
|
200
|
+
$assigns = array();
|
201
|
+
$splat = FALSE;
|
202
|
+
|
203
|
+
if ( ! preg_match(IDENTIFIER, $vvar) || $this->variable->assigns($vvar))
|
204
|
+
{
|
205
|
+
$assigns[] = ($ref = $options['scope']->free_variable('ref')).' = '.$vvar;
|
206
|
+
$vvar = $ref;
|
207
|
+
}
|
208
|
+
|
209
|
+
foreach ($objects as $i => $obj)
|
210
|
+
{
|
211
|
+
$idx = $i;
|
212
|
+
|
213
|
+
if ($is_object)
|
214
|
+
{
|
215
|
+
if ($obj instanceof yy_Assign)
|
216
|
+
{
|
217
|
+
$idx = $obj->variable->base;
|
218
|
+
$obj = $obj->value;
|
219
|
+
}
|
220
|
+
else
|
221
|
+
{
|
222
|
+
if ($obj->base instanceof yy_Parens)
|
223
|
+
{
|
224
|
+
$tmp = yy('Value', $obj->unwrap_all());
|
225
|
+
list($obj, $idx) = $tmp->cache_reference($options);
|
226
|
+
}
|
227
|
+
else
|
228
|
+
{
|
229
|
+
$idx = $obj->this ? $obj->properties[0]->name : $obj;
|
230
|
+
}
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
234
|
+
if ( ! $splat && ($obj instanceof yy_Splat))
|
235
|
+
{
|
236
|
+
$name = $obj->name->unwrap()->value;
|
237
|
+
$obj = $obj->unwrap();
|
238
|
+
|
239
|
+
$val = "{$olen} <= {$vvar}.length ? ".utility('slice').".call({$vvar}, {$i}";
|
240
|
+
$ivar = 'undefined';
|
241
|
+
|
242
|
+
if (($rest = $olen - $i - 1))
|
243
|
+
{
|
244
|
+
$ivar = $options['scope']->free_variable('i');
|
245
|
+
$val .= ", {$ivar} = {$vvar}.length - {$rest}) : ({$ivar} = {$i}, [])";
|
246
|
+
}
|
247
|
+
else
|
248
|
+
{
|
249
|
+
$val .= ') : []';
|
250
|
+
}
|
251
|
+
|
252
|
+
$val = yy('Literal', $val);
|
253
|
+
$splat = "{$ivar}++";
|
254
|
+
}
|
255
|
+
else
|
256
|
+
{
|
257
|
+
$name = $obj->unwrap();
|
258
|
+
$name = isset($name->value) ? $name->value : NULL;
|
259
|
+
|
260
|
+
if ($obj instanceof yy_Splat)
|
261
|
+
{
|
262
|
+
$obj = $obj->name->compile($options);
|
263
|
+
throw new SyntaxError("multiple splats are disallowed in an assignment: {$obj}...");
|
264
|
+
}
|
265
|
+
|
266
|
+
if (is_numeric($idx))
|
267
|
+
{
|
268
|
+
$idx = yy('Literal', $splat ? $splat : $idx);
|
269
|
+
$acc = FALSE;
|
270
|
+
}
|
271
|
+
else
|
272
|
+
{
|
273
|
+
$acc = $is_object ? preg_match(IDENTIFIER, $idx->unwrap()->value) : 0;
|
274
|
+
}
|
275
|
+
|
276
|
+
$val = yy('Value', yy('Literal', $vvar), array($acc ? yy('Access', $idx) : yy('Index', $idx)));
|
277
|
+
}
|
278
|
+
|
279
|
+
if (isset($name) && $name && in_array($name, Lexer::$COFFEE_RESERVED))
|
280
|
+
{
|
281
|
+
throw new SyntaxError("assignment to a reserved word: ".$obj->compile($options).' = '.$val->compile($options));
|
282
|
+
}
|
283
|
+
|
284
|
+
$tmp = yy('Assign', $obj, $val, NULL, array('param' => $this->param, 'subpattern' => TRUE));
|
285
|
+
$assigns[] = $tmp->compile($options, LEVEL_LIST);
|
286
|
+
}
|
287
|
+
|
288
|
+
if ( ! ($top || $this->subpattern))
|
289
|
+
{
|
290
|
+
$assigns[] = $vvar;
|
291
|
+
}
|
292
|
+
|
293
|
+
$code = implode(', ', $assigns);
|
294
|
+
|
295
|
+
return $options['level'] < LEVEL_LIST ? $code : "({$code})";
|
296
|
+
}
|
297
|
+
|
298
|
+
function compile_splice($options)
|
299
|
+
{
|
300
|
+
$tmp = array_pop($this->variable->properties);
|
301
|
+
|
302
|
+
$from = $tmp->range->from;
|
303
|
+
$to = $tmp->range->to;
|
304
|
+
$exclusive = $tmp->range->exclusive;
|
305
|
+
|
306
|
+
$name = $this->variable->compile($options);
|
307
|
+
|
308
|
+
list($from_decl, $from_ref) = $from ? $from->cache($options, LEVEL_OP) : array('0', '0');
|
309
|
+
|
310
|
+
if ($to)
|
311
|
+
{
|
312
|
+
if (($from && $from->is_simple_number()) && $to->is_simple_number())
|
313
|
+
{
|
314
|
+
$to = intval($to->compile($options)) - intval($from_ref);
|
315
|
+
|
316
|
+
if ( ! $exclusive)
|
317
|
+
{
|
318
|
+
$to++;
|
319
|
+
}
|
320
|
+
}
|
321
|
+
else
|
322
|
+
{
|
323
|
+
$to = $to->compile($options, LEVEL_ACCESS).' - '. $from_ref;
|
324
|
+
|
325
|
+
if ( ! $exclusive)
|
326
|
+
{
|
327
|
+
$to .= ' + 1';
|
328
|
+
}
|
329
|
+
}
|
330
|
+
}
|
331
|
+
else
|
332
|
+
{
|
333
|
+
$to = '9e9';
|
334
|
+
}
|
335
|
+
|
336
|
+
list($val_def, $val_ref) = $this->value->cache($options, LEVEL_LIST);
|
337
|
+
|
338
|
+
$code = "[].splice.apply({$name}, [{$from_decl}, {$to}].concat({$val_def})), {$val_ref}";
|
339
|
+
return $options['level'] > LEVEL_TOP ? "({$code})" : $code;
|
340
|
+
}
|
341
|
+
|
342
|
+
function is_statement($options = NULL)
|
343
|
+
{
|
344
|
+
return isset($options['level']) && $options['level'] === LEVEL_TOP && $this->context && strpos($this->context, '?') > -1;
|
345
|
+
}
|
346
|
+
|
347
|
+
function unfold_soak($options = NULL)
|
348
|
+
{
|
349
|
+
return unfold_soak($options, $this, 'variable');
|
350
|
+
}
|
351
|
+
}
|
352
|
+
|
353
|
+
?>
|