summaryrefslogtreecommitdiff
path: root/yapps2.py
diff options
context:
space:
mode:
authorEevee (Alex Munroe) <eevee.git@veekun.com>2014-09-04 14:35:03 -0700
committerEevee (Alex Munroe) <eevee.git@veekun.com>2014-09-04 14:35:03 -0700
commite2a5d7c95d7f9dcbb3c79bb1d6eed43bded8d667 (patch)
treebe4dd9ebb468f2af7cbeb8c6523cd804517e2ae4 /yapps2.py
parent493a349952b18332da31cb7828e4d78124b7f236 (diff)
downloadpyscss-e2a5d7c95d7f9dcbb3c79bb1d6eed43bded8d667.tar.gz
Lots of fixes to gritty details of how Sass treats url().
Basically: if it looks like it's a single bare URL, only interpolations are allowed. Otherwise, it's expected to be a whole expression. Handling of interpolation in barewords is much improved. Also fixed the wrapping of SassSyntaxError.
Diffstat (limited to 'yapps2.py')
-rwxr-xr-xyapps2.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/yapps2.py b/yapps2.py
index e94a7b2..a732c35 100755
--- a/yapps2.py
+++ b/yapps2.py
@@ -747,7 +747,9 @@ class Scanner(object):
msg = "Bad Token"
if restrict:
msg = "Trying to find one of " + ", ".join(restrict)
- raise SyntaxError("SyntaxError[@ char %s: %s]" % (repr(self.pos), msg))
+ err = SyntaxError("SyntaxError[@ char %s: %s]" % (repr(self.pos), msg))
+ err.pos = self.pos
+ raise err
# If we found something that isn't to be ignored, return it
if best_pat in self.ignore:
@@ -875,7 +877,9 @@ class Parser(object):
"""
tok = self._scanner.token(self._pos, set([type]))
if tok[2] != type:
- raise SyntaxError("SyntaxError[@ char %s: %s]" % (repr(tok[0]), "Trying to find " + type))
+ err = SyntaxError("SyntaxError[@ char %s: %s]" % (repr(tok[0]), "Trying to find " + type))
+ err.pos = tok[0]
+ raise err
self._pos += 1
return tok[3]