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

Function phpString_

static/plugins/codemirror/mode/php/php.js:36–80  ·  view source on GitHub ↗
(stream, state, closing, escapes)

Source from the content-addressed store, hash-verified

34 return function(stream, state) { return phpString_(stream, state, closing, escapes); };
35 }
36 function phpString_(stream, state, closing, escapes) {
37 // "Complex" syntax
38 if (escapes !== false && stream.match("${", false) || stream.match("{$", false)) {
39 state.tokenize = null;
40 return "string";
41 }
42
43 // Simple syntax
44 if (escapes !== false && stream.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/)) {
45 // After the variable name there may appear array or object operator.
46 if (stream.match("[", false)) {
47 // Match array operator
48 state.tokenize = matchSequence([
49 [["[", null]],
50 [[/\d[\w\.]*/, "number"],
51 [/\$[a-zA-Z_][a-zA-Z0-9_]*/, "variable-2"],
52 [/[\w\$]+/, "variable"]],
53 [["]", null]]
54 ], closing, escapes);
55 }
56 if (stream.match(/^->\w/, false)) {
57 // Match object operator
58 state.tokenize = matchSequence([
59 [["->", null]],
60 [[/[\w]+/, "variable"]]
61 ], closing, escapes);
62 }
63 return "variable-2";
64 }
65
66 var escaped = false;
67 // Normal string
68 while (!stream.eol() &&
69 (escaped || escapes === false ||
70 (!stream.match("{$", false) &&
71 !stream.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/, false)))) {
72 if (!escaped && stream.match(closing)) {
73 state.tokenize = null;
74 state.tokStack.pop(); state.tokStack.pop();
75 break;
76 }
77 escaped = stream.next() == "\\" && !escaped;
78 }
79 return "string";
80 }
81
82 var phpKeywords = "abstract and array as break case catch class clone const continue declare default " +
83 "do else elseif enddeclare endfor endforeach endif endswitch endwhile enum extends final " +

Callers 1

phpStringFunction · 0.85

Calls 1

matchSequenceFunction · 0.85

Tested by

no test coverage detected