risingwave_sqlparser/parser_v2/
compact.rs1use winnow::{ModalResult, Stateful};
16
17use crate::parser as parser_v1;
18
19pub trait ParseV1 {
20 fn parse_v1<F, O>(&mut self, f: F) -> ModalResult<O>
21 where
22 for<'a> F: FnOnce(&mut parser_v1::Parser<'a>) -> ModalResult<O>;
23}
24
25impl<'a> ParseV1 for parser_v1::Parser<'a> {
26 fn parse_v1<F, O>(&mut self, f: F) -> ModalResult<O>
27 where
28 F: FnOnce(&mut parser_v1::Parser<'a>) -> ModalResult<O>,
29 {
30 f(self)
31 }
32}
33
34impl<S, State> ParseV1 for Stateful<S, State>
35where
36 S: ParseV1,
37{
38 fn parse_v1<F, O>(&mut self, f: F) -> ModalResult<O>
39 where
40 for<'a> F: FnOnce(&mut parser_v1::Parser<'a>) -> ModalResult<O>,
41 {
42 self.input.parse_v1(f)
43 }
44}