//
// rbbiscan.h
//
-// Copyright (C) 2002-2003, International Business Machines Corporation and others.
+// Copyright (C) 2002-2008, International Business Machines Corporation and others.
// All Rights Reserved.
//
// This file contains declarations for class RBBIRuleScanner
// encountered.
//
//--------------------------------------------------------------------------------
-static const int kStackSize = 100; // The size of the state stack for
- // rules parsing. Corresponds roughly
- // to the depth of parentheses nesting
- // that is allowed in the rules.
-
-enum EParseAction {dummy01, dummy02}; // Placeholder enum for the specifier for
- // actions that are specified in the
- // rule parsing state table.
class RBBIRuleScanner : public UMemory {
public:
+ enum {
+ kStackSize = 100 // The size of the state stack for
+ }; // rules parsing. Corresponds roughly
+ // to the depth of parentheses nesting
+ // that is allowed in the rules.
+
struct RBBIRuleChar {
UChar32 fChar;
UBool fEscaped;
static UnicodeString stripRules(const UnicodeString &rules);
private:
- UBool doParseActions(EParseAction a);
+ UBool doParseActions(int32_t a);
void error(UErrorCode e); // error reporting convenience function.
void fixOpStack(RBBINode::OpPrecedence p);
// a character.
void findSetFor(const UnicodeString &s, RBBINode *node, UnicodeSet *setToAdopt = NULL);
UChar32 nextCharLL();
+#ifdef RBBI_DEBUG
void printNodeStack(const char *title);
+#endif
RBBINode *pushNewNode(RBBINode::NodeType t);
void scanSet();
int32_t fNextIndex; // Index of the next character, which
// is the first character not yet scanned.
UBool fQuoteMode; // Scan is in a 'quoted region'
- int fLineNum; // Line number in input file.
- int fCharNum; // Char position within the line.
+ int32_t fLineNum; // Line number in input file.
+ int32_t fCharNum; // Char position within the line.
UChar32 fLastChar; // Previous char, needed to count CR-LF
// as a single line, not two.
// parsing. index by p[state][char-class]
uint16_t fStack[kStackSize]; // State stack, holds state pushes
- int fStackPtr; // and pops as specified in the state
+ int32_t fStackPtr; // and pops as specified in the state
// transition rules.
RBBINode *fNodeStack[kStackSize]; // Node stack, holds nodes created
// during the parse of a rule
- int fNodeStackPtr;
+ int32_t fNodeStackPtr;
UBool fReverseRule; // True if the rule currently being scanned
// The key is the string used for creating
// the set.
- UnicodeSet *fRuleSets[10]; // Unicode Sets that are needed during
+ UnicodeSet fRuleSets[10]; // Unicode Sets that are needed during
// the scanning of RBBI rules. The
// indicies for these are assigned by the
// perl script that builds the state tables.