Skip to content

Commit

Permalink
Merge pull request #99 from dag-erling/des/expand-ast
Browse files Browse the repository at this point in the history
Simplify AST expansion
  • Loading branch information
dag-erling authored Jul 30, 2024
2 parents 369cbec + 4c045e4 commit 11a32cb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/tre-compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ tre_expand_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast,
{
for (j = iter->min; j < iter->max; j++)
{
tre_ast_node_t *tmp, *copy;
tre_ast_node_t *copy;
pos_add_save = pos_add;
status = tre_copy_ast(mem, stack, iter->arg, 0,
&pos_add, NULL, &copy, &max_pos);
Expand All @@ -948,10 +948,7 @@ tre_expand_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast,
seq2 = copy;
if (seq2 == NULL)
return REG_ESPACE;
tmp = tre_ast_new_literal(mem, EMPTY, -1);
if (tmp == NULL)
return REG_ESPACE;
seq2 = tre_ast_new_union(mem, tmp, seq2);
seq2 = tre_ast_new_iter(mem, seq2, 0, 1, 0);
if (seq2 == NULL)
return REG_ESPACE;
}
Expand Down

0 comments on commit 11a32cb

Please sign in to comment.