| 1642 | } |
| 1643 | |
| 1644 | command_exit parser:: |
| 1645 | parse_command_exit (token& t, type& tt) |
| 1646 | { |
| 1647 | // enter: equal/not_equal |
| 1648 | // leave: token after exit status (one parse_names() chunk) |
| 1649 | |
| 1650 | exit_comparison comp (tt == type::equal |
| 1651 | ? exit_comparison::eq |
| 1652 | : exit_comparison::ne); |
| 1653 | |
| 1654 | // The next chunk should be the exit status. |
| 1655 | // |
| 1656 | next (t, tt); |
| 1657 | location l (get_location (t)); |
| 1658 | names ns (parse_names (t, tt, |
| 1659 | pattern_mode::ignore, |
| 1660 | true, |
| 1661 | "exit status", |
| 1662 | nullptr)); |
| 1663 | unsigned long es (256); |
| 1664 | |
| 1665 | if (!pre_parse_) |
| 1666 | { |
| 1667 | try |
| 1668 | { |
| 1669 | if (ns.size () == 1 && ns[0].simple () && !ns[0].empty ()) |
| 1670 | es = stoul (ns[0].value); |
| 1671 | } |
| 1672 | catch (const exception&) {} // Fall through. |
| 1673 | |
| 1674 | if (es > 255) |
| 1675 | { |
| 1676 | diag_record dr (fail (l)); |
| 1677 | |
| 1678 | dr << "expected exit status instead of "; |
| 1679 | to_stream (dr.os, ns, quote_mode::normal); |
| 1680 | |
| 1681 | dr << info << "exit status is an unsigned integer less than 256"; |
| 1682 | } |
| 1683 | } |
| 1684 | |
| 1685 | return command_exit {comp, static_cast<uint8_t> (es)}; |
| 1686 | } |
| 1687 | |
| 1688 | void parser:: |
| 1689 | parse_here_documents (token& t, type& tt, |
nothing calls this directly
no test coverage detected