Well, Espruino itself is quite smart about getting functions in via the console. It counts brackets and only executes if all open brackets have been closed.
The WebIDE actually does some relatively simple stuff:
It checks for require statements and pulls in any external libraries
If you've written any code with slightly odd formatting - eg. where there is a newline in the middle of a statement where there are no open brackets - it changes the newline into a special 'alt-enter' character.
It surrounds everything with echo(0);\n and \necho(1);\n and sends it over
There's maybe some other stuff, but those are the basics.
I'd started work on a simple command-line tool to use EspruinoTools to this with node.js (see http://www.github.com/espruino/espruino-tools). That might be a good way of automating everything? It still needs a bit of work to get command-line arguments parsed, but the basics of communication should be there.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Well, Espruino itself is quite smart about getting functions in via the console. It counts brackets and only executes if all open brackets have been closed.
The WebIDE actually does some relatively simple stuff:
require
statements and pulls in any external librariesecho(0);\n
and\necho(1);\n
and sends it overThere's maybe some other stuff, but those are the basics.
I'd started work on a simple command-line tool to use EspruinoTools to this with node.js (see http://www.github.com/espruino/espruino-tools). That might be a good way of automating everything? It still needs a bit of work to get command-line arguments parsed, but the basics of communication should be there.
There's also https://www.npmjs.org/package/espruino-cli which exists right now, but that doesn't use the Web IDE's code, so it could be a bit out of date now.