]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/rbbinode.h
1 /********************************************************************
3 * Copyright (c) 2001-2016, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
10 #include "unicode/utypes.h"
11 #include "unicode/unistr.h"
12 #include "unicode/uobject.h"
17 // Represents a node in the parse tree generated when reading
26 class RBBINode
: public UMemory
{
58 RBBINode
*fRightChild
;
59 UnicodeSet
*fInputSet
; // For uset nodes only.
60 OpPrecedence fPrecedence
; // For binary ops only.
62 UnicodeString fText
; // Text corresponding to this node.
63 // May be lazily evaluated when (if) needed
64 // for some node types.
65 int fFirstPos
; // Position in the rule source string of the
66 // first text associated with the node.
67 // If there's a left child, this will be the same
68 // as that child's left pos.
69 int fLastPos
; // Last position in the rule source string
70 // of any text associated with this node.
71 // If there's a right child, this will be the same
72 // as that child's last postion.
74 UBool fNullable
; // See Aho.
75 int32_t fVal
; // For leafChar nodes, the value.
76 // Values are the character category,
77 // corresponds to columns in the final
78 // state transition table.
80 UBool fLookAheadEnd
; // For endMark nodes, set TRUE if
81 // marking the end of a look-ahead rule.
83 UBool fRuleRoot
; // True if this node is the root of a rule.
84 UBool fChainIn
; // True if chaining into this rule is allowed
87 UVector
*fFirstPosSet
;
88 UVector
*fLastPosSet
; // TODO: rename fFirstPos & fLastPos to avoid confusion.
93 RBBINode(const RBBINode
&other
);
96 RBBINode
*cloneTree();
97 RBBINode
*flattenVariables();
99 void findNodes(UVector
*dest
, RBBINode::NodeType kind
, UErrorCode
&status
);
102 static void printNodeHeader();
104 void printTree(UBool withHeading
);
108 RBBINode
&operator = (const RBBINode
&other
); // No defs.
109 UBool
operator == (const RBBINode
&other
); // Private, so these functions won't accidently be used.
113 int fSerialNum
; // Debugging aids.
119 RBBI_DEBUG_printUnicodeString(const UnicodeString
&s
, int minWidth
=0);