fix printf command
This commit is contained in:
parent
5075fa6efb
commit
5d9c3cccda
29
lib/tput.js
29
lib/tput.js
|
@ -543,19 +543,12 @@ Tput.prototype._compile = function(val) {
|
|||
// as in printf, flags are [-+#] and space. Use a `:' to allow the
|
||||
// next character to be a `-' flag, avoiding interpreting "%-" as an
|
||||
// operator.
|
||||
// NOTE: Possibly remove one of the {0,1}'s.
|
||||
// Otherwise %+ and other ops could be mistaken for this.
|
||||
// Guessing it looks like:
|
||||
// %:-d
|
||||
// %+d
|
||||
// %#x
|
||||
// %+10d
|
||||
// Probably should be: /^%(:-|[+# ])?(\d+(?:\.\d+)?)?([doxXs])/
|
||||
if (read(/^%(:-|[+# ])(\d+(?:\.\d+)?)?([doxXs])?/)) {
|
||||
// e.g. %:-d %+d %#x %+10d
|
||||
if (read(/^%(:-|[+# ])?(\d+(?:\.\d+)?)?([doxXs])/)) {
|
||||
// var flag = cap[1]
|
||||
// , width = cap[2]
|
||||
// , type = cap[3];
|
||||
print('');
|
||||
echo('stack.pop()');
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -567,16 +560,16 @@ Tput.prototype._compile = function(val) {
|
|||
|
||||
// %d print pop()
|
||||
// "Print (e.g., "%d") is a special case."
|
||||
if (read(/^%d/)) {
|
||||
echo('stack.pop()');
|
||||
continue;
|
||||
}
|
||||
//if (read(/^%d/)) {
|
||||
// echo('stack.pop()');
|
||||
// continue;
|
||||
//}
|
||||
|
||||
// %s print pop() like %s in printf
|
||||
if (read(/^%s/)) {
|
||||
echo('stack.pop()');
|
||||
continue;
|
||||
}
|
||||
//if (read(/^%s/)) {
|
||||
// echo('stack.pop()');
|
||||
// continue;
|
||||
//}
|
||||
|
||||
// %p[1-9]
|
||||
// push i'th parameter
|
||||
|
|
Loading…
Reference in New Issue