diff --git a/apps/pdp10/diags/klad/dakac/DAKAC.MAC.txt b/apps/pdp10/diags/klad/dakac/DAKAC.MAC.txt index 5af64de68..6e4503259 100644 --- a/apps/pdp10/diags/klad/dakac/DAKAC.MAC.txt +++ b/apps/pdp10/diags/klad/dakac/DAKAC.MAC.txt @@ -1714,7 +1714,7 @@ B35000: SETZ ;PRELOAD AC,E WITH 0 B35500: SETZ ;PRELOAD AC WITH 0 SETO 1, ;PRELOAD E WITH -1,,-1 HLLM 1 ;*HLLM SHOULD PLACE 0,,-1 INTO E - CAIE 1,-1 ;PASS IF C(E) =0,,-1 + CAIE 1,- 1 ;PASS IF C(E) =0,,-1 STOP ;***** FAILURE ANALYSIS ***** diff --git a/modules/pdp10/lib/macro10.js b/modules/pdp10/lib/macro10.js index 09850b75e..d7faa9e49 100644 --- a/modules/pdp10/lib/macro10.js +++ b/modules/pdp10/lib/macro10.js @@ -1285,7 +1285,9 @@ class Macro10 { w = this.dbg.parseInstruction(sOperator, sOperands, this.nLocation, true); } - if (w < 0) w = this.parseExpression(sExp, true); + if (w < 0) { + w = this.parseExpression(sExp, true); + } if (w !== undefined) { this.genWord(w, this.dbg.sUndefined); diff --git a/modules/shared/lib/debugger.js b/modules/shared/lib/debugger.js index 222abaa9e..be37c4132 100644 --- a/modules/shared/lib/debugger.js +++ b/modules/shared/lib/debugger.js @@ -660,6 +660,16 @@ class Debugger extends Component sOp = (iValue < iLimit? asValues[iValue++] : ""); } else { + /* + * When parseExpression() calls us, it has collapsed all runs of whitespace into single spaces, + * and although it allows single spaces to divide the elements of the expression, a space is neither + * a unary nor binary operator. It's essentially a no-op. If we encounter it here, then it followed + * another operator and is easily ignored (although perhaps it should still trigger a reset of nBase + * and nUnary -- TBD). + */ + if (sOp == ' ') { + continue; + } if (sOp == '^B') { this.nBase = 2; continue; @@ -706,15 +716,27 @@ class Debugger extends Component } aVals.push(this.truncate(v)); + + /* + * When parseExpression() calls us, it has collapsed all runs of whitespace into single spaces, + * and although it allows single spaces to divide the elements of the expression, a space is neither + * a unary nor binary operator. It's essentially a no-op. If we encounter it here, then it followed + * a value, and since we don't want to misinterpret the next operator as a unary operator, we look + * ahead and grab the next operator as appropriate. + */ + if (sOp == ' ') { + if (iValue < asValues.length - 1 && !asValues[iValue]) { + iValue++; + sOp = asValues[iValue++] + } else { + fError = true; + break; + } + } if (!sOp) break; - if (sOp == ' ') { - fError = true; - break; - } - this.assert(Debugger.aBinOpPrecedence[sOp] != null); - if (aOps.length && Debugger.aBinOpPrecedence[sOp] < Debugger.aBinOpPrecedence[aOps[aOps.length - 1]]) { + if (aOps.length && Debugger.aBinOpPrecedence[sOp] <= Debugger.aBinOpPrecedence[aOps[aOps.length - 1]]) { this.evalOps(aVals, aOps, 1); } @@ -734,6 +756,7 @@ class Debugger extends Component if (!fError) { value = aVals.pop(); + this.assert(!aVals.length); } else if (fQuiet === false) { this.println("parse error (" + (sValue || sOp) + ")"); }