MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / tokenString

Function tokenString

static/js/codemirror/mode/shell/shell.js:66–87  ·  view source on GitHub ↗
(quote)

Source from the content-addressed store, hash-verified

64 }
65
66 function tokenString(quote) {
67 return function(stream, state) {
68 var next, end = false, escaped = false;
69 while ((next = stream.next()) != null) {
70 if (next === quote && !escaped) {
71 end = true;
72 break;
73 }
74 if (next === '$' && !escaped && quote !== '\'') {
75 escaped = true;
76 stream.backUp(1);
77 state.tokens.unshift(tokenDollar);
78 break;
79 }
80 escaped = !escaped && next === '\\';
81 }
82 if (end || !escaped) {
83 state.tokens.shift();
84 }
85 return (quote === '`' || quote === ')' ? 'quote' : 'string');
86 };
87 };
88
89 var tokenDollar = function(stream, state) {
90 if (state.tokens.length > 1) stream.eat('$');

Callers 2

tokenBaseFunction · 0.70
tokenDollarFunction · 0.70

Calls 1

nextMethod · 0.45

Tested by

no test coverage detected