Syntax editor: initial support for string literals

Also a bug fix when switching to editor, although this still messes up
when using the letters grammar.
Also updated readme with options, and some style improvements.
This commit is contained in:
john.j.camilleri
2013-01-11 15:33:17 +00:00
parent 5dfca98088
commit 776539803d
7 changed files with 161 additions and 107 deletions

View File

@@ -73,6 +73,7 @@ function AST(fun, cat) {
return new ASTNode({
"fun": fun,
"cat": cat,
"string": "", // for String literals
"deps": {}, // dependent types
"children": []
});
@@ -304,7 +305,10 @@ function AST(fun, cat) {
this.toString = function() {
var s = "";
function visit(node) {
s += node.fun ? node.fun : "?" ;
if (node.cat == "String")
s += '"' + ((node.string) ? node.string : "") + '"';
else
s += node.fun ? node.fun : "?" ;
if (!node.hasChildren())
// if (node.children.length == 0)
return;