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,161 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_If extends yy_Base
|
6
|
+
{
|
7
|
+
public $children = array('condition', 'body', 'else_body');
|
8
|
+
|
9
|
+
function constructor($condition, $body, $options = array())
|
10
|
+
{
|
11
|
+
$this->condition = (isset($options['type']) && $options['type'] === 'unless') ? $condition->invert() : $condition;
|
12
|
+
$this->body = $body;
|
13
|
+
$this->else_body = NULL;
|
14
|
+
$this->is_chain = FALSE;
|
15
|
+
$this->soak = isset($options['soak']) ? $options['soak'] : NULL;
|
16
|
+
|
17
|
+
return $this;
|
18
|
+
}
|
19
|
+
|
20
|
+
function add_else($else_body)
|
21
|
+
{
|
22
|
+
if ($this->is_chain())
|
23
|
+
{
|
24
|
+
$this->else_body_node()->add_else($else_body);
|
25
|
+
}
|
26
|
+
else
|
27
|
+
{
|
28
|
+
$this->is_chain = $else_body instanceof yy_If;
|
29
|
+
$this->else_body = $this->ensure_block($else_body);
|
30
|
+
}
|
31
|
+
|
32
|
+
return $this;
|
33
|
+
}
|
34
|
+
|
35
|
+
function body_node()
|
36
|
+
{
|
37
|
+
return $this->body ? $this->body->unwrap() : NULL;
|
38
|
+
}
|
39
|
+
|
40
|
+
function compile_node($options = array())
|
41
|
+
{
|
42
|
+
return $this->is_statement($options) ? $this->compile_statement($options) : $this->compile_expression($options);
|
43
|
+
}
|
44
|
+
|
45
|
+
function compile_expression($options)
|
46
|
+
{
|
47
|
+
$cond = $this->condition->compile($options, LEVEL_COND);
|
48
|
+
$body = $this->body_node()->compile($options, LEVEL_LIST);
|
49
|
+
|
50
|
+
$alt = ($tmp = $this->else_body_node()) ? $tmp->compile($options, LEVEL_LIST) : 'void 0';
|
51
|
+
$code = "{$cond} ? {$body} : {$alt}";
|
52
|
+
|
53
|
+
return (isset($options['level']) && $options['level'] >= LEVEL_COND) ? "({$code})" : $code;
|
54
|
+
}
|
55
|
+
|
56
|
+
function compile_statement($options)
|
57
|
+
{
|
58
|
+
$child = del($options, 'chainChild');
|
59
|
+
$exeq = del($options, 'isExistentialEquals');
|
60
|
+
|
61
|
+
if ($exeq)
|
62
|
+
{
|
63
|
+
return yy('If', $this->condition->invert(), $this->else_body_node(), array('type' => 'if'))->compile($options);
|
64
|
+
}
|
65
|
+
|
66
|
+
$cond = $this->condition->compile($options, LEVEL_PAREN);
|
67
|
+
$options['indent'] .= TAB;
|
68
|
+
$body = $this->ensure_block($this->body);
|
69
|
+
$if_part = "if ({$cond}) {\n".$body->compile($options)."\n{$this->tab}}";
|
70
|
+
|
71
|
+
if ( ! $child)
|
72
|
+
{
|
73
|
+
$if_part = $this->tab.$if_part;
|
74
|
+
}
|
75
|
+
|
76
|
+
if ( ! $this->else_body)
|
77
|
+
{
|
78
|
+
return $if_part;
|
79
|
+
}
|
80
|
+
|
81
|
+
$ret = $if_part.' else ';
|
82
|
+
|
83
|
+
if ($this->is_chain())
|
84
|
+
{
|
85
|
+
$options['indent'] = $this->tab;
|
86
|
+
$options['chainChild'] = TRUE;
|
87
|
+
|
88
|
+
$ret .= $this->else_body->unwrap()->compile($options, LEVEL_TOP);
|
89
|
+
}
|
90
|
+
else
|
91
|
+
{
|
92
|
+
$ret .= "{\n".$this->else_body->compile($options, LEVEL_TOP)."\n{$this->tab}}";
|
93
|
+
}
|
94
|
+
|
95
|
+
return $ret;
|
96
|
+
}
|
97
|
+
|
98
|
+
function else_body_node()
|
99
|
+
{
|
100
|
+
return (isset($this->else_body) && $this->else_body) ? $this->else_body->unwrap() : NULL;
|
101
|
+
}
|
102
|
+
|
103
|
+
function ensure_block($node)
|
104
|
+
{
|
105
|
+
return $node instanceof yy_Block ? $node : yy('Block', array($node));
|
106
|
+
}
|
107
|
+
|
108
|
+
function is_chain()
|
109
|
+
{
|
110
|
+
return $this->is_chain;
|
111
|
+
}
|
112
|
+
|
113
|
+
function is_statement($options = array())
|
114
|
+
{
|
115
|
+
return (isset($options['level']) && $options['level'] === LEVEL_TOP) ||
|
116
|
+
$this->body_node()->is_statement($options) ||
|
117
|
+
(($tmp = $this->else_body_node()) && $tmp->is_statement($options));
|
118
|
+
}
|
119
|
+
|
120
|
+
function jumps($options = array())
|
121
|
+
{
|
122
|
+
$tmp = $this->body->jumps($options);
|
123
|
+
|
124
|
+
if ( ! $tmp && isset($this->else_body))
|
125
|
+
{
|
126
|
+
$tmp = $this->else_body->jumps($options);
|
127
|
+
}
|
128
|
+
|
129
|
+
return $tmp;
|
130
|
+
}
|
131
|
+
|
132
|
+
function make_return($res = NULL)
|
133
|
+
{
|
134
|
+
if ( ! (isset($this->else_body) && $this->else_body))
|
135
|
+
{
|
136
|
+
if ($res)
|
137
|
+
{
|
138
|
+
$this->else_body = yy('Block', array(yy('Literal', 'void 0')));
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
if ($this->body)
|
143
|
+
{
|
144
|
+
$this->body = yy('Block', array($this->body->make_return($res)));
|
145
|
+
}
|
146
|
+
|
147
|
+
if ($this->else_body)
|
148
|
+
{
|
149
|
+
$this->else_body = yy('Block', array($this->else_body->make_return($res)));
|
150
|
+
}
|
151
|
+
|
152
|
+
return $this;
|
153
|
+
}
|
154
|
+
|
155
|
+
function unfold_soak($options = NULL)
|
156
|
+
{
|
157
|
+
return $this->soak ? $this : FALSE;
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
?>
|
@@ -0,0 +1,99 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_In extends yy_Base
|
6
|
+
{
|
7
|
+
public $children = array('object', 'array');
|
8
|
+
|
9
|
+
public $negated = NULL;
|
10
|
+
|
11
|
+
function constructor($object = NULL, $array = NULL)
|
12
|
+
{
|
13
|
+
$this->array = $array;
|
14
|
+
$this->object = $object;
|
15
|
+
|
16
|
+
return $this;
|
17
|
+
}
|
18
|
+
|
19
|
+
function compile_node($options = array())
|
20
|
+
{
|
21
|
+
if ($this->array instanceof yy_Value && $this->array->is_array())
|
22
|
+
{
|
23
|
+
$has_splat = FALSE;
|
24
|
+
|
25
|
+
foreach ($this->array->base->objects as $obj)
|
26
|
+
{
|
27
|
+
if ($obj instanceof yy_Splat)
|
28
|
+
{
|
29
|
+
$has_splat = TRUE;
|
30
|
+
break;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
if ( ! $has_splat)
|
35
|
+
{
|
36
|
+
return $this->compile_or_test($options);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
return $this->compile_loop_test($options);
|
41
|
+
}
|
42
|
+
|
43
|
+
function compile_or_test($options)
|
44
|
+
{
|
45
|
+
if (count($this->array->base->objects) === 0)
|
46
|
+
{
|
47
|
+
return $this->negated ? 'true' : 'false';
|
48
|
+
}
|
49
|
+
|
50
|
+
list($sub, $ref) = $this->object->cache($options, LEVEL_OP);
|
51
|
+
list($cmp, $cnj) = $this->negated ? array(' !== ', ' && ') : array(' === ', ' || ');
|
52
|
+
|
53
|
+
$tests = array();
|
54
|
+
|
55
|
+
foreach ($this->array->base->objects as $i => $item)
|
56
|
+
{
|
57
|
+
$tests[] = ($i ? $ref : $sub).$cmp.$item->compile($options, LEVEL_ACCESS);
|
58
|
+
}
|
59
|
+
|
60
|
+
if ( ! $tests)
|
61
|
+
{
|
62
|
+
// In JavaScript '' + false gives 'false', not so in PHP
|
63
|
+
return 'false';
|
64
|
+
}
|
65
|
+
|
66
|
+
$tests = implode($cnj, $tests);
|
67
|
+
|
68
|
+
return (isset($options['level']) && $options['level'] < LEVEL_OP) ? $tests : "({$tests})";
|
69
|
+
}
|
70
|
+
|
71
|
+
function compile_loop_test($options)
|
72
|
+
{
|
73
|
+
list($sub, $ref) = $this->object->cache($options, LEVEL_LIST);
|
74
|
+
|
75
|
+
$code = utility('indexOf').".call(".$this->array->compile($options, LEVEL_LIST).", {$ref}) "
|
76
|
+
.($this->negated ? '< 0' : '>= 0');
|
77
|
+
|
78
|
+
if ($sub === $ref)
|
79
|
+
{
|
80
|
+
return $code;
|
81
|
+
}
|
82
|
+
|
83
|
+
$code = $sub.', '.$code;
|
84
|
+
return (isset($options['level']) && $options['level'] < LEVEL_LIST) ? $code : "({$code})";
|
85
|
+
}
|
86
|
+
|
87
|
+
function invert()
|
88
|
+
{
|
89
|
+
$this->negated = ! $this->negated;
|
90
|
+
return $this;
|
91
|
+
}
|
92
|
+
|
93
|
+
function to_string($idt = '', $name = __CLASS__)
|
94
|
+
{
|
95
|
+
return parent::to_string($idt, $name.($this->negated ? '!' : ''));
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
?>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Index extends yy_Base
|
6
|
+
{
|
7
|
+
public $children = array('index');
|
8
|
+
|
9
|
+
function constructor($index)
|
10
|
+
{
|
11
|
+
$this->index = $index;
|
12
|
+
|
13
|
+
return $this;
|
14
|
+
}
|
15
|
+
|
16
|
+
function compile($options, $level = NULL)
|
17
|
+
{
|
18
|
+
return '['.$this->index->compile($options, LEVEL_PAREN).']';
|
19
|
+
}
|
20
|
+
|
21
|
+
function is_complex()
|
22
|
+
{
|
23
|
+
return $this->index->is_complex();
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
?>
|
@@ -0,0 +1,96 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Literal extends yy_Base
|
6
|
+
{
|
7
|
+
public $is_undefined = FALSE;
|
8
|
+
|
9
|
+
function constructor($value)
|
10
|
+
{
|
11
|
+
$this->value = $value;
|
12
|
+
|
13
|
+
return $this;
|
14
|
+
}
|
15
|
+
|
16
|
+
function assigns($name)
|
17
|
+
{
|
18
|
+
return $name === $this->value;
|
19
|
+
}
|
20
|
+
|
21
|
+
function compile_node($options)
|
22
|
+
{
|
23
|
+
if ($this->is_undefined())
|
24
|
+
{
|
25
|
+
$code = $options['level'] >= LEVEL_ACCESS ? '(void 0)' : 'void 0';
|
26
|
+
}
|
27
|
+
else if ($this->value === 'this')
|
28
|
+
{
|
29
|
+
if ( (isset($options['scope']->method->bound) && $options['scope']->method->bound) )
|
30
|
+
{
|
31
|
+
$code = $options['scope']->method->context;
|
32
|
+
}
|
33
|
+
else
|
34
|
+
{
|
35
|
+
$code = $this->value;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
else if (isset($this->value->reserved) && $this->value->reserved)
|
39
|
+
{
|
40
|
+
$code = '"'.$this->value.'"';
|
41
|
+
}
|
42
|
+
else
|
43
|
+
{
|
44
|
+
$code = ''.$this->value;
|
45
|
+
}
|
46
|
+
|
47
|
+
return $this->is_statement() ? "{$this->tab}{$code};" : $code;
|
48
|
+
}
|
49
|
+
|
50
|
+
function is_assignable()
|
51
|
+
{
|
52
|
+
return preg_match(IDENTIFIER, ''.$this->value);
|
53
|
+
}
|
54
|
+
|
55
|
+
function is_complex()
|
56
|
+
{
|
57
|
+
return FALSE;
|
58
|
+
}
|
59
|
+
|
60
|
+
function is_statement($options = NULL)
|
61
|
+
{
|
62
|
+
return in_array(''.$this->value, array('break', 'continue', 'debugger'), TRUE);
|
63
|
+
}
|
64
|
+
|
65
|
+
function is_undefined()
|
66
|
+
{
|
67
|
+
return $this->is_undefined;
|
68
|
+
}
|
69
|
+
|
70
|
+
function jumps($options = array())
|
71
|
+
{
|
72
|
+
if ($this->value === 'break' && ! ( (isset($options['loop']) && $options['loop']) || (isset($options['block']) && $options['block']) ))
|
73
|
+
{
|
74
|
+
return $this;
|
75
|
+
}
|
76
|
+
|
77
|
+
if ($this->value === 'continue' && ! (isset($options['loop']) && $options['loop']))
|
78
|
+
{
|
79
|
+
return $this;
|
80
|
+
}
|
81
|
+
|
82
|
+
return FALSE;
|
83
|
+
}
|
84
|
+
|
85
|
+
function make_return($res = NULL)
|
86
|
+
{
|
87
|
+
return $this->is_statement() ? $this : parent::make_return($res);
|
88
|
+
}
|
89
|
+
|
90
|
+
function to_string($idt = '', $name = __CLASS__)
|
91
|
+
{
|
92
|
+
return ' "'.$this->value.'"';
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
?>
|
@@ -0,0 +1,126 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
namespace CoffeeScript;
|
4
|
+
|
5
|
+
class yy_Obj extends yy_Base
|
6
|
+
{
|
7
|
+
public $children = array('properties');
|
8
|
+
|
9
|
+
function constructor($props, $generated = FALSE)
|
10
|
+
{
|
11
|
+
$this->generated = $generated;
|
12
|
+
|
13
|
+
$this->properties = $props ? $props : array();
|
14
|
+
$this->objects = $this->properties;
|
15
|
+
|
16
|
+
return $this;
|
17
|
+
}
|
18
|
+
|
19
|
+
function assigns($name)
|
20
|
+
{
|
21
|
+
foreach ($this->properties as $prop)
|
22
|
+
{
|
23
|
+
if ($prop->assigns($name))
|
24
|
+
{
|
25
|
+
return TRUE;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
return FALSE;
|
30
|
+
}
|
31
|
+
|
32
|
+
function compile_node($options)
|
33
|
+
{
|
34
|
+
$props = $this->properties;
|
35
|
+
$prop_names = array();
|
36
|
+
|
37
|
+
foreach ($this->properties as $prop)
|
38
|
+
{
|
39
|
+
if ($prop->is_complex())
|
40
|
+
{
|
41
|
+
$prop = isset($prop->variable) ? $prop->variable : NULL;
|
42
|
+
}
|
43
|
+
|
44
|
+
if ($prop)
|
45
|
+
{
|
46
|
+
$prop_name = $prop->unwrap_all();
|
47
|
+
$prop_name = isset($prop_name->value) ? $prop_name->value.'' : NULL;
|
48
|
+
|
49
|
+
if (in_array($prop_name, $prop_names))
|
50
|
+
{
|
51
|
+
throw new SyntaxError('multiple object literal properties named "'.$prop_name.'"');
|
52
|
+
}
|
53
|
+
|
54
|
+
$prop_names[] = $prop_name;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
if ( ! count($props))
|
59
|
+
{
|
60
|
+
return ($this->front ? '({})' : '{}');
|
61
|
+
}
|
62
|
+
|
63
|
+
if ($this->generated)
|
64
|
+
{
|
65
|
+
foreach ($props as $node)
|
66
|
+
{
|
67
|
+
if ($node instanceof yy_Value)
|
68
|
+
{
|
69
|
+
throw new Error('cannot have an implicit value in an implicit object');
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
$idt = $options['indent'] .= TAB;
|
75
|
+
$last_non_com = $this->last_non_comment($this->properties);
|
76
|
+
|
77
|
+
foreach ($props as $i => $prop)
|
78
|
+
{
|
79
|
+
if ($i === count($props) - 1)
|
80
|
+
{
|
81
|
+
$join = '';
|
82
|
+
}
|
83
|
+
else if ($prop === $last_non_com || $prop instanceof yy_Comment)
|
84
|
+
{
|
85
|
+
$join = "\n";
|
86
|
+
}
|
87
|
+
else
|
88
|
+
{
|
89
|
+
$join = ",\n";
|
90
|
+
}
|
91
|
+
|
92
|
+
$indent = $prop instanceof yy_Comment ? '' : $idt;
|
93
|
+
|
94
|
+
if ($prop instanceof yy_Value && (isset($prop->this) && $prop->this))
|
95
|
+
{
|
96
|
+
$prop = yy('Assign', $prop->properties[0]->name, $prop, 'object');
|
97
|
+
}
|
98
|
+
|
99
|
+
if ( ! ($prop instanceof yy_Comment))
|
100
|
+
{
|
101
|
+
if ( ! ($prop instanceof yy_Assign))
|
102
|
+
{
|
103
|
+
$prop = yy('Assign', $prop, $prop, 'object');
|
104
|
+
}
|
105
|
+
|
106
|
+
if (isset($prop->variable->base))
|
107
|
+
{
|
108
|
+
$prop->variable->base->as_key = TRUE;
|
109
|
+
}
|
110
|
+
else
|
111
|
+
{
|
112
|
+
$prop->variable->as_key = TRUE;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
$props[$i] = $indent.$prop->compile($options, LEVEL_TOP).$join;
|
117
|
+
}
|
118
|
+
|
119
|
+
$props = implode('', $props);
|
120
|
+
$obj = '{'.($props ? "\n{$props}\n{$this->tab}" : '').'}';
|
121
|
+
|
122
|
+
return ($this->front ? "({$obj})" : $obj);
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
?>
|