MCPcopy Create free account
hub / github.com/Glyphack/enderpy / parse_pattern

Method parse_pattern

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

Source from the content-addressed store, hash-verified

808 }
809
810 fn parse_pattern(&mut self) -> Result<MatchPattern, ParsingError> {
811 let or_pattern = self.parse_or_pattern()?;
812
813 if self.at(Kind::As) {
814 let node = self.start_node();
815 let name = Some(self.cur_token().to_string(self.source));
816 self.bump(Kind::As);
817 Ok(MatchPattern::MatchAs(Box::new(MatchAs {
818 node: self.finish_node(node),
819 pattern: Some(or_pattern),
820 name,
821 })))
822 } else {
823 Ok(or_pattern)
824 }
825 }
826
827 fn parse_or_pattern(&mut self) -> Result<MatchPattern, ParsingError> {
828 let mut patterns = vec![];

Callers 4

parse_group_patternMethod · 0.80
parse_mapping_patternMethod · 0.80
parse_class_patternMethod · 0.80

Calls 8

MatchAsClass · 0.85
parse_or_patternMethod · 0.80
atMethod · 0.80
start_nodeMethod · 0.80
to_stringMethod · 0.80
cur_tokenMethod · 0.80
bumpMethod · 0.80
finish_nodeMethod · 0.80

Tested by

no test coverage detected