fix printf command

This commit is contained in:
Christopher Jeffrey 2013-02-24 08:22:37 -06:00
parent 5075fa6efb
commit 5d9c3cccda
1 changed files with 11 additions and 18 deletions

View File

@ -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