Thanks. Surrounding the expression with parenthesis made it work.

cheers

On Mar 5, 12:29 pm, Vyacheslav Egorov <[email protected]> wrote:
> JavaScript grammar has it's peculiarities. Program "{ value: {a:
> [1,2,3,4,5,6]} }" is parsed not as object literal but as block
> statement with labeled block statement inside;  where inner block
> statement contains labeled expression statement (so value and a are
> become labels, not property names).
>
> You have to enclose top level expression like that in parenthesis if
> you want to ensure that it is parsed as an expression.
>
> --
> Vyacheslav Egorov
>
>
>
>
>
>
>
> On Mon, Mar 5, 2012 at 1:02 PM, fdmanana <[email protected]> wrote:
> > Hi,
>
> > When trying to evaluate the following object expression in the shell,
> > I get a syntax error:
>
> > $ v8
> > V8 version 3.8.9 [sample shell]
> >> { value: {a: [1,2,3,4,5,6], b: 1} }
> > (shell):1: SyntaxError: Unexpected token :
> > { value: {a: [1,2,3,4,5,6], b: 1} }
> >                             ^
> > SyntaxError: Unexpected token :
>
> > The syntax seems correct to me.
> > Node.js's shell for e.g. doesn't complain about it:
>
> > $ node
> >> { value: {a: [1,2,3,4,5,6], b: 1} }
> > { value: { a: [ 1, 2, 3, 4, 5, 6 ], b: 1 } }
>
> > If I remove the second property of the inner object it works:
>
> > $ v8
> >> { value: {a: [1,2,3,4,5,6]} }
> > 1,2,3,4,5,6
>
> > Evaluating the code via v8::Script::Compile also produces the same
> > error.
>
> > I'm using V8 version 3.8.9 installed via HomeBrew on Mac OS X 10.7.3.
>
> > Thanks.
>
> > --
> > v8-users mailing list
> > [email protected]
> >http://groups.google.com/group/v8-users

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to