Restructure project

Signed-off-by: trivernis <trivernis@protonmail.com>
develop
trivernis 4 years ago
parent e5dac6bdba
commit 1eb5897e4e
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -1,8 +1,9 @@
pub mod error; pub mod matching;
pub mod input_reader; pub mod tokenizing;
pub mod lexer; mod utils;
pub mod token;
pub mod token_reader; pub use utils::error::*;
pub use utils::input_reader::InputReader;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;

@ -1,5 +1,5 @@
use crate::error::{TapeError, TapeResult}; use crate::InputReader;
use crate::input_reader::InputReader; use crate::{TapeError, TapeResult};
use std::io::Cursor; use std::io::Cursor;
fn get_reader() -> InputReader { fn get_reader() -> InputReader {

@ -1,7 +1,7 @@
use crate::error::TapeResult; use crate::tokenizing::Lexer;
use crate::input_reader::InputReader; use crate::tokenizing::{Token, TokenCheckerFn, UnknownToken};
use crate::lexer::Lexer; use crate::InputReader;
use crate::token::{Token, TokenCheckerFn, UnknownToken}; use crate::TapeResult;
use std::io::Cursor; use std::io::Cursor;
use std::sync::Arc; use std::sync::Arc;

@ -1,6 +1,6 @@
use crate::error::TapeResult; use crate::tokenizing::Token;
use crate::input_reader::InputReader; use crate::InputReader;
use crate::token::Token; use crate::TapeResult;
use std::io::Cursor; use std::io::Cursor;
#[derive(Debug)] #[derive(Debug)]

@ -1,5 +1,5 @@
use crate::token::{EOFToken, Token}; use crate::tokenizing::TokenReader;
use crate::token_reader::TokenReader; use crate::tokenizing::{EOFToken, Token};
struct AToken; struct AToken;
struct BToken; struct BToken;

@ -1,6 +1,6 @@
use crate::error::TapeResult; use crate::tokenizing::{EOFToken, Token, TokenCheckerFn, UnknownToken};
use crate::input_reader::InputReader; use crate::InputReader;
use crate::token::{EOFToken, Token, TokenCheckerFn, UnknownToken}; use crate::TapeResult;
pub struct Lexer { pub struct Lexer {
reader: InputReader, reader: InputReader,
@ -13,7 +13,7 @@ impl Lexer {
Self { reader, checkers } Self { reader, checkers }
} }
/// Scans for tokens /// Scans for tokenizing
pub async fn scan(&mut self) -> TapeResult<Vec<Token>> { pub async fn scan(&mut self) -> TapeResult<Vec<Token>> {
let mut tokens = Vec::new(); let mut tokens = Vec::new();

@ -0,0 +1,7 @@
mod lexer;
mod token;
mod token_reader;
pub use lexer::Lexer;
pub use token::*;
pub use token_reader::TokenReader;

@ -1,5 +1,5 @@
use crate::error::TapeResult; use crate::InputReader;
use crate::input_reader::InputReader; use crate::TapeResult;
use std::any::{Any, TypeId}; use std::any::{Any, TypeId};
use std::future::Future; use std::future::Future;
use std::pin::Pin; use std::pin::Pin;

@ -1,4 +1,4 @@
use crate::token::{EOFToken, Token}; use crate::tokenizing::{EOFToken, Token};
pub struct TokenReader { pub struct TokenReader {
tokens: Vec<Token>, tokens: Vec<Token>,

@ -1,4 +1,4 @@
use crate::error::{TapeError, TapeResult}; use crate::{TapeError, TapeResult};
use std::io::ErrorKind; use std::io::ErrorKind;
use tokio::io::{AsyncBufRead, AsyncBufReadExt}; use tokio::io::{AsyncBufRead, AsyncBufReadExt};

@ -0,0 +1,2 @@
pub mod error;
pub mod input_reader;
Loading…
Cancel
Save