public void HandleEvent(object sender, ShiftEventArgs e) { if (sender is IShiftable) { HandleEvent(sender as IShiftable, e); } }
/// <summary> /// Event handler for the shift action. /// </summary> /// <param name="parser">parser that is the source of this event</param> /// <param name="args">event arguments</param> private void ShiftEvent(LALRParser parser, ShiftEventArgs args) { AddViewItem("Shift", args.Token.Location, args.Token.Symbol.ToString(), StringUtil.ShowEscapeChars(args.Token.Text), args.NewState.Id.ToString(), 1); }
public void OnSF(LALRParser parser, ShiftEventArgs args) { current = new CLL_token(); current.location = args.Token.Location; switch (args.Token.Symbol.Id) { case 3: current_ = 3; //current.type = Token_Type.id; break; } current.text = args.Token.Text; }
public void HandleEvent(IShiftable sender, ShiftEventArgs e) { if (sender == null || e == null) { return; } if (e.Direction != LastDirection) { Counter = TimeSpan.Zero; LastDirection = e.Direction; DirectionChanged = true; } else { DirectionChanged = false; } if (sender is Mino) { Mino mino = sender as Mino; Counter += mino.Game.TargetElapsedTime; bool isHolding = !(Counter < HoldThreshold); if (DirectionChanged || !DirectionChanged && isHolding) { mino.Position = Adjust(mino.Position, e.Direction); } } if (sender is Polyomino) { Polyomino polyomino = sender as Polyomino; Counter += polyomino.Game.TargetElapsedTime; bool isHolding = !(Counter < HoldThreshold); if (DirectionChanged || !DirectionChanged && isHolding) { foreach (Mino mino in polyomino.Minoes) { mino.Position = Adjust(mino.Position, e.Direction); } } } }
private static void P_OnShift(LALRParser parser, ShiftEventArgs args) { abc2.Add(args.Token); }