summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerman M. Bravo <german.mb@deipi.com>2013-08-16 13:52:56 -0500
committerGerman M. Bravo <german.mb@deipi.com>2013-08-16 13:52:56 -0500
commit0f0593c35430fc7273718809c9f9b00296d1e02f (patch)
treeb09d223a259a01396e4371e013e6a7afb2421304
parent2dad69c177acfdccd629ee4be57ceda0822a1d91 (diff)
downloadpyscss-0f0593c35430fc7273718809c9f9b00296d1e02f.tar.gz
Remove trailing Undefined arguments
-rw-r--r--scss/expression.py6
-rw-r--r--scss/src/grammar/grammar.g2
2 files changed, 5 insertions, 3 deletions
diff --git a/scss/expression.py b/scss/expression.py
index 745ef2e..9194363 100644
--- a/scss/expression.py
+++ b/scss/expression.py
@@ -358,7 +358,9 @@ class ArgspecLiteral(Expression):
# argpairs is a list of 2-tuples, parsed as though this were a function
# call, so (variable name as string or None, default value as AST
# node).
- self.argpairs = argpairs
+ while argpairs and argpairs[-1] == (None, None):
+ argpairs = argpairs[:-1]
+ self.argpairs = tuple((var, Literal(Undefined()) if value is None else value) for var, value in argpairs)
def iter_def_argspec(self):
"""Interpreting this literal as a function definition, yields pairs of
@@ -499,7 +501,7 @@ class SassExpression(Parser):
v = [argspec_item]
while self._peek(self.argspec_rsts) == '","':
self._scan('","')
- argspec_item = (None, Literal(Undefined()))
+ argspec_item = (None, None)
if self._peek(self.argspec_rsts_) not in self.argspec_rsts:
argspec_item = self.argspec_item()
v.append(argspec_item)
diff --git a/scss/src/grammar/grammar.g b/scss/src/grammar/grammar.g
index d2dbe6f..a65c6a5 100644
--- a/scss/src/grammar/grammar.g
+++ b/scss/src/grammar/grammar.g
@@ -40,7 +40,7 @@ parser SassExpression:
rule argspec: argspec_item {{ v = [argspec_item] }}
(
- "," {{ argspec_item = (None, Literal(Undefined())) }}
+ "," {{ argspec_item = (None, None) }}
[ argspec_item ] {{ v.append(argspec_item) }}
)* {{ return ArgspecLiteral(v) }}