From 6c9563e91eb7aa738aa2656d141ce56ef66b50cf Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Sat, 16 May 2020 10:39:05 -0700 Subject: feat: added directory for command line tools --- sys/cmd/cc/lex.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 sys/cmd/cc/lex.c (limited to 'sys/cmd/cc/lex.c') 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) { + + } +} -- cgit v1.2.1