⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rcparse.y

📁 基于4个mips核的noc设计
💻 Y
📖 第 1 页 / 共 3 页
字号:
	  }	| rcdata_data ',' sizednumexpr	  {	    struct rcdata_item *ri;	    ri = define_rcdata_number ($3.val, $3.dword);	    $$.first = $1.first;	    $1.last->next = ri;	    $$.last = ri;	  }	;/* Stringtable resources.  */stringtable:	  STRINGTABLE suboptions BEG 	    { sub_res_info = $2; }	    string_data END	;string_data:	  /* empty */	| string_data numexpr QUOTEDSTRING	  {	    define_stringtable (&sub_res_info, $2, $3);	  }	| string_data numexpr ',' QUOTEDSTRING	  {	    define_stringtable (&sub_res_info, $2, $4);	  }	;/* User defined resources.  We accept general suboptions in the   file_name case to keep the parser happy.  */user:	  id id suboptions BEG optrcdata_data END	  {	    define_user_data ($1, $2, &$3, $5.first);	  }	| id id suboptions file_name	  {	    define_user_file ($1, $2, &$3, $4);	  }	;/* Versioninfo resources.  */versioninfo:	  id VERSIONINFO fixedverinfo BEG verblocks END	  {	    define_versioninfo ($1, language, $3, $5);	  }	;fixedverinfo:	  /* empty */	  {	    $$ = ((struct fixed_versioninfo *)		  res_alloc (sizeof (struct fixed_versioninfo)));	    memset ($$, 0, sizeof (struct fixed_versioninfo));	  }	| fixedverinfo FILEVERSION numexpr cnumexpr cnumexpr cnumexpr	  {	    $1->file_version_ms = ($3 << 16) | $4;	    $1->file_version_ls = ($5 << 16) | $6;	    $$ = $1;	  }	| fixedverinfo PRODUCTVERSION numexpr cnumexpr cnumexpr cnumexpr	  {	    $1->product_version_ms = ($3 << 16) | $4;	    $1->product_version_ls = ($5 << 16) | $6;	    $$ = $1;	  }	| fixedverinfo FILEFLAGSMASK numexpr	  {	    $1->file_flags_mask = $3;	    $$ = $1;	  }	| fixedverinfo FILEFLAGS numexpr	  {	    $1->file_flags = $3;	    $$ = $1;	  }	| fixedverinfo FILEOS numexpr	  {	    $1->file_os = $3;	    $$ = $1;	  }	| fixedverinfo FILETYPE numexpr	  {	    $1->file_type = $3;	    $$ = $1;	  }	| fixedverinfo FILESUBTYPE numexpr	  {	    $1->file_subtype = $3;	    $$ = $1;	  }	;/* To handle verblocks successfully, the lexer handles BLOCK   specially.  A BLOCK "StringFileInfo" is returned as   BLOCKSTRINGFILEINFO.  A BLOCK "VarFileInfo" is returned as   BLOCKVARFILEINFO.  A BLOCK with some other string returns BLOCK   with the string as the value.  */verblocks:	  /* empty */	  {	    $$ = NULL;	  }	| verblocks BLOCKSTRINGFILEINFO BEG BLOCK BEG vervals END END	  {	    $$ = append_ver_stringfileinfo ($1, $4, $6);	  }	| verblocks BLOCKVARFILEINFO BEG VALUE QUOTEDSTRING vertrans END	  {	    $$ = append_ver_varfileinfo ($1, $5, $6);	  }	;vervals:	  /* empty */	  {	    $$ = NULL;	  }	| vervals VALUE QUOTEDSTRING ',' QUOTEDSTRING	  {	    $$ = append_verval ($1, $3, $5);	  }	;vertrans:	  /* empty */	  {	    $$ = NULL;	  }	| vertrans cnumexpr cnumexpr	  {	    $$ = append_vertrans ($1, $2, $3);	  }	;/* A resource ID.  */id:	  posnumexpr	  {	    $$.named = 0;	    $$.u.id = $1;	  }	| STRING	  {	    char *copy, *s;	    /* It seems that resource ID's are forced to upper case.  */	    copy = xstrdup ($1);	    for (s = copy; *s != '\0'; s++)	      if (islower ((unsigned char) *s))		*s = toupper ((unsigned char) *s);	    res_string_to_id (&$$, copy);	    free (copy);	  }	;/* A resource reference.  */resname:	  QUOTEDSTRING	  {	    $$ = $1;	  }	| QUOTEDSTRING ','	  {	    $$ = $1;	  }	| STRING ','	  {	    $$ = $1;	  }	;resref:	  posnumexpr ','	  {	    $$.named = 0;	    $$.u.id = $1;	  }	| resname	  {	    char *copy, *s;	    /* It seems that resource ID's are forced to upper case.  */	    copy = xstrdup ($1);	    for (s = copy; *s != '\0'; s++)	      if (islower ((unsigned char) *s))	        *s = toupper ((unsigned char) *s);	    res_string_to_id (&$$, copy);	    free (copy);	  }	;/* Generic suboptions.  These may appear before the BEGIN in any   multiline statement.  */suboptions:	  /* empty */	  {	    memset (&$$, 0, sizeof (struct res_res_info));	    $$.language = language;	    /* FIXME: Is this the right default?  */	    $$.memflags = MEMFLAG_MOVEABLE;	  }	| suboptions memflag	  {	    $$ = $1;	    $$.memflags |= $2.on;	    $$.memflags &=~ $2.off;	  }	| suboptions CHARACTERISTICS numexpr	  {	    $$ = $1;	    $$.characteristics = $3;	  }	| suboptions LANGUAGE numexpr cnumexpr	  {	    $$ = $1;	    $$.language = $3 | ($4 << 8);	  }	| suboptions VERSIONK numexpr	  {	    $$ = $1;	    $$.version = $3;	  }	;/* Memory flags which default to MOVEABLE and DISCARDABLE.  */memflags_move_discard:	  /* empty */	  {	    memset (&$$, 0, sizeof (struct res_res_info));	    $$.language = language;	    $$.memflags = MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE;	  }	| memflags_move_discard memflag	  {	    $$ = $1;	    $$.memflags |= $2.on;	    $$.memflags &=~ $2.off;	  }	;/* Memory flags which default to MOVEABLE.  */memflags_move:	  /* empty */	  {	    memset (&$$, 0, sizeof (struct res_res_info));	    $$.language = language;	    $$.memflags = MEMFLAG_MOVEABLE;	  }	| memflags_move memflag	  {	    $$ = $1;	    $$.memflags |= $2.on;	    $$.memflags &=~ $2.off;	  }	;/* Memory flags.  This returns a struct with two integers, because we   sometimes want to set bits and we sometimes want to clear them.  */memflag:	  MOVEABLE	  {	    $$.on = MEMFLAG_MOVEABLE;	    $$.off = 0;	  }	| FIXED	  {	    $$.on = 0;	    $$.off = MEMFLAG_MOVEABLE;	  }	| PURE	  {	    $$.on = MEMFLAG_PURE;	    $$.off = 0;	  }	| IMPURE	  {	    $$.on = 0;	    $$.off = MEMFLAG_PURE;	  }	| PRELOAD	  {	    $$.on = MEMFLAG_PRELOAD;	    $$.off = 0;	  }	| LOADONCALL	  {	    $$.on = 0;	    $$.off = MEMFLAG_PRELOAD;	  }	| DISCARDABLE	  {	    $$.on = MEMFLAG_DISCARDABLE;	    $$.off = 0;	  }	;/* A file name.  */file_name:	  QUOTEDSTRING	  {	    $$ = $1;	  }	| STRING	  {	    $$ = $1;	  }	;/* A style expression.  This changes the static variable STYLE.  We do   it this way because rc appears to permit a style to be set to   something like       WS_GROUP | NOT WS_TABSTOP   to mean that a default of WS_TABSTOP should be removed.  Anything   which wants to accept a style must first set STYLE to the default   value.  The styleexpr nonterminal will change STYLE as specified by   the user.  Note that we do not accept arbitrary expressions here,   just numbers separated by '|'.  */styleexpr:	  parennumber	  {	    style |= $1;	  }	| NOT parennumber	  {	    style &=~ $2;	  }	| styleexpr '|' parennumber	  {	    style |= $3;	  }	| styleexpr '|' NOT parennumber	  {	    style &=~ $4;	  }	;parennumber:	  NUMBER	  {	    $$ = $1.val;	  }	| '(' numexpr ')'	  {	    $$ = $2;	  }	;/* An optional expression with a leading comma.  */optcnumexpr:	  /* empty */	  {	    $$ = 0;	  }	| cnumexpr	  {	    $$ = $1;	  }	;/* An expression with a leading comma.  */cnumexpr:	  ',' numexpr	  {	    $$ = $2;	  }	;/* A possibly negated numeric expression.  */numexpr:	  sizednumexpr	  {	    $$ = $1.val;	  }	;/* A possibly negated expression with a size.  */sizednumexpr:	  NUMBER	  {	    $$ = $1;	  }	| '(' sizednumexpr ')'	  {	    $$ = $2;	  }	| '~' sizednumexpr %prec '~'	  {	    $$.val = ~ $2.val;	    $$.dword = $2.dword;	  }	| '-' sizednumexpr %prec NEG	  {	    $$.val = - $2.val;	    $$.dword = $2.dword;	  }	| sizednumexpr '*' sizednumexpr	  {	    $$.val = $1.val * $3.val;	    $$.dword = $1.dword || $3.dword;	  }	| sizednumexpr '/' sizednumexpr	  {	    $$.val = $1.val / $3.val;	    $$.dword = $1.dword || $3.dword;	  }	| sizednumexpr '%' sizednumexpr	  {	    $$.val = $1.val % $3.val;	    $$.dword = $1.dword || $3.dword;	  }	| sizednumexpr '+' sizednumexpr	  {	    $$.val = $1.val + $3.val;	    $$.dword = $1.dword || $3.dword;	  }	| sizednumexpr '-' sizednumexpr	  {	    $$.val = $1.val - $3.val;	    $$.dword = $1.dword || $3.dword;	  }	| sizednumexpr '&' sizednumexpr	  {	    $$.val = $1.val & $3.val;	    $$.dword = $1.dword || $3.dword;	  }	| sizednumexpr '^' sizednumexpr	  {	    $$.val = $1.val ^ $3.val;	    $$.dword = $1.dword || $3.dword;	  }	| sizednumexpr '|' sizednumexpr	  {	    $$.val = $1.val | $3.val;	    $$.dword = $1.dword || $3.dword;	  }	;/* An expression with a leading comma which does not use unary   negation.  */cposnumexpr:	  ',' posnumexpr	  {	    $$ = $2;	  }	;/* An expression which does not use unary negation.  */posnumexpr:	  sizedposnumexpr	  {	    $$ = $1.val;	  }	;/* An expression which does not use unary negation.  We separate unary   negation to avoid parsing conflicts when two numeric expressions   appear consecutively.  */sizedposnumexpr:	  NUMBER	  {	    $$ = $1;	  }	| '(' sizednumexpr ')'	  {	    $$ = $2;	  }	| '~' sizednumexpr %prec '~'	  {	    $$.val = ~ $2.val;	    $$.dword = $2.dword;	  }	| sizedposnumexpr '*' sizednumexpr	  {	    $$.val = $1.val * $3.val;	    $$.dword = $1.dword || $3.dword;	  }	| sizedposnumexpr '/' sizednumexpr	  {	    $$.val = $1.val / $3.val;	    $$.dword = $1.dword || $3.dword;	  }	| sizedposnumexpr '%' sizednumexpr	  {	    $$.val = $1.val % $3.val;	    $$.dword = $1.dword || $3.dword;	  }	| sizedposnumexpr '+' sizednumexpr	  {	    $$.val = $1.val + $3.val;	    $$.dword = $1.dword || $3.dword;	  }	| sizedposnumexpr '-' sizednumexpr	  {	    $$.val = $1.val - $3.val;	    $$.dword = $1.dword || $3.dword;	  }	| sizedposnumexpr '&' sizednumexpr	  {	    $$.val = $1.val & $3.val;	    $$.dword = $1.dword || $3.dword;	  }	| sizedposnumexpr '^' sizednumexpr	  {	    $$.val = $1.val ^ $3.val;	    $$.dword = $1.dword || $3.dword;	  }	| sizedposnumexpr '|' sizednumexpr	  {	    $$.val = $1.val | $3.val;	    $$.dword = $1.dword || $3.dword;	  }	;%%/* Set the language from the command line.  */voidrcparse_set_language (lang)     int lang;{  language = lang;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -