haml 3.2.0.alpha.10 → 3.2.0.alpha.13
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of haml might be problematic. Click here for more details.
- data/.yardopts +19 -7
- data/CHANGELOG.md +1224 -0
- data/FAQ.md +157 -0
- data/README.md +99 -62
- data/REFERENCE.md +1404 -0
- data/Rakefile +52 -341
- data/init.rb +1 -18
- data/lib/haml.rb +6 -30
- data/lib/haml/buffer.rb +37 -16
- data/lib/haml/compiler.rb +52 -13
- data/lib/haml/engine.rb +61 -44
- data/lib/haml/exec.rb +21 -4
- data/lib/haml/filters.rb +136 -166
- data/lib/haml/helpers.rb +37 -10
- data/lib/haml/helpers/action_view_extensions.rb +2 -1
- data/lib/haml/helpers/action_view_mods.rb +67 -181
- data/lib/haml/helpers/rails_323_textarea_fix.rb +39 -0
- data/lib/haml/helpers/xss_mods.rb +9 -11
- data/lib/haml/html.rb +22 -9
- data/lib/haml/html/erb.rb +1 -1
- data/lib/haml/parser.rb +22 -15
- data/lib/haml/railtie.rb +2 -13
- data/lib/haml/template.rb +18 -85
- data/lib/haml/template/options.rb +1 -1
- data/lib/haml/template/plugin.rb +15 -101
- data/lib/haml/util.rb +120 -603
- data/lib/haml/version.rb +1 -107
- data/test/{haml/engine_test.rb → engine_test.rb} +137 -143
- data/test/{haml/erb → erb}/_av_partial_1.erb +1 -1
- data/test/{haml/erb → erb}/_av_partial_2.erb +1 -1
- data/test/{haml/erb → erb}/action_view.erb +1 -1
- data/test/{haml/erb → erb}/standard.erb +0 -0
- data/test/filters_test.rb +141 -0
- data/test/gemfiles/Gemfile.rails-3.0.x +4 -6
- data/test/gemfiles/Gemfile.rails-3.1.x +5 -6
- data/test/gemfiles/Gemfile.rails-3.2.x +6 -0
- data/test/haml-spec/LICENSE +14 -0
- data/test/{haml/spec → haml-spec}/README.md +26 -17
- data/test/haml-spec/lua_haml_spec.lua +38 -0
- data/test/haml-spec/perl_haml_test.pl +81 -0
- data/test/haml-spec/ruby_haml_test.rb +23 -0
- data/test/{haml/spec → haml-spec}/tests.json +132 -54
- data/test/{haml/helper_test.rb → helper_test.rb} +50 -36
- data/test/{haml/html2haml → html2haml}/erb_tests.rb +0 -0
- data/test/{haml/html2haml_test.rb → html2haml_test.rb} +11 -5
- data/test/{haml/markaby → markaby}/standard.mab +0 -0
- data/test/{haml/mocks → mocks}/article.rb +0 -0
- data/test/{haml/results → results}/content_for_layout.xhtml +0 -0
- data/test/{haml/results → results}/eval_suppressed.xhtml +0 -0
- data/test/{haml/results → results}/helpers.xhtml +0 -0
- data/test/{haml/results → results}/helpful.xhtml +0 -0
- data/test/{haml/results → results}/just_stuff.xhtml +0 -0
- data/test/{haml/results → results}/list.xhtml +0 -0
- data/test/{haml/results → results}/nuke_inner_whitespace.xhtml +0 -0
- data/test/{haml/results → results}/nuke_outer_whitespace.xhtml +0 -0
- data/test/{haml/results → results}/original_engine.xhtml +0 -0
- data/test/{haml/results → results}/partial_layout.xhtml +0 -0
- data/test/{haml/results → results}/partials.xhtml +0 -0
- data/test/{haml/results → results}/render_layout.xhtml +0 -0
- data/test/{haml/results → results}/silent_script.xhtml +1 -1
- data/test/{haml/results → results}/standard.xhtml +0 -0
- data/test/{haml/results → results}/tag_parsing.xhtml +0 -0
- data/test/{haml/results → results}/very_basic.xhtml +0 -0
- data/test/{haml/results → results}/whitespace_handling.xhtml +46 -50
- data/test/{haml/template_test.rb → template_test.rb} +20 -81
- data/test/{haml/templates → templates}/_av_partial_1.haml +1 -1
- data/test/{haml/templates → templates}/_av_partial_1_ugly.haml +1 -1
- data/test/{haml/templates → templates}/_av_partial_2.haml +1 -1
- data/test/{haml/templates → templates}/_av_partial_2_ugly.haml +1 -1
- data/test/{haml/templates → templates}/_layout.erb +0 -0
- data/test/{haml/templates → templates}/_layout_for_partial.haml +0 -0
- data/test/{haml/templates → templates}/_partial.haml +0 -0
- data/test/{haml/templates → templates}/_text_area.haml +0 -0
- data/test/{haml/templates → templates}/action_view.haml +1 -1
- data/test/{haml/templates → templates}/action_view_ugly.haml +1 -1
- data/test/{haml/templates → templates}/breakage.haml +0 -0
- data/test/{haml/templates → templates}/content_for_layout.haml +0 -0
- data/test/{haml/templates → templates}/eval_suppressed.haml +0 -0
- data/test/{haml/templates → templates}/helpers.haml +0 -0
- data/test/{haml/templates → templates}/helpful.haml +0 -0
- data/test/{haml/templates → templates}/just_stuff.haml +0 -0
- data/test/{haml/templates → templates}/list.haml +0 -0
- data/test/{haml/templates → templates}/nuke_inner_whitespace.haml +0 -0
- data/test/{haml/templates → templates}/nuke_outer_whitespace.haml +0 -0
- data/test/{haml/templates → templates}/original_engine.haml +0 -0
- data/test/templates/partial_layout.haml +3 -0
- data/test/{haml/templates → templates}/partialize.haml +0 -0
- data/test/{haml/templates → templates}/partials.haml +0 -0
- data/test/{haml/templates → templates}/render_layout.haml +0 -0
- data/test/{haml/templates → templates}/silent_script.haml +2 -2
- data/test/{haml/templates → templates}/standard.haml +0 -0
- data/test/{haml/templates → templates}/standard_ugly.haml +0 -0
- data/test/{haml/templates → templates}/tag_parsing.haml +0 -0
- data/test/{haml/templates → templates}/very_basic.haml +0 -0
- data/test/{haml/templates → templates}/whitespace_handling.haml +0 -0
- data/test/test_helper.rb +42 -34
- data/test/util_test.rb +80 -0
- metadata +259 -427
- data/CONTRIBUTING +0 -3
- data/REVISION +0 -1
- data/VERSION +0 -1
- data/VERSION_NAME +0 -1
- data/extra/update_watch.rb +0 -13
- data/lib/haml/root.rb +0 -7
- data/lib/haml/shared.rb +0 -78
- data/lib/haml/template/patch.rb +0 -58
- data/lib/sass.rb +0 -8
- data/lib/sass/plugin.rb +0 -10
- data/lib/sass/rails2_shim.rb +0 -9
- data/lib/sass/rails3_shim.rb +0 -16
- data/test/benchmark.rb +0 -91
- data/test/gemfiles/Gemfile.rails-2.0.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.0.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.1.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.1.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.2.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.2.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.3.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.3.x.lock +0 -40
- data/test/gemfiles/Gemfile.rails-3.0.x.lock +0 -85
- data/test/gemfiles/Gemfile.rails-3.1.x.lock +0 -98
- data/test/gemfiles/Gemfile.rails-xss-2.3.x +0 -9
- data/test/gemfiles/Gemfile.rails-xss-2.3.x.lock +0 -42
- data/test/haml/results/filters.xhtml +0 -62
- data/test/haml/spec/lua_haml_spec.lua +0 -30
- data/test/haml/spec/ruby_haml_test.rb +0 -19
- data/test/haml/spec_test.rb +0 -44
- data/test/haml/templates/filters.haml +0 -66
- data/test/haml/templates/partial_layout.haml +0 -10
- data/test/haml/util_test.rb +0 -300
- data/test/linked_rails.rb +0 -42
- data/vendor/sass/CONTRIBUTING +0 -3
- data/vendor/sass/MIT-LICENSE +0 -20
- data/vendor/sass/README.md +0 -201
- data/vendor/sass/Rakefile +0 -339
- data/vendor/sass/TODO +0 -39
- data/vendor/sass/VERSION +0 -1
- data/vendor/sass/VERSION_NAME +0 -1
- data/vendor/sass/bin/sass +0 -8
- data/vendor/sass/bin/sass-convert +0 -7
- data/vendor/sass/bin/scss +0 -8
- data/vendor/sass/doc-src/FAQ.md +0 -35
- data/vendor/sass/doc-src/INDENTED_SYNTAX.md +0 -210
- data/vendor/sass/doc-src/SASS_CHANGELOG.md +0 -2327
- data/vendor/sass/doc-src/SASS_REFERENCE.md +0 -1965
- data/vendor/sass/doc-src/SCSS_FOR_SASS_USERS.md +0 -155
- data/vendor/sass/ext/extconf.rb +0 -10
- data/vendor/sass/extra/update_watch.rb +0 -13
- data/vendor/sass/init.rb +0 -18
- data/vendor/sass/lib/sass.rb +0 -73
- data/vendor/sass/lib/sass/cache_stores.rb +0 -15
- data/vendor/sass/lib/sass/cache_stores/base.rb +0 -86
- data/vendor/sass/lib/sass/cache_stores/chain.rb +0 -33
- data/vendor/sass/lib/sass/cache_stores/filesystem.rb +0 -60
- data/vendor/sass/lib/sass/cache_stores/memory.rb +0 -47
- data/vendor/sass/lib/sass/cache_stores/null.rb +0 -25
- data/vendor/sass/lib/sass/callbacks.rb +0 -66
- data/vendor/sass/lib/sass/css.rb +0 -295
- data/vendor/sass/lib/sass/engine.rb +0 -878
- data/vendor/sass/lib/sass/environment.rb +0 -166
- data/vendor/sass/lib/sass/error.rb +0 -201
- data/vendor/sass/lib/sass/exec.rb +0 -672
- data/vendor/sass/lib/sass/importers.rb +0 -22
- data/vendor/sass/lib/sass/importers/base.rb +0 -139
- data/vendor/sass/lib/sass/importers/filesystem.rb +0 -149
- data/vendor/sass/lib/sass/less.rb +0 -382
- data/vendor/sass/lib/sass/logger.rb +0 -15
- data/vendor/sass/lib/sass/logger/base.rb +0 -32
- data/vendor/sass/lib/sass/logger/log_level.rb +0 -49
- data/vendor/sass/lib/sass/plugin.rb +0 -132
- data/vendor/sass/lib/sass/plugin/compiler.rb +0 -383
- data/vendor/sass/lib/sass/plugin/configuration.rb +0 -123
- data/vendor/sass/lib/sass/plugin/generic.rb +0 -15
- data/vendor/sass/lib/sass/plugin/merb.rb +0 -48
- data/vendor/sass/lib/sass/plugin/rack.rb +0 -60
- data/vendor/sass/lib/sass/plugin/rails.rb +0 -47
- data/vendor/sass/lib/sass/plugin/staleness_checker.rb +0 -173
- data/vendor/sass/lib/sass/railtie.rb +0 -9
- data/vendor/sass/lib/sass/repl.rb +0 -58
- data/vendor/sass/lib/sass/root.rb +0 -7
- data/vendor/sass/lib/sass/script.rb +0 -40
- data/vendor/sass/lib/sass/script/bool.rb +0 -18
- data/vendor/sass/lib/sass/script/color.rb +0 -480
- data/vendor/sass/lib/sass/script/css_lexer.rb +0 -29
- data/vendor/sass/lib/sass/script/css_parser.rb +0 -31
- data/vendor/sass/lib/sass/script/funcall.rb +0 -175
- data/vendor/sass/lib/sass/script/functions.rb +0 -1386
- data/vendor/sass/lib/sass/script/interpolation.rb +0 -79
- data/vendor/sass/lib/sass/script/lexer.rb +0 -339
- data/vendor/sass/lib/sass/script/list.rb +0 -83
- data/vendor/sass/lib/sass/script/literal.rb +0 -250
- data/vendor/sass/lib/sass/script/node.rb +0 -99
- data/vendor/sass/lib/sass/script/number.rb +0 -452
- data/vendor/sass/lib/sass/script/operation.rb +0 -99
- data/vendor/sass/lib/sass/script/parser.rb +0 -474
- data/vendor/sass/lib/sass/script/string.rb +0 -51
- data/vendor/sass/lib/sass/script/string_interpolation.rb +0 -103
- data/vendor/sass/lib/sass/script/unary_operation.rb +0 -64
- data/vendor/sass/lib/sass/script/variable.rb +0 -59
- data/vendor/sass/lib/sass/scss.rb +0 -17
- data/vendor/sass/lib/sass/scss/css_parser.rb +0 -46
- data/vendor/sass/lib/sass/scss/parser.rb +0 -960
- data/vendor/sass/lib/sass/scss/rx.rb +0 -128
- data/vendor/sass/lib/sass/scss/sass_parser.rb +0 -11
- data/vendor/sass/lib/sass/scss/script_lexer.rb +0 -15
- data/vendor/sass/lib/sass/scss/script_parser.rb +0 -25
- data/vendor/sass/lib/sass/scss/static_parser.rb +0 -40
- data/vendor/sass/lib/sass/selector.rb +0 -361
- data/vendor/sass/lib/sass/selector/abstract_sequence.rb +0 -62
- data/vendor/sass/lib/sass/selector/comma_sequence.rb +0 -81
- data/vendor/sass/lib/sass/selector/sequence.rb +0 -233
- data/vendor/sass/lib/sass/selector/simple.rb +0 -113
- data/vendor/sass/lib/sass/selector/simple_sequence.rb +0 -134
- data/vendor/sass/lib/sass/shared.rb +0 -78
- data/vendor/sass/lib/sass/tree/charset_node.rb +0 -22
- data/vendor/sass/lib/sass/tree/comment_node.rb +0 -90
- data/vendor/sass/lib/sass/tree/debug_node.rb +0 -18
- data/vendor/sass/lib/sass/tree/directive_node.rb +0 -23
- data/vendor/sass/lib/sass/tree/each_node.rb +0 -24
- data/vendor/sass/lib/sass/tree/extend_node.rb +0 -29
- data/vendor/sass/lib/sass/tree/for_node.rb +0 -36
- data/vendor/sass/lib/sass/tree/function_node.rb +0 -27
- data/vendor/sass/lib/sass/tree/if_node.rb +0 -52
- data/vendor/sass/lib/sass/tree/import_node.rb +0 -68
- data/vendor/sass/lib/sass/tree/media_node.rb +0 -32
- data/vendor/sass/lib/sass/tree/mixin_def_node.rb +0 -27
- data/vendor/sass/lib/sass/tree/mixin_node.rb +0 -32
- data/vendor/sass/lib/sass/tree/node.rb +0 -201
- data/vendor/sass/lib/sass/tree/prop_node.rb +0 -148
- data/vendor/sass/lib/sass/tree/return_node.rb +0 -18
- data/vendor/sass/lib/sass/tree/root_node.rb +0 -28
- data/vendor/sass/lib/sass/tree/rule_node.rb +0 -136
- data/vendor/sass/lib/sass/tree/variable_node.rb +0 -30
- data/vendor/sass/lib/sass/tree/visitors/base.rb +0 -75
- data/vendor/sass/lib/sass/tree/visitors/check_nesting.rb +0 -133
- data/vendor/sass/lib/sass/tree/visitors/convert.rb +0 -260
- data/vendor/sass/lib/sass/tree/visitors/cssize.rb +0 -175
- data/vendor/sass/lib/sass/tree/visitors/deep_copy.rb +0 -87
- data/vendor/sass/lib/sass/tree/visitors/perform.rb +0 -332
- data/vendor/sass/lib/sass/tree/visitors/set_options.rb +0 -97
- data/vendor/sass/lib/sass/tree/visitors/to_css.rb +0 -210
- data/vendor/sass/lib/sass/tree/warn_node.rb +0 -18
- data/vendor/sass/lib/sass/tree/while_node.rb +0 -18
- data/vendor/sass/lib/sass/util.rb +0 -721
- data/vendor/sass/lib/sass/util/subset_map.rb +0 -101
- data/vendor/sass/lib/sass/version.rb +0 -112
- data/vendor/sass/rails/init.rb +0 -1
- data/vendor/sass/sass.gemspec +0 -33
- data/vendor/sass/test/Gemfile +0 -4
- data/vendor/sass/test/Gemfile.lock +0 -19
- data/vendor/sass/test/sass/cache_test.rb +0 -89
- data/vendor/sass/test/sass/callbacks_test.rb +0 -61
- data/vendor/sass/test/sass/conversion_test.rb +0 -1199
- data/vendor/sass/test/sass/css2sass_test.rb +0 -373
- data/vendor/sass/test/sass/data/hsl-rgb.txt +0 -319
- data/vendor/sass/test/sass/engine_test.rb +0 -2567
- data/vendor/sass/test/sass/extend_test.rb +0 -1348
- data/vendor/sass/test/sass/fixtures/test_staleness_check_across_importers.css +0 -1
- data/vendor/sass/test/sass/fixtures/test_staleness_check_across_importers.scss +0 -1
- data/vendor/sass/test/sass/functions_test.rb +0 -1038
- data/vendor/sass/test/sass/importer_test.rb +0 -192
- data/vendor/sass/test/sass/less_conversion_test.rb +0 -653
- data/vendor/sass/test/sass/logger_test.rb +0 -58
- data/vendor/sass/test/sass/mock_importer.rb +0 -49
- data/vendor/sass/test/sass/more_results/more1.css +0 -9
- data/vendor/sass/test/sass/more_results/more1_with_line_comments.css +0 -26
- data/vendor/sass/test/sass/more_results/more_import.css +0 -29
- data/vendor/sass/test/sass/more_templates/_more_partial.sass +0 -2
- data/vendor/sass/test/sass/more_templates/more1.sass +0 -23
- data/vendor/sass/test/sass/more_templates/more_import.sass +0 -11
- data/vendor/sass/test/sass/plugin_test.rb +0 -472
- data/vendor/sass/test/sass/results/alt.css +0 -4
- data/vendor/sass/test/sass/results/basic.css +0 -9
- data/vendor/sass/test/sass/results/compact.css +0 -5
- data/vendor/sass/test/sass/results/complex.css +0 -86
- data/vendor/sass/test/sass/results/compressed.css +0 -1
- data/vendor/sass/test/sass/results/expanded.css +0 -19
- data/vendor/sass/test/sass/results/if.css +0 -3
- data/vendor/sass/test/sass/results/import.css +0 -31
- data/vendor/sass/test/sass/results/import_charset.css +0 -4
- data/vendor/sass/test/sass/results/import_charset_1_8.css +0 -4
- data/vendor/sass/test/sass/results/import_charset_ibm866.css +0 -4
- data/vendor/sass/test/sass/results/line_numbers.css +0 -49
- data/vendor/sass/test/sass/results/mixins.css +0 -95
- data/vendor/sass/test/sass/results/multiline.css +0 -24
- data/vendor/sass/test/sass/results/nested.css +0 -22
- data/vendor/sass/test/sass/results/options.css +0 -1
- data/vendor/sass/test/sass/results/parent_ref.css +0 -13
- data/vendor/sass/test/sass/results/script.css +0 -16
- data/vendor/sass/test/sass/results/scss_import.css +0 -31
- data/vendor/sass/test/sass/results/scss_importee.css +0 -2
- data/vendor/sass/test/sass/results/subdir/nested_subdir/nested_subdir.css +0 -1
- data/vendor/sass/test/sass/results/subdir/subdir.css +0 -3
- data/vendor/sass/test/sass/results/units.css +0 -11
- data/vendor/sass/test/sass/results/warn.css +0 -0
- data/vendor/sass/test/sass/results/warn_imported.css +0 -0
- data/vendor/sass/test/sass/script_conversion_test.rb +0 -285
- data/vendor/sass/test/sass/script_test.rb +0 -514
- data/vendor/sass/test/sass/scss/css_test.rb +0 -922
- data/vendor/sass/test/sass/scss/rx_test.rb +0 -156
- data/vendor/sass/test/sass/scss/scss_test.rb +0 -1273
- data/vendor/sass/test/sass/scss/test_helper.rb +0 -37
- data/vendor/sass/test/sass/templates/_imported_charset_ibm866.sass +0 -4
- data/vendor/sass/test/sass/templates/_imported_charset_utf8.sass +0 -4
- data/vendor/sass/test/sass/templates/_partial.sass +0 -2
- data/vendor/sass/test/sass/templates/alt.sass +0 -16
- data/vendor/sass/test/sass/templates/basic.sass +0 -23
- data/vendor/sass/test/sass/templates/bork1.sass +0 -2
- data/vendor/sass/test/sass/templates/bork2.sass +0 -2
- data/vendor/sass/test/sass/templates/bork3.sass +0 -2
- data/vendor/sass/test/sass/templates/bork4.sass +0 -2
- data/vendor/sass/test/sass/templates/bork5.sass +0 -3
- data/vendor/sass/test/sass/templates/compact.sass +0 -17
- data/vendor/sass/test/sass/templates/complex.sass +0 -305
- data/vendor/sass/test/sass/templates/compressed.sass +0 -15
- data/vendor/sass/test/sass/templates/expanded.sass +0 -17
- data/vendor/sass/test/sass/templates/if.sass +0 -11
- data/vendor/sass/test/sass/templates/import.sass +0 -12
- data/vendor/sass/test/sass/templates/import_charset.sass +0 -7
- data/vendor/sass/test/sass/templates/import_charset_1_8.sass +0 -4
- data/vendor/sass/test/sass/templates/import_charset_ibm866.sass +0 -9
- data/vendor/sass/test/sass/templates/importee.less +0 -2
- data/vendor/sass/test/sass/templates/importee.sass +0 -19
- data/vendor/sass/test/sass/templates/line_numbers.sass +0 -13
- data/vendor/sass/test/sass/templates/mixin_bork.sass +0 -5
- data/vendor/sass/test/sass/templates/mixins.sass +0 -76
- data/vendor/sass/test/sass/templates/multiline.sass +0 -20
- data/vendor/sass/test/sass/templates/nested.sass +0 -25
- data/vendor/sass/test/sass/templates/nested_bork1.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork2.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork3.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork4.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork5.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_import.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_mixin_bork.sass +0 -6
- data/vendor/sass/test/sass/templates/options.sass +0 -2
- data/vendor/sass/test/sass/templates/parent_ref.sass +0 -25
- data/vendor/sass/test/sass/templates/script.sass +0 -101
- data/vendor/sass/test/sass/templates/scss_import.scss +0 -11
- data/vendor/sass/test/sass/templates/scss_importee.scss +0 -1
- data/vendor/sass/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +0 -2
- data/vendor/sass/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +0 -3
- data/vendor/sass/test/sass/templates/subdir/subdir.sass +0 -6
- data/vendor/sass/test/sass/templates/units.sass +0 -11
- data/vendor/sass/test/sass/templates/warn.sass +0 -3
- data/vendor/sass/test/sass/templates/warn_imported.sass +0 -4
- data/vendor/sass/test/sass/test_helper.rb +0 -8
- data/vendor/sass/test/sass/util/subset_map_test.rb +0 -91
- data/vendor/sass/test/sass/util_test.rb +0 -266
- data/vendor/sass/test/test_helper.rb +0 -69
- data/vendor/sass/vendor/fssm/Gemfile +0 -3
- data/vendor/sass/vendor/fssm/LICENSE +0 -20
- data/vendor/sass/vendor/fssm/README.markdown +0 -83
- data/vendor/sass/vendor/fssm/Rakefile +0 -11
- data/vendor/sass/vendor/fssm/example.rb +0 -12
- data/vendor/sass/vendor/fssm/fssm.gemspec +0 -24
- data/vendor/sass/vendor/fssm/lib/fssm.rb +0 -37
- data/vendor/sass/vendor/fssm/lib/fssm/backends/fsevents.rb +0 -36
- data/vendor/sass/vendor/fssm/lib/fssm/backends/inotify.rb +0 -26
- data/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb +0 -25
- data/vendor/sass/vendor/fssm/lib/fssm/backends/rbfsevent.rb +0 -42
- data/vendor/sass/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +0 -131
- data/vendor/sass/vendor/fssm/lib/fssm/monitor.rb +0 -36
- data/vendor/sass/vendor/fssm/lib/fssm/path.rb +0 -94
- data/vendor/sass/vendor/fssm/lib/fssm/pathname.rb +0 -36
- data/vendor/sass/vendor/fssm/lib/fssm/state/directory.rb +0 -75
- data/vendor/sass/vendor/fssm/lib/fssm/state/file.rb +0 -24
- data/vendor/sass/vendor/fssm/lib/fssm/support.rb +0 -92
- data/vendor/sass/vendor/fssm/lib/fssm/tree.rb +0 -176
- data/vendor/sass/vendor/fssm/lib/fssm/version.rb +0 -3
- data/vendor/sass/vendor/fssm/profile/prof-cache.rb +0 -40
- data/vendor/sass/vendor/fssm/profile/prof-fssm-pathname.html +0 -1231
- data/vendor/sass/vendor/fssm/profile/prof-pathname-rubinius.rb +0 -35
- data/vendor/sass/vendor/fssm/profile/prof-pathname.rb +0 -68
- data/vendor/sass/vendor/fssm/profile/prof-plain-pathname.html +0 -988
- data/vendor/sass/vendor/fssm/profile/prof.html +0 -2379
- data/vendor/sass/vendor/fssm/spec/count_down_latch.rb +0 -151
- data/vendor/sass/vendor/fssm/spec/monitor_spec.rb +0 -202
- data/vendor/sass/vendor/fssm/spec/path_spec.rb +0 -96
- data/vendor/sass/vendor/fssm/spec/root/duck/quack.txt +0 -0
- data/vendor/sass/vendor/fssm/spec/root/file.css +0 -0
- data/vendor/sass/vendor/fssm/spec/root/file.rb +0 -0
- data/vendor/sass/vendor/fssm/spec/root/file.yml +0 -0
- data/vendor/sass/vendor/fssm/spec/root/moo/cow.txt +0 -0
- data/vendor/sass/vendor/fssm/spec/spec_helper.rb +0 -14
- data/vendor/sass/yard/callbacks.rb +0 -29
- data/vendor/sass/yard/default/fulldoc/html/css/common.sass +0 -26
- data/vendor/sass/yard/default/layout/html/footer.erb +0 -12
- data/vendor/sass/yard/inherited_hash.rb +0 -41
@@ -1,99 +0,0 @@
|
|
1
|
-
require 'set'
|
2
|
-
require 'sass/script/string'
|
3
|
-
require 'sass/script/number'
|
4
|
-
require 'sass/script/color'
|
5
|
-
require 'sass/script/functions'
|
6
|
-
require 'sass/script/unary_operation'
|
7
|
-
require 'sass/script/interpolation'
|
8
|
-
require 'sass/script/string_interpolation'
|
9
|
-
|
10
|
-
module Sass::Script
|
11
|
-
# A SassScript parse node representing a binary operation,
|
12
|
-
# such as `$a + $b` or `"foo" + 1`.
|
13
|
-
class Operation < Node
|
14
|
-
attr_reader :operand1
|
15
|
-
attr_reader :operand2
|
16
|
-
attr_reader :operator
|
17
|
-
|
18
|
-
# @param operand1 [Script::Node] The parse-tree node
|
19
|
-
# for the right-hand side of the operator
|
20
|
-
# @param operand2 [Script::Node] The parse-tree node
|
21
|
-
# for the left-hand side of the operator
|
22
|
-
# @param operator [Symbol] The operator to perform.
|
23
|
-
# This should be one of the binary operator names in {Lexer::OPERATORS}
|
24
|
-
def initialize(operand1, operand2, operator)
|
25
|
-
@operand1 = operand1
|
26
|
-
@operand2 = operand2
|
27
|
-
@operator = operator
|
28
|
-
super()
|
29
|
-
end
|
30
|
-
|
31
|
-
# @return [String] A human-readable s-expression representation of the operation
|
32
|
-
def inspect
|
33
|
-
"(#{@operator.inspect} #{@operand1.inspect} #{@operand2.inspect})"
|
34
|
-
end
|
35
|
-
|
36
|
-
# @see Node#to_sass
|
37
|
-
def to_sass(opts = {})
|
38
|
-
pred = Sass::Script::Parser.precedence_of(@operator)
|
39
|
-
o1 = operand_to_sass @operand1, :left, opts
|
40
|
-
o2 = operand_to_sass @operand2, :right, opts
|
41
|
-
sep =
|
42
|
-
case @operator
|
43
|
-
when :comma; ", "
|
44
|
-
when :space; " "
|
45
|
-
else; " #{Lexer::OPERATORS_REVERSE[@operator]} "
|
46
|
-
end
|
47
|
-
"#{o1}#{sep}#{o2}"
|
48
|
-
end
|
49
|
-
|
50
|
-
# Returns the operands for this operation.
|
51
|
-
#
|
52
|
-
# @return [Array<Node>]
|
53
|
-
# @see Node#children
|
54
|
-
def children
|
55
|
-
[@operand1, @operand2]
|
56
|
-
end
|
57
|
-
|
58
|
-
# @see Node#deep_copy
|
59
|
-
def deep_copy
|
60
|
-
node = dup
|
61
|
-
node.instance_variable_set('@operand1', @operand1.deep_copy)
|
62
|
-
node.instance_variable_set('@operand2', @operand2.deep_copy)
|
63
|
-
node
|
64
|
-
end
|
65
|
-
|
66
|
-
protected
|
67
|
-
|
68
|
-
# Evaluates the operation.
|
69
|
-
#
|
70
|
-
# @param environment [Sass::Environment] The environment in which to evaluate the SassScript
|
71
|
-
# @return [Literal] The SassScript object that is the value of the operation
|
72
|
-
# @raise [Sass::SyntaxError] if the operation is undefined for the operands
|
73
|
-
def _perform(environment)
|
74
|
-
literal1 = @operand1.perform(environment)
|
75
|
-
literal2 = @operand2.perform(environment)
|
76
|
-
|
77
|
-
begin
|
78
|
-
opts(literal1.send(@operator, literal2))
|
79
|
-
rescue NoMethodError => e
|
80
|
-
raise e unless e.name.to_s == @operator.to_s
|
81
|
-
raise Sass::SyntaxError.new("Undefined operation: \"#{literal1} #{@operator} #{literal2}\".")
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
private
|
86
|
-
|
87
|
-
def operand_to_sass(op, side, opts)
|
88
|
-
return "(#{op.to_sass(opts)})" if op.is_a?(List)
|
89
|
-
return op.to_sass(opts) unless op.is_a?(Operation)
|
90
|
-
|
91
|
-
pred = Sass::Script::Parser.precedence_of(@operator)
|
92
|
-
sub_pred = Sass::Script::Parser.precedence_of(op.operator)
|
93
|
-
assoc = Sass::Script::Parser.associative?(@operator)
|
94
|
-
return "(#{op.to_sass(opts)})" if sub_pred < pred ||
|
95
|
-
(side == :right && sub_pred == pred && !assoc)
|
96
|
-
op.to_sass(opts)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
@@ -1,474 +0,0 @@
|
|
1
|
-
require 'sass/script/lexer'
|
2
|
-
|
3
|
-
module Sass
|
4
|
-
module Script
|
5
|
-
# The parser for SassScript.
|
6
|
-
# It parses a string of code into a tree of {Script::Node}s.
|
7
|
-
class Parser
|
8
|
-
# The line number of the parser's current position.
|
9
|
-
#
|
10
|
-
# @return [Fixnum]
|
11
|
-
def line
|
12
|
-
@lexer.line
|
13
|
-
end
|
14
|
-
|
15
|
-
# @param str [String, StringScanner] The source text to parse
|
16
|
-
# @param line [Fixnum] The line on which the SassScript appears.
|
17
|
-
# Used for error reporting
|
18
|
-
# @param offset [Fixnum] The number of characters in on which the SassScript appears.
|
19
|
-
# Used for error reporting
|
20
|
-
# @param options [{Symbol => Object}] An options hash;
|
21
|
-
# see {file:SASS_REFERENCE.md#sass_options the Sass options documentation}
|
22
|
-
def initialize(str, line, offset, options = {})
|
23
|
-
@options = options
|
24
|
-
@lexer = lexer_class.new(str, line, offset, options)
|
25
|
-
end
|
26
|
-
|
27
|
-
# Parses a SassScript expression within an interpolated segment (`#{}`).
|
28
|
-
# This means that it stops when it comes across an unmatched `}`,
|
29
|
-
# which signals the end of an interpolated segment,
|
30
|
-
# it returns rather than throwing an error.
|
31
|
-
#
|
32
|
-
# @return [Script::Node] The root node of the parse tree
|
33
|
-
# @raise [Sass::SyntaxError] if the expression isn't valid SassScript
|
34
|
-
def parse_interpolated
|
35
|
-
expr = assert_expr :expr
|
36
|
-
assert_tok :end_interpolation
|
37
|
-
expr.options = @options
|
38
|
-
expr
|
39
|
-
rescue Sass::SyntaxError => e
|
40
|
-
e.modify_backtrace :line => @lexer.line, :filename => @options[:filename]
|
41
|
-
raise e
|
42
|
-
end
|
43
|
-
|
44
|
-
# Parses a SassScript expression.
|
45
|
-
#
|
46
|
-
# @return [Script::Node] The root node of the parse tree
|
47
|
-
# @raise [Sass::SyntaxError] if the expression isn't valid SassScript
|
48
|
-
def parse
|
49
|
-
expr = assert_expr :expr
|
50
|
-
assert_done
|
51
|
-
expr.options = @options
|
52
|
-
expr
|
53
|
-
rescue Sass::SyntaxError => e
|
54
|
-
e.modify_backtrace :line => @lexer.line, :filename => @options[:filename]
|
55
|
-
raise e
|
56
|
-
end
|
57
|
-
|
58
|
-
# Parses a SassScript expression,
|
59
|
-
# ending it when it encounters one of the given identifier tokens.
|
60
|
-
#
|
61
|
-
# @param [#include?(String)] A set of strings that delimit the expression.
|
62
|
-
# @return [Script::Node] The root node of the parse tree
|
63
|
-
# @raise [Sass::SyntaxError] if the expression isn't valid SassScript
|
64
|
-
def parse_until(tokens)
|
65
|
-
@stop_at = tokens
|
66
|
-
expr = assert_expr :expr
|
67
|
-
assert_done
|
68
|
-
expr.options = @options
|
69
|
-
expr
|
70
|
-
rescue Sass::SyntaxError => e
|
71
|
-
e.modify_backtrace :line => @lexer.line, :filename => @options[:filename]
|
72
|
-
raise e
|
73
|
-
end
|
74
|
-
|
75
|
-
# Parses the argument list for a mixin include.
|
76
|
-
#
|
77
|
-
# @return [(Array<Script::Node>, {String => Script::Note})]
|
78
|
-
# The root nodes of the arguments.
|
79
|
-
# Keyword arguments are in a hash from names to values.
|
80
|
-
# @raise [Sass::SyntaxError] if the argument list isn't valid SassScript
|
81
|
-
def parse_mixin_include_arglist
|
82
|
-
args, keywords = [], {}
|
83
|
-
if try_tok(:lparen)
|
84
|
-
args, keywords = mixin_arglist || [[], {}]
|
85
|
-
assert_tok(:rparen)
|
86
|
-
end
|
87
|
-
assert_done
|
88
|
-
|
89
|
-
args.each {|a| a.options = @options}
|
90
|
-
keywords.each {|k, v| v.options = @options}
|
91
|
-
return args, keywords
|
92
|
-
rescue Sass::SyntaxError => e
|
93
|
-
e.modify_backtrace :line => @lexer.line, :filename => @options[:filename]
|
94
|
-
raise e
|
95
|
-
end
|
96
|
-
|
97
|
-
# Parses the argument list for a mixin definition.
|
98
|
-
#
|
99
|
-
# @return [Array<Script::Node>] The root nodes of the arguments.
|
100
|
-
# @raise [Sass::SyntaxError] if the argument list isn't valid SassScript
|
101
|
-
def parse_mixin_definition_arglist
|
102
|
-
args = defn_arglist!(false)
|
103
|
-
assert_done
|
104
|
-
|
105
|
-
args.each do |k, v|
|
106
|
-
k.options = @options
|
107
|
-
v.options = @options if v
|
108
|
-
end
|
109
|
-
args
|
110
|
-
rescue Sass::SyntaxError => e
|
111
|
-
e.modify_backtrace :line => @lexer.line, :filename => @options[:filename]
|
112
|
-
raise e
|
113
|
-
end
|
114
|
-
|
115
|
-
# Parses the argument list for a function definition.
|
116
|
-
#
|
117
|
-
# @return [Array<Script::Node>] The root nodes of the arguments.
|
118
|
-
# @raise [Sass::SyntaxError] if the argument list isn't valid SassScript
|
119
|
-
def parse_function_definition_arglist
|
120
|
-
args = defn_arglist!(true)
|
121
|
-
assert_done
|
122
|
-
|
123
|
-
args.each do |k, v|
|
124
|
-
k.options = @options
|
125
|
-
v.options = @options if v
|
126
|
-
end
|
127
|
-
args
|
128
|
-
rescue Sass::SyntaxError => e
|
129
|
-
e.modify_backtrace :line => @lexer.line, :filename => @options[:filename]
|
130
|
-
raise e
|
131
|
-
end
|
132
|
-
|
133
|
-
# Parses a SassScript expression.
|
134
|
-
#
|
135
|
-
# @overload parse(str, line, offset, filename = nil)
|
136
|
-
# @return [Script::Node] The root node of the parse tree
|
137
|
-
# @see Parser#initialize
|
138
|
-
# @see Parser#parse
|
139
|
-
def self.parse(*args)
|
140
|
-
new(*args).parse
|
141
|
-
end
|
142
|
-
|
143
|
-
PRECEDENCE = [
|
144
|
-
:comma, :single_eq, :space, :or, :and,
|
145
|
-
[:eq, :neq],
|
146
|
-
[:gt, :gte, :lt, :lte],
|
147
|
-
[:plus, :minus],
|
148
|
-
[:times, :div, :mod],
|
149
|
-
]
|
150
|
-
|
151
|
-
ASSOCIATIVE = [:plus, :times]
|
152
|
-
|
153
|
-
class << self
|
154
|
-
# Returns an integer representing the precedence
|
155
|
-
# of the given operator.
|
156
|
-
# A lower integer indicates a looser binding.
|
157
|
-
#
|
158
|
-
# @private
|
159
|
-
def precedence_of(op)
|
160
|
-
PRECEDENCE.each_with_index do |e, i|
|
161
|
-
return i if Array(e).include?(op)
|
162
|
-
end
|
163
|
-
raise "[BUG] Unknown operator #{op}"
|
164
|
-
end
|
165
|
-
|
166
|
-
# Returns whether or not the given operation is associative.
|
167
|
-
#
|
168
|
-
# @private
|
169
|
-
def associative?(op)
|
170
|
-
ASSOCIATIVE.include?(op)
|
171
|
-
end
|
172
|
-
|
173
|
-
private
|
174
|
-
|
175
|
-
# Defines a simple left-associative production.
|
176
|
-
# name is the name of the production,
|
177
|
-
# sub is the name of the production beneath it,
|
178
|
-
# and ops is a list of operators for this precedence level
|
179
|
-
def production(name, sub, *ops)
|
180
|
-
class_eval <<RUBY
|
181
|
-
def #{name}
|
182
|
-
interp = try_ops_after_interp(#{ops.inspect}, #{name.inspect}) and return interp
|
183
|
-
return unless e = #{sub}
|
184
|
-
while tok = try_tok(#{ops.map {|o| o.inspect}.join(', ')})
|
185
|
-
if interp = try_op_before_interp(tok, e)
|
186
|
-
return interp unless other_interp = try_ops_after_interp(#{ops.inspect}, #{name.inspect}, interp)
|
187
|
-
return other_interp
|
188
|
-
end
|
189
|
-
|
190
|
-
line = @lexer.line
|
191
|
-
e = Operation.new(e, assert_expr(#{sub.inspect}), tok.type)
|
192
|
-
e.line = line
|
193
|
-
end
|
194
|
-
e
|
195
|
-
end
|
196
|
-
RUBY
|
197
|
-
end
|
198
|
-
|
199
|
-
def unary(op, sub)
|
200
|
-
class_eval <<RUBY
|
201
|
-
def unary_#{op}
|
202
|
-
return #{sub} unless tok = try_tok(:#{op})
|
203
|
-
interp = try_op_before_interp(tok) and return interp
|
204
|
-
line = @lexer.line
|
205
|
-
op = UnaryOperation.new(assert_expr(:unary_#{op}), :#{op})
|
206
|
-
op.line = line
|
207
|
-
op
|
208
|
-
end
|
209
|
-
RUBY
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
|
-
private
|
214
|
-
|
215
|
-
# @private
|
216
|
-
def lexer_class; Lexer; end
|
217
|
-
|
218
|
-
def expr
|
219
|
-
interp = try_ops_after_interp([:comma], :expr) and return interp
|
220
|
-
line = @lexer.line
|
221
|
-
return unless e = interpolation
|
222
|
-
arr = [e]
|
223
|
-
while tok = try_tok(:comma)
|
224
|
-
if interp = try_op_before_interp(tok, e)
|
225
|
-
return interp unless other_interp = try_ops_after_interp([:comma], :expr, interp)
|
226
|
-
return other_interp
|
227
|
-
end
|
228
|
-
arr << assert_expr(:interpolation)
|
229
|
-
end
|
230
|
-
arr.size == 1 ? arr.first : node(List.new(arr, :comma), line)
|
231
|
-
end
|
232
|
-
|
233
|
-
production :equals, :interpolation, :single_eq
|
234
|
-
|
235
|
-
def try_op_before_interp(op, prev = nil)
|
236
|
-
return unless @lexer.peek && @lexer.peek.type == :begin_interpolation
|
237
|
-
wb = @lexer.whitespace?(op)
|
238
|
-
str = Script::String.new(Lexer::OPERATORS_REVERSE[op.type])
|
239
|
-
str.line = @lexer.line
|
240
|
-
interp = Script::Interpolation.new(prev, str, nil, wb, !:wa, :originally_text)
|
241
|
-
interp.line = @lexer.line
|
242
|
-
interpolation(interp)
|
243
|
-
end
|
244
|
-
|
245
|
-
def try_ops_after_interp(ops, name, prev = nil)
|
246
|
-
return unless @lexer.after_interpolation?
|
247
|
-
return unless op = try_tok(*ops)
|
248
|
-
interp = try_op_before_interp(op, prev) and return interp
|
249
|
-
|
250
|
-
wa = @lexer.whitespace?
|
251
|
-
str = Script::String.new(Lexer::OPERATORS_REVERSE[op.type])
|
252
|
-
str.line = @lexer.line
|
253
|
-
interp = Script::Interpolation.new(prev, str, assert_expr(name), !:wb, wa, :originally_text)
|
254
|
-
interp.line = @lexer.line
|
255
|
-
return interp
|
256
|
-
end
|
257
|
-
|
258
|
-
def interpolation(first = space)
|
259
|
-
e = first
|
260
|
-
while interp = try_tok(:begin_interpolation)
|
261
|
-
wb = @lexer.whitespace?(interp)
|
262
|
-
line = @lexer.line
|
263
|
-
mid = parse_interpolated
|
264
|
-
wa = @lexer.whitespace?
|
265
|
-
e = Script::Interpolation.new(e, mid, space, wb, wa)
|
266
|
-
e.line = line
|
267
|
-
end
|
268
|
-
e
|
269
|
-
end
|
270
|
-
|
271
|
-
def space
|
272
|
-
line = @lexer.line
|
273
|
-
return unless e = or_expr
|
274
|
-
arr = [e]
|
275
|
-
while e = or_expr
|
276
|
-
arr << e
|
277
|
-
end
|
278
|
-
arr.size == 1 ? arr.first : node(List.new(arr, :space), line)
|
279
|
-
end
|
280
|
-
|
281
|
-
production :or_expr, :and_expr, :or
|
282
|
-
production :and_expr, :eq_or_neq, :and
|
283
|
-
production :eq_or_neq, :relational, :eq, :neq
|
284
|
-
production :relational, :plus_or_minus, :gt, :gte, :lt, :lte
|
285
|
-
production :plus_or_minus, :times_div_or_mod, :plus, :minus
|
286
|
-
production :times_div_or_mod, :unary_plus, :times, :div, :mod
|
287
|
-
|
288
|
-
unary :plus, :unary_minus
|
289
|
-
unary :minus, :unary_div
|
290
|
-
unary :div, :unary_not # For strings, so /foo/bar works
|
291
|
-
unary :not, :ident
|
292
|
-
|
293
|
-
def ident
|
294
|
-
return funcall unless @lexer.peek && @lexer.peek.type == :ident
|
295
|
-
return if @stop_at && @stop_at.include?(@lexer.peek.value)
|
296
|
-
|
297
|
-
name = @lexer.next
|
298
|
-
if color = Color::HTML4_COLORS[name.value.downcase]
|
299
|
-
return node(Color.new(color))
|
300
|
-
end
|
301
|
-
node(Script::String.new(name.value, :identifier))
|
302
|
-
end
|
303
|
-
|
304
|
-
def funcall
|
305
|
-
return raw unless tok = try_tok(:funcall)
|
306
|
-
args, keywords = fn_arglist || [[], {}]
|
307
|
-
assert_tok(:rparen)
|
308
|
-
node(Script::Funcall.new(tok.value, args, keywords))
|
309
|
-
end
|
310
|
-
|
311
|
-
def defn_arglist!(must_have_parens)
|
312
|
-
if must_have_parens
|
313
|
-
assert_tok(:lparen)
|
314
|
-
else
|
315
|
-
return [] unless try_tok(:lparen)
|
316
|
-
end
|
317
|
-
return [] if try_tok(:rparen)
|
318
|
-
|
319
|
-
res = []
|
320
|
-
must_have_default = false
|
321
|
-
loop do
|
322
|
-
line = @lexer.line
|
323
|
-
offset = @lexer.offset + 1
|
324
|
-
c = assert_tok(:const)
|
325
|
-
var = Script::Variable.new(c.value)
|
326
|
-
if tok = try_tok(:colon)
|
327
|
-
val = assert_expr(:space)
|
328
|
-
must_have_default = true
|
329
|
-
elsif must_have_default
|
330
|
-
raise SyntaxError.new("Required argument #{var.inspect} must come before any optional arguments.")
|
331
|
-
end
|
332
|
-
res << [var, val]
|
333
|
-
break unless try_tok(:comma)
|
334
|
-
end
|
335
|
-
assert_tok(:rparen)
|
336
|
-
res
|
337
|
-
end
|
338
|
-
|
339
|
-
def fn_arglist
|
340
|
-
arglist(:fn_arglist, :equals)
|
341
|
-
end
|
342
|
-
|
343
|
-
def mixin_arglist
|
344
|
-
arglist(:mixin_arglist, :interpolation)
|
345
|
-
end
|
346
|
-
|
347
|
-
def arglist(type, subexpr)
|
348
|
-
return unless e = send(subexpr)
|
349
|
-
if @lexer.peek && @lexer.peek.type == :colon
|
350
|
-
name = e
|
351
|
-
@lexer.expected!("comma") unless name.is_a?(Variable)
|
352
|
-
assert_tok(:colon)
|
353
|
-
keywords = {name.underscored_name => assert_expr(subexpr, EXPR_NAMES[type])}
|
354
|
-
end
|
355
|
-
|
356
|
-
unless try_tok(:comma)
|
357
|
-
return [], keywords if keywords
|
358
|
-
return [e], {}
|
359
|
-
end
|
360
|
-
|
361
|
-
other_args, other_keywords = assert_expr(type)
|
362
|
-
if keywords
|
363
|
-
if other_keywords[name.underscored_name]
|
364
|
-
raise SyntaxError.new("Keyword argument \"#{name.to_sass}\" passed more than once")
|
365
|
-
end
|
366
|
-
return other_args, keywords.merge(other_keywords)
|
367
|
-
else
|
368
|
-
return [e, *other_args], other_keywords
|
369
|
-
end
|
370
|
-
end
|
371
|
-
|
372
|
-
def keyword_arglist
|
373
|
-
return unless var = try_tok(:const)
|
374
|
-
unless try_tok(:colon)
|
375
|
-
return_tok!
|
376
|
-
return
|
377
|
-
end
|
378
|
-
name = var[1]
|
379
|
-
value = interpolation
|
380
|
-
return {name => value} unless try_tok(:comma)
|
381
|
-
{name => value}.merge(assert_expr(:keyword_arglist))
|
382
|
-
end
|
383
|
-
|
384
|
-
def raw
|
385
|
-
return special_fun unless tok = try_tok(:raw)
|
386
|
-
node(Script::String.new(tok.value))
|
387
|
-
end
|
388
|
-
|
389
|
-
def special_fun
|
390
|
-
return paren unless tok = try_tok(:special_fun)
|
391
|
-
first = node(Script::String.new(tok.value.first))
|
392
|
-
Sass::Util.enum_slice(tok.value[1..-1], 2).inject(first) do |l, (i, r)|
|
393
|
-
Script::Interpolation.new(
|
394
|
-
l, i, r && node(Script::String.new(r)),
|
395
|
-
false, false)
|
396
|
-
end
|
397
|
-
end
|
398
|
-
|
399
|
-
def paren
|
400
|
-
return variable unless try_tok(:lparen)
|
401
|
-
was_in_parens = @in_parens
|
402
|
-
@in_parens = true
|
403
|
-
line = @lexer.line
|
404
|
-
e = expr
|
405
|
-
assert_tok(:rparen)
|
406
|
-
return e || node(List.new([], :space), line)
|
407
|
-
ensure
|
408
|
-
@in_parens = was_in_parens
|
409
|
-
end
|
410
|
-
|
411
|
-
def variable
|
412
|
-
return string unless c = try_tok(:const)
|
413
|
-
node(Variable.new(*c.value))
|
414
|
-
end
|
415
|
-
|
416
|
-
def string
|
417
|
-
return number unless first = try_tok(:string)
|
418
|
-
return first.value unless try_tok(:begin_interpolation)
|
419
|
-
line = @lexer.line
|
420
|
-
mid = parse_interpolated
|
421
|
-
last = assert_expr(:string)
|
422
|
-
interp = StringInterpolation.new(first.value, mid, last)
|
423
|
-
interp.line = line
|
424
|
-
interp
|
425
|
-
end
|
426
|
-
|
427
|
-
def number
|
428
|
-
return literal unless tok = try_tok(:number)
|
429
|
-
num = tok.value
|
430
|
-
num.original = num.to_s unless @in_parens
|
431
|
-
num
|
432
|
-
end
|
433
|
-
|
434
|
-
def literal
|
435
|
-
(t = try_tok(:color, :bool)) && (return t.value)
|
436
|
-
end
|
437
|
-
|
438
|
-
# It would be possible to have unified #assert and #try methods,
|
439
|
-
# but detecting the method/token difference turns out to be quite expensive.
|
440
|
-
|
441
|
-
EXPR_NAMES = {
|
442
|
-
:string => "string",
|
443
|
-
:default => "expression (e.g. 1px, bold)",
|
444
|
-
:mixin_arglist => "mixin argument",
|
445
|
-
:fn_arglist => "function argument",
|
446
|
-
}
|
447
|
-
|
448
|
-
def assert_expr(name, expected = nil)
|
449
|
-
(e = send(name)) && (return e)
|
450
|
-
@lexer.expected!(expected || EXPR_NAMES[name] || EXPR_NAMES[:default])
|
451
|
-
end
|
452
|
-
|
453
|
-
def assert_tok(*names)
|
454
|
-
(t = try_tok(*names)) && (return t)
|
455
|
-
@lexer.expected!(names.map {|tok| Lexer::TOKEN_NAMES[tok] || tok}.join(" or "))
|
456
|
-
end
|
457
|
-
|
458
|
-
def try_tok(*names)
|
459
|
-
peeked = @lexer.peek
|
460
|
-
peeked && names.include?(peeked.type) && @lexer.next
|
461
|
-
end
|
462
|
-
|
463
|
-
def assert_done
|
464
|
-
return if @lexer.done?
|
465
|
-
@lexer.expected!(EXPR_NAMES[:default])
|
466
|
-
end
|
467
|
-
|
468
|
-
def node(node, line = @lexer.line)
|
469
|
-
node.line = line
|
470
|
-
node
|
471
|
-
end
|
472
|
-
end
|
473
|
-
end
|
474
|
-
end
|