summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authornasr <nsrddyn@gmail.com>2026-03-04 22:20:11 +0000
committernasr <nsrddyn@gmail.com>2026-03-04 22:20:11 +0000
commitaa2bee82ac82ff47c6be84f2e6d39c690ec66a21 (patch)
tree2631c96f888503e1558dc935f845974272c825d7 /source
parent111fde401ad32ceff815f0a5ea3ace650cce60b6 (diff)
feature(main): ryan fleur nil nodes
will add the source to the sources.txt in the future
Diffstat (limited to 'source')
-rw-r--r--source/lexer/lexer.c8
-rw-r--r--source/storage/csv_reader.c8
-rw-r--r--source/storage/csv_reader.h37
3 files changed, 49 insertions, 4 deletions
diff --git a/source/lexer/lexer.c b/source/lexer/lexer.c
index 60a5cda..8182c5a 100644
--- a/source/lexer/lexer.c
+++ b/source/lexer/lexer.c
@@ -1,8 +1,10 @@
1internal token * 1internal token *
2tokenize(string8 buffer) 2tokenize_csv(string8 buffer)
3{ 3{
4 4 if(buffer.size < 0) return NULL;
5 // TODO(nasr): tokenize the user input 5 for(i32 index = 0;
6 buffer.data[index] != '\0'
7 ;)
6 8
7 return NULL; 9 return NULL;
8} 10}
diff --git a/source/storage/csv_reader.c b/source/storage/csv_reader.c
index 6023a3a..a06e9c4 100644
--- a/source/storage/csv_reader.c
+++ b/source/storage/csv_reader.c
@@ -1,9 +1,15 @@
1#if 1 1#define STD_TEST
2#if defined(STD_TEST)
2#include <stdio.h> 3#include <stdio.h>
3#endif 4#endif
4 5
5internal void 6internal void
6read_csv(string8 buffer) 7read_csv(string8 buffer)
7{ 8{
9#if defined(STD_TEST)
8 printf("\nsize:%lu\ndata %s\n", buffer.size, buffer.data); 10 printf("\nsize:%lu\ndata %s\n", buffer.size, buffer.data);
11#endif
12
9} 13}
14
15
diff --git a/source/storage/csv_reader.h b/source/storage/csv_reader.h
index 29ac8ab..711499f 100644
--- a/source/storage/csv_reader.h
+++ b/source/storage/csv_reader.h
@@ -1,6 +1,43 @@
1#ifndef CSV_READER_H 1#ifndef CSV_READER_H
2#define CSV_READER_H 2#define CSV_READER_H
3 3
4typedef struct csv_row csv_row;
5struct csv_row
6{
7 // array of size col_count, points into mmap buffer
8 string8 *fields;
9 i32 count;
10};
11
12typedef struct csv_table csv_table;
13struct csv_table
14{
15 // first row, col names
16 // all data rows
17 string8 *headers;
18 csv_row *rows;
19 i32 col_count;
20 i32 row_count;
21};
22
23read_only global_variable
24csv_row nil_csv_row =
25{
26 .fields = {NULL, 0},
27 .count = 0,
28};
29
30
31
32read_only global_variable
33csv_table nil_csv_table =
34{
35 .string8 = {NULL, 0},
36 .csv_row = &nil_csv_row,
37 .col_count = 0,
38 .row_count = 0,
39};
40
4 41
5 42
6#endif /* CSV_READER_H */ 43#endif /* CSV_READER_H */