Uil.y 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404
  1. /*
  2. * @OSF_COPYRIGHT@
  3. * COPYRIGHT NOTICE
  4. * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
  5. * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
  6. * the full copyright text.
  7. */
  8. /*
  9. * HISTORY
  10. */
  11. /* "$TOG: Uil.y /main/11 1998/01/23 15:05:38 mgreess $" */
  12. /*
  13. * (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
  14. /*
  15. **++
  16. ** FACILITY:
  17. **
  18. ** DECwindows Toolkit User Interface Language Compiler (UIL)
  19. **
  20. ** ABSTRACT:
  21. **
  22. ** YACC Grammar for UIL
  23. **--
  24. **/
  25. %{
  26. /* Begin user declarations section */
  27. #include "UilDefI.h"
  28. #include "UilCompGl.h"
  29. #define YYSTYPE yystype
  30. #define YYDEBUG 1
  31. /* Declare and initialize stack entry for epsilon productions. */
  32. YYSTYPE gz_yynullval = {NULL,0,0,0,0};
  33. /* Declare token to aid in saving source context */
  34. YYSTYPE prev_yylval;
  35. /* End user declarations section */
  36. %}
  37. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  38. * token name token value token class *
  39. * ---------- ----------- ----------- *
  40. *----------------------------------------------------------------------------*
  41. */
  42. /*
  43. ** terminals of the language
  44. **
  45. ** NOTE: the tags which appear in comments at the end of each token
  46. ** definition name the token class for the token. These name the
  47. ** the .dat file processed by WML while constructing token tables.
  48. ** Thus the output of WML and these tags must match, e.g. for
  49. ** the token tag 'special' the file 'special.dat' must exist.
  50. */
  51. /* end of file indicator */
  52. %token UILEOF 0 /* unused */
  53. /* names */
  54. %token NAME 1 /* identifier */
  55. %token FONT_NAME 2 /* font */
  56. %token COLOR_NAME 3 /* color */
  57. %token ARGUMENT_NAME 4 /* argument */
  58. %token REASON_NAME 5 /* reason */
  59. %token CHARSET_NAME 6 /* charset */
  60. %token ENUMVAL_NAME 7 /* enumval */
  61. %token CLASS_NAME 8 /* class */
  62. %token CHILD_NAME 96 /* child */
  63. /* Literals */
  64. %token UNS_FLOAT_LITERAL 9 /* literal */
  65. %token COMP_STRING 10 /* literal */
  66. %token CHAR_8_LITERAL 11 /* literal */
  67. %token UNS_INT_LITERAL 12 /* literal */
  68. /* Special characters. Treat these as tokens rather than literals, so
  69. * that we can assign token numbers to them rather than have YACC use
  70. * the ASCII value as the token number.
  71. */
  72. %token LEFT_PAREN 13 /* special */
  73. %token RIGHT_PAREN 14 /* special */
  74. %token COLON 15 /* special */
  75. %token SEMICOLON 16 /* special */
  76. %token LEFT_BRACE 17 /* special */
  77. %token RIGHT_BRACE 18 /* special */
  78. %token COMMA 19 /* special */
  79. %token EQUAL_SIGN 20 /* special */
  80. %token NOT 21 /* special */
  81. %token PLUS 22 /* special */
  82. %token MINUS 23 /* special */
  83. %token AND 24 /* special */
  84. %token OR 25 /* special */
  85. %token XOR 26 /* special */
  86. %token MULTIPLY 27 /* special */
  87. %token DIVIDE 28 /* special */
  88. %token LEFT_SHIFT 29 /* special */
  89. %token RIGHT_SHIFT 30 /* special */
  90. /* Reserved words */
  91. %token LIST 31 /* reserved */
  92. %token IDENTIFIER 32 /* reserved */
  93. %token END 33 /* reserved */
  94. %token MODULE 34 /* reserved */
  95. %token UILTRUE 35 /* reserved */
  96. %token UILFALSE 36 /* reserved */
  97. %token INCLUDE 37 /* reserved */
  98. %token MACRO 38 /* reserved */
  99. %token ON 39 /* reserved */
  100. %token OFF 40 /* reserved */
  101. %token VALUE 41 /* reserved */
  102. %token ARGUMENTS 42 /* reserved */
  103. %token CALLBACKS 43 /* reserved */
  104. %token PROCEDURES 44 /* reserved */
  105. %token CONTROLS 45 /* reserved */
  106. %token PROCEDURE 46 /* reserved */
  107. %token OBJECT 47 /* reserved */
  108. /* Declaratives */
  109. %token OBJECTS 48 /* keyword */
  110. %token WIDGET 49 /* reserved */
  111. %token GADGET 50 /* reserved */
  112. %token FONT 51 /* keyword */
  113. %token ARGUMENT 52 /* keyword */
  114. %token REASON 53 /* keyword */
  115. %token PIXMAP 54 /* keyword */
  116. %token COLOR 55 /* keyword */
  117. %token NAMES 56 /* keyword */
  118. %token CHARACTER_SET 57 /* keyword */
  119. %token CASE_SENSITIVE 58 /* keyword */
  120. %token CASE_INSENSITIVE 59 /* keyword */
  121. %token VERSION 60 /* keyword */
  122. %token MANAGED 61 /* keyword */
  123. %token UNMANAGED 62 /* keyword */
  124. %token PRIVATE 63 /* reserved */
  125. %token IMPORTED 64 /* keyword */
  126. %token EXPORTED 65 /* reserved */
  127. %token UILFILE 66 /* keyword */
  128. %token STRING_TABLE 67 /* keyword */
  129. %token TRANSLATION_TABLE 68 /* keyword */
  130. %token COMPOUND_STRING 69 /* keyword */
  131. %token FONT_TABLE 70 /* keyword */
  132. %token ANY 71 /* keyword */
  133. %token STRING 72 /* keyword */
  134. %token BOOLEAN 73 /* keyword */
  135. %token ICON 74 /* keyword */
  136. %token RIGHT_TO_LEFT 75 /* keyword */
  137. %token BACKGROUND 76 /* keyword */
  138. %token FOREGROUND 77 /* keyword */
  139. %token COLOR_TABLE 78 /* keyword */
  140. %token FLOAT 79 /* keyword */
  141. %token INTEGER 80 /* keyword */
  142. %token CLASS_REC_NAME 81 /* keyword */
  143. %token ASCIZ_TABLE 82 /* keyword */
  144. %token INTEGER_TABLE 83 /* keyword */
  145. %token ASCIZ_STRING_TABLE 84 /* keyword */
  146. %token COMPOUND_STRING_TABLE 85 /* keyword */
  147. %token XBITMAPFILE 86 /* keyword */
  148. %token SEPARATE 87 /* keyword */
  149. %token SIXTEEN_BIT 88 /* keyword */
  150. %token POUND 89 /* special */
  151. %token KEYSYM 90 /* keyword */
  152. %token SINGLE_FLOAT 91 /* keyword */
  153. %token RGB 92 /* keyword */
  154. %token WIDE_CHARACTER 93 /* keyword */
  155. %token LOC_STRING 94 /* literal */ /* New for 1.2 */
  156. %token FONTSET 95 /* keyword */
  157. %token COMPOUND_STRING_COMPONENT 97 /* keyword */
  158. %token PIX 115
  159. %token PIXEL 103
  160. %token PIXELS 104
  161. %token IN 98
  162. %token INCH 105
  163. %token INCHES 106
  164. %token CM 99
  165. %token CENTIMETER 107
  166. %token CENTIMETERS 108
  167. %token MM 100
  168. %token MILLIMETER 109
  169. %token MILLIMETERS 110
  170. %token PT 101
  171. %token POINT 111
  172. %token POINTS 112
  173. %token FU 102
  174. %token FONT_UNIT 113
  175. %token FONT_UNITS 114
  176. %start module_block
  177. %%
  178. /*
  179. ** productions of the grammar
  180. */
  181. /* module structure */
  182. module_block
  183. : module_header
  184. { sar_save_module_source (); }
  185. module_declaration_list END MODULE SEMICOLON
  186. ;
  187. module_header
  188. : /* empty */ { sar_create_root ( &$$ ); }
  189. MODULE id { sar_create_module( &$$, &$3, &$2 ); }
  190. opt_module_clauses
  191. ;
  192. opt_module_clauses
  193. : /* empty */
  194. | module_clauses
  195. ;
  196. module_clauses
  197. : module_clause
  198. | module_clauses module_clause
  199. ;
  200. module_clause
  201. : VERSION EQUAL_SIGN character_8_value { sar_process_module_version( &$3 , &$1 ); }
  202. | NAMES EQUAL_SIGN sensitivity_value { sar_process_module_sensitivity( &$3 , &$1 ); }
  203. | CHARACTER_SET EQUAL_SIGN valid_charset { sar_process_module_charset( &$3 , &$1 ); }
  204. | OBJECTS { sar_make_def_obj (&$1); } EQUAL_SIGN variant_spec
  205. ;
  206. sensitivity_value
  207. : CASE_SENSITIVE
  208. | CASE_INSENSITIVE
  209. ;
  210. variant_spec
  211. : LEFT_BRACE RIGHT_BRACE
  212. | LEFT_BRACE variant_list RIGHT_BRACE
  213. | error { lex_issue_error (RIGHT_BRACE); } RIGHT_BRACE
  214. ;
  215. variant_list
  216. : variant_clause SEMICOLON
  217. | variant_list variant_clause SEMICOLON
  218. | error { lex_issue_error (SEMICOLON); } SEMICOLON
  219. ;
  220. variant_clause
  221. : CLASS_NAME { sar_make_def_obj (&$1); }
  222. EQUAL_SIGN variant { sar_process_module_variant (&$1, &$4); $$ = gz_yynullval; }
  223. ;
  224. variant
  225. : WIDGET { $$ = gz_yynullval; $$.b_type = sym_k_widget_entry; }
  226. | GADGET { $$ = gz_yynullval; $$.b_type = sym_k_gadget_entry; }
  227. ;
  228. module_declaration_list
  229. : /* empty */
  230. | module_declaration_list module_declaration
  231. ;
  232. module_declaration
  233. : value_declaration
  234. | identifier_declaration
  235. | procedure_declaration
  236. | object_declaration
  237. | list_declaration
  238. | include_directive
  239. ;
  240. /* VALUE declaration */
  241. value_declaration
  242. : VALUE { $$ = $1; sar_save_section_source (&$1, sym_k_value_section); } value_declaration_list
  243. ;
  244. value_declaration_list
  245. : value_decl
  246. | value_declaration_list value_decl
  247. | error { lex_issue_error (SEMICOLON); } SEMICOLON
  248. ;
  249. value_decl
  250. : id COLON value_definition SEMICOLON { sar_bind_value_name( &$1, &$3, &$4 ); }
  251. ;
  252. value_definition
  253. : EXPORTED private_value { $$ = $2; $$.b_flags |= sym_m_exported; $$.b_flags &= ~sym_m_private; }
  254. | PRIVATE private_value_plus { $$ = $2; $$.b_flags |= sym_m_private; $$.b_flags &= ~sym_m_exported; }
  255. | private_value_plus { $$ = $1; $$.b_flags |= sym_m_private; $$.b_flags &= ~sym_m_exported; }
  256. | IMPORTED value_type { sar_import_value_entry( &$$, &$2 ); }
  257. ;
  258. value_type
  259. : INTEGER { $$ = $1; $$.b_type = sym_k_integer_value; }
  260. | STRING { $$ = $1; $$.b_type = sym_k_char_8_value; }
  261. | PIXMAP { $$ = $1; $$.b_type = sym_k_pixmap_value; }
  262. | FLOAT { $$ = $1; $$.b_type = sym_k_float_value; }
  263. | BOOLEAN { $$ = $1; $$.b_type = sym_k_bool_value; }
  264. | FONT { $$ = $1; $$.b_type = sym_k_font_value; }
  265. | REASON { $$ = $1; $$.b_type = sym_k_reason_value; }
  266. | ARGUMENT { $$ = $1; $$.b_type = sym_k_argument_value; }
  267. | COLOR { $$ = $1; $$.b_type = sym_k_color_value; }
  268. | string_table_type { $$ = $1; $$.b_type = sym_k_string_table_value; }
  269. | asciz_table_type { $$ = $1; $$.b_type = sym_k_asciz_table_value; }
  270. | INTEGER_TABLE { $$ = $1; $$.b_type = sym_k_integer_table_value; }
  271. | TRANSLATION_TABLE { $$ = $1; $$.b_type = sym_k_trans_table_value; }
  272. | FONT_TABLE { $$ = $1; $$.b_type = sym_k_font_table_value; }
  273. | ICON { $$ = $1; $$.b_type = sym_k_icon_value; }
  274. | COMPOUND_STRING { $$ = $1; $$.b_type = sym_k_compound_string_value; }
  275. | COMPOUND_STRING_COMPONENT { $$ = $1; $$.b_type = sym_k_compound_string_value; }
  276. | CLASS_REC_NAME { $$ = $1; $$.b_type = sym_k_class_rec_name_value; }
  277. | XBITMAPFILE { $$ = $1; $$.b_type = sym_k_xbitmapfile_value; }
  278. | KEYSYM { $$ = $1; $$.b_type = sym_k_keysym_value; }
  279. | SINGLE_FLOAT { $$ = $1; $$.b_type = sym_k_single_float_value; }
  280. | RGB { $$ = $1; $$.b_type = sym_k_rgb_value; }
  281. | WIDE_CHARACTER { $$ = $1; $$.b_type = sym_k_wchar_string_value; }
  282. | FONTSET { $$ = $1; $$.b_type = sym_k_fontset_value; }
  283. | WIDGET { $$ = $1; $$.b_type = sym_k_widget_ref_value; }
  284. ;
  285. /* Seperately defined for fixing CR 5888 */
  286. arg_value_type
  287. : INTEGER { $$ = $1; $$.b_type = sym_k_integer_value; }
  288. | STRING { $$ = $1; $$.b_type = sym_k_char_8_value; }
  289. | PIXMAP { $$ = $1; $$.b_type = sym_k_pixmap_value; }
  290. | FLOAT { $$ = $1; $$.b_type = sym_k_float_value; }
  291. | BOOLEAN { $$ = $1; $$.b_type = sym_k_bool_value; }
  292. | FONT { $$ = $1; $$.b_type = sym_k_font_value; }
  293. | REASON { $$ = $1; $$.b_type = sym_k_reason_value; }
  294. | COLOR { $$ = $1; $$.b_type = sym_k_color_value; }
  295. | string_table_type { $$ = $1; $$.b_type = sym_k_string_table_value; }
  296. | asciz_table_type { $$ = $1; $$.b_type = sym_k_asciz_table_value; }
  297. | INTEGER_TABLE { $$ = $1; $$.b_type = sym_k_integer_table_value; }
  298. | TRANSLATION_TABLE { $$ = $1; $$.b_type = sym_k_trans_table_value; }
  299. | FONT_TABLE { $$ = $1; $$.b_type = sym_k_font_table_value; }
  300. | ICON { $$ = $1; $$.b_type = sym_k_icon_value; }
  301. | COMPOUND_STRING { $$ = $1; $$.b_type = sym_k_compound_string_value; }
  302. | KEYSYM { $$ = $1; $$.b_type = sym_k_keysym_value; }
  303. | SINGLE_FLOAT { $$ = $1; $$.b_type = sym_k_single_float_value; }
  304. | WIDE_CHARACTER { $$ = $1; $$.b_type = sym_k_wchar_string_value; }
  305. | FONTSET { $$ = $1; $$.b_type = sym_k_fontset_value; }
  306. | WIDGET { $$ = $1; $$.b_type = sym_k_widget_ref_value; }
  307. /* End for fixing CR 5888 */
  308. string_table_type
  309. : STRING_TABLE
  310. | COMPOUND_STRING_TABLE
  311. ;
  312. asciz_table_type
  313. : ASCIZ_TABLE
  314. | ASCIZ_STRING_TABLE
  315. ;
  316. /* PROCEDURE declaration */
  317. procedure_declaration
  318. : PROCEDURE { $$ = $1; sar_save_section_source (&$1, sym_k_procedure_section); } procedure_declaration_list
  319. ;
  320. procedure_declaration_list
  321. : procedure_decl
  322. | procedure_declaration_list procedure_decl
  323. | error { lex_issue_error (SEMICOLON); } SEMICOLON
  324. ;
  325. procedure_decl
  326. : id opt_formal_parameters opt_class SEMICOLON { sar_create_procedure( &$1, &$2, &$3, &$4 );}
  327. ;
  328. opt_formal_parameters
  329. : /* empty */ { $$ = gz_yynullval; }
  330. | LEFT_PAREN formal_parameter_type RIGHT_PAREN { $$ = $2; }
  331. ;
  332. formal_parameter_type
  333. : /* empty */ { $$ = gz_yynullval; $$.b_type = sym_k_no_value; }
  334. | value_type
  335. | ANY { $$ = $1; $$.b_type =
  336. sym_k_any_value; }
  337. | CLASS_NAME
  338. { YYSTYPE temp[2];
  339. temp[0] = gz_yynullval;
  340. sar_create_object(&temp[0], sym_k_widget_entry);
  341. temp[1] = $1; sar_set_object_class(&temp[1]);
  342. sar_verify_object(&temp[1]);
  343. $$ = temp[0];
  344. }
  345. ;
  346. opt_class
  347. : /* empty */ { $$.b_flags = sym_m_private; }
  348. /*
  349. | EXPORTED { $$.b_flags = sym_m_exported; }
  350. | PRIVATE { $$.b_flags = sym_m_private; }
  351. | IMPORTED { $$.b_flags = sym_m_imported; }
  352. */
  353. ;
  354. /* IDENTIFIER declaration */
  355. identifier_declaration
  356. : IDENTIFIER { $$ = $1; sar_save_section_source (&$1, sym_k_identifier_section); } identifier_declaration_list
  357. ;
  358. identifier_declaration_list
  359. : identifier_decl
  360. | identifier_declaration_list identifier_decl
  361. | error { lex_issue_error (SEMICOLON); } SEMICOLON
  362. ;
  363. identifier_decl
  364. : id SEMICOLON { sar_create_identifier ( &$1, &$2 ); }
  365. ;
  366. /* Directives. */
  367. /* Include Directive */
  368. include_directive
  369. : INCLUDE UILFILE character_8_value SEMICOLON { sar_include_file (&$3, &$1, &$4); }
  370. | error { lex_issue_error (SEMICOLON); } SEMICOLON
  371. ;
  372. /* OBJECT declaration */
  373. object_declaration
  374. : OBJECT { $$ = $1; sar_save_section_source (&$1, sym_k_object_section); } object_decl_list
  375. ;
  376. object_decl_list
  377. : object_decl SEMICOLON { $$ = $1; sar_save_src_semicolon_pos (&$2 ); }
  378. | object_decl_list object_decl SEMICOLON { $$ = $1; sar_save_src_semicolon_pos (&$3 ); }
  379. | error { lex_issue_error (SEMICOLON); } SEMICOLON
  380. ;
  381. object_decl
  382. : id
  383. { sar_create_object (&$1, sym_k_widget_entry);
  384. sar_link_section (&$1); $$ = gz_yynullval;}
  385. COLON object_definition
  386. { $$ = gz_yynullval; }
  387. ;
  388. object_definition
  389. : EXPORTED
  390. { sar_set_object_flags (&$1, sym_m_exported); }
  391. object_specification
  392. | PRIVATE
  393. { sar_set_object_flags (&$1, sym_m_private); }
  394. object_specification
  395. | epsilon_production
  396. { sar_set_object_flags (&$1, sym_m_exported); }
  397. object_specification
  398. | IMPORTED
  399. { sar_set_object_flags (&$1, sym_m_imported); }
  400. CLASS_NAME
  401. { sar_set_object_class (&$3); }
  402. /*
  403. * Fix for CR 5440 - Call opt_create_proc_ref to check for creation procedures
  404. * for imported user_defined widgets.
  405. */
  406. opt_create_proc_ref
  407. /*
  408. * End fix for CR 5440
  409. */
  410. epsilon_production
  411. { sar_verify_object (&$1); }
  412. ;
  413. control_object_definition
  414. : EXPORTED
  415. { sar_set_object_flags (&$1, sym_m_exported); }
  416. object_specification
  417. | PRIVATE
  418. { sar_set_object_flags (&$1, sym_m_private); }
  419. object_specification
  420. | MANAGED
  421. { sar_set_object_flags (& $1, (sym_m_managed | sym_m_exported)); }
  422. object_specification
  423. | UNMANAGED
  424. { sar_unset_object_flags (& $1, sym_m_managed), sar_set_object_flags (& $1, sym_m_exported); }
  425. object_specification
  426. | epsilon_production
  427. { sar_set_object_flags (&$1, sym_m_exported); }
  428. object_specification
  429. | IMPORTED
  430. { sar_set_object_flags (&$1, sym_m_imported); }
  431. CLASS_NAME
  432. { sar_set_object_class (&$3); }
  433. epsilon_production
  434. { sar_verify_object (&$1); }
  435. ;
  436. object_specification
  437. : CLASS_NAME
  438. { sar_set_object_class (&$1); }
  439. opt_create_proc_ref
  440. opt_variant
  441. object_spec
  442. { sar_verify_object (&$1); }
  443. ;
  444. opt_variant
  445. : epsilon_production
  446. { sar_set_object_variant (&$1); }
  447. | variant
  448. { sar_set_object_variant (&$1); }
  449. ;
  450. control_object_specification
  451. : CLASS_NAME
  452. { sar_set_object_class (&$1); $$ = gz_yynullval;}
  453. opt_create_proc_ref
  454. opt_variant
  455. control_object_spec
  456. { sar_verify_object (&$1); }
  457. ;
  458. opt_create_proc_ref
  459. : epsilon_production
  460. | PROCEDURE id_ref opt_parens
  461. { sar_process_proc_ref (&$2, &gz_yynullval, sym_k_object_proc);
  462. sar_save_user_proc_ref_src ( &$1, &$2, &$3 ); }
  463. ;
  464. opt_parens
  465. : epsilon_production
  466. | LEFT_PAREN RIGHT_PAREN { $$ = $2; }
  467. ;
  468. /* object specification. */
  469. object_spec
  470. : id_ref
  471. { sar_object_reference (&$1); }
  472. | LEFT_BRACE RIGHT_BRACE
  473. | LEFT_BRACE object_feature_list RIGHT_BRACE
  474. | error { lex_issue_error (RIGHT_BRACE); } RIGHT_BRACE
  475. ;
  476. control_object_spec
  477. : id_ref
  478. { sar_object_reference (&$1); }
  479. | LEFT_BRACE RIGHT_BRACE
  480. epsilon_production
  481. { sar_set_object_flags (&$1, sym_m_exported); }
  482. | LEFT_BRACE object_feature_list RIGHT_BRACE
  483. epsilon_production
  484. { sar_set_object_flags (&$1, sym_m_exported); }
  485. | error { lex_issue_error (RIGHT_BRACE); } RIGHT_BRACE
  486. ;
  487. child_object_spec
  488. : LEFT_BRACE RIGHT_BRACE
  489. epsilon_production
  490. { sar_set_object_flags (&$1, sym_m_private); }
  491. | LEFT_BRACE object_feature_list RIGHT_BRACE
  492. epsilon_production
  493. { sar_set_object_flags (&$1, sym_m_private); }
  494. | error { lex_issue_error (RIGHT_BRACE); } RIGHT_BRACE
  495. ;
  496. object_feature_list
  497. : object_feature
  498. | object_feature_list object_feature
  499. ;
  500. object_feature
  501. : argument_list_def SEMICOLON
  502. { sar_save_list_end ( &$2); sar_save_feature (&$1); $$ = gz_yynullval; }
  503. | callback_list_def SEMICOLON
  504. { sar_save_list_end ( &$2); sar_save_feature (&$1); $$ = gz_yynullval; }
  505. | control_list_def SEMICOLON
  506. { sar_save_list_end ( &$2); sar_save_feature (&$1);
  507. sar_update_parent_list (&$1); $$ = gz_yynullval; }
  508. | error { lex_issue_error (SEMICOLON); } SEMICOLON
  509. ;
  510. epsilon_production
  511. : /* empty */
  512. { $$ = gz_yynullval; }
  513. ;
  514. /* LIST declaration */
  515. list_declaration
  516. : LIST { $$ = $1; sar_save_section_source (&$1, sym_k_list_section); }
  517. list_decl_list
  518. ;
  519. list_decl_list
  520. : list_decl SEMICOLON { $$ = $1; sar_save_src_semicolon_pos (&$2 ); }
  521. | list_decl_list list_decl SEMICOLON { $$ = $1; sar_save_src_semicolon_pos (&$3 ); }
  522. | error { lex_issue_error (SEMICOLON); } SEMICOLON
  523. ;
  524. list_decl
  525. : id
  526. { sar_create_object (&$1, sym_k_list_entry);
  527. sar_link_section (&$1); $$ = gz_yynullval;}
  528. COLON list_specification
  529. { $$ = gz_yynullval; }
  530. ;
  531. list_specification
  532. : control_list_specification
  533. | argument_list_specification
  534. | callback_list_specification
  535. | procedure_list_specification
  536. ;
  537. control_list_specification
  538. : control_list_type
  539. { $$ = gz_yynullval; sar_set_list_type (&$1); }
  540. control_list_spec
  541. { sar_verify_object (&$1); }
  542. ;
  543. argument_list_specification
  544. : argument_list_type
  545. { $$ = gz_yynullval; sar_set_list_type (&$1); }
  546. argument_list_spec
  547. { sar_verify_object (&$1); }
  548. ;
  549. callback_list_specification
  550. : callback_list_type
  551. { $$ = gz_yynullval; sar_set_list_type (&$1); }
  552. callback_list_spec
  553. { sar_verify_object (&$1); }
  554. ;
  555. procedure_list_specification
  556. : procedure_list_type
  557. { $$ = gz_yynullval; sar_set_list_type (&$1); }
  558. procedure_list_spec
  559. { sar_verify_object (&$1); }
  560. ;
  561. argument_list_type
  562. : ARGUMENTS
  563. { $$ = gz_yynullval; $$.b_type = sym_k_argument_list; }
  564. ;
  565. callback_list_type
  566. : CALLBACKS
  567. { $$ = gz_yynullval; $$.b_type = sym_k_callback_list; }
  568. ;
  569. procedure_list_type
  570. : PROCEDURES
  571. { $$ = gz_yynullval; $$.b_type = sym_k_proc_ref_list; }
  572. ;
  573. control_list_type
  574. : CONTROLS
  575. { $$ = gz_yynullval; $$.b_type = sym_k_control_list; }
  576. ;
  577. argument_list_spec
  578. : id_ref { sar_object_reference (&$1); }
  579. | LEFT_BRACE RIGHT_BRACE
  580. | LEFT_BRACE argument_list_clause_list RIGHT_BRACE
  581. | error { lex_issue_error (RIGHT_BRACE); } RIGHT_BRACE
  582. ;
  583. callback_list_spec
  584. : id_ref { sar_object_reference (&$1); }
  585. | LEFT_BRACE RIGHT_BRACE
  586. | LEFT_BRACE callback_list_clause_list RIGHT_BRACE
  587. | error { lex_issue_error (RIGHT_BRACE); } RIGHT_BRACE
  588. ;
  589. procedure_list_spec
  590. : id_ref
  591. { sar_object_reference (&$1); }
  592. | LEFT_BRACE RIGHT_BRACE
  593. | LEFT_BRACE procedure_list_clause_list RIGHT_BRACE
  594. | error { lex_issue_error (RIGHT_BRACE); } RIGHT_BRACE
  595. ;
  596. control_list_spec
  597. : id_ref { sar_object_reference (&$1); }
  598. | LEFT_BRACE RIGHT_BRACE
  599. | LEFT_BRACE control_list_clause_list RIGHT_BRACE
  600. | error { lex_issue_error (RIGHT_BRACE); } RIGHT_BRACE
  601. ;
  602. argument_list_clause_list
  603. : argument_list_clause
  604. | argument_list_clause_list argument_list_clause
  605. ;
  606. callback_list_clause_list
  607. : callback_list_clause
  608. | callback_list_clause_list callback_list_clause
  609. ;
  610. procedure_list_clause_list
  611. : procedure_list_clause
  612. | procedure_list_clause_list procedure_list_clause
  613. ;
  614. control_list_clause_list
  615. : control_list_clause
  616. | control_list_clause_list control_list_clause
  617. ;
  618. argument_list_clause
  619. : argument_list_def SEMICOLON
  620. { sar_save_src_entry_end (&$2, &$1); sar_add_list_entry (&$1); $$ = gz_yynullval; }
  621. | argument_list_item SEMICOLON
  622. { sar_save_src_entry_end (&$2, &$1); sar_add_list_entry (&$1); $$ = gz_yynullval; }
  623. | error { lex_issue_error (SEMICOLON); } SEMICOLON
  624. ;
  625. callback_list_clause
  626. : callback_list_def SEMICOLON
  627. { sar_save_src_entry_end (&$2, &$1); sar_add_list_entry (&$1); $$ = gz_yynullval; }
  628. | callback_list_item SEMICOLON
  629. { sar_save_src_entry_end (&$2, &$1); sar_add_list_entry (&$1); $$ = gz_yynullval; }
  630. | error { lex_issue_error (SEMICOLON); } SEMICOLON
  631. ;
  632. procedure_list_clause
  633. : procedure_list_def SEMICOLON
  634. { sar_save_src_entry_end (&$2, &$1); sar_add_list_entry (&$1); $$ = gz_yynullval; }
  635. | procedure_list_def_ref SEMICOLON
  636. { sar_save_src_entry_end (&$2, &$1); sar_add_list_entry (&$1); $$ = gz_yynullval; }
  637. | error { lex_issue_error (SEMICOLON); } SEMICOLON
  638. ;
  639. control_list_clause
  640. : control_list_def SEMICOLON
  641. { sar_save_src_entry_end (&$2, &$1); sar_add_list_entry (&$1); $$ = gz_yynullval; }
  642. | control_list_item SEMICOLON
  643. { sar_save_src_entry_end (&$2, &$1); sar_add_list_entry (&$1); $$ = gz_yynullval; }
  644. | error { lex_issue_error (SEMICOLON); } SEMICOLON
  645. ;
  646. control_list_def
  647. : epsilon_production
  648. { $$ = gz_yynullval; sar_create_object (&$1, sym_k_list_entry); }
  649. control_list_specification
  650. { $$ = $1; }
  651. ;
  652. argument_list_def
  653. : epsilon_production
  654. { $$ = gz_yynullval; sar_create_object (&$1, sym_k_list_entry); }
  655. argument_list_specification
  656. { $$ = $1; }
  657. ;
  658. callback_list_def
  659. : epsilon_production
  660. { $$ = gz_yynullval; sar_create_object (&$1, sym_k_list_entry); }
  661. callback_list_specification
  662. { $$ = $1; }
  663. ;
  664. procedure_list_def
  665. : epsilon_production
  666. { $$ = gz_yynullval; sar_create_object (&$1, sym_k_list_entry); }
  667. procedure_list_specification
  668. { $$ = $1; }
  669. ;
  670. control_list_item
  671. /* Control item */
  672. : opt_managed control_item
  673. { sar_save_control_item (&$1, &$2); $$ = $1; }
  674. | id
  675. { sar_create_object (& $1, sym_k_widget_entry); $1.b_flags = sym_m_managed; $$ = gz_yynullval;}
  676. COLON
  677. control_object_definition
  678. { sar_save_control_widget (& $1, & $2); $$ = $1; }
  679. /* Child */
  680. | CHILD_NAME opt_child_managed
  681. { sar_create_child (& $1); $1.b_flags = sym_m_managed;
  682. $$ = gz_yynullval; }
  683. child_object_spec
  684. { sar_save_control_widget (& $1, & $2); $$ = $1; }
  685. | CHILD_NAME UNMANAGED
  686. { sar_create_child (& $1); $$ = gz_yynullval; }
  687. child_object_spec
  688. { sar_save_control_widget (& $1, & $3); $$ = $1; }
  689. ;
  690. opt_child_managed
  691. : epsilon_production
  692. | MANAGED
  693. ;
  694. argument_list_item
  695. /* Argument value pair */
  696. : value EQUAL_SIGN value
  697. { sar_save_argument_pair (&$1, &$3, &$2); $$ = $1; }
  698. /* Argument widget pair */
  699. | value EQUAL_SIGN CLASS_NAME id_ref
  700. { YYSTYPE temp [2];
  701. temp [0] = gz_yynullval;
  702. sar_create_object (&temp [0], sym_k_widget_entry);
  703. temp [1] = $3; sar_set_object_class (&temp [1]);
  704. temp [1] = $4; sar_object_reference (&temp [1]);
  705. sar_verify_object (&temp [1]);
  706. sar_save_argument_pair (&$1, &temp [0], &$2); $$ = $1; }
  707. ;
  708. callback_list_item
  709. /* Callback reason binding */
  710. : value EQUAL_SIGN procedure_reference
  711. { sar_save_reason_binding (&$1, &$3, &$2); $$ = $1; }
  712. | value EQUAL_SIGN procedure_list_def
  713. { sar_save_reason_binding (&$1, &$3, &$2); $$ = $1; }
  714. ;
  715. control_item
  716. : epsilon_production
  717. { sar_create_object (&$1, sym_k_widget_entry); $$ = gz_yynullval; }
  718. control_object_specification
  719. { $$ = $1; }
  720. ;
  721. opt_managed
  722. : epsilon_production
  723. { $$.b_flags = sym_m_managed; }
  724. | MANAGED
  725. { $$ = gz_yynullval; $$.b_flags = sym_m_managed; }
  726. | UNMANAGED
  727. { $$ = gz_yynullval; }
  728. ;
  729. procedure_reference
  730. : PROCEDURE id_ref opt_procedure_argument
  731. { sar_process_proc_ref (&$2, &$3, sym_k_callback_proc); $$ = $2; }
  732. ;
  733. procedure_list_def_ref
  734. : id_ref opt_procedure_argument
  735. { sar_process_proc_ref (&$1, &$2, sym_k_callback_proc); $$ = $1; }
  736. ;
  737. opt_procedure_argument
  738. : epsilon_production
  739. | LEFT_PAREN value RIGHT_PAREN
  740. { $$ = $2; }
  741. | LEFT_PAREN CLASS_NAME id_ref RIGHT_PAREN
  742. { YYSTYPE temp [2];
  743. temp [0] = gz_yynullval;
  744. sar_create_object (&temp [0], sym_k_widget_entry);
  745. temp [1] = $2; sar_set_object_class (&temp [1]);
  746. temp [1] = $3; sar_object_reference (&temp [1]);
  747. sar_verify_object (&temp [1]);
  748. $$ = temp [0]; }
  749. | LEFT_PAREN RIGHT_PAREN
  750. { $$ = gz_yynullval; }
  751. ;
  752. /* definition of an id */
  753. id
  754. : NAME
  755. | FONT_NAME
  756. | COLOR_NAME
  757. | ARGUMENT_NAME
  758. | REASON_NAME
  759. | ENUMVAL_NAME
  760. | CHILD_NAME
  761. | keyword { sar_map_keyword_to_name( &$$, &$1); }
  762. ;
  763. /* reference of an id */
  764. id_ref
  765. : id
  766. { sar_process_id_ref (&$1); $$ = $1; }
  767. ;
  768. keyword
  769. : STRING
  770. | BOOLEAN
  771. | FLOAT
  772. | INTEGER
  773. | FONT
  774. | ARGUMENT
  775. | REASON
  776. | PIXMAP
  777. | COLOR
  778. | NAMES
  779. | CASE_SENSITIVE
  780. | CASE_INSENSITIVE
  781. | VERSION
  782. | MANAGED
  783. | UNMANAGED
  784. | UILFILE
  785. | string_table_type
  786. | asciz_table_type
  787. | INTEGER_TABLE
  788. | TRANSLATION_TABLE
  789. | COMPOUND_STRING
  790. | COMPOUND_STRING_COMPONENT
  791. | CLASS_REC_NAME
  792. | FONT_TABLE
  793. | RIGHT_TO_LEFT
  794. | CHARACTER_SET
  795. | COLOR_TABLE
  796. | ICON
  797. | BACKGROUND
  798. | FOREGROUND
  799. | XBITMAPFILE
  800. | SEPARATE
  801. | ANY
  802. | IMPORTED
  803. | OBJECTS
  804. | KEYSYM
  805. | SINGLE_FLOAT
  806. | RGB
  807. | WIDE_CHARACTER
  808. | FONTSET
  809. ;
  810. /* values */
  811. character_8_value : value
  812. {
  813. $$ = $1;
  814. if (($$.b_type != sym_k_error_value) &&
  815. ($$.b_type != sym_k_any_value) &&
  816. (($$.b_flags &sym_m_forward_ref) == 0))
  817. {
  818. if (($$.b_type != sym_k_char_8_value) &&
  819. ($$.b_type != sym_k_localized_string_value))
  820. sar_value_type_error( &$$, sym_k_char_8_value );
  821. if (($$.b_flags &sym_m_private) == 0)
  822. sar_private_error( &$$ );
  823. }
  824. }
  825. ;
  826. private_value
  827. : value { $$ = $1;
  828. if ($$.b_type != sym_k_error_value)
  829. {
  830. if ((($$.b_flags &sym_m_private) == 0) &&
  831. (($$.b_flags &sym_m_forward_ref) == 0))
  832. sar_private_error( &$$ );
  833. }
  834. }
  835. ;
  836. /* BEGIN HaL fix CR 5427 */
  837. private_value_plus
  838. : non_export_value { $$ = $1;
  839. if ($$.b_type != sym_k_error_value)
  840. {
  841. if ((($$.b_flags &sym_m_private) == 0) &&
  842. (($$.b_flags &sym_m_forward_ref) == 0))
  843. sar_private_error( &$$ );
  844. }
  845. }
  846. ;
  847. | value { $$ = $1;
  848. if ($$.b_type != sym_k_error_value)
  849. {
  850. if ((($$.b_flags &sym_m_private) == 0) &&
  851. (($$.b_flags &sym_m_forward_ref) == 0))
  852. sar_private_error( &$$ );
  853. }
  854. }
  855. non_export_value
  856. : COLOR_TABLE LEFT_PAREN color_list RIGHT_PAREN { sar_make_color_table( &$$, &$3, &$1); }
  857. /* END HaL fix CR 5427 */
  858. value
  859. : value_1
  860. | value OR value_1 { $$ = $2; sar_binary_op( &$$, &$1, &$3 ); }
  861. | value XOR value_1 { $$ = $2; sar_binary_op( &$$, &$1, &$3 ); }
  862. ;
  863. value_1
  864. : value_2
  865. | value_1 AND value_2 { $$ = $2; sar_binary_op( &$$, &$1, &$3 ); }
  866. ;
  867. value_2
  868. : value_3
  869. | value_2 LEFT_SHIFT value_3 { $$ = $2; sar_binary_op( &$$, &$1, &$3 ); }
  870. | value_2 RIGHT_SHIFT value_3 { $$ = $2; sar_binary_op( &$$, &$1, &$3 ); }
  871. ;
  872. value_3
  873. : value_4
  874. | value_3 PLUS value_4 { $$ = $2; sar_binary_op( &$$, &$1, &$3 ); }
  875. | value_3 MINUS value_4 { $$ = $2; sar_binary_op( &$$, &$1, &$3 ); }
  876. ;
  877. value_4
  878. : value_5
  879. | value_4 MULTIPLY value_5 { $$ = $2; sar_binary_op( &$$, &$1, &$3 ); }
  880. | value_4 DIVIDE value_5 { $$ = $2; sar_binary_op( &$$, &$1, &$3 ); }
  881. ;
  882. value_5
  883. : value_6
  884. | MINUS value_5 { $$ = $1; sar_unary_op( &$$, &$2 ); }
  885. | NOT value_5 { $$ = $1; sar_unary_op( &$$, &$2 ); }
  886. | PLUS value_5 { $$ = $1; sar_unary_op( &$$, &$2 ); }
  887. ;
  888. value_6
  889. : operand
  890. | LEFT_PAREN value RIGHT_PAREN { $$ = $2; }
  891. ;
  892. operand
  893. : UNS_INT_LITERAL { sar_make_private_value( &$$, &$1, sym_k_integer_value,
  894. &$1, XmPIXELS); }
  895. | UNS_INT_LITERAL units_specification { sar_make_private_value( &$$, &$1, sym_k_integer_value,
  896. &$1, sar_get_units_type(&$2)); }
  897. | optional_charset CHAR_8_LITERAL { /* Don't use FALSE because it is a token not a Boolean! */
  898. Uil_lex_l_charset_specified = 0;
  899. sar_make_private_value( &$$, &$2, sym_k_char_8_value,
  900. &$2, 0); }
  901. | id { sar_process_id( &$$, &$1 );}
  902. | UNS_FLOAT_LITERAL { sar_make_private_value( &$$, &$1, sym_k_float_value,
  903. &$1, XmPIXELS); }
  904. | UNS_FLOAT_LITERAL units_specification { sar_make_private_value( &$$, &$1, sym_k_float_value,
  905. &$1, sar_get_units_type(&$2)); }
  906. | PIXMAP LEFT_PAREN character_8_value RIGHT_PAREN { sar_value_not_implemented( &$$, &$1, "pixmap literal" ); }
  907. | FONT LEFT_PAREN font_spec RIGHT_PAREN { $$ = $3; }
  908. | FONTSET LEFT_PAREN fontset_spec RIGHT_PAREN { $$ = $3; }
  909. | COLOR LEFT_PAREN color_spec RIGHT_PAREN { $$ = $3; }
  910. | REASON LEFT_PAREN character_8_value RIGHT_PAREN { sar_make_private_value(&$$, &$3, sym_k_reason_value,
  911. &$1, 0); }
  912. | CLASS_REC_NAME LEFT_PAREN character_8_value RIGHT_PAREN { sar_make_private_value(&$$, &$3, sym_k_class_rec_name_value,
  913. &$1, 0); }
  914. | ARGUMENT LEFT_PAREN character_8_value opt_arg_type RIGHT_PAREN
  915. { sar_make_private_value
  916. ( &$$, &$3, sym_k_argument_value, &$1, $4.b_type ); }
  917. | UILTRUE { sar_make_private_value( &$$, &$1, sym_k_bool_value,
  918. &$1, 0); }
  919. | UILFALSE { sar_make_private_value( &$$, &$1, sym_k_bool_value,
  920. &$1, 0); }
  921. | ON { sar_make_private_value( &$$, &$1, sym_k_bool_value,
  922. &$1, 0); }
  923. | OFF { sar_make_private_value( &$$, &$1, sym_k_bool_value,
  924. &$1, 0); }
  925. | optional_charset COMP_STRING { /* Don't use FALSE because it is a token not a Boolean! */
  926. Uil_lex_l_charset_specified = 0;
  927. sar_make_private_value
  928. ( &$$, &$2, sym_k_compound_string_value, &$2, 0); }
  929. | string_table_type LEFT_PAREN comp_str_list RIGHT_PAREN { sar_make_private_value( &$$, &$3, sym_k_string_table_value,
  930. &$1, 0); }
  931. | asciz_table_type LEFT_PAREN asciz_list RIGHT_PAREN { sar_make_private_value( &$$, &$3, sym_k_asciz_table_value,
  932. &$1, 0); }
  933. | INTEGER_TABLE LEFT_PAREN integer_list RIGHT_PAREN { sar_make_private_value( &$$, &$3, sym_k_integer_table_value,
  934. &$1, 0); }
  935. | TRANSLATION_TABLE LEFT_PAREN string_list RIGHT_PAREN { sar_make_private_value( &$$, &$3, sym_k_trans_table_value,
  936. &$1, 0); }
  937. | COMPOUND_STRING LEFT_PAREN comp_str_result RIGHT_PAREN { $$ = $3; }
  938. | COMPOUND_STRING_COMPONENT LEFT_PAREN comp_str_comp_result RIGHT_PAREN { $$ = $3; }
  939. | FONT_TABLE LEFT_PAREN font_list RIGHT_PAREN { $$ = $3; }
  940. | ICON LEFT_PAREN icon_spec RIGHT_PAREN { $$ = $3; }
  941. | FLOAT LEFT_PAREN value RIGHT_PAREN { $$ = $1; sar_unary_op( &$$, &$3 ); }
  942. | INTEGER LEFT_PAREN value RIGHT_PAREN { $$ = $1; sar_unary_op( &$$, &$3 ); }
  943. | XBITMAPFILE LEFT_PAREN character_8_value RIGHT_PAREN { sar_make_private_value(&$$, &$3, sym_k_xbitmapfile_value,
  944. &$1, 0); }
  945. | KEYSYM LEFT_PAREN character_8_value RIGHT_PAREN { sar_make_private_value(&$$, &$3, sym_k_keysym_value,
  946. &$1, 0); }
  947. | SINGLE_FLOAT LEFT_PAREN value RIGHT_PAREN { $$ = $1; sar_unary_op( &$$, &$3 ); }
  948. | RGB LEFT_PAREN rgb_list RIGHT_PAREN { sar_make_private_value( & $$, & $3, sym_k_rgb_value,
  949. &$1, 0); }
  950. | WIDE_CHARACTER LEFT_PAREN wchar_str_result RIGHT_PAREN { $$ = $3; }
  951. | LOC_STRING { sar_make_private_value(&$$, &$1, sym_k_localized_string_value,
  952. &$1, 0); }
  953. ;
  954. string_list
  955. : /* empty */
  956. { $$ = gz_yynullval; }
  957. | string_list_2
  958. { $$ = $1; }
  959. ;
  960. string_list_2
  961. : private_value
  962. { sar_append_table_value (&$1, &gz_yynullval, sym_k_trans_table_value, &$1); $$ = $1; }
  963. | string_list_2 COMMA private_value
  964. { sar_append_table_value (&$3, &$1, sym_k_trans_table_value, &$2); $$ = $3; }
  965. ;
  966. asciz_list
  967. : /* empty */
  968. { $$ = gz_yynullval; }
  969. | asciz_list_2
  970. { $$ = $1; }
  971. ;
  972. asciz_list_2
  973. : private_value
  974. { sar_append_table_value (&$1, &gz_yynullval, sym_k_asciz_table_value, &$1); $$ = $1; }
  975. | asciz_list_2 COMMA private_value
  976. { sar_append_table_value (&$3, &$1, sym_k_asciz_table_value, &$2); $$ = $3; }
  977. ;
  978. integer_list
  979. : /* empty */
  980. { $$ = gz_yynullval; }
  981. | integer_list_2
  982. { $$ = $1; }
  983. ;
  984. integer_list_2
  985. : private_value
  986. { sar_append_table_value (&$1, &gz_yynullval, sym_k_integer_table_value, &$1); $$ = $1; }
  987. | integer_list_2 COMMA private_value
  988. { sar_append_table_value (&$3, &$1, sym_k_integer_table_value, &$2); $$ = $3; }
  989. ;
  990. /* RAP rgb data type */
  991. rgb_list
  992. : private_value COMMA private_value COMMA private_value
  993. {sar_append_table_value(&$1, & gz_yynullval, sym_k_integer_table_value, & $1);
  994. sar_append_table_value(& $3, & $1, sym_k_integer_table_value, & $2);
  995. sar_append_table_value(& $5, & $3, sym_k_integer_table_value, & $4);
  996. $$ = $5;}
  997. ;
  998. comp_str_list
  999. : /* empty */
  1000. { $$ = gz_yynullval; }
  1001. | comp_str_list_2
  1002. { $$ = $1; }
  1003. ;
  1004. comp_str_list_2
  1005. : private_value
  1006. { sar_append_table_value (&$1, &gz_yynullval, sym_k_string_table_value, &$1); $$ = $1; }
  1007. | comp_str_list_2 COMMA private_value
  1008. { sar_append_table_value (&$3, &$1, sym_k_string_table_value, &$2); $$ = $3; }
  1009. ;
  1010. opt_arg_type
  1011. : /* empty */ { $$ = gz_yynullval; $$.b_type = sym_k_any_value; }
  1012. | COMMA arg_value_type { $$ = gz_yynullval; $$.b_type = $2.b_type; }
  1013. | COMMA ANY { $$ = gz_yynullval; $$.b_type = sym_k_any_value; }
  1014. ;
  1015. comp_str_result
  1016. : private_value { sar_make_comp_str( &$$, &$1, &gz_yynullval, &$-1 ); }
  1017. | private_value comp_str_attrs { sar_make_comp_str( &$$, &$1, &$2, &$-1 ); }
  1018. ;
  1019. comp_str_comp_result
  1020. : ENUMVAL_NAME { sar_make_comp_str_comp(&$$, &$1, &gz_yynullval, &$-1 ); }
  1021. | ENUMVAL_NAME COMMA ENUMVAL_NAME { sar_make_comp_str_comp( &$$, &$1, &$3, &$-1 ); }
  1022. | ENUMVAL_NAME COMMA CHAR_8_LITERAL { sar_make_comp_str_comp( &$$, &$1, &$3, &$-1 ); }
  1023. | ENUMVAL_NAME COMMA LOC_STRING { sar_make_comp_str_comp( &$$, &$1, &$3, &$-1 ); }
  1024. | ENUMVAL_NAME COMMA CHARSET_NAME { sar_make_comp_str_comp( &$$, &$1, &$3, &$-1 ); }
  1025. ;
  1026. comp_str_attrs
  1027. : COMMA comp_str_attr { sar_chk_comp_str_attr( &$$, &$2, &gz_yynullval ); }
  1028. | comp_str_attrs COMMA comp_str_attr { sar_chk_comp_str_attr( &$$, &$3, &$1 ); }
  1029. ;
  1030. comp_str_attr
  1031. : CHARACTER_SET EQUAL_SIGN valid_charset { $$.b_type = $1.b_type;
  1032. $$.b_tag = $3.b_tag;
  1033. $$.value.az_keyword_entry = $3.value.az_keyword_entry;
  1034. $$.value.az_symbol_entry = $3.value.az_symbol_entry; }
  1035. | RIGHT_TO_LEFT EQUAL_SIGN private_value { $$.b_type = $1.b_type;
  1036. $$.value.az_symbol_entry = $3.value.az_symbol_entry; }
  1037. | SEPARATE EQUAL_SIGN private_value { $$.b_type = $1.b_type;
  1038. $$.value.az_symbol_entry = $3.value.az_symbol_entry; }
  1039. ;
  1040. wchar_str_result
  1041. : private_value { sar_make_wchar_str( &$$, &$1, &gz_yynullval, &$-1 ); }
  1042. ;
  1043. font_spec
  1044. : character_8_value COMMA CHARACTER_SET EQUAL_SIGN valid_charset
  1045. { sar_make_font( &$$, &$5, &$1, &$-1 ); }
  1046. | character_8_value { sar_make_font( &$$, &gz_yynullval, &$1, &$-1 ); }
  1047. ;
  1048. fontset_spec
  1049. : character_8_value COMMA CHARACTER_SET EQUAL_SIGN valid_charset
  1050. { sar_make_fontset( &$$, &$5, &$1, &$-1 ); }
  1051. | character_8_value { sar_make_fontset( &$$, &gz_yynullval, &$1, &$-1 ); }
  1052. ;
  1053. font_list
  1054. : font_item { sar_make_font_table( &$$, &$1, &gz_yynullval, &$-1 ); }
  1055. | font_list COMMA font_item { sar_make_font_table( &$$, &$3, &$1, &$-1 ); }
  1056. ;
  1057. /*
  1058. ** THIS PRODUCTION DOESN'T LOOK RIGHT!!!!!!!!!!!!!!!!!!!!!!
  1059. */
  1060. font_item
  1061. : valid_charset EQUAL_SIGN private_value { sar_make_font_item( &$$, &$1, &$3 ); }
  1062. | private_value { sar_make_font_item( &$$, &gz_yynullval, &$1 ); }
  1063. ;
  1064. optional_charset
  1065. : POUND valid_charset { /* Don't use TRUE because it is a token not a Boolean! */
  1066. $$ = $2;
  1067. Uil_lex_l_charset_specified = 1;}
  1068. | epsilon_production
  1069. ;
  1070. valid_charset
  1071. : CHARSET_NAME { sar_charset_verify (&$1); $$ = $1; }
  1072. | CHARACTER_SET LEFT_PAREN charset_info RIGHT_PAREN { $$ = $3; }
  1073. | NAME { sar_make_fallback_charset(&$1);
  1074. $$ = $1; }
  1075. ;
  1076. charset_info
  1077. : character_8_value { sar_make_private_value(&$$, &$1, sym_k_char_8_value,
  1078. &$1, 0);
  1079. sar_make_charset (&$$, &$$, &gz_yynullval, &$1); }
  1080. | character_8_value charset_attrs { sar_make_private_value(&$$, &$1, sym_k_char_8_value,
  1081. &$1, 0);
  1082. sar_make_charset (&$$, &$$, &$2, &$1); }
  1083. ;
  1084. charset_attrs
  1085. : COMMA charset_attr { sar_chk_charset_attr( &$$, &$2, &gz_yynullval ); }
  1086. | charset_attrs COMMA charset_attr { sar_chk_charset_attr( &$$, &$3, &$1 ); }
  1087. ;
  1088. charset_attr
  1089. : RIGHT_TO_LEFT EQUAL_SIGN private_value { $$.b_type = $1.b_type;
  1090. if ($3.b_type != sym_k_bool_value)
  1091. sar_value_type_error( &$3, sym_k_bool_value );
  1092. $$.value.az_symbol_entry = $3.value.az_symbol_entry; }
  1093. | SIXTEEN_BIT EQUAL_SIGN private_value { $$.b_type = $1.b_type;
  1094. if ($3.b_type != sym_k_bool_value)
  1095. sar_value_type_error( &$3, sym_k_bool_value );
  1096. $$.value.az_symbol_entry = $3.value.az_symbol_entry; }
  1097. ;
  1098. color_list
  1099. : color_item { sar_append_color_item( &$$, &$1, &gz_yynullval ); }
  1100. | color_list COMMA color_item { sar_append_color_item( &$$, &$3, &$1 ); }
  1101. ;
  1102. color_item
  1103. : BACKGROUND COLOR EQUAL_SIGN character_8_value { sar_make_color_item( &$$, &$1, &$4 ); }
  1104. | FOREGROUND COLOR EQUAL_SIGN character_8_value { sar_make_color_item( &$$, &$1, &$4 ); }
  1105. | value EQUAL_SIGN character_8_value { sar_make_color_item( &$$, &$1, &$3 ); }
  1106. ;
  1107. color_spec
  1108. : character_8_value { sar_make_color( &$$, &$1, &gz_yynullval, &$-1 ); }
  1109. | character_8_value COMMA mono_color_spec { sar_make_color( &$$, &$1, &$3, &$-1 ); }
  1110. ;
  1111. mono_color_spec
  1112. : BACKGROUND
  1113. | FOREGROUND
  1114. ;
  1115. icon_spec
  1116. : icon_rows { sar_make_icon( &$$, &$1, &gz_yynullval, &$-1); }
  1117. | COLOR_TABLE EQUAL_SIGN private_value COMMA icon_rows
  1118. { sar_make_icon( &$$, &$5, &$3, &$-1 ); }
  1119. ;
  1120. icon_rows
  1121. : private_value
  1122. { sar_append_table_value (&$1, &gz_yynullval, sym_k_icon_value, &$1); $$ = $1; }
  1123. | icon_rows COMMA private_value
  1124. { sar_append_table_value (&$3, &$1, sym_k_icon_value, &$2); $$ = $3; }
  1125. ;
  1126. units_specification
  1127. : PIX
  1128. { $$ = $1; }
  1129. | PIXEL
  1130. { $$ = $1; }
  1131. | PIXELS
  1132. { $$ = $1; }
  1133. | IN
  1134. { $$ = $1; }
  1135. | INCH
  1136. { $$ = $1; }
  1137. | INCHES
  1138. { $$ = $1; }
  1139. | CM
  1140. { $$ = $1; }
  1141. | CENTIMETER
  1142. { $$ = $1; }
  1143. | CENTIMETERS
  1144. { $$ = $1; }
  1145. | MM
  1146. { $$ = $1; }
  1147. | MILLIMETER
  1148. { $$ = $1; }
  1149. | MILLIMETERS
  1150. { $$ = $1; }
  1151. | PT
  1152. { $$ = $1; }
  1153. | POINT
  1154. { $$ = $1; }
  1155. | POINTS
  1156. { $$ = $1; }
  1157. | FU
  1158. { $$ = $1; }
  1159. | FONT_UNIT
  1160. { $$ = $1; }
  1161. | FONT_UNITS
  1162. { $$ = $1; }
  1163. ;
  1164. %%
  1165. /* Dummy error routine for the parser. We will output our own
  1166. error messages. */
  1167. int yyerror (s)
  1168. char * s;
  1169. {
  1170. return 0;
  1171. }