I've reworked arrays and objects completely. I now use a Array translator that is scanned before the code is converted. So x=[]; gets rewritten to x=A() before it is converted further. I also removed the previous crappy loop code and created a separate for..in checker which allows the following code to work:-

o={a:1,b:2};
for(i in o)alert(i+'='+o)

Phew. Hopefully the translator should detect all arrays and closing ] correctly.

Yeah I dropped that method, the problem was assignments to a function call created errors. This time I parse them first so I can use leftContext to identify the previous character, I then track each open/close and assign them a counter. This makes nested arrays much easier to match.

I use $A$ as a special array constructor, it can't be a constant "A" as the main code rewrite hasn't been performed yet. I could use a higher ascii character that wouldn't affect use defined code. Any other suggestions?

@Gareth
I see. Well, you could always choose an identifier consisting of random characters, to lower the chance of collisions. Create it dynamically like this, for example — '$' + (Math.random() + '').slice(2)

Opera is nuts it supports const x=1 but allows you to modify it! WTF.
Anyway I think most of the language is supported not except toString/valueOf on literals which I was close to supporting but <=IE7 doesn't support setters or constants so there was no 100% way of making it safe :(

I still need to optimize the code a lot and sort the comment parser and make a line by line extracting for speed. But hey I'm doing this in my spare time :) Also next up is a sandbox framework which will be similar to JQuery but in a sandboxed environment. As usual any comments or bug reports are always very welcome and the first one to break it I will get a custom Hackvertor t-shirt