commit e5a4f27da11c657db6007486e8cb481b8ee4757e
parent cafabb31e681429f74e91f1a6df4d4e8ee2541b3
Author: erai <erai@omiltem.net>
Date: Mon, 7 Oct 2024 18:42:18 -0400
add peglib.c to LIB
Diffstat:
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -28,3 +28,4 @@ cat
peg
peg0
*.out*
+*_peg.c
diff --git a/build.sh b/build.sh
@@ -1,9 +1,9 @@
#!/bin/sh
-LIBS="bufio.c lib.c alloc.c syscall.c"
+LIBS="peglib.c bufio.c lib.c alloc.c syscall.c"
CRYPTO="ed25519.c sha512.c sha256.c chacha20.c poly1305.c"
CC="cc1.c type.c as.c decl.c node.c"
-PEG="peg.c peglib.c parsepeg.c"
+PEG="peg.c parsepeg.c"
SSHD="chacha20.c poly1305.c sha256.c sha512.c ed25519.c sshd.c"
KERNEL="kernel.c"
SHELL="echo.c cmp.c rm.c ls.c cat.c xxd.c mv.c mkdir.c cpio.c sh.c"
diff --git a/dump.c b/dump.c
@@ -23,7 +23,7 @@ main(argc: int, argv: **byte, envp: **byte) {
peg_free(peg);
out = fopen(1, &a);
- peg_show(out, node);
+ peg_show(peg, out, node);
fputc(out, '\n');
fflush(out);
diff --git a/peglib.c b/peglib.c
@@ -383,13 +383,13 @@ peg_free(c: *peg) {
free(c.a, c: *byte);
}
-peg_show(out: *file, n: *peg_node) {
+peg_show(c: *peg, out: *file, n: *peg_node) {
var i: int;
var ch: int;
var hex: *byte;
hex = "0123456789abcdef";
fputs(out, "(");
- fputs(out, P_tag_to_str(n.tag));
+ fputs(out, c.tag_to_str(n.tag));
if n.child {
n = n.child;
loop {
@@ -398,7 +398,7 @@ peg_show(out: *file, n: *peg_node) {
}
fputc(out, ' ');
- peg_show(out, n);
+ peg_show(c, out, n);
n = n.next;
}