(quote, style, embed, unescaped)
| 147 | }; |
| 148 | } |
| 149 | function readQuoted(quote, style, embed, unescaped) { |
| 150 | return function(stream, state) { |
| 151 | var escaped = false, ch; |
| 152 | |
| 153 | if (state.context.type === 'read-quoted-paused') { |
| 154 | state.context = state.context.prev; |
| 155 | stream.eat("}"); |
| 156 | } |
| 157 | |
| 158 | while ((ch = stream.next()) != null) { |
| 159 | if (ch == quote && (unescaped || !escaped)) { |
| 160 | state.tokenize.pop(); |
| 161 | break; |
| 162 | } |
| 163 | if (embed && ch == "#" && !escaped) { |
| 164 | if (stream.eat("{")) { |
| 165 | if (quote == "}") { |
| 166 | state.context = {prev: state.context, type: 'read-quoted-paused'}; |
| 167 | } |
| 168 | state.tokenize.push(tokenBaseUntilBrace()); |
| 169 | break; |
| 170 | } else if (/[@\$]/.test(stream.peek())) { |
| 171 | state.tokenize.push(tokenBaseOnce()); |
| 172 | break; |
| 173 | } |
| 174 | } |
| 175 | escaped = !escaped && ch == "\\"; |
| 176 | } |
| 177 | return style; |
| 178 | }; |
| 179 | } |
| 180 | function readHereDoc(phrase) { |
| 181 | return function(stream, state) { |
| 182 | if (stream.match(phrase)) state.tokenize.pop(); |
no test coverage detected