]> granicus.if.org Git - yasm/commit
Add support for single-level GAS .rept directive. Nested .rept's are not
authorPeter Johnson <peter@tortall.net>
Wed, 2 Nov 2005 08:24:19 +0000 (08:24 -0000)
committerPeter Johnson <peter@tortall.net>
Wed, 2 Nov 2005 08:24:19 +0000 (08:24 -0000)
commitbddebf00922b73b835f4c34ee06dfbace1c2b1ef
tree9fe517ff8c7e03613aab47ec7fc564b60561531b
parent81a6ef76d87f10d07af7971e609d58d7c8df3db5
Add support for single-level GAS .rept directive.  Nested .rept's are not
allowed at the moment.  The implementation works mostly like a preproc; it
copies source lines and replays them to the lexer.  A new .line directive
was added to fix up line numbers for errors and warnings.

* gas-parser.h (yasm_parser_gas): Add rept structure storage.
(gas_rept): New data structure for .rept state.
(gas_rept_line): Data structure to store source lines within .rept block.

* gas-parser.c: Initialize rept to NULL and check for unclosed rept.

* gas-bison.y: Add support for .line, .rept, and .endr directives.  The
DIR_REPT handler just creates the rept structure, and the DIR_ENDR handler
just errors (.endr without .rept).  All the real work is done in the lexer.

* gas-token.re (rept_input): Replays captured .rept block source lines back
to fill().
(fill): Call rept_input() instead of yasm_preproc_input() if expanding a
rept block.
(gas_parser_lex): Capture source lines and store into rept data structures.

Also added a whole bunch of testcases.

svn path=/trunk/yasm/; revision=1306
26 files changed:
modules/parsers/gas/gas-bison.y
modules/parsers/gas/gas-parser.c
modules/parsers/gas/gas-parser.h
modules/parsers/gas/gas-token.re
modules/parsers/gas/tests/Makefile.inc
modules/parsers/gas/tests/bin/Makefile.inc [new file with mode: 0644]
modules/parsers/gas/tests/bin/gas_bin_test.sh [new file with mode: 0755]
modules/parsers/gas/tests/bin/rept-err.asm [new file with mode: 0644]
modules/parsers/gas/tests/bin/rept-err.errwarn [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptempty.asm [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptempty.errwarn [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptempty.hex [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptlong.asm [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptlong.errwarn [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptlong.hex [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptnested-err.asm [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptnested-err.errwarn [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptsimple.asm [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptsimple.errwarn [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptsimple.hex [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptwarn.asm [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptwarn.errwarn [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptwarn.hex [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptzero.asm [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptzero.errwarn [new file with mode: 0644]
modules/parsers/gas/tests/bin/reptzero.hex [new file with mode: 0644]