From f4affa93fac8c52b3350cfa3d2dec4bfb9b3deae Mon Sep 17 00:00:00 2001 From: c+1 Date: Fri, 5 May 2023 17:09:41 -0400 Subject: HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALK! --- Makefile | 0 README.md | 0 src/include/token.h | 3 ++- src/lexer.c | 11 +++++++++-- src/main.c | 2 +- src/token.c | 0 src/tree.c | 0 7 files changed, 12 insertions(+), 4 deletions(-) mode change 100755 => 100644 Makefile mode change 100755 => 100644 README.md mode change 100755 => 100644 src/lexer.c mode change 100755 => 100644 src/main.c mode change 100755 => 100644 src/token.c mode change 100755 => 100644 src/tree.c diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 diff --git a/README.md b/README.md old mode 100755 new mode 100644 diff --git a/src/include/token.h b/src/include/token.h index 9bfc4f3..709051a 100644 --- a/src/include/token.h +++ b/src/include/token.h @@ -12,8 +12,9 @@ typedef struct TOKEN_STRUC { TOKEN_LBRAK, // '[' TOKEN_RBRAK, // ']' TOKEN_POUND, // '#'' - TOKEN_tILDE, // '~' + TOKEN_TILDE, // '~' TOKEN_QUOTE, // ''' + TOKEN_COMM, // '[comment]' TOKEN_EOF // '\0' } type; diff --git a/src/lexer.c b/src/lexer.c old mode 100755 new mode 100644 index 3d9f538..db1d994 --- a/src/lexer.c +++ b/src/lexer.c @@ -85,10 +85,17 @@ token_t* lexer_get_next_token(lexer_t* lexer) { case '~': return lexer_next_token( lexer, token_init( - TOKEN_tILDE, + TOKEN_TILDE, lexer_get_c_as_string(lexer) ) ); break; + case ';': return lexer_next_token( + lexer, + token_init( + TOKEN_SEMI, + lexer_get_c_as_string(lexer) + ) + ); break; } } @@ -122,7 +129,7 @@ token_t* lexer_get_comment(lexer_t* lexer) { } lexer_next(lexer); - return token_init(TOKEN_SEMI, NULL); + return token_init(TOKEN_COMM, lexer_get_c_as_string(lexer)); } token_t* lexer_get_id(lexer_t* lexer) { diff --git a/src/main.c b/src/main.c old mode 100755 new mode 100644 index e8c6a9d..6a45767 --- a/src/main.c +++ b/src/main.c @@ -3,7 +3,7 @@ int main(int argc, char* argv[]) { lexer_t* lexer = lexer_init( - "Let it = \"Hello, World!\";\nsay it;" + "[a simple test script]\nlet it = \"Hello, World!\";\nsay it;" ); printf("\n=== INPUT =======\n%s\n=== END INPUT ===\n", lexer->content); diff --git a/src/token.c b/src/token.c old mode 100755 new mode 100644 diff --git a/src/tree.c b/src/tree.c old mode 100755 new mode 100644 -- cgit v1.2.3