Core.DlrEngine.GetTokenInfos C# (CSharp) 메소드

GetTokenInfos() 공개 메소드

public GetTokenInfos ( string code ) : List
code string
리턴 List
        public virtual List<TokenInfo> GetTokenInfos(string code)
        {
            var tokenizer = new Tokenizer(true);
            tokenizer.Initialize(CreateSourceUnit(code));
            return new List<TokenInfo>(tokenizer.ReadTokens(code.Length));
        }

Usage Example

예제 #1
0
파일: Colorizer.cs 프로젝트: jflam/repl-lib
 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;
 }
All Usage Examples Of Core.DlrEngine::GetTokenInfos