diff -r 686fa44e3832 -r 871edf12fe64 stage1_2/iec.y --- a/stage1_2/iec.y Tue Apr 05 14:24:07 2011 +0100 +++ b/stage1_2/iec.y Tue Apr 05 17:12:12 2011 +0100 @@ -2,6 +2,7 @@ * matiec - a compiler for the programming languages defined in IEC 61131-3 * * Copyright (C) 2003-2011 Mario de Sousa (msousa@fe.up.pt) + * Copyright (C) 2007-2011 Laurent Bessard and Edouard Tisserant * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -7971,6 +7972,11 @@ FILE *in_file = NULL, *lib_file = NULL; char *libfilename = NULL; + for(int i = 0; standard_function_names[i] != NULL; i++) + if (library_element_symtable.find_value(standard_function_names[i]) == + library_element_symtable.end_value()) + library_element_symtable.insert(standard_function_names[i], standard_function_name_token); + if((in_file = fopen(filename, "r")) == NULL) { char *errmsg = strdup2("Error opening main file ", filename); perror(errmsg); @@ -8023,11 +8029,6 @@ /* if by any chance the library is not complete, we * now add the missing reserved keywords to the list!!! */ - for(int i = 0; standard_function_names[i] != NULL; i++) - if (library_element_symtable.find_value(standard_function_names[i]) == - library_element_symtable.end_value()) - library_element_symtable.insert(standard_function_names[i], standard_function_name_token); - for(int i = 0; standard_function_block_names[i] != NULL; i++) if (library_element_symtable.find_value(standard_function_block_names[i]) == library_element_symtable.end_value())