Example #1
0
 private void buildTextStruct(int nextState, PonyToken token)
 {
     if (currentState == 10 && currentState == nextState)
     {
         builder.AddLiteral(token);
     }
     else if (currentState == 0 && nextState == 10)
     {
         builder.TryStartParagraph(token);
     }
     else if (nextState == 5)
     {
         builder.StartFormatableMarcoStruct(token);
     }
     else if (currentState == 1 && nextState == 2)
     {
         builder.TryStartParagraph(token.DeriveEmptyToken());
     }
     else if (currentState == 6 && nextState == 3)
     {
         builder.StartDirective(token);
     }
     else if (currentState == 1 && nextState == 4)
     {
         builder.StartDirectiveBlock(token.DeriveEmptyToken());
     }
     else if (nextState == 8)
     {
         tokenAsKey = token.Text.Trim('"');
     }
     else if (currentState == 9 && nextState == 7)
     {
         if (token.TokenType == PonyTokenType.ID)
         {
             builder.AddMarcoMapping(tokenAsKey, token);
         }
         else if (token.TokenType == PonyTokenType.NUMBER)
         {
             builder.AddNumMapping(tokenAsKey, token);
         }
         else if (token.TokenType == PonyTokenType.QUOTE)
         {
             builder.AddLiteralMapping(tokenAsKey, token);
         }
     }
     else if ((currentState == 5 || currentState == 3) && nextState == 4)
     {
         builder.EndCurrentContext();
     }
     else if (currentState == 10 && nextState == 0)
     {
         builder.EndCurrentContext();
     }
     else if (currentState == 3)
     {
         if (token.TokenType == PonyTokenType.ID)
         {
             builder.AddMarco(token);
         }
         else if (token.TokenType == PonyTokenType.NUMBER)
         {
             builder.AddNumber(token);
         }
         else if (token.TokenType == PonyTokenType.LITERAL)
         {
             builder.AddLiteral(token);
         }
         else if (token.TokenType == PonyTokenType.QUOTE)
         {
             builder.AddLiteral(token);
         }
     }
 }