Skip to content

Commit

Permalink
rename lexedtokens to lexer, and fix module to be more idiomatic
Browse files Browse the repository at this point in the history
  • Loading branch information
oysandvik94 committed Aug 20, 2024
1 parent b609370 commit bd0f702
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
8 changes: 3 additions & 5 deletions crates/interpreter/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ pub mod return_statement;
use std::fmt::Display;

use expressions::expression_statement;
use lexer::{token::TokenKind, Lexer};
use parse_errors::ParseErrorKind;
use tracing::{event, span, Level};

use crate::{
parser::assign_statement::AssignStatement,
parser::ast::Statement,
parser::lexer::{lexedtokens::Lexer, token::TokenKind},
parser::parse_errors::ParseError,
parser::return_statement::ReturnStatement,
parser::assign_statement::AssignStatement, parser::ast::Statement,
parser::parse_errors::ParseError, parser::return_statement::ReturnStatement,
};

pub struct Parser<'a> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
use std::str::Chars;

use token::{HasInfix, Location, Precedence, Token, TokenKind};
use tracing::{event, Level};

pub mod token;

use crate::parser::{
ast::Identifier,
parse_errors::{ParseError, ParseErrorKind},
};

use super::token::{HasInfix, Location, Precedence, Token, TokenKind};

#[derive(Debug)]
pub struct Lexer<'a> {
chars: Chars<'a>,
Expand Down Expand Up @@ -340,10 +341,9 @@ impl<'a> Lexer<'a> {

#[cfg(test)]
mod tests {
use crate::{
parser::lexer::{lexedtokens::Lexer, token::TokenKind},
test_util,
};
use crate::test_util;

use super::{token::TokenKind, Lexer};

#[test]
fn parse_sympols() {
Expand Down
2 changes: 0 additions & 2 deletions crates/interpreter/src/parser/lexer/mod.rs

This file was deleted.

2 changes: 1 addition & 1 deletion crates/interpreter/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
expressions::{
expression::Expression, functions::FunctionLiteral, if_expression::IfExpression,
},
lexer::{lexedtokens::Lexer, token::Token},
lexer::{token::Token, Lexer},
ParsedProgram, Parser,
},
vm::VirtualMachine,
Expand Down

0 comments on commit bd0f702

Please sign in to comment.