mirror of
https://github.com/beautifier/js-beautify.git
synced 2025-02-24 15:23:55 +00:00
Fix inputscanner
This commit is contained in:
parent
91ffb9babd
commit
c0d6989d7a
@ -32,7 +32,7 @@ function InputScanner(input) {
|
|||||||
var _position = 0;
|
var _position = 0;
|
||||||
|
|
||||||
this.back = function() {
|
this.back = function() {
|
||||||
if (_position > 0){
|
if (_position > 0) {
|
||||||
_position -= 1;
|
_position -= 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -73,11 +73,12 @@ function InputScanner(input) {
|
|||||||
|
|
||||||
this.test = function(pattern, index) {
|
this.test = function(pattern, index) {
|
||||||
index = index || 0;
|
index = index || 0;
|
||||||
pattern.lastIndex = _position + index;
|
index += _position;
|
||||||
|
pattern.lastIndex = index;
|
||||||
|
|
||||||
if (index >= 0 && index < _input_length) {
|
if (index >= 0 && index < _input_length) {
|
||||||
var pattern_match = pattern.exec(_input);
|
var pattern_match = pattern.exec(_input);
|
||||||
return pattern_match && pattern_match.index === _position + index;
|
return pattern_match && pattern_match.index === index;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -102,4 +103,4 @@ function InputScanner(input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module.exports.InputScanner = InputScanner;
|
module.exports.InputScanner = InputScanner;
|
@ -50,4 +50,4 @@ function mergeOpts(allOptions, childFieldName) {
|
|||||||
return finalOpts;
|
return finalOpts;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.mergeOpts = mergeOpts;
|
module.exports.mergeOpts = mergeOpts;
|
@ -502,4 +502,4 @@ function Beautifier(source_text, options) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.Beautifier = Beautifier;
|
module.exports.Beautifier = Beautifier;
|
@ -1049,4 +1049,4 @@ function Beautifier(html_source, options, js_beautify, css_beautify) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.Beautifier = Beautifier;
|
module.exports.Beautifier = Beautifier;
|
@ -625,4 +625,4 @@ function Tokenizer(input_string, opts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.Tokenizer = Tokenizer;
|
module.exports.Tokenizer = Tokenizer;
|
Loading…
x
Reference in New Issue
Block a user