allow setting MaxTokenCount in tokenizer

This commit is contained in:
nightwing 2013-09-13 20:38:53 +04:00
commit 2c9dbced9b

View file

@ -34,8 +34,6 @@ define(function(require, exports, module) {
// tokenizing lines longer than this makes editor very slow // tokenizing lines longer than this makes editor very slow
var MAX_TOKEN_COUNT = 1000; var MAX_TOKEN_COUNT = 1000;
/** /**
*
*
* This class takes a set of highlighting rules, and creates a tokenizer out of them. For more information, see [the wiki on extending highlighters](https://github.com/ajaxorg/ace/wiki/Creating-or-Extending-an-Edit-Mode#wiki-extendingTheHighlighter). * This class takes a set of highlighting rules, and creates a tokenizer out of them. For more information, see [the wiki on extending highlighters](https://github.com/ajaxorg/ace/wiki/Creating-or-Extending-an-Edit-Mode#wiki-extendingTheHighlighter).
* @class Tokenizer * @class Tokenizer
**/ **/
@ -128,6 +126,10 @@ var Tokenizer = function(rules) {
}; };
(function() { (function() {
this.$setMaxTokenCount = function(m) {
MAX_TOKEN_COUNT = m | 0;
};
this.$applyToken = function(str) { this.$applyToken = function(str) {
var values = this.splitRegex.exec(str).slice(1); var values = this.splitRegex.exec(str).slice(1);
var types = this.token.apply(this, values); var types = this.token.apply(this, values);