Clean up location handling, which wsa kind of a pain.

This commit is contained in:
2023-01-12 18:06:06 -08:00
parent 228f447a06
commit 2e82fcf343
15 changed files with 217 additions and 179 deletions

View File

@@ -2,6 +2,7 @@ use internment::ArcIntern;
use logos::{Lexer, Logos};
use std::fmt;
use std::num::ParseIntError;
use thiserror::Error;
#[derive(Logos, Clone, Debug, PartialEq, Eq)]
pub enum Token {
@@ -54,6 +55,12 @@ impl fmt::Display for Token {
}
}
#[derive(Debug, Error, PartialEq, Eq)]
pub enum LexerError {
#[error("Failed lexing at {0}")]
LexFailure(usize),
}
#[cfg(test)]
impl Token {
pub(crate) fn var(s: &str) -> Token {