From 912988e1741467f892170d57898991086b8096e9 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Fri, 21 Sep 2012 14:27:19 -0400 Subject: [PATCH] Fix parsing of whitespace in calls. This brings over cloudmade/less.js@333d1def4 to permit whitespace in front of arguments of function calls, and tweaks the related test to make sure it stays that way. This fixes #154 --- lib/carto/parser.js | 6 ++++-- test/rendering/transforms.mss | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/carto/parser.js b/lib/carto/parser.js index 1171a9a..ed1566f 100644 --- a/lib/carto/parser.js +++ b/lib/carto/parser.js @@ -461,16 +461,18 @@ carto.Parser = function Parser(env) { call: function() { var name, args; - if (! (name = /^([\w\-]+|%)\(/.exec(chunks[j]))) return; + if (!(name = /^([\w\-]+|%)\(/.exec(chunks[j]))) return; name = name[1]; if (name === 'url') { return null; } else { - i += name.length + 1; + i += name.length; } + $('('); // Parse the '(' and consume whitespace. + args = $(this.entities.arguments); if (!$(')')) return; diff --git a/test/rendering/transforms.mss b/test/rendering/transforms.mss index 628b984..297b652 100644 --- a/test/rendering/transforms.mss +++ b/test/rendering/transforms.mss @@ -1,5 +1,5 @@ @trans: 2; #world { point-file: url(foo.png); - point-transform: translate(@trans * 2, @trans); + point-transform: translate( @trans * 2, @trans); }