about summary refs log tree commit diff
path: root/users/glittershark
diff options
context:
space:
mode:
Diffstat (limited to 'users/glittershark')
-rw-r--r--users/glittershark/achilles/default.nix21
-rw-r--r--users/glittershark/achilles/src/main.rs3
-rw-r--r--users/glittershark/achilles/src/parser/expr.rs13
-rw-r--r--users/glittershark/achilles/src/tc/mod.rs4
4 files changed, 31 insertions, 10 deletions
diff --git a/users/glittershark/achilles/default.nix b/users/glittershark/achilles/default.nix
index 4a72bac2bac9..8ce6fda5c1c7 100644
--- a/users/glittershark/achilles/default.nix
+++ b/users/glittershark/achilles/default.nix
@@ -1,3 +1,20 @@
-# TODO(glittershark): Write the actual default.nix
+{ pkgs, ... }:
 
-_: "nothing to see yet"
+pkgs.naersk.buildPackage {
+  src = ./.;
+
+  buildInputs = with pkgs; [
+    clang_11
+    llvmPackages.llvm
+    llvmPackages.bintools
+    llvmPackages.clang
+    llvmPackages.libclang.lib
+    zlib
+    ncurses
+    libxml2
+    libffi
+    pkgconfig
+  ];
+
+  doCheck = true;
+}
diff --git a/users/glittershark/achilles/src/main.rs b/users/glittershark/achilles/src/main.rs
index 4ba0aaf33e91..d5b00d6b6c46 100644
--- a/users/glittershark/achilles/src/main.rs
+++ b/users/glittershark/achilles/src/main.rs
@@ -1,6 +1,3 @@
-#![feature(str_split_once)]
-#![feature(or_insert_with_key)]
-
 use clap::Clap;
 
 pub mod ast;
diff --git a/users/glittershark/achilles/src/parser/expr.rs b/users/glittershark/achilles/src/parser/expr.rs
index 12c55df02b80..99c8018fd00c 100644
--- a/users/glittershark/achilles/src/parser/expr.rs
+++ b/users/glittershark/achilles/src/parser/expr.rs
@@ -165,9 +165,16 @@ named!(bool_(&str) -> Literal, alt!(
 ));
 
 fn string_internal(i: &str) -> nom::IResult<&str, Cow<'_, str>, nom::error::Error<&str>> {
-    let (s, rem) = i
-        .split_once('"')
-        .ok_or_else(|| nom::Err::Error(nom::error::Error::new(i, nom::error::ErrorKind::Tag)))?;
+    // TODO(grfn): use String::split_once when that's stable
+    let (s, rem) = if let Some(pos) = i.find('"') {
+        (&i[..pos], &i[(pos + 1)..])
+    } else {
+        return Err(nom::Err::Error(nom::error::Error::new(
+            i,
+            nom::error::ErrorKind::Tag,
+        )));
+    };
+
     Ok((rem, Cow::Borrowed(s)))
 }
 
diff --git a/users/glittershark/achilles/src/tc/mod.rs b/users/glittershark/achilles/src/tc/mod.rs
index 559ac993cc9b..52c18e6d5329 100644
--- a/users/glittershark/achilles/src/tc/mod.rs
+++ b/users/glittershark/achilles/src/tc/mod.rs
@@ -358,9 +358,9 @@ impl<'ast> Typechecker<'ast> {
         let mut universalize_type = move |ty| match ty {
             Type::Exist(tv) if self.resolve_tv(tv).is_none() => vars
                 .entry(tv)
-                .or_insert_with_key(|tv| {
+                .or_insert_with(|| {
                     let ty = self.fresh_univ();
-                    self.ctx.insert(*tv, ty.clone());
+                    self.ctx.insert(tv, ty.clone());
                     ty
                 })
                 .clone(),