| 47 | |
| 48 | template <typename Input> |
| 49 | StatusOr<std::unique_ptr<parse_tree::node>> ParseToTree(Input&& in) { |
| 50 | if (auto root = parse_tree::parse<seq<SearchStmt, eof>, TreeSelector>(std::forward<Input>(in))) { |
| 51 | return root; |
| 52 | } else { |
| 53 | // TODO: improve parse error message, with source location |
| 54 | return {Status::NotOK, "invalid syntax"}; |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | struct Transformer : ir::TreeTransformer { |
| 59 | explicit Transformer(const ParamMap& param_map) : TreeTransformer(param_map) {} |