--- parser3/src/include/pa_dictionary.h 2003/02/14 12:59:10 1.13.2.7 +++ parser3/src/include/pa_dictionary.h 2005/08/09 08:14:49 1.18 @@ -1,14 +1,14 @@ /** @file Parser: dictionary class decl. - Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ #ifndef PA_DICTIONARY_H #define PA_DICTIONARY_H -static const char* IDENT_DICTIONARY_H="$Date: 2003/02/14 12:59:10 $"; +static const char * const IDENT_DICTIONARY_H="$Date: 2005/08/09 08:14:49 $"; #include "pa_table.h" @@ -16,25 +16,30 @@ static const char* IDENT_DICTIONARY_H="$ class Dictionary: public PA_Object { public: - /// construct wrapper, grabbing first letters of first column into @b first - Dictionary(TablePtr atable, double amin_ratio=1); + struct Subst { + const char *from; size_t from_length; + const String* to; + + Subst(int): from(0) {} + Subst(const char* afrom, const String* ato): from(afrom), to(ato) { + from_length=strlen(afrom); + } + operator bool() { return from!=0; } + }; - /// get max ratio - double max_ratio() { return fmax_ratio; } + /// construct wrapper, grabbing first letters of first column into @b first + Dictionary(Table& atable); /// find first row that contains string in first column which starts @b src - Table::element_type first_that_starts(const char* src, size_t src_size=0) const; - - /// where this table came from, may be NULL. proxy to Table - StringPtr origin_string() { return table->origin_string(); } + Subst first_that_begins(const char* str) const; private: - TablePtr table; - double fmax_ratio; + Array substs; private: friend void pa_dictionary_add_first(Table::element_type row, Dictionary* self); + //friend bool starts(FromTo row, First_that_begins_info* info); int starting_line_of[0x100]; int constructor_line; };