aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/patch-header.janet
diff options
context:
space:
mode:
Diffstat (limited to 'tools/patch-header.janet')
-rw-r--r--tools/patch-header.janet12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/patch-header.janet b/tools/patch-header.janet
new file mode 100644
index 00000000..bbc86653
--- /dev/null
+++ b/tools/patch-header.janet
@@ -0,0 +1,12 @@
+# Patch janet.h
+
+(def [_ janeth janetconf output] (dyn :args))
+
+(def- replace-peg
+ (peg/compile
+ ~(% (* '(to `#include "janetconf.h"`)
+ (constant ,(slurp janetconf))
+ (thru `#include "janetconf.h"`)
+ '(any 1)))))
+
+(spit output (first (peg/match replace-peg (slurp janeth))))