aboutsummaryrefslogtreecommitdiff
path: root/src/parser.c
diff options
context:
space:
mode:
authorMarvin Borner2021-04-19 22:38:59 +0200
committerMarvin Borner2021-04-19 22:38:59 +0200
commitdb55ea657e1edcb5d7da3dd90e4dc6b7643bbfe0 (patch)
tree3f9b26c54bf3bfafac2e30c82b67bba02883d5c1 /src/parser.c
8051 is awesome
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/parser.c b/src/parser.c
new file mode 100644
index 0000000..e4d0251
--- /dev/null
+++ b/src/parser.c
@@ -0,0 +1,24 @@
+#include <def.h>
+#include <parser.h>
+#include <stdio.h>
+#include <string.h>
+
+#define PEEK(hay, needle) (strcmp(hay, needle) == 0)
+
+u8 parse(char *buf, u32 size)
+{
+ u32 line = 0;
+
+ for (u32 i = 0; i < size; i++) {
+ /* printf("'%c'\n", buf[i]); */
+ if (buf[i] == '\0')
+ break;
+
+ if (buf[i] == '\n') {
+ line++;
+ continue;
+ }
+ }
+
+ return 1;
+}