if a size is specified.
svn path=/trunk/yasm/; revision=87
-/* $Id: errwarn.h,v 1.7 2001/06/28 21:22:01 peter Exp $
+/* $Id: errwarn.h,v 1.8 2001/07/04 20:53:21 peter Exp $
* Error and warning reporting and related functions header file.
*
* Copyright (C) 2001 Peter Johnson
ERR_INVALID_EA,
ERR_INVALID_LINE,
ERR_EXP_SYNTAX,
- ERR_DUPLICATE_DEF
+ ERR_DUPLICATE_DEF,
+ ERR_OP_SIZE_MISMATCH
} err_num;
void Error(err_num, char *, ...);
-/* $Id: errwarn.c,v 1.12 2001/06/29 02:12:15 peter Exp $
+/* $Id: errwarn.c,v 1.13 2001/07/04 20:53:21 peter Exp $
* Error and warning reporting and related functions.
*
* Copyright (C) 2001 Peter Johnson
"invalid effective address",
"label or instruction expected at start of line",
"expression syntax error",
- "duplicate definition of `%s'; previously defined line %d"
+ "duplicate definition of `%s'; previously defined line %d",
+ "mismatch in operand sizes"
};
static char *warn_msgs[] = {
-/* $Id: errwarn.h,v 1.7 2001/06/28 21:22:01 peter Exp $
+/* $Id: errwarn.h,v 1.8 2001/07/04 20:53:21 peter Exp $
* Error and warning reporting and related functions header file.
*
* Copyright (C) 2001 Peter Johnson
ERR_INVALID_EA,
ERR_INVALID_LINE,
ERR_EXP_SYNTAX,
- ERR_DUPLICATE_DEF
+ ERR_DUPLICATE_DEF,
+ ERR_OP_SIZE_MISMATCH
} err_num;
void Error(err_num, char *, ...);
-/* $Id: bison.y.in,v 1.11 2001/07/04 04:24:52 peter Exp $
+/* $Id: bison.y.in,v 1.12 2001/07/04 20:53:21 peter Exp $
* Main bison parser
*
* Copyright (C) 2001 Peter Johnson, Michael Urman
| DWORD memaddr { $$ = $2; SetEALen(&$$, 4); }
;
-mem: '[' memaddr ']' { $$ = $2; }
+memref: '[' memaddr ']' { $$ = $2; }
;
/* explicit memory */
-mem8x: BYTE mem { $$ = $2; }
+mem8x: BYTE memref { $$ = $2; }
;
-mem16x: WORD mem { $$ = $2; }
+mem16x: WORD memref { $$ = $2; }
;
-mem32x: DWORD mem { $$ = $2; }
+mem32x: DWORD memref { $$ = $2; }
;
-mem64x: QWORD mem { $$ = $2; }
+mem64x: QWORD memref { $$ = $2; }
;
-mem80x: TWORD mem { $$ = $2; }
+mem80x: TWORD memref { $$ = $2; }
;
-mem128x: DQWORD mem { $$ = $2; }
+mem128x: DQWORD memref { $$ = $2; }
+;
+
+/* other sized memory reference - no explicit size allowed */
+mem: memref { $$ = $1; }
+ | mem8x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem16x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem32x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem64x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem80x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem128x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
;
/* implicit memory */
-mem8: mem
+mem8: memref
| mem8x
;
-mem16: mem
+mem16: memref
| mem16x
;
-mem32: mem
+mem32: memref
| mem32x
;
-mem64: mem
+mem64: memref
| mem64x
;
-mem80: mem
+mem80: memref
| mem80x
;
-mem128: mem
+mem128: memref
| mem128x
;
/* both 16 and 32 bit memory */
-mem1632: mem
+mem1632: memref
| mem16x
| mem32x
;
-/* $Id: nasm-bison.y,v 1.11 2001/07/04 04:24:52 peter Exp $
+/* $Id: nasm-bison.y,v 1.12 2001/07/04 20:53:21 peter Exp $
* Main bison parser
*
* Copyright (C) 2001 Peter Johnson, Michael Urman
| DWORD memaddr { $$ = $2; SetEALen(&$$, 4); }
;
-mem: '[' memaddr ']' { $$ = $2; }
+memref: '[' memaddr ']' { $$ = $2; }
;
/* explicit memory */
-mem8x: BYTE mem { $$ = $2; }
+mem8x: BYTE memref { $$ = $2; }
;
-mem16x: WORD mem { $$ = $2; }
+mem16x: WORD memref { $$ = $2; }
;
-mem32x: DWORD mem { $$ = $2; }
+mem32x: DWORD memref { $$ = $2; }
;
-mem64x: QWORD mem { $$ = $2; }
+mem64x: QWORD memref { $$ = $2; }
;
-mem80x: TWORD mem { $$ = $2; }
+mem80x: TWORD memref { $$ = $2; }
;
-mem128x: DQWORD mem { $$ = $2; }
+mem128x: DQWORD memref { $$ = $2; }
+;
+
+/* other sized memory reference - no explicit size allowed */
+mem: memref { $$ = $1; }
+ | mem8x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem16x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem32x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem64x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem80x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem128x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
;
/* implicit memory */
-mem8: mem
+mem8: memref
| mem8x
;
-mem16: mem
+mem16: memref
| mem16x
;
-mem32: mem
+mem32: memref
| mem32x
;
-mem64: mem
+mem64: memref
| mem64x
;
-mem80: mem
+mem80: memref
| mem80x
;
-mem128: mem
+mem128: memref
| mem128x
;
/* both 16 and 32 bit memory */
-mem1632: mem
+mem1632: memref
| mem16x
| mem32x
;
-/* $Id: bison.y.in,v 1.11 2001/07/04 04:24:52 peter Exp $
+/* $Id: bison.y.in,v 1.12 2001/07/04 20:53:21 peter Exp $
* Main bison parser
*
* Copyright (C) 2001 Peter Johnson, Michael Urman
| DWORD memaddr { $$ = $2; SetEALen(&$$, 4); }
;
-mem: '[' memaddr ']' { $$ = $2; }
+memref: '[' memaddr ']' { $$ = $2; }
;
/* explicit memory */
-mem8x: BYTE mem { $$ = $2; }
+mem8x: BYTE memref { $$ = $2; }
;
-mem16x: WORD mem { $$ = $2; }
+mem16x: WORD memref { $$ = $2; }
;
-mem32x: DWORD mem { $$ = $2; }
+mem32x: DWORD memref { $$ = $2; }
;
-mem64x: QWORD mem { $$ = $2; }
+mem64x: QWORD memref { $$ = $2; }
;
-mem80x: TWORD mem { $$ = $2; }
+mem80x: TWORD memref { $$ = $2; }
;
-mem128x: DQWORD mem { $$ = $2; }
+mem128x: DQWORD memref { $$ = $2; }
+;
+
+/* other sized memory reference - no explicit size allowed */
+mem: memref { $$ = $1; }
+ | mem8x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem16x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem32x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem64x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem80x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem128x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
;
/* implicit memory */
-mem8: mem
+mem8: memref
| mem8x
;
-mem16: mem
+mem16: memref
| mem16x
;
-mem32: mem
+mem32: memref
| mem32x
;
-mem64: mem
+mem64: memref
| mem64x
;
-mem80: mem
+mem80: memref
| mem80x
;
-mem128: mem
+mem128: memref
| mem128x
;
/* both 16 and 32 bit memory */
-mem1632: mem
+mem1632: memref
| mem16x
| mem32x
;
-/* $Id: errwarn.c,v 1.12 2001/06/29 02:12:15 peter Exp $
+/* $Id: errwarn.c,v 1.13 2001/07/04 20:53:21 peter Exp $
* Error and warning reporting and related functions.
*
* Copyright (C) 2001 Peter Johnson
"invalid effective address",
"label or instruction expected at start of line",
"expression syntax error",
- "duplicate definition of `%s'; previously defined line %d"
+ "duplicate definition of `%s'; previously defined line %d",
+ "mismatch in operand sizes"
};
static char *warn_msgs[] = {
-/* $Id: errwarn.h,v 1.7 2001/06/28 21:22:01 peter Exp $
+/* $Id: errwarn.h,v 1.8 2001/07/04 20:53:21 peter Exp $
* Error and warning reporting and related functions header file.
*
* Copyright (C) 2001 Peter Johnson
ERR_INVALID_EA,
ERR_INVALID_LINE,
ERR_EXP_SYNTAX,
- ERR_DUPLICATE_DEF
+ ERR_DUPLICATE_DEF,
+ ERR_OP_SIZE_MISMATCH
} err_num;
void Error(err_num, char *, ...);
-/* $Id: bison.y.in,v 1.11 2001/07/04 04:24:52 peter Exp $
+/* $Id: bison.y.in,v 1.12 2001/07/04 20:53:21 peter Exp $
* Main bison parser
*
* Copyright (C) 2001 Peter Johnson, Michael Urman
| DWORD memaddr { $$ = $2; SetEALen(&$$, 4); }
;
-mem: '[' memaddr ']' { $$ = $2; }
+memref: '[' memaddr ']' { $$ = $2; }
;
/* explicit memory */
-mem8x: BYTE mem { $$ = $2; }
+mem8x: BYTE memref { $$ = $2; }
;
-mem16x: WORD mem { $$ = $2; }
+mem16x: WORD memref { $$ = $2; }
;
-mem32x: DWORD mem { $$ = $2; }
+mem32x: DWORD memref { $$ = $2; }
;
-mem64x: QWORD mem { $$ = $2; }
+mem64x: QWORD memref { $$ = $2; }
;
-mem80x: TWORD mem { $$ = $2; }
+mem80x: TWORD memref { $$ = $2; }
;
-mem128x: DQWORD mem { $$ = $2; }
+mem128x: DQWORD memref { $$ = $2; }
+;
+
+/* other sized memory reference - no explicit size allowed */
+mem: memref { $$ = $1; }
+ | mem8x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem16x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem32x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem64x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem80x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem128x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
;
/* implicit memory */
-mem8: mem
+mem8: memref
| mem8x
;
-mem16: mem
+mem16: memref
| mem16x
;
-mem32: mem
+mem32: memref
| mem32x
;
-mem64: mem
+mem64: memref
| mem64x
;
-mem80: mem
+mem80: memref
| mem80x
;
-mem128: mem
+mem128: memref
| mem128x
;
/* both 16 and 32 bit memory */
-mem1632: mem
+mem1632: memref
| mem16x
| mem32x
;
-/* $Id: nasm-bison.y,v 1.11 2001/07/04 04:24:52 peter Exp $
+/* $Id: nasm-bison.y,v 1.12 2001/07/04 20:53:21 peter Exp $
* Main bison parser
*
* Copyright (C) 2001 Peter Johnson, Michael Urman
| DWORD memaddr { $$ = $2; SetEALen(&$$, 4); }
;
-mem: '[' memaddr ']' { $$ = $2; }
+memref: '[' memaddr ']' { $$ = $2; }
;
/* explicit memory */
-mem8x: BYTE mem { $$ = $2; }
+mem8x: BYTE memref { $$ = $2; }
;
-mem16x: WORD mem { $$ = $2; }
+mem16x: WORD memref { $$ = $2; }
;
-mem32x: DWORD mem { $$ = $2; }
+mem32x: DWORD memref { $$ = $2; }
;
-mem64x: QWORD mem { $$ = $2; }
+mem64x: QWORD memref { $$ = $2; }
;
-mem80x: TWORD mem { $$ = $2; }
+mem80x: TWORD memref { $$ = $2; }
;
-mem128x: DQWORD mem { $$ = $2; }
+mem128x: DQWORD memref { $$ = $2; }
+;
+
+/* other sized memory reference - no explicit size allowed */
+mem: memref { $$ = $1; }
+ | mem8x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem16x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem32x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem64x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem80x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
+ | mem128x { $$ = $1; Error(ERR_OP_SIZE_MISMATCH, (char *)NULL); }
;
/* implicit memory */
-mem8: mem
+mem8: memref
| mem8x
;
-mem16: mem
+mem16: memref
| mem16x
;
-mem32: mem
+mem32: memref
| mem32x
;
-mem64: mem
+mem64: memref
| mem64x
;
-mem80: mem
+mem80: memref
| mem80x
;
-mem128: mem
+mem128: memref
| mem128x
;
/* both 16 and 32 bit memory */
-mem1632: mem
+mem1632: memref
| mem16x
| mem32x
;