diff options
author | Galin Simeonov <gts@volconst.com> | 2021-06-04 16:42:52 +0300 |
---|---|---|
committer | Galin Simeonov <gts@volconst.com> | 2021-07-15 18:04:59 +0300 |
commit | a26684a417729699e95b335a3d00798237ffba9b (patch) | |
tree | 6cd73bc90fbe5fd435b8cc721455d0a70420a4ac /src/frontend/lexer.c | |
parent | b845e4754be86d2216733d9bea75cb301f38739d (diff) | |
download | MEGATRON-a26684a417729699e95b335a3d00798237ffba9b.tar.gz |
added the if statement
Diffstat (limited to 'src/frontend/lexer.c')
-rw-r--r-- | src/frontend/lexer.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/frontend/lexer.c b/src/frontend/lexer.c index 668d7cd..a832a17 100644 --- a/src/frontend/lexer.c +++ b/src/frontend/lexer.c @@ -8,7 +8,7 @@ #define LEX_ERROR(x) {push_lexing_error(x,src,translation_data); return get_token(src->src+src->where_in_src,0,KW_NOP,src->current_row,src->current_column);} /* - * placeholder very slow lexer that I will probabbly not replace + * placeholder very slow ( and very very bad ) lexer that I will probabbly not replace */ void lex(struct Queue *token_destination,struct Source *src,struct Translation_Data *translation_data) { @@ -69,9 +69,11 @@ struct token* lex_step(struct Source *src,struct Translation_Data *translation_d return get_token(src->src+src->where_in_src-sizeof("event")+1,sizeof("event")-1,KW_EVENT,src->current_row,src->current_column); if(check_and_move_if_on_word("transitions",sizeof("transitions")-1,src,1)) return get_token(src->src+src->where_in_src-sizeof("transitions")+1,sizeof("transitions")-1,KW_TRANSITIONS,src->current_row,src->current_column); + if(check_and_move_if_on_word("if",sizeof("if")-1,src,1)) + return get_token(src->src+src->where_in_src-sizeof("if")+1,sizeof("if")-1,KW_IF,src->current_row,src->current_column); - - + if(check_and_move_if_on_word("else",sizeof("else")-1,src,1)) + return get_token(src->src+src->where_in_src-sizeof("else")+1,sizeof("else")-1,KW_ELSE,src->current_row,src->current_column); |