X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/46f4442e9a5a4f3b98b7c1083586332f6a8a99a4..4388f060552cc537e71e957d32f35e9d75a61233:/icuSources/i18n/regeximp.h diff --git a/icuSources/i18n/regeximp.h b/icuSources/i18n/regeximp.h index 07206e64..31d333ca 100644 --- a/icuSources/i18n/regeximp.h +++ b/icuSources/i18n/regeximp.h @@ -1,5 +1,5 @@ // -// Copyright (C) 2002-2007 International Business Machines Corporation +// Copyright (C) 2002-2012 International Business Machines Corporation // and others. All rights reserved. // // file: regeximp.h @@ -12,11 +12,21 @@ #ifndef _REGEXIMP_H #define _REGEXIMP_H +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "unicode/uniset.h" +#include "unicode/utext.h" + #include "cmemory.h" +#include "ucase.h" U_NAMESPACE_BEGIN -#ifdef REGEX_DEBUG /* For debugging, define REGEX_DEBUG in regex.h, not here in this file. */ +// For debugging, define REGEX_DEBUG +// To define with configure, +// ./runConfigureICU --enable-debug --disable-release Linux CPPFLAGS="-DREGEX_DEBUG" + +#ifdef REGEX_DEBUG // // debugging options. Enable one or more of the three #defines immediately following // @@ -279,12 +289,18 @@ enum { // Match Engine State Stack Frame Layout. // struct REStackFrame { - int32_t fInputIdx; // Position of next character in the input string - int32_t fPatIdx; // Position of next Op in the compiled pattern - int32_t fExtra[2]; // Extra state, for capture group start/ends + // Header + int64_t fInputIdx; // Position of next character in the input string + int64_t fPatIdx; // Position of next Op in the compiled pattern + // (int64_t for UVector64, values fit in an int32_t) + // Remainder + int64_t fExtra[1]; // Extra state, for capture group start/ends // atomic parentheses, repeat counts, etc. // Locations assigned at pattern compile time. + // Variable-length array. }; +// number of UVector elements in the header +#define RESTACKFRAME_HDRCOUNT 2 // // Start-Of-Match type. Used by find() to quickly scan to positions where a @@ -307,7 +323,6 @@ enum StartOfMatch { (v)==START_STRING? "START_STRING" : \ "ILLEGAL") - // // 8 bit set, to fast-path latin-1 set membership tests. // @@ -348,6 +363,60 @@ inline void Regex8BitSet::operator = (const Regex8BitSet &s) { } +// Case folded UText Iterator helper class. +// Wraps a UText, provides a case-folded enumeration over its contents. +// Used in implementing case insensitive matching constructs. +// Implementation in rematch.cpp + +class CaseFoldingUTextIterator: public UMemory { + public: + CaseFoldingUTextIterator(UText &text); + ~CaseFoldingUTextIterator(); + + UChar32 next(); // Next case folded character + + UBool inExpansion(); // True if last char returned from next() and the + // next to be returned both originated from a string + // folding of the same code point from the orignal UText. + private: + UText &fUText; + const UCaseProps *fcsp; + const UChar *fFoldChars; + int32_t fFoldLength; + int32_t fFoldIndex; + +}; + + +// Case folded UChar * string iterator. +// Wraps a UChar *, provides a case-folded enumeration over its contents. +// Used in implementing case insensitive matching constructs. +// Implementation in rematch.cpp + +class CaseFoldingUCharIterator: public UMemory { + public: + CaseFoldingUCharIterator(const UChar *chars, int64_t start, int64_t limit); + ~CaseFoldingUCharIterator(); + + UChar32 next(); // Next case folded character + + UBool inExpansion(); // True if last char returned from next() and the + // next to be returned both originated from a string + // folding of the same code point from the orignal UText. + + int64_t getIndex(); // Return the current input buffer index. + + private: + const UChar *fChars; + int64_t fIndex; + int64_t fLimit; + const UCaseProps *fcsp; + const UChar *fFoldChars; + int32_t fFoldLength; + int32_t fFoldIndex; + +}; + U_NAMESPACE_END #endif