sass 3.2.19 → 3.3.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CONTRIBUTING +1 -1
- data/MIT-LICENSE +2 -2
- data/README.md +13 -14
- data/REVISION +1 -1
- data/Rakefile +4 -6
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/VERSION_NAME +1 -1
- data/bin/sass +1 -6
- data/bin/sass-convert +1 -6
- data/bin/scss +1 -6
- data/lib/sass/cache_stores/base.rb +0 -2
- data/lib/sass/cache_stores/chain.rb +1 -1
- data/lib/sass/cache_stores/filesystem.rb +3 -6
- data/lib/sass/callbacks.rb +1 -1
- data/lib/sass/css.rb +1 -1
- data/lib/sass/engine.rb +4 -11
- data/lib/sass/error.rb +2 -2
- data/lib/sass/exec.rb +10 -40
- data/lib/sass/importers/filesystem.rb +15 -52
- data/lib/sass/logger/log_level.rb +3 -3
- data/lib/sass/media.rb +4 -1
- data/lib/sass/plugin.rb +1 -2
- data/lib/sass/plugin/compiler.rb +18 -40
- data/lib/sass/plugin/staleness_checker.rb +5 -21
- data/lib/sass/railtie.rb +0 -1
- data/lib/sass/script/funcall.rb +8 -62
- data/lib/sass/script/functions.rb +457 -557
- data/lib/sass/script/lexer.rb +30 -25
- data/lib/sass/script/list.rb +1 -2
- data/lib/sass/script/literal.rb +18 -0
- data/lib/sass/script/null.rb +1 -4
- data/lib/sass/script/operation.rb +1 -0
- data/lib/sass/script/parser.rb +35 -42
- data/lib/sass/script/string.rb +1 -1
- data/lib/sass/script/unary_operation.rb +3 -8
- data/lib/sass/scss/parser.rb +14 -33
- data/lib/sass/scss/rx.rb +10 -3
- data/lib/sass/selector.rb +16 -19
- data/lib/sass/selector/sequence.rb +7 -16
- data/lib/sass/selector/simple.rb +1 -1
- data/lib/sass/selector/simple_sequence.rb +15 -25
- data/lib/sass/tree/comment_node.rb +2 -2
- data/lib/sass/tree/import_node.rb +2 -9
- data/lib/sass/tree/visitors/check_nesting.rb +2 -3
- data/lib/sass/tree/visitors/convert.rb +4 -9
- data/lib/sass/tree/visitors/cssize.rb +15 -36
- data/lib/sass/tree/visitors/perform.rb +20 -23
- data/lib/sass/tree/visitors/set_options.rb +0 -8
- data/lib/sass/tree/visitors/to_css.rb +1 -0
- data/lib/sass/util.rb +2 -120
- data/lib/sass/util/multibyte_string_scanner.rb +8 -29
- data/test/sass/conversion_test.rb +8 -33
- data/test/sass/css2sass_test.rb +0 -19
- data/test/sass/engine_test.rb +17 -129
- data/test/sass/extend_test.rb +24 -169
- data/test/sass/functions_test.rb +73 -93
- data/test/sass/plugin_test.rb +11 -72
- data/test/sass/script_conversion_test.rb +0 -14
- data/test/sass/script_test.rb +1 -40
- data/test/sass/scss/css_test.rb +3 -44
- data/test/sass/scss/scss_test.rb +3 -134
- data/test/sass/util_test.rb +0 -93
- data/vendor/listen/CHANGELOG.md +2 -83
- data/vendor/listen/Gemfile +1 -8
- data/vendor/listen/Guardfile +1 -1
- data/vendor/listen/LICENSE +1 -1
- data/vendor/listen/README.md +5 -8
- data/vendor/listen/lib/listen.rb +5 -7
- data/vendor/listen/lib/listen/adapter.rb +29 -76
- data/vendor/listen/lib/listen/adapters/darwin.rb +10 -11
- data/vendor/listen/lib/listen/adapters/linux.rb +30 -33
- data/vendor/listen/lib/listen/adapters/polling.rb +1 -2
- data/vendor/listen/lib/listen/adapters/windows.rb +21 -27
- data/vendor/listen/lib/listen/directory_record.rb +10 -63
- data/vendor/listen/lib/listen/listener.rb +0 -22
- data/vendor/listen/lib/listen/multi_listener.rb +0 -22
- data/vendor/listen/lib/listen/version.rb +1 -1
- data/vendor/listen/listen.gemspec +4 -0
- data/vendor/listen/spec/listen/adapter_spec.rb +4 -45
- data/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -6
- data/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -6
- data/vendor/listen/spec/listen/adapters/windows_spec.rb +1 -7
- data/vendor/listen/spec/listen/directory_record_spec.rb +4 -91
- data/vendor/listen/spec/listen/listener_spec.rb +0 -14
- data/vendor/listen/spec/listen/multi_listener_spec.rb +1 -19
- data/vendor/listen/spec/spec_helper.rb +3 -6
- data/vendor/listen/spec/support/adapter_helper.rb +212 -125
- data/vendor/listen/spec/support/listeners_helper.rb +1 -13
- data/vendor/listen/spec/support/platform_helper.rb +0 -4
- metadata +113 -105
- checksums.yaml +0 -7
- data/lib/sass/util/test.rb +0 -10
- data/test/sass/exec_test.rb +0 -86
- data/test/sass/results/cached_import_option.css +0 -3
- data/test/sass/templates/_cached_import_option_partial.scss +0 -1
- data/test/sass/templates/_same_name_different_partiality.scss +0 -1
- data/test/sass/templates/bork5.sass +0 -3
- data/test/sass/templates/cached_import_option.scss +0 -3
- data/test/sass/templates/same_name_different_ext.sass +0 -2
- data/test/sass/templates/same_name_different_ext.scss +0 -1
- data/test/sass/templates/same_name_different_partiality.scss +0 -1
- data/test/sass/templates/subdir/import_up1.scss +0 -1
- data/test/sass/templates/subdir/import_up2.scss +0 -1
- data/vendor/listen/CONTRIBUTING.md +0 -38
- data/vendor/listen/lib/listen/adapters/bsd.rb +0 -112
- data/vendor/listen/lib/listen/dependency_manager.rb +0 -126
- data/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
- data/vendor/listen/spec/listen/dependency_manager_spec.rb +0 -107
data/lib/sass/script/lexer.rb
CHANGED
@@ -69,7 +69,8 @@ module Sass
|
|
69
69
|
|
70
70
|
TOKEN_NAMES = Sass::Util.map_hash(OPERATORS_REVERSE) {|k, v| [k, v.inspect]}.merge({
|
71
71
|
:const => "variable (e.g. $foo)",
|
72
|
-
:ident => "identifier (e.g. middle)"
|
72
|
+
:ident => "identifier (e.g. middle)",
|
73
|
+
:bool => "boolean (e.g. true, false)",
|
73
74
|
})
|
74
75
|
|
75
76
|
# A list of operator strings ordered with longer names first
|
@@ -89,6 +90,8 @@ module Sass
|
|
89
90
|
:ident => /(#{IDENT})(\()?/,
|
90
91
|
:number => /(-)?(?:(\d*\.\d+)|(\d+))([a-zA-Z%]+)?/,
|
91
92
|
:color => HEXCOLOR,
|
93
|
+
:bool => /(true|false)\b/,
|
94
|
+
:null => /null\b/,
|
92
95
|
:ident_op => %r{(#{Regexp.union(*IDENT_OP_NAMES.map{|s| Regexp.new(Regexp.escape(s) + "(?!#{NMCHAR}|\Z)")})})},
|
93
96
|
:op => %r{(#{Regexp.union(*OP_NAMES)})},
|
94
97
|
}
|
@@ -107,28 +110,18 @@ module Sass
|
|
107
110
|
# while the boolean represents whether or not the string
|
108
111
|
# is following an interpolated segment.
|
109
112
|
STRING_REGULAR_EXPRESSIONS = {
|
110
|
-
:double =>
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
:
|
115
|
-
|
116
|
-
true => string_re('', "'")
|
117
|
-
},
|
118
|
-
:uri => {
|
119
|
-
false => /url\(#{W}(#{URLCHAR}*?)(#{W}\)|#\{)/,
|
120
|
-
true => /(#{URLCHAR}*?)(#{W}\)|#\{)/
|
121
|
-
},
|
113
|
+
[:double, false] => string_re('"', '"'),
|
114
|
+
[:single, false] => string_re("'", "'"),
|
115
|
+
[:double, true] => string_re('', '"'),
|
116
|
+
[:single, true] => string_re('', "'"),
|
117
|
+
[:uri, false] => /url\(#{W}(#{URLCHAR}*?)(#{W}\)|#\{)/,
|
118
|
+
[:uri, true] => /(#{URLCHAR}*?)(#{W}\)|#\{)/,
|
122
119
|
# Defined in https://developer.mozilla.org/en/CSS/@-moz-document as a
|
123
120
|
# non-standard version of http://www.w3.org/TR/css3-conditional/
|
124
|
-
:url_prefix => {
|
125
|
-
|
126
|
-
|
127
|
-
}
|
128
|
-
:domain => {
|
129
|
-
false => /domain\(#{W}(#{URLCHAR}*?)(#{W}\)|#\{)/,
|
130
|
-
true => /(#{URLCHAR}*?)(#{W}\)|#\{)/
|
131
|
-
}
|
121
|
+
[:url_prefix, false] => /url-prefix\(#{W}(#{URLCHAR}*?)(#{W}\)|#\{)/,
|
122
|
+
[:url_prefix, true] => /(#{URLCHAR}*?)(#{W}\)|#\{)/,
|
123
|
+
[:domain, false] => /domain\(#{W}(#{URLCHAR}*?)(#{W}\)|#\{)/,
|
124
|
+
[:domain, true] => /(#{URLCHAR}*?)(#{W}\)|#\{)/,
|
132
125
|
}
|
133
126
|
|
134
127
|
# @param str [String, StringScanner] The source text to lex
|
@@ -242,9 +235,9 @@ module Sass
|
|
242
235
|
return string(interp_type, true)
|
243
236
|
end
|
244
237
|
|
245
|
-
variable || string(:double, false) || string(:single, false) || number ||
|
246
|
-
string(:uri, false) || raw(UNICODERANGE) ||
|
247
|
-
ident || op
|
238
|
+
variable || string(:double, false) || string(:single, false) || number ||
|
239
|
+
color || bool || null || string(:uri, false) || raw(UNICODERANGE) ||
|
240
|
+
special_fun || special_val || ident_op || ident || op
|
248
241
|
end
|
249
242
|
|
250
243
|
def variable
|
@@ -252,6 +245,8 @@ module Sass
|
|
252
245
|
end
|
253
246
|
|
254
247
|
def _variable(rx)
|
248
|
+
line = @line
|
249
|
+
offset = @offset
|
255
250
|
return unless scan(rx)
|
256
251
|
|
257
252
|
[:const, @scanner[2]]
|
@@ -263,7 +258,7 @@ module Sass
|
|
263
258
|
end
|
264
259
|
|
265
260
|
def string(re, open)
|
266
|
-
return unless scan(STRING_REGULAR_EXPRESSIONS[re
|
261
|
+
return unless scan(STRING_REGULAR_EXPRESSIONS[[re, open]])
|
267
262
|
if @scanner[2] == '#{' #'
|
268
263
|
@scanner.pos -= 2 # Don't actually consume the #{
|
269
264
|
@interpolation_stack << re
|
@@ -294,6 +289,16 @@ MESSAGE
|
|
294
289
|
[:color, Script::Color.new(value)]
|
295
290
|
end
|
296
291
|
|
292
|
+
def bool
|
293
|
+
return unless s = scan(REGULAR_EXPRESSIONS[:bool])
|
294
|
+
[:bool, Script::Bool.new(s == 'true')]
|
295
|
+
end
|
296
|
+
|
297
|
+
def null
|
298
|
+
return unless scan(REGULAR_EXPRESSIONS[:null])
|
299
|
+
[:null, Script::Null.new]
|
300
|
+
end
|
301
|
+
|
297
302
|
def special_fun
|
298
303
|
return unless str1 = scan(/((-[\w-]+-)?(calc|element)|expression|progid:[a-z\.]*)\(/i)
|
299
304
|
str2, _ = Sass::Shared.balance(@scanner, ?(, ?), 1)
|
data/lib/sass/script/list.rb
CHANGED
@@ -49,8 +49,7 @@ module Sass::Script
|
|
49
49
|
return "()" if value.empty?
|
50
50
|
precedence = Sass::Script::Parser.precedence_of(separator)
|
51
51
|
value.reject {|e| e.is_a?(Null)}.map do |v|
|
52
|
-
if v.is_a?(List) && Sass::Script::Parser.precedence_of(v.separator) <= precedence
|
53
|
-
separator == :space && v.is_a?(UnaryOperation) && (v.operator == :minus || v.operator == :plus)
|
52
|
+
if v.is_a?(List) && Sass::Script::Parser.precedence_of(v.separator) <= precedence
|
54
53
|
"(#{v.to_sass(opts)})"
|
55
54
|
else
|
56
55
|
v.to_sass(opts)
|
data/lib/sass/script/literal.rb
CHANGED
@@ -90,6 +90,24 @@ MSG
|
|
90
90
|
Sass::Script::Bool.new(!to_bool)
|
91
91
|
end
|
92
92
|
|
93
|
+
# The SassScript default operation (e.g. `$a $b`, `"foo" "bar"`).
|
94
|
+
#
|
95
|
+
# @param other [Literal] The right-hand side of the operator
|
96
|
+
# @return [Script::String] A string containing both literals
|
97
|
+
# separated by a space
|
98
|
+
def space(other)
|
99
|
+
Sass::Script::String.new("#{self.to_s} #{other.to_s}")
|
100
|
+
end
|
101
|
+
|
102
|
+
# The SassScript `,` operation (e.g. `$a, $b`, `"foo", "bar"`).
|
103
|
+
#
|
104
|
+
# @param other [Literal] The right-hand side of the operator
|
105
|
+
# @return [Script::String] A string containing both literals
|
106
|
+
# separated by `", "`
|
107
|
+
def comma(other)
|
108
|
+
Sass::Script::String.new("#{self.to_s},#{' ' unless options[:style] == :compressed}#{other.to_s}")
|
109
|
+
end
|
110
|
+
|
93
111
|
# The SassScript `=` operation
|
94
112
|
# (used for proprietary MS syntax like `alpha(opacity=20)`).
|
95
113
|
#
|
data/lib/sass/script/null.rb
CHANGED
data/lib/sass/script/parser.rb
CHANGED
@@ -203,7 +203,7 @@ module Sass
|
|
203
203
|
# sub is the name of the production beneath it,
|
204
204
|
# and ops is a list of operators for this precedence level
|
205
205
|
def production(name, sub, *ops)
|
206
|
-
class_eval <<RUBY
|
206
|
+
class_eval <<RUBY
|
207
207
|
def #{name}
|
208
208
|
interp = try_ops_after_interp(#{ops.inspect}, #{name.inspect}) and return interp
|
209
209
|
return unless e = #{sub}
|
@@ -223,7 +223,7 @@ RUBY
|
|
223
223
|
end
|
224
224
|
|
225
225
|
def unary(op, sub)
|
226
|
-
class_eval <<RUBY
|
226
|
+
class_eval <<RUBY
|
227
227
|
def unary_#{op}
|
228
228
|
return #{sub} unless tok = try_tok(:#{op})
|
229
229
|
interp = try_op_before_interp(tok) and return interp
|
@@ -242,17 +242,18 @@ RUBY
|
|
242
242
|
def lexer_class; Lexer; end
|
243
243
|
|
244
244
|
def expr
|
245
|
+
interp = try_ops_after_interp([:comma], :expr) and return interp
|
245
246
|
line = @lexer.line
|
246
247
|
return unless e = interpolation
|
247
|
-
|
248
|
+
arr = [e]
|
248
249
|
while tok = try_tok(:comma)
|
249
|
-
if interp = try_op_before_interp(tok,
|
250
|
+
if interp = try_op_before_interp(tok, e)
|
250
251
|
return interp unless other_interp = try_ops_after_interp([:comma], :expr, interp)
|
251
252
|
return other_interp
|
252
253
|
end
|
253
|
-
|
254
|
+
arr << assert_expr(:interpolation)
|
254
255
|
end
|
255
|
-
|
256
|
+
arr.size == 1 ? arr.first : node(List.new(arr, :comma), line)
|
256
257
|
end
|
257
258
|
|
258
259
|
production :equals, :interpolation, :single_eq
|
@@ -321,16 +322,9 @@ RUBY
|
|
321
322
|
|
322
323
|
name = @lexer.next
|
323
324
|
if color = Color::COLOR_NAMES[name.value.downcase]
|
324
|
-
node(Color.new(color))
|
325
|
-
elsif name.value == "true"
|
326
|
-
node(Script::Bool.new(true))
|
327
|
-
elsif name.value == "false"
|
328
|
-
node(Script::Bool.new(false))
|
329
|
-
elsif name.value == "null"
|
330
|
-
node(Script::Null.new)
|
331
|
-
else
|
332
|
-
node(Script::String.new(name.value, :identifier))
|
325
|
+
return node(Color.new(color))
|
333
326
|
end
|
327
|
+
node(Script::String.new(name.value, :identifier))
|
334
328
|
end
|
335
329
|
|
336
330
|
def funcall
|
@@ -352,6 +346,8 @@ RUBY
|
|
352
346
|
splat = nil
|
353
347
|
must_have_default = false
|
354
348
|
loop do
|
349
|
+
line = @lexer.line
|
350
|
+
offset = @lexer.offset + 1
|
355
351
|
c = assert_tok(:const)
|
356
352
|
var = Script::Variable.new(c.value)
|
357
353
|
if try_tok(:colon)
|
@@ -371,41 +367,38 @@ RUBY
|
|
371
367
|
end
|
372
368
|
|
373
369
|
def fn_arglist
|
374
|
-
arglist(:
|
370
|
+
arglist(:fn_arglist, :equals)
|
375
371
|
end
|
376
372
|
|
377
373
|
def mixin_arglist
|
378
|
-
arglist(:
|
374
|
+
arglist(:mixin_arglist, :interpolation)
|
379
375
|
end
|
380
376
|
|
381
|
-
def arglist(
|
377
|
+
def arglist(type, subexpr)
|
382
378
|
return unless e = send(subexpr)
|
379
|
+
if @lexer.peek && @lexer.peek.type == :colon
|
380
|
+
name = e
|
381
|
+
@lexer.expected!("comma") unless name.is_a?(Variable)
|
382
|
+
assert_tok(:colon)
|
383
|
+
keywords = {name.underscored_name => assert_expr(subexpr, EXPR_NAMES[type])}
|
384
|
+
end
|
383
385
|
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
@lexer.expected!("comma") unless name.is_a?(Variable)
|
390
|
-
assert_tok(:colon)
|
391
|
-
value = assert_expr(subexpr, description)
|
392
|
-
|
393
|
-
if keywords[name.underscored_name]
|
394
|
-
raise SyntaxError.new("Keyword argument \"#{name.to_sass}\" passed more than once")
|
395
|
-
end
|
396
|
-
|
397
|
-
keywords[name.underscored_name] = value
|
398
|
-
else
|
399
|
-
if !keywords.empty?
|
400
|
-
raise SyntaxError.new("Positional arguments must come before keyword arguments.")
|
401
|
-
end
|
386
|
+
unless try_tok(:comma)
|
387
|
+
return [], keywords if keywords
|
388
|
+
return [], {}, e if try_tok(:splat)
|
389
|
+
return [e], {}
|
390
|
+
end
|
402
391
|
|
403
|
-
|
404
|
-
|
392
|
+
other_args, other_keywords, splat = assert_expr(type)
|
393
|
+
if keywords
|
394
|
+
if !other_args.empty? || splat
|
395
|
+
raise SyntaxError.new("Positional arguments must come before keyword arguments.")
|
396
|
+
elsif other_keywords[name.underscored_name]
|
397
|
+
raise SyntaxError.new("Keyword argument \"#{name.to_sass}\" passed more than once")
|
405
398
|
end
|
406
|
-
|
407
|
-
|
408
|
-
e
|
399
|
+
return other_args, keywords.merge(other_keywords), splat
|
400
|
+
else
|
401
|
+
return [e, *other_args], other_keywords, splat
|
409
402
|
end
|
410
403
|
end
|
411
404
|
|
@@ -460,7 +453,7 @@ RUBY
|
|
460
453
|
end
|
461
454
|
|
462
455
|
def literal
|
463
|
-
(t = try_tok(:color)) && (return t.value)
|
456
|
+
(t = try_tok(:color, :bool, :null)) && (return t.value)
|
464
457
|
end
|
465
458
|
|
466
459
|
# It would be possible to have unified #assert and #try methods,
|
data/lib/sass/script/string.rb
CHANGED
@@ -4,14 +4,9 @@ module Sass::Script
|
|
4
4
|
#
|
5
5
|
# Currently only `-`, `/`, and `not` are unary operators.
|
6
6
|
class UnaryOperation < Node
|
7
|
-
# @
|
8
|
-
|
9
|
-
|
10
|
-
# @return [Script::Node] The parse-tree node for the object of the operator
|
11
|
-
attr_reader :operand
|
12
|
-
|
13
|
-
# @param operand [Script::Node] See \{#operand}
|
14
|
-
# @param operator [Symbol] See \{#operator}
|
7
|
+
# @param operand [Script::Node] The parse-tree node
|
8
|
+
# for the object of the operator
|
9
|
+
# @param operator [Symbol] The operator to perform
|
15
10
|
def initialize(operand, operator)
|
16
11
|
@operand = operand
|
17
12
|
@operator = operator
|
data/lib/sass/scss/parser.rb
CHANGED
@@ -52,18 +52,6 @@ module Sass
|
|
52
52
|
ql
|
53
53
|
end
|
54
54
|
|
55
|
-
# Parses a supports query condition.
|
56
|
-
#
|
57
|
-
# @return [Sass::Supports::Condition] The parsed condition
|
58
|
-
# @raise [Sass::SyntaxError] if there's a syntax error in the condition,
|
59
|
-
# or if it doesn't take up the entire input string.
|
60
|
-
def parse_supports_condition
|
61
|
-
init_scanner!
|
62
|
-
condition = supports_condition
|
63
|
-
expected("supports condition") unless @scanner.eos?
|
64
|
-
condition
|
65
|
-
end
|
66
|
-
|
67
55
|
private
|
68
56
|
|
69
57
|
include Sass::SCSS::RX
|
@@ -120,6 +108,7 @@ module Sass
|
|
120
108
|
value = [text.sub(/^\s*\/\//, '/*').gsub(/^\s*\/\//, ' *') + ' */']
|
121
109
|
else
|
122
110
|
value = Sass::Engine.parse_interp(text, line, @scanner.pos - text.size, :filename => @filename)
|
111
|
+
value[0].slice!(2) if loud # get rid of the "!"
|
123
112
|
value.unshift(@scanner.
|
124
113
|
string[0...@scanner.pos].
|
125
114
|
reverse[/.*?\*\/(.*?)($|\Z)/, 1].
|
@@ -311,20 +300,16 @@ module Sass
|
|
311
300
|
|
312
301
|
loop do
|
313
302
|
values << expr!(:import_arg)
|
314
|
-
break if use_css_import?
|
315
|
-
break unless tok(/,/)
|
316
|
-
ss
|
303
|
+
break if use_css_import? || !tok(/,\s*/)
|
317
304
|
end
|
318
305
|
|
319
306
|
return values
|
320
307
|
end
|
321
308
|
|
322
309
|
def import_arg
|
323
|
-
line = @line
|
324
310
|
return unless (str = tok(STRING)) || (uri = tok?(/url\(/i))
|
325
311
|
if uri
|
326
312
|
str = sass_script(:parse_string)
|
327
|
-
ss
|
328
313
|
media = media_query_list
|
329
314
|
ss
|
330
315
|
return node(Tree::CssImportNode.new(str, media.to_a))
|
@@ -334,19 +319,17 @@ module Sass
|
|
334
319
|
ss
|
335
320
|
|
336
321
|
media = media_query_list
|
337
|
-
if path =~ /^
|
338
|
-
node
|
339
|
-
else
|
340
|
-
node = Sass::Tree::ImportNode.new(path.strip)
|
322
|
+
if path =~ /^http:\/\// || media || use_css_import?
|
323
|
+
return node(Sass::Tree::CssImportNode.new(str, media.to_a))
|
341
324
|
end
|
342
|
-
|
343
|
-
node
|
325
|
+
|
326
|
+
node(Sass::Tree::ImportNode.new(path.strip))
|
344
327
|
end
|
345
328
|
|
346
329
|
def use_css_import?; false; end
|
347
330
|
|
348
331
|
def media_directive
|
349
|
-
block(node(Sass::Tree::MediaNode.new(
|
332
|
+
block(node(Sass::Tree::MediaNode.new(media_query_list.to_a)), :directive)
|
350
333
|
end
|
351
334
|
|
352
335
|
# http://www.w3.org/TR/css3-mediaqueries/#syntax
|
@@ -691,7 +674,7 @@ module Sass
|
|
691
674
|
expected('"{"') if res.length == 1 && res[0].is_a?(Selector::Universal)
|
692
675
|
throw_error {expected('"{"')}
|
693
676
|
rescue Sass::SyntaxError => e
|
694
|
-
e.message << "\n\n\"#{sel}\" may only be used at the beginning of a
|
677
|
+
e.message << "\n\n\"#{sel}\" may only be used at the beginning of a selector."
|
695
678
|
raise e
|
696
679
|
end
|
697
680
|
end
|
@@ -723,7 +706,7 @@ module Sass
|
|
723
706
|
end
|
724
707
|
|
725
708
|
def element_name
|
726
|
-
ns, name =
|
709
|
+
ns, name = qualified_name(:allow_star_name)
|
727
710
|
return unless ns || name
|
728
711
|
|
729
712
|
if name == '*'
|
@@ -814,7 +797,7 @@ module Sass
|
|
814
797
|
# could start a pseudo expression like "n+1", or it could start a
|
815
798
|
# selector like "n|m". In order to handle this, we must regrettably
|
816
799
|
# backtrack.
|
817
|
-
expr, sel = nil
|
800
|
+
expr, sel = nil
|
818
801
|
pseudo_err = catch_error do
|
819
802
|
expr = pseudo_expr
|
820
803
|
next if tok?(/[,)]/)
|
@@ -954,10 +937,10 @@ MESSAGE
|
|
954
937
|
end
|
955
938
|
|
956
939
|
def _interp_string(type)
|
957
|
-
return unless start = tok(Sass::Script::Lexer::STRING_REGULAR_EXPRESSIONS[type
|
940
|
+
return unless start = tok(Sass::Script::Lexer::STRING_REGULAR_EXPRESSIONS[[type, false]])
|
958
941
|
res = [start]
|
959
942
|
|
960
|
-
mid_re = Sass::Script::Lexer::STRING_REGULAR_EXPRESSIONS[type
|
943
|
+
mid_re = Sass::Script::Lexer::STRING_REGULAR_EXPRESSIONS[[type, true]]
|
961
944
|
# @scanner[2].empty? means we've started an interpolated section
|
962
945
|
while @scanner[2] == '#{'
|
963
946
|
@scanner.pos -= 2 # Don't consume the #{
|
@@ -998,7 +981,7 @@ MESSAGE
|
|
998
981
|
line = @line
|
999
982
|
@strs.push ""
|
1000
983
|
throw_error {yield} && @strs.last
|
1001
|
-
rescue Sass::SyntaxError
|
984
|
+
rescue Sass::SyntaxError => e
|
1002
985
|
@scanner.pos = pos
|
1003
986
|
@line = line
|
1004
987
|
nil
|
@@ -1038,7 +1021,6 @@ MESSAGE
|
|
1038
1021
|
|
1039
1022
|
EXPR_NAMES = {
|
1040
1023
|
:media_query => "media query (e.g. print, screen, print and screen)",
|
1041
|
-
:media_query_list => "media query (e.g. print, screen, print and screen)",
|
1042
1024
|
:media_expr => "media expression (e.g. (min-device-width: 800px))",
|
1043
1025
|
:pseudo_arg => "expression (e.g. fr, 2n+1)",
|
1044
1026
|
:interp_ident => "identifier",
|
@@ -1046,7 +1028,6 @@ MESSAGE
|
|
1046
1028
|
:qualified_name => "identifier",
|
1047
1029
|
:expr => "expression (e.g. 1px, bold)",
|
1048
1030
|
:_selector => "selector",
|
1049
|
-
:selector_comma_sequence => "selector",
|
1050
1031
|
:simple_selector_sequence => "selector",
|
1051
1032
|
:import_arg => "file to import (string or url())",
|
1052
1033
|
:moz_document_function => "matching function (e.g. url-prefix(), domain())",
|
@@ -1113,7 +1094,7 @@ MESSAGE
|
|
1113
1094
|
end
|
1114
1095
|
|
1115
1096
|
def rethrow(err)
|
1116
|
-
if @
|
1097
|
+
if @throw_err
|
1117
1098
|
throw :_sass_parser_error, err
|
1118
1099
|
else
|
1119
1100
|
@scanner = Sass::Util::MultibyteStringScanner.new(@scanner.string)
|