MCPcopy Create free account
hub / github.com/feiyu563/PrometheusAlert / tokenString

Function tokenString

static/plugins/codemirror/mode/shell/shell.js:93–118  ·  view source on GitHub ↗
(quote, style)

Source from the content-addressed store, hash-verified

91 }
92
93 function tokenString(quote, style) {
94 var close = quote == "(" ? ")" : quote == "{" ? "}" : quote
95 return function(stream, state) {
96 var next, escaped = false;
97 while ((next = stream.next()) != null) {
98 if (next === close && !escaped) {
99 state.tokens.shift();
100 break;
101 } else if (next === '$' && !escaped && quote !== "'" && stream.peek() != close) {
102 escaped = true;
103 stream.backUp(1);
104 state.tokens.unshift(tokenDollar);
105 break;
106 } else if (!escaped && quote !== close && next === quote) {
107 state.tokens.unshift(tokenString(quote, style))
108 return tokenize(stream, state)
109 } else if (!escaped && /['"]/.test(next) && !/['"]/.test(quote)) {
110 state.tokens.unshift(tokenStringStart(next, "string"));
111 stream.backUp(1);
112 break;
113 }
114 escaped = !escaped && next === '\\';
115 }
116 return style;
117 };
118 };
119
120 function tokenStringStart(quote, style) {
121 return function(stream, state) {

Callers 3

tokenBaseFunction · 0.70
tokenStringStartFunction · 0.70
tokenDollarFunction · 0.70

Calls 2

tokenStringStartFunction · 0.85
tokenizeFunction · 0.70

Tested by

no test coverage detected