clean up compiler
This commit is contained in:
parent
4000eb0412
commit
587443f9e3
13
lib/tput.js
13
lib/tput.js
|
@ -342,6 +342,10 @@ Tput.prototype._compile = function(val) {
|
|||
, i
|
||||
, v
|
||||
|
||||
var then
|
||||
, els
|
||||
, end;
|
||||
|
||||
function clear() {
|
||||
if (buff) {
|
||||
echo(JSON.stringify(buff).replace(/\\u001b/g, '\\x1b'));
|
||||
|
@ -654,10 +658,11 @@ Tput.prototype._compile = function(val) {
|
|||
}
|
||||
|
||||
if (read(/^%e/)) {
|
||||
var end = val.indexOf('%;');
|
||||
var els = val.indexOf('%e');
|
||||
var then = val.indexOf('%t');
|
||||
// does else if's like this: %?[expr]%t...%e[expr]%t...%;
|
||||
then = val.indexOf('%t');
|
||||
els = val.indexOf('%e');
|
||||
end = val.indexOf('%;');
|
||||
// Terminfo does elseif's like
|
||||
// this: %?[expr]%t...%e[expr]%t...%;
|
||||
if (then < end && then < els) {
|
||||
stmt('} else if (');
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue