public override Mode GetMode(IWarriorParser parser, int currentAddress) { Mode l = left.GetMode(parser, currentAddress); if (l != Mode.NULL) { return(l); } return(right.GetMode(parser, currentAddress)); }
public override Mode GetMode(IWarriorParser parser, int currentAddress) { int l = left.Evaluate(parser, currentAddress); Mode m = middle.GetMode(parser, currentAddress); Mode r = right.GetMode(parser, currentAddress); switch (operation) { case TernaryOperation.If: return((l != 0) ? m : r); default: throw new InvalidOperationException(); } }
public override Mode GetMode(IWarriorParser parser, int currentAddress) { string fullName = GetFullName(parser, currentAddress); if (parser.Variables.ContainsKey(fullName)) { Expression ex = parser.Variables[fullName]; if (ex == this) { parser.WriteError("Label not yet resolved: " + fullName + " at " + Location, Location); return(0); } return(ex.GetMode(parser, currentAddress)); } else { parser.WriteError("Label not defined: " + fullName + " at " + Location, Location); return(0); } }
public override Mode GetMode(IWarriorParser parser, int currentAddress) { return(sub.GetMode(parser, currentAddress)); }