MCPcopy Create free account
hub / github.com/GPPVM-Project/SkyLC / parse

Method parse

crates/skyl-parser/src/parser.rs:28–53  ·  view source on GitHub ↗
(
        &mut self,
        reporter: Rc<RefCell<CompilerErrorReporter>>,
        tokens: TokenStream,
    )

Source from the content-addressed store, hash-verified

26 }
27
28 pub fn parse(
29 &mut self,
30 reporter: Rc<RefCell<CompilerErrorReporter>>,
31 tokens: TokenStream,
32 ) -> Ast {
33 self.reset_internal_state(tokens);
34
35 self.reporter = reporter.clone();
36
37 let mut statements: Vec<Statement> = Vec::new();
38
39 while !self.is_at_end() {
40 let stmt = self.declaration();
41 match stmt {
42 Ok(s) => statements.push(s),
43 Err(e) => {
44 self.report_error(CompilationError::with_span(e.kind, Some(e.line), e.span));
45 self.synchronize();
46 }
47 }
48 }
49
50 statements.push(Statement::EndCode);
51
52 Ast::new(statements)
53 }
54
55 fn declaration(&mut self) -> Result<Statement, ParseError> {
56 match self.advance().kind {

Callers 3

intMethod · 0.80
floatMethod · 0.80
runMethod · 0.80

Calls 7

cloneMethod · 0.80
declarationMethod · 0.80
synchronizeMethod · 0.80
reset_internal_stateMethod · 0.45
is_at_endMethod · 0.45
pushMethod · 0.45
report_errorMethod · 0.45

Tested by

no test coverage detected