diff options
Diffstat (limited to 'src/frontend/lexer.c')
-rw-r--r-- | src/frontend/lexer.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/frontend/lexer.c b/src/frontend/lexer.c index 6dc348d..de8ff95 100644 --- a/src/frontend/lexer.c +++ b/src/frontend/lexer.c @@ -37,14 +37,26 @@ struct token* lex_step(struct Source *src,struct Translation_Data *translation_d return get_token(src->src+src->where_in_src-sizeof("on")+1,sizeof("on")-1,KW_ON,src->current_row,src->current_column); if(check_and_move_if_on_word("[",sizeof("[")-1,src,0)) return get_token(src->src+src->where_in_src-sizeof("[")+1,sizeof("[")-1,KW_OPEN_SQUARE,src->current_row,src->current_column); + if(check_and_move_if_on_word("(",sizeof("(")-1,src,0)) + return get_token(src->src+src->where_in_src-sizeof("(")+1,sizeof("(")-1,KW_OPEN_NORMAL,src->current_row,src->current_column); + if(check_and_move_if_on_word(")",sizeof(")")-1,src,0)) + return get_token(src->src+src->where_in_src-sizeof(")")+1,sizeof(")")-1,KW_CLOSE_NORMAL,src->current_row,src->current_column); if(check_and_move_if_on_word(",",sizeof(",")-1,src,0)) return get_token(src->src+src->where_in_src-sizeof(",")+1,sizeof(",")-1,KW_COMMA,src->current_row,src->current_column); + if(check_and_move_if_on_word(".",sizeof(".")-1,src,0)) + return get_token(src->src+src->where_in_src-sizeof(".")+1,sizeof(".")-1,KW_DOT,src->current_row,src->current_column); if(check_and_move_if_on_word("]",sizeof("]")-1,src,0)) return get_token(src->src+src->where_in_src-sizeof("]")+1,sizeof("]")-1,KW_CLOSE_SQUARE,src->current_row,src->current_column); if(check_and_move_if_on_word(";",sizeof(";")-1,src,0)) return get_token(src->src+src->where_in_src-sizeof(";")+1,sizeof(";")-1,KW_SEMI_COLUMN,src->current_row,src->current_column); if(check_and_move_if_on_word("|",sizeof("|")-1,src,0)) return get_token(src->src+src->where_in_src-sizeof("|")+1,sizeof("|")-1,KW_PIPE,src->current_row,src->current_column); + if(check_and_move_if_on_word("||",sizeof("||")-1,src,0)) + return get_token(src->src+src->where_in_src-sizeof("||")+1,sizeof("||")-1,KW_OR,src->current_row,src->current_column); + if(check_and_move_if_on_word("&&",sizeof("&&")-1,src,0)) + return get_token(src->src+src->where_in_src-sizeof("&&")+1,sizeof("&&")-1,KW_AND,src->current_row,src->current_column); + if(check_and_move_if_on_word("!",sizeof("!")-1,src,0)) + return get_token(src->src+src->where_in_src-sizeof("!")+1,sizeof("!")-1,KW_NOT,src->current_row,src->current_column); if(check_and_move_if_on_word("starting",sizeof("starting")-1,src,1)) return get_token(src->src+src->where_in_src-sizeof("starting")+1,sizeof("starting")-1,KW_STARTING,src->current_row,src->current_column); if(check_and_move_if_on_word("states",sizeof("states")-1,src,1)) @@ -157,4 +169,10 @@ void push_token_into_map(struct token *token,struct Map *map,void *thing) { Map_Push(map,token->data,token->size,thing); } +void id_token_to_upper_case(struct token *token) +{ + size_t i; + for(i=0;i<token->size;++i) + token->data[i]=toupper(token->data[i]); +} #endif |