static void Main(string[] args) { Console.OutputEncoding = System.Text.Encoding.UTF8; Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) { Console.WriteLine(); Console.WriteLine("Goodbye! ¡Adiós! Ciao! Adieu! Adeus! Tschüss! Пока! 再见 さようなら הֱיה שלום وداعا"); }; ClearLine(); // Subscribe to the printing events from the interpreter. // A printing event will be triggered after each successful statement // execution. On error an exception will be thrown. Interpreter.Instance.OnOutput += Print; string scriptFilename = "scripts/test.cscs"; scriptFilename = ""; string script = Utils.GetFileContents(scriptFilename); Environment.SetEnvironmentVariable("MONO_REGISTRY_PATH", "/Library/Frameworks/Mono.framework/Versions/Current/etc/mono/registry/"); DebuggerServer.BaseDirectory = ""; if (string.IsNullOrWhiteSpace(script) && (args.Length < 1 || args[1] == "debugger")) { DebuggerServer.StartServer(13337, true); } if (args.Length >= 3) { Translation.TranslateScript(args); return; } if (args.Length > 0) { if (args[0].EndsWith(EXT)) { scriptFilename = args[0]; Console.WriteLine("Reading script from " + scriptFilename); script = Utils.GetFileContents(scriptFilename); } else { script = args[0]; } } if (!string.IsNullOrWhiteSpace(script)) { ProcessScript(script, scriptFilename); return; } RunLoop(); }
static void Main(string[] args) { Console.OutputEncoding = System.Text.Encoding.UTF8; Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) { Console.WriteLine(); Console.WriteLine("Goodbye! ¡Adiós! Ciao! Adieu! Adeus! Tschüss! Пока! 再见 さようなら הֱיה שלום وداعا"); }; ClearLine(); // Subscribe to the printing events from the interpreter. // A printing event will be triggered after each successful statement // execution. On error an exception will be thrown. Interpreter.Instance.GetOutput += Print; //ProcessScript("include(\"scripts/functions.cscs\");"); string scriptFilename = "scripts/temp.cscs"; string script = ""; script = Utils.GetFileContents(scriptFilename); if (string.IsNullOrWhiteSpace(script) && (args.Length < 1 || args[1] == "debugger")) { DebuggerServer.StartServer(13337, true); //return; } if (args.Length >= 3) { Translation.TranslateScript(args); return; } if (args.Length > 0) { if (args[0].EndsWith(EXT)) { scriptFilename = args[0]; Console.WriteLine("Reading script from " + scriptFilename); script = Utils.GetFileContents(scriptFilename); } else { script = args[0]; } } if (!string.IsNullOrWhiteSpace(script)) { ProcessScript(script, scriptFilename); return; } RunLoop(); }
static void Main2(string[] args) { Console.OutputEncoding = System.Text.Encoding.UTF8; Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) { Console.WriteLine(); Console.WriteLine("Goodbye! ¡Adiós! Ciao! Adieu! Adeus! Tschüss! Пока! 再见 さようなら הֱיה שלום وداعا"); }; ClearLine(); // Subscribe to the printing events from the interpreter. // A printing event will be triggered after each successful statement // execution. On error an exception will be thrown. Interpreter.Instance.GetOutput += Print; ProcessScript("include(\"scripts/functions.cscs\");"); string script = null; //script = GetFileContents("/Users/vk/Documents/github/cscscpp/bin/Debug/scripts/temp.cscs"); if (args.Length >= 3) { Translation.TranslateScript(args); return; } if (args.Length > 0) { if (args[0].EndsWith(EXT)) { string filename = args[0]; Console.WriteLine("Reading script from " + filename); script = GetFileContents(filename); } else { script = args[0]; } } if (!string.IsNullOrWhiteSpace(script)) { ProcessScript(script); return; } RunLoop(); }
protected override Variable Evaluate(ParsingScript script) { string language = Utils.GetToken(script, Constants.TOKEN_SEPARATION); string funcName = Utils.GetToken(script, Constants.TOKEN_SEPARATION); ParserFunction function = ParserFunction.GetFunction(funcName); CustomFunction custFunc = function as CustomFunction; Utils.CheckNotNull(funcName, custFunc); string body = Utils.BeautifyScript(custFunc.Body, custFunc.Header); string translated = Translation.TranslateScript(body, language); Translation.PrintScript(translated); return(new Variable(translated)); }
protected override Variable Evaluate(ParsingScript script) { List <Variable> args = script.GetFunctionArgs(); Utils.CheckArgs(args.Count, 2, m_name, true); string language = args[0].AsString(); string funcName = args[1].AsString(); ParserFunction function = ParserFunction.GetFunction(funcName); CustomFunction custFunc = function as CustomFunction; Utils.CheckNotNull(funcName, custFunc); string body = Utils.BeautifyScript(custFunc.Body, custFunc.Header); string translated = Translation.TranslateScript(body, language); Translation.PrintScript(translated); return(new Variable(translated)); }