Пример #1
0
 private static StringBuilder CurlyBracket_Statements(Parser psr)
 {
     var status = psr.SaveStatus();
       try
       {
     var sb = new StringBuilder();
     if (psr.GetNextTypeOrUnknown() == TokenType.CurlyBracketOpen)
     {
       sb.Append(psr.Consume());
       sb.Append(psr.LineBreakToken());
       psr.IndentDown();
       sb.Append(psr.DefaultManyStatement());
       if (psr.GetNextTypeOrUnknown() == TokenType.CurlyBracketClose)
       {
     psr.IndentUp();
     sb.Append(psr.IndentToken(@"ParserUtils.CurlyBracket_Statements"));
     sb.Append(psr.Consume());
     return sb;
       }
     }
       }
       catch (ResetException)
       {
       }
       psr.LoadStatus(status);
       throw new ResetException();
 }
Пример #2
0
 private static StringBuilder CurlyBrackets_Exprs(Parser psr)
 {
     var status = psr.SaveStatus();
       try
       {
     var sb = new StringBuilder();
     while (psr.GetNextTypeOrUnknown() == TokenType.CurlyBracketOpen)
     {
       sb.Append(psr.Consume());
       if (psr.GetNextTypeOrUnknown() == TokenType.CurlyBracketClose)
       {
     sb.Append(psr.Consume());
     return sb;
       }
       else
       {
     sb.Append(psr.LineBreakToken());
     psr.IndentDown();
     while (psr.GetNextTypeOrUnknown() != TokenType.CurlyBracketClose)
     {
       sb.Append(psr.IndentToken(@"ParserUtils.CurlyBrackets_Exprs"));
       sb.Append(Expr(psr));
       if (psr.GetNextTextOrEmpty() == @"=")
       {
         sb.Append(psr.SpaceToken());
         sb.Append(psr.Consume());
         sb.Append(psr.SpaceToken());
         sb.Append(Expr(psr));
       }
       if (psr.GetNextTextOrEmpty() == @",")
       {
         sb.Append(psr.Consume());
       }
       sb.Append(psr.LineBreakToken());
     }
     if (psr.GetNextTypeOrUnknown() == TokenType.CurlyBracketClose)
     {
       psr.IndentUp();
       sb.Append(psr.IndentToken(@"ParserUtils.CurlyBrackets_Exprs"));
       sb.Append(psr.Consume());
       return sb;
     }
       }
     }
       }
       catch (ResetException)
       {
       }
       psr.LoadStatus(status);
       throw new ResetException();
 }