From 0ebe71383759c8d05d332834ce29da8dbf28907b Mon Sep 17 00:00:00 2001 From: mahlzeit Date: Mon, 22 Dec 2003 16:52:14 +0000 Subject: [PATCH] Whoops! One of the parser rules was incorrect, making this impossible: resource app_flags B_FOO | B_BAR; Sloppy, because allowing this was the reason for making these changes in the first place ;-) git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5723 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tools/rc/docs/grammar.html | 2 ++ src/tools/rc/parser.y | 4 ++-- src/tools/rc/tests/expr.rdef | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tools/rc/docs/grammar.html b/src/tools/rc/docs/grammar.html index 0d473ea48a..b67c5292d3 100644 --- a/src/tools/rc/docs/grammar.html +++ b/src/tools/rc/docs/grammar.html @@ -283,6 +283,8 @@ resource mytype 123;

The unary minus operator is not part of the "expr" (or "data") rules, but of "integer" and "float". This also causes a shift/reduce warning.

+

And finally, "type" is a member of "data" which is called by "expr". One of the rules of "type" refers back to "expr". This introduces a recursive dependency and a whole bunch of shift/reduce conflicts. Fortunately, it seems to have no bad side effects. Yay!

+

Symbol table

The compiler uses two symbol tables: one for the enum symbols, and one with the data type definitions. We need those tables to find the numeric ID/type definition that corresponds with an identifier, and to make sure that there are no duplicate or missing identifiers. These two symbol tables are independent, so you may use the same identifier both as an enum symbol and a type name.

diff --git a/src/tools/rc/parser.y b/src/tools/rc/parser.y index 5eec2cd328..fc658253db 100644 --- a/src/tools/rc/parser.y +++ b/src/tools/rc/parser.y @@ -100,7 +100,7 @@ static void add_resource(id_t, type_code, data_t); //------------------------------------------------------------------------------ %} -%expect 7 +%expect 15 %union { @@ -398,7 +398,7 @@ type list_t list; list.count = 0; list.items = NULL; $$ = make_type($1, list); } - | IDENT data + | IDENT expr { $$ = make_type($1, make_data_list($2)); } diff --git a/src/tools/rc/tests/expr.rdef b/src/tools/rc/tests/expr.rdef index 589b1d0d7a..618cb29a3d 100644 --- a/src/tools/rc/tests/expr.rdef +++ b/src/tools/rc/tests/expr.rdef @@ -60,3 +60,5 @@ resource(10081) my_int32 my_int32 my_int32; // and so on resource(10100) B_SINGLE_LAUNCH; resource(10101) (int8) B_EXCLUSIVE_LAUNCH; resource(10102) B_MULTIPLE_LAUNCH | B_BACKGROUND_APP | B_ARGV_ONLY; + +//resource app_flags B_MULTIPLE_LAUNCH | B_BACKGROUND_APP;