The BTYACC %type(s) has been a PITA to maintain. You have to switch
between file places which makes things very sad to maintain.

I propose this syntax change using small sed script (attached with some
examples)

Then each type will be directly set on the rule.

So instead of:

%type <int32Val> first_file_length

...

first_file_length
        :
        ...

we will have:

%%type <int32Val> first_file_length
        :
        ...


Adriano
diff --git a/builds/posix/make.shared.targets b/builds/posix/make.shared.targets
index 4f36c5b..b53bd7a 100644
--- a/builds/posix/make.shared.targets
+++ b/builds/posix/make.shared.targets
@@ -42,7 +42,10 @@
 # This rule creates parse.cpp from parse.y
 
 $(OBJ)/dsql/parse.cpp $(SRC_ROOT)/include/gen/parse.h: $(SRC_ROOT)/dsql/parse.y $(SRC_ROOT)/dsql/btyacc_fb.ske
-	$(BTYACC) -l -d -S $(SRC_ROOT)/dsql/btyacc_fb.ske $<
+	sed -n 's/%%type <\(.*\)> \(.*\)/%type <\1> \2/p' < $< > $(GEN_ROOT)/y.types
+	sed 's/%%type <\(.*\)> \(.*\)/\2/' < $< > $(GEN_ROOT)/y.y
+	sed $(INLINE_EDIT_SED) '/\/*\*\* TYPES \*\*\*\//r $(GEN_ROOT)/y.types' $(GEN_ROOT)/y.y
+	$(BTYACC) -l -d -S $(SRC_ROOT)/dsql/btyacc_fb.ske $(GEN_ROOT)/y.y
 	$(MV) $(GEN_ROOT)/y_tab.c $(OBJ)/dsql/parse.cpp
 	$(MV) $(GEN_ROOT)/y_tab.h $(SRC_ROOT)/include/gen/parse.h
 
diff --git a/src/dsql/parse.y b/src/dsql/parse.y
index 0abb868..444fff9 100644
--- a/src/dsql/parse.y
+++ b/src/dsql/parse.y
@@ -695,7 +695,7 @@ inline void check_copy_incr(char*& to, const char ch, const char* const string)
 	Jrd::dsql_req* dsqlReq;
 }
 
-%type <legacyNode> access_type alias_list
+/*** TYPES ***/
 %type <legacyNode> alter_column_name
 %type <legacyNode> alter_data_type_or_domain
 %type alter_op(<relationNode>) alter_ops(<relationNode>)
@@ -795,7 +795,6 @@ inline void check_copy_incr(char*& to, const char ch, const char* const string)
 %type <stringPtr>  firstname_opt
 %type file_clause(<dbFileClause>) file_desc(<dbFileClause>) file_desc1(<dbFileClause>)
 %type fetch_scroll(<cursorStmtNode>)
-%type <int32Val>   first_file_length
 %type <execStatementNode> for_exec_into
 
 %type <legacyNode> grant_option granted_by granted_by_text grantee grantee_list
@@ -1611,7 +1610,7 @@ conditional
 	| CONDITIONAL		{ $$ = true; }
 	;
 
-first_file_length
+%%type <int32Val> first_file_length
 	: /* nothing */								{ $$ = 0; }
 	| LENGTH equals long_integer page_noise		{ $$ = $3; }
 	;
@@ -4798,7 +4797,7 @@ derived_column_list
 	| '(' alias_list ')'	{ $$ = make_list($2); }
 	;
 
-alias_list
+%%type <legacyNode> alias_list
 	: symbol_item_alias_name
 	| alias_list ',' symbol_item_alias_name		{ $$ = make_node(nod_list, 2, $1, $3); }
 	;
@@ -4993,7 +4992,7 @@ table_or_alias_list
 	| symbol_table_name table_or_alias_list		{ $$ = make_node(nod_list, 2, $1, $2); }
 	;
 
-access_type
+%%type <legacyNode> access_type
 	: NATURAL									{ $$ = make_node(nod_natural, (int) 0, NULL); }
 	| INDEX '(' index_list ')'					{ $$ = make_node(nod_index, 1, make_list($3)); }
 	| ORDER symbol_index_name extra_indices_opt	{ $$ = make_node(nod_index_order, 2, $2, $3); }
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to