(stream, state)
| 5 | commands = ['ab','awk','bash','beep','cat','cc','cd','chown','chmod','chroot','clear','cp','curl','cut','diff','echo','find','gawk','gcc','get','git','grep','kill','killall','ls','make','mkdir','openssl','mv','nc','node','npm','ping','ps','restart','rm','rmdir','sed','service','sh','shopt','shred','source','sort','sleep','ssh','start','stop','su','sudo','tee','telnet','top','touch','vi','vim','wall','wc','wget','who','write','yes','zsh']; |
| 6 | |
| 7 | function tokenBase(stream, state) { |
| 8 | |
| 9 | var sol = stream.sol(); |
| 10 | var ch = stream.next(); |
| 11 | |
| 12 | if (ch === '\'' || ch === '"' || ch === '`') { |
| 13 | state.tokens.unshift(tokenString(ch)); |
| 14 | return tokenize(stream, state); |
| 15 | } |
| 16 | if (ch === '#') { |
| 17 | if (sol && stream.eat('!')) { |
| 18 | stream.skipToEnd(); |
| 19 | return 'meta'; // 'comment'? |
| 20 | } |
| 21 | stream.skipToEnd(); |
| 22 | return 'comment'; |
| 23 | } |
| 24 | if (ch === '$') { |
| 25 | state.tokens.unshift(tokenDollar); |
| 26 | return tokenize(stream, state); |
| 27 | } |
| 28 | if (ch === '+' || ch === '=') { |
| 29 | return 'operator'; |
| 30 | } |
| 31 | if (ch === '-') { |
| 32 | stream.eat('-'); |
| 33 | stream.eatWhile(/\w/); |
| 34 | return 'attribute'; |
| 35 | } |
| 36 | if (/\d/.test(ch)) { |
| 37 | stream.eatWhile(/\d/); |
| 38 | if(!/\w/.test(stream.peek())) { |
| 39 | return 'number'; |
| 40 | } |
| 41 | } |
| 42 | stream.eatWhile(/\w/); |
| 43 | var cur = stream.current(); |
| 44 | if (stream.peek() === '=' && /\w+/.test(cur)) return 'def'; |
| 45 | if (atoms.indexOf(cur) !== -1) return 'atom'; |
| 46 | if (commands.indexOf(cur) !== -1) return 'builtin'; |
| 47 | if (keywords.indexOf(cur) !== -1) return 'keyword'; |
| 48 | return 'word'; |
| 49 | } |
| 50 | |
| 51 | function tokenString(quote) { |
| 52 | return function(stream, state) { |
nothing calls this directly
no test coverage detected