aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/library.js b/src/library.js
index 1cfe309a..4ad6e06a 100644
--- a/src/library.js
+++ b/src/library.js
@@ -2456,19 +2456,22 @@ LibraryManager.library = {
var fields = 0;
var argIndex = 0;
var next;
- // remove initial whitespace
- while (1) {
- next = get();
- if (next == 0) return 0;
- if (!(next in __scanString.whiteSpace)) break;
- }
- unget(next);
+
next = 1;
mainLoop:
for (var formatIndex = 0; formatIndex < format.length; formatIndex++) {
+ // remove whitespace
+ while (1) {
+ next = get();
+ if (next == 0) return fields;
+ if (!(next in __scanString.whiteSpace)) break;
+ }
+ unget(next);
+
if (next <= 0) return fields;
var next = get();
if (next <= 0) return fields; // End of input.
+
if (format[formatIndex] === '%') {
formatIndex++;
var maxSpecifierStart = formatIndex;