| 1582 | } |
| 1583 | |
| 1584 | bool ParseWhileExpr(Lexeme** str) |
| 1585 | { |
| 1586 | if(!ParseLexem(str, lex_while)) |
| 1587 | return false; |
| 1588 | |
| 1589 | IncreaseCycleDepth(); |
| 1590 | if(!ParseLexem(str, lex_oparen)) |
| 1591 | ThrowError((*str)->pos, "ERROR: '(' not found after 'while'"); |
| 1592 | |
| 1593 | const char *condPos = (*str)->pos; |
| 1594 | if(!ParseVaribleSet(str)) |
| 1595 | ThrowError((*str)->pos, "ERROR: expression expected after 'while('"); |
| 1596 | if(!ParseLexem(str, lex_cparen)) |
| 1597 | ThrowError((*str)->pos, "ERROR: closing ')' not found after expression in 'while' statement"); |
| 1598 | |
| 1599 | if(!ParseExpression(str)) |
| 1600 | { |
| 1601 | if(!ParseLexem(str, lex_semicolon)) |
| 1602 | ThrowError((*str)->pos, "ERROR: expression or ';' expected after 'while(...)'"); |
| 1603 | AddVoidNode(); |
| 1604 | } |
| 1605 | AddWhileNode(condPos); |
| 1606 | return true; |
| 1607 | } |
| 1608 | |
| 1609 | bool ParseDoWhileExpr(Lexeme** str) |
| 1610 | { |
no test coverage detected