Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/ClueLang/Clue
Browse files Browse the repository at this point in the history
  • Loading branch information
Maiori44 committed May 21, 2023
2 parents c1bc669 + 58a6e85 commit c4f2b74
Show file tree
Hide file tree
Showing 11 changed files with 165 additions and 181 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ jobs:
- target: x86_64-unknown-linux-gnu
host_cc: ""
target_cc: ""
- target: i686-unknown-linux-gnu
host_cc: i686-linux-gnu
target_cc: i686-linux-gnu
- target: aarch64-unknown-linux-gnu
host_cc: ""
target_cc: aarch64-linux-gnu
Expand Down
33 changes: 22 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,27 @@ jobs:
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install rust toolchain
uses: actions-rs/toolchain@v1.0.6
with:
default: true
override: true
toolchain: nightly
target: "i686-pc-windows-msvc"
- name: Cache build
uses: Swatinem/rust-cache@v2
- name: Test dev build
run: cargo test
- name: Test release build
run: cargo test --release
- name: Setup
run: |
cargo install cargo-all-features
- name: Check
run: cargo check-all-features
- name: Test core
run: cargo test-all-features
test-wasm:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Cache build
uses: Swatinem/rust-cache@v2
- name: Setup
run: |
rustup target add wasm32-unknown-unknown
cargo install wasm-pack
- name: Test wasm
run: |
cd wasm
wasm-pack test --node
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ makepkg -si
4. Type `clue` in your cmd/PowerShell to run the compiler, it will explain the rest

## More coming soon!
There are still some features that I'm considering adding and others that will be added soon.
There are still features that I'm considering adding and others that will be added soon.
The most likely ones to be added in the future are:
- types (coming in 4.0)
- `async` and `yield` (coming maybe in 3.4)
- `if local` (coming in 3.3)
- better errors (comming in 4.0)
- `async` and `yield` (coming in 3.4)

For any suggestion or bug you can make a github issue.
If you need help with the language itself, you can check out the new [Discord server](https://discord.gg/EQsnWpqN3C).
If you need help with the language itself, you can check out the [Discord server](https://discord.gg/EQsnWpqN3C).

I hope Clue will be useful to you :)

Expand Down
2 changes: 1 addition & 1 deletion core/src/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl CodeChars {
self.code.column
}

/// Returns the number of bytes read by the iterator.
/// Returns the number of bytes read by the iterator since the last time this function was called.
pub fn bytes_read(&mut self) -> usize {
let read = self.code.read;
self.code.read = 0;
Expand Down
10 changes: 5 additions & 5 deletions core/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub enum ContinueMode {
#[default]
#[clap(name = "simple")]
/// Simple: This mode uses the native continue keyword.
/// This can only be used in implementations which support it.
/// This can only be used in implementations which support it (like BLUA).
Simple,

/// DEPRECATED
Expand All @@ -30,11 +30,11 @@ pub enum ContinueMode {
#[clap(name = "goto")]
/// Goto: Clue will use goto continue; and a ::continue:: label when compiling `continue` keywords
/// instead of assuming the version of Lua you're compiling to has a proper continue keyword.
/// This will work with most versions of lua (lua 5.2, luajit, blua)
/// This will work with most versions of Lua (Lua 5.2, LuaJIT).
Goto,

/// Moonscript: This approach is guaranteed to work with any version of lua although
/// it has a performance impact because it uses a loop.
/// Moonscript: This approach is guaranteed to work with any version of Lua although
/// it has a performance impact because it uses an additional loop.
MoonScript,
}

Expand Down Expand Up @@ -125,7 +125,7 @@ pub struct Options {
/// The continue mode to use when compiling `continue` keywords
pub env_continue: ContinueMode,

/// Whether to use rawset(_G, ...) instead of _G.x = ...
/// Whether to use rawset(_G, ...) instead of simply x = ... for globals
pub env_rawsetglobals: bool,

/// Whether to print debug information
Expand Down
28 changes: 16 additions & 12 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
//! This is used by the cli but can also be used by other projects
//! It is recommended to use [`Clue`] instead of the lower level APIs unless you need to
use std::{ffi::OsStr, fmt::Display, fs, path::{Path, PathBuf}};
use std::{
ffi::OsStr,
fmt::Display,
fs,
path::{Path, PathBuf},
};

use code::Code;
use compiler::Compiler;
Expand Down Expand Up @@ -51,14 +56,13 @@ macro_rules! check {
/// assert_eq!(c, "Hello, World!");
/// ```
macro_rules! format_clue {
($($strings:expr),+) => {{
use std::ops::AddAssign;
let mut len_format_clue = 0;
$(len_format_clue.add_assign(AsRef::<str>::as_ref(&$strings).len());)+
let mut output_format_clue = String::with_capacity(len_format_clue);
$(output_format_clue.push_str($strings.as_ref());)+
output_format_clue
}};
($($strings:expr),+) => {{
let vc = [
$($strings.to_string(),)+
];

vc.join("")
}};
}

/// The main Clue library API
Expand Down Expand Up @@ -86,8 +90,8 @@ impl Clue {
/// Sets the `struct` option
/// If `struct` is `true` then then the `struct` option will be enabled
/// If `struct` is `false` then then the `struct` option will be disabled
pub fn env_struct(&mut self, env_tokens: bool) {
self.options.env_tokens = env_tokens;
pub fn env_struct(&mut self, env_struct: bool) {
self.options.env_struct = env_struct;
}

/// Sets the `bitwise_mode` option
Expand All @@ -105,7 +109,7 @@ impl Clue {
}

/// Sets the `rawsetglobals` option
/// When the `rawsetglobals` option is enabled, Clue will rawset(_G, ...) instead of _G.x = ... for globals
/// When the `rawsetglobals` option is enabled, Clue will rawset(_G, ...) instead of simply x = ... for globals
pub fn rawsetglobals(&mut self, env_rawsetglobal: bool) {
self.options.env_rawsetglobals = env_rawsetglobal;
}
Expand Down
Loading

0 comments on commit c4f2b74

Please sign in to comment.