|
| 1 | +2017-10-09 Michael Saboff <msaboff@apple.com> |
| 2 | + |
| 3 | + Implement RegExp Unicode property escapes |
| 4 | + https://bugs.webkit.org/show_bug.cgi?id=172069 |
| 5 | + |
| 6 | + Reviewed by JF Bastien. |
| 7 | + |
| 8 | + Added Unicode Properties by extending the existing CharacterClass processing. |
| 9 | + |
| 10 | + Introduced a new Python script, generateYarrUnicodePropertyTables.py, that parses |
| 11 | + Unicode Database files to create character class data. The result is a set of functions |
| 12 | + that return character classes, one for each of the required Unicode properties. |
| 13 | + There are many cases where many properties are handled by one function, primarily due to |
| 14 | + property aliases, but also due to Script_Extension properties that are the same as the |
| 15 | + Script property for the same script value. |
| 16 | + |
| 17 | + Extended the BuiltInCharacterClassID enum so it can be used also for Unicode property |
| 18 | + character classes. Unicode properties are the enum value BaseUnicodePropertyID plus a |
| 19 | + zero based value, that value being the index to the corrensponding character class |
| 20 | + function. The generation script also creates static hashing tables similar to what we |
| 21 | + use for the generated .lut.h lookup table files. These hashing tables map property |
| 22 | + names to the function index. Using these hashing tables, we can lookup a property |
| 23 | + name and if present convert it to a function index. We add that index to |
| 24 | + BaseUnicodePropertyID to create a BuiltInCharacterClassID. |
| 25 | + |
| 26 | + When we do syntax parsing, we convert the property to its corresponding BuiltInCharacterClassID. |
| 27 | + When doing real parsing we takes the returned BuiltInCharacterClassID and use it to get |
| 28 | + the actual character class by calling the corresponding generated function. |
| 29 | + |
| 30 | + Added a new CharacterClass constructor that can take literal arrays for ranges and matches |
| 31 | + to make the creation of large static character classes more efficent. |
| 32 | + |
| 33 | + Since the Unicode character classes typically have more matches and ranges, the character |
| 34 | + class matching in the interpreter has been updated to use binary searching for matches and |
| 35 | + ranges with more than 6 entries. |
| 36 | + |
| 37 | + * CMakeLists.txt: |
| 38 | + * DerivedSources.make: |
| 39 | + * JavaScriptCore.xcodeproj/project.pbxproj: |
| 40 | + * Scripts/generateYarrUnicodePropertyTables.py: Added. |
| 41 | + (openOrExit): |
| 42 | + (openUCDFileOrExit): |
| 43 | + (verifyUCDFilesExist): |
| 44 | + (ceilingToPowerOf2): |
| 45 | + (Aliases): |
| 46 | + (Aliases.__init__): |
| 47 | + (Aliases.parsePropertyAliasesFile): |
| 48 | + (Aliases.parsePropertyValueAliasesFile): |
| 49 | + (Aliases.globalAliasesFor): |
| 50 | + (Aliases.generalCategoryAliasesFor): |
| 51 | + (Aliases.generalCategoryForAlias): |
| 52 | + (Aliases.scriptAliasesFor): |
| 53 | + (Aliases.scriptNameForAlias): |
| 54 | + (PropertyData): |
| 55 | + (PropertyData.__init__): |
| 56 | + (PropertyData.setAliases): |
| 57 | + (PropertyData.makeCopy): |
| 58 | + (PropertyData.getIndex): |
| 59 | + (PropertyData.getCreateFuncName): |
| 60 | + (PropertyData.addMatch): |
| 61 | + (PropertyData.addRange): |
| 62 | + (PropertyData.addMatchUnorderedForMatchesAndRanges): |
| 63 | + (PropertyData.addRangeUnorderedForMatchesAndRanges): |
| 64 | + (PropertyData.addMatchUnordered): |
| 65 | + (PropertyData.addRangeUnordered): |
| 66 | + (PropertyData.removeMatchFromRanges): |
| 67 | + (PropertyData.removeMatch): |
| 68 | + (PropertyData.dumpMatchData): |
| 69 | + (PropertyData.dump): |
| 70 | + (PropertyData.dumpAll): |
| 71 | + (PropertyData.dumpAll.std): |
| 72 | + (PropertyData.createAndDumpHashTable): |
| 73 | + (Scripts): |
| 74 | + (Scripts.__init__): |
| 75 | + (Scripts.parseScriptsFile): |
| 76 | + (Scripts.parseScriptExtensionsFile): |
| 77 | + (Scripts.dump): |
| 78 | + (GeneralCategory): |
| 79 | + (GeneralCategory.__init__): |
| 80 | + (GeneralCategory.createSpecialPropertyData): |
| 81 | + (GeneralCategory.findPropertyGroupFor): |
| 82 | + (GeneralCategory.addNextCodePoints): |
| 83 | + (GeneralCategory.parse): |
| 84 | + (GeneralCategory.dump): |
| 85 | + (BinaryProperty): |
| 86 | + (BinaryProperty.__init__): |
| 87 | + (BinaryProperty.parsePropertyFile): |
| 88 | + (BinaryProperty.dump): |
| 89 | + * Scripts/hasher.py: Added. |
| 90 | + (stringHash): |
| 91 | + * Sources.txt: |
| 92 | + * ucd/DerivedBinaryProperties.txt: Added. |
| 93 | + * ucd/DerivedCoreProperties.txt: Added. |
| 94 | + * ucd/DerivedNormalizationProps.txt: Added. |
| 95 | + * ucd/PropList.txt: Added. |
| 96 | + * ucd/PropertyAliases.txt: Added. |
| 97 | + * ucd/PropertyValueAliases.txt: Added. |
| 98 | + * ucd/ScriptExtensions.txt: Added. |
| 99 | + * ucd/Scripts.txt: Added. |
| 100 | + * ucd/UnicodeData.txt: Added. |
| 101 | + * ucd/emoji-data.txt: Added. |
| 102 | + * yarr/Yarr.h: |
| 103 | + * yarr/YarrInterpreter.cpp: |
| 104 | + (JSC::Yarr::Interpreter::testCharacterClass): |
| 105 | + * yarr/YarrParser.h: |
| 106 | + (JSC::Yarr::Parser::parseEscape): |
| 107 | + (JSC::Yarr::Parser::parseTokens): |
| 108 | + (JSC::Yarr::Parser::isUnicodePropertyValueExpressionChar): |
| 109 | + (JSC::Yarr::Parser::tryConsumeUnicodePropertyExpression): |
| 110 | + * yarr/YarrPattern.cpp: |
| 111 | + (JSC::Yarr::CharacterClassConstructor::appendInverted): |
| 112 | + (JSC::Yarr::YarrPatternConstructor::atomBuiltInCharacterClass): |
| 113 | + (JSC::Yarr::YarrPatternConstructor::atomCharacterClassBuiltIn): |
| 114 | + (JSC::Yarr::YarrPattern::errorMessage): |
| 115 | + (JSC::Yarr::PatternTerm::dump): |
| 116 | + * yarr/YarrPattern.h: |
| 117 | + (JSC::Yarr::CharacterRange::CharacterRange): |
| 118 | + (JSC::Yarr::CharacterClass::CharacterClass): |
| 119 | + (JSC::Yarr::YarrPattern::reset): |
| 120 | + (JSC::Yarr::YarrPattern::unicodeCharacterClassFor): |
| 121 | + * yarr/YarrUnicodeProperties.cpp: Added. |
| 122 | + (JSC::Yarr::HashTable::entry const): |
| 123 | + (JSC::Yarr::unicodeMatchPropertyValue): |
| 124 | + (JSC::Yarr::unicodeMatchProperty): |
| 125 | + (JSC::Yarr::createUnicodeCharacterClassFor): |
| 126 | + * yarr/YarrUnicodeProperties.h: Added. |
| 127 | + |
1 | 128 | 2017-10-09 Commit Queue <commit-queue@webkit.org> |
2 | 129 |
|
3 | 130 | Unreviewed, rolling out r223015 and r223025. |
|
0 commit comments