Skip to content

Commit

Permalink
Add LICENSE, Fix Code Gen & README Key For Crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
danii committed Aug 11, 2021
1 parent d7f7737 commit 7ddaa81
Show file tree
Hide file tree
Showing 7 changed files with 687 additions and 345 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/target
/hematita_da_lua/tests/matches_standard/main.rs
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion hematita/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
name = "hematita"
version = "0.1.0"
description = "A memory safe Lua interpreter"
license = "GPL-3.0"

keywords = ["interpreter", "lua", "vm", "virtual", "machine"]
categories = ["compilers"]
readme = "README.md"
readme = "../README.md"
repository = "https://github.com/danii/hematita"

edition = "2018"
Expand Down
5 changes: 3 additions & 2 deletions hematita/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
use self::tests::matches_standard;

pub mod tests {
use std::env::current_dir;
use std::env::{current_dir, var};

pub mod matches_standard {
include!("./tests/matches_standard/build.rs");
}

pub fn matches_standard() {
let build = var("OUT_DIR").unwrap();
let current = current_dir().unwrap().join("tests/matches_standard/");
matches_standard::build(&current);
matches_standard::build(&current, build.as_ref());
}
}

Expand Down
11 changes: 4 additions & 7 deletions hematita/tests/matches_standard/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@
// lua folder should not produce psuedo-random or random output (e.g. by)
// printing pointers.

use std::{path::Path, fs::{File, read_dir}, io::{Error, Write}};
use std::{path::Path, fs::{File, create_dir_all, read_dir}, io::{Error, Write}};

static HEADER: &str = "\
#![doc(hidden)]
//! This file was automatically generated by a build script. Please don't edit
//! me!
use hematita::{
ast::{lexer::Lexer, parser::{TokenIterator, parse_block}},
compiler::compile_block, lua_lib::standard_globals,
Expand Down Expand Up @@ -115,7 +111,7 @@ fn snake_case(camel_case: &str) -> String {
snake_case
}

pub fn build(working: &Path) {
pub fn build(working: &Path, output: &Path) {
println!("cargo:rerun-if-changed={}", working.join("lua").to_string_lossy());

let file = read_dir(working.join("lua")).unwrap()
Expand All @@ -139,6 +135,7 @@ pub fn build(working: &Path) {
.unwrap();

let file = format!("{}{}", HEADER, file);
File::create(working.join("main.rs")).unwrap()
create_dir_all(output.join("codegen")).unwrap();
File::create(output.join("codegen/hematita-tests-matches_standard-main")).unwrap()
.write_all(file.as_bytes()).unwrap();
}
Loading

0 comments on commit 7ddaa81

Please sign in to comment.