On 04/24/2012 03:23 PM, Igor Stasenko wrote:
Here the the snippet to parse array literals.. based on existing parser..
i only had to add a #parseNode accessor to Parser to make it work:
| parser|
parser :=
(Parser new
init: '#(1 2 3 (ab bc de))' readStream notifying: nil failBlock: []
).
parser encoder initScopeAndLiteralTables.
parser primaryExpression.
parser parseNode key
Looks neat. Now, this of course still raises the question - shouldn't we
try to move further with our literal arrays?
As I mentioned, in Tirade I added support for Associations. So I can do:
{ 'name'->'Igor' }
...without adding full support for expressions. This was to "match"
JSON. It will still produce an Array of Associations, but then I can
easily change that to a Dictionary on the receiving end.
In Amber Nicolas has added this syntax for literal dictionaries:
#{ 'name' -> 'Igor'}
regards, Göran