Skip to content

Commit

Permalink
Fixed issue 144 (unit test added).
Browse files Browse the repository at this point in the history
  • Loading branch information
marcobambini committed Apr 26, 2017
1 parent 01ad7b3 commit 5b73d29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/compiler/gravity_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,16 +765,18 @@ static gnode_t *parse_analyze_literal_string (gravity_parser_t *parser, gtoken_s

// parse interpolated expression
gnode_t *subnode = parse_expression(parser);
if (!subnode) goto return_string;

// add expression to r
if (!r) r = gnode_array_create();
if (length) gnode_array_push(r, gnode_literal_string_expr_create(token, buffer, length, true, LAST_DECLARATION()));
gnode_array_push(r, subnode);
if (subnode) {
if (!r) r = gnode_array_create();
if (length) gnode_array_push(r, gnode_literal_string_expr_create(token, buffer, length, true, LAST_DECLARATION()));
gnode_array_push(r, subnode);
}

// free temp lexer
marray_pop(*parser->lexer);
gravity_lexer_free(sublexer);
if (!subnode) goto return_string;

buffer = mem_alloc(len+1);
length = 0;
Expand Down
Binary file added test/fuzzy/issue144.gravity
Binary file not shown.

0 comments on commit 5b73d29

Please sign in to comment.