Extend JavaScript Grammar

I'm working with a Rhino installation that supports the optional types from ES4 and would like to add this to the existing JavaScript grammar simply to avoid syntax errors when loading the JS files. Is there a way to extend the JavaScript grammar without having to rewrite the entire thing?

It would basically look like this:

var myVariable : String = "hello";

var myFunction = function(myVar : String) : Array {

}

for each (var item : someType in iterator) {

}

Any thoughts? It would be great if I could just JavaScript language settings.

Screen Shot 2015-05-18 at 10.26.19 AM.png

Please sign in to leave a comment.