Browse Source

Merge pull request #4976 from CodingFabian/restructure-evaluator-read

Restructured EvaluatorPreprocessor_read to be more natural.
Yury Delendik 11 years ago
parent
commit
bb7e7d33c5
  1. 31
      src/core/evaluator.js

31
src/core/evaluator.js

@ -2104,21 +2104,7 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() { @@ -2104,21 +2104,7 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
var args = null;
while (true) {
var obj = this.parser.getObj();
if (isEOF(obj)) {
return false; // no more commands
}
if (!isCmd(obj)) {
// argument
if (obj !== null) {
if (!args) {
args = [];
}
args.push((obj instanceof Dict ? obj.getAll() : obj));
assert(args.length <= 33, 'Too many arguments');
}
continue;
}
if (isCmd(obj)) {
var cmd = obj.cmd;
// Check that the command is valid
var opSpec = OP_MAP[cmd];
@ -2131,7 +2117,7 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() { @@ -2131,7 +2117,7 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
var numArgs = opSpec.numArgs;
if (!opSpec.variableArgs) {
// Some post script commands can be nested, e.g. /F2 /GS2 gs 5.711 Tf
// Postscript commands can be nested, e.g. /F2 /GS2 gs 5.711 Tf
var argsLength = args !== null ? args.length : 0;
if (argsLength !== numArgs) {
var nonProcessedArgs = this.nonProcessedArgs;
@ -2168,6 +2154,19 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() { @@ -2168,6 +2154,19 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
operation.fn = fn;
operation.args = args;
return true;
} else {
if (isEOF(obj)) {
return false; // no more commands
}
// argument
if (obj !== null) {
if (!args) {
args = [];
}
args.push((obj instanceof Dict ? obj.getAll() : obj));
assert(args.length <= 33, 'Too many arguments');
}
}
}
},

Loading…
Cancel
Save