diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-12 15:47:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-19 08:26:54 +0200 |
commit | 4d64e43c1f0106f824f01feb842f8e87a0a91da8 (patch) | |
tree | 549418ae53bf5611f744f3921816db6f3880ce5c /i18npool | |
parent | 6390d77a1498ff2474522031af4a68af5e865d8d (diff) |
Convert TOKEN constants to o3tl::typed_flags
Change-Id: I0fa6cd6160d6c61a3d6f9eeb6ffadf3db68c6d05
Reviewed-on: https://gerrit.libreoffice.org/36506
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/inc/cclass_unicode.hxx | 78 | ||||
-rw-r--r-- | i18npool/source/characterclassification/cclass_unicode_parser.cxx | 464 |
2 files changed, 264 insertions, 278 deletions
diff --git a/i18npool/inc/cclass_unicode.hxx b/i18npool/inc/cclass_unicode.hxx index 811e92b0ff05..287df8e69170 100644 --- a/i18npool/inc/cclass_unicode.hxx +++ b/i18npool/inc/cclass_unicode.hxx @@ -26,14 +26,41 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <transliteration_body.hxx> +#include <o3tl/typed_flags_set.hxx> namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } } -namespace com { namespace sun { namespace star { namespace i18n { -typedef sal_uInt32 UPT_FLAG_TYPE; +/// Flag values of table. +enum class ParserFlags : sal_uInt32 { + ILLEGAL = 0x00000000, + CHAR = 0x00000001, + CHAR_BOOL = 0x00000002, + CHAR_WORD = 0x00000004, + CHAR_VALUE = 0x00000008, + CHAR_STRING = 0x00000010, + CHAR_DONTCARE = 0x00000020, + BOOL = 0x00000040, + WORD = 0x00000080, + WORD_SEP = 0x00000100, + VALUE = 0x00000200, + VALUE_SEP = 0x00000400, + VALUE_EXP = 0x00000800, + VALUE_SIGN = 0x00001000, + VALUE_EXP_VALUE = 0x00002000, + VALUE_DIGIT = 0x00004000, + NAME_SEP = 0x20000000, + STRING_SEP = 0x40000000, + EXCLUDED = 0x80000000, +}; +namespace o3tl { + template<> struct typed_flags<ParserFlags> : is_typed_flags<ParserFlags, 0xe0007fff> {}; +} + + +namespace com { namespace sun { namespace star { namespace i18n { class cclass_Unicode : public cppu::WeakImplHelper < XCharacterClassification, css::lang::XServiceInfo > { @@ -88,30 +115,9 @@ private: }; static const sal_uInt8 nDefCnt; - static const UPT_FLAG_TYPE pDefaultParserTable[]; + static const ParserFlags pDefaultParserTable[]; static const sal_Int32 pParseTokensType[]; - /// Flag values of table. - static const UPT_FLAG_TYPE TOKEN_ILLEGAL; - static const UPT_FLAG_TYPE TOKEN_CHAR; - static const UPT_FLAG_TYPE TOKEN_CHAR_BOOL; - static const UPT_FLAG_TYPE TOKEN_CHAR_WORD; - static const UPT_FLAG_TYPE TOKEN_CHAR_VALUE; - static const UPT_FLAG_TYPE TOKEN_CHAR_STRING; - static const UPT_FLAG_TYPE TOKEN_CHAR_DONTCARE; - static const UPT_FLAG_TYPE TOKEN_BOOL; - static const UPT_FLAG_TYPE TOKEN_WORD; - static const UPT_FLAG_TYPE TOKEN_WORD_SEP; - static const UPT_FLAG_TYPE TOKEN_VALUE; - static const UPT_FLAG_TYPE TOKEN_VALUE_SEP; - static const UPT_FLAG_TYPE TOKEN_VALUE_EXP; - static const UPT_FLAG_TYPE TOKEN_VALUE_SIGN; - static const UPT_FLAG_TYPE TOKEN_VALUE_EXP_VALUE; - static const UPT_FLAG_TYPE TOKEN_VALUE_DIGIT; - static const UPT_FLAG_TYPE TOKEN_NAME_SEP; - static const UPT_FLAG_TYPE TOKEN_STRING_SEP; - static const UPT_FLAG_TYPE TOKEN_EXCLUDED; - /// If and where c occurs in pStr static const sal_Unicode* StrChr( const sal_Unicode* pStr, sal_Unicode c ); @@ -124,29 +130,29 @@ private: css::uno::Reference < css::i18n::XNativeNumberSupplier > xNatNumSup; OUString aStartChars; OUString aContChars; - UPT_FLAG_TYPE* pTable; - UPT_FLAG_TYPE* pStart; - UPT_FLAG_TYPE* pCont; - sal_Int32 nStartTypes; - sal_Int32 nContTypes; - ScanState eState; - sal_Unicode cGroupSep; - sal_Unicode cDecimalSep; + ParserFlags* pTable; + ParserFlags* pStart; + ParserFlags* pCont; + sal_Int32 nStartTypes; + sal_Int32 nContTypes; + ScanState eState; + sal_Unicode cGroupSep; + sal_Unicode cDecimalSep; /// Get corresponding KParseTokens flag for a character static sal_Int32 getParseTokensType(sal_uInt32 c, bool isFirst); /// Access parser table flags. - UPT_FLAG_TYPE getFlags(sal_uInt32 c); + ParserFlags getFlags(sal_uInt32 c); /// Access parser flags via International and special definitions. - UPT_FLAG_TYPE getFlagsExtended(sal_uInt32 c); + ParserFlags getFlagsExtended(sal_uInt32 c); /// Access parser table flags for user defined start characters. - UPT_FLAG_TYPE getStartCharsFlags( sal_Unicode c ); + ParserFlags getStartCharsFlags( sal_Unicode c ); /// Access parser table flags for user defined continuation characters. - UPT_FLAG_TYPE getContCharsFlags( sal_Unicode c ); + ParserFlags getContCharsFlags( sal_Unicode c ); /// Setup parser table. Calls initParserTable() only if needed. void setupParserTable( const css::lang::Locale& rLocale, sal_Int32 startCharTokenType, diff --git a/i18npool/source/characterclassification/cclass_unicode_parser.cxx b/i18npool/source/characterclassification/cclass_unicode_parser.cxx index 94019c73d56f..2a3616302cc3 100644 --- a/i18npool/source/characterclassification/cclass_unicode_parser.cxx +++ b/i18npool/source/characterclassification/cclass_unicode_parser.cxx @@ -35,168 +35,148 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; -namespace com { namespace sun { namespace star { namespace i18n { - -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_ILLEGAL = 0x00000000; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_CHAR = 0x00000001; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_CHAR_BOOL = 0x00000002; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_CHAR_WORD = 0x00000004; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_CHAR_VALUE = 0x00000008; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_CHAR_STRING = 0x00000010; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_CHAR_DONTCARE= 0x00000020; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_BOOL = 0x00000040; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_WORD = 0x00000080; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_WORD_SEP = 0x00000100; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_VALUE = 0x00000200; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_VALUE_SEP = 0x00000400; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_VALUE_EXP = 0x00000800; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_VALUE_SIGN = 0x00001000; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_VALUE_EXP_VALUE = 0x00002000; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_VALUE_DIGIT = 0x00004000; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_NAME_SEP = 0x20000000; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_STRING_SEP = 0x40000000; -const UPT_FLAG_TYPE cclass_Unicode::TOKEN_EXCLUDED = 0x80000000; +#define TOKEN_DIGIT_FLAGS (ParserFlags::CHAR_VALUE | ParserFlags::VALUE | ParserFlags::VALUE_EXP | ParserFlags::VALUE_EXP_VALUE | ParserFlags::VALUE_DIGIT) -#define TOKEN_DIGIT_FLAGS (TOKEN_CHAR_VALUE | TOKEN_VALUE | TOKEN_VALUE_EXP | TOKEN_VALUE_EXP_VALUE | TOKEN_VALUE_DIGIT) +namespace com { namespace sun { namespace star { namespace i18n { // Default identifier/name specification is [A-Za-z_][A-Za-z0-9_]* const sal_uInt8 cclass_Unicode::nDefCnt = 128; -const UPT_FLAG_TYPE cclass_Unicode::pDefaultParserTable[ nDefCnt ] = +const ParserFlags cclass_Unicode::pDefaultParserTable[ nDefCnt ] = { // (...) == Calc formula compiler specific, commented out and modified - /* \0 */ TOKEN_EXCLUDED, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - /* 9 \t */ TOKEN_CHAR_DONTCARE | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_ILLEGAL) - TOKEN_ILLEGAL, - /* 11 \v */ TOKEN_CHAR_DONTCARE | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_ILLEGAL) - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - TOKEN_ILLEGAL, - /* 32 */ TOKEN_CHAR_DONTCARE | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, - /* 33 ! */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, - /* 34 " */ TOKEN_CHAR_STRING | TOKEN_STRING_SEP, - /* 35 # */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_WORD_SEP) - /* 36 $ */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_CHAR_WORD | TOKEN_WORD) - /* 37 % */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_VALUE) - /* 38 & */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, - /* 39 ' */ TOKEN_NAME_SEP, - /* 40 ( */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, - /* 41 ) */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, - /* 42 * */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, - /* 43 + */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP | TOKEN_VALUE_EXP | TOKEN_VALUE_SIGN, - /* 44 , */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_CHAR_VALUE | TOKEN_VALUE) - /* 45 - */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP | TOKEN_VALUE_EXP | TOKEN_VALUE_SIGN, - /* 46 . */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_WORD | TOKEN_CHAR_VALUE | TOKEN_VALUE) - /* 47 / */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, + /* \0 */ ParserFlags::EXCLUDED, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + /* 9 \t */ ParserFlags::CHAR_DONTCARE | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::ILLEGAL) + ParserFlags::ILLEGAL, + /* 11 \v */ ParserFlags::CHAR_DONTCARE | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::ILLEGAL) + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + ParserFlags::ILLEGAL, + /* 32 */ ParserFlags::CHAR_DONTCARE | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, + /* 33 ! */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, + /* 34 " */ ParserFlags::CHAR_STRING | ParserFlags::STRING_SEP, + /* 35 # */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::WORD_SEP) + /* 36 $ */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::CHAR_WORD | ParserFlags::WORD) + /* 37 % */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::VALUE) + /* 38 & */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, + /* 39 ' */ ParserFlags::NAME_SEP, + /* 40 ( */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, + /* 41 ) */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, + /* 42 * */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, + /* 43 + */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP | ParserFlags::VALUE_EXP | ParserFlags::VALUE_SIGN, + /* 44 , */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::CHAR_VALUE | ParserFlags::VALUE) + /* 45 - */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP | ParserFlags::VALUE_EXP | ParserFlags::VALUE_SIGN, + /* 46 . */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::WORD | ParserFlags::CHAR_VALUE | ParserFlags::VALUE) + /* 47 / */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, //for ( i = 48; i < 58; i++ ) - /* 48 0 */ TOKEN_DIGIT_FLAGS | TOKEN_WORD, - /* 49 1 */ TOKEN_DIGIT_FLAGS | TOKEN_WORD, - /* 50 2 */ TOKEN_DIGIT_FLAGS | TOKEN_WORD, - /* 51 3 */ TOKEN_DIGIT_FLAGS | TOKEN_WORD, - /* 52 4 */ TOKEN_DIGIT_FLAGS | TOKEN_WORD, - /* 53 5 */ TOKEN_DIGIT_FLAGS | TOKEN_WORD, - /* 54 6 */ TOKEN_DIGIT_FLAGS | TOKEN_WORD, - /* 55 7 */ TOKEN_DIGIT_FLAGS | TOKEN_WORD, - /* 56 8 */ TOKEN_DIGIT_FLAGS | TOKEN_WORD, - /* 57 9 */ TOKEN_DIGIT_FLAGS | TOKEN_WORD, - /* 58 : */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_WORD) - /* 59 ; */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, - /* 60 < */ TOKEN_CHAR_BOOL | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, - /* 61 = */ TOKEN_CHAR | TOKEN_BOOL | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, - /* 62 > */ TOKEN_CHAR_BOOL | TOKEN_BOOL | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, - /* 63 ? */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_CHAR_WORD | TOKEN_WORD) - /* 64 @ */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_ILLEGAL // UNUSED) + /* 48 0 */ TOKEN_DIGIT_FLAGS | ParserFlags::WORD, + /* 49 1 */ TOKEN_DIGIT_FLAGS | ParserFlags::WORD, + /* 50 2 */ TOKEN_DIGIT_FLAGS | ParserFlags::WORD, + /* 51 3 */ TOKEN_DIGIT_FLAGS | ParserFlags::WORD, + /* 52 4 */ TOKEN_DIGIT_FLAGS | ParserFlags::WORD, + /* 53 5 */ TOKEN_DIGIT_FLAGS | ParserFlags::WORD, + /* 54 6 */ TOKEN_DIGIT_FLAGS | ParserFlags::WORD, + /* 55 7 */ TOKEN_DIGIT_FLAGS | ParserFlags::WORD, + /* 56 8 */ TOKEN_DIGIT_FLAGS | ParserFlags::WORD, + /* 57 9 */ TOKEN_DIGIT_FLAGS | ParserFlags::WORD, + /* 58 : */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::WORD) + /* 59 ; */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, + /* 60 < */ ParserFlags::CHAR_BOOL | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, + /* 61 = */ ParserFlags::CHAR | ParserFlags::BOOL | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, + /* 62 > */ ParserFlags::CHAR_BOOL | ParserFlags::BOOL | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, + /* 63 ? */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::CHAR_WORD | ParserFlags::WORD) + /* 64 @ */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::ILLEGAL // UNUSED) //for ( i = 65; i < 91; i++ ) - /* 65 A */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 66 B */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 67 C */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 68 D */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 69 E */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 70 F */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 71 G */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 72 H */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 73 I */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 74 J */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 75 K */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 76 L */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 77 M */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 78 N */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 79 O */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 80 P */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 81 Q */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 82 R */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 83 S */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 84 T */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 85 U */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 86 V */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 87 W */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 88 X */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 89 Y */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 90 Z */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 91 [ */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_ILLEGAL // UNUSED) - /* 92 \ */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_ILLEGAL // UNUSED) - /* 93 ] */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_ILLEGAL // UNUSED) - /* 94 ^ */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, - /* 95 _ */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 96 ` */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_ILLEGAL // UNUSED) + /* 65 A */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 66 B */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 67 C */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 68 D */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 69 E */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 70 F */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 71 G */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 72 H */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 73 I */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 74 J */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 75 K */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 76 L */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 77 M */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 78 N */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 79 O */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 80 P */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 81 Q */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 82 R */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 83 S */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 84 T */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 85 U */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 86 V */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 87 W */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 88 X */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 89 Y */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 90 Z */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 91 [ */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::ILLEGAL // UNUSED) + /* 92 \ */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::ILLEGAL // UNUSED) + /* 93 ] */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::ILLEGAL // UNUSED) + /* 94 ^ */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, + /* 95 _ */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 96 ` */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::ILLEGAL // UNUSED) //for ( i = 97; i < 123; i++ ) - /* 97 a */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 98 b */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 99 c */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 100 d */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 101 e */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 102 f */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 103 g */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 104 h */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 105 i */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 106 j */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 107 k */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 108 l */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 109 m */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 110 n */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 111 o */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 112 p */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 113 q */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 114 r */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 115 s */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 116 t */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 117 u */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 118 v */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 119 w */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 120 x */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 121 y */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 122 z */ TOKEN_CHAR_WORD | TOKEN_WORD, - /* 123 { */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_ILLEGAL // UNUSED) - /* 124 | */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_ILLEGAL // UNUSED) - /* 125 } */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_ILLEGAL // UNUSED) - /* 126 ~ */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP, // (TOKEN_ILLEGAL // UNUSED) - /* 127 */ TOKEN_CHAR | TOKEN_WORD_SEP | TOKEN_VALUE_SEP // (TOKEN_ILLEGAL // UNUSED) + /* 97 a */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 98 b */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 99 c */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 100 d */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 101 e */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 102 f */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 103 g */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 104 h */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 105 i */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 106 j */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 107 k */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 108 l */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 109 m */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 110 n */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 111 o */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 112 p */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 113 q */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 114 r */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 115 s */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 116 t */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 117 u */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 118 v */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 119 w */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 120 x */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 121 y */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 122 z */ ParserFlags::CHAR_WORD | ParserFlags::WORD, + /* 123 { */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::ILLEGAL // UNUSED) + /* 124 | */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::ILLEGAL // UNUSED) + /* 125 } */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::ILLEGAL // UNUSED) + /* 126 ~ */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP, // (ParserFlags::ILLEGAL // UNUSED) + /* 127 */ ParserFlags::CHAR | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP // (ParserFlags::ILLEGAL // UNUSED) }; @@ -431,8 +411,8 @@ void cclass_Unicode::initParserTable( const Locale& rLocale, sal_Int32 startChar setupInternational( rLocale ); // Memory of pTable is reused. if ( !pTable ) - pTable = new UPT_FLAG_TYPE[nDefCnt]; - memcpy( pTable, pDefaultParserTable, sizeof(UPT_FLAG_TYPE) * nDefCnt ); + pTable = new ParserFlags[nDefCnt]; + memcpy( pTable, pDefaultParserTable, sizeof(ParserFlags) * nDefCnt ); // Start and cont tables only need reallocation if different length. if ( pStart && userDefinedCharactersStart.getLength() != aStartChars.getLength() ) { @@ -461,9 +441,9 @@ void cclass_Unicode::initParserTable( const Locale& rLocale, sal_Int32 startChar } if ( cGroupSep < nDefCnt ) - pTable[cGroupSep] |= TOKEN_VALUE; + pTable[cGroupSep] |= ParserFlags::VALUE; if ( cDecimalSep < nDefCnt ) - pTable[cDecimalSep] |= TOKEN_CHAR_VALUE | TOKEN_VALUE; + pTable[cDecimalSep] |= ParserFlags::CHAR_VALUE | ParserFlags::VALUE; // Modify characters according to KParseTokens definitions. { @@ -472,58 +452,58 @@ void cclass_Unicode::initParserTable( const Locale& rLocale, sal_Int32 startChar if ( !(nStartTypes & ASC_UPALPHA) ) for ( i = 65; i < 91; i++ ) - pTable[i] &= ~TOKEN_CHAR_WORD; // not allowed as start character + pTable[i] &= ~ParserFlags::CHAR_WORD; // not allowed as start character if ( !(nContTypes & ASC_UPALPHA) ) for ( i = 65; i < 91; i++ ) - pTable[i] &= ~TOKEN_WORD; // not allowed as cont character + pTable[i] &= ~ParserFlags::WORD; // not allowed as cont character if ( !(nStartTypes & ASC_LOALPHA) ) for ( i = 97; i < 123; i++ ) - pTable[i] &= ~TOKEN_CHAR_WORD; // not allowed as start character + pTable[i] &= ~ParserFlags::CHAR_WORD; // not allowed as start character if ( !(nContTypes & ASC_LOALPHA) ) for ( i = 97; i < 123; i++ ) - pTable[i] &= ~TOKEN_WORD; // not allowed as cont character + pTable[i] &= ~ParserFlags::WORD; // not allowed as cont character if ( nStartTypes & ASC_DIGIT ) for ( i = 48; i < 58; i++ ) - pTable[i] |= TOKEN_CHAR_WORD; // allowed as start character + pTable[i] |= ParserFlags::CHAR_WORD; // allowed as start character if ( !(nContTypes & ASC_DIGIT) ) for ( i = 48; i < 58; i++ ) - pTable[i] &= ~TOKEN_WORD; // not allowed as cont character + pTable[i] &= ~ParserFlags::WORD; // not allowed as cont character if ( !(nStartTypes & ASC_UNDERSCORE) ) - pTable[95] &= ~TOKEN_CHAR_WORD; // not allowed as start character + pTable[95] &= ~ParserFlags::CHAR_WORD; // not allowed as start character if ( !(nContTypes & ASC_UNDERSCORE) ) - pTable[95] &= ~TOKEN_WORD; // not allowed as cont character + pTable[95] &= ~ParserFlags::WORD; // not allowed as cont character if ( nStartTypes & ASC_DOLLAR ) - pTable[36] |= TOKEN_CHAR_WORD; // allowed as start character + pTable[36] |= ParserFlags::CHAR_WORD; // allowed as start character if ( nContTypes & ASC_DOLLAR ) - pTable[36] |= TOKEN_WORD; // allowed as cont character + pTable[36] |= ParserFlags::WORD; // allowed as cont character if ( nStartTypes & ASC_DOT ) - pTable[46] |= TOKEN_CHAR_WORD; // allowed as start character + pTable[46] |= ParserFlags::CHAR_WORD; // allowed as start character if ( nContTypes & ASC_DOT ) - pTable[46] |= TOKEN_WORD; // allowed as cont character + pTable[46] |= ParserFlags::WORD; // allowed as cont character if ( nStartTypes & ASC_COLON ) - pTable[58] |= TOKEN_CHAR_WORD; // allowed as start character + pTable[58] |= ParserFlags::CHAR_WORD; // allowed as start character if ( nContTypes & ASC_COLON ) - pTable[58] |= TOKEN_WORD; // allowed as cont character + pTable[58] |= ParserFlags::WORD; // allowed as cont character if ( nStartTypes & ASC_CONTROL ) for ( i = 1; i < 32; i++ ) - pTable[i] |= TOKEN_CHAR_WORD; // allowed as start character + pTable[i] |= ParserFlags::CHAR_WORD; // allowed as start character if ( nContTypes & ASC_CONTROL ) for ( i = 1; i < 32; i++ ) - pTable[i] |= TOKEN_WORD; // allowed as cont character + pTable[i] |= ParserFlags::WORD; // allowed as cont character if ( nStartTypes & ASC_ANY_BUT_CONTROL ) for ( i = 32; i < nDefCnt; i++ ) - pTable[i] |= TOKEN_CHAR_WORD; // allowed as start character + pTable[i] |= ParserFlags::CHAR_WORD; // allowed as start character if ( nContTypes & ASC_ANY_BUT_CONTROL ) for ( i = 32; i < nDefCnt; i++ ) - pTable[i] |= TOKEN_WORD; // allowed as cont character + pTable[i] |= ParserFlags::WORD; // allowed as cont character } @@ -533,13 +513,13 @@ void cclass_Unicode::initParserTable( const Locale& rLocale, sal_Int32 startChar if ( nLen ) { if ( !pStart ) - pStart = new UPT_FLAG_TYPE[ nLen ]; + pStart = new ParserFlags[ nLen ]; const sal_Unicode* p = aStartChars.getStr(); for ( sal_Int32 j=0; j<nLen; j++, p++ ) { - pStart[j] = TOKEN_CHAR_WORD; + pStart[j] = ParserFlags::CHAR_WORD; if ( *p < nDefCnt ) - pTable[*p] |= TOKEN_CHAR_WORD; + pTable[*p] |= ParserFlags::CHAR_WORD; } } // ContChars @@ -547,13 +527,13 @@ void cclass_Unicode::initParserTable( const Locale& rLocale, sal_Int32 startChar if ( nLen ) { if ( !pCont ) - pCont = new UPT_FLAG_TYPE[ nLen ]; + pCont = new ParserFlags[ nLen ]; const sal_Unicode* p = aContChars.getStr(); for ( sal_Int32 j=0; j<nLen; j++ ) { - pCont[j] = TOKEN_WORD; + pCont[j] = ParserFlags::WORD; if ( *p < nDefCnt ) - pTable[*p] |= TOKEN_WORD; + pTable[*p] |= ParserFlags::WORD; } } } @@ -570,9 +550,9 @@ void cclass_Unicode::destroyParserTable() } -UPT_FLAG_TYPE cclass_Unicode::getFlags(sal_uInt32 const c) +ParserFlags cclass_Unicode::getFlags(sal_uInt32 const c) { - UPT_FLAG_TYPE nMask; + ParserFlags nMask; if ( c < nDefCnt ) nMask = pTable[ sal_uInt8(c) ]; else @@ -583,20 +563,20 @@ UPT_FLAG_TYPE cclass_Unicode::getFlags(sal_uInt32 const c) case ssRewindFromValue : case ssIgnoreLeadingInRewind : case ssGetWordFirstChar : - if ( !(nMask & TOKEN_CHAR_WORD) ) + if ( !(nMask & ParserFlags::CHAR_WORD) ) { nMask |= getStartCharsFlags( c ); - if ( nMask & TOKEN_CHAR_WORD ) - nMask &= ~TOKEN_EXCLUDED; + if ( nMask & ParserFlags::CHAR_WORD ) + nMask &= ~ParserFlags::EXCLUDED; } break; case ssGetValue : case ssGetWord : - if ( !(nMask & TOKEN_WORD) ) + if ( !(nMask & ParserFlags::WORD) ) { nMask |= getContCharsFlags( c ); - if ( nMask & TOKEN_WORD ) - nMask &= ~TOKEN_EXCLUDED; + if ( nMask & ParserFlags::WORD ) + nMask &= ~ParserFlags::EXCLUDED; } break; default: @@ -606,12 +586,12 @@ UPT_FLAG_TYPE cclass_Unicode::getFlags(sal_uInt32 const c) } -UPT_FLAG_TYPE cclass_Unicode::getFlagsExtended(sal_uInt32 const c) +ParserFlags cclass_Unicode::getFlagsExtended(sal_uInt32 const c) { if ( c == cGroupSep ) - return TOKEN_VALUE; + return ParserFlags::VALUE; else if ( c == cDecimalSep ) - return TOKEN_CHAR_VALUE | TOKEN_VALUE; + return ParserFlags::CHAR_VALUE | ParserFlags::VALUE; using namespace i18n; bool bStart = (eState == ssGetChar || eState == ssGetWordFirstChar || eState == ssRewindFromValue || eState == ssIgnoreLeadingInRewind); @@ -622,66 +602,66 @@ UPT_FLAG_TYPE cclass_Unicode::getFlagsExtended(sal_uInt32 const c) { case U_UPPERCASE_LETTER : return (nTypes & KParseTokens::UNI_UPALPHA) ? - (bStart ? TOKEN_CHAR_WORD : TOKEN_WORD) : - TOKEN_ILLEGAL; + (bStart ? ParserFlags::CHAR_WORD : ParserFlags::WORD) : + ParserFlags::ILLEGAL; case U_LOWERCASE_LETTER : return (nTypes & KParseTokens::UNI_LOALPHA) ? - (bStart ? TOKEN_CHAR_WORD : TOKEN_WORD) : - TOKEN_ILLEGAL; + (bStart ? ParserFlags::CHAR_WORD : ParserFlags::WORD) : + ParserFlags::ILLEGAL; case U_TITLECASE_LETTER : return (nTypes & KParseTokens::UNI_TITLE_ALPHA) ? - (bStart ? TOKEN_CHAR_WORD : TOKEN_WORD) : - TOKEN_ILLEGAL; + (bStart ? ParserFlags::CHAR_WORD : ParserFlags::WORD) : + ParserFlags::ILLEGAL; case U_MODIFIER_LETTER : return (nTypes & KParseTokens::UNI_MODIFIER_LETTER) ? - (bStart ? TOKEN_CHAR_WORD : TOKEN_WORD) : - TOKEN_ILLEGAL; + (bStart ? ParserFlags::CHAR_WORD : ParserFlags::WORD) : + ParserFlags::ILLEGAL; case U_NON_SPACING_MARK : case U_COMBINING_SPACING_MARK : // Non_Spacing_Mark can't be a leading character, // nor can a spacing combining mark. if (bStart) - return TOKEN_ILLEGAL; + return ParserFlags::ILLEGAL; SAL_FALLTHROUGH; // treat it as Other_Letter. case U_OTHER_LETTER : return (nTypes & KParseTokens::UNI_OTHER_LETTER) ? - (bStart ? TOKEN_CHAR_WORD : TOKEN_WORD) : - TOKEN_ILLEGAL; + (bStart ? ParserFlags::CHAR_WORD : ParserFlags::WORD) : + ParserFlags::ILLEGAL; case U_DECIMAL_DIGIT_NUMBER : return ((nTypes & KParseTokens::UNI_DIGIT) ? - (bStart ? TOKEN_CHAR_WORD : TOKEN_WORD) : - TOKEN_ILLEGAL) | TOKEN_DIGIT_FLAGS; + (bStart ? ParserFlags::CHAR_WORD : ParserFlags::WORD) : + ParserFlags::ILLEGAL) | TOKEN_DIGIT_FLAGS; case U_LETTER_NUMBER : return ((nTypes & KParseTokens::UNI_LETTER_NUMBER) ? - (bStart ? TOKEN_CHAR_WORD : TOKEN_WORD) : - TOKEN_ILLEGAL) | TOKEN_DIGIT_FLAGS; + (bStart ? ParserFlags::CHAR_WORD : ParserFlags::WORD) : + ParserFlags::ILLEGAL) | TOKEN_DIGIT_FLAGS; case U_OTHER_NUMBER : return ((nTypes & KParseTokens::UNI_OTHER_NUMBER) ? - (bStart ? TOKEN_CHAR_WORD : TOKEN_WORD) : - TOKEN_ILLEGAL) | TOKEN_DIGIT_FLAGS; + (bStart ? ParserFlags::CHAR_WORD : ParserFlags::WORD) : + ParserFlags::ILLEGAL) | TOKEN_DIGIT_FLAGS; case U_SPACE_SEPARATOR : return ((nTypes & KParseTokens::IGNORE_LEADING_WS) ? - TOKEN_CHAR_DONTCARE : (bStart ? TOKEN_CHAR_WORD : (TOKEN_CHAR_DONTCARE | TOKEN_WORD_SEP | TOKEN_VALUE_SEP) )); + ParserFlags::CHAR_DONTCARE : (bStart ? ParserFlags::CHAR_WORD : (ParserFlags::CHAR_DONTCARE | ParserFlags::WORD_SEP | ParserFlags::VALUE_SEP) )); case U_OTHER_PUNCTUATION: // fdo#61754 Lets see (if we not at the start) if this is midletter // punctuation and allow it in a word if it is similarly to // U_NON_SPACING_MARK if (bStart || U_WB_MIDLETTER != u_getIntPropertyValue(c, UCHAR_WORD_BREAK)) - return TOKEN_ILLEGAL; + return ParserFlags::ILLEGAL; else { //allowing it to continue the word return (nTypes & KParseTokens::UNI_OTHER_LETTER) ? - TOKEN_WORD : TOKEN_ILLEGAL; + ParserFlags::WORD : ParserFlags::ILLEGAL; } break; } - return TOKEN_ILLEGAL; + return ParserFlags::ILLEGAL; } -UPT_FLAG_TYPE cclass_Unicode::getStartCharsFlags( sal_Unicode c ) +ParserFlags cclass_Unicode::getStartCharsFlags( sal_Unicode c ) { if ( pStart ) { @@ -690,11 +670,11 @@ UPT_FLAG_TYPE cclass_Unicode::getStartCharsFlags( sal_Unicode c ) if ( p ) return pStart[ p - pStr ]; } - return TOKEN_ILLEGAL; + return ParserFlags::ILLEGAL; } -UPT_FLAG_TYPE cclass_Unicode::getContCharsFlags( sal_Unicode c ) +ParserFlags cclass_Unicode::getContCharsFlags( sal_Unicode c ) { if ( pCont ) { @@ -703,7 +683,7 @@ UPT_FLAG_TYPE cclass_Unicode::getContCharsFlags( sal_Unicode c ) if ( p ) return pCont[ p - pStr ]; } - return TOKEN_ILLEGAL; + return ParserFlags::ILLEGAL; } @@ -731,16 +711,16 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 while ((current != 0) && (eState != ssStop)) { ++nCodePoints; - UPT_FLAG_TYPE nMask = getFlags(current); - if ( nMask & TOKEN_EXCLUDED ) + ParserFlags nMask = getFlags(current); + if ( nMask & ParserFlags::EXCLUDED ) eState = ssBounce; if ( bMightBeWord ) { // only relevant for ssGetValue fall back if ( eState == ssGetChar || eState == ssRewindFromValue || eState == ssIgnoreLeadingInRewind ) - bMightBeWord = ((nMask & TOKEN_CHAR_WORD) != 0); + bMightBeWord = bool(nMask & ParserFlags::CHAR_WORD); else - bMightBeWord = ((nMask & TOKEN_WORD) != 0); + bMightBeWord = bool(nMask & ParserFlags::WORD); } sal_Int32 nParseTokensType = getParseTokensType(current, isFirst); isFirst = false; @@ -753,11 +733,11 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 case ssRewindFromValue : case ssIgnoreLeadingInRewind : { - if ( (nMask & TOKEN_CHAR_VALUE) && eState != ssRewindFromValue + if ( (nMask & ParserFlags::CHAR_VALUE) && eState != ssRewindFromValue && eState != ssIgnoreLeadingInRewind ) { //! must be first, may fall back to ssGetWord via bMightBeWord eState = ssGetValue; - if ( nMask & TOKEN_VALUE_DIGIT ) + if ( nMask & ParserFlags::VALUE_DIGIT ) { if (128 <= current) r.TokenType = KParseType::UNI_NUMBER; @@ -773,12 +753,12 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 // retry for ONE_SINGLE_CHAR or others } } - else if ( nMask & TOKEN_CHAR_WORD ) + else if ( nMask & ParserFlags::CHAR_WORD ) { eState = ssGetWord; r.TokenType = KParseType::IDENTNAME; } - else if ( nMask & TOKEN_NAME_SEP ) + else if ( nMask & ParserFlags::NAME_SEP ) { eState = ssGetWordFirstChar; bQuote = true; @@ -786,14 +766,14 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 nParseTokensType = 0; // will be taken of first real character r.TokenType = KParseType::SINGLE_QUOTE_NAME; } - else if ( nMask & TOKEN_CHAR_STRING ) + else if ( nMask & ParserFlags::CHAR_STRING ) { eState = ssGetString; postSymbolIndex = nextCharIndex; nParseTokensType = 0; // will be taken of first real character r.TokenType = KParseType::DOUBLE_QUOTE_STRING; } - else if ( nMask & TOKEN_CHAR_DONTCARE ) + else if ( nMask & ParserFlags::CHAR_DONTCARE ) { if ( nStartTypes & KParseTokens::IGNORE_LEADING_WS ) { @@ -808,12 +788,12 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 else eState = ssBounce; } - else if ( nMask & TOKEN_CHAR_BOOL ) + else if ( nMask & ParserFlags::CHAR_BOOL ) { eState = ssGetBool; r.TokenType = KParseType::BOOLEAN; } - else if ( nMask & TOKEN_CHAR ) + else if ( nMask & ParserFlags::CHAR ) { //! must be last eState = ssStop; r.TokenType = KParseType::ONE_SINGLE_CHAR; @@ -824,14 +804,14 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 break; case ssGetValue : { - if ( nMask & TOKEN_VALUE_DIGIT ) + if ( nMask & ParserFlags::VALUE_DIGIT ) { if (128 <= current) r.TokenType = KParseType::UNI_NUMBER; else if ( r.TokenType != KParseType::UNI_NUMBER ) r.TokenType = KParseType::ASC_NUMBER; } - if ( nMask & TOKEN_VALUE ) + if ( nMask & ParserFlags::VALUE ) { if (current == cDecimalSep && ++nDecSeps > 1) { @@ -845,10 +825,10 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 } else if (current == 'E' || current == 'e') { - UPT_FLAG_TYPE nNext = getFlags(nextChar); - if ( nNext & TOKEN_VALUE_EXP ) + ParserFlags nNext = getFlags(nextChar); + if ( nNext & ParserFlags::VALUE_EXP ) ; // keep it going - else if (bMightBeWord && ((nNext & TOKEN_WORD) || !nextChar)) + else if (bMightBeWord && ((nNext & ParserFlags::WORD) || !nextChar)) { // might be a numerical name (1.2efg) eState = ssGetWord; r.TokenType = KParseType::IDENTNAME; @@ -856,14 +836,14 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 else eState = ssStopBack; } - else if ( nMask & TOKEN_VALUE_SIGN ) + else if ( nMask & ParserFlags::VALUE_SIGN ) { if ( (cLast == 'E') || (cLast == 'e') ) { - UPT_FLAG_TYPE nNext = getFlags(nextChar); - if ( nNext & TOKEN_VALUE_EXP_VALUE ) + ParserFlags nNext = getFlags(nextChar); + if ( nNext & ParserFlags::VALUE_EXP_VALUE ) ; // keep it going - else if (bMightBeWord && ((nNext & TOKEN_WORD) || !nextChar)) + else if (bMightBeWord && ((nNext & ParserFlags::WORD) || !nextChar)) { // might be a numerical name (1.2e+fg) eState = ssGetWord; r.TokenType = KParseType::IDENTNAME; @@ -879,7 +859,7 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 else eState = ssStopBack; } - else if ( bMightBeWord && (nMask & TOKEN_WORD) ) + else if ( bMightBeWord && (nMask & ParserFlags::WORD) ) { // might be a numerical name (1995.A1) eState = ssGetWord; r.TokenType = KParseType::IDENTNAME; @@ -893,9 +873,9 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 SAL_FALLTHROUGH; case ssGetWord : { - if ( nMask & TOKEN_WORD ) + if ( nMask & ParserFlags::WORD ) ; // keep it going - else if ( nMask & TOKEN_NAME_SEP ) + else if ( nMask & ParserFlags::NAME_SEP ) { if ( bQuote ) { @@ -922,7 +902,7 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 break; case ssGetString : { - if ( nMask & TOKEN_STRING_SEP ) + if ( nMask & ParserFlags::STRING_SEP ) { if ( cLast == '\\' ) { // escaped @@ -948,7 +928,7 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 break; case ssGetBool : { - if ( (nMask & TOKEN_BOOL) ) + if ( (nMask & ParserFlags::BOOL) ) eState = ssStop; // maximum 2: <, >, <>, <=, >= else eState = ssStopBack; @@ -985,7 +965,7 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 ; // keep a number that might be a word else if (r.LeadingWhiteSpace == (nextCharIndex - nPos)) ; // keep ignored white space - else if ( !r.TokenType && eState == ssGetValue && (nMask & TOKEN_VALUE_SEP) ) + else if ( !r.TokenType && eState == ssGetValue && (nMask & ParserFlags::VALUE_SEP) ) ; // keep uncertain value else eState = ssBounce; |