From b8e3fe7bc099d3ee09f1c5dfe05fab1fd73afed1 Mon Sep 17 00:00:00 2001 From: "john.j.camilleri" Date: Fri, 11 Jan 2013 15:33:17 +0000 Subject: 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. --- src/www/syntax-editor/ast.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/www/syntax-editor/ast.js') diff --git a/src/www/syntax-editor/ast.js b/src/www/syntax-editor/ast.js index 50c417e96..698272228 100644 --- a/src/www/syntax-editor/ast.js +++ b/src/www/syntax-editor/ast.js @@ -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; -- cgit v1.2.3