]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/rbbinode.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /********************************************************************
5 * Copyright (c) 2001-2016, International Business Machines Corporation and
6 * others. All Rights Reserved.
7 ********************************************************************/
12 #include "unicode/utypes.h"
13 #include "unicode/unistr.h"
14 #include "unicode/uobject.h"
19 // Represents a node in the parse tree generated when reading
28 class RBBINode
: public UMemory
{
60 RBBINode
*fRightChild
;
61 UnicodeSet
*fInputSet
; // For uset nodes only.
62 OpPrecedence fPrecedence
; // For binary ops only.
64 UnicodeString fText
; // Text corresponding to this node.
65 // May be lazily evaluated when (if) needed
66 // for some node types.
67 int fFirstPos
; // Position in the rule source string of the
68 // first text associated with the node.
69 // If there's a left child, this will be the same
70 // as that child's left pos.
71 int fLastPos
; // Last position in the rule source string
72 // of any text associated with this node.
73 // If there's a right child, this will be the same
74 // as that child's last postion.
76 UBool fNullable
; // See Aho.
77 int32_t fVal
; // For leafChar nodes, the value.
78 // Values are the character category,
79 // corresponds to columns in the final
80 // state transition table.
82 UBool fLookAheadEnd
; // For endMark nodes, set TRUE if
83 // marking the end of a look-ahead rule.
85 UBool fRuleRoot
; // True if this node is the root of a rule.
86 UBool fChainIn
; // True if chaining into this rule is allowed
89 UVector
*fFirstPosSet
;
90 UVector
*fLastPosSet
; // TODO: rename fFirstPos & fLastPos to avoid confusion.
95 RBBINode(const RBBINode
&other
);
98 RBBINode
*cloneTree();
99 RBBINode
*flattenVariables();
101 void findNodes(UVector
*dest
, RBBINode::NodeType kind
, UErrorCode
&status
);
104 static void printNodeHeader();
105 static void printNode(const RBBINode
*n
);
106 static void printTree(const RBBINode
*n
, UBool withHeading
);
110 RBBINode
&operator = (const RBBINode
&other
); // No defs.
111 UBool
operator == (const RBBINode
&other
); // Private, so these functions won't accidently be used.
115 int fSerialNum
; // Debugging aids.
121 RBBI_DEBUG_printUnicodeString(const UnicodeString
&s
, int minWidth
=0);