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