コード例 #1
0
ファイル: Parser.cs プロジェクト: katiearriagam/Marbles
 /// <summary>
 /// Called by <see cref="DO"/> after identifying the asset to perform the action.
 /// Checks which action is going to be performed (verifying that it is a valid one)
 /// and passes on this information to the functions that handle the action's code
 /// generation.
 /// </summary>
 void ACTION()
 {
     Utilities.AssetAction action;
     if (StartOf(4))
     {
         if (la.kind == 23)               // "move_x"
         {
             action = Utilities.AssetAction.move_x;
             Get();
             Expect(10);                 // '('
         }
         else if (la.kind == 24)         // "move_y"
         {
             action = Utilities.AssetAction.move_y;
             Get();
             Expect(10);                 // '('
         }
         else if (la.kind == 25)         // "rotate"
         {
             action = Utilities.AssetAction.rotate;
             Get();
             Expect(10);      // '('
         }
         else                 // "set_position"
         {
             action = Utilities.AssetAction.set_position;
             Get();
             Expect(10);                 // '('
             SUPER_EXP();
             Expect(11);                 // ','
         }
         SUPER_EXP();
         Expect(12);             // ')'
         try { QuadrupleManager.DoBlock_ReadAssetAction(action); }
         catch (Exception e) { SemErr(e.Message); }
     }
     else if (la.kind == 27)             // "spin"
     {
         action = Utilities.AssetAction.spin;
         Get();
         Expect(10);             // (
         Expect(12);             // )
         try { QuadrupleManager.DoBlock_ReadAssetAction(action); }
         catch (Exception e) { SemErr(e.Message); }
     }
     else
     {
         SynErr(57);
     }
 }