diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 609a32e..0dca9f7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,27 +2,26 @@ name: Rust on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] env: CARGO_TERM_COLOR: always jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.56 + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: 1.60 - - name: Build - run: cargo +1.56 build --verbose - - name: Run tests - run: cargo + 1.56 test --verbose + - name: Build + run: cargo +1.60 build --verbose + - name: Run tests + run: cargo + 1.60 test --verbose diff --git a/Cargo.lock b/Cargo.lock index ee62476..88de92a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,11 +13,12 @@ dependencies = [ [[package]] name = "home" -version = "0.5.9" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "013e4e6e9134211bb4d6bf53dd8cfb75d9e2715cc33614b9c0827718c6fbe0b8" dependencies = [ - "windows-sys", + "scopeguard", + "winapi", ] [[package]] @@ -43,76 +44,38 @@ version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + [[package]] name = "walterlang" -version = "0.2.0" +version = "0.2.1" dependencies = [ "home", "regex", ] [[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.4" +name = "winapi" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.4" +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] -name = "windows_x86_64_msvc" -version = "0.52.4" +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index 55cdb43..d20a279 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,14 @@ [package] name = "walterlang" -version = "0.2.0" +version = "0.2.1" authors = ["ElectricS01<103579308+ElectricS01@users.noreply.github.com>"] edition = "2021" -rust-version = "1.56" +rust-version = "1.60" description = "WalterLang, an interpreted typeless language built with Rust" repository = "https://github.com/ElectricS01/WalterLang" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -home = "0.5.9" +home = "0.4.2" regex = "1.7.3" diff --git a/example.wltr b/example.wltr index e8a7e2c..681ef8f 100644 --- a/example.wltr +++ b/example.wltr @@ -28,5 +28,13 @@ Um print Print 1 Ok Um print Print 2 Ok Um print 6. Ok Set MultilineVar to This is a multiline variable Ok -Um print MultilineVar +Um print MultilineVar Ok + +// Test functions +Um print 7. Ok +Set TestFunction to +Um print This is a function Ok +Ok + +TestFunction diff --git a/src/main.rs b/src/main.rs index 4807742..2b75ef3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ // main.rs // Created 12/2/2024 -// Modified 26/3/2024 +// Modified 9/4/2024 // Created by ElectricS01 use home::home_dir; @@ -9,8 +9,7 @@ use std::collections::HashMap; use std::env; use std::fs; use std::fs::OpenOptions; -use std::io; -use std::io::Write; +use std::io::{self, Write}; use std::path::Path; fn main() { @@ -120,12 +119,7 @@ fn execute(debug: bool, contents: String, vars: &mut HashMap) { for _i in 0..line.len() { if line[0].trim().is_empty() { break; - } else if "Um" == &*line[0] || "Set" == &*line[0] { - if function == "Um" { - um(read_buffer.split(' ').collect(), vars); - } else if function == "Set" { - set(read_buffer.split(' ').collect(), vars); - } + } else if ("Um" == &*line[0] || "Set" == &*line[0]) && function == String::new() { read_buffer = String::new(); function = line[0].to_string(); } else if "Ok" == &*line[0] && function != "" { @@ -152,6 +146,12 @@ fn execute(debug: bool, contents: String, vars: &mut HashMap) { read_buffer += "\n" } } + + if function == "Um" { + um(read_buffer.split(' ').collect(), vars); + } else if function == "Set" { + set(read_buffer.split(' ').collect(), vars); + } } fn set(line: Vec<&str>, vars: &mut HashMap) {