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


C# MemoryStream.TryMatch方法代码示例

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


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

示例1: MatchCurlyBraces

 private void MatchCurlyBraces(MemoryStream<JavaToken> ts)
 {
     while (!ts.TryMatch(t => t.Type == JavaTokenType.Operator && t.Value == "}"))
         if (ts.TryMatch(t => t.Type == JavaTokenType.Operator && t.Value == "{"))
             MatchCurlyBraces(ts);
         else
             ts.Read();
 }
开发者ID:Shraddha512,项目名称:ICSE-2011-FireDetective,代码行数:8,代码来源:JavaMethodBlock.cs

示例2: ParseClassBody

 private void ParseClassBody(MemoryStream<JavaToken> ts)
 {
     while (!ts.TryMatch(t => t.Type == JavaTokenType.Operator && t.Value == "}"))
     {
         int pos = ts.Position;
         if (ts.TryMatch(t => t.Type == JavaTokenType.Operator && t.Value == "{"))
             MatchCurlyBraces(ts);
         else if (ts.TryMatch(t => t.Type == JavaTokenType.Keyword && (t.Value == "public" || t.Value == "protected" || t.Value == "private")))
             ParsePossibleMethod(ts, pos);
         else
             ts.Read();
     }
 }
开发者ID:Shraddha512,项目名称:ICSE-2011-FireDetective,代码行数:13,代码来源:JavaMethodBlock.cs

示例3: ParsePossibleMethod

 private void ParsePossibleMethod(MemoryStream<JavaToken> ts, int pos)
 {
     while (!ts.TryMatch(t => t.Type == JavaTokenType.Operator && t.Value == ";"))
     {
         if (ts.TryMatch(t => t.Type == JavaTokenType.Operator && t.Value == "{"))
         {
             MatchCurlyBraces(ts);
             m_MethodBlocks.Add(new JavaMethodBlock(new SimpleTextSpan(m_Tokens[pos].Location.Start, m_Tokens[ts.Position - 1].Location.End)));
             return;
         }
         else
             ts.Read();
     }
 }
开发者ID:Shraddha512,项目名称:ICSE-2011-FireDetective,代码行数:14,代码来源:JavaMethodBlock.cs

示例4: TryParseLVar

 protected JavaScriptBlock TryParseLVar(MemoryStream<JavaScriptToken> ts)
 {
     int before = ts.Position;
     if (ts.TryMatch((token) => token.Type == JavaScriptTokenType.Identifier))
     {
         JavaScriptBlock block = new JavaScriptBlock(before, JavaScriptBlockType.LVar, this, m_TopLevel, m_Tokens);
         while (true)
         {
             while (block.TryParseBrackets(ts, "[", "]") != null)
                 ;
             if (!ts.TryMatch((token) => token.Type == JavaScriptTokenType.Operator && token.Value == "."))
                 break;
             if (!ts.TryMatch((token) => token.Type == JavaScriptTokenType.Identifier))
                 break;
         }
         block.m_SubBlocks.Clear(); // Don't want sub blocks in LVar blocks.
         AddBlock(block, ts);
         return block;
     }
     return null;
 }
开发者ID:Shraddha512,项目名称:ICSE-2011-FireDetective,代码行数:21,代码来源:JavaScriptBlock.cs

示例5: TryParseFunction

 protected JavaScriptBlock TryParseFunction(MemoryStream<JavaScriptToken> ts)
 {
     int before = ts.Position;
     if (ts.TryMatch((token) => token.Type == JavaScriptTokenType.Keyword && token.Value == "function"))
     {
         JavaScriptBlock block = new JavaScriptBlock(before, JavaScriptBlockType.Function, this, m_TopLevel, m_Tokens);
         block.TryMatchComments(ts);
         block.TryParseLVar(ts); // Too generic for optional function name, but never mind
         block.TryMatchComments(ts);
         block.TryParseBrackets(ts, "(", ")");
         block.TryMatchComments(ts);
         block.m_FunctionBody = block.TryParseBrackets(ts, "{", "}");
         AddBlock(block, ts);
         return block;
     }
     return null;
 }
开发者ID:Shraddha512,项目名称:ICSE-2011-FireDetective,代码行数:17,代码来源:JavaScriptBlock.cs

示例6: TryParseBrackets

 protected JavaScriptBlock TryParseBrackets(MemoryStream<JavaScriptToken> ts, string ch, string endCh)
 {
     int before = ts.Position;
     if (ts.TryMatch((token) => token.Type == JavaScriptTokenType.Operator && token.Value == ch))
     {
         JavaScriptBlock block = new JavaScriptBlock(before, JavaScriptBlockType.Brackets, this, m_TopLevel, m_Tokens);
         block.TryParseAny(ts, (token) => token.Type == JavaScriptTokenType.Operator && token.Value == endCh);
         ts.Read();
         AddBlock(block, ts);
         return block;
     }
     return null;
 }
开发者ID:Shraddha512,项目名称:ICSE-2011-FireDetective,代码行数:13,代码来源:JavaScriptBlock.cs

示例7: TryMatchComments

 protected void TryMatchComments(MemoryStream<JavaScriptToken> ts)
 {
     while (ts.TryMatch(token => token.Type == JavaScriptTokenType.Comment || token.Type == JavaScriptTokenType.MultiLineComment))
         ;
 }
开发者ID:Shraddha512,项目名称:ICSE-2011-FireDetective,代码行数:5,代码来源:JavaScriptBlock.cs

示例8: ParseStream

 private void ParseStream(MemoryStream<JavaToken> ts)
 {
     while (true)
     {
         if (ts.TryMatch(t => t.Type == JavaTokenType.Keyword && t.Value == "class"))
             ParseClass(ts);
         else
             ts.Read();
     }
 }
开发者ID:Shraddha512,项目名称:ICSE-2011-FireDetective,代码行数:10,代码来源:JavaMethodBlock.cs

示例9: ParseClass

 private void ParseClass(MemoryStream<JavaToken> ts)
 {
     while (!ts.TryMatch(t => t.Type == JavaTokenType.Operator && t.Value == "{"))
         ts.Read();
     ParseClassBody(ts);
 }
开发者ID:Shraddha512,项目名称:ICSE-2011-FireDetective,代码行数:6,代码来源:JavaMethodBlock.cs


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