--- parser3/src/main/pa_dictionary.C 2003/03/20 11:11:55 1.17.2.6.2.3 +++ parser3/src/main/pa_dictionary.C 2003/04/02 12:02:33 1.17.2.6.2.6 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_DICTIONARY_C="$Date: 2003/03/20 11:11:55 $"; +static const char* IDENT_DICTIONARY_C="$Date: 2003/04/02 12:02:33 $"; #include "pa_dictionary.h" #include "pa_exception.h" @@ -15,9 +15,9 @@ void pa_dictionary_add_first(Table::elem // get a=>b values const String* a=row->get(0); // empty 'a' check - if(!*a) { + if(a->is_empty()) { throw Exception("parser.runtime", - a, + 0, //&a, "dictionary table 'from' column elements must not be empty"); } unsigned char c=(unsigned char)a->first_char(); @@ -27,17 +27,19 @@ void pa_dictionary_add_first(Table::elem self->constructor_line++; } Dictionary::Dictionary(Table& atable): table(atable) { + // clear starting_lines + memset(starting_line_of, 0, sizeof(starting_line_of)); // grab first letters of first column of a table constructor_line=1; table.for_each(pa_dictionary_add_first, this); } #ifndef DOXYGEN -struct First_that_starts_info { +struct First_that_begins_info { int line; const char* str; }; #endif -static bool starts(Table::element_type row, First_that_starts_info* info) { +static bool starts(Table::element_type row, First_that_begins_info* info) { // skip irrelevant lines if(info->line>1) { --info->line; @@ -46,8 +48,8 @@ static bool starts(Table::element_type r return row->get(0)->this_starts(info->str); } -Table::element_type Dictionary::first_that_starts(const char* str) const { - First_that_starts_info info; +Table::element_type Dictionary::first_that_begins(const char* str) const { + First_that_begins_info info; if(info.line=starting_line_of[(unsigned char)*str]) { info.str=str; return table.first_that(starts, &info);