internal void HandleCommand(Command c) { if (c is Chat) // add chat to runtime list { activeChat = (Chat)c; runtime.AddChat(activeChat); return; } if (runtime.chats.Count == 0) { CreateDefaultChat(); } // add option data to last Ask if (c is Opt) { if (lastAsk == null) { throw new ParseException ("OPT must follow ASK"); } lastAsk.AddOption((Opt)c); } else // add command to last Chat { if (c is Ask) { lastAsk = (Ask)c; } activeChat.AddCommand(c); } }
internal void HandleCommand(Command c) { if (c is Chat) // add chat to runtime list { activeChat = (Chat)c; runtime.AddChat(activeChat); return; } if (runtime.chats.Count == 0) { CreateDefaultChat(); } // add option data to last Ask if (c is Opt) { lastAsk.AddOption((Opt)c); //Opt opt = (Opt)c; //Command last = LastOfType(parsedCommands, typeof(Ask)); //if (!(last is Ask)) throw new ParseException //(line, lineNo, "OPT must follow ASK"); } else // add command to last Chat { if (c is Ask) { lastAsk = (Ask)c; } activeChat.AddCommand(c); } }