diff options
author | neksard <neksard@yandex-team.ru> | 2022-02-10 16:45:33 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:33 +0300 |
commit | 1d9c550e7c38e051d7961f576013a482003a70d9 (patch) | |
tree | b2cc84ee7850122e7ccf51d0ea21e4fa7e7a5685 /contrib/libs/icu/common/rbbitblb.h | |
parent | 8f7cf138264e0caa318144bf8a2c950e0b0a8593 (diff) | |
download | ydb-1d9c550e7c38e051d7961f576013a482003a70d9.tar.gz |
Restoring authorship annotation for <neksard@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/icu/common/rbbitblb.h')
-rw-r--r-- | contrib/libs/icu/common/rbbitblb.h | 242 |
1 files changed, 121 insertions, 121 deletions
diff --git a/contrib/libs/icu/common/rbbitblb.h b/contrib/libs/icu/common/rbbitblb.h index b0eea8e053..c2b574fe1b 100644 --- a/contrib/libs/icu/common/rbbitblb.h +++ b/contrib/libs/icu/common/rbbitblb.h @@ -1,54 +1,54 @@ // © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -// -// rbbitblb.h -// - -/* -********************************************************************** -* Copyright (c) 2002-2016, International Business Machines -* Corporation and others. All Rights Reserved. -********************************************************************** -*/ - -#ifndef RBBITBLB_H -#define RBBITBLB_H - -#include "unicode/utypes.h" +// License & terms of use: http://www.unicode.org/copyright.html +// +// rbbitblb.h +// + +/* +********************************************************************** +* Copyright (c) 2002-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ + +#ifndef RBBITBLB_H +#define RBBITBLB_H + +#include "unicode/utypes.h" #if !UCONFIG_NO_BREAK_ITERATION -#include "unicode/uobject.h" -#include "unicode/rbbi.h" +#include "unicode/uobject.h" +#include "unicode/rbbi.h" #include "rbbirb.h" -#include "rbbinode.h" - - -U_NAMESPACE_BEGIN - -class RBBIRuleScanner; -class RBBIRuleBuilder; +#include "rbbinode.h" + + +U_NAMESPACE_BEGIN + +class RBBIRuleScanner; +class RBBIRuleBuilder; class UVector32; - -// -// class RBBITableBuilder is part of the RBBI rule compiler. -// It builds the state transition table used by the RBBI runtime -// from the expression syntax tree generated by the rule scanner. -// -// This class is part of the RBBI implementation only. -// There is no user-visible public API here. -// - -class RBBITableBuilder : public UMemory { -public: + +// +// class RBBITableBuilder is part of the RBBI rule compiler. +// It builds the state transition table used by the RBBI runtime +// from the expression syntax tree generated by the rule scanner. +// +// This class is part of the RBBI implementation only. +// There is no user-visible public API here. +// + +class RBBITableBuilder : public UMemory { +public: RBBITableBuilder(RBBIRuleBuilder *rb, RBBINode **rootNode, UErrorCode &status); - ~RBBITableBuilder(); - + ~RBBITableBuilder(); + void buildForwardTable(); - + /** Return the runtime size in bytes of the built state table. */ int32_t getTableSize() const; - + /** Fill in the runtime state table. Sufficient memory must exist at the specified location. */ void exportTable(void *where); @@ -86,28 +86,28 @@ public: void exportSafeTable(void *where); -private: - void calcNullable(RBBINode *n); - void calcFirstPos(RBBINode *n); - void calcLastPos(RBBINode *n); - void calcFollowPos(RBBINode *n); +private: + void calcNullable(RBBINode *n); + void calcFirstPos(RBBINode *n); + void calcLastPos(RBBINode *n); + void calcFollowPos(RBBINode *n); void calcChainedFollowPos(RBBINode *n, RBBINode *endMarkNode); - void bofFixup(); - void buildStateTable(); + void bofFixup(); + void buildStateTable(); void mapLookAheadRules(); - void flagAcceptingStates(); - void flagLookAheadStates(); - void flagTaggedStates(); - void mergeRuleStatusVals(); - + void flagAcceptingStates(); + void flagLookAheadStates(); + void flagTaggedStates(); + void mergeRuleStatusVals(); + /** * Merge redundant state table columns, eliminating character classes with identical behavior. * Done after the state tables are generated, just before converting to their run-time format. */ int32_t mergeColumns(); - void addRuleRootNodes(UVector *dest, RBBINode *node); - + void addRuleRootNodes(UVector *dest, RBBINode *node); + /** * Find duplicate (redundant) states, beginning at the specified pair, * within this state table. This is an iterator-like function, used to @@ -139,82 +139,82 @@ private: */ void removeSafeState(IntPair duplStates); - // Set functions for UVector. - // TODO: make a USet subclass of UVector - - void setAdd(UVector *dest, UVector *source); - UBool setEquals(UVector *a, UVector *b); - - void sortedAdd(UVector **dest, int32_t val); - -public: -#ifdef RBBI_DEBUG - void printSet(UVector *s); - void printPosSets(RBBINode *n /* = NULL*/); - void printStates(); - void printRuleStatusTable(); + // Set functions for UVector. + // TODO: make a USet subclass of UVector + + void setAdd(UVector *dest, UVector *source); + UBool setEquals(UVector *a, UVector *b); + + void sortedAdd(UVector **dest, int32_t val); + +public: +#ifdef RBBI_DEBUG + void printSet(UVector *s); + void printPosSets(RBBINode *n /* = NULL*/); + void printStates(); + void printRuleStatusTable(); void printReverseTable(); -#else - #define printSet(s) - #define printPosSets(n) - #define printStates() - #define printRuleStatusTable() +#else + #define printSet(s) + #define printPosSets(n) + #define printStates() + #define printRuleStatusTable() #define printReverseTable() -#endif - -private: - RBBIRuleBuilder *fRB; - RBBINode *&fTree; // The root node of the parse tree to build a - // table for. - UErrorCode *fStatus; - +#endif + +private: + RBBIRuleBuilder *fRB; + RBBINode *&fTree; // The root node of the parse tree to build a + // table for. + UErrorCode *fStatus; + /** State Descriptors, UVector<RBBIStateDescriptor> */ - UVector *fDStates; // D states (Aho's terminology) - // Index is state number - // Contents are RBBIStateDescriptor pointers. - + UVector *fDStates; // D states (Aho's terminology) + // Index is state number + // Contents are RBBIStateDescriptor pointers. + /** Synthesized safe table, UVector of UnicodeString, one string per table row. */ UVector *fSafeTable; - + /** Map from rule number (fVal in look ahead nodes) to sequential lookahead index. */ UVector32 *fLookAheadRuleMap = nullptr; - RBBITableBuilder(const RBBITableBuilder &other); // forbid copying of this class - RBBITableBuilder &operator=(const RBBITableBuilder &other); // forbid copying of this class -}; - -// -// RBBIStateDescriptor - The DFA is constructed as a set of these descriptors, -// one for each state. -class RBBIStateDescriptor : public UMemory { -public: - UBool fMarked; - int32_t fAccepting; - int32_t fLookAhead; - UVector *fTagVals; - int32_t fTagsIdx; - UVector *fPositions; // Set of parse tree positions associated - // with this state. Unordered (it's a set). - // UVector contents are RBBINode * - + RBBITableBuilder(const RBBITableBuilder &other); // forbid copying of this class + RBBITableBuilder &operator=(const RBBITableBuilder &other); // forbid copying of this class +}; + +// +// RBBIStateDescriptor - The DFA is constructed as a set of these descriptors, +// one for each state. +class RBBIStateDescriptor : public UMemory { +public: + UBool fMarked; + int32_t fAccepting; + int32_t fLookAhead; + UVector *fTagVals; + int32_t fTagsIdx; + UVector *fPositions; // Set of parse tree positions associated + // with this state. Unordered (it's a set). + // UVector contents are RBBINode * + UVector32 *fDtran; // Transitions out of this state. - // indexed by input character - // contents is int index of dest state - // in RBBITableBuilder.fDStates - - RBBIStateDescriptor(int maxInputSymbol, UErrorCode *fStatus); - ~RBBIStateDescriptor(); - -private: - RBBIStateDescriptor(const RBBIStateDescriptor &other); // forbid copying of this class - RBBIStateDescriptor &operator=(const RBBIStateDescriptor &other); // forbid copying of this class -}; - - - -U_NAMESPACE_END + // indexed by input character + // contents is int index of dest state + // in RBBITableBuilder.fDStates + + RBBIStateDescriptor(int maxInputSymbol, UErrorCode *fStatus); + ~RBBIStateDescriptor(); + +private: + RBBIStateDescriptor(const RBBIStateDescriptor &other); // forbid copying of this class + RBBIStateDescriptor &operator=(const RBBIStateDescriptor &other); // forbid copying of this class +}; + + + +U_NAMESPACE_END #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ -#endif +#endif |