summaryrefslogtreecommitdiff
path: root/src/www/syntax-editor/editor.js
diff options
context:
space:
mode:
authorjohn.j.camilleri <john.j.camilleri@chalmers.se>2012-11-27 10:09:40 +0000
committerjohn.j.camilleri <john.j.camilleri@chalmers.se>2012-11-27 10:09:40 +0000
commitb3c1177f9ed5a3eaff378671fa119be1c605498e (patch)
tree6c32e5fc86fd45b91a934b8d0fc6da2cf236ab8a /src/www/syntax-editor/editor.js
parentdef375e58808ea431ef0d786ae0abb9de0a67155 (diff)
Syntax editor: improvements and fixes with grammar manager
Diffstat (limited to 'src/www/syntax-editor/editor.js')
-rw-r--r--src/www/syntax-editor/editor.js39
1 files changed, 9 insertions, 30 deletions
diff --git a/src/www/syntax-editor/editor.js b/src/www/syntax-editor/editor.js
index 031a461a2..41360c53f 100644
--- a/src/www/syntax-editor/editor.js
+++ b/src/www/syntax-editor/editor.js
@@ -1,20 +1,4 @@
/* --- Main Editor object --------------------------------------------------- */
-/* When creating the object, stuff gets called in this order:
-new EditorMenu
- server.get_grammarlists
- EditorMenu.show_grammarlist
- EditorMenu.change_grammar
- server.switch_to_other_grammar
- server.get_grammar_info
- EditorMenu.update_startcat_menu
- EditorMenu.update_language_menu
- Editor.change_grammar
- Editor.get_grammar_constructors
- Editor.start_fresh
- Editor.update_current_node();
- Editor.redraw_tree();
- Editor.get_refinements();
-*/
function Editor(gm,opts) {
var t = this;
/* --- Configuration ---------------------------------------------------- */
@@ -64,11 +48,6 @@ function Editor(gm,opts) {
/* --- Register Grammar Manager hooks ----------------------------------- */
this.gm.register_action("change_grammar",function(grammar){
debug("Editor: change grammar");
- var startcat0 = t.options.initial.startcat;
- if (elem(startcat0, grammar.categories))
- t.startcat = startcat0;
- else
- t.startcat = null;
t.get_grammar_constructors(bind(t.start_fresh,t));
});
this.gm.register_action("change_startcat",function(startcat){
@@ -124,19 +103,19 @@ Editor.prototype.get_startcat=function() {
}
// TODO
-Editor.prototype.initialize_from=function(opts) {
- var t=this;
- if (opts.startcat)
- t.options.initial_startcat=opts.startcat;
- t.change_grammar();
- if (opts.abstr)
- t.import_ast(opts.abstr);
-}
+// Editor.prototype.initialize_from=function(opts) {
+// var t=this;
+// if (opts.startcat)
+// t.options.initial_startcat=opts.startcat;
+// t.change_grammar();
+// if (opts.abstr)
+// t.import_ast(opts.abstr);
+// }
// Called after changing grammar or startcat
Editor.prototype.start_fresh=function () {
var t = this;
- t.ast = new AST(null, t.get_startcat());
+ t.ast = new AST(null, t.get_startcat());
if (t.options.initial.abstr) {
t.import_ast(t.options.initial.abstr);
}