SHARE
TWEET

Untitled

a guest Oct 14th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     @SuppressWarnings("unchecked")
  2.     private Intermediate nItem() {// 項
  3.         Intermediate inter = new Intermediate();
  4.         Intermediate inter1, inter2;
  5.         String tmpResult;
  6.         String operator = "";
  7.         debugPrint("nItem");
  8.         inter1 = nElement();
  9.         while(getTokenName().matches("SSTAR|SDIVD|SMOD|SAND")) {// * div / mod and
  10.             operator = getToken();
  11.             tl++;
  12.             inter2 = nElement();
  13.             debugPrint("type1" + inter1.type);
  14.             debugPrint("type2" + inter2.type);
  15.             if(!inter1.type.equals(inter2.type)) printSemError();
  16.             // tmpにresultを回避
  17.             tmpResult = inter1.getResult();
  18.             // まず作業用変数であれば右辺をスタックに返す
  19.             returnTemp(tmpResult);
  20.             returnTemp(inter2.getResult());
  21.             // 次にResultをスタックから追加
  22.             inter1.setResult(getNewTemp());
  23.             // コードを追加
  24.             inter1.addCodeListList(Arrays.asList(inter2.getCode()));
  25.             inter1.addCodeList(Arrays.asList(inter1.getResult(), ":=", tmpResult, operator, inter2.getResult()));
  26.            
  27.         }
  28.         inter = inter1;
  29.         return inter;
  30.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top