📄 rc.y
字号:
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: Windows Resource Compiler grammar for yacc.
*
*/
/***************************************************************************
* As of Nov 25/94 this file contains 13 shift/reduce conflicts
* -3 involving Y_MINUS
* -5 involving Y_LANGUAGE
* -5 involving Y_CHARACTERISTICS
***************************************************************************/
/*** error tokens ***/
%token Y_SCAN_ERROR
/*** non-keyword tokens ***/
%token <string> Y_NAME
%token <intinfo> Y_INTEGER
%token <string> Y_STRING
%token <string> Y_DOS_FILENAME
/*** operator tokens ***/
%token Y_POUND_SIGN /* this token is intercepted by yylex */
%token Y_LPAREN
%token Y_RPAREN
%token Y_LBRACE
%token Y_RBRACE
%token Y_LSQ_BRACKET
%token Y_RSQ_BRACKET
%token Y_PLUS
%token Y_MINUS
%token Y_BITNOT
%token Y_NOT
%token Y_TIMES
%token Y_DIVIDE
%token Y_MOD
%token Y_SHIFTL
%token Y_SHIFTR
%token Y_GT
%token Y_LT
%token Y_GE
%token Y_LE
%token Y_EQ
%token Y_SINGLE_EQ
%token Y_NE
%token Y_BITAND
%token Y_BITXOR
%token Y_BITOR
%token Y_AND
%token Y_OR
%token Y_QUESTION
%token Y_COLON
%token Y_COMMA
/*** keywords tokens ***/
%token Y_ACCELERATORS
%token Y_ALT
%token Y_ASCII
%token Y_AUTOCHECKBOX
%token Y_AUTORADIOBUTTON
%token Y_AUTO3STATE
%token Y_BEGIN
%token Y_BITMAP
%token Y_BLOCK
%token Y_BUTTON
%token Y_CAPTION
%token Y_CHARACTERISTICS
%token Y_CHECKBOX
%token Y_CHECKED
%token Y_CLASS
%token Y_CODEPAGE
%token Y_COMBOBOX
%token Y_CONTROL
%token Y_CTEXT
%token Y_CURSOR
%token Y_DEFPUSHBUTTON
%token Y_DIALOG
%token Y_DIALOG_EX
%token Y_DISCARDABLE
%token Y_DLGINIT
%token Y_EDIT
%token Y_EDITTEXT
%token Y_END
%token Y_ERRTABLE
%token Y_EXSTYLE
%token Y_FILEFLAGS
%token Y_FILEFLAGSMASK
%token Y_FILEOS
%token Y_FILESUBTYPE
%token Y_FILETYPE
%token Y_FILEVERSION
%token Y_FIXED
%token Y_FONT
%token Y_GRAYED
%token Y_GROUPBOX
%token Y_HELP
%token Y_ICON
%token Y_IMPURE
%token Y_INACTIVE
%token Y_INCLUDERES
%token Y_LANGUAGE
%token Y_LISTBOX
%token Y_LOADONCALL
%token Y_LTEXT
%token Y_MENU
%token Y_MENU_EX
%token Y_MENUBARBREAK
%token Y_MENUBREAK
%token Y_MENUITEM
%token Y_MESSAGETABLE
%token Y_MOVEABLE
%token Y_NOINVERT
%token Y_OWNERDRAW
%token Y_POPUP
%token Y_POUND_PRAGMA
%token Y_PRELOAD
%token Y_PRODUCTVERSION
%token Y_PURE
%token Y_PUSHBUTTON
%token Y_RADIOBUTTON
%token Y_RCDATA
%token Y_RCINCLUDE /* This is an old keyword that should no */
/* longer be used, but is used in the sample files*/
/* so may be used in some old .RC files. */
/* It is intercepted by the scanner */
%token Y_RTEXT
%token Y_SCROLLBAR
%token Y_SEPARATOR
%token Y_SHIFT
%token Y_STATE3
%token Y_STATIC
%token Y_STRINGTABLE
%token Y_STYLE
%token Y_TOOLBAR
%token Y_VALUE
%token Y_VERSION
%token Y_VERSIONINFO
%token Y_VIRTKEY
%type <maskint> constant-expression
%type <maskint> conditional-exp
%type <maskint> log-or-exp
%type <maskint> log-and-exp
%type <maskint> bit-or-exp
%type <maskint> bit-xor-exp
%type <maskint> bit-and-exp
%type <maskint> equality-exp
%type <maskint> relational-exp
%type <maskint> shift-exp
%type <maskint> additive-exp
%type <maskint> multiplicative-exp
%type <maskint> unary-exp
%type <maskint> primary-exp
%type <token> keyword-name
%type <resid> name-id
%type <resid> type-id
%type <resid> user-defined-type-id
%type <accflags> acc-item-option
%type <accflags> acc-item-options
%type <accelfullentry> acc-item
%type <accelfullentry> acc-items
%type <resloc> acc-section
%type <integral> id-value
%type <accevent> event
%type <fullmemflags> resource-options
%type <token> resource-option
%type <string> file-name
%type <integral> fontitalic
%type <integral> fontweight
%type <integral> fontextra
%type <menuflags> menu-item-options
%type <token> menu-item-option
%type <menuptr> menu-section
%type <menuptr> menu-items
%type <menuitem> menu-item
%type <popupmenuitem> menu-popup-stmt
%type <normalmenuitem> menu-entry-stmt
%type <normalmenuitem> menu-entry-defn
%type <string> menu-text
%type <integral> menu-result
%type <langinfo> language-stmt
%type <integral> size-x
%type <integral> size-y
%type <integral> size-w
%type <integral> size-h
%type <sizeinfo> size-info
%type <string> string-constant
%type <string> string-group
%type <maskint> style
%type <maskint> exstyle
%type <diagopts> style-stmt
%type <diagopts> exstyle-stmt
%type <diagopts> exstyle-equal-stmt
%type <diagopts> caption-stmt
%type <diagopts> menu-stmt
%type <diagopts> class-stmt
%type <diagopts> font-stmt
%type <diagopts> diag-lang-stmt
%type <diagopts> diag-options-stmt
%type <diagopts> diag-version-stmt
%type <diagopts> diag-characteristics-stmt
%type <token> dialog-or-dialogEx
%type <dataelem> diag-data-elements
%type <nameorord> class-name
%type <nameorord> ctl-class-name
%type <integral> point-size
%type <string> typeface
%type <diaghead> diag-options-section
%type <diagctrllist> diag-control-section
%type <diagctrllist> diag-control-stmts
%type <diagctrl> diag-control-stmt
%type <diagctrlopts> cntl-text-options
%type <diagctrlopts> cntl-options
%type <diagctrl> ltext-stmt
%type <diagctrl> rtext-stmt
%type <diagctrl> ctext-stmt
%type <diagctrl> autocheckbox-stmt
%type <diagctrl> autoradiobutton-stmt
%type <diagctrl> auto3state-stmt
%type <diagctrl> checkbox-stmt
%type <diagctrl> pushbutton-stmt
%type <diagctrl> listbox-stmt
%type <diagctrl> groupbox-stmt
%type <diagctrl> defpushbutton-stmt
%type <diagctrl> radiobutton-stmt
%type <diagctrl> edittext-stmt
%type <diagctrl> combobox-stmt
%type <diagctrl> icon-stmt
%type <diagctrl> scrollbar-stmt
%type <diagctrl> control-stmt
%type <diagctrl> state3-stmt
%type <nameorord> icon-name
%type <diagctrlopts> icon-parms
%type <integral> cntl-id
%type <resid> cntl-text
%type <integral> string-id
%type <stritem> string-item
%type <strtable> string-items
%type <strtable> string-section
%type <rawitem> raw-data-item
%type <resloc> user-defined-data
%type <token> resource-type
%type <verinforoot> fixed-ver-section
%type <verfixedoption> fixed-ver-stmt
%type <verfixedoption> fileversion-stmt
%type <verfixedoption> productversion-stmt
%type <verfixedoption> fileflagsmask-stmt
%type <verfixedoption> fileflags-stmt
%type <verfixedoption> fileos-stmt
%type <verfixedoption> filetype-stmt
%type <verfixedoption> filesubtype-stmt
%type <verfixedoption> version
%type <verpair> version-pair
%type <verblocknest> variable-ver-section
%type <verblocknest> block-stmts
%type <verblock> block-stmt
%type <string> block-name
%type <verblocknest> block-body
%type <verblocknest> value-stmts
%type <verblock> value-stmt
%type <string> value-name
%type <valuelist> value-list
%type <valueitem> value-item
%type <valueitem> value-string-list
%type <dataelem> raw-data-section
%type <dataelem> raw-data-items
%type <dlghelpid> helpId-opt
%type <integral> menuId
%type <integral> menuType
%type <integral> menuState
%type <integral> helpId
%type <toolbar> toolbar-block
%type <toolbar> toolbar-items
%type <integral> toolbar-item
%start goal-symbol
%%
goal-symbol
: resources
| /* nothing */
;
resources
: resource
| resources resource
;
resource
: normal-resource
| string-table-resource
| error-table-resource
| pragma-statment
| includeres-statement
;
normal-resource
: single-line-resource
| rcdata-resource
| user-defined-resource
| accelerators-resource
| menu-resource
| menuex-resource
| dlg-resource
| version-info-resource
| language-resource
| characteristics-stmt
| version-stmt
| message-table-resource
| toolbar-resource
;
name-id
: Y_NAME
{ $$ = WResIDFromStr( $1.string ); RcMemFree( $1.string ); }
| string-constant
{ $$ = WResIDFromStr( $1.string ); RcMemFree( $1.string ); }
| constant-expression
{
$$ = WResIDFromNum( $1.Value );
if( $$ == NULL ) {
$$ = WResIDFromNum( 0 );
RcError( ERR_BAD_RES_ID, $1.Value );
ErrorHasOccured = TRUE;
}
}
| keyword-name
{ $$ = WResIDFromStr( SemTokenToString( $1 ) ); }
;
type-id
: Y_NAME
{ $$ = WResIDFromStr( $1.string ); RcMemFree( $1.string ); }
| string-constant
{ $$ = WResIDFromStr( $1.string ); RcMemFree( $1.string ); }
| constant-expression
{
$$ = WResIDFromNum( $1.Value );
if( $$ == NULL ) {
$$ = WResIDFromNum( 0 );
RcError( ERR_BAD_RES_TYPE, $1.Value );
ErrorHasOccured = TRUE;
}
}
;
includeres-statement
: Y_INCLUDERES file-name
{
SemAddResFile( $2.string );
}
;
pragma-statment
: Y_POUND_PRAGMA Y_CODEPAGE Y_LPAREN constant-expression Y_RPAREN
{}
;
keyword-name
: Y_ACCELERATORS
{ $$ = Y_ACCELERATORS; }
| Y_ALT
{ $$ = Y_ALT; }
| Y_ASCII
{ $$ = Y_ASCII; }
| Y_AUTOCHECKBOX
{ $$ = Y_AUTOCHECKBOX; }
| Y_AUTORADIOBUTTON
{ $$ = Y_AUTORADIOBUTTON; }
| Y_AUTO3STATE
{ $$ = Y_AUTO3STATE; }
| Y_BEGIN
{ $$ = Y_BEGIN; }
| Y_BITMAP
{ $$ = Y_BITMAP; }
| Y_BLOCK
{ $$ = Y_BLOCK; }
| Y_BUTTON
{ $$ = Y_BUTTON; }
| Y_CAPTION
{ $$ = Y_CAPTION; }
| Y_CHARACTERISTICS
{ $$ = Y_CHARACTERISTICS; }
| Y_CHECKBOX
{ $$ = Y_CHECKBOX; }
| Y_CHECKED
{ $$ = Y_CHECKED; }
| Y_CLASS
{ $$ = Y_CLASS; }
| Y_COMBOBOX
{ $$ = Y_COMBOBOX; }
| Y_CODEPAGE
{ $$ = Y_CODEPAGE; }
| Y_CONTROL
{ $$ = Y_CONTROL; }
| Y_CTEXT
{ $$ = Y_CTEXT; }
| Y_CURSOR
{ $$ = Y_CURSOR; }
| Y_DEFPUSHBUTTON
{ $$ = Y_DEFPUSHBUTTON; }
| Y_DIALOG
{ $$ = Y_DIALOG; }
| Y_DIALOG_EX
{ $$ = Y_DIALOG_EX; }
| Y_DISCARDABLE
{ $$ = Y_DISCARDABLE; }
| Y_DLGINIT
{ $$ = Y_DLGINIT; }
| Y_EDIT
{ $$ = Y_EDIT; }
| Y_EDITTEXT
{ $$ = Y_EDITTEXT; }
| Y_END
{ $$ = Y_END; }
| Y_ERRTABLE
{ $$ = Y_ERRTABLE; }
| Y_EXSTYLE
{ $$ = Y_EXSTYLE; }
| Y_FILEFLAGS
{ $$ = Y_FILEFLAGS; }
| Y_FILEFLAGSMASK
{ $$ = Y_FILEFLAGSMASK; }
| Y_FILEOS
{ $$ = Y_FILEOS; }
| Y_FILESUBTYPE
{ $$ = Y_FILESUBTYPE; }
| Y_FILETYPE
{ $$ = Y_FILETYPE; }
| Y_FILEVERSION
{ $$ = Y_FILEVERSION; }
| Y_FIXED
{ $$ = Y_FIXED; }
| Y_FONT
{ $$ = Y_FONT; }
| Y_GRAYED
{ $$ = Y_GRAYED; }
| Y_GROUPBOX
{ $$ = Y_GROUPBOX; }
| Y_HELP
{ $$ = Y_HELP; }
| Y_ICON
{ $$ = Y_ICON; }
| Y_IMPURE
{ $$ = Y_IMPURE; }
| Y_INACTIVE
{ $$ = Y_INACTIVE; }
| Y_LANGUAGE
{ $$ = Y_LANGUAGE; }
| Y_LISTBOX
{ $$ = Y_LISTBOX; }
| Y_LOADONCALL
{ $$ = Y_LOADONCALL; }
| Y_LTEXT
{ $$ = Y_LTEXT; }
| Y_MENU
{ $$ = Y_MENU; }
| Y_MENU_EX
{ $$ = Y_MENU_EX; }
| Y_MENUBARBREAK
{ $$ = Y_MENUBARBREAK; }
| Y_MENUBREAK
{ $$ = Y_MENUBREAK; }
| Y_MENUITEM
{ $$ = Y_MENUITEM; }
| Y_MESSAGETABLE
{ $$ = Y_MESSAGETABLE; }
| Y_MOVEABLE
{ $$ = Y_MOVEABLE; }
| Y_NOINVERT
{ $$ = Y_NOINVERT; }
| Y_OWNERDRAW
{ $$ = Y_OWNERDRAW; }
| Y_POPUP
{ $$ = Y_POPUP; }
| Y_PRELOAD
{ $$ = Y_PRELOAD; }
| Y_PRODUCTVERSION
{ $$ = Y_PRODUCTVERSION; }
| Y_PURE
{ $$ = Y_PURE; }
| Y_PUSHBUTTON
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -