Skip to content

Commit

Permalink
Merge pull request #82 from ErwannLesech/fix_double_quote
Browse files Browse the repository at this point in the history
fix<double_quote_error>: fixing double quote error tests
  • Loading branch information
ErwannLesech authored Jan 20, 2024
2 parents d951c23 + 4583ea9 commit ad9fff2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lexer/lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ char *get_word(struct lexer *lexer, bool *is_diactivated)
// Handle backslash
else if (lexer->data[lexer->index - 1] == '\\')
{
// TODO: check if it's handle backslash in double quote
handle_backslash(lexer, is_diactivated, word, word_index);
}

Expand Down Expand Up @@ -317,6 +316,15 @@ struct token parse_input_for_tok(struct lexer *lexer)
{
if (fnmatch(lex_match[i].str, word, 0) == 0 && !is_diactivated)
{
if (lex_match[i].type == TOKEN_EOF
&& (lexer->curr_tok.type == TOKEN_DOUBLE_QUOTE
|| lexer->curr_tok.type == TOKEN_WORD_DOUBLE_QUOTE
|| lexer->curr_tok.type == TOKEN_VARIABLE_AND_DOUBLE_QUOTE))
{
token.type = TOKEN_ERROR;
token.data = "parse_input_for_tok - Missing closing quote.";
return token;
}
token.type = lex_match[i].type;
token.data = word;
return token;
Expand Down

0 comments on commit ad9fff2

Please sign in to comment.