* Return: -1, length not specified */
| 1631 | * Return: -1, length not specified |
| 1632 | */ |
| 1633 | int Parser::ParseArrayLength() { |
| 1634 | auto hasStatic = ts_.Try(Token::STATIC); |
| 1635 | auto qual = ParseQual(); |
| 1636 | if (0 != qual) |
| 1637 | hasStatic = ts_.Try(Token::STATIC); |
| 1638 | |
| 1639 | if (!hasStatic && ts_.Test(']')) |
| 1640 | return -1; |
| 1641 | |
| 1642 | auto expr = ParseAssignExpr(); |
| 1643 | EnsureInteger(expr); |
| 1644 | auto ret = Evaluator<long>().Eval(expr); |
| 1645 | if (ret < 0) { |
| 1646 | Error(expr, "size of array is negative"); |
| 1647 | } |
| 1648 | return ret; |
| 1649 | } |
| 1650 | |
| 1651 | |
| 1652 | /* |