kevoree-kevscript
Convert a KevScript file to a Kevoree model (ContainerRoot)
node kevs2model.js -k examples/test-parser.kevs# will output `model.json` in current directory
Kevscript API
Want to parse Kevscript programatically ?
Then, you can do something like this:
var Kevscript = ; var myKevscript = 'include npm:kevoree-node-javascript\nadd node0 : JavascriptNode' kevs = ; kevs ;
You can also give a context model and/or context variables
Context Model
var KevScript = ;var kevs = ;var script = 'add node : JavascriptNode';kevs ;
Context Variables
You can use the naming convention %NAME%
to dinamycally set variable content.
If you use 2 %
symbols, then the interpreter will randomly generate a value for those variables (eg. %%RANDOM_NAME%%
)
var KevScript = ;var kevs = ;var script = 'add %node% : JavascriptNode\n' + 'add %%grp%%: WSGroup\n' + 'attach %node% %%grp%%';var ctxVars = node: 'myNode';kevs ;
Tests
To be sure that the parser works correctly, run:
npm test
This will try to parse the KevScript file from examples/test-parser.kevs
showing the resulting AST on stdo
Browserify
If you want to generate kevoree-kevscript.js
for the browser, just run:
npm installgrunt
This will create a new folder named browser/
in the project root containing a raw browserified version of
kevoree-kevscript
Once loaded in your browser, you can access the KevoreeKevscript
class from the global scope.