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

Function parse_operand

src/expr-parser/src/parser.rs:958–989  ·  view source on GitHub ↗
(input: ParseStream)

Source from the content-addressed store, hash-verified

956 }
957
958 pub fn parse_operand(input: ParseStream) -> Result {
959 let lookahead = input.lookahead1();
960 if lookahead.peek(syn::Token![#]) {
961 parse_column(input)
962 } else if lookahead.peek(syn::Lit) || lookahead.peek(kw::null) {
963 parse_literal_ok(input)
964 } else if lookahead.peek(kw::error) {
965 parse_literal_err(input)
966 } else if lookahead.peek(kw::array) {
967 parse_array(input)
968 } else if lookahead.peek(kw::list) {
969 parse_list(input)
970 } else if lookahead.peek(kw::case) {
971 parse_case(input)
972 } else if lookahead.peek(syn::Ident) {
973 parse_apply(input)
974 } else if lookahead.peek(syn::token::Brace) {
975 let inner;
976 syn::braced!(inner in input);
977 parse_literal_array(&inner)
978 } else if lookahead.peek(syn::token::Bracket) {
979 let inner;
980 syn::bracketed!(inner in input);
981 parse_literal_list(&inner)
982 } else if lookahead.peek(syn::token::Paren) {
983 let inner;
984 syn::parenthesized!(inner in input);
985 parse_expr(&inner)
986 } else {
987 Err(lookahead.error())
988 }
989 }
990
991 /// Parses `case when {cond} then {then} else {els} end`.
992 fn parse_case(input: ParseStream) -> Result {

Callers 1

parse_exprFunction · 0.85

Calls 12

parse_columnFunction · 0.85
parse_literal_okFunction · 0.85
parse_literal_errFunction · 0.85
parse_caseFunction · 0.85
parse_applyFunction · 0.85
parse_literal_arrayFunction · 0.85
parse_literal_listFunction · 0.85
parse_arrayFunction · 0.70
parse_listFunction · 0.70
parse_exprFunction · 0.70
peekMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected