pakmanaged.js
function peek(p) {
        var i = p || 0, j = 0, t;
    
        while (j <= i) {
          t = lookahead[j];
          if (!t) {
            t = lookahead[j] = lex.token();
          }
          j += 1;
        }
    
        // Peeking past the end of the program should produce the "(end)" token.
        if (!t && state.tokens.next.id === "(end)") {
          return state.tokens.next;
        }
    
        return t;
      }
function peek(p) {
        var i = p || 0, j = 0, t;
    
        while (j <= i) {
          t = lookahead[j];
          if (!t) {
            t = lookahead[j] = lex.token();
          }
          j += 1;
        }
    
        // Peeking past the end of the program should produce the "(end)" token.
        if (!t && state.tokens.next.id === "(end)") {
          return state.tokens.next;
        }
    
        return t;
      }
We need a peek function. If it has an argument, it peeks that much farther ahead. It is used to distinguish for ( var i in ... from for ( var i = ...