(buffer, mode)
| 438 | } |
| 439 | |
| 440 | function processKeywords(buffer, mode) { |
| 441 | buffer = escape(buffer); |
| 442 | if (!mode.keywords) |
| 443 | return buffer; |
| 444 | var result = ''; |
| 445 | var last_index = 0; |
| 446 | mode.lexemsRe.lastIndex = 0; |
| 447 | var match = mode.lexemsRe.exec(buffer); |
| 448 | while (match) { |
| 449 | result += buffer.substr(last_index, match.index - last_index); |
| 450 | var keyword_match = keywordMatch(mode, match); |
| 451 | if (keyword_match) { |
| 452 | keyword_count += keyword_match[1]; |
| 453 | result += '<span class="'+ keyword_match[0] +'">' + match[0] + '</span>'; |
| 454 | } else { |
| 455 | result += match[0]; |
| 456 | } |
| 457 | last_index = mode.lexemsRe.lastIndex; |
| 458 | match = mode.lexemsRe.exec(buffer); |
| 459 | } |
| 460 | return result + buffer.substr(last_index, buffer.length - last_index); |
| 461 | } |
| 462 | |
| 463 | function processBuffer(buffer, mode) { |
| 464 | if (mode.subLanguage && languages[mode.subLanguage]) { |
no test coverage detected
searching dependent graphs…