//---------------------------------------- // Relational and type testing (<, >, <=, >=, is, as) //---------------------------------------- private void eval_exp17() { eval_exp18(); if (currentToken.Type == StiTokenType.Left || currentToken.Type == StiTokenType.LeftEqual || currentToken.Type == StiTokenType.Right || currentToken.Type == StiTokenType.RightEqual) { StiAsmCommand command = null; if (currentToken.Type == StiTokenType.Left) { command = new StiAsmCommand(StiAsmCommandType.CompareLeft); } if (currentToken.Type == StiTokenType.LeftEqual) { command = new StiAsmCommand(StiAsmCommandType.CompareLeftEqual); } if (currentToken.Type == StiTokenType.Right) { command = new StiAsmCommand(StiAsmCommandType.CompareRight); } if (currentToken.Type == StiTokenType.RightEqual) { command = new StiAsmCommand(StiAsmCommandType.CompareRightEqual); } get_token(); eval_exp18(); asmList.Add(command); } }
//---------------------------------------- // Shift (<<, >>) //---------------------------------------- private void eval_exp18() { eval_exp2(); if ((currentToken.Type == StiTokenType.Shl) || (currentToken.Type == StiTokenType.Shr)) { StiAsmCommand command = new StiAsmCommand(StiAsmCommandType.Shl); if (currentToken.Type == StiTokenType.Shr) { command.Type = StiAsmCommandType.Shr; } get_token(); eval_exp2(); asmList.Add(command); } }
//---------------------------------------- // Equality (==, !=) //---------------------------------------- private void eval_exp16() { eval_exp17(); if (currentToken.Type == StiTokenType.Equal || currentToken.Type == StiTokenType.NotEqual) { StiAsmCommand command = new StiAsmCommand(StiAsmCommandType.CompareEqual); if (currentToken.Type == StiTokenType.NotEqual) { command.Type = StiAsmCommandType.CompareNotEqual; } get_token(); eval_exp17(); asmList.Add(command); } }
//---------------------------------------- // Вычисление унарного + и - //---------------------------------------- private void eval_exp5() { StiAsmCommand command = null; if (currentToken.Type == StiTokenType.Plus || currentToken.Type == StiTokenType.Minus || currentToken.Type == StiTokenType.Not) { if (currentToken.Type == StiTokenType.Minus) { command = new StiAsmCommand(StiAsmCommandType.Neg); } if (currentToken.Type == StiTokenType.Not) { command = new StiAsmCommand(StiAsmCommandType.Not); } get_token(); } eval_exp6(); if (command != null) { asmList.Add(command); } }