Rename the language from Dino to Rex
Files use .rex, the command is rex, and the crate, runtime prefixes, docs, editor files and examples all use the new name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2f44f09b6a
commit
7cf9727bcd
94 files changed
+858
-858
No files matched your search
+8
-8
@@ -14,7 +14,7 @@ pub fn load_c_headers(main: &Program, modules: &[(String, Program)], dir: &Path)
|
||||
let mut libs: Vec<cheader::Lib> = Vec::new();
|
||||
let all = std::iter::once(("", main)).chain(modules.iter().map(|(k, p)| (k.as_str(), p)));
|
||||
for (key, p) in all {
|
||||
// `import a.b` lives in a/b.dino: its headers are found next to it
|
||||
// `import a.b` lives in a/b.rex: its headers are found next to it
|
||||
let mut here = dir.to_path_buf();
|
||||
let parts: Vec<&str> = key.split('.').collect();
|
||||
for part in &parts[..parts.len().saturating_sub(1)] {
|
||||
@@ -33,7 +33,7 @@ pub fn load_c_headers(main: &Program, modules: &[(String, Program)], dir: &Path)
|
||||
Ok(libs)
|
||||
}
|
||||
|
||||
/// Dino source -> C source, for a program in a single file. C headers it imports are looked
|
||||
/// Rex source -> C source, for a program in a single file. C headers it imports are looked
|
||||
/// for in the current folder and the system's.
|
||||
pub fn compile_to_c(src: &str) -> PResult<String> {
|
||||
let ast = parser::parse(src)?;
|
||||
@@ -78,7 +78,7 @@ pub fn compile_file(path: &str) -> Result<String, String> {
|
||||
let src = std::fs::read_to_string(path).map_err(|e| format!("error: cannot read {path}: {e}"))?;
|
||||
let dir = Path::new(path).parent().map(Path::to_path_buf).unwrap_or_default();
|
||||
compile_project(path, &src, |key| {
|
||||
let file = dir.join(format!("{}.dino", key.replace('.', "/")));
|
||||
let file = dir.join(format!("{}.rex", key.replace('.', "/")));
|
||||
std::fs::read_to_string(&file).ok().map(|s| (file.display().to_string(), s))
|
||||
})
|
||||
}
|
||||
@@ -88,7 +88,7 @@ fn unique_name(tag: &str, ext: &str) -> PathBuf {
|
||||
static COUNTER: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
|
||||
let n = COUNTER.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
|
||||
let nanos = SystemTime::now().duration_since(UNIX_EPOCH).map(|d| d.as_nanos()).unwrap_or(0);
|
||||
std::env::temp_dir().join(format!("dino-{}-{}-{}-{}{}", std::process::id(), nanos, n, tag, ext))
|
||||
std::env::temp_dir().join(format!("rex-{}-{}-{}-{}{}", std::process::id(), nanos, n, tag, ext))
|
||||
}
|
||||
|
||||
/// A path for a throw-away executable.
|
||||
@@ -102,11 +102,11 @@ pub fn build_exe(c_code: &str, out: &Path) -> Result<(), String> {
|
||||
}
|
||||
|
||||
/// Like `build_exe`, with explicit compiler flags (used by tests to turn on strict warnings).
|
||||
/// The generated code says which C libraries it needs in `// dino-...:` lines at the top.
|
||||
/// The generated code says which C libraries it needs in `// rex-...:` lines at the top.
|
||||
pub fn build_exe_with(c_code: &str, out: &Path, flags: &[&str]) -> Result<(), String> {
|
||||
let (mut cflags, mut libs, mut sources) = (Vec::new(), Vec::new(), Vec::new());
|
||||
for line in c_code.lines().take_while(|l| l.starts_with("// dino-")) {
|
||||
let (kind, value) = line["// dino-".len()..].split_once(": ").unwrap_or(("", ""));
|
||||
for line in c_code.lines().take_while(|l| l.starts_with("// rex-")) {
|
||||
let (kind, value) = line["// rex-".len()..].split_once(": ").unwrap_or(("", ""));
|
||||
match kind {
|
||||
"cflag" => cflags.push(value.to_string()),
|
||||
"lib" => libs.push(value.to_string()),
|
||||
@@ -173,7 +173,7 @@ pub fn build_exe_with(c_code: &str, out: &Path, flags: &[&str]) -> Result<(), St
|
||||
} else if uses_c {
|
||||
Err(format!("the C compiler rejected the program:\n{err}"))
|
||||
} else {
|
||||
Err(format!("the C compiler rejected the generated code (this is a bug in Dino):\n{err}"))
|
||||
Err(format!("the C compiler rejected the generated code (this is a bug in Rex):\n{err}"))
|
||||
}
|
||||
}
|
||||
Ok(_) => Ok(()),
|
||||
|
||||
Reference in new issue
Block a user