Skip to content

Instantly share code, notes, and snippets.

View he-la's full-sized avatar

Henrik Laxhuber he-la

View GitHub Profile
@he-la
he-la / enum_to_errset.zig
Last active July 18, 2020 10:36
Convert an enum to an error set in zig (ziglang.org)
const std = @import("std");
const builtin = std.builtin;
// Convert an enum to an error set.
//
// This is quite a kludge that works by generating the ErrorSet using comptime
// (possible since a62e9bc8e5). Enum values are converted to error values using
// @enumToInt and @intoToError and banking on the hypothesis that error values
// are generated sequentially - this only works for enums with sequentially
// assigned values.
@he-la
he-la / flycheck-futhark.el
Created January 13, 2020 18:29
Emacs flycheck checker for futhark
(flycheck-define-checker futhark
"A futhark syntax checker using `futhark check`."
:command ("futhark" "check" source-inplace)
:error-patterns
(
;; TODO: Use column range
(error line-start "Error at " (file-name) ":" line ":" column "-" (1+ digit) ":"
(0+ (not graphic))
(message (1+ anything) "If you find this error message confusing")) ;; TODO: exclude delimiter from output (no lookahead support)