summaryrefslogtreecommitdiff
path: root/src/parser/parser_utils.c
diff options
context:
space:
mode:
authorZuhaitz <zuhaitz.zechhub@gmail.com>2026-02-02 00:22:19 +0000
committerGitHub <noreply@github.com>2026-02-02 00:22:19 +0000
commit6fde408251dcc0e32c6f513b5d65cc7a9d8c8912 (patch)
treea50440a6148113ebf0e017da8111338e8e067a31 /src/parser/parser_utils.c
parentc4b73a1e99bda3cdfabe7ff3b64066b310ee7292 (diff)
parentfb57d746d706fbae822de17087f4a3991d3079cb (diff)
Merge branch 'main' into dev/weilun/thread
Diffstat (limited to 'src/parser/parser_utils.c')
-rw-r--r--src/parser/parser_utils.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/parser/parser_utils.c b/src/parser/parser_utils.c
index 28d2c11..8ea2934 100644
--- a/src/parser/parser_utils.c
+++ b/src/parser/parser_utils.c
@@ -691,16 +691,22 @@ void register_tuple(ParserContext *ctx, const char *sig)
s_def->strct.name = xstrdup(struct_name);
char *s_sig = xstrdup(sig);
- char *tok = strtok(s_sig, "_");
+ char *current = s_sig;
+ char *next_sep = strstr(current, "__");
ASTNode *head = NULL, *tail = NULL;
int i = 0;
- while (tok)
+ while (current)
{
+ if (next_sep)
+ {
+ *next_sep = 0;
+ }
+
ASTNode *f = ast_create(NODE_FIELD);
char fname[32];
sprintf(fname, "v%d", i++);
f->field.name = xstrdup(fname);
- f->field.type = xstrdup(tok);
+ f->field.type = xstrdup(current);
if (!head)
{
@@ -712,7 +718,15 @@ void register_tuple(ParserContext *ctx, const char *sig)
}
tail = f;
- tok = strtok(NULL, "_");
+ if (next_sep)
+ {
+ current = next_sep + 2;
+ next_sep = strstr(current, "__");
+ }
+ else
+ {
+ break;
+ }
}
free(s_sig);
s_def->strct.fields = head;