sass-embedded 1.54.6-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +42 -0
- data/ext/sass/embedded.rb +9 -0
- data/ext/sass/embedded_sass_pb.rb +349 -0
- data/ext/sass/sass_embedded/dart-sass-embedded +17 -0
- data/ext/sass/sass_embedded/src/LICENSE +1476 -0
- data/ext/sass/sass_embedded/src/dart +0 -0
- data/ext/sass/sass_embedded/src/dart-sass-embedded.snapshot +0 -0
- data/lib/sass/compile_error.rb +28 -0
- data/lib/sass/compile_result.rb +23 -0
- data/lib/sass/embedded/async.rb +65 -0
- data/lib/sass/embedded/channel.rb +61 -0
- data/lib/sass/embedded/compiler.rb +60 -0
- data/lib/sass/embedded/dispatcher.rb +90 -0
- data/lib/sass/embedded/host/function_registry.rb +90 -0
- data/lib/sass/embedded/host/importer_registry.rb +108 -0
- data/lib/sass/embedded/host/logger_registry.rb +50 -0
- data/lib/sass/embedded/host/value_protofier.rb +241 -0
- data/lib/sass/embedded/host.rb +141 -0
- data/lib/sass/embedded/protofier.rb +78 -0
- data/lib/sass/embedded/structifier.rb +36 -0
- data/lib/sass/embedded/varint.rb +35 -0
- data/lib/sass/embedded/version.rb +7 -0
- data/lib/sass/embedded.rb +245 -0
- data/lib/sass/logger/silent.rb +26 -0
- data/lib/sass/logger/source_location.rb +21 -0
- data/lib/sass/logger/source_span.rb +27 -0
- data/lib/sass/script_error.rb +6 -0
- data/lib/sass/value/argument_list.rb +30 -0
- data/lib/sass/value/boolean.rb +52 -0
- data/lib/sass/value/color.rb +253 -0
- data/lib/sass/value/function.rb +54 -0
- data/lib/sass/value/fuzzy_math.rb +81 -0
- data/lib/sass/value/list.rb +79 -0
- data/lib/sass/value/map.rb +71 -0
- data/lib/sass/value/null.rb +48 -0
- data/lib/sass/value/number/unit.rb +186 -0
- data/lib/sass/value/number.rb +358 -0
- data/lib/sass/value/string.rb +55 -0
- data/lib/sass/value.rb +132 -0
- data/lib/sass-embedded.rb +4 -0
- metadata +186 -0
@@ -0,0 +1,358 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'number/unit'
|
4
|
+
|
5
|
+
module Sass
|
6
|
+
module Value
|
7
|
+
# Sass's number type.
|
8
|
+
#
|
9
|
+
# @see https://sass-lang.com/documentation/js-api/classes/SassNumber
|
10
|
+
class Number
|
11
|
+
include Value
|
12
|
+
|
13
|
+
# @param value [Numeric]
|
14
|
+
# @param unit [::String, Hash]
|
15
|
+
# @option unit [Array<::String>] :numerator_units
|
16
|
+
# @option unit [Array<::String>] :denominator_units
|
17
|
+
def initialize(value, unit = nil)
|
18
|
+
case unit
|
19
|
+
when nil
|
20
|
+
numerator_units = []
|
21
|
+
denominator_units = []
|
22
|
+
when ::String
|
23
|
+
numerator_units = [unit]
|
24
|
+
denominator_units = []
|
25
|
+
when ::Hash
|
26
|
+
numerator_units = unit.fetch(:numerator_units, [])
|
27
|
+
raise error "invalid numerator_units #{numerator_units.inspect}" unless numerator_units.is_a? Array
|
28
|
+
|
29
|
+
denominator_units = unit.fetch(:denominator_units, [])
|
30
|
+
raise error "invalid denominator_units #{denominator_units.inspect}" unless denominator_units.is_a? Array
|
31
|
+
else
|
32
|
+
raise error "invalid unit #{unit.inspect}"
|
33
|
+
end
|
34
|
+
|
35
|
+
unless denominator_units.empty? && numerator_units.empty?
|
36
|
+
value = value.dup
|
37
|
+
numerator_units = numerator_units.dup
|
38
|
+
new_denominator_units = []
|
39
|
+
|
40
|
+
denominator_units.each do |denominator_unit|
|
41
|
+
index = numerator_units.find_index do |numerator_unit|
|
42
|
+
factor = Unit.conversion_factor(denominator_unit, numerator_unit)
|
43
|
+
if factor.nil?
|
44
|
+
false
|
45
|
+
else
|
46
|
+
value *= factor
|
47
|
+
true
|
48
|
+
end
|
49
|
+
end
|
50
|
+
if index.nil?
|
51
|
+
new_denominator_units.push(denominator_unit)
|
52
|
+
else
|
53
|
+
numerator_units.delete_at(index)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
denominator_units = new_denominator_units
|
58
|
+
end
|
59
|
+
|
60
|
+
@value = value.freeze
|
61
|
+
@numerator_units = numerator_units.freeze
|
62
|
+
@denominator_units = denominator_units.freeze
|
63
|
+
end
|
64
|
+
|
65
|
+
# @return [Numeric]
|
66
|
+
attr_reader :value
|
67
|
+
|
68
|
+
# @return [Array<::String>]
|
69
|
+
attr_reader :numerator_units, :denominator_units
|
70
|
+
|
71
|
+
# @return [::Boolean]
|
72
|
+
def ==(other)
|
73
|
+
return false unless other.is_a? Sass::Value::Number
|
74
|
+
|
75
|
+
return false if numerator_units.length != other.numerator_units.length ||
|
76
|
+
denominator_units.length != other.denominator_units.length
|
77
|
+
|
78
|
+
return FuzzyMath.equals(value, other.value) if unitless?
|
79
|
+
|
80
|
+
if Unit.canonicalize_units(numerator_units) != Unit.canonicalize_units(other.numerator_units) &&
|
81
|
+
Unit.canonicalize_units(denominator_units) != Unit.canonicalize_units(other.denominator_units)
|
82
|
+
return false
|
83
|
+
end
|
84
|
+
|
85
|
+
FuzzyMath.equals(
|
86
|
+
(value *
|
87
|
+
Unit.canonical_multiplier(numerator_units) /
|
88
|
+
Unit.canonical_multiplier(denominator_units)),
|
89
|
+
(other.value *
|
90
|
+
Unit.canonical_multiplier(other.numerator_units) /
|
91
|
+
Unit.canonical_multiplier(other.denominator_units))
|
92
|
+
)
|
93
|
+
end
|
94
|
+
|
95
|
+
# @return [Integer]
|
96
|
+
def hash
|
97
|
+
@hash ||= FuzzyMath.hash(canonical_units_value)
|
98
|
+
end
|
99
|
+
|
100
|
+
# @return [::Boolean]
|
101
|
+
def unitless?
|
102
|
+
numerator_units.empty? && denominator_units.empty?
|
103
|
+
end
|
104
|
+
|
105
|
+
# @return [Number]
|
106
|
+
# @raise [ScriptError]
|
107
|
+
def assert_unitless(name = nil)
|
108
|
+
raise error "Expected #{self} to have no units", name unless unitless?
|
109
|
+
|
110
|
+
self
|
111
|
+
end
|
112
|
+
|
113
|
+
# @return [::Boolean]
|
114
|
+
def units?
|
115
|
+
!unitless?
|
116
|
+
end
|
117
|
+
|
118
|
+
# @param unit [::String]
|
119
|
+
# @return [::Boolean]
|
120
|
+
def unit?(unit)
|
121
|
+
single_unit? && numerator_units.first == unit
|
122
|
+
end
|
123
|
+
|
124
|
+
# @param unit [::String]
|
125
|
+
# @return [Number]
|
126
|
+
# @raise [ScriptError]
|
127
|
+
def assert_unit(unit, name = nil)
|
128
|
+
raise error "Expected #{self} to have unit #{unit.inspect}", name unless unit?(unit)
|
129
|
+
|
130
|
+
self
|
131
|
+
end
|
132
|
+
|
133
|
+
# @return [::Boolean]
|
134
|
+
def integer?
|
135
|
+
FuzzyMath.integer?(value)
|
136
|
+
end
|
137
|
+
|
138
|
+
# @return [Integer]
|
139
|
+
# @raise [ScriptError]
|
140
|
+
def assert_integer(name = nil)
|
141
|
+
raise error "#{self} is not an integer", name unless integer?
|
142
|
+
|
143
|
+
to_i
|
144
|
+
end
|
145
|
+
|
146
|
+
# @return [Integer]
|
147
|
+
def to_i
|
148
|
+
FuzzyMath.to_i(value)
|
149
|
+
end
|
150
|
+
|
151
|
+
# @param min [Numeric]
|
152
|
+
# @param max [Numeric]
|
153
|
+
# @return [Numeric]
|
154
|
+
# @raise [ScriptError]
|
155
|
+
def assert_between(min, max, name = nil)
|
156
|
+
FuzzyMath.assert_between(value, min, max, name)
|
157
|
+
end
|
158
|
+
|
159
|
+
# @param unit [::String]
|
160
|
+
# @return [::Boolean]
|
161
|
+
def compatible_with_unit?(unit)
|
162
|
+
single_unit? && !Unit.conversion_factor(numerator_units.first, unit).nil?
|
163
|
+
end
|
164
|
+
|
165
|
+
# @param new_numerator_units [Array<::String>]
|
166
|
+
# @param new_denominator_units [Array<::String>]
|
167
|
+
# @return [Number]
|
168
|
+
def convert(new_numerator_units, new_denominator_units, name = nil)
|
169
|
+
Number.new(convert_value(new_numerator_units, new_denominator_units, name), {
|
170
|
+
numerator_units: new_numerator_units,
|
171
|
+
denominator_units: new_denominator_units
|
172
|
+
})
|
173
|
+
end
|
174
|
+
|
175
|
+
# @param new_numerator_units [Array<::String>]
|
176
|
+
# @param new_denominator_units [Array<::String>]
|
177
|
+
# @return [Numeric]
|
178
|
+
def convert_value(new_numerator_units, new_denominator_units, name = nil)
|
179
|
+
coerce_or_convert_value(new_numerator_units, new_denominator_units,
|
180
|
+
coerce_unitless: false,
|
181
|
+
name: name)
|
182
|
+
end
|
183
|
+
|
184
|
+
# @param other [Number]
|
185
|
+
# @return [Number]
|
186
|
+
def convert_to_match(other, name = nil, other_name = nil)
|
187
|
+
Number.new(convert_value_to_match(other, name, other_name), {
|
188
|
+
numerator_units: other.numerator_units,
|
189
|
+
denominator_units: other.denominator_units
|
190
|
+
})
|
191
|
+
end
|
192
|
+
|
193
|
+
# @param other [Number]
|
194
|
+
# @return [Numeric]
|
195
|
+
def convert_value_to_match(other, name = nil, other_name = nil)
|
196
|
+
coerce_or_convert_value(other.numerator_units, other.denominator_units,
|
197
|
+
coerce_unitless: false,
|
198
|
+
name: name,
|
199
|
+
other: other,
|
200
|
+
other_name: other_name)
|
201
|
+
end
|
202
|
+
|
203
|
+
# @param new_numerator_units [Array<::String>]
|
204
|
+
# @param new_denominator_units [Array<::String>]
|
205
|
+
# @return [Number]
|
206
|
+
def coerce(new_numerator_units, new_denominator_units, name = nil)
|
207
|
+
Number.new(coerce_value(new_numerator_units, new_denominator_units, name), {
|
208
|
+
numerator_units: new_numerator_units,
|
209
|
+
denominator_units: new_denominator_units
|
210
|
+
})
|
211
|
+
end
|
212
|
+
|
213
|
+
# @param new_numerator_units [Array<::String>]
|
214
|
+
# @param new_denominator_units [Array<::String>]
|
215
|
+
# @return [Numeric]
|
216
|
+
def coerce_value(new_numerator_units, new_denominator_units, name = nil)
|
217
|
+
coerce_or_convert_value(new_numerator_units, new_denominator_units,
|
218
|
+
coerce_unitless: true,
|
219
|
+
name: name)
|
220
|
+
end
|
221
|
+
|
222
|
+
# @param unit [::String]
|
223
|
+
# @return [Numeric]
|
224
|
+
def coerce_value_to_unit(unit, name = nil)
|
225
|
+
coerce_value([unit], [], name)
|
226
|
+
end
|
227
|
+
|
228
|
+
# @param other [Number]
|
229
|
+
# @return [Number]
|
230
|
+
def coerce_to_match(other, name = nil, other_name = nil)
|
231
|
+
Number.new(coerce_value_to_match(other, name, other_name), {
|
232
|
+
numerator_units: other.numerator_units,
|
233
|
+
denominator_units: other.denominator_units
|
234
|
+
})
|
235
|
+
end
|
236
|
+
|
237
|
+
# @param other [Number]
|
238
|
+
# @return [Numeric]
|
239
|
+
def coerce_value_to_match(other, name = nil, other_name = nil)
|
240
|
+
coerce_or_convert_value(other.numerator_units, other.denominator_units,
|
241
|
+
coerce_unitless: true,
|
242
|
+
name: name,
|
243
|
+
other: other,
|
244
|
+
other_name: other_name)
|
245
|
+
end
|
246
|
+
|
247
|
+
# @return [Number]
|
248
|
+
def assert_number(_name = nil)
|
249
|
+
self
|
250
|
+
end
|
251
|
+
|
252
|
+
protected
|
253
|
+
|
254
|
+
def single_unit?
|
255
|
+
numerator_units.length == 1 && denominator_units.empty?
|
256
|
+
end
|
257
|
+
|
258
|
+
def canonical_units_value
|
259
|
+
if unitless?
|
260
|
+
value
|
261
|
+
elsif single_unit?
|
262
|
+
value * Unit.canonical_multiplier_for_unit(numerator_units.first)
|
263
|
+
else
|
264
|
+
value * Unit.canonical_multiplier(numerator_units) / Unit.canonical_multiplier(denominator_units)
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
def coerce_or_convert_value(new_numerator_units, new_denominator_units,
|
269
|
+
coerce_unitless:,
|
270
|
+
name: nil,
|
271
|
+
other: nil,
|
272
|
+
other_name: nil)
|
273
|
+
if other && (other.numerator_units != new_denominator_units && other.denominator_units != new_denominator_units)
|
274
|
+
raise error "Expect #{other} to have units #{unit_string(new_numerator_units, new_denominator_units).inspect}"
|
275
|
+
end
|
276
|
+
|
277
|
+
return value if numerator_units == new_numerator_units && denominator_units == new_denominator_units
|
278
|
+
|
279
|
+
return value if numerator_units == new_numerator_units && denominator_units == new_denominator_units
|
280
|
+
|
281
|
+
other_unitless = new_numerator_units.empty? && new_denominator_units.empty?
|
282
|
+
|
283
|
+
return value if coerce_unitless && (unitless? || other_unitless)
|
284
|
+
|
285
|
+
compatibility_error = lambda {
|
286
|
+
unless other.nil?
|
287
|
+
message = +"#{self} and"
|
288
|
+
message << " $#{other_name}:" unless other_name.nil?
|
289
|
+
message << " #{other} have incompatible units"
|
290
|
+
message << " (one has units and the other doesn't)" if unitless? || other_unitless
|
291
|
+
return error message, name
|
292
|
+
end
|
293
|
+
|
294
|
+
return error "Expected #{self} to have no units", name unless other_unitless
|
295
|
+
|
296
|
+
if new_numerator_units.length == 1 && new_denominator_units.empty?
|
297
|
+
type = Unit::TYPES_BY_UNIT[new_numerator_units.first]
|
298
|
+
return error "Expected #{self} to have a #{type} unit (#{Unit::UNITS_BY_TYPE[type].join(', ')})", name
|
299
|
+
end
|
300
|
+
|
301
|
+
unit_length = new_numerator_units.length + new_denominator_units.length
|
302
|
+
units = unit_string(new_numerator_units, new_denominator_units)
|
303
|
+
error "Expected #{self} to have unit#{unit_length > 1 ? 's' : ''} #{units}", name
|
304
|
+
}
|
305
|
+
|
306
|
+
result = value
|
307
|
+
|
308
|
+
old_numerator_units = numerator_units.dup
|
309
|
+
new_numerator_units.each do |new_numerator_unit|
|
310
|
+
index = old_numerator_units.find_index do |old_numerator_unit|
|
311
|
+
factor = Unit.conversion_factor(new_numerator_unit, old_numerator_unit)
|
312
|
+
if factor.nil?
|
313
|
+
false
|
314
|
+
else
|
315
|
+
result *= factor
|
316
|
+
true
|
317
|
+
end
|
318
|
+
end
|
319
|
+
raise compatibility_error.call if index.nil?
|
320
|
+
|
321
|
+
old_numerator_units.delete_at(index)
|
322
|
+
end
|
323
|
+
|
324
|
+
old_denominator_units = denominator_units.dup
|
325
|
+
new_denominator_units.each do |new_denominator_unit|
|
326
|
+
index = old_denominator_units.find_index do |old_denominator_unit|
|
327
|
+
factor = Unit.conversion_factor(new_denominator_unit, old_denominator_unit)
|
328
|
+
if factor.nil?
|
329
|
+
false
|
330
|
+
else
|
331
|
+
result /= factor
|
332
|
+
true
|
333
|
+
end
|
334
|
+
end
|
335
|
+
raise compatibility_error.call if index.nil?
|
336
|
+
|
337
|
+
old_denominator_units.delete_at(index)
|
338
|
+
end
|
339
|
+
|
340
|
+
raise compatibility_error.call unless old_numerator_units.empty? && old_denominator_units.empty?
|
341
|
+
|
342
|
+
result
|
343
|
+
end
|
344
|
+
|
345
|
+
def unit_string(numerator_units, denominator_units)
|
346
|
+
if numerator_units.empty?
|
347
|
+
return 'no units' if denominator_units.empty?
|
348
|
+
|
349
|
+
return denominator_units.length == 1 ? "#{denominator_units.first}^-1" : "(#{denominator_units.join('*')})^-1"
|
350
|
+
end
|
351
|
+
|
352
|
+
return numerator_units.join('*') if denominator_units.empty?
|
353
|
+
|
354
|
+
"#{numerator_units.join('*')}/#{denominator_units.join('*')}"
|
355
|
+
end
|
356
|
+
end
|
357
|
+
end
|
358
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sass
|
4
|
+
module Value
|
5
|
+
# Sass's string type.
|
6
|
+
#
|
7
|
+
# @see https://sass-lang.com/documentation/js-api/classes/SassString
|
8
|
+
class String
|
9
|
+
include Value
|
10
|
+
|
11
|
+
# @param text [::String]
|
12
|
+
# @param quoted [::Boolean]
|
13
|
+
def initialize(text = '', quoted: true)
|
14
|
+
@text = text.freeze
|
15
|
+
@quoted = quoted
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [::String]
|
19
|
+
attr_reader :text
|
20
|
+
|
21
|
+
# @return [::Boolean]
|
22
|
+
def quoted?
|
23
|
+
@quoted
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [::Boolean]
|
27
|
+
def ==(other)
|
28
|
+
other.is_a?(Sass::Value::String) && other.text == text
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [Integer]
|
32
|
+
def hash
|
33
|
+
@hash ||= text.hash
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [String]
|
37
|
+
def assert_string(_name = nil)
|
38
|
+
self
|
39
|
+
end
|
40
|
+
|
41
|
+
# @param sass_index [Number]
|
42
|
+
# @return [Integer]
|
43
|
+
def sass_index_to_string_index(sass_index, name = nil)
|
44
|
+
index = sass_index.assert_number(name).assert_integer(name)
|
45
|
+
raise error('String index may not be 0', name) if index.zero?
|
46
|
+
|
47
|
+
if index.abs > text.length
|
48
|
+
raise error("Invalid index #{sass_index} for a string with #{text.length} characters", name)
|
49
|
+
end
|
50
|
+
|
51
|
+
index.negative? ? text.length + index : index - 1
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/sass/value.rb
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'script_error'
|
4
|
+
|
5
|
+
module Sass
|
6
|
+
# The abstract base class of Sass's value types.
|
7
|
+
#
|
8
|
+
# @see https://sass-lang.com/documentation/js-api/classes/Value
|
9
|
+
module Value
|
10
|
+
# @return [::String, nil]
|
11
|
+
def separator
|
12
|
+
nil
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [::Boolean]
|
16
|
+
def bracketed?
|
17
|
+
false
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [::Boolean]
|
21
|
+
def eql?(other)
|
22
|
+
self == other
|
23
|
+
end
|
24
|
+
|
25
|
+
# @param index [Numeric]
|
26
|
+
# @return [Value]
|
27
|
+
def [](index)
|
28
|
+
at(index)
|
29
|
+
end
|
30
|
+
|
31
|
+
# @param index [Numeric]
|
32
|
+
# @return [Value]
|
33
|
+
def at(index)
|
34
|
+
index < 1 && index >= -1 ? self : nil
|
35
|
+
end
|
36
|
+
|
37
|
+
# @return [Array<Value>]
|
38
|
+
def to_a
|
39
|
+
[self]
|
40
|
+
end
|
41
|
+
|
42
|
+
# @return [::Boolean]
|
43
|
+
def to_bool
|
44
|
+
true
|
45
|
+
end
|
46
|
+
|
47
|
+
# @return [Map, nil]
|
48
|
+
def to_map
|
49
|
+
nil
|
50
|
+
end
|
51
|
+
|
52
|
+
# @return [Value, nil]
|
53
|
+
def to_nil
|
54
|
+
self
|
55
|
+
end
|
56
|
+
|
57
|
+
# @return [Boolean]
|
58
|
+
# @raise [ScriptError]
|
59
|
+
def assert_boolean(name = nil)
|
60
|
+
raise error("#{self} is not a boolean", name)
|
61
|
+
end
|
62
|
+
|
63
|
+
# @raise [ScriptError]
|
64
|
+
def assert_calculation(name = nil)
|
65
|
+
raise error("#{self} is not a calculation", name)
|
66
|
+
end
|
67
|
+
|
68
|
+
# @return [Color]
|
69
|
+
# @raise [ScriptError]
|
70
|
+
def assert_color(name = nil)
|
71
|
+
raise error("#{self} is not a color", name)
|
72
|
+
end
|
73
|
+
|
74
|
+
# @return [Function]
|
75
|
+
# @raise [ScriptError]
|
76
|
+
def assert_function(name = nil)
|
77
|
+
raise error("#{self} is not a function", name)
|
78
|
+
end
|
79
|
+
|
80
|
+
# @return [Map]
|
81
|
+
# @raise [ScriptError]
|
82
|
+
def assert_map(name = nil)
|
83
|
+
raise error("#{self} is not a map", name)
|
84
|
+
end
|
85
|
+
|
86
|
+
# @return [Number]
|
87
|
+
# @raise [ScriptError]
|
88
|
+
def assert_number(name = nil)
|
89
|
+
raise error("#{self} is not a number", name)
|
90
|
+
end
|
91
|
+
|
92
|
+
# @return [String]
|
93
|
+
# @raise [ScriptError]
|
94
|
+
def assert_string(name = nil)
|
95
|
+
raise error("#{self} is not a string", name)
|
96
|
+
end
|
97
|
+
|
98
|
+
# @param sass_index [Number]
|
99
|
+
# @return [Integer]
|
100
|
+
def sass_index_to_array_index(sass_index, name = nil)
|
101
|
+
index = sass_index.assert_number(name).assert_integer(name)
|
102
|
+
raise error('List index may not be 0', name) if index.zero?
|
103
|
+
|
104
|
+
if index.abs > to_a_length
|
105
|
+
raise error("Invalid index #{sass_index} for a list with #{to_a_length} elements", name)
|
106
|
+
end
|
107
|
+
|
108
|
+
index.negative? ? to_a_length + index : index - 1
|
109
|
+
end
|
110
|
+
|
111
|
+
private
|
112
|
+
|
113
|
+
def to_a_length
|
114
|
+
1
|
115
|
+
end
|
116
|
+
|
117
|
+
def error(message, name = nil)
|
118
|
+
Sass::ScriptError.new name.nil? ? message : "$#{name}: #{message}"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
require_relative 'value/list'
|
124
|
+
require_relative 'value/argument_list'
|
125
|
+
require_relative 'value/boolean'
|
126
|
+
require_relative 'value/color'
|
127
|
+
require_relative 'value/function'
|
128
|
+
require_relative 'value/fuzzy_math'
|
129
|
+
require_relative 'value/map'
|
130
|
+
require_relative 'value/null'
|
131
|
+
require_relative 'value/number'
|
132
|
+
require_relative 'value/string'
|