* MAINTAINERS: Change e-mail address back to airs.com.
[binutils.git] / gas / config / m68k-parse.y
blob15c6236c58e0e852474cb4f69e79821b1fdbe4f3
1 /* m68k.y -- bison grammar for m68k operand parsing
2 Copyright 1995, 1996, 1997, 1998, 2001 Free Software Foundation, Inc.
3 Written by Ken Raeburn and Ian Lance Taylor, Cygnus Support
5 This file is part of GAS, the GNU Assembler.
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
22 /* This file holds a bison grammar to parse m68k operands. The m68k
23 has a complicated operand syntax, and gas supports two main
24 variations of it. Using a grammar is probably overkill, but at
25 least it makes clear exactly what we do support. */
29 #include "as.h"
30 #include "tc-m68k.h"
31 #include "m68k-parse.h"
32 #include "safe-ctype.h"
34 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
35 etc), as well as gratuitiously global symbol names If other parser
36 generators (bison, byacc, etc) produce additional global names that
37 conflict at link time, then those parser generators need to be
38 fixed instead of adding those names to this list. */
40 #define yymaxdepth m68k_maxdepth
41 #define yyparse m68k_parse
42 #define yylex m68k_lex
43 #define yyerror m68k_error
44 #define yylval m68k_lval
45 #define yychar m68k_char
46 #define yydebug m68k_debug
47 #define yypact m68k_pact
48 #define yyr1 m68k_r1
49 #define yyr2 m68k_r2
50 #define yydef m68k_def
51 #define yychk m68k_chk
52 #define yypgo m68k_pgo
53 #define yyact m68k_act
54 #define yyexca m68k_exca
55 #define yyerrflag m68k_errflag
56 #define yynerrs m68k_nerrs
57 #define yyps m68k_ps
58 #define yypv m68k_pv
59 #define yys m68k_s
60 #define yy_yys m68k_yys
61 #define yystate m68k_state
62 #define yytmp m68k_tmp
63 #define yyv m68k_v
64 #define yy_yyv m68k_yyv
65 #define yyval m68k_val
66 #define yylloc m68k_lloc
67 #define yyreds m68k_reds /* With YYDEBUG defined */
68 #define yytoks m68k_toks /* With YYDEBUG defined */
69 #define yylhs m68k_yylhs
70 #define yylen m68k_yylen
71 #define yydefred m68k_yydefred
72 #define yydgoto m68k_yydgoto
73 #define yysindex m68k_yysindex
74 #define yyrindex m68k_yyrindex
75 #define yygindex m68k_yygindex
76 #define yytable m68k_yytable
77 #define yycheck m68k_yycheck
79 #ifndef YYDEBUG
80 #define YYDEBUG 1
81 #endif
83 /* Internal functions. */
85 static enum m68k_register m68k_reg_parse PARAMS ((char **));
86 static int yylex PARAMS ((void));
87 static void yyerror PARAMS ((const char *));
89 /* The parser sets fields pointed to by this global variable. */
90 static struct m68k_op *op;
94 %union
96 struct m68k_indexreg indexreg;
97 enum m68k_register reg;
98 struct m68k_exp exp;
99 unsigned long mask;
100 int onereg;
103 %token <reg> DR AR FPR FPCR LPC ZAR ZDR LZPC CREG
104 %token <indexreg> INDEXREG
105 %token <exp> EXPR
107 %type <indexreg> zireg zdireg
108 %type <reg> zadr zdr apc zapc zpc optzapc optczapc
109 %type <exp> optcexpr optexprc
110 %type <mask> reglist ireglist reglistpair
111 %type <onereg> reglistreg
115 /* An operand. */
117 operand:
118 generic_operand
119 | motorola_operand
120 | mit_operand
123 /* A generic operand. */
125 generic_operand:
128 op->mode = DREG;
129 op->reg = $1;
131 | AR
133 op->mode = AREG;
134 op->reg = $1;
136 | FPR
138 op->mode = FPREG;
139 op->reg = $1;
141 | FPCR
143 op->mode = CONTROL;
144 op->reg = $1;
146 | CREG
148 op->mode = CONTROL;
149 op->reg = $1;
151 | EXPR
153 op->mode = ABSL;
154 op->disp = $1;
156 | '#' EXPR
158 op->mode = IMMED;
159 op->disp = $2;
161 | '&' EXPR
163 op->mode = IMMED;
164 op->disp = $2;
166 | reglist
168 op->mode = REGLST;
169 op->mask = $1;
173 /* An operand in Motorola syntax. This includes MRI syntax as well,
174 which may or may not be different in that it permits commutativity
175 of index and base registers, and permits an offset expression to
176 appear inside or outside of the parentheses. */
178 motorola_operand:
179 '(' AR ')'
181 op->mode = AINDR;
182 op->reg = $2;
184 | '(' AR ')' '+'
186 op->mode = AINC;
187 op->reg = $2;
189 | '-' '(' AR ')'
191 op->mode = ADEC;
192 op->reg = $3;
194 | '(' EXPR ',' zapc ')'
196 op->reg = $4;
197 op->disp = $2;
198 if (($4 >= ZADDR0 && $4 <= ZADDR7)
199 || $4 == ZPC)
200 op->mode = BASE;
201 else
202 op->mode = DISP;
204 | '(' zapc ',' EXPR ')'
206 op->reg = $2;
207 op->disp = $4;
208 if (($2 >= ZADDR0 && $2 <= ZADDR7)
209 || $2 == ZPC)
210 op->mode = BASE;
211 else
212 op->mode = DISP;
214 | EXPR '(' zapc ')'
216 op->reg = $3;
217 op->disp = $1;
218 if (($3 >= ZADDR0 && $3 <= ZADDR7)
219 || $3 == ZPC)
220 op->mode = BASE;
221 else
222 op->mode = DISP;
224 | '(' LPC ')'
226 op->mode = DISP;
227 op->reg = $2;
229 | '(' ZAR ')'
231 op->mode = BASE;
232 op->reg = $2;
234 | '(' LZPC ')'
236 op->mode = BASE;
237 op->reg = $2;
239 | '(' EXPR ',' zapc ',' zireg ')'
241 op->mode = BASE;
242 op->reg = $4;
243 op->disp = $2;
244 op->index = $6;
246 | '(' EXPR ',' zapc ',' zpc ')'
248 if ($4 == PC || $4 == ZPC)
249 yyerror (_("syntax error"));
250 op->mode = BASE;
251 op->reg = $6;
252 op->disp = $2;
253 op->index.reg = $4;
254 op->index.size = SIZE_UNSPEC;
255 op->index.scale = 1;
257 | '(' EXPR ',' zdireg optczapc ')'
259 op->mode = BASE;
260 op->reg = $5;
261 op->disp = $2;
262 op->index = $4;
264 | '(' zdireg ',' EXPR ')'
266 op->mode = BASE;
267 op->disp = $4;
268 op->index = $2;
270 | EXPR '(' zapc ',' zireg ')'
272 op->mode = BASE;
273 op->reg = $3;
274 op->disp = $1;
275 op->index = $5;
277 | '(' zapc ',' zireg ')'
279 op->mode = BASE;
280 op->reg = $2;
281 op->index = $4;
283 | EXPR '(' zapc ',' zpc ')'
285 if ($3 == PC || $3 == ZPC)
286 yyerror (_("syntax error"));
287 op->mode = BASE;
288 op->reg = $5;
289 op->disp = $1;
290 op->index.reg = $3;
291 op->index.size = SIZE_UNSPEC;
292 op->index.scale = 1;
294 | '(' zapc ',' zpc ')'
296 if ($2 == PC || $2 == ZPC)
297 yyerror (_("syntax error"));
298 op->mode = BASE;
299 op->reg = $4;
300 op->index.reg = $2;
301 op->index.size = SIZE_UNSPEC;
302 op->index.scale = 1;
304 | EXPR '(' zdireg optczapc ')'
306 op->mode = BASE;
307 op->reg = $4;
308 op->disp = $1;
309 op->index = $3;
311 | '(' zdireg optczapc ')'
313 op->mode = BASE;
314 op->reg = $3;
315 op->index = $2;
317 | '(' '[' EXPR optczapc ']' ',' zireg optcexpr ')'
319 op->mode = POST;
320 op->reg = $4;
321 op->disp = $3;
322 op->index = $7;
323 op->odisp = $8;
325 | '(' '[' EXPR optczapc ']' optcexpr ')'
327 op->mode = POST;
328 op->reg = $4;
329 op->disp = $3;
330 op->odisp = $6;
332 | '(' '[' zapc ']' ',' zireg optcexpr ')'
334 op->mode = POST;
335 op->reg = $3;
336 op->index = $6;
337 op->odisp = $7;
339 | '(' '[' zapc ']' optcexpr ')'
341 op->mode = POST;
342 op->reg = $3;
343 op->odisp = $5;
345 | '(' '[' EXPR ',' zapc ',' zireg ']' optcexpr ')'
347 op->mode = PRE;
348 op->reg = $5;
349 op->disp = $3;
350 op->index = $7;
351 op->odisp = $9;
353 | '(' '[' zapc ',' zireg ']' optcexpr ')'
355 op->mode = PRE;
356 op->reg = $3;
357 op->index = $5;
358 op->odisp = $7;
360 | '(' '[' EXPR ',' zapc ',' zpc ']' optcexpr ')'
362 if ($5 == PC || $5 == ZPC)
363 yyerror (_("syntax error"));
364 op->mode = PRE;
365 op->reg = $7;
366 op->disp = $3;
367 op->index.reg = $5;
368 op->index.size = SIZE_UNSPEC;
369 op->index.scale = 1;
370 op->odisp = $9;
372 | '(' '[' zapc ',' zpc ']' optcexpr ')'
374 if ($3 == PC || $3 == ZPC)
375 yyerror (_("syntax error"));
376 op->mode = PRE;
377 op->reg = $5;
378 op->index.reg = $3;
379 op->index.size = SIZE_UNSPEC;
380 op->index.scale = 1;
381 op->odisp = $7;
383 | '(' '[' optexprc zdireg optczapc ']' optcexpr ')'
385 op->mode = PRE;
386 op->reg = $5;
387 op->disp = $3;
388 op->index = $4;
389 op->odisp = $7;
393 /* An operand in MIT syntax. */
395 mit_operand:
396 optzapc '@'
398 /* We use optzapc to avoid a shift/reduce conflict. */
399 if ($1 < ADDR0 || $1 > ADDR7)
400 yyerror (_("syntax error"));
401 op->mode = AINDR;
402 op->reg = $1;
404 | optzapc '@' '+'
406 /* We use optzapc to avoid a shift/reduce conflict. */
407 if ($1 < ADDR0 || $1 > ADDR7)
408 yyerror (_("syntax error"));
409 op->mode = AINC;
410 op->reg = $1;
412 | optzapc '@' '-'
414 /* We use optzapc to avoid a shift/reduce conflict. */
415 if ($1 < ADDR0 || $1 > ADDR7)
416 yyerror (_("syntax error"));
417 op->mode = ADEC;
418 op->reg = $1;
420 | optzapc '@' '(' EXPR ')'
422 op->reg = $1;
423 op->disp = $4;
424 if (($1 >= ZADDR0 && $1 <= ZADDR7)
425 || $1 == ZPC)
426 op->mode = BASE;
427 else
428 op->mode = DISP;
430 | optzapc '@' '(' optexprc zireg ')'
432 op->mode = BASE;
433 op->reg = $1;
434 op->disp = $4;
435 op->index = $5;
437 | optzapc '@' '(' EXPR ')' '@' '(' optexprc zireg ')'
439 op->mode = POST;
440 op->reg = $1;
441 op->disp = $4;
442 op->index = $9;
443 op->odisp = $8;
445 | optzapc '@' '(' EXPR ')' '@' '(' EXPR ')'
447 op->mode = POST;
448 op->reg = $1;
449 op->disp = $4;
450 op->odisp = $8;
452 | optzapc '@' '(' optexprc zireg ')' '@' '(' EXPR ')'
454 op->mode = PRE;
455 op->reg = $1;
456 op->disp = $4;
457 op->index = $5;
458 op->odisp = $9;
462 /* An index register, possibly suppressed, which need not have a size
463 or scale. */
465 zireg:
466 INDEXREG
467 | zadr
469 $$.reg = $1;
470 $$.size = SIZE_UNSPEC;
471 $$.scale = 1;
475 /* A register which may be an index register, but which may not be an
476 address register. This nonterminal is used to avoid ambiguity when
477 trying to parse something like (0,d5,a6) as compared to (0,a6,d5). */
479 zdireg:
480 INDEXREG
481 | zdr
483 $$.reg = $1;
484 $$.size = SIZE_UNSPEC;
485 $$.scale = 1;
489 /* An address or data register, or a suppressed address or data
490 register. */
492 zadr:
494 | AR
495 | ZAR
498 /* A data register which may be suppressed. */
500 zdr:
502 | ZDR
505 /* Either an address register or the PC. */
507 apc:
509 | LPC
512 /* Either an address register, or the PC, or a suppressed address
513 register, or a suppressed PC. */
515 zapc:
517 | LZPC
518 | ZAR
521 /* An optional zapc. */
523 optzapc:
524 /* empty */
526 $$ = ZADDR0;
528 | zapc
531 /* The PC, optionally suppressed. */
533 zpc:
535 | LZPC
538 /* ',' zapc when it may be omitted. */
540 optczapc:
541 /* empty */
543 $$ = ZADDR0;
545 | ',' zapc
547 $$ = $2;
551 /* ',' EXPR when it may be omitted. */
553 optcexpr:
554 /* empty */
556 $$.exp.X_op = O_absent;
557 $$.size = SIZE_UNSPEC;
559 | ',' EXPR
561 $$ = $2;
565 /* EXPR ',' when it may be omitted. */
567 optexprc:
568 /* empty */
570 $$.exp.X_op = O_absent;
571 $$.size = SIZE_UNSPEC;
573 | EXPR ','
575 $$ = $1;
579 /* A register list for the movem instruction. */
581 reglist:
582 reglistpair
583 | reglistpair '/' ireglist
585 $$ = $1 | $3;
587 | reglistreg '/' ireglist
589 $$ = (1 << $1) | $3;
593 /* We use ireglist when we know we are looking at a reglist, and we
594 can safely reduce a simple register to reglistreg. If we permitted
595 reglist to reduce to reglistreg, it would be ambiguous whether a
596 plain register were a DREG/AREG/FPREG or a REGLST. */
598 ireglist:
599 reglistreg
601 $$ = 1 << $1;
603 | reglistpair
604 | reglistpair '/' ireglist
606 $$ = $1 | $3;
608 | reglistreg '/' ireglist
610 $$ = (1 << $1) | $3;
614 reglistpair:
615 reglistreg '-' reglistreg
617 if ($1 <= $3)
618 $$ = (1 << ($3 + 1)) - 1 - ((1 << $1) - 1);
619 else
620 $$ = (1 << ($1 + 1)) - 1 - ((1 << $3) - 1);
624 reglistreg:
627 $$ = $1 - DATA0;
629 | AR
631 $$ = $1 - ADDR0 + 8;
633 | FPR
635 $$ = $1 - FP0 + 16;
637 | FPCR
639 if ($1 == FPI)
640 $$ = 24;
641 else if ($1 == FPS)
642 $$ = 25;
643 else
644 $$ = 26;
650 /* The string to parse is stored here, and modified by yylex. */
652 static char *str;
654 /* The original string pointer. */
656 static char *strorig;
658 /* If *CCP could be a register, return the register number and advance
659 *CCP. Otherwise don't change *CCP, and return 0. */
661 static enum m68k_register
662 m68k_reg_parse (ccp)
663 register char **ccp;
665 char *start = *ccp;
666 char c;
667 char *p;
668 symbolS *symbolp;
670 if (flag_reg_prefix_optional)
672 if (*start == REGISTER_PREFIX)
673 start++;
674 p = start;
676 else
678 if (*start != REGISTER_PREFIX)
679 return 0;
680 p = start + 1;
683 if (! is_name_beginner (*p))
684 return 0;
686 p++;
687 while (is_part_of_name (*p) && *p != '.' && *p != ':' && *p != '*')
688 p++;
690 c = *p;
691 *p = 0;
692 symbolp = symbol_find (start);
693 *p = c;
695 if (symbolp != NULL && S_GET_SEGMENT (symbolp) == reg_section)
697 *ccp = p;
698 return S_GET_VALUE (symbolp);
701 /* In MRI mode, something like foo.bar can be equated to a register
702 name. */
703 while (flag_mri && c == '.')
705 ++p;
706 while (is_part_of_name (*p) && *p != '.' && *p != ':' && *p != '*')
707 p++;
708 c = *p;
709 *p = '\0';
710 symbolp = symbol_find (start);
711 *p = c;
712 if (symbolp != NULL && S_GET_SEGMENT (symbolp) == reg_section)
714 *ccp = p;
715 return S_GET_VALUE (symbolp);
719 return 0;
722 /* The lexer. */
724 static int
725 yylex ()
727 enum m68k_register reg;
728 char *s;
729 int parens;
730 int c = 0;
731 int tail = 0;
732 char *hold;
734 if (*str == ' ')
735 ++str;
737 if (*str == '\0')
738 return 0;
740 /* Various special characters are just returned directly. */
741 switch (*str)
743 case '@':
744 /* In MRI mode, this can be the start of an octal number. */
745 if (flag_mri)
747 if (ISDIGIT (str[1])
748 || ((str[1] == '+' || str[1] == '-')
749 && ISDIGIT (str[2])))
750 break;
752 /* Fall through. */
753 case '#':
754 case '&':
755 case ',':
756 case ')':
757 case '/':
758 case '[':
759 case ']':
760 return *str++;
761 case '+':
762 /* It so happens that a '+' can only appear at the end of an
763 operand. If it appears anywhere else, it must be a unary
764 plus on an expression. */
765 if (str[1] == '\0')
766 return *str++;
767 break;
768 case '-':
769 /* A '-' can only appear in -(ar), rn-rn, or ar@-. If it
770 appears anywhere else, it must be a unary minus on an
771 expression. */
772 if (str[1] == '\0')
773 return *str++;
774 s = str + 1;
775 if (*s == '(')
776 ++s;
777 if (m68k_reg_parse (&s) != 0)
778 return *str++;
779 break;
780 case '(':
781 /* A '(' can only appear in `(reg)', `(expr,...', `([', `@(', or
782 `)('. If it appears anywhere else, it must be starting an
783 expression. */
784 if (str[1] == '['
785 || (str > strorig
786 && (str[-1] == '@'
787 || str[-1] == ')')))
788 return *str++;
789 s = str + 1;
790 if (m68k_reg_parse (&s) != 0)
791 return *str++;
792 /* Check for the case of '(expr,...' by scanning ahead. If we
793 find a comma outside of balanced parentheses, we return '('.
794 If we find an unbalanced right parenthesis, then presumably
795 the '(' really starts an expression. */
796 parens = 0;
797 for (s = str + 1; *s != '\0'; s++)
799 if (*s == '(')
800 ++parens;
801 else if (*s == ')')
803 if (parens == 0)
804 break;
805 --parens;
807 else if (*s == ',' && parens == 0)
809 /* A comma can not normally appear in an expression, so
810 this is a case of '(expr,...'. */
811 return *str++;
816 /* See if it's a register. */
818 reg = m68k_reg_parse (&str);
819 if (reg != 0)
821 int ret;
823 yylval.reg = reg;
825 if (reg >= DATA0 && reg <= DATA7)
826 ret = DR;
827 else if (reg >= ADDR0 && reg <= ADDR7)
828 ret = AR;
829 else if (reg >= FP0 && reg <= FP7)
830 return FPR;
831 else if (reg == FPI
832 || reg == FPS
833 || reg == FPC)
834 return FPCR;
835 else if (reg == PC)
836 return LPC;
837 else if (reg >= ZDATA0 && reg <= ZDATA7)
838 ret = ZDR;
839 else if (reg >= ZADDR0 && reg <= ZADDR7)
840 ret = ZAR;
841 else if (reg == ZPC)
842 return LZPC;
843 else
844 return CREG;
846 /* If we get here, we have a data or address register. We
847 must check for a size or scale; if we find one, we must
848 return INDEXREG. */
850 s = str;
852 if (*s != '.' && *s != ':' && *s != '*')
853 return ret;
855 yylval.indexreg.reg = reg;
857 if (*s != '.' && *s != ':')
858 yylval.indexreg.size = SIZE_UNSPEC;
859 else
861 ++s;
862 switch (*s)
864 case 'w':
865 case 'W':
866 yylval.indexreg.size = SIZE_WORD;
867 ++s;
868 break;
869 case 'l':
870 case 'L':
871 yylval.indexreg.size = SIZE_LONG;
872 ++s;
873 break;
874 default:
875 yyerror (_("illegal size specification"));
876 yylval.indexreg.size = SIZE_UNSPEC;
877 break;
881 yylval.indexreg.scale = 1;
883 if (*s == '*' || *s == ':')
885 expressionS scale;
887 ++s;
889 hold = input_line_pointer;
890 input_line_pointer = s;
891 expression (&scale);
892 s = input_line_pointer;
893 input_line_pointer = hold;
895 if (scale.X_op != O_constant)
896 yyerror (_("scale specification must resolve to a number"));
897 else
899 switch (scale.X_add_number)
901 case 1:
902 case 2:
903 case 4:
904 case 8:
905 yylval.indexreg.scale = scale.X_add_number;
906 break;
907 default:
908 yyerror (_("invalid scale value"));
909 break;
914 str = s;
916 return INDEXREG;
919 /* It must be an expression. Before we call expression, we need to
920 look ahead to see if there is a size specification. We must do
921 that first, because otherwise foo.l will be treated as the symbol
922 foo.l, rather than as the symbol foo with a long size
923 specification. The grammar requires that all expressions end at
924 the end of the operand, or with ',', '(', ']', ')'. */
926 parens = 0;
927 for (s = str; *s != '\0'; s++)
929 if (*s == '(')
931 if (parens == 0
932 && s > str
933 && (s[-1] == ')' || ISALNUM (s[-1])))
934 break;
935 ++parens;
937 else if (*s == ')')
939 if (parens == 0)
940 break;
941 --parens;
943 else if (parens == 0
944 && (*s == ',' || *s == ']'))
945 break;
948 yylval.exp.size = SIZE_UNSPEC;
949 if (s <= str + 2
950 || (s[-2] != '.' && s[-2] != ':'))
951 tail = 0;
952 else
954 switch (s[-1])
956 case 's':
957 case 'S':
958 case 'b':
959 case 'B':
960 yylval.exp.size = SIZE_BYTE;
961 break;
962 case 'w':
963 case 'W':
964 yylval.exp.size = SIZE_WORD;
965 break;
966 case 'l':
967 case 'L':
968 yylval.exp.size = SIZE_LONG;
969 break;
970 default:
971 break;
973 if (yylval.exp.size != SIZE_UNSPEC)
974 tail = 2;
977 #ifdef OBJ_ELF
979 /* Look for @PLTPC, etc. */
980 char *cp;
982 yylval.exp.pic_reloc = pic_none;
983 cp = s - tail;
984 if (cp - 6 > str && cp[-6] == '@')
986 if (strncmp (cp - 6, "@PLTPC", 6) == 0)
988 yylval.exp.pic_reloc = pic_plt_pcrel;
989 tail += 6;
991 else if (strncmp (cp - 6, "@GOTPC", 6) == 0)
993 yylval.exp.pic_reloc = pic_got_pcrel;
994 tail += 6;
997 else if (cp - 4 > str && cp[-4] == '@')
999 if (strncmp (cp - 4, "@PLT", 4) == 0)
1001 yylval.exp.pic_reloc = pic_plt_off;
1002 tail += 4;
1004 else if (strncmp (cp - 4, "@GOT", 4) == 0)
1006 yylval.exp.pic_reloc = pic_got_off;
1007 tail += 4;
1011 #endif
1013 if (tail != 0)
1015 c = s[-tail];
1016 s[-tail] = 0;
1019 hold = input_line_pointer;
1020 input_line_pointer = str;
1021 expression (&yylval.exp.exp);
1022 str = input_line_pointer;
1023 input_line_pointer = hold;
1025 if (tail != 0)
1027 s[-tail] = c;
1028 str = s;
1031 return EXPR;
1034 /* Parse an m68k operand. This is the only function which is called
1035 from outside this file. */
1038 m68k_ip_op (s, oparg)
1039 char *s;
1040 struct m68k_op *oparg;
1042 memset (oparg, 0, sizeof *oparg);
1043 oparg->error = NULL;
1044 oparg->index.reg = ZDATA0;
1045 oparg->index.scale = 1;
1046 oparg->disp.exp.X_op = O_absent;
1047 oparg->odisp.exp.X_op = O_absent;
1049 str = strorig = s;
1050 op = oparg;
1052 return yyparse ();
1055 /* The error handler. */
1057 static void
1058 yyerror (s)
1059 const char *s;
1061 op->error = s;