Fix regular expression at doc/rdsrc.pl
[platform/upstream/nasm.git] / parser.c
index bb56924..2d8d4ff 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -89,6 +89,8 @@ static int prefix_slot(int prefix)
     case P_REPNZ:
     case P_XACQUIRE:
     case P_XRELEASE:
+    case P_BND:
+    case P_NOBND:
         return PPS_REP;
     case P_O16:
     case P_O32:
@@ -100,6 +102,10 @@ static int prefix_slot(int prefix)
     case P_A64:
     case P_ASP:
         return PPS_ASIZE;
+    case P_EVEX:
+    case P_VEX3:
+    case P_VEX2:
+        return PPS_VEX;
     default:
         nasm_error(ERR_PANIC, "Invalid value %d passed to prefix_slot()", prefix);
         return -1;
@@ -197,7 +203,7 @@ static void process_size_override(insn *result, operand *op)
  * when two or more decorators follow a register operand,
  * consecutive decorators are parsed here.
  * opmask and zeroing decorators can be placed in any order.
- * e.g. zmm1 {k2}{z} or zmm2 {z,k3}
+ * e.g. zmm1 {k2}{z} or zmm2 {z}{k3}
  * decorator(s) are placed at the end of an operand.
  */
 static bool parse_braces(decoflags_t *decoflags)
@@ -209,7 +215,7 @@ static bool parse_braces(decoflags_t *decoflags)
     do {
         if (i == TOKEN_OPMASK) {
             if (*decoflags & OPMASK_MASK) {
-                nasm_error(ERR_NONFATAL, "opmask k%lu is already set",
+                nasm_error(ERR_NONFATAL, "opmask k%"PRIu64" is already set",
                            *decoflags & OPMASK_MASK);
                 *decoflags &= ~OPMASK_MASK;
             }
@@ -821,6 +827,13 @@ is_expression:
                 process_size_override(result, op);
                 i = stdscan(NULL, &tokval);
             }
+            /* when a comma follows an opening bracket - [ , eax*4] */
+            if (i == ',') {
+                /* treat as if there is a zero displacement virtually */
+                tokval.t_type = TOKEN_NUM;
+                tokval.t_integer = 0;
+                stdscan_set(stdscan_get() - 1);     /* rewind the comma */
+            }
         } else {                /* immediate operand, or register */
             mref = false;
             bracket = false;    /* placate optimisers */
@@ -937,7 +950,8 @@ is_expression:
                      * is expected for memory reference operands
                      */
                     if (tokval.t_flag & TFLAG_BRDCAST) {
-                        brace_flags |= GEN_BRDCAST(0);
+                        brace_flags |= GEN_BRDCAST(0) |
+                                       VAL_BRNUM(tokval.t_integer - BRC_1TO8);
                         i = stdscan(NULL, &tokval);
                     } else if (i == TOKEN_OPMASK) {
                         brace_flags |= VAL_OPMASK(nasm_regvals[tokval.t_integer]);