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
;
322 dialog.menu.named
= 1;
323 dialog.class.named
= 1;
326 dialog.controls
= NULL
;
329 styles BEG controls END
331 define_dialog
($1, &sub_res_info
, &dialog
);
333 | id DIALOGEX memflags_move exstyle posnumexpr cnumexpr cnumexpr
336 memset
(&dialog
, 0, sizeof dialog
);
341 dialog.style
= WS_POPUP | WS_BORDER | WS_SYSMENU
;
343 dialog.menu.named
= 1;
344 dialog.class.named
= 1;
346 dialog.ex
= ((struct dialog_ex
*)
347 res_alloc
(sizeof
(struct dialog_ex
)));
348 memset
(dialog.ex
, 0, sizeof
(struct dialog_ex
));
349 dialog.controls
= NULL
;
352 styles BEG controls END
354 define_dialog
($1, &sub_res_info
, &dialog
);
356 | id DIALOGEX memflags_move exstyle posnumexpr cnumexpr cnumexpr
359 memset
(&dialog
, 0, sizeof dialog
);
364 dialog.style
= WS_POPUP | WS_BORDER | WS_SYSMENU
;
366 dialog.menu.named
= 1;
367 dialog.class.named
= 1;
369 dialog.ex
= ((struct dialog_ex
*)
370 res_alloc
(sizeof
(struct dialog_ex
)));
371 memset
(dialog.ex
, 0, sizeof
(struct dialog_ex
));
372 dialog.ex
->help
= $9;
373 dialog.controls
= NULL
;
376 styles BEG controls END
378 define_dialog
($1, &sub_res_info
, &dialog
);
387 | EXSTYLE
'=' numexpr
395 | styles CAPTION QUOTEDSTRING
397 unicode_from_ascii
((int *) NULL
, &dialog.caption
, $3);
404 { style
= dialog.style
; }
407 dialog.style
= style
;
409 | styles EXSTYLE numexpr
413 | styles FONT numexpr
',' QUOTEDSTRING
415 dialog.style |
= DS_SETFONT
;
416 dialog.pointsize
= $3;
417 unicode_from_ascii
((int *) NULL
, &dialog.font
, $5);
419 | styles FONT numexpr
',' QUOTEDSTRING cnumexpr cnumexpr
421 dialog.style |
= DS_SETFONT
;
422 dialog.pointsize
= $3;
423 unicode_from_ascii
((int *) NULL
, &dialog.font
, $5);
424 if
(dialog.ex
== NULL
)
425 rcparse_warning
("extended FONT requires DIALOGEX");
428 dialog.ex
->weight
= $6;
429 dialog.ex
->italic
= $7;
436 | styles CHARACTERISTICS numexpr
438 sub_res_info.characteristics
= $3;
440 | styles LANGUAGE numexpr cnumexpr
442 sub_res_info.language
= $3 |
($4 << 8);
444 | styles VERSION numexpr
446 sub_res_info.version
= $3;
454 struct dialog_control
**pp
;
456 for
(pp
= &dialog.controls
; *pp
!= NULL
; pp
= &(*pp
)->next
)
465 default_style
= BS_AUTO3STATE | WS_TABSTOP
;
466 base_style
= BS_AUTO3STATE
;
475 default_style
= BS_AUTOCHECKBOX | WS_TABSTOP
;
476 base_style
= BS_AUTOCHECKBOX
;
485 default_style
= BS_AUTORADIOBUTTON | WS_TABSTOP
;
486 base_style
= BS_AUTORADIOBUTTON
;
495 default_style
= ES_LEFT | WS_BORDER | WS_TABSTOP
;
496 base_style
= ES_LEFT | WS_BORDER | WS_TABSTOP
;
502 if
(dialog.ex
== NULL
)
503 rcparse_warning
("IEDIT requires DIALOGEX");
504 res_string_to_id
(&$$
->class
, "BEDIT");
508 default_style
= BS_CHECKBOX | WS_TABSTOP
;
509 base_style
= BS_CHECKBOX | WS_TABSTOP
;
518 default_style
= CBS_SIMPLE | WS_TABSTOP
;
520 class
= CTL_COMBOBOX
;
526 | CONTROL optstringc numexpr cnumexpr control_styleexpr cnumexpr
527 cnumexpr cnumexpr cnumexpr optcnumexpr opt_control_data
529 $$
= define_control
($2, $3, $6, $7, $8, $9, $4, style
, $10);
532 if
(dialog.ex
== NULL
)
533 rcparse_warning
("control data requires DIALOGEX");
537 | CONTROL optstringc numexpr cnumexpr control_styleexpr cnumexpr
538 cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr opt_control_data
540 $$
= define_control
($2, $3, $6, $7, $8, $9, $4, style
, $10);
541 if
(dialog.ex
== NULL
)
542 rcparse_warning
("help ID requires DIALOGEX");
548 default_style
= SS_CENTER | WS_GROUP
;
549 base_style
= SS_CENTER
;
558 default_style
= BS_DEFPUSHBUTTON | WS_TABSTOP
;
559 base_style
= BS_DEFPUSHBUTTON | WS_TABSTOP
;
568 default_style
= ES_LEFT | WS_BORDER | WS_TABSTOP
;
569 base_style
= ES_LEFT | WS_BORDER | WS_TABSTOP
;
578 default_style
= BS_GROUPBOX
;
579 base_style
= BS_GROUPBOX
;
588 default_style
= ES_LEFT | WS_BORDER | WS_TABSTOP
;
589 base_style
= ES_LEFT | WS_BORDER | WS_TABSTOP
;
595 if
(dialog.ex
== NULL
)
596 rcparse_warning
("IEDIT requires DIALOGEX");
597 res_string_to_id
(&$$
->class
, "HEDIT");
599 | ICON optstringc numexpr cnumexpr cnumexpr opt_control_data
601 $$
= define_control
($2, $3, $4, $5, 0, 0, CTL_STATIC
,
602 SS_ICON | WS_CHILD | WS_VISIBLE
, 0);
605 if
(dialog.ex
== NULL
)
606 rcparse_warning
("control data requires DIALOGEX");
610 | ICON optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
611 icon_styleexpr optcnumexpr opt_control_data
613 $$
= define_control
($2, $3, $4, $5, $6, $7, CTL_STATIC
,
617 if
(dialog.ex
== NULL
)
618 rcparse_warning
("control data requires DIALOGEX");
622 | ICON optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
623 icon_styleexpr cnumexpr cnumexpr opt_control_data
625 $$
= define_control
($2, $3, $4, $5, $6, $7, CTL_STATIC
,
627 if
(dialog.ex
== NULL
)
628 rcparse_warning
("help ID requires DIALOGEX");
634 default_style
= ES_LEFT | WS_BORDER | WS_TABSTOP
;
635 base_style
= ES_LEFT | WS_BORDER | WS_TABSTOP
;
641 if
(dialog.ex
== NULL
)
642 rcparse_warning
("IEDIT requires DIALOGEX");
643 res_string_to_id
(&$$
->class
, "IEDIT");
647 default_style
= LBS_NOTIFY | WS_BORDER
;
648 base_style
= LBS_NOTIFY | WS_BORDER
;
657 default_style
= SS_LEFT | WS_GROUP
;
658 base_style
= SS_LEFT
;
667 default_style
= BS_PUSHBOX | WS_TABSTOP
;
668 base_style
= BS_PUSHBOX
;
677 default_style
= BS_PUSHBUTTON | WS_TABSTOP
;
678 base_style
= BS_PUSHBUTTON | WS_TABSTOP
;
687 default_style
= BS_RADIOBUTTON | WS_TABSTOP
;
688 base_style
= BS_RADIOBUTTON
;
697 default_style
= SS_RIGHT | WS_GROUP
;
698 base_style
= SS_RIGHT
;
707 default_style
= SBS_HORZ
;
709 class
= CTL_SCROLLBAR
;
717 default_style
= BS_3STATE | WS_TABSTOP
;
718 base_style
= BS_3STATE
;
725 | USERBUTTON QUOTEDSTRING
',' numexpr
',' numexpr
',' numexpr
','
726 numexpr
',' numexpr
','
727 { style
= WS_CHILD | WS_VISIBLE
; }
728 styleexpr optcnumexpr
730 $$
= define_control
($2, $4, $6, $8, $10, $12, CTL_BUTTON
,
735 /* Parameters for a control. The static variables DEFAULT_STYLE,
736 BASE_STYLE, and CLASS must be initialized before this nonterminal
737 is used. DEFAULT_STYLE is the style to use if no style expression
738 is specified. BASE_STYLE is the base style to use if a style
739 expression is specified; the style expression modifies the base
740 style. CLASS is the class of the control. */
743 optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
746 $$
= define_control
($1, $2, $3, $4, $5, $6, class
,
747 default_style | WS_CHILD | WS_VISIBLE
, 0);
750 if
(dialog.ex
== NULL
)
751 rcparse_warning
("control data requires DIALOGEX");
755 | optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
756 control_params_styleexpr optcnumexpr opt_control_data
758 $$
= define_control
($1, $2, $3, $4, $5, $6, class
, style
, $8);
761 if
(dialog.ex
== NULL
)
762 rcparse_warning
("control data requires DIALOGEX");
766 | optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
767 control_params_styleexpr cnumexpr cnumexpr opt_control_data
769 $$
= define_control
($1, $2, $3, $4, $5, $6, class
, style
, $8);
770 if
(dialog.ex
== NULL
)
771 rcparse_warning
("help ID requires DIALOGEX");
793 | BEG optrcdata_data END
799 /* These only exist to parse a reduction out of a common case. */
803 { style
= WS_CHILD | WS_VISIBLE
; }
809 { style
= SS_ICON | WS_CHILD | WS_VISIBLE
; }
813 control_params_styleexpr:
815 { style
= base_style | WS_CHILD | WS_VISIBLE
; }
819 /* Font resources. */
822 id FONT memflags_move_discard file_name
824 define_font
($1, &$3, $4);
828 /* Icon resources. */
831 id ICON memflags_move_discard file_name
833 define_icon
($1, &$3, $4);
837 /* Language command. This changes the static variable language, which
838 affects all subsequent resources. */
841 LANGUAGE numexpr cnumexpr
843 language
= $2 |
($3 << 8);
847 /* Menu resources. */
850 id MENU suboptions BEG menuitems END
852 define_menu
($1, &$3, $5);
867 struct menuitem
**pp
;
869 for
(pp
= &$1->next
; *pp
!= NULL
; pp
= &(*pp
)->next
)
878 MENUITEM QUOTEDSTRING cnumexpr menuitem_flags
880 $$
= define_menuitem
($2, $3, $4, 0, 0, NULL
);
884 $$
= define_menuitem
(NULL
, 0, 0, 0, 0, NULL
);
886 | POPUP QUOTEDSTRING menuitem_flags BEG menuitems END
888 $$
= define_menuitem
($2, 0, $3, 0, 0, $5);
897 | menuitem_flags
',' menuitem_flag
901 | menuitem_flags menuitem_flag
910 $$
= MENUITEM_CHECKED
;
914 $$
= MENUITEM_GRAYED
;
922 $$
= MENUITEM_INACTIVE
;
926 $$
= MENUITEM_MENUBARBREAK
;
930 $$
= MENUITEM_MENUBREAK
;
934 /* Menuex resources. */
937 id MENUEX suboptions BEG menuexitems END
939 define_menu
($1, &$3, $5);
948 | menuexitems menuexitem
954 struct menuitem
**pp
;
956 for
(pp
= &$1->next
; *pp
!= NULL
; pp
= &(*pp
)->next
)
965 MENUITEM QUOTEDSTRING
967 $$
= define_menuitem
($2, 0, 0, 0, 0, NULL
);
969 | MENUITEM QUOTEDSTRING cnumexpr
971 $$
= define_menuitem
($2, $3, 0, 0, 0, NULL
);
973 | MENUITEM QUOTEDSTRING cnumexpr cnumexpr optcnumexpr
975 $$
= define_menuitem
($2, $3, $4, $5, 0, NULL
);
977 | POPUP QUOTEDSTRING BEG menuexitems END
979 $$
= define_menuitem
($2, 0, 0, 0, 0, $4);
981 | POPUP QUOTEDSTRING cnumexpr BEG menuexitems END
983 $$
= define_menuitem
($2, $3, 0, 0, 0, $5);
985 | POPUP QUOTEDSTRING cnumexpr cnumexpr BEG menuexitems END
987 $$
= define_menuitem
($2, $3, $4, 0, 0, $6);
989 | POPUP QUOTEDSTRING cnumexpr cnumexpr cnumexpr optcnumexpr
992 $$
= define_menuitem
($2, $3, $4, $5, $6, $8);
996 /* Messagetable resources. */
999 id MESSAGETABLE memflags_move file_name
1001 define_messagetable
($1, &$3, $4);
1005 /* Rcdata resources. */
1008 id RCDATA suboptions BEG optrcdata_data END
1010 define_rcdata
($1, &$3, $5.first
);
1014 /* We use a different lexing algorithm, because rcdata strings may
1015 contain embedded null bytes, and we need to know the length to use. */
1043 struct rcdata_item
*ri
;
1045 ri
= define_rcdata_string
($1.s
, $1.length
);
1051 struct rcdata_item
*ri
;
1053 ri
= define_rcdata_number
($1.val
, $1.dword
);
1057 | rcdata_data
',' SIZEDSTRING
1059 struct rcdata_item
*ri
;
1061 ri
= define_rcdata_string
($3.s
, $3.length
);
1062 $$.first
= $1.first
;
1066 | rcdata_data
',' sizednumexpr
1068 struct rcdata_item
*ri
;
1070 ri
= define_rcdata_number
($3.val
, $3.dword
);
1071 $$.first
= $1.first
;
1077 /* Stringtable resources. */
1080 STRINGTABLE suboptions BEG
1081 { sub_res_info
= $2; }
1087 | string_data numexpr QUOTEDSTRING
1089 define_stringtable
(&sub_res_info
, $2, $3);
1091 | string_data numexpr
',' QUOTEDSTRING
1093 define_stringtable
(&sub_res_info
, $2, $4);
1097 /* User defined resources. We accept general suboptions in the
1098 file_name case to keep the parser happy. */
1101 id id suboptions BEG optrcdata_data END
1103 define_user_data
($1, $2, &$3, $5.first
);
1105 | id id suboptions file_name
1107 define_user_file
($1, $2, &$3, $4);
1111 /* Versioninfo resources. */
1114 id VERSIONINFO fixedverinfo BEG verblocks END
1116 define_versioninfo
($1, language
, $3, $5);
1123 $$
= ((struct fixed_versioninfo
*)
1124 res_alloc
(sizeof
(struct fixed_versioninfo
)));
1125 memset
($$
, 0, sizeof
(struct fixed_versioninfo
));
1127 | fixedverinfo FILEVERSION numexpr cnumexpr cnumexpr cnumexpr
1129 $1->file_version_ms
= ($3 << 16) |
$4;
1130 $1->file_version_ls
= ($5 << 16) |
$6;
1133 | fixedverinfo PRODUCTVERSION numexpr cnumexpr cnumexpr cnumexpr
1135 $1->product_version_ms
= ($3 << 16) |
$4;
1136 $1->product_version_ls
= ($5 << 16) |
$6;
1139 | fixedverinfo FILEFLAGSMASK numexpr
1141 $1->file_flags_mask
= $3;
1144 | fixedverinfo FILEFLAGS numexpr
1146 $1->file_flags
= $3;
1149 | fixedverinfo FILEOS numexpr
1154 | fixedverinfo FILETYPE numexpr
1159 | fixedverinfo FILESUBTYPE numexpr
1161 $1->file_subtype
= $3;
1166 /* To handle verblocks successfully, the lexer handles BLOCK
1167 specially. A BLOCK "StringFileInfo" is returned as
1168 BLOCKSTRINGFILEINFO. A BLOCK "VarFileInfo" is returned as
1169 BLOCKVARFILEINFO. A BLOCK with some other string returns BLOCK
1170 with the string as the value. */
1177 | verblocks BLOCKSTRINGFILEINFO BEG BLOCK BEG vervals END END
1179 $$
= append_ver_stringfileinfo
($1, $4, $6);
1181 | verblocks BLOCKVARFILEINFO BEG VALUE QUOTEDSTRING vertrans END
1183 $$
= append_ver_varfileinfo
($1, $5, $6);
1192 | vervals VALUE QUOTEDSTRING
',' QUOTEDSTRING
1194 $$
= append_verval
($1, $3, $5);
1203 | vertrans cnumexpr cnumexpr
1205 $$
= append_vertrans
($1, $2, $3);
1209 /* A resource ID. */
1221 /* It seems that resource ID's are forced to upper case. */
1222 copy
= xstrdup
($1);
1223 for
(s
= copy
; *s
!= '\0'; s
++)
1226 res_string_to_id
(&$$
, copy
);
1231 /* Generic suboptions. These may appear before the BEGIN in any
1232 multiline statement. */
1237 memset
(&$$
, 0, sizeof
(struct res_res_info
));
1238 $$.language
= language
;
1239 /* FIXME: Is this the right default? */
1240 $$.memflags
= MEMFLAG_MOVEABLE
;
1242 | suboptions memflag
1245 $$.memflags |
= $2.on
;
1246 $$.memflags
&=~
$2.off
;
1248 | suboptions CHARACTERISTICS numexpr
1251 $$.characteristics
= $3;
1253 | suboptions LANGUAGE numexpr cnumexpr
1256 $$.language
= $3 |
($4 << 8);
1258 | suboptions VERSION numexpr
1265 /* Memory flags which default to MOVEABLE and DISCARDABLE. */
1267 memflags_move_discard:
1270 memset
(&$$
, 0, sizeof
(struct res_res_info
));
1271 $$.language
= language
;
1272 $$.memflags
= MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE
;
1274 | memflags_move_discard memflag
1277 $$.memflags |
= $2.on
;
1278 $$.memflags
&=~
$2.off
;
1282 /* Memory flags which default to MOVEABLE. */
1287 memset
(&$$
, 0, sizeof
(struct res_res_info
));
1288 $$.language
= language
;
1289 $$.memflags
= MEMFLAG_MOVEABLE
;
1291 | memflags_move_discard memflag
1294 $$.memflags |
= $2.on
;
1295 $$.memflags
&=~
$2.off
;
1299 /* Memory flags. This returns a struct with two integers, because we
1300 sometimes want to set bits and we sometimes want to clear them. */
1305 $$.on
= MEMFLAG_MOVEABLE
;
1311 $$.off
= MEMFLAG_MOVEABLE
;
1315 $$.on
= MEMFLAG_PURE
;
1321 $$.off
= MEMFLAG_PURE
;
1325 $$.on
= MEMFLAG_PRELOAD
;
1331 $$.off
= MEMFLAG_PRELOAD
;
1335 $$.on
= MEMFLAG_DISCARDABLE
;
1353 /* A style expression. This changes the static variable STYLE. We do
1354 it this way because rc appears to permit a style to be set to
1356 WS_GROUP | NOT WS_TABSTOP
1357 to mean that a default of WS_TABSTOP should be removed. Anything
1358 which wants to accept a style must first set STYLE to the default
1359 value. The styleexpr nonterminal will change STYLE as specified by
1360 the user. Note that we do not accept arbitrary expressions here,
1361 just numbers separated by '|'. */
1372 | styleexpr
'|' parennumber
1376 | styleexpr
'|' NOT parennumber
1393 /* An optional expression with a leading comma. */
1406 /* An expression with a leading comma. */
1415 /* A possibly negated numeric expression. */
1424 /* A possibly negated expression with a size. */
1431 |
'(' sizednumexpr
')'
1435 |
'~' sizednumexpr %prec
'~'
1438 $$.dword
= $2.dword
;
1440 |
'-' sizednumexpr %prec NEG
1443 $$.dword
= $2.dword
;
1445 | sizednumexpr
'*' sizednumexpr
1447 $$.val
= $1.val
* $3.val
;
1448 $$.dword
= $1.dword ||
$3.dword
;
1450 | sizednumexpr
'/' sizednumexpr
1452 $$.val
= $1.val
/ $3.val
;
1453 $$.dword
= $1.dword ||
$3.dword
;
1455 | sizednumexpr
'%' sizednumexpr
1457 $$.val
= $1.val %
$3.val
;
1458 $$.dword
= $1.dword ||
$3.dword
;
1460 | sizednumexpr
'+' sizednumexpr
1462 $$.val
= $1.val
+ $3.val
;
1463 $$.dword
= $1.dword ||
$3.dword
;
1465 | sizednumexpr
'-' sizednumexpr
1467 $$.val
= $1.val
- $3.val
;
1468 $$.dword
= $1.dword ||
$3.dword
;
1470 | sizednumexpr
'&' sizednumexpr
1472 $$.val
= $1.val
& $3.val
;
1473 $$.dword
= $1.dword ||
$3.dword
;
1475 | sizednumexpr
'^' sizednumexpr
1477 $$.val
= $1.val ^
$3.val
;
1478 $$.dword
= $1.dword ||
$3.dword
;
1480 | sizednumexpr
'|' sizednumexpr
1482 $$.val
= $1.val |
$3.val
;
1483 $$.dword
= $1.dword ||
$3.dword
;
1487 /* An expression with a leading comma which does not use unary
1497 /* An expression which does not use unary negation. */
1506 /* An expression which does not use unary negation. We separate unary
1507 negation to avoid parsing conflicts when two numeric expressions
1508 appear consecutively. */
1515 |
'(' sizednumexpr
')'
1519 |
'~' sizednumexpr %prec
'~'
1522 $$.dword
= $2.dword
;
1524 | sizedposnumexpr
'*' sizednumexpr
1526 $$.val
= $1.val
* $3.val
;
1527 $$.dword
= $1.dword ||
$3.dword
;
1529 | sizedposnumexpr
'/' sizednumexpr
1531 $$.val
= $1.val
/ $3.val
;
1532 $$.dword
= $1.dword ||
$3.dword
;
1534 | sizedposnumexpr
'%' sizednumexpr
1536 $$.val
= $1.val %
$3.val
;
1537 $$.dword
= $1.dword ||
$3.dword
;
1539 | sizedposnumexpr
'+' sizednumexpr
1541 $$.val
= $1.val
+ $3.val
;
1542 $$.dword
= $1.dword ||
$3.dword
;
1544 | sizedposnumexpr
'-' sizednumexpr
1546 $$.val
= $1.val
- $3.val
;
1547 $$.dword
= $1.dword ||
$3.dword
;
1549 | sizedposnumexpr
'&' sizednumexpr
1551 $$.val
= $1.val
& $3.val
;
1552 $$.dword
= $1.dword ||
$3.dword
;
1554 | sizedposnumexpr
'^' sizednumexpr
1556 $$.val
= $1.val ^
$3.val
;
1557 $$.dword
= $1.dword ||
$3.dword
;
1559 | sizedposnumexpr
'|' sizednumexpr
1561 $$.val
= $1.val |
$3.val
;
1562 $$.dword
= $1.dword ||
$3.dword
;
1568 /* Set the language from the command line. */
1571 rcparse_set_language
(lang
)