sass 3.4.20 → 3.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/Rakefile +3 -1
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/lib/sass/cache_stores/filesystem.rb +1 -1
- data/lib/sass/cache_stores/memory.rb +4 -5
- data/lib/sass/engine.rb +4 -10
- data/lib/sass/error.rb +4 -4
- data/lib/sass/exec/sass_convert.rb +6 -4
- data/lib/sass/exec/sass_scss.rb +5 -2
- data/lib/sass/plugin.rb +2 -1
- data/lib/sass/plugin/compiler.rb +14 -11
- data/lib/sass/plugin/configuration.rb +1 -1
- data/lib/sass/plugin/merb.rb +1 -1
- data/lib/sass/script/css_parser.rb +2 -3
- data/lib/sass/script/functions.rb +20 -33
- data/lib/sass/script/lexer.rb +7 -8
- data/lib/sass/script/parser.rb +1 -1
- data/lib/sass/script/tree/node.rb +1 -1
- data/lib/sass/script/tree/operation.rb +1 -1
- data/lib/sass/script/tree/variable.rb +1 -1
- data/lib/sass/script/value/base.rb +6 -6
- data/lib/sass/script/value/color.rb +2 -2
- data/lib/sass/script/value/helpers.rb +7 -7
- data/lib/sass/script/value/number.rb +9 -2
- data/lib/sass/scss/parser.rb +34 -33
- data/lib/sass/scss/rx.rb +2 -3
- data/lib/sass/selector.rb +7 -10
- data/lib/sass/selector/abstract_sequence.rb +3 -1
- data/lib/sass/selector/comma_sequence.rb +4 -2
- data/lib/sass/selector/pseudo.rb +2 -2
- data/lib/sass/selector/sequence.rb +2 -2
- data/lib/sass/selector/simple.rb +3 -1
- data/lib/sass/selector/simple_sequence.rb +4 -4
- data/lib/sass/tree/function_node.rb +2 -3
- data/lib/sass/tree/prop_node.rb +4 -5
- data/lib/sass/tree/rule_node.rb +1 -1
- data/lib/sass/tree/visitors/check_nesting.rb +16 -22
- data/lib/sass/tree/visitors/convert.rb +2 -2
- data/lib/sass/tree/visitors/extend.rb +15 -13
- data/lib/sass/tree/visitors/perform.rb +1 -1
- data/lib/sass/tree/visitors/set_options.rb +1 -1
- data/lib/sass/tree/visitors/to_css.rb +18 -15
- data/lib/sass/util.rb +7 -8
- data/lib/sass/util/multibyte_string_scanner.rb +0 -2
- data/test/sass/engine_test.rb +45 -4
- data/test/sass/script_test.rb +31 -0
- metadata +99 -98
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YjBlMTNlNzkwYjBjMzQ5MzUxNGM1OTliZTdhNGE1ZTMzMTI3NmM1Yg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 58d1f34ed3be5533eff693b26e97e7ff371a075b
|
4
|
+
data.tar.gz: b37b28619e83950329b0c7421ba1dac2610e0e71
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NmE3YjE4OWIzOTRlMDdkY2Q2OWY5ZTRjYjdmODc1OGU4NGRiMmUzZjNiMTIx
|
11
|
-
MWUxMDYyOGY2OWE0MmJhMThmNGRkNzNjZDJjMmM0ODk1NjA2YTY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
Nzg1YTgxNTdmOWI3MjQxOGYwYWQzZTM4OTE3Mjk4NjAzNzRiYTYxNmRmOTIx
|
14
|
-
NDgwODRiNzQ4ZGIyZDFjMTZmNTUwMzM5NTNjMmZmN2Y5OGYzNTcyOTRhOTU1
|
15
|
-
NmE1NjY1NTVlYzZhMzUyMjE0ZTFkNTQ4MTNiODUwM2E3YzUzNDk=
|
6
|
+
metadata.gz: 974eaab5ff1c88be44d765065daf43bb56d5fc74be054332bbbbba3396ba8ba1605a90a994d7815f31ec3eafaebfb7c30a03f960beb9b14295bc44328d750a7b
|
7
|
+
data.tar.gz: f84b2caf06a1e0d42e78297d73f1441b9e9e796d6370f916acd2446893fa3a00335fc454dd7e1437bf16baa3f65bedb8d1d581da6cbeac6cec97316b68c51651
|
data/Rakefile
CHANGED
@@ -32,7 +32,9 @@ if (version[0] > 1 || (version[0] == 1 && version[1] > 8)) &&
|
|
32
32
|
(ENV.has_key?("RUBOCOP") && ENV["RUBOCOP"] == "true" ||
|
33
33
|
!(ENV.has_key?("RUBOCOP") || ENV.has_key?("TEST")))
|
34
34
|
require 'rubocop/rake_task'
|
35
|
-
Rubocop
|
35
|
+
RuboCop = Rubocop unless defined?(RuboCop)
|
36
|
+
RuboCop::RakeTask.new do |t|
|
37
|
+
t.options = ['-c', '.rubocop_0.18.0.yml'] if RUBY_VERSION < '1.9.3'
|
36
38
|
t.patterns = FileList["lib/**/*"]
|
37
39
|
end
|
38
40
|
else
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.4.
|
1
|
+
3.4.21
|
data/VERSION_DATE
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
12 January 2016 01:03:01 UTC
|
@@ -52,7 +52,7 @@ module Sass
|
|
52
52
|
# @param key [String]
|
53
53
|
# @return [String] The path to the cache file.
|
54
54
|
def path_to(key)
|
55
|
-
key = key.gsub(/[<>:\\|?*%]/) {|c| "%%%03d" % Sass::Util.ord(c)}
|
55
|
+
key = key.gsub(/[<>:\\|?*%]/) {|c| "%%%03d" % (Sass::Util.ord(c))}
|
56
56
|
File.join(cache_location, key)
|
57
57
|
end
|
58
58
|
end
|
@@ -26,11 +26,10 @@ module Sass
|
|
26
26
|
|
27
27
|
# @see Base#retrieve
|
28
28
|
def retrieve(key, sha)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
29
|
+
return unless @contents.has_key?(key)
|
30
|
+
return unless @contents[key][:sha] == sha
|
31
|
+
obj = @contents[key][:obj]
|
32
|
+
obj.respond_to?(:deep_copy) ? obj.deep_copy : obj.dup
|
34
33
|
end
|
35
34
|
|
36
35
|
# @see Base#store
|
data/lib/sass/engine.rb
CHANGED
@@ -172,7 +172,7 @@ module Sass
|
|
172
172
|
# @return [{Symbol => Object}] The normalized options hash.
|
173
173
|
# @private
|
174
174
|
def self.normalize_options(options)
|
175
|
-
options = DEFAULT_OPTIONS.merge(options.reject {|
|
175
|
+
options = DEFAULT_OPTIONS.merge(options.reject {|_k, v| v.nil?})
|
176
176
|
|
177
177
|
# If the `:filename` option is passed in without an importer,
|
178
178
|
# assume it's using the default filesystem importer.
|
@@ -476,7 +476,7 @@ ERR
|
|
476
476
|
|
477
477
|
line_tabs = line_tab_str.scan(tab_str).size
|
478
478
|
if tab_str * line_tabs != line_tab_str
|
479
|
-
message = <<END.strip.
|
479
|
+
message = <<END.strip.tr("\n", ' ')
|
480
480
|
Inconsistent indentation: #{Sass::Shared.human_indentation line_tab_str, true} used for indentation,
|
481
481
|
but the rest of the document was indented using #{Sass::Shared.human_indentation tab_str}.
|
482
482
|
END
|
@@ -489,15 +489,13 @@ END
|
|
489
489
|
end
|
490
490
|
|
491
491
|
# @comment
|
492
|
-
# rubocop:disable ParameterLists
|
493
492
|
def try_comment(line, last, tab_str, comment_tab_str, index)
|
494
|
-
# rubocop:enable ParameterLists
|
495
493
|
return unless last && last.comment?
|
496
494
|
# Nested comment stuff must be at least one whitespace char deeper
|
497
495
|
# than the normal indentation
|
498
496
|
return unless line =~ /^#{tab_str}\s/
|
499
497
|
unless line =~ /^(?:#{comment_tab_str})(.*)$/
|
500
|
-
raise SyntaxError.new(<<MSG.strip.
|
498
|
+
raise SyntaxError.new(<<MSG.strip.tr("\n", " "), :line => index)
|
501
499
|
Inconsistent indentation:
|
502
500
|
previous line was indented by #{Sass::Shared.human_indentation comment_tab_str},
|
503
501
|
but this line was indented by #{Sass::Shared.human_indentation line[/^\s*/]}.
|
@@ -798,14 +796,12 @@ WARNING
|
|
798
796
|
:each, :while, :if, :else, :extend, :import, :media, :charset, :content,
|
799
797
|
:at_root, :error]
|
800
798
|
|
801
|
-
# @comment
|
802
|
-
# rubocop:disable MethodLength
|
803
799
|
def parse_directive(parent, line, root)
|
804
800
|
directive, whitespace, value = line.text[1..-1].split(/(\s+)/, 2)
|
805
801
|
raise SyntaxError.new("Invalid directive: '@'.") unless directive
|
806
802
|
offset = directive.size + whitespace.size + 1 if whitespace
|
807
803
|
|
808
|
-
directive_name = directive.
|
804
|
+
directive_name = directive.tr('-', '_').to_sym
|
809
805
|
if DIRECTIVES.include?(directive_name)
|
810
806
|
return send("parse_#{directive_name}_directive", parent, line, root, value, offset)
|
811
807
|
end
|
@@ -860,8 +856,6 @@ WARNING
|
|
860
856
|
)
|
861
857
|
Tree::ExtendNode.new(interp_parsed, optional, selector_range)
|
862
858
|
end
|
863
|
-
# @comment
|
864
|
-
# rubocop:enable MethodLength
|
865
859
|
|
866
860
|
def parse_warn_directive(parent, line, root, value, offset)
|
867
861
|
raise SyntaxError.new("Invalid warn directive '@warn': expected expression.") unless value
|
data/lib/sass/error.rb
CHANGED
@@ -86,7 +86,7 @@ module Sass
|
|
86
86
|
# @param attrs [{Symbol => Object}] The information in the backtrace entry.
|
87
87
|
# See \{#sass\_backtrace}
|
88
88
|
def add_backtrace(attrs)
|
89
|
-
sass_backtrace << attrs.reject {|
|
89
|
+
sass_backtrace << attrs.reject {|_k, v| v.nil?}
|
90
90
|
end
|
91
91
|
|
92
92
|
# Modify the top Sass backtrace entries
|
@@ -104,12 +104,12 @@ module Sass
|
|
104
104
|
# @param attrs [{Symbol => Object}] The information to add to the backtrace entry.
|
105
105
|
# See \{#sass\_backtrace}
|
106
106
|
def modify_backtrace(attrs)
|
107
|
-
attrs = attrs.reject {|
|
107
|
+
attrs = attrs.reject {|_k, v| v.nil?}
|
108
108
|
# Move backwards through the backtrace
|
109
|
-
(0...sass_backtrace.size).to_a.
|
109
|
+
(0...sass_backtrace.size).to_a.reverse_each do |i|
|
110
110
|
entry = sass_backtrace[i]
|
111
111
|
sass_backtrace[i] = attrs.merge(entry)
|
112
|
-
attrs.reject! {|k,
|
112
|
+
attrs.reject! {|k, _v| entry.include?(k)}
|
113
113
|
break if attrs.empty?
|
114
114
|
end
|
115
115
|
end
|
@@ -108,10 +108,11 @@ END
|
|
108
108
|
@options[:for_tree][:dasherize] = true
|
109
109
|
end
|
110
110
|
|
111
|
-
opts.on(
|
111
|
+
opts.on(
|
112
|
+
'--indent NUM',
|
112
113
|
'How many spaces to use for each level of indentation. Defaults to 2.',
|
113
|
-
'"t" means use hard tabs.'
|
114
|
-
|
114
|
+
'"t" means use hard tabs.'
|
115
|
+
) do |indent|
|
115
116
|
if indent == 't'
|
116
117
|
@options[:for_tree][:indent] = "\t"
|
117
118
|
else
|
@@ -162,7 +163,8 @@ END
|
|
162
163
|
end
|
163
164
|
|
164
165
|
def process_directory
|
165
|
-
|
166
|
+
@options[:input] = @args.shift
|
167
|
+
unless @options[:input]
|
166
168
|
raise "Error: directory required when using --recursive."
|
167
169
|
end
|
168
170
|
|
data/lib/sass/exec/sass_scss.rb
CHANGED
@@ -299,8 +299,9 @@ MSG
|
|
299
299
|
# #watched_paths.
|
300
300
|
# rubocop:disable ClassVars
|
301
301
|
@@working_directory = Sass::Util.realpath('.').to_s
|
302
|
-
# rubocop:
|
302
|
+
# rubocop:enable ClassVars
|
303
303
|
|
304
|
+
# rubocop:disable NestedMethodDefinition
|
304
305
|
def watched_file?(file)
|
305
306
|
super(file) ||
|
306
307
|
(file =~ /\.s[ac]ss$/ && file.start_with?(@@working_directory + File::SEPARATOR))
|
@@ -309,6 +310,7 @@ MSG
|
|
309
310
|
def watched_paths
|
310
311
|
@watched_paths ||= super + [@@working_directory]
|
311
312
|
end
|
313
|
+
# rubocop:enable NestedMethodDefinition
|
312
314
|
end
|
313
315
|
|
314
316
|
dirs, files = @args.map {|name| split_colon_path(name)}.
|
@@ -411,7 +413,8 @@ WARNING
|
|
411
413
|
@options[:sourcemap_filename], Sass::Util.pathname(@options[:output_filename]).dirname)
|
412
414
|
rendered, mapping = engine.render_with_sourcemap(relative_sourcemap_path.to_s)
|
413
415
|
write_output(rendered, output)
|
414
|
-
write_output(
|
416
|
+
write_output(
|
417
|
+
mapping.to_json(
|
415
418
|
:type => @options[:sourcemap],
|
416
419
|
:css_path => @options[:output_filename],
|
417
420
|
:sourcemap_path => @options[:sourcemap_filename]) + "\n",
|
data/lib/sass/plugin.rb
CHANGED
@@ -93,7 +93,8 @@ module Sass
|
|
93
93
|
# the second is the location of the CSS file that it should be compiled to.
|
94
94
|
# @see #update_stylesheets
|
95
95
|
def force_update_stylesheets(individual_files = [])
|
96
|
-
Compiler.new(
|
96
|
+
Compiler.new(
|
97
|
+
options.dup.merge(
|
97
98
|
:never_update => false,
|
98
99
|
:always_update => true,
|
99
100
|
:cache => false)).update_stylesheets(individual_files)
|
data/lib/sass/plugin/compiler.rb
CHANGED
@@ -463,12 +463,12 @@ module Sass::Plugin
|
|
463
463
|
end
|
464
464
|
end
|
465
465
|
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
466
|
+
return unless recompile_required
|
467
|
+
|
468
|
+
# In case a file we're watching is removed and then recreated we
|
469
|
+
# prune out the non-existant files here.
|
470
|
+
watched_files_remaining = individual_files.select {|(source, _, _)| File.exist?(source)}
|
471
|
+
update_stylesheets(watched_files_remaining)
|
472
472
|
end
|
473
473
|
|
474
474
|
def update_stylesheet(filename, css, sourcemap)
|
@@ -500,7 +500,9 @@ module Sass::Plugin
|
|
500
500
|
|
501
501
|
write_file(css, rendered)
|
502
502
|
if mapping
|
503
|
-
write_file(
|
503
|
+
write_file(
|
504
|
+
sourcemap,
|
505
|
+
mapping.to_json(
|
504
506
|
:css_path => css, :sourcemap_path => sourcemap, :type => options[:sourcemap]))
|
505
507
|
end
|
506
508
|
run_updated_stylesheet(filename, css, sourcemap) unless compilation_error_occured
|
@@ -521,10 +523,11 @@ module Sass::Plugin
|
|
521
523
|
File.delete css
|
522
524
|
end
|
523
525
|
map = Sass::Util.sourcemap_name(css)
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
526
|
+
|
527
|
+
return unless File.exist?(map)
|
528
|
+
|
529
|
+
run_deleting_sourcemap map
|
530
|
+
File.delete map
|
528
531
|
end
|
529
532
|
|
530
533
|
def watched_file?(file)
|
data/lib/sass/plugin/merb.rb
CHANGED
@@ -15,7 +15,7 @@ unless defined?(Sass::MERB_LOADED)
|
|
15
15
|
end
|
16
16
|
|
17
17
|
{
|
18
|
-
:always_update
|
18
|
+
:always_update => false,
|
19
19
|
:template_location => root + '/public/stylesheets/sass',
|
20
20
|
:css_location => root + '/public/stylesheets',
|
21
21
|
:cache_location => root + '/tmp/sass-cache',
|
@@ -19,9 +19,8 @@ module Sass
|
|
19
19
|
def string
|
20
20
|
tok = try_tok(:string)
|
21
21
|
return number unless tok
|
22
|
-
|
23
|
-
|
24
|
-
end
|
22
|
+
return if @lexer.peek && @lexer.peek.type == :begin_interpolation
|
23
|
+
literal_node(tok.value, tok.source_range)
|
25
24
|
end
|
26
25
|
|
27
26
|
# Short-circuit all the SassScript-only productions
|
@@ -356,6 +356,7 @@ module Sass::Script
|
|
356
356
|
#
|
357
357
|
# @comment
|
358
358
|
# rubocop:enable LineLength
|
359
|
+
# rubocop:disable ModuleLength
|
359
360
|
module Functions
|
360
361
|
@signatures = {}
|
361
362
|
|
@@ -454,8 +455,8 @@ module Sass::Script
|
|
454
455
|
t_arg_arity = sig_arity
|
455
456
|
end
|
456
457
|
|
457
|
-
if
|
458
|
-
(t_kwarg_arity == 0
|
458
|
+
if (t_arg_arity == sig_arity || t_arg_arity > sig_arity && signature.var_args) &&
|
459
|
+
(t_kwarg_arity == 0 || t_kwarg_arity > 0 && signature.var_kwargs)
|
459
460
|
return signature
|
460
461
|
end
|
461
462
|
end
|
@@ -533,7 +534,7 @@ module Sass::Script
|
|
533
534
|
|
534
535
|
return if value.is_a?(Sass::Script::Value::List) && type == :Map && value.value.empty?
|
535
536
|
err = "#{value.inspect} is not a #{TYPE_NAMES[type] || type.to_s.downcase}"
|
536
|
-
err = "$#{name.to_s.
|
537
|
+
err = "$#{name.to_s.tr('_', '-')}: " + err if name
|
537
538
|
raise ArgumentError.new(err)
|
538
539
|
end
|
539
540
|
|
@@ -641,7 +642,7 @@ module Sass::Script
|
|
641
642
|
assert_type green, :Number, :green
|
642
643
|
assert_type blue, :Number, :blue
|
643
644
|
|
644
|
-
color_attrs = [
|
645
|
+
color_attrs = [red, green, blue].map do |c|
|
645
646
|
if c.is_unit?("%")
|
646
647
|
c.value * 255 / 100.0
|
647
648
|
elsif c.unitless?
|
@@ -1102,11 +1103,7 @@ module Sass::Script
|
|
1102
1103
|
# adjust-color(#102030, $blue: 5) => #102035
|
1103
1104
|
# adjust-color(#102030, $red: -5, $blue: 5) => #0b2035
|
1104
1105
|
# adjust-color(hsl(25, 100%, 80%), $lightness: -30%, $alpha: -0.4) => hsla(25, 100%, 50%, 0.6)
|
1105
|
-
# @comment
|
1106
|
-
# rubocop:disable LineLength
|
1107
1106
|
# @overload adjust_color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])
|
1108
|
-
# @comment
|
1109
|
-
# rubocop:disable LineLength
|
1110
1107
|
# @param $color [Sass::Script::Value::Color]
|
1111
1108
|
# @param $red [Sass::Script::Value::Number] The adjustment to make on the
|
1112
1109
|
# red component, between -255 and 255 inclusive
|
@@ -1129,15 +1126,14 @@ module Sass::Script
|
|
1129
1126
|
def adjust_color(color, kwargs)
|
1130
1127
|
assert_type color, :Color, :color
|
1131
1128
|
with = Sass::Util.map_hash(
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1129
|
+
"red" => [-255..255, ""],
|
1130
|
+
"green" => [-255..255, ""],
|
1131
|
+
"blue" => [-255..255, ""],
|
1132
|
+
"hue" => nil,
|
1133
|
+
"saturation" => [-100..100, "%"],
|
1134
|
+
"lightness" => [-100..100, "%"],
|
1135
|
+
"alpha" => [-1..1, ""]
|
1136
|
+
) do |name, (range, units)|
|
1141
1137
|
val = kwargs.delete(name)
|
1142
1138
|
next unless val
|
1143
1139
|
assert_type val, :Number, name
|
@@ -1183,11 +1179,7 @@ module Sass::Script
|
|
1183
1179
|
# scale-color(hsl(120, 70%, 80%), $lightness: 50%) => hsl(120, 70%, 90%)
|
1184
1180
|
# scale-color(rgb(200, 150%, 170%), $green: -40%, $blue: 70%) => rgb(200, 90, 229)
|
1185
1181
|
# scale-color(hsl(200, 70%, 80%), $saturation: -90%, $alpha: -30%) => hsla(200, 7%, 80%, 0.7)
|
1186
|
-
# @comment
|
1187
|
-
# rubocop:disable LineLength
|
1188
1182
|
# @overload scale_color($color, [$red], [$green], [$blue], [$saturation], [$lightness], [$alpha])
|
1189
|
-
# @comment
|
1190
|
-
# rubocop:disable LineLength
|
1191
1183
|
# @param $color [Sass::Script::Value::Color]
|
1192
1184
|
# @param $red [Sass::Script::Value::Number]
|
1193
1185
|
# @param $green [Sass::Script::Value::Number]
|
@@ -1202,14 +1194,13 @@ module Sass::Script
|
|
1202
1194
|
def scale_color(color, kwargs)
|
1203
1195
|
assert_type color, :Color, :color
|
1204
1196
|
with = Sass::Util.map_hash(
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1197
|
+
"red" => 255,
|
1198
|
+
"green" => 255,
|
1199
|
+
"blue" => 255,
|
1200
|
+
"saturation" => 100,
|
1201
|
+
"lightness" => 100,
|
1202
|
+
"alpha" => 1
|
1203
|
+
) do |name, max|
|
1213
1204
|
val = kwargs.delete(name)
|
1214
1205
|
next unless val
|
1215
1206
|
assert_type val, :Number, name
|
@@ -1244,11 +1235,7 @@ module Sass::Script
|
|
1244
1235
|
# change-color(#102030, $blue: 5) => #102005
|
1245
1236
|
# change-color(#102030, $red: 120, $blue: 5) => #782005
|
1246
1237
|
# change-color(hsl(25, 100%, 80%), $lightness: 40%, $alpha: 0.8) => hsla(25, 100%, 40%, 0.8)
|
1247
|
-
# @comment
|
1248
|
-
# rubocop:disable LineLength
|
1249
1238
|
# @overload change_color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])
|
1250
|
-
# @comment
|
1251
|
-
# rubocop:disable LineLength
|
1252
1239
|
# @param $color [Sass::Script::Value::Color]
|
1253
1240
|
# @param $red [Sass::Script::Value::Number] The new red component for the
|
1254
1241
|
# color, within 0 and 255 inclusive
|
data/lib/sass/script/lexer.rb
CHANGED
@@ -71,8 +71,8 @@ module Sass
|
|
71
71
|
OPERATORS_REVERSE = Sass::Util.map_hash(OPERATORS) {|k, v| [v, k]}
|
72
72
|
|
73
73
|
TOKEN_NAMES = Sass::Util.map_hash(OPERATORS_REVERSE) {|k, v| [k, v.inspect]}.merge(
|
74
|
-
|
75
|
-
|
74
|
+
:const => "variable (e.g. $foo)",
|
75
|
+
:ident => "identifier (e.g. middle)")
|
76
76
|
|
77
77
|
# A list of operator strings ordered with longer names first
|
78
78
|
# so that `>` and `<` don't clobber `>=` and `<=`.
|
@@ -80,7 +80,7 @@ module Sass
|
|
80
80
|
|
81
81
|
# A sub-list of {OP_NAMES} that only includes operators
|
82
82
|
# with identifier names.
|
83
|
-
IDENT_OP_NAMES = OP_NAMES.select {|k,
|
83
|
+
IDENT_OP_NAMES = OP_NAMES.select {|k, _v| k =~ /^\w+/}
|
84
84
|
|
85
85
|
PARSEABLE_NUMBER = /(?:(\d*\.\d+)|(\d+))(?:[eE]([+-]?\d+))?(#{UNIT})?/
|
86
86
|
|
@@ -196,11 +196,10 @@ module Sass
|
|
196
196
|
# Rewinds the underlying StringScanner
|
197
197
|
# to before the token returned by \{#peek}.
|
198
198
|
def unpeek!
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
end
|
199
|
+
return unless @tok
|
200
|
+
@scanner.pos = @tok.pos
|
201
|
+
@line = @tok.source_range.start_pos.line
|
202
|
+
@offset = @tok.source_range.start_pos.offset
|
204
203
|
end
|
205
204
|
|
206
205
|
# @return [Boolean] Whether or not there's more source text to lex.
|