1 %{ /* rcparse.y -- parser for Windows rc files
2 Copyright 1997 Free Software Foundation, Inc.
3 Written by Ian Lance Taylor, Cygnus Support.
5 This file is part of GNU Binutils.
7 This program 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 of the License, or
10 (at your option) any later version.
12 This program 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 this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 /* This is a parser for Windows rc files. It is based on the parser
23 by Gunther Ebert <gunther.ebert@ixos-leipzig.de>. */
27 #include "libiberty.h"
32 /* The current language. */
34 static unsigned short language;
36 /* The resource information during a sub statement. */
38 static struct res_res_info sub_res_info;
40 /* Dialog information. This is built by the nonterminals styles and
43 static struct dialog dialog;
45 /* This is used when building a style. It is modified by the
46 nonterminal styleexpr. */
48 static unsigned long style;
50 /* These are used when building a control. They are set before using
53 static unsigned long base_style;
54 static unsigned long default_style;
55 static unsigned long class;
61 struct accelerator acc;
62 struct accelerator *pacc;
63 struct dialog_control *dialog_control;
64 struct menuitem *menuitem;
67 struct rcdata_item *first;
68 struct rcdata_item *last;
70 struct rcdata_item *rcdata_item;
71 struct stringtable_data *stringtable;
72 struct fixed_versioninfo *fixver;
73 struct ver_info *verinfo;
74 struct ver_stringinfo *verstring;
75 struct ver_varinfo *vervar;
77 struct res_res_info res_info;
86 /* Nonzero if this number was explicitly specified as long. */
100 %token ACCELERATORS VIRTKEY ASCII NOINVERT SHIFT CONTROL ALT
103 %token DIALOG DIALOGEX EXSTYLE CAPTION CLASS STYLE
104 %token AUTO3STATE AUTOCHECKBOX AUTORADIOBUTTON CHECKBOX COMBOBOX CTEXT
105 %token DEFPUSHBUTTON EDITTEXT GROUPBOX LISTBOX LTEXT PUSHBOX PUSHBUTTON
106 %token RADIOBUTTON RTEXT SCROLLBAR STATE3 USERBUTTON
107 %token BEDIT HEDIT IEDIT
110 %token LANGUAGE CHARACTERISTICS VERSION
111 %token MENU MENUEX MENUITEM SEPARATOR POPUP CHECKED GRAYED HELP INACTIVE
112 %token MENUBARBREAK MENUBREAK
116 %token VERSIONINFO FILEVERSION PRODUCTVERSION FILEFLAGSMASK FILEFLAGS
117 %token FILEOS FILETYPE FILESUBTYPE BLOCKSTRINGFILEINFO BLOCKVARFILEINFO
120 %token MOVEABLE FIXED PURE IMPURE PRELOAD LOADONCALL DISCARDABLE
122 %token <s> QUOTEDSTRING STRING
124 %token <ss> SIZEDSTRING
126 %type <pacc> acc_entries
127 %type <acc> acc_entry acc_event
128 %type <dialog_control> control control_params
129 %type <menuitem> menuitems menuitem menuexitems menuexitem
130 %type <rcdata> optrcdata_data optrcdata_data_int rcdata_data
131 %type <rcdata_item> opt_control_data
132 %type <fixver> fixedverinfo
133 %type <verinfo> verblocks
134 %type <verstring> vervals
135 %type <vervar> vertrans
136 %type <res_info> suboptions memflags_move_discard memflags_move
137 %type <memflags> memflag
139 %type <il> exstyle parennumber
140 %type <il> numexpr posnumexpr cnumexpr optcnumexpr cposnumexpr
141 %type <is> acc_options acc_option menuitem_flags menuitem_flag
142 %type <s> optstringc file_name
143 %type <i> sizednumexpr sizedposnumexpr
156 | input newcmd accelerator
157 | input newcmd bitmap
158 | input newcmd cursor
159 | input newcmd dialog
162 | input newcmd language
164 | input newcmd menuex
165 | input newcmd messagetable
166 | input newcmd rcdata
167 | input newcmd stringtable
169 | input newcmd versioninfo
175 rcparse_discard_strings ();
179 /* Accelerator resources. */
182 id ACCELERATORS suboptions BEG acc_entries END
184 define_accelerator ($1, &$3, $5);
193 | acc_entries acc_entry
195 struct accelerator *a;
197 a = (struct accelerator *) res_alloc (sizeof *a);
203 struct accelerator **pp;
205 for (pp = &$1->next; *pp != NULL; pp = &(*pp)->next)
214 acc_event cposnumexpr
219 | acc_event cposnumexpr ',' acc_options
237 $$.flags = ACC_CONTROL;
242 rcparse_warning ("accelerator should only be one character");
257 | acc_options ',' acc_option
270 /* This is just the absence of VIRTKEY. */
291 /* Bitmap resources. */
294 id BITMAP memflags_move file_name
296 define_bitmap ($1, &$3, $4);
300 /* Cursor resources. */
303 id CURSOR memflags_move_discard file_name
305 define_cursor ($1, &$3, $4);
309 /* Dialog resources. */
312 id DIALOG memflags_move exstyle posnumexpr cnumexpr cnumexpr
315 memset (&dialog, 0, sizeof dialog);
320 dialog.style = WS_POPUP | WS_BORDER | WS_SYSMENU;
324 dialog.controls = NULL;
327 styles BEG controls END
329 define_dialog ($1, &sub_res_info, &dialog);
331 | id DIALOGEX memflags_move exstyle posnumexpr cnumexpr cnumexpr
334 memset (&dialog, 0, sizeof dialog);
339 dialog.style = WS_POPUP | WS_BORDER | WS_SYSMENU;
342 dialog.ex = ((struct dialog_ex *)
343 res_alloc (sizeof (struct dialog_ex)));
344 memset (dialog.ex, 0, sizeof (struct dialog_ex));
345 dialog.controls = NULL;
348 styles BEG controls END
350 define_dialog ($1, &sub_res_info, &dialog);
352 | id DIALOGEX memflags_move exstyle posnumexpr cnumexpr cnumexpr
355 memset (&dialog, 0, sizeof dialog);
360 dialog.style = WS_POPUP | WS_BORDER | WS_SYSMENU;
363 dialog.ex = ((struct dialog_ex *)
364 res_alloc (sizeof (struct dialog_ex)));
365 memset (dialog.ex, 0, sizeof (struct dialog_ex));
366 dialog.ex->help = $9;
367 dialog.controls = NULL;
370 styles BEG controls END
372 define_dialog ($1, &sub_res_info, &dialog);
381 | EXSTYLE '=' numexpr
389 | styles CAPTION QUOTEDSTRING
391 unicode_from_ascii ((int *) NULL, &dialog.caption, $3);
398 { style = dialog.style }
401 dialog.style = style;
403 | styles EXSTYLE numexpr
407 | styles FONT numexpr ',' QUOTEDSTRING
409 dialog.pointsize = $3;
410 unicode_from_ascii ((int *) NULL, &dialog.font, $5);
412 | styles FONT numexpr ',' QUOTEDSTRING cnumexpr cnumexpr
414 dialog.pointsize = $3;
415 unicode_from_ascii ((int *) NULL, &dialog.font, $5);
416 if (dialog.ex == NULL)
417 rcparse_warning ("extended FONT requires DIALOGEX");
420 dialog.ex->weight = $6;
421 dialog.ex->italic = $7;
428 | styles CHARACTERISTICS numexpr
430 sub_res_info.characteristics = $3;
432 | styles LANGUAGE numexpr cnumexpr
434 sub_res_info.language = $3 | ($4 << 8);
436 | styles VERSION numexpr
438 sub_res_info.version = $3;
446 struct dialog_control **pp;
448 for (pp = &dialog.controls; *pp != NULL; pp = &(*pp)->next)
457 default_style = BS_AUTO3STATE | WS_TABSTOP;
458 base_style = BS_AUTO3STATE;
467 default_style = BS_AUTOCHECKBOX | WS_TABSTOP;
468 base_style = BS_AUTOCHECKBOX;
477 default_style = BS_AUTORADIOBUTTON | WS_TABSTOP;
478 base_style = BS_AUTORADIOBUTTON;
487 default_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
488 base_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
494 if (dialog.ex == NULL)
495 rcparse_warning ("IEDIT requires DIALOGEX");
496 res_string_to_id (&$$->class, "BEDIT");
500 default_style = BS_CHECKBOX | WS_TABSTOP;
501 base_style = BS_CHECKBOX | WS_TABSTOP;
510 default_style = CBS_SIMPLE | WS_TABSTOP;
512 class = CTL_COMBOBOX;
518 | CONTROL optstringc numexpr cnumexpr control_styleexpr cnumexpr
519 cnumexpr cnumexpr cnumexpr optcnumexpr opt_control_data
521 $$ = define_control ($2, $3, $6, $7, $8, $9, $4, style, $10);
524 if (dialog.ex == NULL)
525 rcparse_warning ("control data requires DIALOGEX");
529 | CONTROL optstringc numexpr cnumexpr control_styleexpr cnumexpr
530 cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr opt_control_data
532 $$ = define_control ($2, $3, $6, $7, $8, $9, $4, style, $10);
533 if (dialog.ex == NULL)
534 rcparse_warning ("help ID requires DIALOGEX");
540 default_style = SS_CENTER | WS_GROUP;
541 base_style = SS_CENTER;
550 default_style = BS_DEFPUSHBUTTON | WS_TABSTOP;
551 base_style = BS_DEFPUSHBUTTON | WS_TABSTOP;
560 default_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
561 base_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
570 default_style = BS_GROUPBOX;
571 base_style = BS_GROUPBOX;
580 default_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
581 base_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
587 if (dialog.ex == NULL)
588 rcparse_warning ("IEDIT requires DIALOGEX");
589 res_string_to_id (&$$->class, "HEDIT");
591 | ICON optstringc numexpr cnumexpr cnumexpr opt_control_data
593 $$ = define_control ($2, $3, $4, $5, 0, 0, CTL_STATIC,
594 SS_ICON | WS_CHILD | WS_VISIBLE, 0);
597 if (dialog.ex == NULL)
598 rcparse_warning ("control data requires DIALOGEX");
602 | ICON optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
603 icon_styleexpr optcnumexpr opt_control_data
605 $$ = define_control ($2, $3, $4, $5, $6, $7, CTL_STATIC,
609 if (dialog.ex == NULL)
610 rcparse_warning ("control data requires DIALOGEX");
614 | ICON optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
615 icon_styleexpr cnumexpr cnumexpr opt_control_data
617 $$ = define_control ($2, $3, $4, $5, $6, $7, CTL_STATIC,
619 if (dialog.ex == NULL)
620 rcparse_warning ("help ID requires DIALOGEX");
626 default_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
627 base_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
633 if (dialog.ex == NULL)
634 rcparse_warning ("IEDIT requires DIALOGEX");
635 res_string_to_id (&$$->class, "IEDIT");
639 default_style = LBS_NOTIFY | WS_BORDER;
640 base_style = LBS_NOTIFY | WS_BORDER;
649 default_style = SS_LEFT | WS_GROUP;
650 base_style = SS_LEFT;
659 default_style = BS_PUSHBOX | WS_TABSTOP;
660 base_style = BS_PUSHBOX;
669 default_style = BS_PUSHBUTTON | WS_TABSTOP;
670 base_style = BS_PUSHBUTTON | WS_TABSTOP;
679 default_style = BS_RADIOBUTTON | WS_TABSTOP;
680 base_style = BS_RADIOBUTTON;
689 default_style = SS_RIGHT | WS_GROUP;
690 base_style = SS_RIGHT;
699 default_style = SBS_HORZ;
701 class = CTL_SCROLLBAR;
709 default_style = BS_3STATE | WS_TABSTOP;
710 base_style = BS_3STATE;
717 | USERBUTTON QUOTEDSTRING ',' numexpr ',' numexpr ',' numexpr ','
718 numexpr ',' numexpr ','
719 { style = WS_CHILD | WS_VISIBLE }
720 styleexpr optcnumexpr
722 $$ = define_control ($2, $4, $6, $8, $10, $12, CTL_BUTTON,
727 /* Parameters for a control. The static variables DEFAULT_STYLE,
728 BASE_STYLE, and CLASS must be initialized before this nonterminal
729 is used. DEFAULT_STYLE is the style to use if no style expression
730 is specified. BASE_STYLE is the base style to use if a style
731 expression is specified; the style expression modifies the base
732 style. CLASS is the class of the control. */
735 optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
738 $$ = define_control ($1, $2, $3, $4, $5, $6, class,
739 default_style | WS_CHILD | WS_VISIBLE, 0);
742 if (dialog.ex == NULL)
743 rcparse_warning ("control data requires DIALOGEX");
747 | optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
748 control_params_styleexpr optcnumexpr opt_control_data
750 $$ = define_control ($1, $2, $3, $4, $5, $6, class, style, $8);
753 if (dialog.ex == NULL)
754 rcparse_warning ("control data requires DIALOGEX");
758 | optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
759 control_params_styleexpr cnumexpr cnumexpr opt_control_data
761 $$ = define_control ($1, $2, $3, $4, $5, $6, class, style, $8);
762 if (dialog.ex == NULL)
763 rcparse_warning ("help ID requires DIALOGEX");
785 | BEG optrcdata_data END
791 /* These only exist to parse a reduction out of a common case. */
795 { style = WS_CHILD | WS_VISIBLE; }
801 { style = SS_ICON | WS_CHILD | WS_VISIBLE; }
805 control_params_styleexpr:
807 { style = base_style | WS_CHILD | WS_VISIBLE; }
811 /* Font resources. */
814 id FONT memflags_move_discard file_name
816 define_font ($1, &$3, $4);
820 /* Icon resources. */
823 id ICON memflags_move_discard file_name
825 define_icon ($1, &$3, $4);
829 /* Language command. This changes the static variable language, which
830 affects all subsequent resources. */
833 LANGUAGE numexpr cnumexpr
835 language = $2 | ($3 << 8);
839 /* Menu resources. */
842 id MENU suboptions BEG menuitems END
844 define_menu ($1, &$3, $5);
859 struct menuitem **pp;
861 for (pp = &$1->next; *pp != NULL; pp = &(*pp)->next)
870 MENUITEM QUOTEDSTRING cnumexpr menuitem_flags
872 $$ = define_menuitem ($2, $3, $4, 0, 0, NULL);
876 $$ = define_menuitem (NULL, 0, 0, 0, 0, NULL);
878 | POPUP QUOTEDSTRING menuitem_flags BEG menuitems END
880 $$ = define_menuitem ($2, 0, $3, 0, 0, $5);
889 | menuitem_flags ',' menuitem_flag
893 | menuitem_flags menuitem_flag
902 $$ = MENUITEM_CHECKED;
906 $$ = MENUITEM_GRAYED;
914 $$ = MENUITEM_INACTIVE;
918 $$ = MENUITEM_MENUBARBREAK;
922 $$ = MENUITEM_MENUBREAK;
926 /* Menuex resources. */
929 id MENUEX suboptions BEG menuexitems END
931 define_menu ($1, &$3, $5);
940 | menuexitems menuexitem
946 struct menuitem **pp;
948 for (pp = &$1->next; *pp != NULL; pp = &(*pp)->next)
957 MENUITEM QUOTEDSTRING
959 $$ = define_menuitem ($2, 0, 0, 0, 0, NULL);
961 | MENUITEM QUOTEDSTRING cnumexpr
963 $$ = define_menuitem ($2, $3, 0, 0, 0, NULL);
965 | MENUITEM QUOTEDSTRING cnumexpr cnumexpr optcnumexpr
967 $$ = define_menuitem ($2, $3, $4, $5, 0, NULL);
969 | POPUP QUOTEDSTRING BEG menuexitems END
971 $$ = define_menuitem ($2, 0, 0, 0, 0, $4);
973 | POPUP QUOTEDSTRING cnumexpr BEG menuexitems END
975 $$ = define_menuitem ($2, $3, 0, 0, 0, $5);
977 | POPUP QUOTEDSTRING cnumexpr cnumexpr BEG menuexitems END
979 $$ = define_menuitem ($2, $3, $4, 0, 0, $6);
981 | POPUP QUOTEDSTRING cnumexpr cnumexpr cnumexpr optcnumexpr
984 $$ = define_menuitem ($2, $3, $4, $5, $6, $8);
988 /* Messagetable resources. */
991 id MESSAGETABLE memflags_move file_name
993 define_messagetable ($1, &$3, $4);
997 /* Rcdata resources. */
1000 id RCDATA suboptions BEG optrcdata_data END
1002 define_rcdata ($1, &$3, $5.first);
1006 /* We use a different lexing algorithm, because rcdata strings may
1007 contain embedded null bytes, and we need to know the length to use. */
1035 struct rcdata_item *ri;
1037 ri = define_rcdata_string ($1.s, $1.length);
1043 struct rcdata_item *ri;
1045 ri = define_rcdata_number ($1.val, $1.dword);
1049 | rcdata_data ',' SIZEDSTRING
1051 struct rcdata_item *ri;
1053 ri = define_rcdata_string ($3.s, $3.length);
1054 $$.first = $1.first;
1058 | rcdata_data ',' sizednumexpr
1060 struct rcdata_item *ri;
1062 ri = define_rcdata_number ($3.val, $3.dword);
1063 $$.first = $1.first;
1069 /* Stringtable resources. */
1072 STRINGTABLE suboptions BEG
1073 { sub_res_info = $2; }
1079 | string_data numexpr QUOTEDSTRING
1081 define_stringtable (&sub_res_info, $2, $3);
1083 | string_data numexpr ',' QUOTEDSTRING
1085 define_stringtable (&sub_res_info, $2, $4);
1089 /* User defined resources. We accept general suboptions in the
1090 file_name case to keep the parser happy. */
1093 id id suboptions BEG optrcdata_data END
1095 define_user_data ($1, $2, &$3, $5.first);
1097 | id id suboptions file_name
1099 define_user_file ($1, $2, &$3, $4);
1103 /* Versioninfo resources. */
1106 id VERSIONINFO fixedverinfo BEG verblocks END
1108 define_versioninfo ($1, language, $3, $5);
1115 $$ = ((struct fixed_versioninfo *)
1116 res_alloc (sizeof (struct fixed_versioninfo)));
1117 memset ($$, 0, sizeof (struct fixed_versioninfo));
1119 | fixedverinfo FILEVERSION numexpr cnumexpr cnumexpr cnumexpr
1121 $1->file_version_ms = ($3 << 16) | $4;
1122 $1->file_version_ls = ($5 << 16) | $6;
1125 | fixedverinfo PRODUCTVERSION numexpr cnumexpr cnumexpr cnumexpr
1127 $1->product_version_ms = ($3 << 16) | $4;
1128 $1->product_version_ls = ($5 << 16) | $6;
1131 | fixedverinfo FILEFLAGSMASK numexpr
1133 $1->file_flags_mask = $3;
1136 | fixedverinfo FILEFLAGS numexpr
1138 $1->file_flags = $3;
1141 | fixedverinfo FILEOS numexpr
1146 | fixedverinfo FILETYPE numexpr
1151 | fixedverinfo FILESUBTYPE numexpr
1153 $1->file_subtype = $3;
1158 /* To handle verblocks successfully, the lexer handles BLOCK
1159 specially. A BLOCK "StringFileInfo" is returned as
1160 BLOCKSTRINGFILEINFO. A BLOCK "VarFileInfo" is returned as
1161 BLOCKVARFILEINFO. A BLOCK with some other string returns BLOCK
1162 with the string as the value. */
1169 | verblocks BLOCKSTRINGFILEINFO BEG BLOCK BEG vervals END END
1171 $$ = append_ver_stringfileinfo ($1, $4, $6);
1173 | verblocks BLOCKVARFILEINFO BEG VALUE QUOTEDSTRING vertrans END
1175 $$ = append_ver_varfileinfo ($1, $5, $6);
1184 | vervals VALUE QUOTEDSTRING ',' QUOTEDSTRING
1186 $$ = append_verval ($1, $3, $5);
1195 | vertrans cnumexpr cnumexpr
1197 $$ = append_vertrans ($1, $2, $3);
1201 /* A resource ID. */
1213 /* It seems that resource ID's are forced to upper case. */
1214 copy = xstrdup ($1);
1215 for (s = copy; *s != '\0'; s++)
1218 res_string_to_id (&$$, copy);
1223 /* Generic suboptions. These may appear before the BEGIN in any
1224 multiline statement. */
1229 memset (&$$, 0, sizeof (struct res_res_info));
1230 $$.language = language;
1231 /* FIXME: Is this the right default? */
1232 $$.memflags = MEMFLAG_MOVEABLE;
1234 | suboptions memflag
1237 $$.memflags |= $2.on;
1238 $$.memflags &=~ $2.off;
1240 | suboptions CHARACTERISTICS numexpr
1243 $$.characteristics = $3;
1245 | suboptions LANGUAGE numexpr cnumexpr
1248 $$.language = $3 | ($4 << 8);
1250 | suboptions VERSION numexpr
1257 /* Memory flags which default to MOVEABLE and DISCARDABLE. */
1259 memflags_move_discard:
1262 memset (&$$, 0, sizeof (struct res_res_info));
1263 $$.language = language;
1264 $$.memflags = MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE;
1266 | memflags_move_discard memflag
1269 $$.memflags |= $2.on;
1270 $$.memflags &=~ $2.off;
1274 /* Memory flags which default to MOVEABLE. */
1279 memset (&$$, 0, sizeof (struct res_res_info));
1280 $$.language = language;
1281 $$.memflags = MEMFLAG_MOVEABLE;
1283 | memflags_move_discard memflag
1286 $$.memflags |= $2.on;
1287 $$.memflags &=~ $2.off;
1291 /* Memory flags. This returns a struct with two integers, because we
1292 sometimes want to set bits and we sometimes want to clear them. */
1297 $$.on = MEMFLAG_MOVEABLE;
1303 $$.off = MEMFLAG_MOVEABLE;
1307 $$.on = MEMFLAG_PURE;
1313 $$.off = MEMFLAG_PURE;
1317 $$.on = MEMFLAG_PRELOAD;
1323 $$.off = MEMFLAG_PRELOAD;
1327 $$.on = MEMFLAG_DISCARDABLE;
1345 /* A style expression. This changes the static variable STYLE. We do
1346 it this way because rc appears to permit a style to be set to
1348 WS_GROUP | NOT WS_TABSTOP
1349 to mean that a default of WS_TABSTOP should be removed. Anything
1350 which wants to accept a style must first set STYLE to the default
1351 value. The styleexpr nonterminal will change STYLE as specified by
1352 the user. Note that we do not accept arbitrary expressions here,
1353 just numbers separated by '|'. */
1364 | styleexpr '|' parennumber
1368 | styleexpr '|' NOT parennumber
1385 /* An optional expression with a leading comma. */
1398 /* An expression with a leading comma. */
1407 /* A possibly negated numeric expression. */
1416 /* A possibly negated expression with a size. */
1423 | '(' sizednumexpr ')'
1427 | '~' sizednumexpr %prec '~'
1430 $$.dword = $2.dword;
1432 | '-' sizednumexpr %prec NEG
1435 $$.dword = $2.dword;
1437 | sizednumexpr '*' sizednumexpr
1439 $$.val = $1.val * $3.val;
1440 $$.dword = $1.dword || $3.dword;
1442 | sizednumexpr '/' sizednumexpr
1444 $$.val = $1.val / $3.val;
1445 $$.dword = $1.dword || $3.dword;
1447 | sizednumexpr '%' sizednumexpr
1449 $$.val = $1.val % $3.val;
1450 $$.dword = $1.dword || $3.dword;
1452 | sizednumexpr '+' sizednumexpr
1454 $$.val = $1.val + $3.val;
1455 $$.dword = $1.dword || $3.dword;
1457 | sizednumexpr '-' sizednumexpr
1459 $$.val = $1.val - $3.val;
1460 $$.dword = $1.dword || $3.dword;
1462 | sizednumexpr '&' sizednumexpr
1464 $$.val = $1.val & $3.val;
1465 $$.dword = $1.dword || $3.dword;
1467 | sizednumexpr '^' sizednumexpr
1469 $$.val = $1.val ^ $3.val;
1470 $$.dword = $1.dword || $3.dword;
1472 | sizednumexpr '|' sizednumexpr
1474 $$.val = $1.val | $3.val;
1475 $$.dword = $1.dword || $3.dword;
1479 /* An expression with a leading comma which does not use unary
1489 /* An expression which does not use unary negation. */
1498 /* An expression which does not use unary negation. We separate unary
1499 negation to avoid parsing conflicts when two numeric expressions
1500 appear consecutively. */
1507 | '(' sizednumexpr ')'
1511 | '~' sizednumexpr %prec '~'
1514 $$.dword = $2.dword;
1516 | sizedposnumexpr '*' sizednumexpr
1518 $$.val = $1.val * $3.val;
1519 $$.dword = $1.dword || $3.dword;
1521 | sizedposnumexpr '/' sizednumexpr
1523 $$.val = $1.val / $3.val;
1524 $$.dword = $1.dword || $3.dword;
1526 | sizedposnumexpr '%' sizednumexpr
1528 $$.val = $1.val % $3.val;
1529 $$.dword = $1.dword || $3.dword;
1531 | sizedposnumexpr '+' sizednumexpr
1533 $$.val = $1.val + $3.val;
1534 $$.dword = $1.dword || $3.dword;
1536 | sizedposnumexpr '-' sizednumexpr
1538 $$.val = $1.val - $3.val;
1539 $$.dword = $1.dword || $3.dword;
1541 | sizedposnumexpr '&' sizednumexpr
1543 $$.val = $1.val & $3.val;
1544 $$.dword = $1.dword || $3.dword;
1546 | sizedposnumexpr '^' sizednumexpr
1548 $$.val = $1.val ^ $3.val;
1549 $$.dword = $1.dword || $3.dword;
1551 | sizedposnumexpr '|' sizednumexpr
1553 $$.val = $1.val | $3.val;
1554 $$.dword = $1.dword || $3.dword;
1560 /* Set the language from the command line. */
1563 rcparse_set_language (lang)