]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/rbbitblb57.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 **********************************************************************
5 * Copyright (c) 2002-2016, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
9 **********************************************************************
10 * Legacy version of RBBITableBuilder from ICU 57,
11 * only for use by Apple RuleBasedTokenizer
12 **********************************************************************
18 #include "unicode/utypes.h"
19 #include "unicode/uobject.h"
28 class RBBIRuleScanner57
;
29 class RBBIRuleBuilder57
;
33 // class RBBITableBuilder57 is part of the RBBI rule compiler.
34 // It builds the state transition table used by the RBBI runtime
35 // from the expression syntax tree generated by the rule scanner.
37 // This class is part of the RBBI implementation only.
38 // There is no user-visible public API here.
41 class RBBITableBuilder57
: public UMemory
{
43 RBBITableBuilder57(RBBIRuleBuilder57
*rb
, RBBINode
**rootNode
);
44 ~RBBITableBuilder57();
47 int32_t getTableSize() const; // Return the runtime size in bytes of
48 // the built state table
49 void exportTable(void *where
); // fill in the runtime state table.
50 // Sufficient memory must exist at
51 // the specified location.
55 void calcNullable(RBBINode
*n
);
56 void calcFirstPos(RBBINode
*n
);
57 void calcLastPos(RBBINode
*n
);
58 void calcFollowPos(RBBINode
*n
);
59 void calcChainedFollowPos(RBBINode
*n
);
61 void buildStateTable();
62 void flagAcceptingStates();
63 void flagLookAheadStates();
64 void flagTaggedStates();
65 void mergeRuleStatusVals();
67 void addRuleRootNodes(UVector
*dest
, RBBINode
*node
);
69 // Set functions for UVector.
70 // TODO: make a USet subclass of UVector
72 void setAdd(UVector
*dest
, UVector
*source
);
73 UBool
setEquals(UVector
*a
, UVector
*b
);
75 void sortedAdd(UVector
**dest
, int32_t val
);
79 void printSet(UVector
*s
);
80 void printPosSets(RBBINode
*n
/* = NULL*/);
82 void printRuleStatusTable();
85 #define printPosSets(n)
87 #define printRuleStatusTable()
91 RBBIRuleBuilder57
*fRB
;
92 RBBINode
*&fTree
; // The root node of the parse tree to build a
96 UVector
*fDStates
; // D states (Aho's terminology)
97 // Index is state number
98 // Contents are RBBIStateDescriptor pointers.
101 RBBITableBuilder57(const RBBITableBuilder57
&other
); // forbid copying of this class
102 RBBITableBuilder57
&operator=(const RBBITableBuilder57
&other
); // forbid copying of this class
105 // class RBBIStateDescriptor - use standard rbbitblb.h