#include "irregexp/RegExpCharacters.h"
#include "mozilla/Assertions.h"
char16_t
js::irregexp::ConvertNonLatin1ToLatin1(char16_t c, bool unicode)
{
MOZ_ASSERT(c > 0xFF, "Character mustn't be Latin1");
if (unicode) {
if (c == 0x017F) {
return 0x73;
}
if (c == 0x1E9E) {
return 0xDF;
}
if (c == 0x212A) {
return 0x6B;
}
if (c == 0x212B) {
return 0xE5;
}
}
if (c == 0x039C || c == 0x03BC) {
return 0xB5;
}
if (c == 0x0178) {
return 0xFF;
}
return 0;
}
const int js::irregexp::kSpaceRanges[] = {
0x0009, 0x000D + 1, 0x0020, 0x0020 + 1, 0x00A0, 0x00A0 + 1, 0x1680, 0x1680 + 1, 0x2000, 0x200A + 1, 0x2028, 0x2029 + 1, 0x202F, 0x202F + 1, 0x205F, 0x205F + 1, 0x3000, 0x3000 + 1, 0xFEFF, 0xFEFF + 1, 0xFFFF + 1
};
const int js::irregexp::kSpaceRangeCount = 21;
const int js::irregexp::kSpaceAndSurrogateRanges[] = {
0x0009, 0x000D + 1, 0x0020, 0x0020 + 1, 0x00A0, 0x00A0 + 1, 0x1680, 0x1680 + 1, 0x2000, 0x200A + 1, 0x2028, 0x2029 + 1, 0x202F, 0x202F + 1, 0x205F, 0x205F + 1, 0x3000, 0x3000 + 1, 0xD800, 0xDFFF + 1, 0xFEFF, 0xFEFF + 1, 0xFFFF + 1
};
const int js::irregexp::kSpaceAndSurrogateRangeCount = 23;
const int js::irregexp::kWordRanges[] = {
0x0030, 0x0039 + 1, 0x0041, 0x005A + 1, 0x005F, 0x005F + 1, 0x0061, 0x007A + 1, 0xFFFF + 1
};
const int js::irregexp::kWordRangeCount = 9;
const int js::irregexp::kIgnoreCaseWordRanges[] = {
0x0030, 0x0039 + 1, 0x0041, 0x005A + 1, 0x005F, 0x005F + 1, 0x0061, 0x007A + 1, 0x017F, 0x017F + 1, 0x212A, 0x212A + 1, 0xFFFF + 1
};
const int js::irregexp::kIgnoreCaseWordRangeCount = 13;
const int js::irregexp::kWordAndSurrogateRanges[] = {
0x0030, 0x0039 + 1, 0x0041, 0x005A + 1, 0x005F, 0x005F + 1, 0x0061, 0x007A + 1, 0xD800, 0xDFFF + 1, 0xFFFF + 1
};
const int js::irregexp::kWordAndSurrogateRangeCount = 11;
const int js::irregexp::kNegatedIgnoreCaseWordAndSurrogateRanges[] = {
0x0000, 0x002F + 1, 0x003A, 0x0040 + 1, 0x005B, 0x005E + 1, 0x0060, 0x0060 + 1, 0x007B, 0x017E + 1, 0x0180, 0x2129 + 1, 0x212B, 0xD7FF + 1, 0xE000, 0xFFFF + 1, 0xFFFF + 1
};
const int js::irregexp::kNegatedIgnoreCaseWordAndSurrogateRangeCount = 17;
const int js::irregexp::kDigitRanges[] = {
0x0030, 0x0039 + 1, 0xFFFF + 1
};
const int js::irregexp::kDigitRangeCount = 3;
const int js::irregexp::kDigitAndSurrogateRanges[] = {
0x0030, 0x0039 + 1, 0xD800, 0xDFFF + 1, 0xFFFF + 1
};
const int js::irregexp::kDigitAndSurrogateRangeCount = 5;
const int js::irregexp::kSurrogateRanges[] = {
0xD800, 0xDFFF + 1, 0xFFFF + 1
};
const int js::irregexp::kSurrogateRangeCount = 3;
const int js::irregexp::kLineTerminatorRanges[] = {
0x000A, 0x000A + 1, 0x000D, 0x000D + 1, 0x2028, 0x2029 + 1, 0xFFFF + 1
};
const int js::irregexp::kLineTerminatorRangeCount = 7;
const int js::irregexp::kLineTerminatorAndSurrogateRanges[] = {
0x000A, 0x000A + 1, 0x000D, 0x000D + 1, 0x2028, 0x2029 + 1, 0xD800, 0xDFFF + 1, 0xFFFF + 1
};
const int js::irregexp::kLineTerminatorAndSurrogateRangeCount = 9;