feat(lexer): operators done
This commit is contained in:
parent
3cdba0ad9c
commit
1e5593fc8e
3 changed files with 111 additions and 43 deletions
|
|
@ -11,18 +11,6 @@
|
|||
#include "../utils/string_utils/string_utils.h"
|
||||
#include "lexer_utils.h"
|
||||
|
||||
/* @return: true if a special character from the grammar was found,
|
||||
* false otherwise.
|
||||
*/
|
||||
static bool is_special_char(char c)
|
||||
{
|
||||
if (c == EOF)
|
||||
return true;
|
||||
|
||||
char special_chars[] = "\n'\"`;#|&\\(){}<>*";
|
||||
return strchr(special_chars, c) != NULL;
|
||||
}
|
||||
|
||||
/* @brief: sets the ctx->current_token to [tok].
|
||||
* this function is called by token_peek().
|
||||
*/
|
||||
|
|
@ -177,7 +165,7 @@ struct token *pop_token(struct lexer_context *ctx)
|
|||
if (is_special_char(stream[i]))
|
||||
{
|
||||
if (i == 0) // where we create spe_char token
|
||||
i++;
|
||||
i += len_op_sepchar(stream, i);
|
||||
break;
|
||||
}
|
||||
if (isblank(stream[i]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue