(stream, state, closing)
| 34 | return function(stream, state) { return stringWithEscapes_(stream, state, closing); }; |
| 35 | } |
| 36 | function stringWithEscapes_(stream, state, closing) { |
| 37 | // "Complex" syntax |
| 38 | if (stream.match("${", false) || stream.match("{$", false)) { |
| 39 | state.tokenize = null; |
| 40 | return "string"; |
| 41 | } |
| 42 | |
| 43 | // Simple syntax |
| 44 | if (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); |
| 55 | } |
| 56 | if (stream.match(/\-\>\w/, false)) { |
| 57 | // Match object operator |
| 58 | state.tokenize = matchSequence([ |
| 59 | [["->", null]], |
| 60 | [[/[\w]+/, "variable"]] |
| 61 | ], closing); |
| 62 | } |
| 63 | return "variable-2"; |
| 64 | } |
| 65 | |
| 66 | var escaped = false; |
| 67 | // Normal string |
| 68 | while (!stream.eol() && |
| 69 | (escaped || (!stream.match("{$", false) && |
| 70 | !stream.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/, false)))) { |
| 71 | if (!escaped && stream.match(closing)) { |
| 72 | state.tokenize = null; |
| 73 | state.tokStack.pop(); state.tokStack.pop(); |
| 74 | break; |
| 75 | } |
| 76 | escaped = stream.next() == "\\" && !escaped; |
| 77 | } |
| 78 | return "string"; |
| 79 | } |
| 80 | |
| 81 | var phpKeywords = "abstract and array as break case catch class clone const continue declare default " + |
| 82 | "do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final " + |
no test coverage detected
searching dependent graphs…