Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- object Integer cond;
- object Statement_Parse_1 IF_Block;
- m.Get_Next_Non_Separator_Token (str, token_text, token_kind); // Get the condition
- assert(token_kind == CONDITION, "Expected condition after keyword 'IF'.");
- Parse_Condition (token_text, cond); // Parse condition
- m.Get_Next_Non_Separator_Token (str, token_text, token_kind); // Trash "THEN" token
- assert(token_text.Is_Equal_To("THEN"), "Expected keyword 'THEN' after condition.");
- m.Get_Next_Non_Separator_Token (str, token_text, token_kind);// Get
- // next token(block)
- IF_Block.Parse_Block(str, m, token_text, token_kind);
- //Parses the IF which should then give us ELSE or END
- if (token_text == "ELSE")
- {
- object Statement_Parse_1 ELSE_Block;
- m.Get_Next_Non_Separator_Token(str, token_text, token_kind);
- ELSE_Block.Parse_Block (str, m, token_text, token_kind);//Should give us END token
- assert(token_text.Is_Equal_To("END"), "Expected keyword 'END' after IF Block.");
- m.Get_Next_Non_Separator_Token (str, token_text, token_kind); // Trash IF token
- assert(token_text.Is_Equal_To("IF"), "Expected keyword 'IF' after 'END'.");
- m.Get_Next_Non_Separator_Token (str, token_text, token_kind); // Get next
- // usable token
- stmnt.Compose_If_Else (cond, IF_Block, ELSE_Block); //Compose IF_ELSE
- }
- else
- {
- assert(token_text.Is_Equal_To("END"), "Expected keyword 'END' after If Block.");
- m.Get_Next_Non_Separator_Token (str, token_text, token_kind); // Trash IF token
- assert(token_text.Is_Equal_To("IF"), "Expected keyword 'IF' after 'END'.");
- stmnt.Compose_If (cond, IF_Block); // Compose IF
- m.Get_Next_Non_Separator_Token (str, token_text, token_kind); //Get next token
- }
- }
Add Comment
Please, Sign In to add comment