// Copyright (c) 1994 James Clark // See the file COPYING for copying permission. #ifndef TrieBuilder_INCLUDED #define TrieBuilder_INCLUDED 1 #ifdef __GNUG__ #pragma interface #endif #include "types.h" #include "StringOf.h" #include "Owner.h" #include "Trie.h" #include "Vector.h" #ifdef SP_NAMESPACE namespace SP_NAMESPACE { #endif class TrieBuilder { public: typedef Vector TokenVector; TrieBuilder(int nCodes); void recognize(const String &chars, Token t, Priority::Type pri, TokenVector &ambiguities); void recognize(const String &chars, const String &set, Token t, Priority::Type pri, TokenVector &ambiguities); // recognize a delimiter with a blank sequence void recognizeB(const String &chars, int bSequenceLength, // >= 1 size_t maxBlankSequenceLength, const String &blankCodes, const String &chars2, Token t, TokenVector &ambiguities); void recognizeEE(EquivCode code, Token t); Trie *extractTrie() { return root_.extract(); } private: TrieBuilder(const TrieBuilder &); // undefined void operator=(const TrieBuilder &); // undefined void doB(Trie *trie, int tokenLength, int minBLength, size_t maxLength, const String &blankCodes, const String &chars2, Token token, Priority::Type pri, TokenVector &ambiguities); Trie *extendTrie(Trie *, const String &); void setToken(Trie *trie, int tokenLength, Token token, Priority::Type pri, TokenVector &ambiguities); Trie *forceNext(Trie *trie, EquivCode); void copyInto(Trie *, const Trie *, int); int nCodes_; Owner root_; }; #ifdef SP_NAMESPACE } #endif #endif /* not TrieBuilder_INCLUDED */