本文整理汇总了C#中TokenStream.Read方法的典型用法代码示例。如果您正苦于以下问题:C# TokenStream.Read方法的具体用法?C# TokenStream.Read怎么用?C# TokenStream.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TokenStream
的用法示例。
在下文中一共展示了TokenStream.Read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindPosition
private static void FindPosition(TokenStream tokenStream, int offset)
{
tokenStream.Position = 0;
if (offset < 0)
return;
while (tokenStream.Position < tokenStream.Length)
{
IToken currentToken = tokenStream.Peek();
if (currentToken.StartOffset <= offset && offset < currentToken.StartOffset + currentToken.Length)
break;
else
tokenStream.Read();
}
}
示例2: GetTokenOutliningAction
public override void GetTokenOutliningAction(TokenStream tokenStream, ref string outliningKey, ref OutliningNodeAction tokenAction)
{
IToken token = tokenStream.Peek();
switch ((token.get_Language().get_Key() + "_" + token.get_Key()))
{
case "CSS_PropertyStartToken":
outliningKey = "CSS_PropertyBlock";
tokenAction = 1;
break;
case "CSS_PropertyEndToken":
outliningKey = "CSS_PropertyBlock";
tokenAction = 2;
break;
case "CSS_CommentStartToken":
outliningKey = "CSS_Comment";
tokenAction = 1;
break;
case "CSS_CommentEndToken":
outliningKey = "CSS_Comment";
tokenAction = 2;
break;
case "JScript_OpenCurlyBraceToken":
outliningKey = "JScript_CodeBlock";
tokenAction = 1;
break;
case "JScript_CloseCurlyBraceToken":
outliningKey = "JScript_CodeBlock";
tokenAction = 2;
break;
case "JScript_MultiLineCommentStartToken":
outliningKey = "JScript_MultiLineComment";
tokenAction = 1;
break;
case "JScript_MultiLineCommentEndToken":
outliningKey = "JScript_MultiLineComment";
tokenAction = 2;
break;
default:
if (tokenAction != 0)
{
if (token.HasFlag(0x40))
{
if ((tokenStream.get_Position() > 0) && (tokenStream.ReadReverse().get_LexicalState().get_Key() == "ASPDirectiveResponseWriteState"))
{
outliningKey = null;
tokenAction = 0;
}
}
else if (token.HasFlag(0x80))
{
tokenStream.Read();
if (!tokenStream.get_IsDocumentEnd() && (tokenStream.Peek().get_LexicalState().get_Key() == "ASPDirectiveResponseWriteState"))
{
outliningKey = null;
tokenAction = 0;
}
}
}
break;
}
}