private Node variables(int context) throws IOException, ParserException {
  Node pn;
  boolean first=true;
  if (context == Token.CONST) {
    pn=nf.createVariables(Token.CONST,ts.getLineno());
    decompiler.addToken(Token.CONST);
  }
 else {
    pn=nf.createVariables(Token.VAR,ts.getLineno());
    decompiler.addToken(Token.VAR);
  }
  for (; ; ) {
    Node name;
    Node init;
    mustMatchToken(Token.NAME,"msg.bad.var");
    String s=ts.getString();
    if (!first)     decompiler.addToken(Token.COMMA);
    first=false;
    decompiler.addName(s);
    if (context == Token.CONST) {
      if (!currentScriptOrFn.addConst(s)) {
        if (currentScriptOrFn.addVar(s) != ScriptOrFnNode.DUPLICATE_CONST)         addError("msg.var.redecl",s);
 else         addError("msg.const.redecl",s);
      }
    }
 else {
      int dupState=currentScriptOrFn.addVar(s);
      if (dupState == ScriptOrFnNode.DUPLICATE_CONST)       addError("msg.const.redecl",s);
 else       if (dupState == ScriptOrFnNode.DUPLICATE_PARAMETER)       addStrictWarning("msg.var.hides.arg",s);
 else       if (dupState == ScriptOrFnNode.DUPLICATE_VAR)       addStrictWarning("msg.var.redecl",s);
    }
    name=nf.createName(s);
    if (matchToken(Token.ASSIGN)) {
      decompiler.addToken(Token.ASSIGN);
      init=assignExpr(context == Token.FOR);
      nf.addChildToBack(name,init);
    }
    nf.addChildToBack(pn,name);
    if (!matchToken(Token.COMMA))     break;
  }
  return pn;
}

private Node variables ( int context ) throws IOException , ParserException { Node pn ; boolean first = true ; if ( context == Token . CONST ) { pn = nf . createVariables ( Token . CONST , ts . getLineno ( ) ) ; decompiler . addToken ( Token . CONST ) ; } else { pn = nf . createVariables ( Token . VAR , ts . getLineno ( ) ) ; decompiler . addToken ( Token . VAR ) ; } for ( ; ; ) { Node name ; Node init ; mustMatchToken ( Token . NAME , "msg.bad.var" ) ; String s = ts . getString ( ) ; if ( ! first ) decompiler . addToken ( Token . COMMA ) ; first = false ; decompiler . addName ( s ) ; if ( context == Token . CONST ) { if ( ! currentScriptOrFn . addConst ( s ) ) { if ( currentScriptOrFn . addVar ( s ) != ScriptOrFnNode . DUPLICATE_CONST ) addError ( "msg.var.redecl" , s ) ; else addError ( "msg.const.redecl" , s ) ; } } else { int dupState = currentScriptOrFn . addVar ( s ) ; if ( dupState == ScriptOrFnNode . DUPLICATE_CONST ) addError ( "msg.const.redecl" , s ) ; else if ( dupState == ScriptOrFnNode . DUPLICATE_PARAMETER ) addStrictWarning ( "msg.var.hides.arg" , s ) ; else if ( dupState == ScriptOrFnNode . DUPLICATE_VAR ) addStrictWarning ( "msg.var.redecl" , s ) ; } name = nf . createName ( s ) ; if ( matchToken ( Token . ASSIGN ) ) { decompiler . addToken ( Token . ASSIGN ) ; init = assignExpr ( context == Token . FOR ) ; nf . addChildToBack ( name , init ) ; } nf . addChildToBack ( pn , name ) ; if ( ! matchToken ( Token . COMMA ) ) break ; } return pn ; }
parse a ' var ' or ' const ' statement , or a ' var ' init list in a for statement .
