summaryrefslogtreecommitdiff
path: root/modules/parsers/nasm/nasm-parse.c
diff options
context:
space:
mode:
authorPeter Johnson <peter@tortall.net>2010-01-19 07:57:43 +0000
committerPeter Johnson <peter@tortall.net>2010-01-19 07:57:43 +0000
commitcb7f1a254c41586e905a3fa1b5e85c73fb276ad4 (patch)
treebe085eb8b3a53f323653d92104b9add78e5504c3 /modules/parsers/nasm/nasm-parse.c
parent14888572a63cc9622d9c3bf4ab44b3cd8ba4b709 (diff)
downloadyasm-cb7f1a254c41586e905a3fa1b5e85c73fb276ad4.tar.gz
Add .intel_syntax and .gas_syntax support to GAS parser.
Uses the NASM parser for the .intel_syntax parsing heavy lifting. Contributed by: Alexei Svitkine svn path=/trunk/yasm/; revision=2279
Diffstat (limited to 'modules/parsers/nasm/nasm-parse.c')
-rw-r--r--modules/parsers/nasm/nasm-parse.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/parsers/nasm/nasm-parse.c b/modules/parsers/nasm/nasm-parse.c
index 72db7775..0c4820ff 100644
--- a/modules/parsers/nasm/nasm-parse.c
+++ b/modules/parsers/nasm/nasm-parse.c
@@ -1664,3 +1664,25 @@ nasm_parser_directive(yasm_parser_nasm *parser_nasm, const char *name,
if (objext_valparams)
yasm_vps_delete(objext_valparams);
}
+
+yasm_bytecode *
+gas_intel_syntax_parse_instr(yasm_parser_nasm *parser_nasm, unsigned char *instr)
+{
+ yasm_bytecode *bc = NULL;
+ char *sinstr = (char *) instr;
+
+ parser_nasm->s.bot = instr;
+ parser_nasm->s.tok = instr;
+ parser_nasm->s.ptr = instr;
+ parser_nasm->s.cur = instr;
+ parser_nasm->s.lim = instr + strlen(sinstr) + 1;
+ parser_nasm->s.top = parser_nasm->s.lim;
+ parser_nasm->peek_token = NONE;
+
+ get_next_token();
+ if (!is_eol()) {
+ bc = parse_instr(parser_nasm);
+ }
+
+ return bc;
+}