📄 rc.y
字号:
{ $$ = Y_PUSHBUTTON; }
| Y_RADIOBUTTON
{ $$ = Y_RADIOBUTTON; }
| Y_RCDATA
{ $$ = Y_RCDATA; }
| Y_RCINCLUDE
{ $$ = Y_RCINCLUDE; }
| Y_RTEXT
{ $$ = Y_RTEXT; }
| Y_SCROLLBAR
{ $$ = Y_SCROLLBAR; }
| Y_SEPARATOR
{ $$ = Y_SEPARATOR; }
| Y_SHIFT
{ $$ = Y_SHIFT; }
| Y_STATIC
{ $$ = Y_STATIC; }
| Y_STATE3
{ $$ = Y_STATE3; }
| Y_STRINGTABLE
{ $$ = Y_STRINGTABLE; }
| Y_STYLE
{ $$ = Y_STYLE; }
| Y_TOOLBAR
{ $$ = Y_TOOLBAR; }
| Y_VALUE
{ $$ = Y_VALUE; }
| Y_VERSIONINFO
{ $$ = Y_VERSIONINFO; }
| Y_VIRTKEY
{ $$ = Y_VIRTKEY; }
;
comma-opt
: Y_COMMA
| /* nothing */
;
single-line-resource
: name-id resource-type file-name
{ SemAddSingleLineResource( $1, $2, NULL, $3.string ); }
| name-id resource-type resource-options file-name
{ SemAddSingleLineResource( $1, $2, &($3), $4.string ); }
;
resource-options
: resource-option
{ $$ = SemAddFirstMemOption( $1 ); }
| resource-options resource-option
{ $$ = SemAddMemOption( $1, $2 ); }
;
resource-option
: Y_PRELOAD
{ $$ = Y_PRELOAD; }
| Y_LOADONCALL
{ $$ = Y_LOADONCALL; }
| Y_FIXED
{ $$ = Y_FIXED; }
| Y_MOVEABLE
{ $$ = Y_MOVEABLE; }
| Y_PURE
{ $$ = Y_PURE; }
| Y_IMPURE
{ $$ = Y_IMPURE; }
| Y_DISCARDABLE
{ $$ = Y_DISCARDABLE; }
;
file-name
: Y_NAME
| Y_DOS_FILENAME
| string-constant
;
resource-type
: Y_CURSOR
{ $$ = Y_CURSOR; }
| Y_ICON
{ $$ = Y_ICON; }
| Y_BITMAP
{ $$ = Y_BITMAP; }
| Y_FONT
{ $$ = Y_FONT; }
;
user-defined-resource
: name-id comma-opt user-defined-type-id user-defined-data
{
SemAddResourceFree( $1, $3,
MEMFLAG_PURE | MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE, $4 );
}
| name-id comma-opt user-defined-type-id resource-options user-defined-data
{
SemCheckMemFlags( &($4), 0, MEMFLAG_DISCARDABLE|MEMFLAG_MOVEABLE,
MEMFLAG_PURE );
SemAddResourceFree( $1, $3, $4.flags, $5 );
}
;
user-defined-type-id
:type-id
{ $$ = $1; }
|Y_DLGINIT
{ $$ = WResIDFromNum( 0xF0 ); }
;
user-defined-data
: file-name
{ $$ = SemCopyRawFile( $1.string ); RcMemFree( $1.string ); }
| raw-data-section
{ $$ = SemFlushDataElemList( $1, TRUE ); }
;
raw-data-section
: Y_BEGIN raw-data-items Y_END
{ $$ = $2; }
| Y_LBRACE raw-data-items Y_RBRACE
{ $$ = $2; }
;
raw-data-items
: raw-data-item
{ $$ = SemNewDataElemList( $1 ); }
| raw-data-items raw-data-item
{ $$ = SemAppendDataElem( $1, $2 ); }
| raw-data-items Y_COMMA
{ $$ = $1; }
;
raw-data-item
: string-constant
{
$$.IsString = TRUE;
$$.TmpStr = TRUE;
$$.StrLen = $1.length;
$$.Item.String = $1.string;
$$.LongItem = $1.lstring;
}
| constant-expression
{ $$.IsString = FALSE; $$.Item.Num = $1.Value; $$.LongItem = $1.longVal; }
;
rcdata-resource
: name-id Y_RCDATA opt-resource-info-stmts user-defined-data
{
SemAddResourceFree( $1, WResIDFromNum( RT_RCDATA ),
MEMFLAG_PURE | MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE, $4 );
}
| name-id Y_RCDATA resource-options opt-resource-info-stmts user-defined-data
{
SemCheckMemFlags( &($3), 0, MEMFLAG_DISCARDABLE|MEMFLAG_MOVEABLE,
MEMFLAG_PURE );
SemAddResourceFree( $1, WResIDFromNum( RT_RCDATA ), $3.flags, $5 );
}
;
string-table-resource
: Y_STRINGTABLE opt-resource-info-stmts string-section
{
SemMergeStrTable( $3,
MEMFLAG_PURE|MEMFLAG_MOVEABLE|MEMFLAG_DISCARDABLE );
}
| Y_STRINGTABLE resource-options opt-resource-info-stmts string-section
{
SemCheckMemFlags( &($2), 0, MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE,
MEMFLAG_PURE );
SemMergeStrTable( $4, $2.flags );
}
;
toolbar-resource
: name-id Y_TOOLBAR resource-options constant-expression comma-opt
constant-expression toolbar-block
{
SemCheckMemFlags( &($3), 0, MEMFLAG_MOVEABLE, MEMFLAG_PURE );
SemWriteToolBar( $1, $7, $4.Value, $6.Value, $3.flags );
}
| name-id Y_TOOLBAR constant-expression comma-opt
constant-expression toolbar-block
{
SemWriteToolBar( $1, $6, $3.Value, $5.Value,
MEMFLAG_PURE | MEMFLAG_MOVEABLE );
}
;
toolbar-block
: Y_BEGIN toolbar-items Y_END
{
$$ = $2;
}
| Y_LBRACE toolbar-items Y_RBRACE
{
$$ = $2;
}
;
toolbar-items
: toolbar-item
{
$$ = SemCreateToolBar();
SemAddToolBarItem( $$, $1 );
}
| toolbar-items toolbar-item
{
$$ = $1;
SemAddToolBarItem( $$, $2 );
}
;
toolbar-item
: Y_BUTTON constant-expression
{
$$ = $2.Value;
}
| Y_SEPARATOR
{
$$ = 0;
}
;
message-table-resource
: name-id Y_MESSAGETABLE file-name
{
SemAddMessageTable( $1, &$3 );
}
;
error-table-resource
: Y_ERRTABLE opt-resource-info-stmts string-section
{
SemMergeErrTable( $3,
MEMFLAG_PURE|MEMFLAG_MOVEABLE|MEMFLAG_DISCARDABLE );
}
| Y_ERRTABLE resource-options opt-resource-info-stmts string-section
{
SemCheckMemFlags( &($2), 0, MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE,
MEMFLAG_PURE );
SemMergeErrTable( $4, $2.flags );
}
;
string-section
: Y_BEGIN string-items Y_END
{ $$ = $2; }
| Y_LBRACE string-items Y_RBRACE
{ $$ = $2; }
;
string-items
: string-item
{
$$ = SemNewStringTable();
SemAddStrToStringTable( $$, $1.ItemID, $1.String );
RcMemFree( $1.String );
}
| string-items string-item
{
SemAddStrToStringTable( $1, $2.ItemID, $2.String );
$$ = $1;
RcMemFree( $2.String );
}
;
string-item
: string-id comma-opt string-constant
{ $$.ItemID = $1; $$.String = $3.string; }
;
string-id
: constant-expression
{ $$ = $1.Value; }
;
accelerators-resource
: name-id Y_ACCELERATORS opt-resource-info-stmts acc-section
{
SemAddResourceFree( $1, WResIDFromNum( RT_ACCELERATOR ),
MEMFLAG_PURE | MEMFLAG_MOVEABLE, $4 );
}
| name-id Y_ACCELERATORS resource-options opt-resource-info-stmts acc-section
{
SemCheckMemFlags( &($3), 0, MEMFLAG_MOVEABLE, MEMFLAG_PURE );
SemAddResourceFree( $1, WResIDFromNum( RT_ACCELERATOR ),
$3.flags, $5 );
}
;
acc-section
: Y_BEGIN acc-items Y_END
{
SemWriteLastAccelEntry( $2 );
$$.start = $2.startoftable;
$$.len = SemEndResource( $2.startoftable );
}
| Y_LBRACE acc-items Y_RBRACE
{
SemWriteLastAccelEntry( $2 );
$$.start = $2.startoftable;
$$.len = SemEndResource( $2.startoftable );
}
;
acc-items
: acc-item
{ $$ = $1; $$.startoftable = SemStartResource(); }
| acc-items acc-item
{
SemWriteAccelEntry( $1 );
$$ = $2;
$$.startoftable = $1.startoftable;
}
;
acc-item
: event comma-opt id-value comma-opt acc-item-options
{ $$ = SemMakeAccItem( $1, $3, $5 ); }
| event comma-opt id-value
{ $$ = SemMakeAccItem( $1, $3, DefaultAccelFlags ); }
;
event
: string-constant
{
$$.event = SemStrToAccelEvent( $1.string );
$$.strevent = TRUE;
RcMemFree( $1.string );
}
| constant-expression
{
$$.event = $1.Value;
$$.strevent = FALSE;
}
;
id-value
: constant-expression
{ $$ = $1.Value; }
;
acc-item-options
: acc-item-option
| acc-item-options comma-opt acc-item-option
{
if ($3.flags == ACCEL_ASCII) {
$$.flags = $1.flags & ~ACCEL_VIRTKEY;
} else {
$$.flags = $1.flags | $3.flags;
}
$$.typegiven = $1.typegiven || $3.typegiven;
}
;
acc-item-option
: Y_NOINVERT
{ $$.flags = ACCEL_NOINVERT; $$.typegiven = FALSE; }
| Y_ALT
{ $$.flags = ACCEL_ALT; $$.typegiven = FALSE; }
| Y_SHIFT
{ $$.flags = ACCEL_SHIFT; $$.typegiven = FALSE; }
| Y_CONTROL
{ $$.flags = ACCEL_CONTROL; $$.typegiven = FALSE; }
| Y_ASCII
{ $$.flags = ACCEL_ASCII; $$.typegiven = TRUE; }
| Y_VIRTKEY
{ $$.flags = ACCEL_VIRTKEY; $$.typegiven = TRUE; }
;
menuex-resource
: name-id Y_MENU_EX menu-section
{ SemWriteMenu( $1, MEMFLAG_PURE|MEMFLAG_MOVEABLE|MEMFLAG_DISCARDABLE,
$3, Y_MENU_EX ); }
| name-id Y_MENU_EX resource-options menu-section
{
SemCheckMemFlags( &($3), 0, MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE,
MEMFLAG_PURE );
SemWriteMenu( $1, $3.flags, $4, Y_MENU_EX );
}
;
menu-resource
: name-id Y_MENU opt-resource-info-stmts menu-section
{ SemWriteMenu( $1, MEMFLAG_PURE|MEMFLAG_MOVEABLE|MEMFLAG_DISCARDABLE,
$4, Y_MENU ); }
| name-id Y_MENU resource-options opt-resource-info-stmts menu-section
{
SemCheckMemFlags( &($3), 0, MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE,
MEMFLAG_PURE );
SemWriteMenu( $1, $3.flags, $5, Y_MENU );
}
;
menu-section
: Y_BEGIN menu-items Y_END
{ $$ = $2; }
| Y_LBRACE menu-items Y_RBRACE
{ $$ = $2; }
;
menu-items
: menu-item
{ $$ = SemNewMenu( $1 ); }
| menu-items menu-item
{ $$ = SemAddMenuItem( $1, $2 ); }
;
menuId
: constant-expression
{ $$ = $1.Value; }
;
menuType
: constant-expression
{ $$ = $1.Value; }
;
menuState
: constant-expression
{ $$ = $1.Value; }
;
helpId
: constant-expression
{ $$ = $1.Value; }
;
menu-item
: menu-entry-stmt
{
$$.next = NULL;
$$.prev = NULL;
$$.UseUnicode = (CmdLineParms.TargetOS == RC_TARGET_OS_WIN32);
$$.IsPopup = FALSE;
$$.item.normal = $1;
}
| menu-popup-stmt
{
$$.next = NULL;
$$.prev = NULL;
$$.UseUnicode = (CmdLineParms.TargetOS == RC_TARGET_OS_WIN32);
$$.IsPopup = TRUE;
$$.item.popup = $1;
}
;
menu-popup-stmt
: Y_POPUP menu-text comma-opt menu-section comma-opt
{
$$.item.type = MT_EITHER;
$$.item.menuData.ItemFlags = MENU_POPUP;
$$.item.menuData.ItemText = $2.string;
$$.submenu = $4;
$$.item.menuExData.ItemId = 0L;
$$.item.menuExData.ItemType = 0L;
$$.item.menuExData.ItemState = 0L;
$$.item.menuExData.HelpId = 0L;
}
| Y_POPUP menu-text comma-opt menuId comma-opt menu-section comma-opt
{
$$.item.type = MT_MENUEX;
$$.item.menuData.ItemFlags = MENUEX_POPUP;
$$.item.menuData.ItemText = $2.string;
$$.submenu = $6;
$$.item.menuExData.ItemId = $4;
$$.item.menuExData.ItemType = 0L;
$$.item.menuExData.ItemState = 0L;
$$.item.menuExData.HelpId = 0L;
}
| Y_POPUP menu-text comma-opt menuId comma-opt menuType comma-opt
menu-section comma-opt
{
$$.item.type = MT_MENUEX;
$$.item.menuData.ItemFlags = MENUEX_POPUP;
$$.item.menuData.ItemText = $2.string;
$$.submenu = $8;
$$.item.menuExData.ItemId = $4;
$$.item.menuExData.ItemType = $6;
$$.item.menuExData.ItemState = 0L;
$$.item.menuExData.HelpId = 0L;
}
| Y_POPUP menu-text comma-opt menuId comma-opt menuType comma-opt
menuState comma-opt menu-section comma-opt
{
$$.item.type = MT_MENUEX;
$$.item.menuData.ItemFlags = MENUEX_POPUP;
$$.item.menuData.ItemText = $2.string;
$$.submenu = $10;
$$.item.menuExData.ItemId = $4;
$$.item.menuExData.ItemType = $6;
$$.item.menuExData.ItemState = $8;
$$.item.menuExData.HelpId = 0L;
}
| Y_POPUP menu-text comma-opt menuId comma-opt menuType comma-opt
menuState comma-opt helpId comma-opt menu-section comma-opt
{
$$.item.type = MT_MENUEX;
$$.item.menuData.ItemFlags = MENUEX_POPUP;
$$.item.menuData.ItemText = $2.string;
$$.submenu = $12;
$$.item.menuExData.ItemId = $4;
$$.item.menuExData.ItemType = $6;
$$.item.menuExData.ItemState = $8;
$$.item.menuExData.HelpId = $10;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -