(function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)})(function(e){e.defineMode("shell",function(){function l(a,b){for(var c=0;c<b.length;c++)m[b[c]]=a}function t(a,b){if(a.eatSpace())return null;var c=a.sol(),d=a.next();if("\\"===d)return a.next(),null;if("'"===d||'"'===d||"`"===d)return b.tokens.unshift(k(d,"`"===d?"quote":"string")),g(a,b);if("#"===d){if(c&&a.eat("!"))return a.skipToEnd(),
"meta";a.skipToEnd();return"comment"}if("$"===d)return b.tokens.unshift(n),g(a,b);if("+"===d||"="===d)return"operator";if("-"===d)return a.eat("-"),a.eatWhile(/\w/),"attribute";if("<"==d&&(c=a.match(/^<-?\s+(.*)/)))return b.tokens.unshift(u(c[1])),"string-2";if(/\d/.test(d)&&(a.eatWhile(/\d/),a.eol()||!/\w/.test(a.peek())))return"number";a.eatWhile(/[\w-]/);b=a.current();return"="===a.peek()&&/\w+/.test(b)?"def":m.hasOwnProperty(b)?m[b]:null}function k(a,b){var c="("==a?")":"{"==a?"}":a;return function(d,
e){for(var f,h=!1;null!=(f=d.next());){if(f!==c||h)if("$"!==f||h||"'"===a||d.peek()==c){if(!h&&a!==c&&f===a)return e.tokens.unshift(k(a,b)),g(d,e);if(!h&&/['"]/.test(f)&&!/['"]/.test(a)){e.tokens.unshift(v(f,"string"));d.backUp(1);break}}else{d.backUp(1);e.tokens.unshift(n);break}else{e.tokens.shift();break}h=!h&&"\\"===f}return b}}function v(a,b){return function(c,d){d.tokens[0]=k(a,b);c.next();return g(c,d)}}function u(a){return function(b,c){b.sol()&&b.string==a&&c.tokens.shift();b.skipToEnd();
return"string-2"}}function g(a,b){return(b.tokens[0]||t)(a,b)}var m={},p=["true","false"],q="if then do else elif while until for in esac fi fin fil done exit set unset export function".split(" "),r="ab awk bash beep cat cc cd chown chmod chroot clear cp curl cut diff echo find gawk gcc get git grep hg kill killall ln ls make mkdir openssl mv nc nl node npm ping ps restart rm rmdir sed service sh shopt shred source sort sleep ssh start stop su sudo svn tee telnet top touch vi vim wall wc wget who write yes zsh".split(" ");
e.registerHelper("hintWords","shell",p.concat(q,r));l("atom",p);l("keyword",q);l("builtin",r);var n=function(a,b){1<b.tokens.length&&a.eat("$");var c=a.next();if(/['"({]/.test(c))return b.tokens[0]=k(c,"("==c?"quote":"{"==c?"def":"string"),g(a,b);/\d/.test(c)||a.eatWhile(/\w/);b.tokens.shift();return"def"};return{startState:function(){return{tokens:[]}},token:function(a,b){return g(a,b)},closeBrackets:"()[]{}''\"\"``",lineComment:"#",fold:"brace"}});e.defineMIME("text/x-sh","shell");e.defineMIME("application/x-sh",
"shell")});