当前位置: 首页>>代码示例>>C#>>正文


C# Context.GetToken方法代码示例

本文整理汇总了C#中Microsoft.JScript.Context.GetToken方法的典型用法代码示例。如果您正苦于以下问题:C# Context.GetToken方法的具体用法?C# Context.GetToken怎么用?C# Context.GetToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.JScript.Context的用法示例。


在下文中一共展示了Context.GetToken方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetStateForText

 public virtual SourceState GetStateForText(string sourceCode, SourceState state)
 {
     if (sourceCode != null)
     {
         this._state = SourceState.STATE_COLOR_NORMAL;
         Context sourceContext = new Context(null, sourceCode);
         this._scanner.SetSource(sourceContext);
         if ((SourceState.STATE_COLOR_COMMENT == state) && (this._scanner.SkipMultiLineComment() > sourceCode.Length))
         {
             this._state = SourceState.STATE_COLOR_COMMENT;
             return this._state;
         }
         this._scanner.GetNextToken();
         JSToken none = JSToken.None;
         while (sourceContext.GetToken() != JSToken.EndOfFile)
         {
             none = sourceContext.GetToken();
             this._scanner.GetNextToken();
         }
         if (JSToken.UnterminatedComment == none)
         {
             this._state = SourceState.STATE_COLOR_COMMENT;
         }
     }
     return this._state;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:JSColorizer.cs

示例2: ColorFromToken

 internal static TokenColor ColorFromToken(Context context)
 {
     JSToken token = context.GetToken();
     if (JSScanner.IsKeyword(token))
     {
         return TokenColor.COLOR_KEYWORD;
     }
     if (JSToken.Identifier == token)
     {
         if (context.Equals("eval"))
         {
             return TokenColor.COLOR_KEYWORD;
         }
         return TokenColor.COLOR_IDENTIFIER;
     }
     if (JSToken.StringLiteral == token)
     {
         return TokenColor.COLOR_STRING;
     }
     if ((JSToken.NumericLiteral == token) || (JSToken.IntegerLiteral == token))
     {
         return TokenColor.COLOR_NUMBER;
     }
     if ((JSToken.Comment == token) || (JSToken.UnterminatedComment == token))
     {
         return TokenColor.COLOR_COMMENT;
     }
     if (JSScanner.IsOperator(token))
     {
         return TokenColor.COLOR_OPERATOR;
     }
     return TokenColor.COLOR_TEXT;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:TokenColorInfo.cs

示例3: Colorize

 public virtual ITokenEnumerator Colorize(string sourceCode, SourceState state)
 {
     TokenColorInfoList list = new TokenColorInfoList();
     this._state = SourceState.STATE_COLOR_NORMAL;
     if (sourceCode.Length > 0)
     {
         Context sourceContext = new Context(null, sourceCode);
         this._scanner.SetSource(sourceContext);
         try
         {
             if (SourceState.STATE_COLOR_COMMENT == state)
             {
                 int length = this._scanner.SkipMultiLineComment();
                 if (length > sourceCode.Length)
                 {
                     this._state = SourceState.STATE_COLOR_COMMENT;
                     length = sourceCode.Length;
                 }
                 list.Add(sourceContext);
                 if (length == sourceCode.Length)
                 {
                     return list;
                 }
             }
             this._scanner.GetNextToken();
             JSToken none = JSToken.None;
             while (sourceContext.GetToken() != JSToken.EndOfFile)
             {
                 list.Add(sourceContext);
                 none = sourceContext.GetToken();
                 this._scanner.GetNextToken();
             }
             if (JSToken.UnterminatedComment == none)
             {
                 this._state = SourceState.STATE_COLOR_COMMENT;
             }
         }
         catch (ScannerException)
         {
         }
     }
     return list;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:43,代码来源:JSColorizer.cs


注:本文中的Microsoft.JScript.Context.GetToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。