diff options
| author | Raghuram Subramani <raghus2247@gmail.com> | 2025-07-27 22:35:51 +0530 |
|---|---|---|
| committer | Raghuram Subramani <raghus2247@gmail.com> | 2025-07-27 22:35:51 +0530 |
| commit | c33ced7d86b7ed7676cb1649c36a700f259b9ac6 (patch) | |
| tree | 825a7f7421e314f12eb2d4e57ea4a8542e583d79 | |
| parent | ef99b3441bd8d5ea8de192af8476f684aa3023c6 (diff) | |
lexer: hydrate lex_t->matches
| -rw-r--r-- | compromyse.xyz/index.html | 3 | ||||
| -rw-r--r-- | src/lexer.c | 21 |
2 files changed, 23 insertions, 1 deletions
diff --git a/compromyse.xyz/index.html b/compromyse.xyz/index.html index 9b038c4..9af59df 100644 --- a/compromyse.xyz/index.html +++ b/compromyse.xyz/index.html @@ -1,4 +1,3 @@ -{{ put abc }} <div class="p-16"> </div> @@ -6,6 +5,8 @@ KSFAISO ASHIAUHSFI HERE +HERETOO{{ put abc }}ENDIT +ASJFHAIS {{ endeachdo }} <div class="p-16"> diff --git a/src/lexer.c b/src/lexer.c index 1a8366f..4ab82ae 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -33,23 +33,44 @@ lex(char *buffer) char *raw_content = strndup(buffer, key->offset); directive_t *raw_directive = malloc(sizeof(directive_t)); + key_match_t *raw_key = malloc(sizeof(key_match_t)); + raw_directive->type = _RAW; raw_directive->operands = raw_content; + + raw_key->length = key->offset; + raw_key->offset = current_offset - key->length - key->offset; + list_add(directives, raw_directive); + list_add(matches, raw_key); + + free(raw_directive); + free(raw_key); } buffer += key->offset + key->length; list_add(directives, directive); + list_add(matches, key); } if (strlen(buffer) > 0) { char *raw_content = strdup(buffer); directive_t *raw_directive = malloc(sizeof(directive_t)); + key_match_t *raw_key = malloc(sizeof(key_match_t)); + raw_directive->type = _RAW; raw_directive->operands = raw_content; + + raw_key->length = strlen(buffer); + raw_key->offset = current_offset; + list_add(directives, raw_directive); + list_add(matches, raw_key); + + free(raw_directive); + free(raw_key); } out->directives = directives; |
