// Generated by CoffeeScript 1.10.0 (function() { window.Editor = Backbone.D3View.extend({ namespace: null, tagName: 'div', events: { input: 'compile' }, initialize: function(conf) { this.d3el.classed('editor', true); this.textarea = this.d3el.append('textarea'); this.status_bar = this.d3el.append('div').attr({ "class": 'status_bar' }); this.parser = PEG.buildParser(conf.grammar); this.textarea.node().value = 'Apples Oranges Coconuts\n5 5 1\n2 4 1'; return this.compile(); }, compile: function() { var e, error, rows; this.status_bar.text('All ok.'); this.status_bar.classed('error', false); try { rows = this.parser.parse(this.textarea.node().value); return this.model.set('rows', rows); } catch (error) { e = error; this.status_bar.text("Line " + e.location.start.line + ": " + e.message); return this.status_bar.classed('error', true); } } }); }).call(this);