From d2f2ba36a50c501f84c39c5cfab866a8e0fe9808 Mon Sep 17 00:00:00 2001 From: nikeedev Date: Wed, 6 Dec 2023 10:36:04 +0100 Subject: [PATCH] up --- .idea/.gitignore | 8 ++++++++ .idea/modules.xml | 8 ++++++++ .idea/rain-lang.iml | 11 +++++++++++ .idea/vcs.xml | 6 ++++++ src/main.rs | 11 +++++------ src/rain/mod.rs | 19 ++++++++++++------- 6 files changed, 50 insertions(+), 13 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/modules.xml create mode 100644 .idea/rain-lang.iml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..31cb9b1 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/rain-lang.iml b/.idea/rain-lang.iml new file mode 100644 index 0000000..cf84ae4 --- /dev/null +++ b/.idea/rain-lang.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index e39b461..96f3c9e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,14 +30,13 @@ fn main() { let tokens = lexer.tokens; for token in tokens { - println!("{:#?}", token); + // println!("{:#?}", token); } - // let idents: Vec = lexer.idents; + let idents = lexer.idents; - // for ident in &idents { - // println!("{:#?}", ident); - // } + for ident in &idents { + println!("{:#?}", ident); + } - // lex(src_raw) } diff --git a/src/rain/mod.rs b/src/rain/mod.rs index 289ea62..f85de51 100644 --- a/src/rain/mod.rs +++ b/src/rain/mod.rs @@ -9,13 +9,12 @@ pub enum TokenType { Comment, // // String { is_terminated: bool }, - Dot, // for getting variables and functions out of structs or, - // defining a float + Dot, // 0.0f (floats), struct.name (for getting properties or doing function calls from something) Function, // () {} Ident, // x : = - If, - Else, - For, + If, // if + Else, // else / else if + For, // for Plus, // + Minus, // - @@ -172,12 +171,18 @@ impl<'a> Lexer<'a> { ',' => TokenType::Comma, '>' => match self.peek() { - '=' => TokenType::EqualsGreaterThan, // >= + '=' => { + self.bump(); + TokenType::EqualsGreaterThan // >= + }, _ => TokenType::GreaterThan, // > }, '<' => match self.peek() { - '=' => TokenType::EqualsLessThan, // <= + '=' => { + self.bump(); + TokenType::EqualsLessThan // <= + }, _ => TokenType::LessThan, // < },