📄 rc.y
字号:
}
| Y_POPUP menu-text comma-opt menu-item-options comma-opt menu-section comma-opt
{
$$.item.type = MT_MENU;
$$.item.menuData.ItemText = $2.string;
$$.item.menuData.ItemFlags = $4 | MENU_POPUP;
$$.submenu = $6;
}
;
menu-entry-stmt
: Y_MENUITEM menu-entry-defn
{ $$ = $2; }
;
menu-entry-defn
: Y_SEPARATOR comma-opt
{
$$.type = MT_SEPARATOR;
$$.menuData.ItemText = NULL;
$$.menuData.ItemID = 0;
$$.menuData.ItemFlags = 0;
$$.menuExData.ItemType = MENUEX_SEPARATOR;
$$.menuExData.ItemState = 0;
}
| menu-text comma-opt
{
$$.type = MT_MENUEX_NO_ID;
$$.menuData.ItemText = $1.string;
$$.menuData.ItemID = 0;
$$.menuData.ItemFlags = 0;
$$.menuExData.ItemType = 0L;
$$.menuExData.ItemState = 0L;
}
| menu-text comma-opt menu-result comma-opt
{
$$.type = MT_EITHER;
$$.menuData.ItemText = $1.string;
$$.menuData.ItemID = $3;
$$.menuData.ItemFlags = 0;
$$.menuExData.ItemType = 0L;
$$.menuExData.ItemState = 0L;
}
| menu-text comma-opt menu-result comma-opt menuType comma-opt
{
$$.type = MT_MENUEX;
$$.menuData.ItemText = $1.string;
$$.menuData.ItemID = $3;
$$.menuData.ItemFlags = 0;
$$.menuExData.ItemType = $5;
$$.menuExData.ItemState = 0L;
}
| menu-text comma-opt menu-result comma-opt menuType comma-opt
menuState comma-opt
{
$$.type = MT_MENUEX;
$$.menuData.ItemText = $1.string;
$$.menuData.ItemID = $3;
$$.menuData.ItemFlags = 0;
$$.menuExData.ItemType = $5;
$$.menuExData.ItemState = $7;
}
| menu-text comma-opt menu-result comma-opt menu-item-options comma-opt
{
$$.type = MT_MENU;
$$.menuData.ItemText = $1.string;
$$.menuData.ItemID = $3;
$$.menuData.ItemFlags = $5;
}
;
menu-text
: string-constant
;
menu-result
: constant-expression
{ $$ = $1.Value; }
;
/* Note: The way we accept menu options differs from what is specified */
/* in the Windows Programmer's Reference. There they say that the Y_HELP */
/* keyword is used only with menu entry statements but then proceed to ignore */
/* it. The bit that is designated MF_HELP in windows.h only produces */
/* meaningful results if it is set for top level menu items. Every where else */
/* we issue a warnning but set the bit anyways. This is similar to what the */
/* Whitewater Resource Toolkit does. */
/* Note: the Y_BITMAP and Y_OWNERDRAW keywords may not be meaning full in this*/
/* context but we accept them anyways and set the appropriate bits assuming */
/* that the user knows what he or she is doing when they use these keyword */
menu-item-options
: menu-item-option
{ $$ = SemAddFirstMenuOption( $1 ); }
| menu-item-options comma-opt menu-item-option
{ $$ = SemAddMenuOption( $1, $3 ); }
;
menu-item-option
: Y_CHECKED
{ $$ = Y_CHECKED; }
| Y_GRAYED
{ $$ = Y_GRAYED; }
| Y_INACTIVE
{ $$ = Y_INACTIVE; }
| Y_MENUBARBREAK
{ $$ = Y_MENUBARBREAK; }
| Y_MENUBREAK
{ $$ = Y_MENUBREAK; }
| Y_OWNERDRAW
{ $$ = Y_OWNERDRAW; }
| Y_BITMAP
{ $$ = Y_BITMAP; }
| Y_HELP
{ $$ = Y_HELP; }
;
language-resource
: language-stmt
{
SemSetGlobalLanguage( &$1 );
}
;
opt-resource-info-stmts
: resource-info-stmts
| /* nothing */
;
resource-info-stmts
: resource-info-stmt
| resource-info-stmts resource-info-stmt
;
resource-info-stmt
: language-stmt
{
SemSetResourceLanguage( &$1, TRUE );
}
| characteristics-stmt
| version-stmt
;
language-stmt
: Y_LANGUAGE constant-expression Y_COMMA constant-expression
{ $$.lang = $2.Value; $$.sublang = $4.Value; }
;
characteristics-stmt
: Y_CHARACTERISTICS constant-expression
{ SemUnsupported( Y_CHARACTERISTICS ); }
;
version-stmt
: Y_VERSION constant-expression
{ SemUnsupported( Y_VERSION ); }
;
dialog-or-dialogEx
: Y_DIALOG
{ $$ = Y_DIALOG; }
| Y_DIALOG_EX
{ $$ = Y_DIALOG_EX; }
;
helpId-opt
: comma-opt constant-expression
{ $$.HelpId = $2.Value; $$.HelpIdDefined = TRUE; }
| /* nothing */
{ $$.HelpId = 0; $$.HelpIdDefined = FALSE; }
;
dlg-resource
: name-id dialog-or-dialogEx size-info helpId-opt diag-options-section
diag-control-section
{
SemWriteDialogBox( $1,
MEMFLAG_PURE|MEMFLAG_MOVEABLE|MEMFLAG_DISCARDABLE,
$3, $5, $6, $4, $2 );
}
| name-id dialog-or-dialogEx size-info helpId-opt diag-control-section
{
SemWriteDialogBox( $1,
MEMFLAG_PURE|MEMFLAG_MOVEABLE|MEMFLAG_DISCARDABLE,
$3, NULL, $5, $4, $2 );
}
| name-id dialog-or-dialogEx exstyle-equal-stmt size-info helpId-opt
diag-options-section diag-control-section
{
SemWriteDialogBox( $1,
MEMFLAG_PURE|MEMFLAG_MOVEABLE|MEMFLAG_DISCARDABLE,
$4, SemDiagOptions( $6, &($3) ), $7, $5, $2 );
}
| name-id dialog-or-dialogEx exstyle-equal-stmt size-info helpId-opt
diag-control-section
{
SemWriteDialogBox( $1,
MEMFLAG_PURE|MEMFLAG_MOVEABLE|MEMFLAG_DISCARDABLE,
$4, SemNewDiagOptions( &($3 ) ), $6, $5, $2 );
}
| name-id dialog-or-dialogEx resource-options comma-opt size-info helpId-opt
diag-options-section diag-control-section
{
SemCheckMemFlags( &($3), 0, MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE,
MEMFLAG_PURE );
SemWriteDialogBox( $1, $3.flags, $5, $7, $8, $6, $2 );
}
| name-id dialog-or-dialogEx resource-options comma-opt size-info helpId-opt
diag-control-section
{
SemCheckMemFlags( &($3), 0, MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE,
MEMFLAG_PURE );
SemWriteDialogBox( $1, $3.flags, $5, NULL, $7, $6, $2 );
}
| name-id dialog-or-dialogEx resource-options comma-opt exstyle-equal-stmt
size-info helpId-opt diag-options-section diag-control-section
{
SemCheckMemFlags( &($3), 0, MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE,
MEMFLAG_PURE );
SemWriteDialogBox( $1, $3.flags, $6,
SemDiagOptions( $8, &($5) ) , $9, $7, $2 );
}
| name-id dialog-or-dialogEx resource-options comma-opt exstyle-equal-stmt
size-info helpId-opt diag-control-section
{
SemCheckMemFlags( &($3), 0, MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE,
MEMFLAG_PURE );
SemWriteDialogBox( $1, $3.flags, $6,
SemNewDiagOptions( &($5 ) ), $8, $7, $2 );
}
;
size-info
: size-x comma-opt size-y comma-opt size-w comma-opt size-h
{ $$.x = $1; $$.y = $3; $$.width = $5; $$.height = $7; }
;
size-x
: constant-expression
{ $$ = $1.Value; }
;
size-y
: constant-expression
{ $$ = $1.Value; }
;
size-w
: constant-expression
{ $$ = $1.Value; }
;
size-h
: constant-expression
{ $$ = $1.Value; }
;
diag-options-section
: diag-options-stmt
{ $$ = SemNewDiagOptions( &($1) ); }
| diag-options-section diag-options-stmt
{ $$ = SemDiagOptions( $1, &($2) ); }
;
diag-options-stmt
: style-stmt
| exstyle-stmt
| caption-stmt
| menu-stmt
| class-stmt
| font-stmt
| diag-lang-stmt
| diag-version-stmt
| diag-characteristics-stmt
;
diag-lang-stmt
: language-stmt
{ $$.token = Y_LANGUAGE; $$.Opt.lang = $1; }
;
diag-version-stmt
: version-stmt
{ $$.token = Y_VERSION; }
;
diag-characteristics-stmt
: characteristics-stmt
{ $$.token = Y_CHARACTERISTICS; }
;
exstyle-stmt
: Y_EXSTYLE exstyle
{ $$.token = Y_EXSTYLE; $$.Opt.Exstyle = $2.Value; }
;
exstyle-equal-stmt
: Y_EXSTYLE Y_SINGLE_EQ exstyle comma-opt
{ $$.token = Y_EXSTYLE; $$.Opt.Exstyle = $3.Value; }
;
exstyle
: constant-expression
;
style-stmt
: Y_STYLE style
{ $$.token = Y_STYLE; $$.Opt.Style = $2.Value; }
;
style
: constant-expression
;
caption-stmt
: Y_CAPTION string-constant
{
$$.token = Y_CAPTION;
$$.Opt.Str = $2.string;
}
;
menu-stmt
: Y_MENU name-id
{
$$.token = Y_MENU;
$$.Opt.Name = WResIDToNameOrOrd( $2 );
RcMemFree( $2 );
}
;
class-stmt
: Y_CLASS class-name
{ $$.token = Y_CLASS; $$.Opt.Name = $2; }
;
class-name
: string-constant
{ $$ = ResStrToNameOrOrd( $1.string ); RcMemFree( $1.string ); }
| constant-expression
{ $$ = ResNumToNameOrOrd( $1.Value ); }
;
ctl-class-name
: string-constant
{ $$ = ResStrToNameOrOrd( $1.string ); RcMemFree( $1.string ); }
| Y_BUTTON
{ $$ = ResStrToNameOrOrd( "BUTTON" ); }
| Y_COMBOBOX
{ $$ = ResStrToNameOrOrd( "COMBOBOX" ); }
| Y_EDIT
{ $$ = ResStrToNameOrOrd( "EDIT" ); }
| Y_LISTBOX
{ $$ = ResStrToNameOrOrd( "LISTBOX" ); }
| Y_SCROLLBAR
{ $$ = ResStrToNameOrOrd( "SCROLLBAR" ); }
| Y_STATIC
{ $$ = ResStrToNameOrOrd( "STATIC" ); }
| constant-expression
{ $$ = ResNumToNameOrOrd( $1.Value ); }
;
font-stmt
: Y_FONT point-size comma-opt typeface
{
$$.token = Y_FONT;
$$.Opt.Font.PointSize = $2;
$$.Opt.Font.FontName = $4.string;
$$.Opt.Font.FontWeight = 0;
$$.Opt.Font.FontItalic = 0;
$$.Opt.Font.FontExtra = 1;
$$.Opt.Font.FontWeightDefined = FALSE;
$$.Opt.Font.FontItalicDefined = FALSE;
}
| Y_FONT point-size comma-opt typeface comma-opt fontweight
{
$$.token = Y_FONT;
$$.Opt.Font.PointSize = $2;
$$.Opt.Font.FontName = $4.string;
$$.Opt.Font.FontWeight = $6;
$$.Opt.Font.FontItalic = 0;
$$.Opt.Font.FontExtra = 1;
$$.Opt.Font.FontWeightDefined = TRUE;
$$.Opt.Font.FontItalicDefined = FALSE;
}
| Y_FONT point-size comma-opt typeface comma-opt fontweight comma-opt
fontitalic
{
$$.token = Y_FONT;
$$.Opt.Font.PointSize = $2;
$$.Opt.Font.FontName = $4.string;
$$.Opt.Font.FontWeight = $6;
$$.Opt.Font.FontItalic = $8;
$$.Opt.Font.FontExtra = 1;
$$.Opt.Font.FontWeightDefined = TRUE;
$$.Opt.Font.FontItalicDefined = TRUE;
}
| Y_FONT point-size comma-opt typeface comma-opt fontweight comma-opt
fontitalic comma-opt fontextra
{
$$.token = Y_FONT;
$$.Opt.Font.PointSize = $2;
$$.Opt.Font.FontName = $4.string;
$$.Opt.Font.FontWeight = $6;
$$.Opt.Font.FontItalic = $8;
$$.Opt.Font.FontExtra = $10;
$$.Opt.Font.FontWeightDefined = TRUE;
$$.Opt.Font.FontItalicDefined = TRUE;
}
;
fontextra
: constant-expression
{ $$ = $1.Value & 0xFF; }
;
fontweight
: constant-expression
{ $$ = $1.Value; }
;
fontitalic
: constant-expression
{
/* the value stored is boolean and must be 1 or 0 */
$$ = ( $1.Value != 0 );
}
;
point-size
: constant-expression
{ $$ = $1.Value; }
;
typeface
: string-constant
;
diag-control-section
: Y_BEGIN diag-control-stmts Y_END
{
$$ = $2;
}
| Y_LBRACE diag-control-stmts Y_RBRACE
{ $$ = $2; }
| Y_BEGIN Y_END
{ $$ = SemEmptyDiagCtrlList(); }
| Y_LBRACE Y_RBRACE
{ $$ = SemEmptyDiagCtrlList(); }
;
diag-data-elements
: raw-data-section
| /* Nothing */
{ $$ = NULL; }
;
diag-control-stmts
: diag-control-stmt diag-data-elements
{ $$ = SemNewDiagCtrlList( $1, $2 ); }
| diag-control-stmts diag-control-stmt diag-data-elements
{ $$ = SemAddDiagCtrlList( $1, $2, $3 ); }
;
diag-control-stmt
: ltext-stmt
| rtext-stmt
| ctext-stmt
| autocheckbox-stmt
| autoradiobutton-stmt
| auto3state-stmt
| checkbox-stmt
| pushbutton-stmt
| listbox-stmt
| groupbox-stmt
| defpushbutton-stmt
| radiobutton-stmt
| edittext-stmt
| combobox-stmt
| icon-stmt
| scrollbar-stmt
| state3-stmt
| control-stmt
;
cntl-text-options
: string-constant cntl-options
{
$2.Text = ResStrToNameOrOrd( $1.string );
RcMemFree( $1.string );
$$ = $2;
}
;
cntl-options
: comma-opt cntl-id comma-opt size-info
{
$$.ID = $2;
$$.Size = $4;
$$.Style.Mask = 0;
$$.Text = NULL;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -