// Generated by CoffeeScript 1.10.0 (function() { var jison_parser, language; language = '%lex\n%%\n\n\\n___\\n return \'___\'\n"<" return \'<\'\n">" return \'>\'\n"(" return \'(\'\n")" return \')\'\n"[" return \'[\'\n"]" return \']\'\n[_] return \'UNDERSCORE\'\n(" "|\\t)+ return \'SPACES\'\n";" return \';\'\n[0-9] return \'DIGIT\'\n[a-zA-Z] return \'ALPHABETIC_ASCII\'\n. return \'OTHER_CHAR\'\n\\n return \'NEWLINE\'\n<> return \'EOF\'\n\n/lex\n\n%start Document\n%%\n\nDocument\n : EOF\n | Code EOF\n | Code \'___\' Directives EOF\n ;\n\nCode\n : TChars\n | Span\n | %empty\n | Code Code\n ;\n\nTChar\n : OTHER_CHAR\n | \'(\'\n | \')\'\n | \'[\'\n | \']\'\n | \';\'\n | UNDERSCORE\n | DIGIT\n | ALPHABETIC_ASCII\n | SPACES\n | NEWLINE\n ;\n\nTChars\n : TChar\n { parser.on_text($1); }\n | TChars TChar\n { $$ = $1+$2; parser.on_text($2);}\n ;\n\nSpan\n : \'<\' TChars \'>\' \'(\' Id \')\'\n { parser.on_annotation($2, $5); }\n ;\n\nTextWithoutNewlineNorSpaceChar\n : NotNewlineNorSpaceChar\n | TextWithoutNewlineNorSpaceChar NotNewlineNorSpaceChar\n { $$ = $1+$2; }\n ;\n \nTextWithoutNewline\n : NotNewlineChar\n | TextWithoutNewline NotNewlineChar\n { $$ = $1+$2; }\n ;\n\nNotNewlineNorSpaceChar\n : OTHER_CHAR\n | \'<\'\n | \'>\'\n | \'(\'\n | \')\'\n | \'[\'\n | \']\'\n | \';\'\n | UNDERSCORE\n | DIGIT\n | ALPHABETIC_ASCII\n ;\n\nNotNewlineChar\n : NotNewlineNorSpaceChar\n | SPACES\n ;\n\nSpacesOrNothing\n : SPACES\n | %empty\n ;\n\nSpacesNewlinesOrNothing\n : SPACES\n | %empty\n | SpacesNewlinesOrNothing NEWLINE SpacesNewlinesOrNothing\n ;\n\nId\n : IdChar\n | Id IdChar\n { $$ = $1+$2; }\n ;\n\nIdChar\n : UNDERSCORE\n | DIGIT\n | ALPHABETIC_ASCII\n ;\n\nDirectives\n : Directive\n | Directive NEWLINE Directives\n ;\n\nDirective\n : SpacesOrNothing \'(\' Id \')\' SpacesOrNothing POSequence SpacesOrNothing\n { parser.on_directive($6, $3); }\n | SpacesOrNothing \'[\' Id \']\' SpacesOrNothing POSequence SpacesOrNothing\n { parser.on_directive($6, $3); }\n | SpacesOrNothing\n ;\n\n/* RDF */\nPOSequence\n : POPair\n { $$ = [$1]; }\n | POSequence SpacesOrNothing \';\' SpacesOrNothing POPair\n { $$ = $1.concat([$5]); }\n ;\n\nPOPair\n : Predicate SPACES Object\n { $$ = {predicate: $1, object: $3}; }\n ;\n\nPOChar\n : OTHER_CHAR\n | \'<\'\n | \'>\'\n | \'(\'\n | \')\'\n | \'[\'\n | \']\'\n | UNDERSCORE\n | DIGIT\n | ALPHABETIC_ASCII\n ;\n\nPOChars\n : POChar\n | POChar POChars\n { $$ = $1+$2; }\n ;\n\nPredicate\n : POChars\n ;\n\nObject\n : POChars\n ;\n'; Jison.print = function() {}; jison_parser = Jison.Generator(bnf.parse(language), { type: 'lalr' }).createParser(); jison_parser.yy.parseError = function(message, details) { return on_code_error(message, details); }; window.parser = { offset: 0, plain_text: '', annotations: [], directives: {}, parse: function(code) { this.offset = 0; this.annotations = []; this.directives = []; this.plain_text = ''; jison_parser.parse(code); return this.annotations.forEach((function(_this) { return function(a) { a.directives = []; return _this.directives.forEach(function(d) { if (a.id === d.id) { return a.directives.push(d); } }); }; })(this)); }, on_text: function(content) { this.offset += content.length; return this.plain_text += content; }, on_annotation: function(content, id) { return this.annotations.push({ id: id, start: this.offset - content.length, end: this.offset, content: content }); }, on_directive: function(popairs, id) { return this.directives.push({ id: id, popairs: popairs }); } }; }).call(this);