8484#include "expparse.h"
8585#include "expscan.h"
8686#include "parse_data.h"
87+ #include "express/lexact.h"
8788
8889void * ParseAlloc ( void * ( * mallocProc )( size_t ) );
8990void ParseFree ( void * parser , void ( * freeProc )( void * ) );
@@ -609,6 +610,9 @@ void EXPRESSparse( Express model, FILE * fp, char * filename ) {
609610 PARSERrun ( filename , model -> u .express -> file = fp );
610611}
611612
613+ /* TODO LEMON ought to put this in expparse.h */
614+ void parserInitState ();
615+
612616/** start parsing a new schema file */
613617static Express PARSERrun ( char * filename , FILE * fp ) {
614618 extern void SCAN_lex_init PROTO ( ( char * , FILE * ) );
@@ -633,7 +637,8 @@ static Express PARSERrun( char * filename, FILE * fp ) {
633637 parserInitState ();
634638
635639 yyerrstatus = 0 ;
636- // ParseTrace( stderr, "- expparse - " ); //NOTE uncomment this to enable parser tracing
640+ /* NOTE uncomment the next line to enable parser tracing */
641+ /* ParseTrace( stderr, "- expparse - " ); */
637642 while ( ( tokenID = yylex ( scanner ) ) > 0 ) {
638643 Parse ( parser , tokenID , yylval , parseData );
639644 }
@@ -660,8 +665,10 @@ static void RENAMEresolve( Rename * r, Schema s );
660665 * find the final object to which a rename points
661666 * i.e., follow chain of USEs or REFs
662667 * sets DICT_type
668+ *
669+ * Sept 2013 - remove unused param enum rename_type type (TODO should this be used)?
663670 */
664- static Generic SCOPEfind_for_rename ( Scope schema , char * name , enum rename_type type ) {
671+ static Generic SCOPEfind_for_rename ( Scope schema , char * name ) {
665672 Generic result ;
666673 Rename * rename ;
667674
@@ -674,13 +681,13 @@ static Generic SCOPEfind_for_rename( Scope schema, char * name, enum rename_type
674681 }
675682
676683 /* Occurs in a fully USE'd schema? */
677- LISTdo ( schema -> u .schema -> use_schemas , schema , Schema )
678- /* follow chain'd USEs */
679- result = SCOPEfind_for_rename ( schema , name , use );
680- if ( result ) {
681- return ( result );
682- }
683- LISTod ;
684+ LISTdo ( schema -> u .schema -> use_schemas , use_schema , Schema ) {
685+ /* follow chain'd USEs */
686+ result = SCOPEfind_for_rename ( use_schema , name );
687+ if ( result ) {
688+ return ( result );
689+ }
690+ } LISTod ;
684691
685692 /* Occurs in a partially USE'd schema? */
686693 rename = ( Rename * )DICTlookup ( schema -> u .schema -> usedict , name );
@@ -725,7 +732,7 @@ static void RENAMEresolve( Rename * r, Schema s ) {
725732 }
726733 resolve_in_progress_raw ( r -> old );
727734
728- remote = SCOPEfind_for_rename ( r -> schema , r -> old -> name , r -> rename_type );
735+ remote = SCOPEfind_for_rename ( r -> schema , r -> old -> name );
729736 if ( remote == 0 ) {
730737 ERRORreport_with_symbol ( ERROR_ref_nonexistent , r -> old ,
731738 r -> old -> name , r -> schema -> symbol .name );
@@ -891,24 +898,24 @@ void EXPRESSresolve( Express model ) {
891898 /* add news schemas to end, drop old ones off the front as we */
892899 /* process them. */
893900
894- LISTdo ( PARSEnew_schemas , schema , Schema )
895- if ( print_objects_while_running & OBJ_SCHEMA_BITS ) {
896- fprintf ( stdout , "pass %d: %s (schema)\n" ,
897- EXPRESSpass , schema -> symbol .name );
898- }
901+ LISTdo ( PARSEnew_schemas , print_schema , Schema ) {
902+ if ( print_objects_while_running & OBJ_SCHEMA_BITS ) {
903+ fprintf ( stdout , "pass %d: %s (schema)\n" ,
904+ EXPRESSpass , print_schema -> symbol .name );
905+ }
899906
900- if ( schema -> u .schema -> uselist )
901- connect_lists ( model -> symbol_table ,
902- schema , schema -> u .schema -> uselist );
903- if ( schema -> u .schema -> reflist )
904- connect_lists ( model -> symbol_table ,
905- schema , schema -> u .schema -> reflist );
906-
907- connect_schema_lists ( model -> symbol_table ,
908- schema , schema -> u .schema -> use_schemas );
909- connect_schema_lists ( model -> symbol_table ,
910- schema , schema -> u .schema -> ref_schemas );
911- LISTod ;
907+ if ( print_schema -> u .schema -> uselist )
908+ connect_lists ( model -> symbol_table ,
909+ print_schema , print_schema -> u .schema -> uselist );
910+ if ( print_schema -> u .schema -> reflist )
911+ connect_lists ( model -> symbol_table ,
912+ print_schema , print_schema -> u .schema -> reflist );
913+
914+ connect_schema_lists ( model -> symbol_table ,
915+ print_schema , print_schema -> u .schema -> use_schemas );
916+ connect_schema_lists ( model -> symbol_table ,
917+ print_schema , print_schema -> u .schema -> ref_schemas );
918+ } LISTod ;
912919
913920 LISTfree ( PARSEnew_schemas );
914921 PARSEnew_schemas = 0 ; /* just in case */
0 commit comments