Exemplo n.º 1
0
        private void InitializeScriptEngines()
        {
            DlrEngine engine = new RubyEngine();

            _languageMap[engine.Name] = engine;
            _rubyEngine = engine;
            engine      = new PythonEngine();
            _languageMap[engine.Name] = engine;
            _currentEngine            = "ruby";
        }
Exemplo n.º 2
0
 public static List<Run> Colorize(DlrEngine engine, string code, Action<Run, TokenInfo> proc)
 {
     var result = new List<Run>();
     int position = 0;
     foreach (TokenInfo token in engine.GetTokenInfos(code)) {
         result.Add(CreateLeadingWhitespaceRun(code, position, token));
         var run = CreateTextRun(code, token);
         if (proc != null)
             proc(run, token);
         result.Add(run);
         position = token.SourceSpan.Start.Index + token.SourceSpan.Length;
     }
     return result;
 }
Exemplo n.º 3
0
        public static List <Run> Colorize(DlrEngine engine, string code, Action <Run, TokenInfo> proc)
        {
            var result   = new List <Run>();
            int position = 0;

            foreach (TokenInfo token in engine.GetTokenInfos(code))
            {
                result.Add(CreateLeadingWhitespaceRun(code, position, token));
                var run = CreateTextRun(code, token);
                if (proc != null)
                {
                    proc(run, token);
                }
                result.Add(run);
                position = token.SourceSpan.Start.Index + token.SourceSpan.Length;
            }
            return(result);
        }
Exemplo n.º 4
0
 private void InitializeScriptEngines()
 {
     DlrEngine engine = new RubyEngine();
     _languageMap[engine.Name] = engine;
     _rubyEngine = engine;
     engine = new PythonEngine();
     _languageMap[engine.Name] = engine;
     _currentEngine = "ruby";
 }