(stream, state)
| 23 | 'touch vi vim wall wc wget who write yes zsh'); |
| 24 | |
| 25 | function tokenBase(stream, state) { |
| 26 | |
| 27 | var sol = stream.sol(); |
| 28 | var ch = stream.next(); |
| 29 | |
| 30 | if (ch === '\'' || ch === '"' || ch === '`') { |
| 31 | state.tokens.unshift(tokenString(ch)); |
| 32 | return tokenize(stream, state); |
| 33 | } |
| 34 | if (ch === '#') { |
| 35 | if (sol && stream.eat('!')) { |
| 36 | stream.skipToEnd(); |
| 37 | return 'meta'; // 'comment'? |
| 38 | } |
| 39 | stream.skipToEnd(); |
| 40 | return 'comment'; |
| 41 | } |
| 42 | if (ch === '$') { |
| 43 | state.tokens.unshift(tokenDollar); |
| 44 | return tokenize(stream, state); |
| 45 | } |
| 46 | if (ch === '+' || ch === '=') { |
| 47 | return 'operator'; |
| 48 | } |
| 49 | if (ch === '-') { |
| 50 | stream.eat('-'); |
| 51 | stream.eatWhile(/\w/); |
| 52 | return 'attribute'; |
| 53 | } |
| 54 | if (/\d/.test(ch)) { |
| 55 | stream.eatWhile(/\d/); |
| 56 | if(!/\w/.test(stream.peek())) { |
| 57 | return 'number'; |
| 58 | } |
| 59 | } |
| 60 | stream.eatWhile(/\w/); |
| 61 | var cur = stream.current(); |
| 62 | if (stream.peek() === '=' && /\w+/.test(cur)) return 'def'; |
| 63 | return words.hasOwnProperty(cur) ? words[cur] : null; |
| 64 | } |
| 65 | |
| 66 | function tokenString(quote) { |
| 67 | return function(stream, state) { |
nothing calls this directly
no test coverage detected