diff options
author | Raghuram Subramani <raghus2247@gmail.com> | 2025-07-11 11:43:41 +0530 |
---|---|---|
committer | Raghuram Subramani <raghus2247@gmail.com> | 2025-07-11 11:43:41 +0530 |
commit | a56f7b45203d14adbcd0687e7f9eb96d26d45aa2 (patch) | |
tree | 44b9ae6461ae3dbfac9ec3aae7ac3f011a2a2def /src | |
parent | 71297652640596c8f45d65eb8a3a7127d525492c (diff) |
lexer: check contentfor before content
Since content is a substring of contentfor, it gets wrongly recognized.
Diffstat (limited to 'src')
-rw-r--r-- | src/lexer.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/lexer.c b/src/lexer.c index a967c25..2076d20 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -124,18 +124,6 @@ found_start: } directive->operands = operand; - } else if (strncmp(buffer + n, "content ", strlen("content")) == 0) { - directive->type = CONTENT; - - char *operand = NULL; - for (size_t i = n + strlen("content"); i < match->length - n; i++) - if (isalnum(buffer[i])) { - sscanf(buffer + i, "%ms\"", &operand); - operand[strlen(operand) - 1] = '\0'; - break; - } - - directive->operands = operand; } else if (strncmp(buffer + n, "endcontent", strlen("endcontent")) == 0) { directive->type = ENDCONTENT; directive->operands = NULL; @@ -194,6 +182,18 @@ found_start: free(new_match); directive->operands = operands; + } else if (strncmp(buffer + n, "content ", strlen("content")) == 0) { + directive->type = CONTENT; + + char *operand = NULL; + for (size_t i = n + strlen("content"); i < match->length - n; i++) + if (isalnum(buffer[i])) { + sscanf(buffer + i, "%ms\"", &operand); + operand[strlen(operand) - 1] = '\0'; + break; + } + + directive->operands = operand; } else { free(directive); return NULL; |