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


C# ISourceStream.CreateErrorToken方法代码示例

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


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

示例1: TryMatch

        public override Token TryMatch(ParsingContext context, ISourceStream source)
        {
            Token result;
            if (context.VsLineScanState.Value != 0)
            {
                byte commentLevel = context.VsLineScanState.TokenSubType;
                result = CompleteMatch(context, source, commentLevel);
            }
            else
            {
                //we are starting from scratch
                byte commentLevel = 0;
                if (!BeginMatch(context, source, ref commentLevel))
                    return null;

                result = CompleteMatch(context, source, commentLevel);
            }

            if (result != null)
                return result;

            if (context.Mode == ParseMode.VsLineScan)
                return CreateIncompleteToken(context, source);

            return source.CreateErrorToken("Unclosed comment block");
        }
开发者ID:guillaume86,项目名称:vsLua,代码行数:26,代码来源:LuaBlockCommentTerminal.cs

示例2: TryMatch

 public override Token TryMatch(ParsingContext context, ISourceStream source) {
   try {
     var textValue = ReadBody(context, source);
     if (textValue == null) return null; 
     var value = ConvertValue(context, textValue);
     return source.CreateToken(this.OutputTerminal, value);
   } catch(Exception ex) {
     //we throw exception in DsvLiteral when we cannot find a closing quote for quoted value
     return source.CreateErrorToken(ex.Message);
   }
 }//method
开发者ID:cg123,项目名称:xenko,代码行数:11,代码来源:DataLiteralBase.cs

示例3: TryMatch

 public override Token TryMatch(ParsingContext context, ISourceStream source) {
   Token result;
   if (context.VsLineScanState.Value != 0) {
     // we are continuing in line mode - restore internal env (none in this case)
     context.VsLineScanState.Value = 0;
   } else {
     //we are starting from scratch
     if (!BeginMatch(context, source)) return null;
   }
   result = CompleteMatch(context, source);
   if (result != null) return result;
   //if it is LineComment, it is ok to hit EOF without final line-break; just return all until end.
   if (_isLineComment)
     return source.CreateToken(this.OutputTerminal);
   if (context.Mode == ParseMode.VsLineScan)
     return CreateIncompleteToken(context, source);
   return source.CreateErrorToken(O2_Misc_Microsoft_MPL_Libs.Irony_Parser.Resources.ErrUnclosedComment);
 }
开发者ID:o2platform,项目名称:O2.Platform.Projects,代码行数:18,代码来源:CommentTerminal.cs

示例4: TryMatch

    public override Token TryMatch(ParsingContext context, ISourceStream source) {
      // Quick check
      var lookAhead = source.PreviewChar;
      var startIndex = _startSymbolsFirsts.IndexOf(lookAhead);
      if (startIndex < 0)
        return null;

      // Match start symbols
      if (!BeginMatch(source, startIndex, lookAhead))
        return null;

      // Match NewLine
      var result = CompleteMatch(source);
      if (result != null)
        return result;

      // Report an error
      return source.CreateErrorToken(Resources.ErrNewLineExpected);
    }
开发者ID:cg123,项目名称:xenko,代码行数:19,代码来源:LineContinuationTerminal.cs

示例5: TryMatchContentSimple

 private Token TryMatchContentSimple(ParsingContext context, ISourceStream source)
 {
     var startPos = source.PreviewPosition;
       int p = source.Text.IndexOf(_singleTerminator, startPos, Grammar.StringComparisonMode);
       if (p < 0 && IsSet(FreeTextOptions.AllowEof))
     p = source.Text.Length;
       if (p < 0)
     return source.CreateErrorToken(Resources.ErrFreeTextNoEndTag, _singleTerminator);
       var tokenText = source.Text.Substring(startPos, p - startPos);
       return source.CreateToken(this.OutputTerminal, tokenText);
 }
开发者ID:guillaume86,项目名称:vsLua,代码行数:11,代码来源:FreeTextLiteral.cs


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