aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2025-07-27 19:17:48 +0530
committerRaghuram Subramani <raghus2247@gmail.com>2025-07-27 19:17:48 +0530
commit82699f835535ae58f9ad7eb088c38df2a787a07d (patch)
tree7bf612ff1d7e4e97915f9e5a1d4ec4d5ff409cb6 /src
parentd59070443e4f9a82ce177bb883dd7b6179471147 (diff)
lexer: handle put
Diffstat (limited to 'src')
-rw-r--r--src/lexer.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lexer.c b/src/lexer.c
index a1f893f..eefeddd 100644
--- a/src/lexer.c
+++ b/src/lexer.c
@@ -226,6 +226,21 @@ lexer_handle_eachdo(directive_t *directive,
}
void
+lexer_handle_put(directive_t *directive,
+ key_match_t *match,
+ char *buffer,
+ size_t n)
+{
+ directive->type = PUT;
+
+ /* TODO: Use this for include and contentfor too instead of sscanf() */
+ char *operand = trim(strndup(buffer + n + strlen("put"),
+ match->length - n - strlen("put") - 2));
+
+ directive->operands = operand;
+}
+
+void
lexer_handle_content(directive_t *directive,
key_match_t *match,
char *buffer,
@@ -287,6 +302,8 @@ found_start:
lexer_handle_content(directive, match, buffer, n);
} else if (DIRECTIVE_IS("eachdo")) {
lexer_handle_eachdo(directive, match, buffer, n);
+ } else if (DIRECTIVE_IS("put")) {
+ lexer_handle_put(directive, match, buffer, n);
} else {
free(directive);
return NULL;