MCPcopy Create free account
hub / github.com/AlenVelocity/MeowScript / parse_params

Method parse_params

src/parser.rs:492–524  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

490 }
491
492 fn parse_params(&mut self) -> Option<Vec<Ident>> {
493 let mut idents: Vec<Ident> = vec![];
494 if self.peek_token(&Token::RightParen) {
495 self.next_token();
496 return Some(idents);
497 }
498
499 self.next_token();
500 match self.current_token {
501 Token::Ident(ref mut ident) => idents.push(Ident(ident.clone())),
502 _ => {
503 self.errors.push(
504 format!("Meow! Expected a purr-ameter identifier. Got: {} 🙀", self.current_token)
505 );
506 return None;
507 }
508 };
509
510 while self.peek_token(&Token::Comma) {
511 self.next_token();
512 self.next_token();
513 match self.current_token {
514 Token::Ident(ref mut ident) => idents.push(Ident(ident.clone())),
515 _ => return None,
516 };
517 }
518
519 if !self.expect_peek(Token::RightParen) {
520 return None;
521 }
522
523 Some(idents)
524 }
525
526 fn parse_call_arguments(&mut self) -> Option<Vec<Expr>> {
527 let mut args: Vec<Expr> = vec![];

Callers 1

parse_fn_exprMethod · 0.80

Calls 4

IdentClass · 0.85
peek_tokenMethod · 0.80
expect_peekMethod · 0.80
next_tokenMethod · 0.45

Tested by

no test coverage detected