Skip to content

Commit

Permalink
mruby-pack/pack.c (read_tmpl): support comments in derectives
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Jul 24, 2023
1 parent 5d00161 commit e17f325
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mrbgems/mruby-pack/src/pack.c
Expand Up @@ -1218,7 +1218,7 @@ read_tmpl(mrb_state *mrb, struct tmpl *tmpl, enum pack_dir *dirp, enum pack_type
tlen = RSTRING_LEN(tmpl->str);

t = tptr[tmpl->idx++];
alias:
alias:
switch (t) {
case 'A':
dir = PACK_DIR_STR;
Expand Down Expand Up @@ -1424,6 +1424,13 @@ read_tmpl(mrb_state *mrb, struct tmpl *tmpl, enum pack_dir *dirp, enum pack_type
type = PACK_TYPE_STRING;
flags |= PACK_FLAG_WIDTH | PACK_FLAG_COUNT2 | PACK_FLAG_Z;
break;
case '#':
while (++tmpl->idx < tlen && tptr[tmpl->idx] != '\n')
;
dir = PACK_DIR_INVALID;
type = PACK_TYPE_NONE;
return;

case 'p': case 'P':
case '%':
mrb_raisef(mrb, E_ARGUMENT_ERROR, "%c is not supported", (char)t);
Expand Down

0 comments on commit e17f325

Please sign in to comment.