summaryrefslogtreecommitdiff
path: root/scss/expression.py
diff options
context:
space:
mode:
authorEevee <eevee.git@veekun.com>2013-07-10 12:50:57 -0700
committerEevee <eevee.git@veekun.com>2013-07-10 12:50:57 -0700
commita25b27a1ceb5d6a5429c3fa9e09b34e8442f2951 (patch)
treea7f588c1a9ace7611f3a0250238c449fec319dce /scss/expression.py
parentdd66433e438292ef67fec00d41abe58f5560e6b1 (diff)
downloadpyscss-a25b27a1ceb5d6a5429c3fa9e09b34e8442f2951.tar.gz
Rewrite the String type.
Unifies quoted and unquoted strings. Single quotes are now preserved. Also moves the result of `type-of` into the type system, hurrah.
Diffstat (limited to 'scss/expression.py')
-rw-r--r--scss/expression.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/scss/expression.py b/scss/expression.py
index 762a235..2a06f27 100644
--- a/scss/expression.py
+++ b/scss/expression.py
@@ -7,7 +7,7 @@ import re
import scss.config as config
from scss.cssdefs import is_builtin_css_function, _colors, _expr_glob_re, _interpolate_re, _units, _variable_re
-from scss.types import BooleanValue, ColorValue, ListValue, NullValue, NumberValue, ParserValue, QuotedStringValue, StringValue
+from scss.types import BooleanValue, ColorValue, ListValue, NullValue, NumberValue, ParserValue, String
from scss.util import dequote, normalize_var, to_str
################################################################################
@@ -253,7 +253,9 @@ class CallOp(Expression):
else:
rendered_args.append("%s: %s" % (var, rendered_value))
- return StringValue("%s(%s)" % (self.func_name, ", ".join(rendered_args)))
+ return String(
+ u"%s(%s)" % (self.func_name, u", ".join(rendered_args)),
+ quotes=None)
else:
return func(*args, **kwargs)
@@ -310,7 +312,7 @@ def parse_bareword(word):
elif word == 'false':
return BooleanValue(False)
else:
- return StringValue(ParserValue(word))
+ return String(word, quotes=None)
@@ -531,10 +533,10 @@ class SassExpression(Parser):
return Literal(NumberValue(float(NUM)))
elif _token_ == 'STR':
STR = self._scan('STR')
- return Literal(StringValue(ParserValue(STR)))
+ return Literal(String(STR[1:-1], quotes="'"))
elif _token_ == 'QSTR':
QSTR = self._scan('QSTR')
- return Literal(QuotedStringValue(ParserValue(QSTR)))
+ return Literal(String(QSTR[1:-1], quotes='"'))
elif _token_ == 'COLOR':
COLOR = self._scan('COLOR')
return Literal(ColorValue(ParserValue(COLOR)))