var e={};function t(t,n){for(var r=0;r<n.length;r++)e[n[r]]=t}var n=[`true`,`false`],r=[`if`,`then`,`do`,`else`,`elif`,`while`,`until`,`for`,`in`,`esac`,`fi`,`fin`,`fil`,`done`,`exit`,`set`,`unset`,`export`,`function`],i=`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(`.`);t(`atom`,n),t(`keyword`,r),t(`builtin`,i);function a(t,n){if(t.eatSpace())return null;var r=t.sol(),i=t.next();if(i===`\\`)return t.next(),null;if(i===`'`||i===`"`||i==="`")return n.tokens.unshift(o(i,i==="`"?`quote`:`string`)),u(t,n);if(i===`#`)return r&&t.eat(`!`)?(t.skipToEnd(),`meta`):(t.skipToEnd(),`comment`);if(i===`$`)return n.tokens.unshift(c),u(t,n);if(i===`+`||i===`=`)return`operator`;if(i===`-`)return t.eat(`-`),t.eatWhile(/\w/),`attribute`;if(i==`<`){if(t.match(`<<`))return`operator`;var a=t.match(/^<-?\s*(?:['"]([^'"]*)['"]|([^'"\s]*))/);if(a)return n.tokens.unshift(l(a[1]||a[2])),`string.special`}if(/\d/.test(i)&&(t.eatWhile(/\d/),t.eol()||!/\w/.test(t.peek())))return`number`;t.eatWhile(/[\w-]/);var s=t.current();return t.peek()===`=`&&/\w+/.test(s)?`def`:e.hasOwnProperty(s)?e[s]:null}function o(e,t){var n=e==`(`?`)`:e==`{`?`}`:e;return function(r,i){for(var a,l=!1;(a=r.next())!=null;){if(a===n&&!l){i.tokens.shift();break}else if(a===`$`&&!l&&e!==`'`&&r.peek()!=n){l=!0,r.backUp(1),i.tokens.unshift(c);break}else if(!l&&e!==n&&a===e)return i.tokens.unshift(o(e,t)),u(r,i);else if(!l&&/['"]/.test(a)&&!/['"]/.test(e)){i.tokens.unshift(s(a,`string`)),r.backUp(1);break}l=!l&&a===`\\`}return t}}function s(e,t){return function(n,r){return r.tokens[0]=o(e,t),n.next(),u(n,r)}}var c=function(e,t){t.tokens.length>1&&e.eat(`$`);var n=e.next();return/['"({]/.test(n)?(t.tokens[0]=o(n,n==`(`?`quote`:n==`{`?`def`:`string`),u(e,t)):(/\d/.test(n)||e.eatWhile(/\w/),t.tokens.shift(),`def`)};function l(e){return function(t,n){return t.sol()&&t.string==e&&n.tokens.shift(),t.skipToEnd(),`string.special`}}function u(e,t){return(t.tokens[0]||a)(e,t)}const d={name:`shell`,startState:function(){return{tokens:[]}},token:function(e,t){return u(e,t)},languageData:{autocomplete:n.concat(r,i),closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,"`"]},commentTokens:{line:`#`}}};export{d as shell};