MCPcopy Index your code
hub / github.com/endbasic/endbasic / parse_goto

Method parse_goto

core/src/parser.rs:1037–1049  ·  view source on GitHub ↗

Parses a `GOTO` statement.

(&mut self)

Source from the content-addressed store, hash-verified

1035
1036 /// Parses a `GOTO` statement.
1037 fn parse_goto(&mut self) -> Result<Statement> {
1038 let token_span = self.lexer.read()?;
1039 match token_span.token {
1040 Token::Integer(i) => {
1041 let target = format!("{}", i);
1042 Ok(Statement::Goto(GotoSpan { target, target_pos: token_span.pos }))
1043 }
1044 Token::Label(target) => {
1045 Ok(Statement::Goto(GotoSpan { target, target_pos: token_span.pos }))
1046 }
1047 _ => Err(Error::Bad(token_span.pos, "Expected label name after GOTO".to_owned())),
1048 }
1049 }
1050
1051 /// Parses the branches of a uniline `IF` statement.
1052 fn parse_if_uniline(&mut self, branches: &mut Vec<IfBranchSpan>) -> Result<()> {

Callers 2

parse_unilineMethod · 0.80
parse_oneMethod · 0.80

Calls 1

readMethod · 0.45

Tested by

no test coverage detected