MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / parse_window_frame_bound

Method parse_window_frame_bound

src/sql-parser/src/parser.rs:926–943  ·  view source on GitHub ↗

Parse `CURRENT ROW` or `{ | UNBOUNDED } { PRECEDING | FOLLOWING }`

(&mut self)

Source from the content-addressed store, hash-verified

924
925 /// Parse `CURRENT ROW` or `{ <positive number> | UNBOUNDED } { PRECEDING | FOLLOWING }`
926 fn parse_window_frame_bound(&mut self) -> Result<WindowFrameBound, ParserError> {
927 if self.parse_keywords(&[CURRENT, ROW]) {
928 Ok(WindowFrameBound::CurrentRow)
929 } else {
930 let rows = if self.parse_keyword(UNBOUNDED) {
931 None
932 } else {
933 Some(self.parse_literal_uint()?)
934 };
935 if self.parse_keyword(PRECEDING) {
936 Ok(WindowFrameBound::Preceding(rows))
937 } else if self.parse_keyword(FOLLOWING) {
938 Ok(WindowFrameBound::Following(rows))
939 } else {
940 self.expected(self.peek_pos(), "PRECEDING or FOLLOWING", self.peek_token())
941 }
942 }
943 }
944
945 fn parse_case_expr(&mut self) -> Result<Expr<Raw>, ParserError> {
946 let mut operand = None;

Callers 1

parse_window_frameMethod · 0.80

Calls 6

parse_keywordsMethod · 0.80
parse_keywordMethod · 0.80
parse_literal_uintMethod · 0.80
expectedMethod · 0.80
peek_posMethod · 0.80
peek_tokenMethod · 0.80

Tested by

no test coverage detected