aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/cc/lex.c
diff options
context:
space:
mode:
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) {
+
+ }
+}