From: Peter Johnson Date: Tue, 21 Oct 2003 01:54:31 +0000 (-0000) Subject: Be less pedantic about trailing commas in data declarations and incbin. X-Git-Tag: v0.4.0~92 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=38654f318e1fc61cb655622893956dde42697c59;p=yasm Be less pedantic about trailing commas in data declarations and incbin. We're still being pedantic when it comes to instructions, however. Reported by: Edouard Gomez svn path=/trunk/yasm/; revision=1073 --- diff --git a/modules/parsers/nasm/nasm-bison.y b/modules/parsers/nasm/nasm-bison.y index da3632d7..abbe8fa3 100644 --- a/modules/parsers/nasm/nasm-bison.y +++ b/modules/parsers/nasm/nasm-bison.y @@ -172,9 +172,15 @@ exp: instr | INCBIN STRING { $$ = yasm_bc_create_incbin($2, NULL, NULL, cur_line); } + | INCBIN STRING ',' { + $$ = yasm_bc_create_incbin($2, NULL, NULL, cur_line); + } | INCBIN STRING ',' expr { $$ = yasm_bc_create_incbin($2, $4, NULL, cur_line); } + | INCBIN STRING ',' expr ',' { + $$ = yasm_bc_create_incbin($2, $4, NULL, cur_line); + } | INCBIN STRING ',' expr ',' expr { $$ = yasm_bc_create_incbin($2, $4, $6, cur_line); } @@ -208,6 +214,7 @@ datavals: dataval { yasm_dvs_append(&$$, $1); } | datavals ',' dataval { yasm_dvs_append(&$1, $3); $$ = $1; } + | datavals ',' { $$ = $1; } ; dataval: dvexpr { $$ = yasm_dv_create_expr($1); } diff --git a/modules/parsers/nasm/tests/Makefile.inc b/modules/parsers/nasm/tests/Makefile.inc index 18c250ac..5fc8c92c 100644 --- a/modules/parsers/nasm/tests/Makefile.inc +++ b/modules/parsers/nasm/tests/Makefile.inc @@ -3,6 +3,9 @@ TESTS += modules/parsers/nasm/tests/nasm_test.sh EXTRA_DIST += modules/parsers/nasm/tests/nasm_test.sh +EXTRA_DIST += modules/parsers/nasm/tests/endcomma.asm +EXTRA_DIST += modules/parsers/nasm/tests/endcomma.errwarn +EXTRA_DIST += modules/parsers/nasm/tests/endcomma.hex EXTRA_DIST += modules/parsers/nasm/tests/equlocal.asm EXTRA_DIST += modules/parsers/nasm/tests/equlocal.errwarn EXTRA_DIST += modules/parsers/nasm/tests/equlocal.hex diff --git a/modules/parsers/nasm/tests/endcomma.asm b/modules/parsers/nasm/tests/endcomma.asm new file mode 100644 index 00000000..8e09610a --- /dev/null +++ b/modules/parsers/nasm/tests/endcomma.asm @@ -0,0 +1,2 @@ +[bits 32] +db 1,2,3,4, diff --git a/modules/parsers/nasm/tests/endcomma.errwarn b/modules/parsers/nasm/tests/endcomma.errwarn new file mode 100644 index 00000000..e69de29b diff --git a/modules/parsers/nasm/tests/endcomma.hex b/modules/parsers/nasm/tests/endcomma.hex new file mode 100644 index 00000000..68d6ef9f --- /dev/null +++ b/modules/parsers/nasm/tests/endcomma.hex @@ -0,0 +1,4 @@ +01 +02 +03 +04