Guest User

Untitled

a guest
Jun 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. object Integer cond;
  2. object Statement_Parse_1 IF_Block;
  3.  
  4. m.Get_Next_Non_Separator_Token (str, token_text, token_kind); // Get the condition
  5. assert(token_kind == CONDITION, "Expected condition after keyword 'IF'.");
  6. Parse_Condition (token_text, cond); // Parse condition
  7. m.Get_Next_Non_Separator_Token (str, token_text, token_kind); // Trash "THEN" token
  8. assert(token_text.Is_Equal_To("THEN"), "Expected keyword 'THEN' after condition.");
  9. m.Get_Next_Non_Separator_Token (str, token_text, token_kind);// Get
  10. // next token(block)
  11. IF_Block.Parse_Block(str, m, token_text, token_kind);
  12. //Parses the IF which should then give us ELSE or END
  13. if (token_text == "ELSE")
  14. {
  15. object Statement_Parse_1 ELSE_Block;
  16. m.Get_Next_Non_Separator_Token(str, token_text, token_kind);
  17. ELSE_Block.Parse_Block (str, m, token_text, token_kind);//Should give us END token
  18. assert(token_text.Is_Equal_To("END"), "Expected keyword 'END' after IF Block.");
  19. m.Get_Next_Non_Separator_Token (str, token_text, token_kind); // Trash IF token
  20. assert(token_text.Is_Equal_To("IF"), "Expected keyword 'IF' after 'END'.");
  21. m.Get_Next_Non_Separator_Token (str, token_text, token_kind); // Get next
  22. // usable token
  23. stmnt.Compose_If_Else (cond, IF_Block, ELSE_Block); //Compose IF_ELSE
  24. }
  25. else
  26. {
  27. assert(token_text.Is_Equal_To("END"), "Expected keyword 'END' after If Block.");
  28. m.Get_Next_Non_Separator_Token (str, token_text, token_kind); // Trash IF token
  29. assert(token_text.Is_Equal_To("IF"), "Expected keyword 'IF' after 'END'.");
  30. stmnt.Compose_If (cond, IF_Block); // Compose IF
  31. m.Get_Next_Non_Separator_Token (str, token_text, token_kind); //Get next token
  32. }
  33. }
Add Comment
Please, Sign In to add comment