!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(h){"use strict";h.defineMode("ebnf",function(e){var i=0,o=1,s=0,m=1,f=2,u=null;return e.bracesMode&&(u=h.getMode(e,e.bracesMode)),{startState:function(){return{stringType:null,commentType:null,braced:0,lhs:!0,localState:null,stack:[],inDefinition:!1}},token:function(e,t){if(e){switch(0===t.stack.length&&('"'==e.peek()||"'"==e.peek()?(t.stringType=e.peek(),e.next(),t.stack.unshift(m)):e.match(/^\/\*/)?(t.stack.unshift(s),t.commentType=i):e.match(/^\(\*/)&&(t.stack.unshift(s),t.commentType=o)),t.stack[0]){case m:for(;t.stack[0]===m&&!e.eol();)e.peek()===t.stringType?(e.next(),t.stack.shift()):"\\"===e.peek()?(e.next(),e.next()):e.match(/^.[^\\\"\']*/);return t.lhs?"property string":"string";case s:for(;t.stack[0]===s&&!e.eol();)t.commentType===i&&e.match(/\*\//)?(t.stack.shift(),t.commentType=null):t.commentType===o&&e.match(/\*\)/)?(t.stack.shift(),t.commentType=null):e.match(/^.[^\*]*/);return"comment";case f:for(;t.stack[0]===f&&!e.eol();)e.match(/^[^\]\\]+/)||e.match(/^\\./)||t.stack.shift();return"operator"}var a=e.peek();if(null!==u&&(t.braced||"{"===a)){null===t.localState&&(t.localState=h.startState(u));var r=u.token(e,t.localState),c=e.current();if(!r)for(var n=0;n<c.length;n++)"{"===c[n]?(0===t.braced&&(r="matchingbracket"),t.braced++):"}"===c[n]&&(t.braced--,0===t.braced&&(r="matchingbracket"));return r}switch(a){case"[":return e.next(),t.stack.unshift(f),"bracket";case":":case"|":case";":return e.next(),"operator";case"%":if(e.match("%%"))return"header";if(e.match(/[%][A-Za-z]+/))return"keyword";if(e.match(/[%][}]/))return"matchingbracket";break;case"/":if(e.match(/[\/][A-Za-z]+/))return"keyword";case"\\":if(e.match(/[\][a-z]+/))return"string-2";case".":if(e.match("."))return"atom";case"*":case"-":case"+":case"^":if(e.match(a))return"atom";case"$":if(e.match("$$"))return"builtin";if(e.match(/[$][0-9]+/))return"variable-3";case"<":if(e.match(/<<[a-zA-Z_]+>>/))return"builtin"}return e.match(/^\/\//)?(e.skipToEnd(),"comment"):e.match(/return/)?"operator":e.match(/^[a-zA-Z_][a-zA-Z0-9_]*/)?e.match(/(?=[\(.])/)?"variable":e.match(/(?=[\s\n]*[:=])/)?"def":"variable-2":-1!=["[","]","(",")"].indexOf(e.peek())?(e.next(),"bracket"):(e.eatSpace()||e.next(),null)}}}}),h.defineMIME("text/x-ebnf","ebnf")});