📄 rc.y
字号:
$$.ExtendedStyle = 0L;
$$.HelpId = 0L;
$$.HelpIdDefined = FALSE;
}
| comma-opt cntl-id comma-opt size-info comma-opt style
{
$$.ID = $2;
$$.Size = $4;
$$.Style = $6;
$$.Text = NULL;
$$.ExtendedStyle = 0L;
$$.HelpId = 0L;
$$.HelpIdDefined = FALSE;
}
| comma-opt cntl-id comma-opt size-info comma-opt style comma-opt exstyle
{
$$.ID = $2;
$$.Size = $4;
$$.Style = $6;
$$.Text = NULL;
$$.ExtendedStyle = $8.Value;
$$.HelpId = 0L;
$$.HelpIdDefined = FALSE;
}
| comma-opt cntl-id comma-opt size-info comma-opt style comma-opt
exstyle comma-opt helpId
{
$$.ID = $2;
$$.Size = $4;
$$.Style = $6;
$$.Text = NULL;
$$.ExtendedStyle = $8.Value;
$$.HelpId = $10;
$$.HelpIdDefined = TRUE;
}
;
cntl-id
: constant-expression
{ $$ = $1.Value; }
;
ltext-stmt
: Y_LTEXT cntl-text-options
{ $$ = SemNewDiagCtrl( Y_LTEXT, $2 ); }
;
rtext-stmt
: Y_RTEXT cntl-text-options
{ $$ = SemNewDiagCtrl( Y_RTEXT, $2 ); }
;
ctext-stmt
: Y_CTEXT cntl-text-options
{ $$ = SemNewDiagCtrl( Y_CTEXT, $2 ); }
;
autocheckbox-stmt
: Y_AUTOCHECKBOX cntl-text-options
{ $$ = SemNewDiagCtrl( Y_AUTOCHECKBOX, $2 ); }
;
autoradiobutton-stmt
: Y_AUTORADIOBUTTON cntl-text-options
{ $$ = SemNewDiagCtrl( Y_AUTORADIOBUTTON, $2 ); }
;
auto3state-stmt
: Y_AUTO3STATE cntl-text-options
{ $$ = SemNewDiagCtrl( Y_AUTO3STATE, $2 ); }
;
checkbox-stmt
: Y_CHECKBOX cntl-text-options
{ $$ = SemNewDiagCtrl( Y_CHECKBOX, $2 ); }
;
pushbutton-stmt
: Y_PUSHBUTTON cntl-text-options
{ $$ = SemNewDiagCtrl( Y_PUSHBUTTON, $2 ); }
;
listbox-stmt
: Y_LISTBOX cntl-options
{ $$ = SemNewDiagCtrl( Y_LISTBOX, $2 ); }
;
groupbox-stmt
: Y_GROUPBOX cntl-text-options
{ $$ = SemNewDiagCtrl( Y_GROUPBOX, $2 ); }
;
defpushbutton-stmt
: Y_DEFPUSHBUTTON cntl-text-options
{ $$ = SemNewDiagCtrl( Y_DEFPUSHBUTTON, $2 ); }
;
radiobutton-stmt
: Y_RADIOBUTTON cntl-text-options
{ $$ = SemNewDiagCtrl( Y_RADIOBUTTON, $2 ); }
;
edittext-stmt
: Y_EDITTEXT cntl-options
{ $$ = SemNewDiagCtrl( Y_EDITTEXT, $2 ); }
;
combobox-stmt
: Y_COMBOBOX cntl-options
{ $$ = SemNewDiagCtrl( Y_COMBOBOX, $2 ); }
;
icon-stmt
: Y_ICON icon-name comma-opt cntl-id comma-opt icon-parms
{ $6.Text = $2; $6.ID = $4; $$ = SemNewDiagCtrl( Y_ICON, $6 ); }
;
state3-stmt
: Y_STATE3 cntl-text-options
{ $$ = SemNewDiagCtrl( Y_STATE3, $2 ); }
;
icon-name
: name-id
{ $$ = WResIDToNameOrOrd( $1 ); RcMemFree( $1 ); }
;
icon-parms
: size-x comma-opt size-y
{
$$.Size.x = $1;
$$.Size.y = $3;
$$.Size.width = 0; /* ignore width, height, style */
$$.Size.height = 0;
$$.Style.Mask = 0;
$$.ExtendedStyle = 0L;
}
| size-x comma-opt size-y comma-opt style
{
$$.Size.x = $1;
$$.Size.y = $3;
$$.Size.width = 0; /* ignore width, height */
$$.Size.height = 0;
$$.Style = $5;
$$.ExtendedStyle = 0L;
}
| size-x comma-opt size-y comma-opt size-w comma-opt size-h
{
$$.Size.x = $1;
$$.Size.y = $3;
$$.Size.width = $5; /* ignore style */
$$.Size.height = $7;
$$.Style.Mask = 0;
$$.ExtendedStyle = 0L;
}
| size-x comma-opt size-y comma-opt size-w comma-opt size-h comma-opt style
{
$$.Size.x = $1;
$$.Size.y = $3;
$$.Size.width = $5;
$$.Size.height = $7;
$$.Style = $9;
$$.ExtendedStyle = 0L;
}
| size-x comma-opt size-y comma-opt size-w comma-opt size-h comma-opt style
comma-opt exstyle
{
$$.Size.x = $1;
$$.Size.y = $3;
$$.Size.width = $5;
$$.Size.height = $7;
$$.Style = $9;
$$.ExtendedStyle = $11.Value;
}
;
scrollbar-stmt
: Y_SCROLLBAR cntl-options
{ $$ = SemNewDiagCtrl( Y_SCROLLBAR, $2 ); }
;
control-stmt
: Y_CONTROL cntl-text comma-opt cntl-id comma-opt ctl-class-name comma-opt
style comma-opt size-info
{
$$ = SemSetControlData( $8, $4, $10, $2, $6, 0L, NULL );
}
| Y_CONTROL cntl-text comma-opt cntl-id comma-opt ctl-class-name comma-opt
style comma-opt size-info comma-opt exstyle helpId-opt
{
$$ = SemSetControlData( $8, $4, $10, $2, $6, $12.Value, &($13) );
}
;
cntl-text
: name-id
;
version-info-resource
: name-id Y_VERSIONINFO fixed-ver-section variable-ver-section
{
SemWriteVerInfo( $1, MEMFLAG_MOVEABLE | MEMFLAG_PURE, $3, $4 );
}
| name-id Y_VERSIONINFO resource-options fixed-ver-section
variable-ver-section
{
SemCheckMemFlags( &($3), 0, MEMFLAG_MOVEABLE, MEMFLAG_PURE );
SemWriteVerInfo( $1, $3.flags, $4, $5 );
}
;
fixed-ver-section
: fixed-ver-stmt
{ $$ = SemNewVerFixedInfo( $1 ); }
| fixed-ver-section fixed-ver-stmt
{ $$ = SemAddVerFixedInfo( $1, $2 ); }
;
fixed-ver-stmt
: fileversion-stmt
| productversion-stmt
| fileflagsmask-stmt
| fileflags-stmt
| fileos-stmt
| filetype-stmt
| filesubtype-stmt
;
fileversion-stmt
: Y_FILEVERSION version
{ $2.token = Y_FILEVERSION; $$ = $2; }
;
productversion-stmt
: Y_PRODUCTVERSION version
{ $2.token = Y_PRODUCTVERSION; $$ = $2; }
;
fileflagsmask-stmt
: Y_FILEFLAGSMASK constant-expression
{ $$.token = Y_FILEFLAGSMASK; $$.u.Option = $2.Value; }
;
fileflags-stmt
: Y_FILEFLAGS constant-expression
{ $$.token = Y_FILEFLAGS; $$.u.Option = $2.Value; }
;
fileos-stmt
: Y_FILEOS constant-expression
{ $$.token = Y_FILEOS; $$.u.Option = $2.Value; }
;
filetype-stmt
: Y_FILETYPE constant-expression
{ $$.token = Y_FILETYPE; $$.u.Option = $2.Value; }
;
filesubtype-stmt
: Y_FILESUBTYPE constant-expression
{ $$.token = Y_FILESUBTYPE; $$.u.Option = $2.Value; }
;
version
: version-pair
{
$$.u.Version.High = $1;
$$.u.Version.Low.HighWord = 0;
$$.u.Version.Low.LowWord = 0;
}
| version-pair comma-opt version-pair
{ $$.u.Version.High = $1; $$.u.Version.Low = $3; }
| version-pair comma-opt constant-expression
{
$$.u.Version.High = $1;
$$.u.Version.Low.HighWord = $3.Value;
$$.u.Version.Low.LowWord = 0;
}
;
version-pair
: constant-expression comma-opt constant-expression
{ $$.HighWord = $1.Value; $$.LowWord = $3.Value; }
;
variable-ver-section
: Y_BEGIN block-stmts Y_END
{ $$ = $2; }
| Y_LBRACE block-stmts Y_RBRACE
{ $$ = $2; }
;
block-stmts
: block-stmt
{ $$ = SemNewBlockNest( $1 ); }
| block-stmts block-stmt
{ $$ = SemAddBlockNest( $1, $2 ); }
;
block-stmt
: Y_BLOCK block-name block-body
{ $$ = SemNameVerBlock( $2.string, $3 ); }
;
block-name
: string-constant
;
block-body
: Y_BEGIN value-stmts Y_END
{ $$ = $2; }
| Y_BEGIN value-stmts block-stmts Y_END
{ $$ = SemMergeBlockNest( $2, $3 ); }
| Y_BEGIN block-stmts Y_END
{ $$ = $2; }
| Y_LBRACE value-stmts Y_RBRACE
{ $$ = $2; }
| Y_LBRACE value-stmts block-stmts Y_RBRACE
{ $$ = SemMergeBlockNest( $2, $3 ); }
| Y_LBRACE block-stmts Y_RBRACE
{ $$ = $2; }
;
value-stmts
: value-stmt
{ $$ = SemNewBlockNest( $1 ); }
| value-stmts value-stmt
{ $$ = SemAddBlockNest( $1, $2 ); }
;
value-stmt
: Y_VALUE value-name comma-opt value-list
{ $$ = SemNewBlockVal( $2.string, $4 ); }
;
value-name
: string-constant
;
value-list
: value-item
{ $$ = SemNewVerValueList( $1 ); }
| value-list comma-opt value-item
{ $$ = SemAddVerValueList( $1, $3 ); }
;
value-item
: constant-expression
{ $$.IsNum = TRUE; $$.Value.Num = $1.Value; }
| value-string-list
;
value-string-list
:string-constant
{
$$.IsNum = FALSE;
$$.Value.String = $1.string;
$$.strlen = $1.length;
}
| value-string-list string-constant
{
$$.IsNum = FALSE;
$$.strlen = strlen( $1.Value.String ) + strlen( $2.string );
$$.Value.String = RcMemMalloc( $$.strlen + 1 );
strcpy( $$.Value.String, $1.Value.String );
strcat( $$.Value.String, $2.string );
RcMemFree( $1.Value.String );
RcMemFree( $2.string );
}
;
string-constant
: Y_STRING
| Y_LSQ_BRACKET string-group Y_RSQ_BRACKET
{
$$ = $2;
}
;
string-group
: Y_STRING
| string-group Y_STRING
{
$$.lstring = ( $1.lstring | $2.lstring );
$$.length = $1.length + $2.length;
$$.string = RcMemMalloc( $$.length + 1 );
strcpy( $$.string, $1.string );
strcat( $$.string, $2.string );
RcMemFree( $1.string );
RcMemFree( $2.string );
}
;
constant-expression
: conditional-exp
;
conditional-exp
: log-or-exp
| log-or-exp Y_QUESTION constant-expression Y_COLON conditional-exp
{ $$ = $1.Value ? $3 : $5; }
;
log-or-exp
: log-and-exp
| log-or-exp Y_OR log-and-exp
{ $$.Value = $1.Value || $3.Value; $$.Mask = $1.Mask | $3.Mask; }
;
log-and-exp
: bit-or-exp
| log-and-exp Y_AND bit-or-exp
{ $$.Value = $1.Value && $3.Value; $$.Mask = $1.Mask | $3.Mask; }
;
bit-or-exp
: bit-xor-exp
| bit-or-exp Y_BITOR bit-xor-exp
{ $$.Value = $1.Value | $3.Value; $$.Mask = $1.Mask | $3.Mask; }
;
bit-xor-exp
: bit-and-exp
| bit-xor-exp Y_BITXOR bit-and-exp
{ $$.Value = $1.Value ^ $3.Value; $$.Mask = $1.Mask | $3.Mask; }
;
bit-and-exp
: equality-exp
| bit-and-exp Y_BITAND equality-exp
{ $$.Value = $1.Value & $3.Value; $$.Mask = $1.Mask | $3.Mask; }
;
equality-exp
: relational-exp
| equality-exp Y_EQ relational-exp
{ $$.Value = $1.Value == $3.Value; $$.Mask = $1.Mask | $3.Mask; }
| equality-exp Y_NE relational-exp
{ $$.Value = $1.Value != $3.Value; $$.Mask = $1.Mask | $3.Mask; }
;
relational-exp
: shift-exp
| relational-exp Y_GT shift-exp
{ $$.Value = $1.Value > $3.Value; $$.Mask = $1.Mask | $3.Mask; }
| relational-exp Y_LT shift-exp
{ $$.Value = $1.Value < $3.Value; $$.Mask = $1.Mask | $3.Mask; }
| relational-exp Y_GE shift-exp
{ $$.Value = $1.Value >= $3.Value; $$.Mask = $1.Mask | $3.Mask; }
| relational-exp Y_LE shift-exp
{ $$.Value = $1.Value <= $3.Value; $$.Mask = $1.Mask | $3.Mask; }
;
shift-exp
: additive-exp
| shift-exp Y_SHIFTL additive-exp
{ $$.Value = $1.Value << $3.Value; $$.Mask = $1.Mask | $3.Mask; }
| shift-exp Y_SHIFTR additive-exp
{ $$.Value = $1.Value >> $3.Value; $$.Mask = $1.Mask | $3.Mask; }
;
additive-exp
: multiplicative-exp
| additive-exp Y_PLUS multiplicative-exp
{ $$.Value = $1.Value + $3.Value; $$.Mask = $1.Mask | $3.Mask; }
| additive-exp Y_MINUS multiplicative-exp
{ $$.Value = $1.Value - $3.Value; $$.Mask = $1.Mask | $3.Mask; }
;
multiplicative-exp
: unary-exp
| multiplicative-exp Y_TIMES unary-exp
{ $$.Value = $1.Value * $3.Value; $$.Mask = $1.Mask | $3.Mask; }
| multiplicative-exp Y_DIVIDE unary-exp
{ $$.Value = $1.Value / $3.Value; $$.Mask = $1.Mask | $3.Mask; }
| multiplicative-exp Y_MOD unary-exp
{ $$.Value = $1.Value % $3.Value; $$.Mask = $1.Mask | $3.Mask; }
;
unary-exp
: primary-exp
| Y_MINUS unary-exp
{ $$.Value = - $2.Value; $$.Mask = $2.Mask; }
| Y_BITNOT unary-exp
{ $$.Value = ~ $2.Value; $$.Mask = $2.Mask; }
| Y_NOT unary-exp
{ $$.Value = ! $2.Value; $$.Mask = $2.Mask; }
;
primary-exp
: Y_INTEGER
{
$$.Mask = $1.val; $$.Value = $1.val;
$$.longVal = ($1.type & SCAN_INT_TYPE_LONG) != 0;
$$.unsgVal = ($1.type & SCAN_INT_TYPE_UNSIGNED) != 0;
}
| Y_LPAREN constant-expression Y_RPAREN
{ $$ = $2; }
;
%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -