| 30 | } |
| 31 | |
| 32 | Span<const char> Expr(Span<const char>& sp) |
| 33 | { |
| 34 | int level = 0; |
| 35 | auto it = sp.begin(); |
| 36 | while (it != sp.end()) { |
| 37 | if (*it == '(' || *it == '{') { |
| 38 | ++level; |
| 39 | } else if (level && (*it == ')' || *it == '}')) { |
| 40 | --level; |
| 41 | } else if (level == 0 && (*it == ')' || *it == '}' || *it == ',')) { |
| 42 | break; |
| 43 | } |
| 44 | ++it; |
| 45 | } |
| 46 | Span<const char> ret = sp.first(it - sp.begin()); |
| 47 | sp = sp.subspan(it - sp.begin()); |
| 48 | return ret; |
| 49 | } |
| 50 | |
| 51 | std::vector<Span<const char>> Split(const Span<const char>& sp, char sep) |
| 52 | { |