type checking !?!?
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
use std::{iter::Peekable, str::Chars};
|
||||
|
||||
use super::super::ParserMsg;
|
||||
use crate::ir::FilePos;
|
||||
use super::super::{CompilerMsg, FilePos};
|
||||
|
||||
pub struct CharCursor<'a> {
|
||||
chars: Peekable<Chars<'a>>,
|
||||
@@ -15,12 +14,12 @@ impl CharCursor<'_> {
|
||||
self.advance();
|
||||
Some(res)
|
||||
}
|
||||
pub fn expect(&mut self, c: char) -> Result<(), ParserMsg> {
|
||||
pub fn expect(&mut self, c: char) -> Result<(), CompilerMsg> {
|
||||
let next = self.expect_next()?;
|
||||
if next == c {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(ParserMsg::at(
|
||||
Err(CompilerMsg::at(
|
||||
self.prev_pos,
|
||||
format!("unexpected char '{next}'; expected '{c}'"),
|
||||
))
|
||||
@@ -46,8 +45,8 @@ impl CharCursor<'_> {
|
||||
self.next_pos.col += 1;
|
||||
}
|
||||
}
|
||||
pub fn expect_next(&mut self) -> Result<char, ParserMsg> {
|
||||
self.next().ok_or(ParserMsg::unexpected_end())
|
||||
pub fn expect_next(&mut self) -> Result<char, CompilerMsg> {
|
||||
self.next().ok_or(CompilerMsg::unexpected_end())
|
||||
}
|
||||
pub fn next_pos(&self) -> FilePos {
|
||||
self.next_pos
|
||||
|
||||
Reference in New Issue
Block a user