aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorc+12023-05-04 13:08:33 -0400
committerc+12023-05-04 13:08:33 -0400
commit48f6a2e757ffa49f4a5676e29f5fff935660b6a1 (patch)
tree943a5e1fc646f012f665dd397c0ebd2354067f2c /src
parent2ac46b8b73896603f6b14d3e52500761c49a3262 (diff)
HALK HALK HALK
Diffstat (limited to 'src')
-rw-r--r--src/include/lexer.h18
-rw-r--r--src/include/token.h6
-rw-r--r--src/lexer.c20
-rw-r--r--src/token.c4
4 files changed, 24 insertions, 24 deletions
diff --git a/src/include/lexer.h b/src/include/lexer.h
index a20bf8c..e002893 100644
--- a/src/include/lexer.h
+++ b/src/include/lexer.h
@@ -6,15 +6,15 @@ typedef struct LEXER_STRUC {
char c; // current character in content
unsigned int i; // index of c
char* content; // the code itself
-} lexer_T;
+} lexer_t;
-lexer_T* lexer_init(char* content);
-void lexer_next(lexer_T* lexer);
-void lexer_pass(lexer_T* lexer);
-token_T* lexer_get_next_token(lexer_T* lexer);
-token_T* lexer_get_string(lexer_T* lexer);
-token_T* lexer_get_id(lexer_T* lexer);
-token_T* lexer_next_token(lexer_T* lexer, token_T* token);
-char* lexer_get_c_as_string(lexer_T* lexer);
+lexer_t* lexer_init(char* content);
+void lexer_next(lexer_t* lexer);
+void lexer_pass(lexer_t* lexer);
+token_t* lexer_get_next_token(lexer_t* lexer);
+token_t* lexer_get_string(lexer_t* lexer);
+token_t* lexer_get_id(lexer_t* lexer);
+token_t* lexer_next_token(lexer_t* lexer, token_t* token);
+char* lexer_get_c_as_string(lexer_t* lexer);
#endif
diff --git a/src/include/token.h b/src/include/token.h
index b923734..9bfc4f3 100644
--- a/src/include/token.h
+++ b/src/include/token.h
@@ -12,13 +12,13 @@ typedef struct TOKEN_STRUC {
TOKEN_LBRAK, // '['
TOKEN_RBRAK, // ']'
TOKEN_POUND, // '#''
- TOKEN_TILDE, // '~'
+ TOKEN_tILDE, // '~'
TOKEN_QUOTE, // '''
TOKEN_EOF // '\0'
} type;
char* value;
-} token_T;
+} token_t;
-token_T* token_init(int type, char* value);
+token_t* token_init(int type, char* value);
#endif
diff --git a/src/lexer.c b/src/lexer.c
index 35e9fde..24b035d 100644
--- a/src/lexer.c
+++ b/src/lexer.c
@@ -4,8 +4,8 @@
#include <string.h>
#include <ctype.h>
-lexer_T* lexer_init(char* content) {
- lexer_T* lexer = calloc(1, sizeof(struct LEXER_STRUC));
+lexer_t* lexer_init(char* content) {
+ lexer_t* lexer = calloc(1, sizeof(struct LEXER_STRUC));
lexer->content = content;
lexer->i = 0;
@@ -14,7 +14,7 @@ lexer_T* lexer_init(char* content) {
return lexer;
}
-void lexer_next(lexer_T* lexer) {
+void lexer_next(lexer_t* lexer) {
// if not at end of line or file
if (lexer->c != '\0' && lexer->i < strlen(lexer->content)) {
lexer->i += 1; // advance index 1 character
@@ -22,7 +22,7 @@ void lexer_next(lexer_T* lexer) {
}
}
-void lexer_pass(lexer_T* lexer) {
+void lexer_pass(lexer_t* lexer) {
while (lexer->c == ' ' ||
lexer->c == '\t' ||
lexer->c == '\n') {
@@ -30,7 +30,7 @@ void lexer_pass(lexer_T* lexer) {
}
}
-token_T* lexer_get_next_token(lexer_T* lexer) {
+token_t* lexer_get_next_token(lexer_t* lexer) {
while (lexer->c != '\0' && lexer->i < strlen(lexer->content)) {
if (lexer->c == ' ' ||
lexer->c == '\t' ||
@@ -92,7 +92,7 @@ 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;
@@ -102,7 +102,7 @@ token_T* lexer_get_next_token(lexer_T* lexer) {
return token_init(TOKEN_EOF, "\0");
}
-token_T* lexer_get_string(lexer_T* lexer) {
+token_t* lexer_get_string(lexer_t* lexer) {
lexer_next(lexer);
char* str_so_far = calloc(2, sizeof(char));
@@ -120,7 +120,7 @@ token_T* lexer_get_string(lexer_T* lexer) {
return token_init(TOKEN_QUOTE, str_so_far);
}
-token_T* lexer_get_id(lexer_T* lexer) {
+token_t* lexer_get_id(lexer_t* lexer) {
char* str_so_far = calloc(1, sizeof(char));
str_so_far[0] = '\0';
@@ -135,13 +135,13 @@ token_T* lexer_get_id(lexer_T* lexer) {
return token_init(TOKEN_ID, str_so_far);
}
-token_T* lexer_next_token(lexer_T* lexer, token_T* token) {
+token_t* lexer_next_token(lexer_t* lexer, token_t* token) {
lexer_next(lexer);
return token;
}
-char* lexer_get_c_as_string(lexer_T* lexer) {
+char* lexer_get_c_as_string(lexer_t* lexer) {
char* str = calloc(1, sizeof(char));
str[0] = lexer->c;
str[1] = '\0';
diff --git a/src/token.c b/src/token.c
index da38b9a..3021a64 100644
--- a/src/token.c
+++ b/src/token.c
@@ -1,8 +1,8 @@
#include "include/token.h"
#include <stdlib.h>
-token_T* token_init(int type, char* val) {
- token_T* token = calloc(1, sizeof(struct TOKEN_STRUC));
+token_t* token_init(int type, char* val) {
+ token_t* token = calloc(1, sizeof(struct TOKEN_STRUC));
token->type = type;
token->value = val;