CodeMirror.defineMode("pascal",function(){functionwords(str){varobj={},words=str.split(" ");for(vari=0;i<words.length;++i)obj[words[i]]=true;returnobj;}varkeywords=words("and array begin case const div do downto else end file for forward integer "+"boolean char function goto if in label mod nil not of or packed procedure "+"program record repeat set string then to type until var while with");varatoms={"null":true};varisOperatorChar=/[+\-*&%=<>!?|\/]/;functiontokenBase(stream,state){varch=stream.next();if(ch=="#"&&state.startOfLine){stream.skipToEnd();return"meta";}if(ch=='"'||ch=="'"){state.tokenize=tokenString(ch);returnstate.tokenize(stream,state);}if(ch=="("&&stream.eat("*")){state.tokenize=tokenComment;returntokenComment(stream,state);}if(/[\[\]{}\(\),;\:\.]/.test(ch)){returnnull;}if(/\d/.test(ch)){stream.eatWhile(/[\w\.]/);return"number";}if(ch=="/"){if(stream.eat("/")){stream.skipToEnd();return"comment";}}if(isOperatorChar.test(ch)){stream.eatWhile(isOperatorChar);return"operator";}stream.eatWhile(/[\w\$_]/);varcur=stream.current();if(keywords.propertyIsEnumerable(cur))return"keyword";if(atoms.propertyIsEnumerable(cur))return"atom";return"variable";}functiontokenString(quote){returnfunction(stream,state){varescaped=false,next,end=false;while((next=stream.next())!=null){if(next==quote&&!escaped){end=true;break;}escaped=!escaped&&next=="\\";}if(end||!escaped)state.tokenize=null;return"string";};}functiontokenComment(stream,state){varmaybeEnd=false,ch;while(ch=stream.next()){if(ch==")"&&maybeEnd){state.tokenize=null;break;}maybeEnd=(ch=="*");}return"comment";}// Interfacereturn{startState:function(){return{tokenize:null};},token:function(stream,state){if(stream.eatSpace())returnnull;varstyle=(state.tokenize||tokenBase)(stream,state);if(style=="comment"||style=="meta")returnstyle;returnstyle;},electricChars:"{}"};});CodeMirror.defineMIME("text/x-pascal","pascal");