diff options
author | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2013-08-23 16:21:43 -0700 |
---|---|---|
committer | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2013-08-23 16:21:43 -0700 |
commit | 930e7382d41f450f8aa4bb29649204683a07353a (patch) | |
tree | d33c4980bd21373868a812029d0092b47e7521f5 /scss/expression.parsley | |
parent | 444ac8f8b4e5d167050b3d0eb0869bce5335aa33 (diff) | |
download | pyscss-930e7382d41f450f8aa4bb29649204683a07353a.tar.gz |
Map literals in Parsley, and a few other minor fixes.parsley
- Labels for some of the rules.
- Faux goal_argspec rule to play nicely with parse_expression.
- Wrap ParseErrors in SassParseError.
- Ruby's interp-and-slash test now passes exactly.
- Don't render nulls in an interpolation.
Diffstat (limited to 'scss/expression.parsley')
-rw-r--r-- | scss/expression.parsley | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/scss/expression.parsley b/scss/expression.parsley index 77b41fa..8fc35bf 100644 --- a/scss/expression.parsley +++ b/scss/expression.parsley @@ -38,7 +38,7 @@ spaced_list = single_expression:head ( )*:tails -> ListLiteral([head] + tails, comma=False) if tails else head -single_expression = or_test +single_expression = or_test ^(single expression) or_test = and_test:head ( 'o' 'r' @@ -97,6 +97,9 @@ atom = ( # TODO kill this off | '[' comma_list:node ']' -> Parentheses(node) + # Map literal + | map + # URL literal | 'u' 'r' 'l' '(' inside_url:s ')' -> FunctionLiteral('url', s) @@ -135,6 +138,21 @@ atom = ( # Variable | variable:name -> Variable(name) ) + ^(single value) + + +### Map literals +map = '(' ows + ( map_pair:pair ows ',' ows -> pair )*:pairs + ( map_pair:pair ows !(pairs.append(pair)) )? + ')' + -> MapLiteral(pairs) + +map_pair = + single_expression:key + ows ':' ows + spaced_list:value + -> (key, value) ### Strings, literals, and interpolation @@ -174,6 +192,8 @@ string_part :end = <( ### Function definitions and arguments +goal_argspec = argspec + argspec = ( argspec_item:node ows ',' ows @@ -186,7 +206,7 @@ argspec = ( argspec_item = ows ( - ( variable:name ows ':' ows -> name )?:name + ( variable:name ows ':' ows -> Variable(name) )?:name spaced_list:value -> (name, value) ) |