MCPcopy Create free account
hub / github.com/nwutils/nw-sample-apps / tokenString

Function tokenString

mini-code-edit/cm/mode/shell/shell.js:51–72  ·  view source on GitHub ↗
(quote)

Source from the content-addressed store, hash-verified

49 }
50
51 function tokenString(quote) {
52 return function(stream, state) {
53 var next, end = false, escaped = false;
54 while ((next = stream.next()) != null) {
55 if (next === quote && !escaped) {
56 end = true;
57 break;
58 }
59 if (next === '$' && !escaped && quote !== '\'') {
60 escaped = true;
61 stream.backUp(1);
62 state.tokens.unshift(tokenDollar);
63 break;
64 }
65 escaped = !escaped && next === '\\';
66 }
67 if (end || !escaped) {
68 state.tokens.shift();
69 }
70 return (quote === '`' || quote === ')' ? 'quote' : 'string');
71 };
72 };
73
74 var tokenDollar = function(stream, state) {
75 if (state.tokens.length > 1) stream.eat('$');

Callers 2

tokenBaseFunction · 0.70
tokenDollarFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected