[Interest] reading javascript body from c++

Jan Krause jan.krause.no19 at gmail.com
Mon Dec 10 18:47:36 CET 2012


Am 10.12.2012 16:55, schrieb Thiago Macieira:
> On segunda-feira, 10 de dezembro de 2012 13.44.23, Andy Mayer wrote:
>> But for my DSL (declaration of a special petri net) I need the body of
>> the javascript functions. The workaround looks quite interesting...
> This of it this way: you can't get the source code as written by the user, but
> you can (I think -- to be verified) get a handle to the compiled function, so
> you can execute it.
>
> Will this suffice?
No unfortunately not. I have to parse the body of to javascript-function 
in order to build something else (a special csp in this case). But ok, 
it was just a try...


>
> If you need a free-form text that isn't parsed by the engine, you'll need to
> write it as a string.
yes, that should work. If the qml-editor would have the same 
functionality for strings like the c++-editor (or is it the compiler?), 
that someone can do this:

var action = "this.y=this.x+2;"
                     "this.y=this.y-10;"
<=> var action= "this.y=this.x+2;this.y=this.y-10;"

Probably that would be sufficient, but this is not possible yet.

But, anyway, thanks again and regards
Andy



More information about the Interest mailing list