private static void ProcessTokens(int lineNumber) { try { Debug.Assert(_tokens.Count > 0); string actionType = GetActionType(); switch (actionType) { case "#import": LoadImportScript(_tokens[1]); return; case "const": case "var": VariableParser.Parse(lineNumber, _LoadedFiles.Peek(), _script, _tokens); return; } ActionBase act = CreateActionObject(actionType); switch (actionType) { case "function": { string name = FunctionParser.Parse((Actionfunction)act, _tokens); if (!_script.AddFunction(name)) { string msg = "Function [" + name + "] already exists." + Environment.NewLine + "Unable to load script."; throw new Exception(msg); } } break; case "call": CallParser.Parse((Actioncall)act, _tokens); break; case "for": ParseForLoop((Actionfor)act, _tokens); break; default: act.AddParams(_tokens); break; } act.LineNumber = lineNumber; act.Path2Script = _LoadedFiles.Peek(); _script.AddAction(act); } catch { _vm.ParseError(_LoadedFiles.Pop(), lineNumber); throw; } }