aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/cc/lex.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-05-16 10:39:05 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-05-16 10:39:05 -0700
commit6c9563e91eb7aa738aa2656d141ce56ef66b50cf (patch)
tree85fd9a50777ae8f5ec14ca112d26c5f4b9262113 /sys/cmd/cc/lex.c
parent3f7474df0645224ce61fedcd908028f41971189e (diff)
feat: added directory for command line tools
Diffstat (limited to 'sys/cmd/cc/lex.c')
-rw-r--r--sys/cmd/cc/lex.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/sys/cmd/cc/lex.c b/sys/cmd/cc/lex.c
new file mode 100644
index 0000000..af3bbf3
--- /dev/null
+++ b/sys/cmd/cc/lex.c
@@ -0,0 +1,38 @@
+#include "cc.h"
+
+static
+void
+errorat(Pos x, byte *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ printf("error %d:", x.line);
+ vprintf(fmt, args);
+ va_end(args);
+}
+
+static
+byte
+getbyte(struct Lexer *lex)
+{
+ return bufio·getbyte(&lex->buf);
+}
+
+static
+error
+ungetbyte(struct Lexer *lex, byte b)
+{
+ return bufio·ungetbyte(&lex->buf, b);
+}
+
+void
+lex(struct Lexer *lex)
+{
+ int b;
+
+ b = getbyte(lex);
+TOP:
+ switch (b) {
+
+ }
+}