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 12:00:41 +0000
committerjohn.j.camilleri <john.j.camilleri@chalmers.se>2012-11-27 12:00:41 +0000
commit59b9676fd1b85500b7a66e957542af6dea66c53e (patch)
tree41da285a1881809a1bef9a725cec9c9a0777dd20 /src/www/syntax-editor/editor.js
parente9e29aab678f0ff6b4939c938ea91f82df2fa435 (diff)
Syntax editor; add new helper for parsing type signatures (not complete)
Diffstat (limited to 'src/www/syntax-editor/editor.js')
-rw-r--r--src/www/syntax-editor/editor.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/www/syntax-editor/editor.js b/src/www/syntax-editor/editor.js
index 8cf31921b..b2936e898 100644
--- a/src/www/syntax-editor/editor.js
+++ b/src/www/syntax-editor/editor.js
@@ -198,14 +198,12 @@ Editor.prototype.select_refinement=function(fun) {
// Parse out function arguments
var def = t.grammar_constructors.funs[fun].def;
- def = def.substr(def.lastIndexOf(":")+1);
- var fun_args = map(function(s){return s.trim()}, def.split("->"))
- fun_args = fun_args.slice(0,-1);
+ var typeobj = AST.parse_type_signature(def);
- if (fun_args.length > 0) {
+ if (typeobj.args.length > 0) {
// Add placeholders
- for (ci in fun_args) {
- t.ast.add(null, fun_args[ci]);
+ for (var i in typeobj.args) {
+ t.ast.add(null, typeobj.args[i]);
}
}