regs.pl: handle dashed sequences with suffixes
[nasm/autotest.git] / parser.c
blob54e17377767183caf86ab0e64a6af2f81391cee8
1 /* parser.c source line parser for the Netwide Assembler
3 * The Netwide Assembler is copyright (C) 1996 Simon Tatham and
4 * Julian Hall. All rights reserved. The software is
5 * redistributable under the licence given in the file "Licence"
6 * distributed in the NASM archive.
8 * initial version 27/iii/95 by Simon Tatham
9 */
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <stddef.h>
14 #include <string.h>
15 #include <ctype.h>
16 #include <inttypes.h>
18 #include "nasm.h"
19 #include "insns.h"
20 #include "nasmlib.h"
21 #include "parser.h"
22 #include "float.h"
24 extern int in_abs_seg; /* ABSOLUTE segment flag */
25 extern int32_t abs_seg; /* ABSOLUTE segment */
26 extern int32_t abs_offset; /* ABSOLUTE segment offset */
28 #include "regflags.c" /* List of register flags */
30 enum { /* special tokens */
31 S_BYTE, S_DWORD, S_FAR, S_LONG, S_NEAR, S_NOSPLIT, S_QWORD,
32 S_SHORT, S_STRICT, S_TO, S_TWORD, S_WORD
35 static int is_comma_next(void);
37 static int i;
38 static struct tokenval tokval;
39 static efunc error;
40 static struct ofmt *outfmt; /* Structure of addresses of output routines */
41 static loc_t *location; /* Pointer to current line's segment,offset */
43 void parser_global_info(struct ofmt *output, loc_t * locp)
45 outfmt = output;
46 location = locp;
49 insn *parse_line(int pass, char *buffer, insn * result,
50 efunc errfunc, evalfunc evaluate, ldfunc ldef)
52 int operand;
53 int critical;
54 struct eval_hints hints;
56 result->forw_ref = FALSE;
57 error = errfunc;
59 stdscan_reset();
60 stdscan_bufptr = buffer;
61 i = stdscan(NULL, &tokval);
63 result->label = NULL; /* Assume no label */
64 result->eops = NULL; /* must do this, whatever happens */
65 result->operands = 0; /* must initialize this */
67 if (i == 0) { /* blank line - ignore */
68 result->opcode = -1; /* and no instruction either */
69 return result;
71 if (i != TOKEN_ID && i != TOKEN_INSN && i != TOKEN_PREFIX &&
72 (i != TOKEN_REG || (REG_SREG & ~reg_flags[tokval.t_integer]))) {
73 error(ERR_NONFATAL, "label or instruction expected"
74 " at start of line");
75 result->opcode = -1;
76 return result;
79 if (i == TOKEN_ID) { /* there's a label here */
80 result->label = tokval.t_charptr;
81 i = stdscan(NULL, &tokval);
82 if (i == ':') { /* skip over the optional colon */
83 i = stdscan(NULL, &tokval);
84 } else if (i == 0) {
85 error(ERR_WARNING | ERR_WARN_OL | ERR_PASS1,
86 "label alone on a line without a colon might be in error");
88 if (i != TOKEN_INSN || tokval.t_integer != I_EQU) {
90 * FIXME: location->segment could be NO_SEG, in which case
91 * it is possible we should be passing 'abs_seg'. Look into this.
92 * Work out whether that is *really* what we should be doing.
93 * Generally fix things. I think this is right as it is, but
94 * am still not certain.
96 ldef(result->label, in_abs_seg ? abs_seg : location->segment,
97 location->offset, NULL, TRUE, FALSE, outfmt, errfunc);
101 if (i == 0) {
102 result->opcode = -1; /* this line contains just a label */
103 return result;
106 result->nprefix = 0;
107 result->times = 1L;
109 while (i == TOKEN_PREFIX ||
110 (i == TOKEN_REG && !(REG_SREG & ~reg_flags[tokval.t_integer])))
113 * Handle special case: the TIMES prefix.
115 if (i == TOKEN_PREFIX && tokval.t_integer == P_TIMES) {
116 expr *value;
118 i = stdscan(NULL, &tokval);
119 value =
120 evaluate(stdscan, NULL, &tokval, NULL, pass0, error, NULL);
121 i = tokval.t_type;
122 if (!value) { /* but, error in evaluator */
123 result->opcode = -1; /* unrecoverable parse error: */
124 return result; /* ignore this instruction */
126 if (!is_simple(value)) {
127 error(ERR_NONFATAL,
128 "non-constant argument supplied to TIMES");
129 result->times = 1L;
130 } else {
131 result->times = value->value;
132 if (value->value < 0) {
133 error(ERR_NONFATAL, "TIMES value %d is negative",
134 value->value);
135 result->times = 0;
138 } else {
139 if (result->nprefix == MAXPREFIX)
140 error(ERR_NONFATAL,
141 "instruction has more than %d prefixes", MAXPREFIX);
142 else
143 result->prefixes[result->nprefix++] = tokval.t_integer;
144 i = stdscan(NULL, &tokval);
148 if (i != TOKEN_INSN) {
149 if (result->nprefix > 0 && i == 0) {
151 * Instruction prefixes are present, but no actual
152 * instruction. This is allowed: at this point we
153 * invent a notional instruction of RESB 0.
155 result->opcode = I_RESB;
156 result->operands = 1;
157 result->oprs[0].type = IMMEDIATE;
158 result->oprs[0].offset = 0L;
159 result->oprs[0].segment = result->oprs[0].wrt = NO_SEG;
160 return result;
161 } else {
162 error(ERR_NONFATAL, "parser: instruction expected");
163 result->opcode = -1;
164 return result;
168 result->opcode = tokval.t_integer;
169 result->condition = tokval.t_inttwo;
172 * RESB, RESW and RESD cannot be satisfied with incorrectly
173 * evaluated operands, since the correct values _must_ be known
174 * on the first pass. Hence, even in pass one, we set the
175 * `critical' flag on calling evaluate(), so that it will bomb
176 * out on undefined symbols. Nasty, but there's nothing we can
177 * do about it.
179 * For the moment, EQU has the same difficulty, so we'll
180 * include that.
182 if (result->opcode == I_RESB || result->opcode == I_RESW || result->opcode == I_RESD || result->opcode == I_RESQ || result->opcode == I_REST || result->opcode == I_EQU || result->opcode == I_INCBIN) { /* fbk */
183 critical = pass0;
184 } else
185 critical = (pass == 2 ? 2 : 0);
187 if (result->opcode == I_DB ||
188 result->opcode == I_DW ||
189 result->opcode == I_DD ||
190 result->opcode == I_DQ ||
191 result->opcode == I_DT || result->opcode == I_INCBIN) {
192 extop *eop, **tail = &result->eops, **fixptr;
193 int oper_num = 0;
195 result->eops_float = FALSE;
198 * Begin to read the DB/DW/DD/DQ/DT/INCBIN operands.
200 while (1) {
201 i = stdscan(NULL, &tokval);
202 if (i == 0)
203 break;
204 fixptr = tail;
205 eop = *tail = nasm_malloc(sizeof(extop));
206 tail = &eop->next;
207 eop->next = NULL;
208 eop->type = EOT_NOTHING;
209 oper_num++;
211 if (i == TOKEN_NUM && tokval.t_charptr && is_comma_next()) {
212 eop->type = EOT_DB_STRING;
213 eop->stringval = tokval.t_charptr;
214 eop->stringlen = tokval.t_inttwo;
215 i = stdscan(NULL, &tokval); /* eat the comma */
216 continue;
219 if ((i == TOKEN_FLOAT && is_comma_next()) || i == '-') {
220 int32_t sign = +1L;
222 if (i == '-') {
223 char *save = stdscan_bufptr;
224 i = stdscan(NULL, &tokval);
225 sign = -1L;
226 if (i != TOKEN_FLOAT || !is_comma_next()) {
227 stdscan_bufptr = save;
228 i = tokval.t_type = '-';
232 if (i == TOKEN_FLOAT) {
233 eop->type = EOT_DB_STRING;
234 result->eops_float = TRUE;
235 if (result->opcode == I_DD)
236 eop->stringlen = 4;
237 else if (result->opcode == I_DQ)
238 eop->stringlen = 8;
239 else if (result->opcode == I_DT)
240 eop->stringlen = 10;
241 else {
242 error(ERR_NONFATAL, "floating-point constant"
243 " encountered in `D%c' instruction",
244 result->opcode == I_DW ? 'W' : 'B');
246 * fix suggested by Pedro Gimeno... original line
247 * was:
248 * eop->type = EOT_NOTHING;
250 eop->stringlen = 0;
252 eop =
253 nasm_realloc(eop, sizeof(extop) + eop->stringlen);
254 tail = &eop->next;
255 *fixptr = eop;
256 eop->stringval = (char *)eop + sizeof(extop);
257 if (eop->stringlen < 4 ||
258 !float_const(tokval.t_charptr, sign,
259 (uint8_t *)eop->stringval,
260 eop->stringlen, error))
261 eop->type = EOT_NOTHING;
262 i = stdscan(NULL, &tokval); /* eat the comma */
263 continue;
267 /* anything else */
269 expr *value;
270 value = evaluate(stdscan, NULL, &tokval, NULL,
271 critical, error, NULL);
272 i = tokval.t_type;
273 if (!value) { /* error in evaluator */
274 result->opcode = -1; /* unrecoverable parse error: */
275 return result; /* ignore this instruction */
277 if (is_unknown(value)) {
278 eop->type = EOT_DB_NUMBER;
279 eop->offset = 0; /* doesn't matter what we put */
280 eop->segment = eop->wrt = NO_SEG; /* likewise */
281 } else if (is_reloc(value)) {
282 eop->type = EOT_DB_NUMBER;
283 eop->offset = reloc_value(value);
284 eop->segment = reloc_seg(value);
285 eop->wrt = reloc_wrt(value);
286 } else {
287 error(ERR_NONFATAL,
288 "operand %d: expression is not simple"
289 " or relocatable", oper_num);
294 * We're about to call stdscan(), which will eat the
295 * comma that we're currently sitting on between
296 * arguments. However, we'd better check first that it
297 * _is_ a comma.
299 if (i == 0) /* also could be EOL */
300 break;
301 if (i != ',') {
302 error(ERR_NONFATAL, "comma expected after operand %d",
303 oper_num);
304 result->opcode = -1; /* unrecoverable parse error: */
305 return result; /* ignore this instruction */
309 if (result->opcode == I_INCBIN) {
311 * Correct syntax for INCBIN is that there should be
312 * one string operand, followed by one or two numeric
313 * operands.
315 if (!result->eops || result->eops->type != EOT_DB_STRING)
316 error(ERR_NONFATAL, "`incbin' expects a file name");
317 else if (result->eops->next &&
318 result->eops->next->type != EOT_DB_NUMBER)
319 error(ERR_NONFATAL, "`incbin': second parameter is",
320 " non-numeric");
321 else if (result->eops->next && result->eops->next->next &&
322 result->eops->next->next->type != EOT_DB_NUMBER)
323 error(ERR_NONFATAL, "`incbin': third parameter is",
324 " non-numeric");
325 else if (result->eops->next && result->eops->next->next &&
326 result->eops->next->next->next)
327 error(ERR_NONFATAL,
328 "`incbin': more than three parameters");
329 else
330 return result;
332 * If we reach here, one of the above errors happened.
333 * Throw the instruction away.
335 result->opcode = -1;
336 return result;
337 } else /* DB ... */ if (oper_num == 0)
338 error(ERR_WARNING | ERR_PASS1,
339 "no operand for data declaration");
340 else
341 result->operands = oper_num;
343 return result;
346 /* right. Now we begin to parse the operands. There may be up to three
347 * of these, separated by commas, and terminated by a zero token. */
349 for (operand = 0; operand < 3; operand++) {
350 expr *value; /* used most of the time */
351 int mref; /* is this going to be a memory ref? */
352 int bracket; /* is it a [] mref, or a & mref? */
353 int setsize = 0;
355 result->oprs[operand].addr_size = 0; /* have to zero this whatever */
356 result->oprs[operand].eaflags = 0; /* and this */
357 result->oprs[operand].opflags = 0;
359 i = stdscan(NULL, &tokval);
360 if (i == 0)
361 break; /* end of operands: get out of here */
362 result->oprs[operand].type = 0; /* so far, no override */
363 while (i == TOKEN_SPECIAL) { /* size specifiers */
364 switch ((int)tokval.t_integer) {
365 case S_BYTE:
366 if (!setsize) /* we want to use only the first */
367 result->oprs[operand].type |= BITS8;
368 setsize = 1;
369 break;
370 case S_WORD:
371 if (!setsize)
372 result->oprs[operand].type |= BITS16;
373 setsize = 1;
374 break;
375 case S_DWORD:
376 case S_LONG:
377 if (!setsize)
378 result->oprs[operand].type |= BITS32;
379 setsize = 1;
380 break;
381 case S_QWORD:
382 if (!setsize)
383 result->oprs[operand].type |= BITS64;
384 setsize = 1;
385 break;
386 case S_TWORD:
387 if (!setsize)
388 result->oprs[operand].type |= BITS80;
389 setsize = 1;
390 break;
391 case S_TO:
392 result->oprs[operand].type |= TO;
393 break;
394 case S_STRICT:
395 result->oprs[operand].type |= STRICT;
396 break;
397 case S_FAR:
398 result->oprs[operand].type |= FAR;
399 break;
400 case S_NEAR:
401 result->oprs[operand].type |= NEAR;
402 break;
403 case S_SHORT:
404 result->oprs[operand].type |= SHORT;
405 break;
406 default:
407 error(ERR_NONFATAL, "invalid operand size specification");
409 i = stdscan(NULL, &tokval);
412 if (i == '[' || i == '&') { /* memory reference */
413 mref = TRUE;
414 bracket = (i == '[');
415 i = stdscan(NULL, &tokval);
416 if (i == TOKEN_SPECIAL) { /* check for address size override */
417 if (tasm_compatible_mode) {
418 switch ((int)tokval.t_integer) {
419 /* For TASM compatibility a size override inside the
420 * brackets changes the size of the operand, not the
421 * address type of the operand as it does in standard
422 * NASM syntax. Hence:
424 * mov eax,[DWORD val]
426 * is valid syntax in TASM compatibility mode. Note that
427 * you lose the ability to override the default address
428 * type for the instruction, but we never use anything
429 * but 32-bit flat model addressing in our code.
431 case S_BYTE:
432 result->oprs[operand].type |= BITS8;
433 break;
434 case S_WORD:
435 result->oprs[operand].type |= BITS16;
436 break;
437 case S_DWORD:
438 case S_LONG:
439 result->oprs[operand].type |= BITS32;
440 break;
441 case S_QWORD:
442 result->oprs[operand].type |= BITS64;
443 break;
444 case S_TWORD:
445 result->oprs[operand].type |= BITS80;
446 break;
447 default:
448 error(ERR_NONFATAL,
449 "invalid operand size specification");
451 } else {
452 /* Standard NASM compatible syntax */
453 switch ((int)tokval.t_integer) {
454 case S_NOSPLIT:
455 result->oprs[operand].eaflags |= EAF_TIMESTWO;
456 break;
457 case S_BYTE:
458 result->oprs[operand].eaflags |= EAF_BYTEOFFS;
459 break;
460 case S_WORD:
461 result->oprs[operand].addr_size = 16;
462 result->oprs[operand].eaflags |= EAF_WORDOFFS;
463 break;
464 case S_DWORD:
465 case S_LONG:
466 result->oprs[operand].addr_size = 32;
467 result->oprs[operand].eaflags |= EAF_WORDOFFS;
468 break;
469 default:
470 error(ERR_NONFATAL, "invalid size specification in"
471 " effective address");
474 i = stdscan(NULL, &tokval);
476 } else { /* immediate operand, or register */
477 mref = FALSE;
478 bracket = FALSE; /* placate optimisers */
481 if ((result->oprs[operand].type & FAR) && !mref &&
482 result->opcode != I_JMP && result->opcode != I_CALL) {
483 error(ERR_NONFATAL, "invalid use of FAR operand specifier");
486 value = evaluate(stdscan, NULL, &tokval,
487 &result->oprs[operand].opflags,
488 critical, error, &hints);
489 i = tokval.t_type;
490 if (result->oprs[operand].opflags & OPFLAG_FORWARD) {
491 result->forw_ref = TRUE;
493 if (!value) { /* error in evaluator */
494 result->opcode = -1; /* unrecoverable parse error: */
495 return result; /* ignore this instruction */
497 if (i == ':' && mref) { /* it was seg:offset */
499 * Process the segment override.
501 if (value[1].type != 0 || value->value != 1 ||
502 REG_SREG & ~reg_flags[value->type])
503 error(ERR_NONFATAL, "invalid segment override");
504 else if (result->nprefix == MAXPREFIX)
505 error(ERR_NONFATAL,
506 "instruction has more than %d prefixes", MAXPREFIX);
507 else
508 result->prefixes[result->nprefix++] = value->type;
510 i = stdscan(NULL, &tokval); /* then skip the colon */
511 if (i == TOKEN_SPECIAL) { /* another check for size override */
512 switch ((int)tokval.t_integer) {
513 case S_WORD:
514 result->oprs[operand].addr_size = 16;
515 break;
516 case S_DWORD:
517 case S_LONG:
518 result->oprs[operand].addr_size = 32;
519 break;
520 default:
521 error(ERR_NONFATAL, "invalid size specification in"
522 " effective address");
524 i = stdscan(NULL, &tokval);
526 value = evaluate(stdscan, NULL, &tokval,
527 &result->oprs[operand].opflags,
528 critical, error, &hints);
529 i = tokval.t_type;
530 if (result->oprs[operand].opflags & OPFLAG_FORWARD) {
531 result->forw_ref = TRUE;
533 /* and get the offset */
534 if (!value) { /* but, error in evaluator */
535 result->opcode = -1; /* unrecoverable parse error: */
536 return result; /* ignore this instruction */
539 if (mref && bracket) { /* find ] at the end */
540 if (i != ']') {
541 error(ERR_NONFATAL, "parser: expecting ]");
542 do { /* error recovery again */
543 i = stdscan(NULL, &tokval);
544 } while (i != 0 && i != ',');
545 } else /* we got the required ] */
546 i = stdscan(NULL, &tokval);
547 } else { /* immediate operand */
548 if (i != 0 && i != ',' && i != ':') {
549 error(ERR_NONFATAL, "comma or end of line expected");
550 do { /* error recovery */
551 i = stdscan(NULL, &tokval);
552 } while (i != 0 && i != ',');
553 } else if (i == ':') {
554 result->oprs[operand].type |= COLON;
558 /* now convert the exprs returned from evaluate() into operand
559 * descriptions... */
561 if (mref) { /* it's a memory reference */
562 expr *e = value;
563 int b, i, s; /* basereg, indexreg, scale */
564 int64_t o; /* offset */
566 b = i = -1, o = s = 0;
567 result->oprs[operand].hintbase = hints.base;
568 result->oprs[operand].hinttype = hints.type;
570 if (e->type && e->type <= EXPR_REG_END) { /* this bit's a register */
571 if (e->value == 1) /* in fact it can be basereg */
572 b = e->type;
573 else /* no, it has to be indexreg */
574 i = e->type, s = e->value;
575 e++;
577 if (e->type && e->type <= EXPR_REG_END) { /* it's a 2nd register */
578 if (b != -1) /* If the first was the base, ... */
579 i = e->type, s = e->value; /* second has to be indexreg */
581 else if (e->value != 1) { /* If both want to be index */
582 error(ERR_NONFATAL,
583 "beroset-p-592-invalid effective address");
584 result->opcode = -1;
585 return result;
586 } else
587 b = e->type;
588 e++;
590 if (e->type != 0) { /* is there an offset? */
591 if (e->type <= EXPR_REG_END) { /* in fact, is there an error? */
592 error(ERR_NONFATAL,
593 "beroset-p-603-invalid effective address");
594 result->opcode = -1;
595 return result;
596 } else {
597 if (e->type == EXPR_UNKNOWN) {
598 o = 0; /* doesn't matter what */
599 result->oprs[operand].wrt = NO_SEG; /* nor this */
600 result->oprs[operand].segment = NO_SEG; /* or this */
601 while (e->type)
602 e++; /* go to the end of the line */
603 } else {
604 if (e->type == EXPR_SIMPLE) {
605 o = e->value;
606 e++;
608 if (e->type == EXPR_WRT) {
609 result->oprs[operand].wrt = e->value;
610 e++;
611 } else
612 result->oprs[operand].wrt = NO_SEG;
614 * Look for a segment base type.
616 if (e->type && e->type < EXPR_SEGBASE) {
617 error(ERR_NONFATAL,
618 "beroset-p-630-invalid effective address");
619 result->opcode = -1;
620 return result;
622 while (e->type && e->value == 0)
623 e++;
624 if (e->type && e->value != 1) {
625 error(ERR_NONFATAL,
626 "beroset-p-637-invalid effective address");
627 result->opcode = -1;
628 return result;
630 if (e->type) {
631 result->oprs[operand].segment =
632 e->type - EXPR_SEGBASE;
633 e++;
634 } else
635 result->oprs[operand].segment = NO_SEG;
636 while (e->type && e->value == 0)
637 e++;
638 if (e->type) {
639 error(ERR_NONFATAL,
640 "beroset-p-650-invalid effective address");
641 result->opcode = -1;
642 return result;
646 } else {
647 o = 0;
648 result->oprs[operand].wrt = NO_SEG;
649 result->oprs[operand].segment = NO_SEG;
652 if (e->type != 0) { /* there'd better be nothing left! */
653 error(ERR_NONFATAL,
654 "beroset-p-663-invalid effective address");
655 result->opcode = -1;
656 return result;
659 result->oprs[operand].type |= MEMORY;
660 if (b == -1 && (i == -1 || s == 0))
661 result->oprs[operand].type |= MEM_OFFS;
662 result->oprs[operand].basereg = b;
663 result->oprs[operand].indexreg = i;
664 result->oprs[operand].scale = s;
665 result->oprs[operand].offset = o;
666 } else { /* it's not a memory reference */
668 if (is_just_unknown(value)) { /* it's immediate but unknown */
669 result->oprs[operand].type |= IMMEDIATE;
670 result->oprs[operand].offset = 0; /* don't care */
671 result->oprs[operand].segment = NO_SEG; /* don't care again */
672 result->oprs[operand].wrt = NO_SEG; /* still don't care */
673 } else if (is_reloc(value)) { /* it's immediate */
674 result->oprs[operand].type |= IMMEDIATE;
675 result->oprs[operand].offset = reloc_value(value);
676 result->oprs[operand].segment = reloc_seg(value);
677 result->oprs[operand].wrt = reloc_wrt(value);
678 if (is_simple(value)) {
679 if (reloc_value(value) == 1)
680 result->oprs[operand].type |= UNITY;
681 if (optimizing >= 0 &&
682 !(result->oprs[operand].type & STRICT)) {
683 if (reloc_value(value) >= -128 &&
684 reloc_value(value) <= 127)
685 result->oprs[operand].type |= SBYTE;
688 } else { /* it's a register */
690 if (value->type >= EXPR_SIMPLE || value->value != 1) {
691 error(ERR_NONFATAL, "invalid operand type");
692 result->opcode = -1;
693 return result;
697 * check that its only 1 register, not an expression...
699 for (i = 1; value[i].type; i++)
700 if (value[i].value) {
701 error(ERR_NONFATAL, "invalid operand type");
702 result->opcode = -1;
703 return result;
706 /* clear overrides, except TO which applies to FPU regs */
707 if (result->oprs[operand].type & ~TO) {
709 * we want to produce a warning iff the specified size
710 * is different from the register size
712 i = result->oprs[operand].type & SIZE_MASK;
713 } else
714 i = 0;
716 result->oprs[operand].type &= TO;
717 result->oprs[operand].type |= REGISTER;
718 result->oprs[operand].type |= reg_flags[value->type];
719 result->oprs[operand].basereg = value->type;
721 if (i && (result->oprs[operand].type & SIZE_MASK) != i)
722 error(ERR_WARNING | ERR_PASS1,
723 "register size specification ignored");
728 result->operands = operand; /* set operand count */
730 while (operand < 3) /* clear remaining operands */
731 result->oprs[operand++].type = 0;
734 * Transform RESW, RESD, RESQ, REST into RESB.
736 switch (result->opcode) {
737 case I_RESW:
738 result->opcode = I_RESB;
739 result->oprs[0].offset *= 2;
740 break;
741 case I_RESD:
742 result->opcode = I_RESB;
743 result->oprs[0].offset *= 4;
744 break;
745 case I_RESQ:
746 result->opcode = I_RESB;
747 result->oprs[0].offset *= 8;
748 break;
749 case I_REST:
750 result->opcode = I_RESB;
751 result->oprs[0].offset *= 10;
752 break;
755 return result;
758 static int is_comma_next(void)
760 char *p;
761 int i;
762 struct tokenval tv;
764 p = stdscan_bufptr;
765 i = stdscan(NULL, &tv);
766 stdscan_bufptr = p;
767 return (i == ',' || i == ';' || !i);
770 void cleanup_insn(insn * i)
772 extop *e;
774 while (i->eops) {
775 e = i->eops;
776 i->eops = i->eops->next;
777 nasm_free(e);