From 679cbe58c4e53f0163588a7731154f3afe2d25aa Mon Sep 17 00:00:00 2001 From: Adam Branes Date: Sun, 2 May 2021 17:46:29 +0300 Subject: lexer formed --- lexer.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'lexer.h') diff --git a/lexer.h b/lexer.h index 27b69d5..e69e23b 100644 --- a/lexer.h +++ b/lexer.h @@ -1,8 +1,12 @@ #ifndef LEXER_H #define LEXER_H +#include //isspace #include #include +struct Translation_Data; +struct Source; + enum Keyword { KW_MACHINE, @@ -11,16 +15,33 @@ enum Keyword KW_TO, KW_ON, KW_ID, + KW_STRING, + KW_NOP, + KW_EOF, + KW_OPEN_SQUARE, + KW_CLOSE_SQUARE, + KW_PIPE, + KW_SEMI_COLUMN, + KW_STARTING, }; struct token { size_t size; enum Keyword type; char *data; + size_t row; + size_t column; }; + void lex(struct Queue *token_destination,struct Source *src,struct Translation_Data *translation_data); -struct token* get_token(char *data,size_t size); -void delete_token(struct token *token); +struct token* lex_step(struct Source *src,struct Translation_Data *translation_data); +struct token* get_token(char *data,size_t size,enum Keyword type,size_t row,size_t column); +void skip_white_space(struct Source *src); + +void delete_token(struct token *token); +/*:X*/ +static char check_and_move_if_on_word(char *word,size_t word_size,struct Source *src,char needs_space_after); + #endif -- cgit v1.2.3