From db4430326a3d54f8b08cbc3de12ab061ca6a7279 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Sun, 3 Mar 2013 12:05:43 +0300 Subject: [PATCH] Show generator exceptions as errors on try web page --- assets/js/try.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/assets/js/try.js b/assets/js/try.js index 5977a851c..c0aab9d7c 100644 --- a/assets/js/try.js +++ b/assets/js/try.js @@ -44,8 +44,13 @@ function processGrammar () { } } - Jison.print = function () {}; - parser = Jison.Generator(cfg, {type: type}); + //Jison.print = function () {}; + try { + parser = Jison.Generator(cfg, {type: type}); + } catch(e) { + $("#gen_out").text("Oops. Error while parsing grammar.\n"+e).addClass('bad'); + throw(e); + } $("#out").removeClass("good").removeClass("bad").html(''); $("#gen_out").removeClass("good").removeClass("bad");