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

Method consume_rest_of_line

core/src/lexer.rs:638–652  ·  view source on GitHub ↗

Consumes the remainder of the line and returns the token that was encountered at the end (which may be EOF or end of line).

(&mut self)

Source from the content-addressed store, hash-verified

636 /// Consumes the remainder of the line and returns the token that was encountered at the end
637 /// (which may be EOF or end of line).
638 fn consume_rest_of_line(&mut self) -> io::Result<TokenSpan> {
639 loop {
640 match self.input.next() {
641 None => {
642 let last_pos = self.input.next_pos();
643 return Ok(TokenSpan::new(Token::Eof, last_pos, 0));
644 }
645 Some(Ok(ch_span)) if ch_span.ch == '\n' => {
646 return Ok(TokenSpan::new(Token::Eol, ch_span.pos, 1));
647 }
648 Some(Err(e)) => return Err(e),
649 Some(Ok(_)) => (),
650 }
651 }
652 }
653
654 /// Skips whitespace until it finds the beginning of the next token, and returns its first
655 /// character.

Callers 2

consume_symbolMethod · 0.80
readMethod · 0.80

Calls 2

next_posMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected