From 95bfb0b45c55aae5a9d6630a12fd3ba9be406ce8 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Thu, 24 Dec 2009 17:14:53 -0800 Subject: [PATCH] allowing quoted strings within object assignment, a in JS and JSON --- lib/coffee_script/grammar.y | 1 + test/fixtures/execution/test_everything.cs | 2 +- test/fixtures/execution/test_everything.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/coffee_script/grammar.y b/lib/coffee_script/grammar.y index 857847e5..c2459287 100644 --- a/lib/coffee_script/grammar.y +++ b/lib/coffee_script/grammar.y @@ -121,6 +121,7 @@ rule # Assignment within an object literal. AssignObj: IDENTIFIER ":" Expression { result = AssignNode.new(val[0], val[2], :object) } + | STRING ":" Expression { result = AssignNode.new(val[0], val[2], :object) } | Comment { result = val[0] } ; diff --git a/test/fixtures/execution/test_everything.cs b/test/fixtures/execution/test_everything.cs index 62a43a85..aed47da8 100644 --- a/test/fixtures/execution/test_everything.cs +++ b/test/fixtures/execution/test_everything.cs @@ -6,7 +6,7 @@ func: => a--. c: { - text: b + "text": b } c: 'error' unless 42 > 41 diff --git a/test/fixtures/execution/test_everything.js b/test/fixtures/execution/test_everything.js index 59cee64e..72a9a585 100644 --- a/test/fixtures/execution/test_everything.js +++ b/test/fixtures/execution/test_everything.js @@ -7,7 +7,7 @@ a--; } var c = { - text: b + "text": b }; if (!(42 > 41)) { c = 'error';