diff --git a/.eslintrc.js b/.eslintrc.js index 99f7196ffc8158..7f37fc19d5a543 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -16,7 +16,8 @@ const ModuleFindPath = Module._findPath; const hacks = [ 'eslint-plugin-node-core', 'eslint-plugin-markdown', - 'babel-eslint', + '@babel/eslint-parser', + '@babel/plugin-syntax-class-properties', ]; Module._findPath = (request, paths, isMain) => { const r = ModuleFindPath(request, paths, isMain); @@ -37,8 +38,14 @@ Module._findPath = (request, paths, isMain) => { module.exports = { root: true, plugins: ['markdown', 'node-core'], - parser: 'babel-eslint', - parserOptions: { sourceType: 'script' }, + parser: '@babel/eslint-parser', + parserOptions: { + babelOptions: { + plugins: [Module._findPath('@babel/plugin-syntax-class-properties')], + }, + requireConfigFile: false, + sourceType: 'script', + }, overrides: [ { files: [ @@ -150,6 +157,7 @@ module.exports = { 'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 0, maxBOF: 0 }], 'no-new-require': 'error', 'no-new-symbol': 'error', + 'no-nonoctal-decimal-escape': 'error', 'no-obj-calls': 'error', 'no-octal': 'error', 'no-path-concat': 'error', diff --git a/.github/ISSUE_TEMPLATE/1-bug-report.md b/.github/ISSUE_TEMPLATE/1-bug-report.md index 2a2e94d411fe2a..84b6daf665e522 100644 --- a/.github/ISSUE_TEMPLATE/1-bug-report.md +++ b/.github/ISSUE_TEMPLATE/1-bug-report.md @@ -15,7 +15,7 @@ repo. https://github.com/nodejs/help Please fill in as much of the template below as you're able. Version: output of `node -v` -Platform: output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows) +Platform: output of `uname -a` (UNIX), or output of `"$([Environment]::OSVersion | ForEach-Object VersionString) $(if ([Environment]::Is64BitOperatingSystem) { "x64" } else { "x86" })"` in PowerShell console (Windows) Subsystem: if known, please specify affected core module name --> diff --git a/LICENSE b/LICENSE index c5177204b84980..5f905a79a96090 100644 --- a/LICENSE +++ b/LICENSE @@ -418,9 +418,9 @@ The externally maintained libraries used by Node.js are: # Copyright (c) 2013 International Business Machines Corporation # and others. All Rights Reserved. # - # Project: http://code.google.com/p/lao-dictionary/ - # Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt - # License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt + # Project: https://github.com/veer66/lao-dictionary + # Dictionary: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary.txt + # License: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary-LICENSE.txt # (copied below) # # This file is derived from the above dictionary, with slight diff --git a/Makefile b/Makefile index 6379f06a2e0b6d..0c95b7f8904646 100644 --- a/Makefile +++ b/Makefile @@ -979,7 +979,7 @@ $(PKG): release-only --release-urlbase=$(RELEASE_URLBASE) \ $(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS) $(MAKE) install V=$(V) DESTDIR=$(MACOSOUTDIR)/dist/node - SIGN="$(CODESIGN_CERT)" PKGDIR="$(MACOSOUTDIR)/dist/node/usr/local" bash \ + SIGN="$(CODESIGN_CERT)" PKGDIR="$(MACOSOUTDIR)/dist/node/usr/local" sh \ tools/osx-codesign.sh mkdir -p $(MACOSOUTDIR)/dist/npm/usr/local/lib/node_modules mkdir -p $(MACOSOUTDIR)/pkgs @@ -1001,8 +1001,8 @@ $(PKG): release-only productbuild --distribution $(MACOSOUTDIR)/installer/productbuild/distribution.xml \ --resources $(MACOSOUTDIR)/installer/productbuild/Resources \ --package-path $(MACOSOUTDIR)/pkgs ./$(PKG) - SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" bash tools/osx-productsign.sh - bash tools/osx-notarize.sh $(FULLVERSION) + SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" sh tools/osx-productsign.sh + sh tools/osx-notarize.sh $(FULLVERSION) .PHONY: pkg # Builds the macOS installer for releases. @@ -1120,7 +1120,7 @@ $(BINARYTAR): release-only cp LICENSE $(BINARYNAME) cp CHANGELOG.md $(BINARYNAME) ifeq ($(OSTYPE),darwin) - SIGN="$(CODESIGN_CERT)" PKGDIR="$(BINARYNAME)" bash tools/osx-codesign.sh + SIGN="$(CODESIGN_CERT)" PKGDIR="$(BINARYNAME)" sh tools/osx-codesign.sh endif tar -cf $(BINARYNAME).tar $(BINARYNAME) $(RM) -r $(BINARYNAME) @@ -1346,7 +1346,7 @@ lint-py: PYTHONPATH=tools/pip $(PYTHON) -m flake8 --count --show-source --statistics . else lint-py: - $(warning Python linting with flake8 is not avalible) + $(warning Python linting with flake8 is not available) $(warning Run 'make lint-py-build') endif diff --git a/benchmark/child_process/child-process-read-ipc.js b/benchmark/child_process/child-process-read-ipc.js index 827f75b1e54bd1..280505026cd02e 100644 --- a/benchmark/child_process/child-process-read-ipc.js +++ b/benchmark/child_process/child-process-read-ipc.js @@ -13,7 +13,7 @@ if (process.argv[2] === 'child') { const bench = common.createBenchmark(main, { len: [ 64, 256, 1024, 4096, 16384, 65536, - 65536 << 4, 65536 << 8, + 65536 << 4, 65536 << 6 - 1, ], dur: [5] }); diff --git a/benchmark/fs/bench-statSync.js b/benchmark/fs/bench-statSync.js index 0c9366a402cb71..e75d6603fcfc64 100644 --- a/benchmark/fs/bench-statSync.js +++ b/benchmark/fs/bench-statSync.js @@ -21,6 +21,6 @@ function main({ n, statSyncType }) { } bench.end(n); - if (statSyncType === 'fstat') + if (statSyncType === 'fstatSync') fs.closeSync(arg); } diff --git a/deps/icu-small/LICENSE b/deps/icu-small/LICENSE index e7f98ed18391b8..5d664a083b986f 100644 --- a/deps/icu-small/LICENSE +++ b/deps/icu-small/LICENSE @@ -284,9 +284,9 @@ property of their respective owners. # Copyright (c) 2013 International Business Machines Corporation # and others. All Rights Reserved. # - # Project: http://code.google.com/p/lao-dictionary/ - # Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt - # License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt + # Project: https://github.com/veer66/lao-dictionary + # Dictionary: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary.txt + # License: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary-LICENSE.txt # (copied below) # # This file is derived from the above dictionary, with slight diff --git a/deps/icu-small/README-FULL-ICU.txt b/deps/icu-small/README-FULL-ICU.txt index bad8b0346d3e98..df63187d3ae6e4 100644 --- a/deps/icu-small/README-FULL-ICU.txt +++ b/deps/icu-small/README-FULL-ICU.txt @@ -1,8 +1,8 @@ ICU sources - auto generated by shrink-icu-src.py This directory contains the ICU subset used by --with-intl=full-icu -It is a strict subset of ICU 67 source files with the following exception(s): -* deps/icu-small/source/data/in/icudt67l.dat.bz2 : compressed data file +It is a strict subset of ICU 68 source files with the following exception(s): +* deps/icu-small/source/data/in/icudt68l.dat.bz2 : compressed data file To rebuild this directory, see ../../tools/icu/README.md diff --git a/deps/icu-small/source/.clang-format b/deps/icu-small/source/.clang-format new file mode 100644 index 00000000000000..06bd4885a10a21 --- /dev/null +++ b/deps/icu-small/source/.clang-format @@ -0,0 +1,11 @@ +# © 2020 and later: Unicode, Inc. and others. +# License & terms of use: http://www.unicode.org/copyright.html + +--- +Language: Cpp +BasedOnStyle: LLVM +IndentWidth: 4 +ColumnLimit: 105 +AllowShortBlocksOnASingleLine: false +AllowShortIfStatementsOnASingleLine: true +... diff --git a/deps/icu-small/source/common/bmpset.h b/deps/icu-small/source/common/bmpset.h index 018aeb7f95b078..e1982ac669db85 100644 --- a/deps/icu-small/source/common/bmpset.h +++ b/deps/icu-small/source/common/bmpset.h @@ -101,7 +101,7 @@ class BMPSet : public UMemory { */ UBool latin1Contains[0x100]; - /* TRUE if contains(U+FFFD). */ + /* true if contains(U+FFFD). */ UBool containsFFFD; /* diff --git a/deps/icu-small/source/common/brkeng.h b/deps/icu-small/source/common/brkeng.h index e40fce13f64b8a..155433b89a86ac 100644 --- a/deps/icu-small/source/common/brkeng.h +++ b/deps/icu-small/source/common/brkeng.h @@ -54,7 +54,7 @@ class LanguageBreakEngine : public UMemory { * a particular kind of break.

* * @param c A character which begins a run that the engine might handle - * @return TRUE if this engine handles the particular character and break + * @return true if this engine handles the particular character and break * type. */ virtual UBool handles(UChar32 c) const = 0; @@ -171,7 +171,7 @@ class UnhandledEngine : public LanguageBreakEngine { * a particular kind of break.

* * @param c A character which begins a run that the engine might handle - * @return TRUE if this engine handles the particular character and break + * @return true if this engine handles the particular character and break * type. */ virtual UBool handles(UChar32 c) const; diff --git a/deps/icu-small/source/common/bytesinkutil.h b/deps/icu-small/source/common/bytesinkutil.h index 6808fbe6777837..ab2516432d3111 100644 --- a/deps/icu-small/source/common/bytesinkutil.h +++ b/deps/icu-small/source/common/bytesinkutil.h @@ -45,9 +45,9 @@ class U_COMMON_API ByteSinkUtil { static UBool appendUnchanged(const uint8_t *s, int32_t length, ByteSink &sink, uint32_t options, Edits *edits, UErrorCode &errorCode) { - if (U_FAILURE(errorCode)) { return FALSE; } + if (U_FAILURE(errorCode)) { return false; } if (length > 0) { appendNonEmptyUnchanged(s, length, sink, options, edits); } - return TRUE; + return true; } static UBool appendUnchanged(const uint8_t *s, const uint8_t *limit, diff --git a/deps/icu-small/source/common/charstr.cpp b/deps/icu-small/source/common/charstr.cpp index dda29dac63273c..318a185b3f1d64 100644 --- a/deps/icu-small/source/common/charstr.cpp +++ b/deps/icu-small/source/common/charstr.cpp @@ -20,6 +20,7 @@ #include "cmemory.h" #include "cstring.h" #include "uinvchar.h" +#include "ustr_imp.h" U_NAMESPACE_BEGIN @@ -46,6 +47,19 @@ char *CharString::cloneData(UErrorCode &errorCode) const { return p; } +int32_t CharString::extract(char *dest, int32_t capacity, UErrorCode &errorCode) const { + if (U_FAILURE(errorCode)) { return len; } + if (capacity < 0 || (capacity > 0 && dest == nullptr)) { + errorCode = U_ILLEGAL_ARGUMENT_ERROR; + return len; + } + const char *src = buffer.getAlias(); + if (0 < len && len <= capacity && src != dest) { + uprv_memcpy(dest, src, len); + } + return u_terminateChars(dest, capacity, len, &errorCode); +} + CharString &CharString::copyFrom(const CharString &s, UErrorCode &errorCode) { if(U_SUCCESS(errorCode) && this!=&s && ensureCapacity(s.len+1, 0, errorCode)) { len=s.len; @@ -197,7 +211,7 @@ CharString &CharString::appendPathPart(StringPiece s, UErrorCode &errorCode) { } char c; if(len>0 && (c=buffer[len-1])!=U_FILE_SEP_CHAR && c!=U_FILE_ALT_SEP_CHAR) { - append(U_FILE_SEP_CHAR, errorCode); + append(getDirSepChar(), errorCode); } append(s, errorCode); return *this; @@ -207,9 +221,19 @@ CharString &CharString::ensureEndsWithFileSeparator(UErrorCode &errorCode) { char c; if(U_SUCCESS(errorCode) && len>0 && (c=buffer[len-1])!=U_FILE_SEP_CHAR && c!=U_FILE_ALT_SEP_CHAR) { - append(U_FILE_SEP_CHAR, errorCode); + append(getDirSepChar(), errorCode); } return *this; } +char CharString::getDirSepChar() const { + char dirSepChar = U_FILE_SEP_CHAR; +#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR) + // We may need to return a different directory separator when building for Cygwin or MSYS2. + if(len>0 && !uprv_strchr(data(), U_FILE_SEP_CHAR) && uprv_strchr(data(), U_FILE_ALT_SEP_CHAR)) + dirSepChar = U_FILE_ALT_SEP_CHAR; +#endif + return dirSepChar; +} + U_NAMESPACE_END diff --git a/deps/icu-small/source/common/charstr.h b/deps/icu-small/source/common/charstr.h index 23b950ed6ecc76..6619faac618193 100644 --- a/deps/icu-small/source/common/charstr.h +++ b/deps/icu-small/source/common/charstr.h @@ -87,6 +87,22 @@ class U_COMMON_API CharString : public UMemory { * The caller must uprv_free() the result. */ char *cloneData(UErrorCode &errorCode) const; + /** + * Copies the contents of the string into dest. + * Checks if there is enough space in dest, extracts the entire string if possible, + * and NUL-terminates dest if possible. + * + * If the string fits into dest but cannot be NUL-terminated (length()==capacity), + * then the error code is set to U_STRING_NOT_TERMINATED_WARNING. + * If the string itself does not fit into dest (length()>capacity), + * then the error code is set to U_BUFFER_OVERFLOW_ERROR. + * + * @param dest Destination string buffer. + * @param capacity Size of the dest buffer (number of chars). + * @param errorCode ICU error code. + * @return length() + */ + int32_t extract(char *dest, int32_t capacity, UErrorCode &errorCode) const; bool operator==(StringPiece other) const { return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0); @@ -141,13 +157,13 @@ class U_COMMON_API CharString : public UMemory { /** * Appends a filename/path part, e.g., a directory name. - * First appends a U_FILE_SEP_CHAR if necessary. + * First appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if necessary. * Does nothing if s is empty. */ CharString &appendPathPart(StringPiece s, UErrorCode &errorCode); /** - * Appends a U_FILE_SEP_CHAR if this string is not empty + * Appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if this string is not empty * and does not already end with a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR. */ CharString &ensureEndsWithFileSeparator(UErrorCode &errorCode); @@ -160,6 +176,12 @@ class U_COMMON_API CharString : public UMemory { CharString(const CharString &other); // forbid copying of this class CharString &operator=(const CharString &other); // forbid copying of this class + + /** + * Returns U_FILE_ALT_SEP_CHAR if found in string, and U_FILE_SEP_CHAR is not found. + * Otherwise returns U_FILE_SEP_CHAR. + */ + char getDirSepChar() const; }; U_NAMESPACE_END diff --git a/deps/icu-small/source/common/charstrmap.h b/deps/icu-small/source/common/charstrmap.h new file mode 100644 index 00000000000000..3320a4620852ce --- /dev/null +++ b/deps/icu-small/source/common/charstrmap.h @@ -0,0 +1,55 @@ +// © 2020 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// charstrmap.h +// created: 2020sep01 Frank Yung-Fong Tang + +#ifndef __CHARSTRMAP_H__ +#define __CHARSTRMAP_H__ + +#include +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "uhash.h" + +U_NAMESPACE_BEGIN + +/** + * Map of const char * keys & values. + * Stores pointers as is: Does not own/copy/adopt/release strings. + */ +class CharStringMap final : public UMemory { +public: + /** Constructs an unusable non-map. */ + CharStringMap() : map(nullptr) {} + CharStringMap(int32_t size, UErrorCode &errorCode) { + map = uhash_openSize(uhash_hashChars, uhash_compareChars, uhash_compareChars, + size, &errorCode); + } + CharStringMap(CharStringMap &&other) U_NOEXCEPT : map(other.map) { + other.map = nullptr; + } + CharStringMap(const CharStringMap &other) = delete; + ~CharStringMap() { + uhash_close(map); + } + + CharStringMap &operator=(CharStringMap &&other) U_NOEXCEPT { + map = other.map; + other.map = nullptr; + return *this; + } + CharStringMap &operator=(const CharStringMap &other) = delete; + + const char *get(const char *key) const { return static_cast(uhash_get(map, key)); } + void put(const char *key, const char *value, UErrorCode &errorCode) { + uhash_put(map, const_cast(key), const_cast(value), &errorCode); + } + +private: + UHashtable *map; +}; + +U_NAMESPACE_END + +#endif // __CHARSTRMAP_H__ diff --git a/deps/icu-small/source/common/cmemory.h b/deps/icu-small/source/common/cmemory.h index 38f99179631b10..b5e0c2b7a17296 100644 --- a/deps/icu-small/source/common/cmemory.h +++ b/deps/icu-small/source/common/cmemory.h @@ -292,14 +292,21 @@ class MaybeStackArray { /** * Default constructor initializes with internal T[stackCapacity] buffer. */ - MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(FALSE) {} + MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} /** * Automatically allocates the heap array if the argument is larger than the stack capacity. * Intended for use when an approximate capacity is known at compile time but the true * capacity is not known until runtime. */ - MaybeStackArray(int32_t newCapacity) : MaybeStackArray() { - if (capacity < newCapacity) { resize(newCapacity); } + MaybeStackArray(int32_t newCapacity, UErrorCode status) : MaybeStackArray() { + if (U_FAILURE(status)) { + return; + } + if (capacity < newCapacity) { + if (resize(newCapacity) == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + } + } } /** * Destructor deletes the array (if owned). @@ -355,7 +362,7 @@ class MaybeStackArray { releaseArray(); ptr=otherArray; capacity=otherCapacity; - needToRelease=FALSE; + needToRelease=false; } } /** @@ -380,6 +387,20 @@ class MaybeStackArray { * caller becomes responsible for deleting the array */ inline T *orphanOrClone(int32_t length, int32_t &resultCapacity); + +protected: + // Resizes the array to the size of src, then copies the contents of src. + void copyFrom(const MaybeStackArray &src, UErrorCode &status) { + if (U_FAILURE(status)) { + return; + } + if (this->resize(src.capacity, 0) == NULL) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + uprv_memcpy(this->ptr, src.ptr, (size_t)capacity * sizeof(T)); + } + private: T *ptr; int32_t capacity; @@ -393,14 +414,14 @@ class MaybeStackArray { void resetToStackArray() { ptr=stackArray; capacity=stackCapacity; - needToRelease=FALSE; + needToRelease=false; } /* No comparison operators with other MaybeStackArray's. */ - bool operator==(const MaybeStackArray & /*other*/) {return FALSE;} - bool operator!=(const MaybeStackArray & /*other*/) {return TRUE;} + bool operator==(const MaybeStackArray & /*other*/) = delete; + bool operator!=(const MaybeStackArray & /*other*/) = delete; /* No ownership transfer: No copy constructor, no assignment operator. */ - MaybeStackArray(const MaybeStackArray & /*other*/) {} - void operator=(const MaybeStackArray & /*other*/) {} + MaybeStackArray(const MaybeStackArray & /*other*/) = delete; + void operator=(const MaybeStackArray & /*other*/) = delete; }; template @@ -435,7 +456,7 @@ template inline T *MaybeStackArray::resize(int32_t newCapacity, int32_t length) { if(newCapacity>0) { #if U_DEBUG && defined(UPRV_MALLOC_COUNT) - ::fprintf(::stderr,"MaybeStacArray (resize) alloc %d * %lu\n", newCapacity,sizeof(T)); + ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); #endif T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); if(p!=NULL) { @@ -451,7 +472,7 @@ inline T *MaybeStackArray::resize(int32_t newCapacity, int32_t releaseArray(); ptr=p; capacity=newCapacity; - needToRelease=TRUE; + needToRelease=true; } return p; } else { @@ -507,7 +528,7 @@ class MaybeStackHeaderAndArray { /** * Default constructor initializes with internal H+T[stackCapacity] buffer. */ - MaybeStackHeaderAndArray() : ptr(&stackHeader), capacity(stackCapacity), needToRelease(FALSE) {} + MaybeStackHeaderAndArray() : ptr(&stackHeader), capacity(stackCapacity), needToRelease(false) {} /** * Destructor deletes the memory (if owned). */ @@ -556,7 +577,7 @@ class MaybeStackHeaderAndArray { releaseMemory(); ptr=otherMemory; capacity=otherCapacity; - needToRelease=FALSE; + needToRelease=false; } } /** @@ -595,8 +616,8 @@ class MaybeStackHeaderAndArray { } } /* No comparison operators with other MaybeStackHeaderAndArray's. */ - bool operator==(const MaybeStackHeaderAndArray & /*other*/) {return FALSE;} - bool operator!=(const MaybeStackHeaderAndArray & /*other*/) {return TRUE;} + bool operator==(const MaybeStackHeaderAndArray & /*other*/) {return false;} + bool operator!=(const MaybeStackHeaderAndArray & /*other*/) {return true;} /* No ownership transfer: No copy constructor, no assignment operator. */ MaybeStackHeaderAndArray(const MaybeStackHeaderAndArray & /*other*/) {} void operator=(const MaybeStackHeaderAndArray & /*other*/) {} @@ -625,7 +646,7 @@ inline H *MaybeStackHeaderAndArray::resize(int32_t newCapac releaseMemory(); ptr=p; capacity=newCapacity; - needToRelease=TRUE; + needToRelease=true; } return p; } else { @@ -657,7 +678,7 @@ inline H *MaybeStackHeaderAndArray::orphanOrClone(int32_t l resultCapacity=length; ptr=&stackHeader; capacity=stackCapacity; - needToRelease=FALSE; + needToRelease=false; return p; } @@ -728,6 +749,18 @@ class MemoryPool : public UMemory { return fPool[fCount++] = new T(std::forward(args)...); } + template + T* createAndCheckErrorCode(UErrorCode &status, Args &&... args) { + if (U_FAILURE(status)) { + return nullptr; + } + T *pointer = this->create(args...); + if (U_SUCCESS(status) && pointer == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + } + return pointer; + } + /** * @return Number of elements that have been allocated. */ @@ -771,6 +804,11 @@ class MaybeStackVector : protected MemoryPool { return this->create(args...); } + template + T *emplaceBackAndCheckErrorCode(UErrorCode &status, Args &&... args) { + return this->createAndCheckErrorCode(status, args...); + } + int32_t length() const { return this->fCount; } @@ -779,6 +817,10 @@ class MaybeStackVector : protected MemoryPool { return this->fPool.getAlias(); } + const T *const *getAlias() const { + return this->fPool.getAlias(); + } + /** * Array item access (read-only). * No index bounds check. @@ -798,19 +840,6 @@ class MaybeStackVector : protected MemoryPool { T* operator[](ptrdiff_t i) { return this->fPool[i]; } - - /** - * Append all the items from another MaybeStackVector to this one. - */ - void appendAll(const MaybeStackVector& other, UErrorCode& status) { - for (int32_t i = 0; i < other.fCount; i++) { - T* item = emplaceBack(*other[i]); - if (!item) { - status = U_MEMORY_ALLOCATION_ERROR; - return; - } - } - } }; diff --git a/deps/icu-small/source/common/dictbe.h b/deps/icu-small/source/common/dictbe.h index 99d176cc2e7bcf..246c1dc6935fbd 100644 --- a/deps/icu-small/source/common/dictbe.h +++ b/deps/icu-small/source/common/dictbe.h @@ -59,7 +59,7 @@ class DictionaryBreakEngine : public LanguageBreakEngine { * a particular kind of break.

* * @param c A character which begins a run that the engine might handle - * @return TRUE if this engine handles the particular character and break + * @return true if this engine handles the particular character and break * type. */ virtual UBool handles(UChar32 c) const; diff --git a/deps/icu-small/source/common/icuplug.cpp b/deps/icu-small/source/common/icuplug.cpp index c3c8231b77d572..944df5465d0dd2 100644 --- a/deps/icu-small/source/common/icuplug.cpp +++ b/deps/icu-small/source/common/icuplug.cpp @@ -145,7 +145,7 @@ static int32_t searchForLibrary(void *lib) { return -1; } -U_INTERNAL char * U_EXPORT2 +U_CAPI char * U_EXPORT2 uplug_findLibrary(void *lib, UErrorCode *status) { int32_t libEnt; char *ret = NULL; @@ -161,7 +161,7 @@ uplug_findLibrary(void *lib, UErrorCode *status) { return ret; } -U_INTERNAL void * U_EXPORT2 +U_CAPI void * U_EXPORT2 uplug_openLibrary(const char *libName, UErrorCode *status) { int32_t libEntry = -1; void *lib = NULL; @@ -209,7 +209,7 @@ uplug_openLibrary(const char *libName, UErrorCode *status) { return lib; } -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uplug_closeLibrary(void *lib, UErrorCode *status) { int32_t i; @@ -507,7 +507,7 @@ uplug_getConfiguration(UPlugData *data) { return data->config; } -U_INTERNAL UPlugData* U_EXPORT2 +U_CAPI UPlugData* U_EXPORT2 uplug_getPlugInternal(int32_t n) { if(n <0 || n >= pluginCount) { return NULL; @@ -707,7 +707,7 @@ static void uplug_loadWaitingPlugs(UErrorCode *status) { static char plugin_file[2048] = ""; #endif -U_INTERNAL const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uplug_getPluginFile() { #if U_ENABLE_DYLOAD && !UCONFIG_NO_FILE_IO return plugin_file; @@ -782,7 +782,7 @@ uplug_init(UErrorCode *status) { /* plugin_file is not used for processing - it is only used so that uplug_getPluginFile() works (i.e. icuinfo) */ - uprv_strncpy(plugin_file, pluginFile.data(), sizeof(plugin_file)); + pluginFile.extract(plugin_file, sizeof(plugin_file), *status); #if UPLUG_TRACE DBG((stderr, "pluginfile= %s len %d/%d\n", plugin_file, (int)strlen(plugin_file), (int)sizeof(plugin_file))); diff --git a/deps/icu-small/source/common/icuplugimp.h b/deps/icu-small/source/common/icuplugimp.h index 282c639b40e271..712fdb236fde35 100644 --- a/deps/icu-small/source/common/icuplugimp.h +++ b/deps/icu-small/source/common/icuplugimp.h @@ -36,7 +36,7 @@ * @return the library pointer, or NULL * @internal internal use only */ -U_INTERNAL void * U_EXPORT2 +U_CAPI void * U_EXPORT2 uplug_openLibrary(const char *libName, UErrorCode *status); /** @@ -45,7 +45,7 @@ uplug_openLibrary(const char *libName, UErrorCode *status); * @param status error code * @internal internal use only */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uplug_closeLibrary(void *lib, UErrorCode *status); /** @@ -55,7 +55,7 @@ uplug_closeLibrary(void *lib, UErrorCode *status); * @return the library name, or NULL if not found. * @internal internal use only */ -U_INTERNAL char * U_EXPORT2 +U_CAPI char * U_EXPORT2 uplug_findLibrary(void *lib, UErrorCode *status); /** @} */ @@ -69,21 +69,21 @@ uplug_findLibrary(void *lib, UErrorCode *status); * @param status error result * @internal - Internal use only. */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uplug_init(UErrorCode *status); /** * Get raw plug N * @internal - Internal use only */ -U_INTERNAL UPlugData* U_EXPORT2 +U_CAPI UPlugData* U_EXPORT2 uplug_getPlugInternal(int32_t n); /** * Get the name of the plugin file. * @internal - Internal use only. */ -U_INTERNAL const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uplug_getPluginFile(void); /** @} */ diff --git a/deps/icu-small/source/common/localematcher.cpp b/deps/icu-small/source/common/localematcher.cpp index 85db8c8bf3246d..5795cbf87e633a 100644 --- a/deps/icu-small/source/common/localematcher.cpp +++ b/deps/icu-small/source/common/localematcher.cpp @@ -1,12 +1,9 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // localematcher.cpp // created: 2019may08 Markus W. Scherer -#ifndef __LOCMATCHER_H__ -#define __LOCMATCHER_H__ - #include "unicode/utypes.h" #include "unicode/localebuilder.h" #include "unicode/localematcher.h" @@ -131,6 +128,7 @@ LocaleMatcher::Builder::Builder(LocaleMatcher::Builder &&src) U_NOEXCEPT : thresholdDistance_(src.thresholdDistance_), demotion_(src.demotion_), defaultLocale_(src.defaultLocale_), + withDefault_(src.withDefault_), favor_(src.favor_), direction_(src.direction_) { src.supportedLocales_ = nullptr; @@ -140,6 +138,8 @@ LocaleMatcher::Builder::Builder(LocaleMatcher::Builder &&src) U_NOEXCEPT : LocaleMatcher::Builder::~Builder() { delete supportedLocales_; delete defaultLocale_; + delete maxDistanceDesired_; + delete maxDistanceSupported_; } LocaleMatcher::Builder &LocaleMatcher::Builder::operator=(LocaleMatcher::Builder &&src) U_NOEXCEPT { @@ -150,6 +150,7 @@ LocaleMatcher::Builder &LocaleMatcher::Builder::operator=(LocaleMatcher::Builder thresholdDistance_ = src.thresholdDistance_; demotion_ = src.demotion_; defaultLocale_ = src.defaultLocale_; + withDefault_ = src.withDefault_, favor_ = src.favor_; direction_ = src.direction_; @@ -229,6 +230,14 @@ LocaleMatcher::Builder &LocaleMatcher::Builder::addSupportedLocale(const Locale return *this; } +LocaleMatcher::Builder &LocaleMatcher::Builder::setNoDefaultLocale() { + if (U_FAILURE(errorCode_)) { return *this; } + delete defaultLocale_; + defaultLocale_ = nullptr; + withDefault_ = false; + return *this; +} + LocaleMatcher::Builder &LocaleMatcher::Builder::setDefaultLocale(const Locale *defaultLocale) { if (U_FAILURE(errorCode_)) { return *this; } Locale *clone = nullptr; @@ -241,6 +250,7 @@ LocaleMatcher::Builder &LocaleMatcher::Builder::setDefaultLocale(const Locale *d } delete defaultLocale_; defaultLocale_ = clone; + withDefault_ = true; return *this; } @@ -256,6 +266,24 @@ LocaleMatcher::Builder &LocaleMatcher::Builder::setDemotionPerDesiredLocale(ULoc return *this; } +LocaleMatcher::Builder &LocaleMatcher::Builder::setMaxDistance(const Locale &desired, + const Locale &supported) { + if (U_FAILURE(errorCode_)) { return *this; } + Locale *desiredClone = desired.clone(); + Locale *supportedClone = supported.clone(); + if (desiredClone == nullptr || supportedClone == nullptr) { + delete desiredClone; // in case only one could not be allocated + delete supportedClone; + errorCode_ = U_MEMORY_ALLOCATION_ERROR; + return *this; + } + delete maxDistanceDesired_; + delete maxDistanceSupported_; + maxDistanceDesired_ = desiredClone; + maxDistanceSupported_ = supportedClone; + return *this; +} + #if 0 /** * Internal only! @@ -340,9 +368,6 @@ LocaleMatcher::LocaleMatcher(const Builder &builder, UErrorCode &errorCode) : supportedLSRs(nullptr), supportedIndexes(nullptr), supportedLSRsLength(0), ownedDefaultLocale(nullptr), defaultLocale(nullptr) { if (U_FAILURE(errorCode)) { return; } - if (thresholdDistance < 0) { - thresholdDistance = localeDistance.getDefaultScriptDistance(); - } const Locale *def = builder.defaultLocale_; LSR builderDefaultLSR; const LSR *defLSR = nullptr; @@ -408,22 +433,20 @@ LocaleMatcher::LocaleMatcher(const Builder &builder, UErrorCode &errorCode) : int32_t suppLength = 0; // Determine insertion order. // Add locales immediately that are equivalent to the default. - MaybeStackArray order(supportedLocalesLength); - if (order.getAlias() == nullptr) { - errorCode = U_MEMORY_ALLOCATION_ERROR; - return; - } + MaybeStackArray order(supportedLocalesLength, errorCode); + if (U_FAILURE(errorCode)) { return; } int32_t numParadigms = 0; for (int32_t i = 0; i < supportedLocalesLength; ++i) { const Locale &locale = *supportedLocales[i]; const LSR &lsr = lsrs[i]; - if (defLSR == nullptr) { + if (defLSR == nullptr && builder.withDefault_) { + // Implicit default locale = first supported locale, if not turned off. U_ASSERT(i == 0); def = &locale; defLSR = &lsr; order[i] = 1; suppLength = putIfAbsent(lsr, 0, suppLength, errorCode); - } else if (lsr.isEquivalentTo(*defLSR)) { + } else if (defLSR != nullptr && lsr.isEquivalentTo(*defLSR)) { order[i] = 1; suppLength = putIfAbsent(lsr, i, suppLength, errorCode); } else if (localeDistance.isParadigmLSR(lsr)) { @@ -458,6 +481,25 @@ LocaleMatcher::LocaleMatcher(const Builder &builder, UErrorCode &errorCode) : if (builder.demotion_ == ULOCMATCH_DEMOTION_REGION) { demotionPerDesiredLocale = localeDistance.getDefaultDemotionPerDesiredLocale(); } + + if (thresholdDistance >= 0) { + // already copied + } else if (builder.maxDistanceDesired_ != nullptr) { + LSR suppLSR = getMaximalLsrOrUnd(likelySubtags, *builder.maxDistanceSupported_, errorCode); + const LSR *pSuppLSR = &suppLSR; + int32_t indexAndDistance = localeDistance.getBestIndexAndDistance( + getMaximalLsrOrUnd(likelySubtags, *builder.maxDistanceDesired_, errorCode), + &pSuppLSR, 1, + LocaleDistance::shiftDistance(100), favorSubtag, direction); + if (U_SUCCESS(errorCode)) { + // +1 for an exclusive threshold from an inclusive max. + thresholdDistance = LocaleDistance::getDistanceFloor(indexAndDistance) + 1; + } else { + thresholdDistance = 0; + } + } else { + thresholdDistance = localeDistance.getDefaultScriptDistance(); + } } LocaleMatcher::LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT : @@ -683,6 +725,18 @@ int32_t LocaleMatcher::getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remai return supportedIndexes[bestSupportedLsrIndex]; } +UBool LocaleMatcher::isMatch(const Locale &desired, const Locale &supported, + UErrorCode &errorCode) const { + LSR suppLSR = getMaximalLsrOrUnd(likelySubtags, supported, errorCode); + if (U_FAILURE(errorCode)) { return 0; } + const LSR *pSuppLSR = &suppLSR; + int32_t indexAndDistance = localeDistance.getBestIndexAndDistance( + getMaximalLsrOrUnd(likelySubtags, desired, errorCode), + &pSuppLSR, 1, + LocaleDistance::shiftDistance(thresholdDistance), favorSubtag, direction); + return indexAndDistance >= 0; +} + double LocaleMatcher::internalMatch(const Locale &desired, const Locale &supported, UErrorCode &errorCode) const { // Returns the inverse of the distance: That is, 1-distance(desired, supported). LSR suppLSR = getMaximalLsrOrUnd(likelySubtags, supported, errorCode); @@ -790,5 +844,3 @@ uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, return acceptLanguage(*availableLocales, desiredLocales, result, resultAvailable, outResult, *status); } - -#endif // __LOCMATCHER_H__ diff --git a/deps/icu-small/source/common/localeprioritylist.cpp b/deps/icu-small/source/common/localeprioritylist.cpp index cee408269c9b39..8916b121be3057 100644 --- a/deps/icu-small/source/common/localeprioritylist.cpp +++ b/deps/icu-small/source/common/localeprioritylist.cpp @@ -1,5 +1,5 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // localeprioritylist.cpp // created: 2019jul11 Markus W. Scherer diff --git a/deps/icu-small/source/common/localeprioritylist.h b/deps/icu-small/source/common/localeprioritylist.h index 80ca38a7b52892..41e9d3ea081f56 100644 --- a/deps/icu-small/source/common/localeprioritylist.h +++ b/deps/icu-small/source/common/localeprioritylist.h @@ -1,5 +1,5 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // localeprioritylist.h // created: 2019jul11 Markus W. Scherer diff --git a/deps/icu-small/source/common/locdispnames.cpp b/deps/icu-small/source/common/locdispnames.cpp index 7216a3a3083e3d..a60dd0c9c1ffa7 100644 --- a/deps/icu-small/source/common/locdispnames.cpp +++ b/deps/icu-small/source/common/locdispnames.cpp @@ -26,6 +26,8 @@ #include "unicode/uloc.h" #include "unicode/ures.h" #include "unicode/ustring.h" +#include "bytesinkutil.h" +#include "charstr.h" #include "cmemory.h" #include "cstring.h" #include "putilimp.h" @@ -406,20 +408,26 @@ uloc_getDisplayScript(const char* locale, UChar *dest, int32_t destCapacity, UErrorCode *pErrorCode) { - UErrorCode err = U_ZERO_ERROR; - int32_t res = _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity, + UErrorCode err = U_ZERO_ERROR; + int32_t res = _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity, uloc_getScript, _kScriptsStandAlone, &err); - if ( err == U_USING_DEFAULT_WARNING ) { + if (destCapacity == 0 && err == U_BUFFER_OVERFLOW_ERROR) { + // For preflight, return the max of the value and the fallback. + int32_t fallback_res = _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity, + uloc_getScript, _kScripts, pErrorCode); + return (fallback_res > res) ? fallback_res : res; + } + if ( err == U_USING_DEFAULT_WARNING ) { return _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity, - uloc_getScript, _kScripts, pErrorCode); - } else { - *pErrorCode = err; - return res; - } + uloc_getScript, _kScripts, pErrorCode); + } else { + *pErrorCode = err; + return res; + } } -U_INTERNAL int32_t U_EXPORT2 +static int32_t uloc_getDisplayScriptInContext(const char* locale, const char* displayLocale, UChar *dest, int32_t destCapacity, @@ -727,7 +735,7 @@ uloc_getDisplayName(const char *locale, int32_t padLen; patPos+=subLen; padLen=(subi==0 ? sub1Pos : patLen)-patPos; - if(length+padLen < destCapacity) { + if(length+padLen <= destCapacity) { p=dest+length; for(int32_t i=0;i> DISTANCE_SHIFT; + } + static int32_t getIndex(int32_t indexAndDistance) { // assert indexAndDistance >= 0; return indexAndDistance >> INDEX_SHIFT; @@ -79,10 +83,6 @@ class LocaleDistance final : public UMemory { // tic constexpr int32_t MAX_INDEX = 0x1fffff; // avoids sign bit static constexpr int32_t INDEX_NEG_1 = 0xfffffc00; - static int32_t getDistanceFloor(int32_t indexAndDistance) { - return (indexAndDistance & DISTANCE_MASK) >> DISTANCE_SHIFT; - } - LocaleDistance(const LocaleDistanceData &data, const XLikelySubtags &likely); LocaleDistance(const LocaleDistance &other) = delete; LocaleDistance &operator=(const LocaleDistance &other) = delete; diff --git a/deps/icu-small/source/common/locid.cpp b/deps/icu-small/source/common/locid.cpp index 753a452120ee62..2804e36bf62cb1 100644 --- a/deps/icu-small/source/common/locid.cpp +++ b/deps/icu-small/source/common/locid.cpp @@ -42,6 +42,7 @@ #include "bytesinkutil.h" #include "charstr.h" +#include "charstrmap.h" #include "cmemory.h" #include "cstring.h" #include "mutex.h" @@ -51,7 +52,9 @@ #include "uhash.h" #include "ulocimp.h" #include "umutex.h" +#include "uniquecharstr.h" #include "ustr_imp.h" +#include "uvector.h" U_CDECL_BEGIN static UBool U_CALLCONV locale_cleanup(void); @@ -102,12 +105,6 @@ typedef enum ELocalePos { eMAX_LOCALES } ELocalePos; -U_CFUNC int32_t locale_getKeywords(const char *localeID, - char prev, - char *keywords, int32_t keywordCapacity, - UBool valuesToo, - UErrorCode *status); - U_CDECL_BEGIN // // Deleter function for Locales owned by the default Locale hash table/ @@ -252,6 +249,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Locale) // '_' // In the platform codepage. #define SEP_CHAR '_' +#define NULL_CHAR '\0' Locale::~Locale() { @@ -506,38 +504,1127 @@ Locale::operator==( const Locale& other) const return (uprv_strcmp(other.fullName, fullName) == 0); } -#define ISASCIIALPHA(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z')) - namespace { -CharString& AppendLSCVE(CharString& out, const char* language, const char* script, - const char* country, const char* variants, const char* extension, - UErrorCode& status) { +UInitOnce gKnownCanonicalizedInitOnce = U_INITONCE_INITIALIZER; +UHashtable *gKnownCanonicalized = nullptr; + +static const char* const KNOWN_CANONICALIZED[] = { + "c", + // Commonly used locales known are already canonicalized + "af", "af_ZA", "am", "am_ET", "ar", "ar_001", "as", "as_IN", "az", "az_AZ", + "be", "be_BY", "bg", "bg_BG", "bn", "bn_IN", "bs", "bs_BA", "ca", "ca_ES", + "cs", "cs_CZ", "cy", "cy_GB", "da", "da_DK", "de", "de_DE", "el", "el_GR", + "en", "en_GB", "en_US", "es", "es_419", "es_ES", "et", "et_EE", "eu", + "eu_ES", "fa", "fa_IR", "fi", "fi_FI", "fil", "fil_PH", "fr", "fr_FR", + "ga", "ga_IE", "gl", "gl_ES", "gu", "gu_IN", "he", "he_IL", "hi", "hi_IN", + "hr", "hr_HR", "hu", "hu_HU", "hy", "hy_AM", "id", "id_ID", "is", "is_IS", + "it", "it_IT", "ja", "ja_JP", "jv", "jv_ID", "ka", "ka_GE", "kk", "kk_KZ", + "km", "km_KH", "kn", "kn_IN", "ko", "ko_KR", "ky", "ky_KG", "lo", "lo_LA", + "lt", "lt_LT", "lv", "lv_LV", "mk", "mk_MK", "ml", "ml_IN", "mn", "mn_MN", + "mr", "mr_IN", "ms", "ms_MY", "my", "my_MM", "nb", "nb_NO", "ne", "ne_NP", + "nl", "nl_NL", "or", "or_IN", "pa", "pa_IN", "pl", "pl_PL", "ps", "ps_AF", + "pt", "pt_BR", "pt_PT", "ro", "ro_RO", "ru", "ru_RU", "sd", "sd_IN", "si", + "si_LK", "sk", "sk_SK", "sl", "sl_SI", "so", "so_SO", "sq", "sq_AL", "sr", + "sr_Cyrl_RS", "sr_Latn", "sr_RS", "sv", "sv_SE", "sw", "sw_TZ", "ta", + "ta_IN", "te", "te_IN", "th", "th_TH", "tk", "tk_TM", "tr", "tr_TR", "uk", + "uk_UA", "ur", "ur_PK", "uz", "uz_UZ", "vi", "vi_VN", "yue", "yue_Hant", + "yue_Hant_HK", "yue_HK", "zh", "zh_CN", "zh_Hans", "zh_Hans_CN", "zh_Hant", + "zh_Hant_TW", "zh_TW", "zu", "zu_ZA" +}; + +static UBool U_CALLCONV cleanupKnownCanonicalized() { + gKnownCanonicalizedInitOnce.reset(); + if (gKnownCanonicalized) { uhash_close(gKnownCanonicalized); } + return TRUE; +} + +static void U_CALLCONV loadKnownCanonicalized(UErrorCode &status) { + ucln_common_registerCleanup(UCLN_COMMON_LOCALE_KNOWN_CANONICALIZED, + cleanupKnownCanonicalized); + LocalUHashtablePointer newKnownCanonicalizedMap( + uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &status)); + for (int32_t i = 0; + U_SUCCESS(status) && i < UPRV_LENGTHOF(KNOWN_CANONICALIZED); + i++) { + uhash_puti(newKnownCanonicalizedMap.getAlias(), + (void*)KNOWN_CANONICALIZED[i], + 1, &status); + } + if (U_FAILURE(status)) { + return; + } + + gKnownCanonicalized = newKnownCanonicalizedMap.orphan(); +} + +class AliasData; + +/** + * A Builder class to build the alias data. + */ +class AliasDataBuilder { +public: + AliasDataBuilder() { + } + + // Build the AliasData from resource. + AliasData* build(UErrorCode &status); + +private: + void readAlias(UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, + void (*checkType)(const char* type), + void (*checkReplacement)(const UnicodeString& replacement), + UErrorCode &status); + + // Read the languageAlias data from alias to + // strings+types+replacementIndexes + // The number of record will be stored into length. + // Allocate length items for types, to store the type field. + // Allocate length items for replacementIndexes, + // to store the index in the strings for the replacement script. + void readLanguageAlias(UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, + UErrorCode &status); + + // Read the scriptAlias data from alias to + // strings+types+replacementIndexes + // Allocate length items for types, to store the type field. + // Allocate length items for replacementIndexes, + // to store the index in the strings for the replacement script. + void readScriptAlias(UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, UErrorCode &status); + + // Read the territoryAlias data from alias to + // strings+types+replacementIndexes + // Allocate length items for types, to store the type field. + // Allocate length items for replacementIndexes, + // to store the index in the strings for the replacement script. + void readTerritoryAlias(UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, UErrorCode &status); + + // Read the variantAlias data from alias to + // strings+types+replacementIndexes + // Allocate length items for types, to store the type field. + // Allocate length items for replacementIndexes, + // to store the index in the strings for the replacement variant. + void readVariantAlias(UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, UErrorCode &status); +}; + +/** + * A class to hold the Alias Data. + */ +class AliasData : public UMemory { +public: + static const AliasData* singleton(UErrorCode& status) { + if (U_FAILURE(status)) { + // Do not get into loadData if the status already has error. + return nullptr; + } + umtx_initOnce(AliasData::gInitOnce, &AliasData::loadData, status); + return gSingleton; + } + + const CharStringMap& languageMap() const { return language; } + const CharStringMap& scriptMap() const { return script; } + const CharStringMap& territoryMap() const { return territory; } + const CharStringMap& variantMap() const { return variant; } + + static void U_CALLCONV loadData(UErrorCode &status); + static UBool U_CALLCONV cleanup(); + + static UInitOnce gInitOnce; + +private: + AliasData(CharStringMap languageMap, + CharStringMap scriptMap, + CharStringMap territoryMap, + CharStringMap variantMap, + CharString* strings) + : language(std::move(languageMap)), + script(std::move(scriptMap)), + territory(std::move(territoryMap)), + variant(std::move(variantMap)), + strings(strings) { + } + + ~AliasData() { + delete strings; + } + + static const AliasData* gSingleton; + + CharStringMap language; + CharStringMap script; + CharStringMap territory; + CharStringMap variant; + CharString* strings; + + friend class AliasDataBuilder; +}; + + +const AliasData* AliasData::gSingleton = nullptr; +UInitOnce AliasData::gInitOnce = U_INITONCE_INITIALIZER; + +UBool U_CALLCONV +AliasData::cleanup() +{ + gInitOnce.reset(); + delete gSingleton; + return TRUE; +} + +void +AliasDataBuilder::readAlias( + UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, + void (*checkType)(const char* type), + void (*checkReplacement)(const UnicodeString& replacement), + UErrorCode &status) { + if (U_FAILURE(status)) { + return; + } + length = ures_getSize(alias); + const char** rawTypes = types.allocateInsteadAndCopy(length); + if (rawTypes == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + int32_t* rawIndexes = replacementIndexes.allocateInsteadAndCopy(length); + if (rawIndexes == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + int i = 0; + while (ures_hasNext(alias)) { + LocalUResourceBundlePointer res( + ures_getNextResource(alias, nullptr, &status)); + const char* aliasFrom = ures_getKey(res.getAlias()); + UnicodeString aliasTo = + ures_getUnicodeStringByKey(res.getAlias(), "replacement", &status); + + checkType(aliasFrom); + checkReplacement(aliasTo); + + rawTypes[i] = aliasFrom; + rawIndexes[i] = strings->add(aliasTo, status); + i++; + } +} + +/** + * Read the languageAlias data from alias to strings+types+replacementIndexes. + * Allocate length items for types, to store the type field. Allocate length + * items for replacementIndexes, to store the index in the strings for the + * replacement language. + */ +void +AliasDataBuilder::readLanguageAlias( + UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, + UErrorCode &status) +{ + return readAlias( + alias, strings, types, replacementIndexes, length, +#if U_DEBUG + [](const char* type) { + // Assert the aliasFrom only contains the following possibilties + // language_REGION_variant + // language_REGION + // language_variant + // language + // und_variant + Locale test(type); + // Assert no script in aliasFrom + U_ASSERT(test.getScript()[0] == '\0'); + // Assert when language is und, no REGION in aliasFrom. + U_ASSERT(test.getLanguage()[0] != '\0' || test.getCountry()[0] == '\0'); + }, +#else + [](const char*) {}, +#endif + [](const UnicodeString&) {}, status); +} + +/** + * Read the scriptAlias data from alias to strings+types+replacementIndexes. + * Allocate length items for types, to store the type field. Allocate length + * items for replacementIndexes, to store the index in the strings for the + * replacement script. + */ +void +AliasDataBuilder::readScriptAlias( + UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, + UErrorCode &status) +{ + return readAlias( + alias, strings, types, replacementIndexes, length, +#if U_DEBUG + [](const char* type) { + U_ASSERT(uprv_strlen(type) == 4); + }, + [](const UnicodeString& replacement) { + U_ASSERT(replacement.length() == 4); + }, +#else + [](const char*) {}, + [](const UnicodeString&) { }, +#endif + status); +} + +/** + * Read the territoryAlias data from alias to strings+types+replacementIndexes. + * Allocate length items for types, to store the type field. Allocate length + * items for replacementIndexes, to store the index in the strings for the + * replacement regions. + */ +void +AliasDataBuilder::readTerritoryAlias( + UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, + UErrorCode &status) +{ + return readAlias( + alias, strings, types, replacementIndexes, length, +#if U_DEBUG + [](const char* type) { + U_ASSERT(uprv_strlen(type) == 2 || uprv_strlen(type) == 3); + }, +#else + [](const char*) {}, +#endif + [](const UnicodeString&) { }, + status); +} + +/** + * Read the variantAlias data from alias to strings+types+replacementIndexes. + * Allocate length items for types, to store the type field. Allocate length + * items for replacementIndexes, to store the index in the strings for the + * replacement variant. + */ +void +AliasDataBuilder::readVariantAlias( + UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, + UErrorCode &status) +{ + return readAlias( + alias, strings, types, replacementIndexes, length, +#if U_DEBUG + [](const char* type) { + U_ASSERT(uprv_strlen(type) >= 4 && uprv_strlen(type) <= 8); + U_ASSERT(uprv_strlen(type) != 4 || + (type[0] >= '0' && type[0] <= '9')); + }, + [](const UnicodeString& replacement) { + U_ASSERT(replacement.length() >= 4 && replacement.length() <= 8); + U_ASSERT(replacement.length() != 4 || + (replacement.charAt(0) >= u'0' && + replacement.charAt(0) <= u'9')); + }, +#else + [](const char*) {}, + [](const UnicodeString&) { }, +#endif + status); +} + +/** + * Initializes the alias data from the ICU resource bundles. The alias data + * contains alias of language, country, script and variants. + * + * If the alias data has already loaded, then this method simply returns without + * doing anything meaningful. + */ +void U_CALLCONV +AliasData::loadData(UErrorCode &status) +{ +#ifdef LOCALE_CANONICALIZATION_DEBUG + UDate start = uprv_getRawUTCtime(); +#endif // LOCALE_CANONICALIZATION_DEBUG + ucln_common_registerCleanup(UCLN_COMMON_LOCALE_ALIAS, cleanup); + AliasDataBuilder builder; + gSingleton = builder.build(status); +#ifdef LOCALE_CANONICALIZATION_DEBUG + UDate end = uprv_getRawUTCtime(); + printf("AliasData::loadData took total %f ms\n", end - start); +#endif // LOCALE_CANONICALIZATION_DEBUG +} + +/** + * Build the alias data from resources. + */ +AliasData* +AliasDataBuilder::build(UErrorCode &status) { + LocalUResourceBundlePointer metadata( + ures_openDirect(nullptr, "metadata", &status)); + LocalUResourceBundlePointer metadataAlias( + ures_getByKey(metadata.getAlias(), "alias", nullptr, &status)); + LocalUResourceBundlePointer languageAlias( + ures_getByKey(metadataAlias.getAlias(), "language", nullptr, &status)); + LocalUResourceBundlePointer scriptAlias( + ures_getByKey(metadataAlias.getAlias(), "script", nullptr, &status)); + LocalUResourceBundlePointer territoryAlias( + ures_getByKey(metadataAlias.getAlias(), "territory", nullptr, &status)); + LocalUResourceBundlePointer variantAlias( + ures_getByKey(metadataAlias.getAlias(), "variant", nullptr, &status)); + + if (U_FAILURE(status)) { + return nullptr; + } + int32_t languagesLength = 0, scriptLength = 0, territoryLength = 0, + variantLength = 0; + + // Read the languageAlias into languageTypes, languageReplacementIndexes + // and strings + UniqueCharStrings strings(status); + LocalMemory languageTypes; + LocalMemory languageReplacementIndexes; + readLanguageAlias(languageAlias.getAlias(), + &strings, + languageTypes, + languageReplacementIndexes, + languagesLength, + status); + + // Read the scriptAlias into scriptTypes, scriptReplacementIndexes + // and strings + LocalMemory scriptTypes; + LocalMemory scriptReplacementIndexes; + readScriptAlias(scriptAlias.getAlias(), + &strings, + scriptTypes, + scriptReplacementIndexes, + scriptLength, + status); + + // Read the territoryAlias into territoryTypes, territoryReplacementIndexes + // and strings + LocalMemory territoryTypes; + LocalMemory territoryReplacementIndexes; + readTerritoryAlias(territoryAlias.getAlias(), + &strings, + territoryTypes, + territoryReplacementIndexes, + territoryLength, status); + + // Read the variantAlias into variantTypes, variantReplacementIndexes + // and strings + LocalMemory variantTypes; + LocalMemory variantReplacementIndexes; + readVariantAlias(variantAlias.getAlias(), + &strings, + variantTypes, + variantReplacementIndexes, + variantLength, status); + + if (U_FAILURE(status)) { + return nullptr; + } + + // We can only use strings after freeze it. + strings.freeze(); + + // Build the languageMap from languageTypes & languageReplacementIndexes + CharStringMap languageMap(490, status); + for (int32_t i = 0; U_SUCCESS(status) && i < languagesLength; i++) { + languageMap.put(languageTypes[i], + strings.get(languageReplacementIndexes[i]), + status); + } + + // Build the scriptMap from scriptTypes & scriptReplacementIndexes + CharStringMap scriptMap(1, status); + for (int32_t i = 0; U_SUCCESS(status) && i < scriptLength; i++) { + scriptMap.put(scriptTypes[i], + strings.get(scriptReplacementIndexes[i]), + status); + } + + // Build the territoryMap from territoryTypes & territoryReplacementIndexes + CharStringMap territoryMap(650, status); + for (int32_t i = 0; U_SUCCESS(status) && i < territoryLength; i++) { + territoryMap.put(territoryTypes[i], + strings.get(territoryReplacementIndexes[i]), + status); + } + + // Build the variantMap from variantTypes & variantReplacementIndexes. + CharStringMap variantMap(2, status); + for (int32_t i = 0; U_SUCCESS(status) && i < variantLength; i++) { + variantMap.put(variantTypes[i], + strings.get(variantReplacementIndexes[i]), + status); + } + + if (U_FAILURE(status)) { + return nullptr; + } + + // copy hashtables + auto *data = new AliasData( + std::move(languageMap), + std::move(scriptMap), + std::move(territoryMap), + std::move(variantMap), + strings.orphanCharStrings()); + + if (data == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + } + return data; +} + +/** + * A class that find the replacement values of locale fields by using AliasData. + */ +class AliasReplacer { +public: + AliasReplacer(UErrorCode status) : + language(nullptr), script(nullptr), region(nullptr), + extensions(nullptr), variants(status), + data(nullptr) { + } + ~AliasReplacer() { + } + + // Check the fields inside locale, if need to replace fields, + // place the the replaced locale ID in out and return true. + // Otherwise return false for no replacement or error. + bool replace( + const Locale& locale, CharString& out, UErrorCode status); + +private: + const char* language; + const char* script; + const char* region; + const char* extensions; + UVector variants; + + const AliasData* data; + + inline bool notEmpty(const char* str) { + return str && str[0] != NULL_CHAR; + } + + /** + * If replacement is neither null nor empty and input is either null or empty, + * return replacement. + * If replacement is neither null nor empty but input is not empty, return input. + * If replacement is either null or empty and type is either null or empty, + * return input. + * Otherwise return null. + * replacement input type return + * AAA nullptr * AAA + * AAA BBB * BBB + * nullptr || "" CCC nullptr CCC + * nullptr || "" * DDD nullptr + */ + inline const char* deleteOrReplace( + const char* input, const char* type, const char* replacement) { + return notEmpty(replacement) ? + ((input == nullptr) ? replacement : input) : + ((type == nullptr) ? input : nullptr); + } + + inline bool same(const char* a, const char* b) { + if (a == nullptr && b == nullptr) { + return true; + } + if ((a == nullptr && b != nullptr) || + (a != nullptr && b == nullptr)) { + return false; + } + return uprv_strcmp(a, b) == 0; + } + + // Gather fields and generate locale ID into out. + CharString& outputToString(CharString& out, UErrorCode status); + + // Generate the lookup key. + CharString& generateKey(const char* language, const char* region, + const char* variant, CharString& out, + UErrorCode status); + + void parseLanguageReplacement(const char* replacement, + const char*& replaceLanguage, + const char*& replaceScript, + const char*& replaceRegion, + const char*& replaceVariant, + const char*& replaceExtensions, + UVector& toBeFreed, + UErrorCode& status); + + // Replace by using languageAlias. + bool replaceLanguage(bool checkLanguage, bool checkRegion, + bool checkVariants, UVector& toBeFreed, + UErrorCode& status); + + // Replace by using territoryAlias. + bool replaceTerritory(UVector& toBeFreed, UErrorCode& status); + + // Replace by using scriptAlias. + bool replaceScript(UErrorCode& status); + + // Replace by using variantAlias. + bool replaceVariant(UErrorCode& status); +}; + +CharString& +AliasReplacer::generateKey( + const char* language, const char* region, const char* variant, + CharString& out, UErrorCode status) +{ out.append(language, status); - if (script && script[0] != '\0') { - out.append('_', status); - out.append(script, status); - } - if (country && country[0] != '\0') { - out.append('_', status); - out.append(country, status); - } - if (variants && variants[0] != '\0') { - if ((script == nullptr || script[0] == '\0') && - (country == nullptr || country[0] == '\0')) { - out.append('_', status); + if (notEmpty(region)) { + out.append(SEP_CHAR, status) + .append(region, status); + } + if (notEmpty(variant)) { + out.append(SEP_CHAR, status) + .append(variant, status); + } + return out; +} + +void +AliasReplacer::parseLanguageReplacement( + const char* replacement, + const char*& replacedLanguage, + const char*& replacedScript, + const char*& replacedRegion, + const char*& replacedVariant, + const char*& replacedExtensions, + UVector& toBeFreed, + UErrorCode& status) +{ + if (U_FAILURE(status)) { + return; + } + replacedScript = replacedRegion = replacedVariant + = replacedExtensions = nullptr; + if (uprv_strchr(replacement, '_') == nullptr) { + replacedLanguage = replacement; + // reach the end, just return it. + return; + } + // We have multiple field so we have to allocate and parse + CharString* str = new CharString( + replacement, (int32_t)uprv_strlen(replacement), status); + if (U_FAILURE(status)) { + return; + } + if (str == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + toBeFreed.addElement(str, status); + char* data = str->data(); + replacedLanguage = (const char*) data; + char* endOfField = uprv_strchr(data, '_'); + *endOfField = '\0'; // null terminiate it. + endOfField++; + const char* start = endOfField; + endOfField = (char*) uprv_strchr(start, '_'); + size_t len = 0; + if (endOfField == nullptr) { + len = uprv_strlen(start); + } else { + len = endOfField - start; + *endOfField = '\0'; // null terminiate it. + } + if (len == 4 && uprv_isASCIILetter(*start)) { + // Got a script + replacedScript = start; + if (endOfField == nullptr) { + return; + } + start = endOfField++; + endOfField = (char*)uprv_strchr(start, '_'); + if (endOfField == nullptr) { + len = uprv_strlen(start); + } else { + len = endOfField - start; + *endOfField = '\0'; // null terminiate it. + } + } + if (len >= 2 && len <= 3) { + // Got a region + replacedRegion = start; + if (endOfField == nullptr) { + return; + } + start = endOfField++; + endOfField = (char*)uprv_strchr(start, '_'); + if (endOfField == nullptr) { + len = uprv_strlen(start); + } else { + len = endOfField - start; + *endOfField = '\0'; // null terminiate it. + } + } + if (len >= 4) { + // Got a variant + replacedVariant = start; + if (endOfField == nullptr) { + return; } - out.append('_', status); - out.append(variants, status); + start = endOfField++; + } + replacedExtensions = start; +} + +bool +AliasReplacer::replaceLanguage( + bool checkLanguage, bool checkRegion, + bool checkVariants, UVector& toBeFreed, UErrorCode& status) +{ + if (U_FAILURE(status)) { + return false; + } + if ( (checkRegion && region == nullptr) || + (checkVariants && variants.size() == 0)) { + // Nothing to search. + return false; + } + int32_t variant_size = checkVariants ? variants.size() : 1; + // Since we may have more than one variant, we need to loop through them. + const char* searchLanguage = checkLanguage ? language : "und"; + const char* searchRegion = checkRegion ? region : nullptr; + const char* searchVariant = nullptr; + for (int32_t variant_index = 0; + variant_index < variant_size; + variant_index++) { + if (checkVariants) { + U_ASSERT(variant_index < variant_size); + searchVariant = (const char*)(variants.elementAt(variant_index)); + } + + if (searchVariant != nullptr && uprv_strlen(searchVariant) < 4) { + // Do not consider ill-formed variant subtag. + searchVariant = nullptr; + } + CharString typeKey; + generateKey(searchLanguage, searchRegion, searchVariant, typeKey, + status); + if (U_FAILURE(status)) { + return false; + } + const char *replacement = data->languageMap().get(typeKey.data()); + if (replacement == nullptr) { + // Found no replacement data. + continue; + } + + const char* replacedLanguage = nullptr; + const char* replacedScript = nullptr; + const char* replacedRegion = nullptr; + const char* replacedVariant = nullptr; + const char* replacedExtensions = nullptr; + parseLanguageReplacement(replacement, + replacedLanguage, + replacedScript, + replacedRegion, + replacedVariant, + replacedExtensions, + toBeFreed, + status); + replacedLanguage = + (replacedLanguage != nullptr && uprv_strcmp(replacedLanguage, "und") == 0) ? + language : replacedLanguage; + replacedScript = deleteOrReplace(script, nullptr, replacedScript); + replacedRegion = deleteOrReplace(region, searchRegion, replacedRegion); + replacedVariant = deleteOrReplace( + searchVariant, searchVariant, replacedVariant); + + if ( same(language, replacedLanguage) && + same(script, replacedScript) && + same(region, replacedRegion) && + same(searchVariant, replacedVariant) && + replacedExtensions == nullptr) { + // Replacement produce no changes. + continue; + } + + language = replacedLanguage; + region = replacedRegion; + script = replacedScript; + if (searchVariant != nullptr) { + if (notEmpty(replacedVariant)) { + variants.setElementAt((void*)replacedVariant, variant_index); + } else { + variants.removeElementAt(variant_index); + } + } + if (replacedExtensions != nullptr) { + // TODO(ICU-21292) + // DO NOTHING + // UTS35 does not specifiy what should we do if we have extensions in the + // replacement. Currently we know only the following 4 "BCP47 LegacyRules" have + // extensions in them languageAlias: + // i_default => en_x_i_default + // i_enochian => und_x_i_enochian + // i_mingo => see_x_i_mingo + // zh_min => nan_x_zh_min + // But all of them are already changed by code inside ultag_parse() before + // hitting this code. + } + + // Something changed by language alias data. + return true; + } + // Nothing changed by language alias data. + return false; +} + +bool +AliasReplacer::replaceTerritory(UVector& toBeFreed, UErrorCode& status) +{ + if (U_FAILURE(status)) { + return false; + } + if (region == nullptr) { + // No region to search. + return false; + } + const char *replacement = data->territoryMap().get(region); + if (replacement == nullptr) { + // Found no replacement data for this region. + return false; + } + const char* replacedRegion = replacement; + const char* firstSpace = uprv_strchr(replacement, ' '); + if (firstSpace != nullptr) { + // If there are are more than one region in the replacement. + // We need to check which one match based on the language. + // Cannot use nullptr for language because that will construct + // the default locale, in that case, use "und" to get the correct + // locale. + Locale l(language == nullptr ? "und" : language, nullptr, script); + l.addLikelySubtags(status); + const char* likelyRegion = l.getCountry(); + CharString* item = nullptr; + if (likelyRegion != nullptr && uprv_strlen(likelyRegion) > 0) { + size_t len = uprv_strlen(likelyRegion); + const char* foundInReplacement = uprv_strstr(replacement, + likelyRegion); + if (foundInReplacement != nullptr) { + // Assuming the case there are no three letter region code in + // the replacement of territoryAlias + U_ASSERT(foundInReplacement == replacement || + *(foundInReplacement-1) == ' '); + U_ASSERT(foundInReplacement[len] == ' ' || + foundInReplacement[len] == '\0'); + item = new CharString(foundInReplacement, (int32_t)len, status); + } + } + if (item == nullptr) { + item = new CharString(replacement, + (int32_t)(firstSpace - replacement), status); + } + if (U_FAILURE(status)) { return false; } + if (item == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return false; + } + replacedRegion = item->data(); + toBeFreed.addElement(item, status); + } + U_ASSERT(!same(region, replacedRegion)); + region = replacedRegion; + // The region is changed by data in territory alias. + return true; +} + +bool +AliasReplacer::replaceScript(UErrorCode& status) +{ + if (U_FAILURE(status)) { + return false; + } + if (script == nullptr) { + // No script to search. + return false; } - if (extension && extension[0] != '\0') { - out.append(extension, status); + const char *replacement = data->scriptMap().get(script); + if (replacement == nullptr) { + // Found no replacement data for this script. + return false; + } + U_ASSERT(!same(script, replacement)); + script = replacement; + // The script is changed by data in script alias. + return true; +} + +bool +AliasReplacer::replaceVariant(UErrorCode& status) +{ + if (U_FAILURE(status)) { + return false; + } + // Since we may have more than one variant, we need to loop through them. + for (int32_t i = 0; i < variants.size(); i++) { + const char *variant = (const char*)(variants.elementAt(i)); + const char *replacement = data->variantMap().get(variant); + if (replacement == nullptr) { + // Found no replacement data for this variant. + continue; + } + U_ASSERT((uprv_strlen(replacement) >= 5 && + uprv_strlen(replacement) <= 8) || + (uprv_strlen(replacement) == 4 && + replacement[0] >= '0' && + replacement[0] <= '9')); + if (!same(variant, replacement)) { + variants.setElementAt((void*)replacement, i); + // Special hack to handle hepburn-heploc => alalc97 + if (uprv_strcmp(variant, "heploc") == 0) { + for (int32_t j = 0; j < variants.size(); j++) { + if (uprv_strcmp((const char*)(variants.elementAt(j)), + "hepburn") == 0) { + variants.removeElementAt(j); + } + } + } + return true; + } + } + return false; +} + +CharString& +AliasReplacer::outputToString( + CharString& out, UErrorCode status) +{ + out.append(language, status); + if (notEmpty(script)) { + out.append(SEP_CHAR, status) + .append(script, status); + } + if (notEmpty(region)) { + out.append(SEP_CHAR, status) + .append(region, status); + } + if (variants.size() > 0) { + if (!notEmpty(script) && !notEmpty(region)) { + out.append(SEP_CHAR, status); + } + variants.sort([](UElement e1, UElement e2) -> int8_t { + return uprv_strcmp( + (const char*)e1.pointer, (const char*)e2.pointer); + }, status); + int32_t variantsStart = out.length(); + for (int32_t i = 0; i < variants.size(); i++) { + out.append(SEP_CHAR, status) + .append((const char*)((UVector*)variants.elementAt(i)), + status); + } + T_CString_toUpperCase(out.data() + variantsStart); + } + if (notEmpty(extensions)) { + CharString tmp("und_", status); + tmp.append(extensions, status); + Locale tmpLocale(tmp.data()); + // only support x extension inside CLDR for now. + U_ASSERT(extensions[0] == 'x'); + out.append(tmpLocale.getName() + 1, status); } return out; } +bool +AliasReplacer::replace(const Locale& locale, CharString& out, UErrorCode status) +{ + data = AliasData::singleton(status); + if (U_FAILURE(status)) { + return false; + } + U_ASSERT(data != nullptr); + out.clear(); + language = locale.getLanguage(); + if (!notEmpty(language)) { + language = nullptr; + } + script = locale.getScript(); + if (!notEmpty(script)) { + script = nullptr; + } + region = locale.getCountry(); + if (!notEmpty(region)) { + region = nullptr; + } + const char* variantsStr = locale.getVariant(); + const char* extensionsStr = locale_getKeywordsStart(locale.getName()); + CharString variantsBuff(variantsStr, -1, status); + if (!variantsBuff.isEmpty()) { + if (U_FAILURE(status)) { return false; } + char* start = variantsBuff.data(); + T_CString_toLowerCase(start); + char* end; + while ((end = uprv_strchr(start, SEP_CHAR)) != nullptr && + U_SUCCESS(status)) { + *end = NULL_CHAR; // null terminate inside variantsBuff + variants.addElement(start, status); + start = end + 1; + } + variants.addElement(start, status); + } + if (U_FAILURE(status)) { return false; } + + // Sort the variants + variants.sort([](UElement e1, UElement e2) -> int8_t { + return uprv_strcmp( + (const char*)e1.pointer, (const char*)e2.pointer); + }, status); + + // A changed count to assert when loop too many times. + int changed = 0; + // A UVector to to hold CharString allocated by the replace* method + // and freed when out of scope from his function. + UVector stringsToBeFreed([](void *obj){ delete ((CharString*) obj); }, + nullptr, 10, status); + while (U_SUCCESS(status)) { + // Something wrong with the data cause looping here more than 10 times + // already. + U_ASSERT(changed < 5); + // From observation of key in data/misc/metadata.txt + // we know currently we only need to search in the following combination + // of fields for type in languageAlias: + // * lang_region_variant + // * lang_region + // * lang_variant + // * lang + // * und_variant + // This assumption is ensured by the U_ASSERT in readLanguageAlias + // + // lang REGION variant + if ( replaceLanguage(true, true, true, stringsToBeFreed, status) || + replaceLanguage(true, true, false, stringsToBeFreed, status) || + replaceLanguage(true, false, true, stringsToBeFreed, status) || + replaceLanguage(true, false, false, stringsToBeFreed, status) || + replaceLanguage(false,false, true, stringsToBeFreed, status) || + replaceTerritory(stringsToBeFreed, status) || + replaceScript(status) || + replaceVariant(status)) { + // Some values in data is changed, try to match from the beginning + // again. + changed++; + continue; + } + // Nothing changed. Break out. + break; + } // while(1) + + if (U_FAILURE(status)) { return false; } + // Nothing changed and we know the order of the vaiants are not change + // because we have no variant or only one. + if (changed == 0 && variants.size() <= 1) { + return false; + } + outputToString(out, status); + if (extensionsStr != nullptr) { + out.append(extensionsStr, status); + } + if (U_FAILURE(status)) { + return false; + } + // If the tag is not changed, return. + if (uprv_strcmp(out.data(), locale.getName()) == 0) { + U_ASSERT(changed == 0); + U_ASSERT(variants.size() > 1); + out.clear(); + return false; + } + return true; +} + +// Return true if the locale is changed during canonicalization. +// The replaced value then will be put into out. +bool +canonicalizeLocale(const Locale& locale, CharString& out, UErrorCode& status) +{ + AliasReplacer replacer(status); + return replacer.replace(locale, out, status); +} + +// Function to optimize for known cases without so we can skip the loading +// of resources in the startup time until we really need it. +bool +isKnownCanonicalizedLocale(const char* locale, UErrorCode& status) +{ + if ( uprv_strcmp(locale, "c") == 0 || + uprv_strcmp(locale, "en") == 0 || + uprv_strcmp(locale, "en_US") == 0) { + return true; + } + + // common well-known Canonicalized. + umtx_initOnce(gKnownCanonicalizedInitOnce, + &loadKnownCanonicalized, status); + if (U_FAILURE(status)) { + return false; + } + U_ASSERT(gKnownCanonicalized != nullptr); + return uhash_geti(gKnownCanonicalized, locale) != 0; +} + } // namespace +// Function for testing. +U_CAPI const char* const* +ulocimp_getKnownCanonicalizedLocaleForTest(int32_t* length) +{ + *length = UPRV_LENGTHOF(KNOWN_CANONICALIZED); + return KNOWN_CANONICALIZED; +} + +// Function for testing. +U_CAPI bool +ulocimp_isCanonicalizedLocaleForTest(const char* localeName) +{ + Locale l(localeName); + UErrorCode status = U_ZERO_ERROR; + CharString temp; + return !canonicalizeLocale(l, temp, status) && U_SUCCESS(status); +} + /*This function initializes a Locale from a C locale ID*/ Locale& Locale::init(const char* localeID, UBool canonicalize) { @@ -632,9 +1719,9 @@ Locale& Locale::init(const char* localeID, UBool canonicalize) uprv_memcpy(language, fullName, fieldLen[0]); language[fieldLen[0]] = 0; } - if (fieldLen[1] == 4 && ISASCIIALPHA(field[1][0]) && - ISASCIIALPHA(field[1][1]) && ISASCIIALPHA(field[1][2]) && - ISASCIIALPHA(field[1][3])) { + if (fieldLen[1] == 4 && uprv_isASCIILetter(field[1][0]) && + uprv_isASCIILetter(field[1][1]) && uprv_isASCIILetter(field[1][2]) && + uprv_isASCIILetter(field[1][3])) { /* We have at least a script */ uprv_memcpy(script, field[1], fieldLen[1]); script[fieldLen[1]] = 0; @@ -662,192 +1749,18 @@ Locale& Locale::init(const char* localeID, UBool canonicalize) } if (canonicalize) { - UErrorCode status = U_ZERO_ERROR; - // TODO: Try to use ResourceDataValue and ures_getValueWithFallback() etc. - LocalUResourceBundlePointer metadata(ures_openDirect(NULL, "metadata", &status)); - LocalUResourceBundlePointer metadataAlias(ures_getByKey(metadata.getAlias(), "alias", NULL, &status)); - // Look up the metadata:alias:language:$key:replacement entries - // key could be one of the following: - // language - // language_Script_REGION - // language_REGION - // language_variant - do { - // The resource structure looks like - // metadata { - // alias { - // language { - // art_lojban { - // replacement{"jbo"} - // } - // ... - // ks_Arab_IN { - // replacement{"ks_IN"} - // } - // ... - // no { - // replacement{"nb"} - // } - // .... - // zh_CN { - // replacement{"zh_Hans_CN"} - // } - // } - // ... - // } - // } - LocalUResourceBundlePointer languageAlias(ures_getByKey(metadataAlias.getAlias(), "language", NULL, &status)); - if (U_FAILURE(status)) + if (!isKnownCanonicalizedLocale(fullName, err)) { + CharString replaced; + // Not sure it is already canonicalized + if (canonicalizeLocale(*this, replaced, err)) { + U_ASSERT(U_SUCCESS(err)); + // If need replacement, call init again. + init(replaced.data(), false); + } + if (U_FAILURE(err)) { break; - CharString temp; - // Handle cases of key pattern "language _ variant" - // ex: Map "art_lojban" to "jbo" - const char* variants = getVariant(); - if (variants != nullptr && variants[0] != '\0') { - const char* begin = variants; - const char* end = begin; - // We may have multiple variants, need to look at each of - // them. - do { - status = U_ZERO_ERROR; - end = uprv_strchr(begin, '_'); - int32_t len = (end == nullptr) ? int32_t(uprv_strlen(begin)) : int32_t(end - begin); - temp.clear().append(getLanguage(), status).append("_", status).append(begin, len, status); - LocalUResourceBundlePointer languageVariantAlias( - ures_getByKey(languageAlias.getAlias(), - temp.data(), - NULL, &status)); - temp.clear().appendInvariantChars( - UnicodeString(ures_getStringByKey(languageVariantAlias.getAlias(), "replacement", nullptr, &status)), status); - if (U_SUCCESS(status)) { - CharString newVar; - if (begin != variants) { - newVar.append(variants, static_cast(begin - variants - 1), status); - } - if (end != nullptr) { - if (begin != variants) { - newVar.append("_", status); - } - newVar.append(end + 1, status); - } - Locale l(temp.data()); - init(AppendLSCVE(temp.clear(), - l.getLanguage(), - (getScript() != nullptr && getScript()[0] != '\0') ? getScript() : l.getScript(), - (getCountry() != nullptr && getCountry()[0] != '\0') ? getCountry() : l.getCountry(), - newVar.data(), - uprv_strchr(fullName, '@'), status).data(), false); - break; - } - begin = end + 1; - } while (end != nullptr); - } // End of handle language _ variant - // Handle cases of key pattern "language _ Script _ REGION" - // ex: Map "ks_Arab_IN" to "ks_IN" - if (getScript() != nullptr && getScript()[0] != '\0' && - getCountry() != nullptr && getCountry()[0] != '\0') { - status = U_ZERO_ERROR; - LocalUResourceBundlePointer replacedAlias( - ures_getByKey(languageAlias.getAlias(), - AppendLSCVE(temp.clear(), getLanguage(), getScript(), getCountry(), - nullptr, nullptr, status).data(), NULL, &status)); - temp.clear().appendInvariantChars( - UnicodeString(ures_getStringByKey(replacedAlias.getAlias(), "replacement", nullptr, &status)), status); - if (U_SUCCESS(status)) { - Locale l(temp.data()); - init(AppendLSCVE(temp.clear(), - l.getLanguage(), - l.getScript(), - l.getCountry(), - getVariant(), - uprv_strchr(fullName, '@'), status).data(), false); - } - } // End of handle language _ Script _ REGION - // Handle cases of key pattern "language _ REGION" - // ex: Map "zh_CN" to "zh_Hans_CN" - if (getCountry() != nullptr && getCountry()[0] != '\0') { - status = U_ZERO_ERROR; - LocalUResourceBundlePointer replacedAlias( - ures_getByKey(languageAlias.getAlias(), - AppendLSCVE(temp.clear(), getLanguage(), nullptr, getCountry(), - nullptr, nullptr, status).data(), NULL, &status)); - temp.clear().appendInvariantChars( - UnicodeString(ures_getStringByKey(replacedAlias.getAlias(), "replacement", nullptr, &status)), status); - if (U_SUCCESS(status)) { - Locale l(temp.data()); - init(AppendLSCVE(temp.clear(), - l.getLanguage(), - (getScript() != nullptr && getScript()[0] != '\0') ? getScript() : l.getScript(), - l.getCountry(), - getVariant(), - uprv_strchr(fullName, '@'), status).data(), false); - } - } // End of handle "language _ REGION" - // Handle cases of key pattern "language" - // ex: Map "no" to "nb" - { - status = U_ZERO_ERROR; - LocalUResourceBundlePointer replaceLanguageAlias(ures_getByKey(languageAlias.getAlias(), getLanguage(), NULL, &status)); - temp.clear().appendInvariantChars( - UnicodeString(ures_getStringByKey(replaceLanguageAlias.getAlias(), "replacement", nullptr, &status)), status); - if (U_SUCCESS(status)) { - Locale l(temp.data()); - init(AppendLSCVE(temp.clear(), - l.getLanguage(), - (getScript() != nullptr && getScript()[0] != '\0') ? getScript() : l.getScript(), - (getCountry() != nullptr && getCountry()[0] != '\0') ? getCountry() : l.getCountry(), - getVariant(), - uprv_strchr(fullName, '@'), status).data(), false); - } - } // End of handle "language" - - // Look up the metadata:alias:territory:$key:replacement entries - // key is region code. - if (getCountry() != nullptr) { - status = U_ZERO_ERROR; - // The resource structure looks like - // metadata { - // alias { - // ... - // territory: { - // 172 { - // replacement{"RU AM AZ BY GE KG KZ MD TJ TM UA UZ"} - // } - // ... - // 554 { - // replacement{"NZ"} - // } - // } - // } - // } - LocalUResourceBundlePointer territoryAlias(ures_getByKey(metadataAlias.getAlias(), "territory", NULL, &status)); - LocalUResourceBundlePointer countryAlias(ures_getByKey(territoryAlias.getAlias(), getCountry(), NULL, &status)); - UnicodeString replacements( - ures_getStringByKey(countryAlias.getAlias(), "replacement", nullptr, &status)); - if (U_SUCCESS(status)) { - CharString replacedCountry; - int32_t delPos = replacements.indexOf(' '); - if (delPos == -1) { - replacedCountry.appendInvariantChars(replacements, status); - } else { - Locale l(AppendLSCVE(temp.clear(), getLanguage(), nullptr, getScript(), - nullptr, nullptr, status).data()); - l.addLikelySubtags(status); - if (replacements.indexOf(UnicodeString(l.getCountry())) != -1) { - replacedCountry.append(l.getCountry(), status); - } else { - replacedCountry.appendInvariantChars(replacements.getBuffer(), delPos, status); - } - } - init(AppendLSCVE(temp.clear(), - getLanguage(), - getScript(), - replacedCountry.data(), - getVariant(), - uprv_strchr(fullName, '@'), status).data(), false); - } - } // End of handle REGION - } while (0); + } + } } // if (canonicalize) { // successful end of init() @@ -1024,13 +1937,14 @@ Locale::forLanguageTag(StringPiece tag, UErrorCode& status) return result; } - // If a BCP-47 language tag is passed as the language parameter to the + // If a BCP 47 language tag is passed as the language parameter to the // normal Locale constructor, it will actually fall back to invoking // uloc_forLanguageTag() to parse it if it somehow is able to detect that - // the string actually is BCP-47. This works well for things like strings - // using BCP-47 extensions, but it does not at all work for things like - // BCP-47 grandfathered tags (eg. "en-GB-oed") which are possible to also - // interpret as ICU locale IDs and because of that won't trigger the BCP-47 + // the string actually is BCP 47. This works well for things like strings + // using BCP 47 extensions, but it does not at all work for things like + // legacy language tags (marked as “Type: grandfathered” in BCP 47, + // e.g., "en-GB-oed") which are possible to also + // interpret as ICU locale IDs and because of that won't trigger the BCP 47 // parsing. Therefore the code here explicitly calls uloc_forLanguageTag() // and then Locale::init(), instead of just calling the normal constructor. @@ -1414,8 +2328,6 @@ UnicodeKeywordEnumeration::~UnicodeKeywordEnumeration() = default; StringEnumeration * Locale::createKeywords(UErrorCode &status) const { - char keywords[256]; - int32_t keywordCapacity = sizeof keywords; StringEnumeration *result = NULL; if (U_FAILURE(status)) { @@ -1426,9 +2338,11 @@ Locale::createKeywords(UErrorCode &status) const const char* assignment = uprv_strchr(fullName, '='); if(variantStart) { if(assignment > variantStart) { - int32_t keyLen = locale_getKeywords(variantStart+1, '@', keywords, keywordCapacity, FALSE, &status); - if(U_SUCCESS(status) && keyLen) { - result = new KeywordEnumeration(keywords, keyLen, 0, status); + CharString keywords; + CharStringByteSink sink(&keywords); + ulocimp_getKeywords(variantStart+1, '@', sink, FALSE, &status); + if (U_SUCCESS(status) && !keywords.isEmpty()) { + result = new KeywordEnumeration(keywords.data(), keywords.length(), 0, status); if (!result) { status = U_MEMORY_ALLOCATION_ERROR; } @@ -1443,8 +2357,6 @@ Locale::createKeywords(UErrorCode &status) const StringEnumeration * Locale::createUnicodeKeywords(UErrorCode &status) const { - char keywords[256]; - int32_t keywordCapacity = sizeof keywords; StringEnumeration *result = NULL; if (U_FAILURE(status)) { @@ -1455,9 +2367,11 @@ Locale::createUnicodeKeywords(UErrorCode &status) const const char* assignment = uprv_strchr(fullName, '='); if(variantStart) { if(assignment > variantStart) { - int32_t keyLen = locale_getKeywords(variantStart+1, '@', keywords, keywordCapacity, FALSE, &status); - if(U_SUCCESS(status) && keyLen) { - result = new UnicodeKeywordEnumeration(keywords, keyLen, 0, status); + CharString keywords; + CharStringByteSink sink(&keywords); + ulocimp_getKeywords(variantStart+1, '@', sink, FALSE, &status); + if (U_SUCCESS(status) && !keywords.isEmpty()) { + result = new UnicodeKeywordEnumeration(keywords.data(), keywords.length(), 0, status); if (!result) { status = U_MEMORY_ALLOCATION_ERROR; } @@ -1492,48 +2406,7 @@ Locale::getKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& sta return; } - LocalMemory scratch; - int32_t scratch_capacity = 16; // Arbitrarily chosen default size. - - char* buffer; - int32_t result_capacity, reslen; - - for (;;) { - if (scratch.allocateInsteadAndReset(scratch_capacity) == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - return; - } - - buffer = sink.GetAppendBuffer( - /*min_capacity=*/scratch_capacity, - /*desired_capacity_hint=*/scratch_capacity, - scratch.getAlias(), - scratch_capacity, - &result_capacity); - - reslen = uloc_getKeywordValue( - fullName, - keywordName_nul.data(), - buffer, - result_capacity, - &status); - - if (status != U_BUFFER_OVERFLOW_ERROR) { - break; - } - - scratch_capacity = reslen; - status = U_ZERO_ERROR; - } - - if (U_FAILURE(status)) { - return; - } - - sink.Append(buffer, reslen); - if (status == U_STRING_NOT_TERMINATED_WARNING) { - status = U_ZERO_ERROR; // Terminators not used. - } + ulocimp_getKeywordValue(fullName, keywordName_nul.data(), sink, &status); } void diff --git a/deps/icu-small/source/common/loclikely.cpp b/deps/icu-small/source/common/loclikely.cpp index 3b71708e549d5f..6a34bb42cecf3f 100644 --- a/deps/icu-small/source/common/loclikely.cpp +++ b/deps/icu-small/source/common/loclikely.cpp @@ -464,8 +464,7 @@ parseTagString( goto error; } - subtagLength = ulocimp_getLanguage(position, lang, *langLength, &position); - u_terminateChars(lang, *langLength, subtagLength, err); + subtagLength = ulocimp_getLanguage(position, &position, *err).extract(lang, *langLength, *err); /* * Note that we explicit consider U_STRING_NOT_TERMINATED_WARNING @@ -486,8 +485,7 @@ parseTagString( ++position; } - subtagLength = ulocimp_getScript(position, script, *scriptLength, &position); - u_terminateChars(script, *scriptLength, subtagLength, err); + subtagLength = ulocimp_getScript(position, &position, *err).extract(script, *scriptLength, *err); if(U_FAILURE(*err)) { goto error; @@ -511,8 +509,7 @@ parseTagString( } } - subtagLength = ulocimp_getCountry(position, region, *regionLength, &position); - u_terminateChars(region, *regionLength, subtagLength, err); + subtagLength = ulocimp_getCountry(position, &position, *err).extract(region, *regionLength, *err); if(U_FAILURE(*err)) { goto error; @@ -826,7 +823,7 @@ createLikelySubtagsString( } \ } UPRV_BLOCK_MACRO_END -static void +static UBool _uloc_addLikelySubtags(const char* localeID, icu::ByteSink& sink, UErrorCode* err) { @@ -897,15 +894,22 @@ _uloc_addLikelySubtags(const char* localeID, sink.Append(localeID, localIDLength); } - return; + return success; error: if (!U_FAILURE(*err)) { *err = U_ILLEGAL_ARGUMENT_ERROR; } + return FALSE; } +// Add likely subtags to the sink +// return true if the value in the sink is produced by a match during the lookup +// return false if the value in the sink is the same as input because there are +// no match after the lookup. +static UBool _ulocimp_addLikelySubtags(const char*, icu::ByteSink&, UErrorCode*); + static void _uloc_minimizeSubtags(const char* localeID, icu::ByteSink& sink, @@ -921,6 +925,7 @@ _uloc_minimizeSubtags(const char* localeID, const char* trailing = ""; int32_t trailingLength = 0; int32_t trailingIndex = 0; + UBool successGetMax = FALSE; if(U_FAILURE(*err)) { goto error; @@ -961,7 +966,7 @@ _uloc_minimizeSubtags(const char* localeID, { icu::CharString base; { - icu::CharStringByteSink sink(&base); + icu::CharStringByteSink baseSink(&base); createTagString( lang, langLength, @@ -971,7 +976,7 @@ _uloc_minimizeSubtags(const char* localeID, regionLength, NULL, 0, - sink, + baseSink, err); } @@ -980,8 +985,8 @@ _uloc_minimizeSubtags(const char* localeID, * from AddLikelySubtags. **/ { - icu::CharStringByteSink sink(&maximizedTagBuffer); - ulocimp_addLikelySubtags(base.data(), sink, err); + icu::CharStringByteSink maxSink(&maximizedTagBuffer); + successGetMax = _ulocimp_addLikelySubtags(base.data(), maxSink, err); } } @@ -989,13 +994,40 @@ _uloc_minimizeSubtags(const char* localeID, goto error; } + if (!successGetMax) { + /** + * If we got here, return the locale ID parameter unchanged. + **/ + const int32_t localeIDLength = (int32_t)uprv_strlen(localeID); + sink.Append(localeID, localeIDLength); + return; + } + + // In the following, the lang, script, region are referring to those in + // the maximizedTagBuffer, not the one in the localeID. + langLength = sizeof(lang); + scriptLength = sizeof(script); + regionLength = sizeof(region); + parseTagString( + maximizedTagBuffer.data(), + lang, + &langLength, + script, + &scriptLength, + region, + ®ionLength, + err); + if(U_FAILURE(*err)) { + goto error; + } + /** * Start first with just the language. **/ { icu::CharString tagBuffer; { - icu::CharStringByteSink sink(&tagBuffer); + icu::CharStringByteSink tagSink(&tagBuffer); createLikelySubtagsString( lang, langLength, @@ -1005,14 +1037,15 @@ _uloc_minimizeSubtags(const char* localeID, 0, NULL, 0, - sink, + tagSink, err); } if(U_FAILURE(*err)) { goto error; } - else if (!tagBuffer.isEmpty() && uprv_strnicmp( + else if (!tagBuffer.isEmpty() && + uprv_strnicmp( maximizedTagBuffer.data(), tagBuffer.data(), tagBuffer.length()) == 0) { @@ -1039,7 +1072,7 @@ _uloc_minimizeSubtags(const char* localeID, icu::CharString tagBuffer; { - icu::CharStringByteSink sink(&tagBuffer); + icu::CharStringByteSink tagSink(&tagBuffer); createLikelySubtagsString( lang, langLength, @@ -1049,14 +1082,15 @@ _uloc_minimizeSubtags(const char* localeID, regionLength, NULL, 0, - sink, + tagSink, err); } if(U_FAILURE(*err)) { goto error; } - else if (uprv_strnicmp( + else if (!tagBuffer.isEmpty() && + uprv_strnicmp( maximizedTagBuffer.data(), tagBuffer.data(), tagBuffer.length()) == 0) { @@ -1081,10 +1115,10 @@ _uloc_minimizeSubtags(const char* localeID, * since trying with all three subtags would only yield the * maximal version that we already have. **/ - if (scriptLength > 0 && regionLength > 0) { + if (scriptLength > 0) { icu::CharString tagBuffer; { - icu::CharStringByteSink sink(&tagBuffer); + icu::CharStringByteSink tagSink(&tagBuffer); createLikelySubtagsString( lang, langLength, @@ -1094,14 +1128,15 @@ _uloc_minimizeSubtags(const char* localeID, 0, NULL, 0, - sink, + tagSink, err); } if(U_FAILURE(*err)) { goto error; } - else if (uprv_strnicmp( + else if (!tagBuffer.isEmpty() && + uprv_strnicmp( maximizedTagBuffer.data(), tagBuffer.data(), tagBuffer.length()) == 0) { @@ -1123,10 +1158,19 @@ _uloc_minimizeSubtags(const char* localeID, { /** - * If we got here, return the locale ID parameter. + * If we got here, return the max + trail. **/ - const int32_t localeIDLength = (int32_t)uprv_strlen(localeID); - sink.Append(localeID, localeIDLength); + createTagString( + lang, + langLength, + script, + scriptLength, + region, + regionLength, + trailing, + trailingLength, + sink, + err); return; } @@ -1193,15 +1237,23 @@ uloc_addLikelySubtags(const char* localeID, return reslen; } -U_CAPI void U_EXPORT2 -ulocimp_addLikelySubtags(const char* localeID, - icu::ByteSink& sink, - UErrorCode* status) { +static UBool +_ulocimp_addLikelySubtags(const char* localeID, + icu::ByteSink& sink, + UErrorCode* status) { char localeBuffer[ULOC_FULLNAME_CAPACITY]; if (do_canonicalize(localeID, localeBuffer, sizeof localeBuffer, status)) { - _uloc_addLikelySubtags(localeBuffer, sink, status); + return _uloc_addLikelySubtags(localeBuffer, sink, status); } + return FALSE; +} + +U_CAPI void U_EXPORT2 +ulocimp_addLikelySubtags(const char* localeID, + icu::ByteSink& sink, + UErrorCode* status) { + _ulocimp_addLikelySubtags(localeID, sink, status); } U_CAPI int32_t U_EXPORT2 diff --git a/deps/icu-small/source/common/loclikelysubtags.cpp b/deps/icu-small/source/common/loclikelysubtags.cpp index 1fbf1a1463299f..a031bfa5872642 100644 --- a/deps/icu-small/source/common/loclikelysubtags.cpp +++ b/deps/icu-small/source/common/loclikelysubtags.cpp @@ -1,5 +1,5 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // loclikelysubtags.cpp // created: 2019may08 Markus W. Scherer @@ -20,6 +20,7 @@ #include "uhash.h" #include "uinvchar.h" #include "umutex.h" +#include "uniquecharstr.h" #include "uresdata.h" #include "uresimp.h" @@ -31,71 +32,6 @@ constexpr char PSEUDO_ACCENTS_PREFIX = '\''; // -XA, -PSACCENT constexpr char PSEUDO_BIDI_PREFIX = '+'; // -XB, -PSBIDI constexpr char PSEUDO_CRACKED_PREFIX = ','; // -XC, -PSCRACK -/** - * Stores NUL-terminated strings with duplicate elimination. - * Checks for unique UTF-16 string pointers and converts to invariant characters. - */ -class UniqueCharStrings { -public: - UniqueCharStrings(UErrorCode &errorCode) : strings(nullptr) { - uhash_init(&map, uhash_hashUChars, uhash_compareUChars, uhash_compareLong, &errorCode); - if (U_FAILURE(errorCode)) { return; } - strings = new CharString(); - if (strings == nullptr) { - errorCode = U_MEMORY_ALLOCATION_ERROR; - } - } - ~UniqueCharStrings() { - uhash_close(&map); - delete strings; - } - - /** Returns/orphans the CharString that contains all strings. */ - CharString *orphanCharStrings() { - CharString *result = strings; - strings = nullptr; - return result; - } - - /** Adds a string and returns a unique number for it. */ - int32_t add(const UnicodeString &s, UErrorCode &errorCode) { - if (U_FAILURE(errorCode)) { return 0; } - if (isFrozen) { - errorCode = U_NO_WRITE_PERMISSION; - return 0; - } - // The string points into the resource bundle. - const char16_t *p = s.getBuffer(); - int32_t oldIndex = uhash_geti(&map, p); - if (oldIndex != 0) { // found duplicate - return oldIndex; - } - // Explicit NUL terminator for the previous string. - // The strings object is also terminated with one implicit NUL. - strings->append(0, errorCode); - int32_t newIndex = strings->length(); - strings->appendInvariantChars(s, errorCode); - uhash_puti(&map, const_cast(p), newIndex, &errorCode); - return newIndex; - } - - void freeze() { isFrozen = true; } - - /** - * Returns a string pointer for its unique number, if this object is frozen. - * Otherwise nullptr. - */ - const char *get(int32_t i) const { - U_ASSERT(isFrozen); - return isFrozen && i > 0 ? strings->data() + i : nullptr; - } - -private: - UHashtable map; - CharString *strings; - bool isFrozen = false; -}; - } // namespace LocaleDistanceData::LocaleDistanceData(LocaleDistanceData &&data) : diff --git a/deps/icu-small/source/common/loclikelysubtags.h b/deps/icu-small/source/common/loclikelysubtags.h index 90ddfffaca672d..14a01a5eac7eba 100644 --- a/deps/icu-small/source/common/loclikelysubtags.h +++ b/deps/icu-small/source/common/loclikelysubtags.h @@ -1,5 +1,5 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // loclikelysubtags.h // created: 2019may08 Markus W. Scherer @@ -13,49 +13,13 @@ #include "unicode/locid.h" #include "unicode/uobject.h" #include "unicode/ures.h" +#include "charstrmap.h" #include "lsr.h" -#include "uhash.h" U_NAMESPACE_BEGIN struct XLikelySubtagsData; -/** - * Map of const char * keys & values. - * Stores pointers as is: Does not own/copy/adopt/release strings. - */ -class CharStringMap final : public UMemory { -public: - /** Constructs an unusable non-map. */ - CharStringMap() : map(nullptr) {} - CharStringMap(int32_t size, UErrorCode &errorCode) { - map = uhash_openSize(uhash_hashChars, uhash_compareChars, uhash_compareChars, - size, &errorCode); - } - CharStringMap(CharStringMap &&other) U_NOEXCEPT : map(other.map) { - other.map = nullptr; - } - CharStringMap(const CharStringMap &other) = delete; - ~CharStringMap() { - uhash_close(map); - } - - CharStringMap &operator=(CharStringMap &&other) U_NOEXCEPT { - map = other.map; - other.map = nullptr; - return *this; - } - CharStringMap &operator=(const CharStringMap &other) = delete; - - const char *get(const char *key) const { return static_cast(uhash_get(map, key)); } - void put(const char *key, const char *value, UErrorCode &errorCode) { - uhash_put(map, const_cast(key), const_cast(value), &errorCode); - } - -private: - UHashtable *map; -}; - struct LocaleDistanceData { LocaleDistanceData() = default; LocaleDistanceData(LocaleDistanceData &&data); diff --git a/deps/icu-small/source/common/locmap.cpp b/deps/icu-small/source/common/locmap.cpp index 46986399b23e7a..515205222a65ac 100644 --- a/deps/icu-small/source/common/locmap.cpp +++ b/deps/icu-small/source/common/locmap.cpp @@ -28,8 +28,11 @@ */ #include "locmap.h" +#include "bytesinkutil.h" +#include "charstr.h" #include "cstring.h" #include "cmemory.h" +#include "ulocimp.h" #include "unicode/uloc.h" #if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API @@ -1167,15 +1170,18 @@ uprv_convertToLCIDPlatform(const char* localeID, UErrorCode* status) // conversion functionality when available. #if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API int32_t len; - char collVal[ULOC_KEYWORDS_CAPACITY] = {}; char baseName[ULOC_FULLNAME_CAPACITY] = {}; const char * mylocaleID = localeID; // Check any for keywords. if (uprv_strchr(localeID, '@')) { - len = uloc_getKeywordValue(localeID, "collation", collVal, UPRV_LENGTHOF(collVal) - 1, status); - if (U_SUCCESS(*status) && len > 0) + icu::CharString collVal; + { + icu::CharStringByteSink sink(&collVal); + ulocimp_getKeywordValue(localeID, "collation", sink, status); + } + if (U_SUCCESS(*status) && !collVal.isEmpty()) { // If it contains the keyword collation, return 0 so that the LCID lookup table will be used. return 0; diff --git a/deps/icu-small/source/common/lsr.cpp b/deps/icu-small/source/common/lsr.cpp index d4308ad0275428..b81808f2c4aae1 100644 --- a/deps/icu-small/source/common/lsr.cpp +++ b/deps/icu-small/source/common/lsr.cpp @@ -1,5 +1,5 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // lsr.cpp // created: 2019may08 Markus W. Scherer diff --git a/deps/icu-small/source/common/lsr.h b/deps/icu-small/source/common/lsr.h index d535e5b0376cd3..a33f855245335e 100644 --- a/deps/icu-small/source/common/lsr.h +++ b/deps/icu-small/source/common/lsr.h @@ -1,5 +1,5 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // lsr.h // created: 2019may08 Markus W. Scherer diff --git a/deps/icu-small/source/common/messageimpl.h b/deps/icu-small/source/common/messageimpl.h index dc7a6edd6c0e5f..a56479066bc058 100644 --- a/deps/icu-small/source/common/messageimpl.h +++ b/deps/icu-small/source/common/messageimpl.h @@ -33,7 +33,7 @@ U_NAMESPACE_BEGIN class U_COMMON_API MessageImpl { public: /** - * @return TRUE if getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED + * @return true if getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED */ static UBool jdkAposMode(const MessagePattern &msgPattern) { return msgPattern.getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED; diff --git a/deps/icu-small/source/common/norm2allmodes.h b/deps/icu-small/source/common/norm2allmodes.h index 682ece28f13092..e8bd52c6ae39d7 100644 --- a/deps/icu-small/source/common/norm2allmodes.h +++ b/deps/icu-small/source/common/norm2allmodes.h @@ -65,13 +65,13 @@ class Normalizer2WithImpl : public Normalizer2 { normalizeSecondAndAppend(UnicodeString &first, const UnicodeString &second, UErrorCode &errorCode) const { - return normalizeSecondAndAppend(first, second, TRUE, errorCode); + return normalizeSecondAndAppend(first, second, true, errorCode); } virtual UnicodeString & append(UnicodeString &first, const UnicodeString &second, UErrorCode &errorCode) const { - return normalizeSecondAndAppend(first, second, FALSE, errorCode); + return normalizeSecondAndAppend(first, second, false, errorCode); } UnicodeString & normalizeSecondAndAppend(UnicodeString &first, @@ -112,14 +112,14 @@ class Normalizer2WithImpl : public Normalizer2 { int32_t length; const UChar *d=impl.getDecomposition(c, buffer, length); if(d==NULL) { - return FALSE; + return false; } if(d==buffer) { decomposition.setTo(buffer, length); // copy the string (Jamos from Hangul syllable c) } else { - decomposition.setTo(FALSE, d, length); // read-only alias + decomposition.setTo(false, d, length); // read-only alias } - return TRUE; + return true; } virtual UBool getRawDecomposition(UChar32 c, UnicodeString &decomposition) const { @@ -127,14 +127,14 @@ class Normalizer2WithImpl : public Normalizer2 { int32_t length; const UChar *d=impl.getRawDecomposition(c, buffer, length); if(d==NULL) { - return FALSE; + return false; } if(d==buffer) { decomposition.setTo(buffer, length); // copy the string (algorithmic decomposition) } else { - decomposition.setTo(FALSE, d, length); // read-only alias + decomposition.setTo(false, d, length); // read-only alias } - return TRUE; + return true; } virtual UChar32 composePair(UChar32 a, UChar32 b) const { @@ -150,12 +150,12 @@ class Normalizer2WithImpl : public Normalizer2 { virtual UBool isNormalized(const UnicodeString &s, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { - return FALSE; + return false; } const UChar *sArray=s.getBuffer(); if(sArray==NULL) { errorCode=U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + return false; } const UChar *sLimit=sArray+s.length(); return sLimit==spanQuickCheckYes(sArray, sLimit, errorCode); @@ -227,7 +227,7 @@ class ComposeNormalizer2 : public Normalizer2WithImpl { virtual void normalize(const UChar *src, const UChar *limit, ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE { - impl.compose(src, limit, onlyContiguous, TRUE, buffer, errorCode); + impl.compose(src, limit, onlyContiguous, true, buffer, errorCode); } using Normalizer2WithImpl::normalize; // Avoid warning about hiding base class function. @@ -256,24 +256,24 @@ class ComposeNormalizer2 : public Normalizer2WithImpl { virtual UBool isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE { if(U_FAILURE(errorCode)) { - return FALSE; + return false; } const UChar *sArray=s.getBuffer(); if(sArray==NULL) { errorCode=U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + return false; } UnicodeString temp; ReorderingBuffer buffer(impl, temp); if(!buffer.init(5, errorCode)) { // small destCapacity for substring normalization - return FALSE; + return false; } - return impl.compose(sArray, sArray+s.length(), onlyContiguous, FALSE, buffer, errorCode); + return impl.compose(sArray, sArray+s.length(), onlyContiguous, false, buffer, errorCode); } virtual UBool isNormalizedUTF8(StringPiece sp, UErrorCode &errorCode) const U_OVERRIDE { if(U_FAILURE(errorCode)) { - return FALSE; + return false; } const uint8_t *s = reinterpret_cast(sp.data()); return impl.composeUTF8(0, onlyContiguous, s, s + sp.length(), nullptr, nullptr, errorCode); @@ -343,7 +343,7 @@ class FCDNormalizer2 : public Normalizer2WithImpl { struct Norm2AllModes : public UMemory { Norm2AllModes(Normalizer2Impl *i) - : impl(i), comp(*i, FALSE), decomp(*i), fcd(*i), fcc(*i, TRUE) {} + : impl(i), comp(*i, false), decomp(*i), fcd(*i), fcc(*i, true) {} ~Norm2AllModes(); static Norm2AllModes *createInstance(Normalizer2Impl *impl, UErrorCode &errorCode); diff --git a/deps/icu-small/source/common/normalizer2impl.h b/deps/icu-small/source/common/normalizer2impl.h index cf3015ea881bfc..4218a30a3452df 100644 --- a/deps/icu-small/source/common/normalizer2impl.h +++ b/deps/icu-small/source/common/normalizer2impl.h @@ -171,7 +171,7 @@ class U_COMMON_API ReorderingBuffer : public UMemory { UErrorCode &errorCode); UBool appendBMP(UChar c, uint8_t cc, UErrorCode &errorCode) { if(remainingCapacity==0 && !resize(1, errorCode)) { - return FALSE; + return false; } if(lastCC<=cc || cc==0) { *limit++=c; @@ -183,7 +183,7 @@ class U_COMMON_API ReorderingBuffer : public UMemory { insert(c, cc); } --remainingCapacity; - return TRUE; + return true; } UBool appendZeroCC(UChar32 c, UErrorCode &errorCode); UBool appendZeroCC(const UChar *s, const UChar *sLimit, UErrorCode &errorCode); @@ -359,7 +359,7 @@ class U_COMMON_API Normalizer2Impl : public UObject { return getFCD16FromNormData(c); } - /** Returns TRUE if the single-or-lead code unit c might have non-zero FCD data. */ + /** Returns true if the single-or-lead code unit c might have non-zero FCD data. */ UBool singleLeadMightHaveNonZeroFCD16(UChar32 lead) const { // 0<=lead<=0xffff uint8_t bits=smallFCD[lead>>8]; @@ -397,8 +397,8 @@ class U_COMMON_API Normalizer2Impl : public UObject { MIN_YES_YES_WITH_CC=0xfe02, JAMO_VT=0xfe00, MIN_NORMAL_MAYBE_YES=0xfc00, - JAMO_L=2, // offset=1 hasCompBoundaryAfter=FALSE - INERT=1, // offset=0 hasCompBoundaryAfter=TRUE + JAMO_L=2, // offset=1 hasCompBoundaryAfter=false + INERT=1, // offset=0 hasCompBoundaryAfter=true // norm16 bit 0 is comp-boundary-after. HAS_COMP_BOUNDARY_AFTER=1, diff --git a/deps/icu-small/source/common/patternprops.h b/deps/icu-small/source/common/patternprops.h index b57cdeb6e534f6..95898d580c82f0 100644 --- a/deps/icu-small/source/common/patternprops.h +++ b/deps/icu-small/source/common/patternprops.h @@ -44,17 +44,17 @@ U_NAMESPACE_BEGIN class U_COMMON_API PatternProps { public: /** - * @return TRUE if c is a Pattern_Syntax code point. + * @return true if c is a Pattern_Syntax code point. */ static UBool isSyntax(UChar32 c); /** - * @return TRUE if c is a Pattern_Syntax or Pattern_White_Space code point. + * @return true if c is a Pattern_Syntax or Pattern_White_Space code point. */ static UBool isSyntaxOrWhiteSpace(UChar32 c); /** - * @return TRUE if c is a Pattern_White_Space character. + * @return true if c is a Pattern_White_Space character. */ static UBool isWhiteSpace(UChar32 c); @@ -78,7 +78,7 @@ class U_COMMON_API PatternProps { /** * Tests whether the string contains a "pattern identifier", that is, * whether it contains only non-Pattern_White_Space, non-Pattern_Syntax characters. - * @return TRUE if there are no Pattern_White_Space or Pattern_Syntax characters in s. + * @return true if there are no Pattern_White_Space or Pattern_Syntax characters in s. */ static UBool isIdentifier(const UChar *s, int32_t length); diff --git a/deps/icu-small/source/common/pluralmap.h b/deps/icu-small/source/common/pluralmap.h index db644093a1fc46..d898ac4671f797 100644 --- a/deps/icu-small/source/common/pluralmap.h +++ b/deps/icu-small/source/common/pluralmap.h @@ -234,7 +234,7 @@ class PluralMap : public PluralMapBase { } /** - * Returns TRUE if this object equals rhs. + * Returns true if this object equals rhs. */ UBool equals( const PluralMap &rhs, @@ -244,13 +244,13 @@ class PluralMap : public PluralMapBase { continue; } if (fVariants[i] == NULL || rhs.fVariants[i] == NULL) { - return FALSE; + return false; } if (!eqFunc(*fVariants[i], *rhs.fVariants[i])) { - return FALSE; + return false; } } - return TRUE; + return true; } private: diff --git a/deps/icu-small/source/common/punycode.cpp b/deps/icu-small/source/common/punycode.cpp index 4f0b9ea9cd385f..94d32a66d7678d 100644 --- a/deps/icu-small/source/common/punycode.cpp +++ b/deps/icu-small/source/common/punycode.cpp @@ -107,36 +107,26 @@ digitToBasic(int32_t digit, UBool uppercase) { } /** - * basicToDigit[] contains the numeric value of a basic code - * point (for use in representing integers) in the range 0 to - * BASE-1, or -1 if b is does not represent a value. + * @return the numeric value of a basic code point (for use in representing integers) + * in the range 0 to BASE-1, or a negative value if cp is invalid. */ -static const int8_t -basicToDigit[256]={ - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, -1, - - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, - - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, - - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 -}; +static int32_t decodeDigit(int32_t cp) { + if(cp<=u'Z') { + if(cp<=u'9') { + if(cp 26..35 + } + } else { + return cp-u'A'; // A-Z -> 0..25 + } + } else if(cp<=u'z') { + return cp-'a'; // a..z -> 0..25 + } else { + return -1; + } +} static inline char asciiCaseMap(char b, UBool uppercase) { @@ -178,15 +168,23 @@ adaptBias(int32_t delta, int32_t length, UBool firstTime) { return count+(((BASE-TMIN+1)*delta)/(delta+SKEW)); } -#define MAX_CP_COUNT 200 +namespace { -U_CFUNC int32_t +// ICU-13727: Limit input length for n^2 algorithm +// where well-formed strings are at most 59 characters long. +constexpr int32_t ENCODE_MAX_CODE_UNITS=1000; +constexpr int32_t DECODE_MAX_CHARS=2000; + +} // namespace + +// encode +U_CAPI int32_t u_strToPunycode(const UChar *src, int32_t srcLength, UChar *dest, int32_t destCapacity, const UBool *caseFlags, UErrorCode *pErrorCode) { - int32_t cpBuffer[MAX_CP_COUNT]; + int32_t cpBuffer[ENCODE_MAX_CODE_UNITS]; int32_t n, delta, handledCPCount, basicLength, destLength, bias, j, m, q, k, t, srcCPCount; UChar c, c2; @@ -199,6 +197,10 @@ u_strToPunycode(const UChar *src, int32_t srcLength, *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } + if (srcLength>ENCODE_MAX_CODE_UNITS) { + *pErrorCode=U_INPUT_TOO_LONG_ERROR; + return 0; + } /* * Handle the basic code points and @@ -211,9 +213,8 @@ u_strToPunycode(const UChar *src, int32_t srcLength, if((c=src[j])==0) { break; } - if(srcCPCount==MAX_CP_COUNT) { - /* too many input code points */ - *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR; + if(j>=ENCODE_MAX_CODE_UNITS) { + *pErrorCode=U_INPUT_TOO_LONG_ERROR; return 0; } if(IS_BASIC(c)) { @@ -243,11 +244,6 @@ u_strToPunycode(const UChar *src, int32_t srcLength, } else { /* length-specified input */ for(j=0; j state to , but guard against overflow: */ - if(m-n>(0x7fffffff-MAX_CP_COUNT-delta)/(handledCPCount+1)) { + if(m-n>(0x7fffffff-handledCPCount-delta)/(handledCPCount+1)) { *pErrorCode=U_INTERNAL_PROGRAM_ERROR; return 0; } @@ -373,7 +369,8 @@ u_strToPunycode(const UChar *src, int32_t srcLength, return u_terminateUChars(dest, destCapacity, destLength, pErrorCode); } -U_CFUNC int32_t +// decode +U_CAPI int32_t u_strFromPunycode(const UChar *src, int32_t srcLength, UChar *dest, int32_t destCapacity, UBool *caseFlags, @@ -395,6 +392,10 @@ u_strFromPunycode(const UChar *src, int32_t srcLength, if(srcLength==-1) { srcLength=u_strlen(src); } + if (srcLength>DECODE_MAX_CHARS) { + *pErrorCode=U_INPUT_TOO_LONG_ERROR; + return 0; + } /* * Handle the basic code points: @@ -455,7 +456,7 @@ u_strFromPunycode(const UChar *src, int32_t srcLength, return 0; } - digit=basicToDigit[(uint8_t)src[in++]]; + digit=decodeDigit(src[in++]); if(digit<0) { *pErrorCode=U_INVALID_CHAR_FOUND; return 0; diff --git a/deps/icu-small/source/common/punycode.h b/deps/icu-small/source/common/punycode.h index 5d8a243175cca3..9e28f770c407ec 100644 --- a/deps/icu-small/source/common/punycode.h +++ b/deps/icu-small/source/common/punycode.h @@ -50,7 +50,7 @@ Adam M. Costello * @param caseFlags Vector of boolean values, one per input UChar, * indicating that the corresponding character is to be * marked for the decoder optionally - * uppercasing (TRUE) or lowercasing (FALSE) + * uppercasing (true) or lowercasing (false) * the character. * ASCII characters are output directly in the case as marked. * Flags corresponding to trail surrogates are ignored. @@ -65,7 +65,7 @@ Adam M. Costello * * @see u_strFromPunycode */ -U_CFUNC int32_t +U_CAPI int32_t u_strToPunycode(const UChar *src, int32_t srcLength, UChar *dest, int32_t destCapacity, const UBool *caseFlags, @@ -83,10 +83,10 @@ u_strToPunycode(const UChar *src, int32_t srcLength, * and of caseFlags in numbers of UBools. * @param caseFlags Output array for case flags as * defined by the Punycode string. - * The caller should uppercase (TRUE) or lowercase (FASLE) + * The caller should uppercase (true) or lowercase (FASLE) * the corresponding character in dest. * For supplementary characters, only the lead surrogate - * is marked, and FALSE is stored for the trail surrogate. + * is marked, and false is stored for the trail surrogate. * This is redundant and not necessary for ASCII characters * because they are already in the case indicated. * Can be NULL if the case flags are not needed. @@ -100,7 +100,7 @@ u_strToPunycode(const UChar *src, int32_t srcLength, * * @see u_strToPunycode */ -U_CFUNC int32_t +U_CAPI int32_t u_strFromPunycode(const UChar *src, int32_t srcLength, UChar *dest, int32_t destCapacity, UBool *caseFlags, diff --git a/deps/icu-small/source/common/putil.cpp b/deps/icu-small/source/common/putil.cpp index 51c2473c982d5d..3ed6a05d22d839 100644 --- a/deps/icu-small/source/common/putil.cpp +++ b/deps/icu-small/source/common/putil.cpp @@ -81,7 +81,7 @@ #include #ifndef U_COMMON_IMPLEMENTATION -#error U_COMMON_IMPLEMENTATION not set - must be set for all ICU source files in common/ - see http://userguide.icu-project.org/howtouseicu +#error U_COMMON_IMPLEMENTATION not set - must be set for all ICU source files in common/ - see https://unicode-org.github.io/icu/userguide/howtouseicu #endif @@ -118,11 +118,15 @@ # ifndef _XPG4_2 # define _XPG4_2 # endif +# elif U_PLATFORM == U_PF_ANDROID +# include +# include # endif #elif U_PLATFORM == U_PF_QNX # include #endif + /* * Only include langinfo.h if we have a way to get the codeset. If we later * depend on more feature, we can test on U_HAVE_NL_LANGINFO. @@ -1043,9 +1047,53 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) { } #endif +#if U_PLATFORM == U_PF_ANDROID +typedef int(system_property_read_callback)(const prop_info* info, + void (*callback)(void* cookie, + const char* name, + const char* value, + uint32_t serial), + void* cookie); +typedef int(system_property_get)(const char*, char*); + +static char gAndroidTimeZone[PROP_VALUE_MAX] = { '\0' }; + +static void u_property_read(void* cookie, const char* name, const char* value, + uint32_t serial) { + uprv_strcpy((char* )cookie, value); +} +#endif + U_CAPI void U_EXPORT2 -uprv_tzname_clear_cache() +uprv_tzname_clear_cache(void) { +#if U_PLATFORM == U_PF_ANDROID + /* Android's timezone is stored in system property. */ + gAndroidTimeZone[0] = '\0'; + void* libc = dlopen("libc.so", RTLD_NOLOAD); + if (libc) { + /* Android API 26+ has new API to get system property and old API + * (__system_property_get) is deprecated */ + system_property_read_callback* property_read_callback = + (system_property_read_callback*)dlsym( + libc, "__system_property_read_callback"); + if (property_read_callback) { + const prop_info* info = + __system_property_find("persist.sys.timezone"); + if (info) { + property_read_callback(info, &u_property_read, gAndroidTimeZone); + } + } else { + system_property_get* property_get = + (system_property_get*)dlsym(libc, "__system_property_get"); + if (property_get) { + property_get("persist.sys.timezone", gAndroidTimeZone); + } + } + dlclose(libc); + } +#endif + #if defined(CHECK_LOCALTIME_LINK) && !defined(DEBUG_SKIP_LOCALTIME_LINK) gTimeZoneBufferPtr = NULL; #endif @@ -1084,7 +1132,11 @@ uprv_tzname(int n) /* This code can be temporarily disabled to test tzname resolution later on. */ #ifndef DEBUG_TZNAME +#if U_PLATFORM == U_PF_ANDROID + tzid = gAndroidTimeZone; +#else tzid = getenv("TZ"); +#endif if (tzid != NULL && isValidOlsonID(tzid) #if U_PLATFORM == U_PF_SOLARIS /* When TZ equals localtime on Solaris, check the /etc/localtime file. */ @@ -2299,7 +2351,7 @@ u_getVersion(UVersionInfo versionArray) { #include #endif /* HAVE_DLFCN_H */ -U_INTERNAL void * U_EXPORT2 +U_CAPI void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status) { void *ret = NULL; if(U_FAILURE(*status)) return ret; @@ -2313,13 +2365,13 @@ uprv_dl_open(const char *libName, UErrorCode *status) { return ret; } -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uprv_dl_close(void *lib, UErrorCode *status) { if(U_FAILURE(*status)) return; dlclose(lib); } -U_INTERNAL UVoidFunction* U_EXPORT2 +U_CAPI UVoidFunction* U_EXPORT2 uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { union { UVoidFunction *fp; @@ -2342,7 +2394,7 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { /* Windows API implementation. */ // Note: UWP does not expose/allow these APIs, so the UWP version gets the null implementation. */ -U_INTERNAL void * U_EXPORT2 +U_CAPI void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status) { HMODULE lib = NULL; @@ -2357,7 +2409,7 @@ uprv_dl_open(const char *libName, UErrorCode *status) { return (void*)lib; } -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uprv_dl_close(void *lib, UErrorCode *status) { HMODULE handle = (HMODULE)lib; if(U_FAILURE(*status)) return; @@ -2367,7 +2419,7 @@ uprv_dl_close(void *lib, UErrorCode *status) { return; } -U_INTERNAL UVoidFunction* U_EXPORT2 +U_CAPI UVoidFunction* U_EXPORT2 uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { HMODULE handle = (HMODULE)lib; UVoidFunction* addr = NULL; @@ -2392,7 +2444,7 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { /* No dynamic loading, null (nonexistent) implementation. */ -U_INTERNAL void * U_EXPORT2 +U_CAPI void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status) { (void)libName; if(U_FAILURE(*status)) return NULL; @@ -2400,7 +2452,7 @@ uprv_dl_open(const char *libName, UErrorCode *status) { return NULL; } -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uprv_dl_close(void *lib, UErrorCode *status) { (void)lib; if(U_FAILURE(*status)) return; @@ -2408,7 +2460,7 @@ uprv_dl_close(void *lib, UErrorCode *status) { return; } -U_INTERNAL UVoidFunction* U_EXPORT2 +U_CAPI UVoidFunction* U_EXPORT2 uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { (void)lib; (void)sym; diff --git a/deps/icu-small/source/common/putilimp.h b/deps/icu-small/source/common/putilimp.h index 2e9fbcc4837cd8..a325c6c359ad26 100644 --- a/deps/icu-small/source/common/putilimp.h +++ b/deps/icu-small/source/common/putilimp.h @@ -210,93 +210,93 @@ typedef size_t uintptr_t; * Floating point utility to determine if a double is Not a Number (NaN). * @internal */ -U_INTERNAL UBool U_EXPORT2 uprv_isNaN(double d); +U_CAPI UBool U_EXPORT2 uprv_isNaN(double d); /** * Floating point utility to determine if a double has an infinite value. * @internal */ -U_INTERNAL UBool U_EXPORT2 uprv_isInfinite(double d); +U_CAPI UBool U_EXPORT2 uprv_isInfinite(double d); /** * Floating point utility to determine if a double has a positive infinite value. * @internal */ -U_INTERNAL UBool U_EXPORT2 uprv_isPositiveInfinity(double d); +U_CAPI UBool U_EXPORT2 uprv_isPositiveInfinity(double d); /** * Floating point utility to determine if a double has a negative infinite value. * @internal */ -U_INTERNAL UBool U_EXPORT2 uprv_isNegativeInfinity(double d); +U_CAPI UBool U_EXPORT2 uprv_isNegativeInfinity(double d); /** * Floating point utility that returns a Not a Number (NaN) value. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_getNaN(void); +U_CAPI double U_EXPORT2 uprv_getNaN(void); /** * Floating point utility that returns an infinite value. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_getInfinity(void); +U_CAPI double U_EXPORT2 uprv_getInfinity(void); /** * Floating point utility to truncate a double. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_trunc(double d); +U_CAPI double U_EXPORT2 uprv_trunc(double d); /** * Floating point utility to calculate the floor of a double. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_floor(double d); +U_CAPI double U_EXPORT2 uprv_floor(double d); /** * Floating point utility to calculate the ceiling of a double. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_ceil(double d); +U_CAPI double U_EXPORT2 uprv_ceil(double d); /** * Floating point utility to calculate the absolute value of a double. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_fabs(double d); +U_CAPI double U_EXPORT2 uprv_fabs(double d); /** * Floating point utility to calculate the fractional and integer parts of a double. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_modf(double d, double* pinteger); +U_CAPI double U_EXPORT2 uprv_modf(double d, double* pinteger); /** * Floating point utility to calculate the remainder of a double divided by another double. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_fmod(double d, double y); +U_CAPI double U_EXPORT2 uprv_fmod(double d, double y); /** * Floating point utility to calculate d to the power of exponent (d^exponent). * @internal */ -U_INTERNAL double U_EXPORT2 uprv_pow(double d, double exponent); +U_CAPI double U_EXPORT2 uprv_pow(double d, double exponent); /** * Floating point utility to calculate 10 to the power of exponent (10^exponent). * @internal */ -U_INTERNAL double U_EXPORT2 uprv_pow10(int32_t exponent); +U_CAPI double U_EXPORT2 uprv_pow10(int32_t exponent); /** * Floating point utility to calculate the maximum value of two doubles. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_fmax(double d, double y); +U_CAPI double U_EXPORT2 uprv_fmax(double d, double y); /** * Floating point utility to calculate the minimum value of two doubles. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_fmin(double d, double y); +U_CAPI double U_EXPORT2 uprv_fmin(double d, double y); /** * Private utility to calculate the maximum value of two integers. * @internal */ -U_INTERNAL int32_t U_EXPORT2 uprv_max(int32_t d, int32_t y); +U_CAPI int32_t U_EXPORT2 uprv_max(int32_t d, int32_t y); /** * Private utility to calculate the minimum value of two integers. * @internal */ -U_INTERNAL int32_t U_EXPORT2 uprv_min(int32_t d, int32_t y); +U_CAPI int32_t U_EXPORT2 uprv_min(int32_t d, int32_t y); #if U_IS_BIG_ENDIAN # define uprv_isNegative(number) (*((signed char *)&(number))<0) @@ -309,13 +309,13 @@ U_INTERNAL int32_t U_EXPORT2 uprv_min(int32_t d, int32_t y); * type of arbitrary bit length. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_maxMantissa(void); +U_CAPI double U_EXPORT2 uprv_maxMantissa(void); /** * Floating point utility to calculate the logarithm of a double. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_log(double d); +U_CAPI double U_EXPORT2 uprv_log(double d); /** * Does common notion of rounding e.g. uprv_floor(x + 0.5); @@ -323,7 +323,7 @@ U_INTERNAL double U_EXPORT2 uprv_log(double d); * @return the rounded double * @internal */ -U_INTERNAL double U_EXPORT2 uprv_round(double x); +U_CAPI double U_EXPORT2 uprv_round(double x); /** * Adds the signed integers a and b, storing the result in res. @@ -336,7 +336,7 @@ U_INTERNAL double U_EXPORT2 uprv_round(double x); * @return true if overflow occurred; false if no overflow occurred. * @internal */ -U_INTERNAL UBool U_EXPORT2 uprv_add32_overflow(int32_t a, int32_t b, int32_t* res); +U_CAPI UBool U_EXPORT2 uprv_add32_overflow(int32_t a, int32_t b, int32_t* res); /** * Multiplies the signed integers a and b, storing the result in res. @@ -349,7 +349,7 @@ U_INTERNAL UBool U_EXPORT2 uprv_add32_overflow(int32_t a, int32_t b, int32_t* re * @return true if overflow occurred; false if no overflow occurred. * @internal */ -U_INTERNAL UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* res); +U_CAPI UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* res); #if 0 /** @@ -359,7 +359,7 @@ U_INTERNAL UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* re * @return the number of digits after the decimal point in a double number x. * @internal */ -/*U_INTERNAL int32_t U_EXPORT2 uprv_digitsAfterDecimal(double x);*/ +/*U_CAPI int32_t U_EXPORT2 uprv_digitsAfterDecimal(double x);*/ #endif #if !U_CHARSET_IS_UTF8 @@ -371,7 +371,7 @@ U_INTERNAL UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* re * @return the default codepage for this platform * @internal */ -U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void); +U_CAPI const char* U_EXPORT2 uprv_getDefaultCodepage(void); #endif /** @@ -383,7 +383,7 @@ U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void); * @return the default locale ID string * @internal */ -U_INTERNAL const char* U_EXPORT2 uprv_getDefaultLocaleID(void); +U_CAPI const char* U_EXPORT2 uprv_getDefaultLocaleID(void); /** * Time zone utilities @@ -417,7 +417,7 @@ U_INTERNAL const char* U_EXPORT2 uprv_getDefaultLocaleID(void); * Date/Time application. * @internal */ -U_INTERNAL void U_EXPORT2 uprv_tzset(void); +U_CAPI void U_EXPORT2 uprv_tzset(void); /** * Difference in seconds between coordinated universal @@ -425,7 +425,7 @@ U_INTERNAL void U_EXPORT2 uprv_tzset(void); * @return the difference in seconds between coordinated universal time and local time. * @internal */ -U_INTERNAL int32_t U_EXPORT2 uprv_timezone(void); +U_CAPI int32_t U_EXPORT2 uprv_timezone(void); /** * tzname(0) Three-letter time-zone name derived from TZ environment @@ -435,13 +435,13 @@ U_INTERNAL int32_t U_EXPORT2 uprv_timezone(void); * tzname(1) is an empty string. * @internal */ -U_INTERNAL const char* U_EXPORT2 uprv_tzname(int n); +U_CAPI const char* U_EXPORT2 uprv_tzname(int n); /** * Reset the global tzname cache. * @internal */ -U_INTERNAL void uprv_tzname_clear_cache(); +U_CAPI void uprv_tzname_clear_cache(void); /** * Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970. @@ -449,7 +449,7 @@ U_INTERNAL void uprv_tzname_clear_cache(); * @return the UTC time measured in milliseconds * @internal */ -U_INTERNAL UDate U_EXPORT2 uprv_getUTCtime(void); +U_CAPI UDate U_EXPORT2 uprv_getUTCtime(void); /** * Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970. @@ -458,15 +458,15 @@ U_INTERNAL UDate U_EXPORT2 uprv_getUTCtime(void); * @return the UTC time measured in milliseconds * @internal */ -U_INTERNAL UDate U_EXPORT2 uprv_getRawUTCtime(void); +U_CAPI UDate U_EXPORT2 uprv_getRawUTCtime(void); /** * Determine whether a pathname is absolute or not, as defined by the platform. * @param path Pathname to test - * @return TRUE if the path is absolute + * @return true if the path is absolute * @internal (ICU 3.0) */ -U_INTERNAL UBool U_EXPORT2 uprv_pathIsAbsolute(const char *path); +U_CAPI UBool U_EXPORT2 uprv_pathIsAbsolute(const char *path); /** * Use U_MAX_PTR instead of this function. @@ -474,7 +474,7 @@ U_INTERNAL UBool U_EXPORT2 uprv_pathIsAbsolute(const char *path); * @return the largest possible pointer greater than the base * @internal (ICU 3.8) */ -U_INTERNAL void * U_EXPORT2 uprv_maximumPtr(void *base); +U_CAPI void * U_EXPORT2 uprv_maximumPtr(void *base); /** * Maximum value of a (void*) - use to indicate the limit of an 'infinite' buffer. @@ -572,26 +572,26 @@ typedef void (UVoidFunction)(void); * Load a library * @internal (ICU 4.4) */ -U_INTERNAL void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status); +U_CAPI void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status); /** * Close a library * @internal (ICU 4.4) */ -U_INTERNAL void U_EXPORT2 uprv_dl_close( void *lib, UErrorCode *status); +U_CAPI void U_EXPORT2 uprv_dl_close( void *lib, UErrorCode *status); /** * Extract a symbol from a library (function) * @internal (ICU 4.8) */ -U_INTERNAL UVoidFunction* U_EXPORT2 uprv_dlsym_func( void *lib, const char *symbolName, UErrorCode *status); +U_CAPI UVoidFunction* U_EXPORT2 uprv_dlsym_func( void *lib, const char *symbolName, UErrorCode *status); /** * Extract a symbol from a library (function) * Not implemented, no clients. * @internal */ -/* U_INTERNAL void * U_EXPORT2 uprv_dlsym_data( void *lib, const char *symbolName, UErrorCode *status); */ +/* U_CAPI void * U_EXPORT2 uprv_dlsym_data( void *lib, const char *symbolName, UErrorCode *status); */ #endif diff --git a/deps/icu-small/source/common/rbbi.cpp b/deps/icu-small/source/common/rbbi.cpp index 43ba58ba9e6577..9b7e70c3cf419f 100644 --- a/deps/icu-small/source/common/rbbi.cpp +++ b/deps/icu-small/source/common/rbbi.cpp @@ -68,10 +68,18 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode init(status); fData = new RBBIDataWrapper(data, status); // status checked in constructor if (U_FAILURE(status)) {return;} - if(fData == 0) { + if(fData == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } + if (fData->fForwardTable->fLookAheadResultsSize > 0) { + fLookAheadMatches = static_cast( + uprv_malloc(fData->fForwardTable->fLookAheadResultsSize * sizeof(int32_t))); + if (fLookAheadMatches == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + } } // @@ -98,10 +106,18 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(const uint8_t *compiledRules, } fData = new RBBIDataWrapper(data, RBBIDataWrapper::kDontAdopt, status); if (U_FAILURE(status)) {return;} - if(fData == 0) { + if(fData == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } + if (fData->fForwardTable->fLookAheadResultsSize > 0) { + fLookAheadMatches = static_cast( + uprv_malloc(fData->fForwardTable->fLookAheadResultsSize * sizeof(int32_t))); + if (fLookAheadMatches == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + } } @@ -117,10 +133,18 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(UDataMemory* udm, UErrorCode &sta init(status); fData = new RBBIDataWrapper(udm, status); // status checked in constructor if (U_FAILURE(status)) {return;} - if(fData == 0) { + if(fData == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } + if (fData->fForwardTable->fLookAheadResultsSize > 0) { + fLookAheadMatches = static_cast( + uprv_malloc(fData->fForwardTable->fLookAheadResultsSize * sizeof(int32_t))); + if (fLookAheadMatches == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + } } @@ -188,30 +212,34 @@ RuleBasedBreakIterator::~RuleBasedBreakIterator() { // fCharIter was adopted from the outside. delete fCharIter; } - fCharIter = NULL; + fCharIter = nullptr; utext_close(&fText); - if (fData != NULL) { + if (fData != nullptr) { fData->removeReference(); - fData = NULL; + fData = nullptr; } delete fBreakCache; - fBreakCache = NULL; + fBreakCache = nullptr; delete fDictionaryCache; - fDictionaryCache = NULL; + fDictionaryCache = nullptr; delete fLanguageBreakEngines; - fLanguageBreakEngines = NULL; + fLanguageBreakEngines = nullptr; delete fUnhandledBreakEngine; - fUnhandledBreakEngine = NULL; + fUnhandledBreakEngine = nullptr; + + uprv_free(fLookAheadMatches); + fLookAheadMatches = nullptr; } /** * Assignment operator. Sets this iterator to have the same behavior, * and iterate over the same text, as the one passed in. + * TODO: needs better handling of memory allocation errors. */ RuleBasedBreakIterator& RuleBasedBreakIterator::operator=(const RuleBasedBreakIterator& that) { @@ -252,6 +280,14 @@ RuleBasedBreakIterator::operator=(const RuleBasedBreakIterator& that) { fData = that.fData->addReference(); } + uprv_free(fLookAheadMatches); + fLookAheadMatches = nullptr; + if (fData && fData->fForwardTable->fLookAheadResultsSize > 0) { + fLookAheadMatches = static_cast( + uprv_malloc(fData->fForwardTable->fLookAheadResultsSize * sizeof(int32_t))); + } + + fPosition = that.fPosition; fRuleStatusIndex = that.fRuleStatusIndex; fDone = that.fDone; @@ -275,16 +311,17 @@ RuleBasedBreakIterator::operator=(const RuleBasedBreakIterator& that) { // //----------------------------------------------------------------------------- void RuleBasedBreakIterator::init(UErrorCode &status) { - fCharIter = NULL; - fData = NULL; + fCharIter = nullptr; + fData = nullptr; fPosition = 0; fRuleStatusIndex = 0; fDone = false; fDictionaryCharCount = 0; - fLanguageBreakEngines = NULL; - fUnhandledBreakEngine = NULL; - fBreakCache = NULL; - fDictionaryCache = NULL; + fLanguageBreakEngines = nullptr; + fUnhandledBreakEngine = nullptr; + fBreakCache = nullptr; + fDictionaryCache = nullptr; + fLookAheadMatches = nullptr; // Note: IBM xlC is unable to assign or initialize member fText from UTEXT_INITIALIZER. // fText = UTEXT_INITIALIZER; @@ -700,50 +737,53 @@ enum RBBIRunMode { }; -// Map from look-ahead break states (corresponds to rules) to boundary positions. -// Allows multiple lookahead break rules to be in flight at the same time. +// Wrapper functions to select the appropriate handleNext() or handleSafePrevious() +// instantiation, based on whether an 8 or 16 bit table is required. // -// This is a temporary approach for ICU 57. A better fix is to make the look-ahead numbers -// in the state table be sequential, then we can just index an array. And the -// table could also tell us in advance how big that array needs to be. -// -// Before ICU 57 there was just a single simple variable for a look-ahead match that -// was in progress. Two rules at once did not work. - -static const int32_t kMaxLookaheads = 8; -struct LookAheadResults { - int32_t fUsedSlotLimit; - int32_t fPositions[8]; - int16_t fKeys[8]; +// These Trie access functions will be inlined within the handleNext()/Previous() instantions. +static inline uint16_t TrieFunc8(const UCPTrie *trie, UChar32 c) { + return UCPTRIE_FAST_GET(trie, UCPTRIE_8, c); +} - LookAheadResults() : fUsedSlotLimit(0), fPositions(), fKeys() {} +static inline uint16_t TrieFunc16(const UCPTrie *trie, UChar32 c) { + return UCPTRIE_FAST_GET(trie, UCPTRIE_16, c); +} - int32_t getPosition(int16_t key) { - for (int32_t i=0; ifForwardTable; + bool use8BitsTrie = ucptrie_getValueWidth(fData->fTrie) == UCPTRIE_VALUE_BITS_8; + if (statetable->fFlags & RBBI_8BITS_ROWS) { + if (use8BitsTrie) { + return handleNext(); + } else { + return handleNext(); + } + } else { + if (use8BitsTrie) { + return handleNext(); + } else { + return handleNext(); } - UPRV_UNREACHABLE; } +} - void setPosition(int16_t key, int32_t position) { - int32_t i; - for (i=0; ifReverseTable; + bool use8BitsTrie = ucptrie_getValueWidth(fData->fTrie) == UCPTRIE_VALUE_BITS_8; + if (statetable->fFlags & RBBI_8BITS_ROWS) { + if (use8BitsTrie) { + return handleSafePrevious(fromPosition); + } else { + return handleSafePrevious(fromPosition); } - if (i >= kMaxLookaheads) { - UPRV_UNREACHABLE; + } else { + if (use8BitsTrie) { + return handleSafePrevious(fromPosition); + } else { + return handleSafePrevious(fromPosition); } - fKeys[i] = key; - fPositions[i] = position; - U_ASSERT(fUsedSlotLimit == i); - fUsedSlotLimit = i + 1; } -}; +} //----------------------------------------------------------------------------------- @@ -752,19 +792,20 @@ struct LookAheadResults { // Run the state machine to find a boundary // //----------------------------------------------------------------------------------- +template int32_t RuleBasedBreakIterator::handleNext() { int32_t state; uint16_t category = 0; RBBIRunMode mode; - RBBIStateTableRow *row; + RowType *row; UChar32 c; - LookAheadResults lookAheadMatches; int32_t result = 0; int32_t initialPosition = 0; const RBBIStateTable *statetable = fData->fForwardTable; const char *tableData = statetable->fTableData; uint32_t tableRowLen = statetable->fRowLen; + uint32_t dictStart = statetable->fDictCategoriesStart; #ifdef RBBI_DEBUG if (gTrace) { RBBIDebugPuts("Handle Next pos char state category"); @@ -789,7 +830,7 @@ int32_t RuleBasedBreakIterator::handleNext() { // Set the initial state for the state machine state = START_STATE; - row = (RBBIStateTableRow *) + row = (RowType *) //(statetable->fTableData + (statetable->fRowLen * state)); (tableData + tableRowLen * state); @@ -825,21 +866,8 @@ int32_t RuleBasedBreakIterator::handleNext() { if (mode == RBBI_RUN) { // look up the current character's character category, which tells us // which column in the state table to look at. - // Note: the 16 in UTRIE_GET16 refers to the size of the data being returned, - // not the size of the character going in, which is a UChar32. - // - category = UTRIE2_GET16(fData->fTrie, c); - - // Check the dictionary bit in the character's category. - // Counter is only used by dictionary based iteration. - // Chars that need to be handled by a dictionary have a flag bit set - // in their category values. - // - if ((category & 0x4000) != 0) { - fDictionaryCharCount++; - // And off the dictionary flag bit. - category &= ~0x4000; - } + category = trieFunc(fData->fTrie, c); + fDictionaryCharCount += (category >= dictStart); } #ifdef RBBI_DEBUG @@ -860,25 +888,24 @@ int32_t RuleBasedBreakIterator::handleNext() { // fNextState is a variable-length array. U_ASSERT(categoryfHeader->fCatCount); state = row->fNextState[category]; /*Not accessing beyond memory*/ - row = (RBBIStateTableRow *) + row = (RowType *) // (statetable->fTableData + (statetable->fRowLen * state)); (tableData + tableRowLen * state); - if (row->fAccepting == -1) { + uint16_t accepting = row->fAccepting; + if (accepting == ACCEPTING_UNCONDITIONAL) { // Match found, common case. if (mode != RBBI_START) { result = (int32_t)UTEXT_GETNATIVEINDEX(&fText); } - fRuleStatusIndex = row->fTagIdx; // Remember the break status (tag) values. - } - - int16_t completedRule = row->fAccepting; - if (completedRule > 0) { + fRuleStatusIndex = row->fTagsIdx; // Remember the break status (tag) values. + } else if (accepting > ACCEPTING_UNCONDITIONAL) { // Lookahead match is completed. - int32_t lookaheadResult = lookAheadMatches.getPosition(completedRule); + U_ASSERT(accepting < fData->fForwardTable->fLookAheadResultsSize); + int32_t lookaheadResult = fLookAheadMatches[accepting]; if (lookaheadResult >= 0) { - fRuleStatusIndex = row->fTagIdx; + fRuleStatusIndex = row->fTagsIdx; fPosition = lookaheadResult; return lookaheadResult; } @@ -890,10 +917,12 @@ int32_t RuleBasedBreakIterator::handleNext() { // This would enable hard-break rules with no following context. // But there are line break test failures when trying this. Investigate. // Issue ICU-20837 - int16_t rule = row->fLookAhead; - if (rule != 0) { + uint16_t rule = row->fLookAhead; + U_ASSERT(rule == 0 || rule > ACCEPTING_UNCONDITIONAL); + U_ASSERT(rule == 0 || rule < fData->fForwardTable->fLookAheadResultsSize); + if (rule > ACCEPTING_UNCONDITIONAL) { int32_t pos = (int32_t)UTEXT_GETNATIVEINDEX(&fText); - lookAheadMatches.setPosition(rule, pos); + fLookAheadMatches[rule] = pos; } if (state == STOP_STATE) { @@ -948,10 +977,12 @@ int32_t RuleBasedBreakIterator::handleNext() { // because the safe table does not require as many options. // //----------------------------------------------------------------------------------- +template int32_t RuleBasedBreakIterator::handleSafePrevious(int32_t fromPosition) { + int32_t state; uint16_t category = 0; - RBBIStateTableRow *row; + RowType *row; UChar32 c; int32_t result = 0; @@ -971,7 +1002,7 @@ int32_t RuleBasedBreakIterator::handleSafePrevious(int32_t fromPosition) { // Set the initial state for the state machine c = UTEXT_PREVIOUS32(&fText); state = START_STATE; - row = (RBBIStateTableRow *) + row = (RowType *) (stateTable->fTableData + (stateTable->fRowLen * state)); // loop until we reach the start of the text or transition to state 0 @@ -980,12 +1011,9 @@ int32_t RuleBasedBreakIterator::handleSafePrevious(int32_t fromPosition) { // look up the current character's character category, which tells us // which column in the state table to look at. - // Note: the 16 in UTRIE_GET16 refers to the size of the data being returned, - // not the size of the character going in, which is a UChar32. // - // And off the dictionary flag bit. For reverse iteration it is not used. - category = UTRIE2_GET16(fData->fTrie, c); - category &= ~0x4000; + // Off the dictionary flag bit. For reverse iteration it is not used. + category = trieFunc(fData->fTrie, c); #ifdef RBBI_DEBUG if (gTrace) { @@ -1004,7 +1032,7 @@ int32_t RuleBasedBreakIterator::handleSafePrevious(int32_t fromPosition) { // fNextState is a variable-length array. U_ASSERT(categoryfHeader->fCatCount); state = row->fNextState[category]; /*Not accessing beyond memory*/ - row = (RBBIStateTableRow *) + row = (RowType *) (stateTable->fTableData + (stateTable->fRowLen * state)); if (state == STOP_STATE) { @@ -1024,6 +1052,7 @@ int32_t RuleBasedBreakIterator::handleSafePrevious(int32_t fromPosition) { return result; } + //------------------------------------------------------------------------------- // // getRuleStatus() Return the break rule tag associated with the current diff --git a/deps/icu-small/source/common/rbbi_cache.cpp b/deps/icu-small/source/common/rbbi_cache.cpp index 4f9e83360a2a32..63ff3001c7034e 100644 --- a/deps/icu-small/source/common/rbbi_cache.cpp +++ b/deps/icu-small/source/common/rbbi_cache.cpp @@ -142,13 +142,15 @@ void RuleBasedBreakIterator::DictionaryCache::populateDictionary(int32_t startPo utext_setNativeIndex(text, rangeStart); UChar32 c = utext_current32(text); - category = UTRIE2_GET16(fBI->fData->fTrie, c); + category = ucptrie_get(fBI->fData->fTrie, c); + uint32_t dictStart = fBI->fData->fForwardTable->fDictCategoriesStart; while(U_SUCCESS(status)) { - while((current = (int32_t)UTEXT_GETNATIVEINDEX(text)) < rangeEnd && (category & 0x4000) == 0) { + while((current = (int32_t)UTEXT_GETNATIVEINDEX(text)) < rangeEnd + && (category < dictStart)) { utext_next32(text); // TODO: cleaner loop structure. c = utext_current32(text); - category = UTRIE2_GET16(fBI->fData->fTrie, c); + category = ucptrie_get(fBI->fData->fTrie, c); } if (current >= rangeEnd) { break; @@ -166,7 +168,7 @@ void RuleBasedBreakIterator::DictionaryCache::populateDictionary(int32_t startPo // Reload the loop variables for the next go-round c = utext_current32(text); - category = UTRIE2_GET16(fBI->fData->fTrie, c); + category = ucptrie_get(fBI->fData->fTrie, c); } // If we found breaks, ensure that the first and last entries are diff --git a/deps/icu-small/source/common/rbbi_cache.h b/deps/icu-small/source/common/rbbi_cache.h index 864ff811aaaff3..8c1fa86e7d1aa1 100644 --- a/deps/icu-small/source/common/rbbi_cache.h +++ b/deps/icu-small/source/common/rbbi_cache.h @@ -126,13 +126,13 @@ class RuleBasedBreakIterator::BreakCache: public UMemory { * Additional boundaries, either preceding or following, may be added * to the cache as a side effect. * - * Return FALSE if the operation failed. + * Return false if the operation failed. */ UBool populateNear(int32_t position, UErrorCode &status); /** * Add boundary(s) to the cache following the current last boundary. - * Return FALSE if at the end of the text, and no more boundaries can be added. + * Return false if at the end of the text, and no more boundaries can be added. * Leave iteration position at the first newly added boundary, or unchanged if no boundary was added. */ UBool populateFollowing(); @@ -170,7 +170,7 @@ class RuleBasedBreakIterator::BreakCache: public UMemory { * Fails if the requested position is outside of the range of boundaries currently held by the cache. * The startPosition must be on a code point boundary. * - * Return TRUE if successful, FALSE if the specified position is after + * Return true if successful, false if the specified position is after * the last cached boundary or before the first. */ UBool seek(int32_t startPosition); diff --git a/deps/icu-small/source/common/rbbicst.pl b/deps/icu-small/source/common/rbbicst.pl index 839b9501dda953..29f575d7d09357 100755 --- a/deps/icu-small/source/common/rbbicst.pl +++ b/deps/icu-small/source/common/rbbicst.pl @@ -1,6 +1,6 @@ #************************************************************************** # Copyright (C) 2016 and later: Unicode, Inc. and others. -# License & terms of use: http://www.unicode.org/copyright.html#License +# License & terms of use: http://www.unicode.org/copyright.html #************************************************************************** #************************************************************************** # Copyright (C) 2002-2016 International Business Machines Corporation diff --git a/deps/icu-small/source/common/rbbidata.cpp b/deps/icu-small/source/common/rbbidata.cpp index fdcb564961362e..f78d9d06689178 100644 --- a/deps/icu-small/source/common/rbbidata.cpp +++ b/deps/icu-small/source/common/rbbidata.cpp @@ -11,10 +11,10 @@ #if !UCONFIG_NO_BREAK_ITERATION +#include "unicode/ucptrie.h" #include "unicode/utypes.h" #include "rbbidata.h" #include "rbbirb.h" -#include "utrie2.h" #include "udatamem.h" #include "cmemory.h" #include "cstring.h" @@ -110,17 +110,24 @@ void RBBIDataWrapper::init(const RBBIDataHeader *data, UErrorCode &status) { fReverseTable = (RBBIStateTable *)((char *)data + fHeader->fRTable); } - fTrie = utrie2_openFromSerialized(UTRIE2_16_VALUE_BITS, - (uint8_t *)data + fHeader->fTrie, - fHeader->fTrieLen, - NULL, // *actual length - &status); + fTrie = ucptrie_openFromBinary(UCPTRIE_TYPE_FAST, + UCPTRIE_VALUE_BITS_ANY, + (uint8_t *)data + fHeader->fTrie, + fHeader->fTrieLen, + nullptr, // *actual length + &status); if (U_FAILURE(status)) { return; } - fRuleSource = (UChar *)((char *)data + fHeader->fRuleSource); - fRuleString.setTo(TRUE, fRuleSource, -1); + UCPTrieValueWidth width = ucptrie_getValueWidth(fTrie); + if (!(width == UCPTRIE_VALUE_BITS_8 || width == UCPTRIE_VALUE_BITS_16)) { + status = U_INVALID_FORMAT_ERROR; + return; + } + + fRuleSource = ((char *)data + fHeader->fRuleSource); + fRuleString = UnicodeString::fromUTF8(StringPiece(fRuleSource, fHeader->fRuleSourceLen)); U_ASSERT(data->fRuleSourceLen > 0); fRuleStatusTable = (int32_t *)((char *)data + fHeader->fStatusTable); @@ -142,8 +149,8 @@ void RBBIDataWrapper::init(const RBBIDataHeader *data, UErrorCode &status) { //----------------------------------------------------------------------------- RBBIDataWrapper::~RBBIDataWrapper() { U_ASSERT(fRefCount == 0); - utrie2_close(fTrie); - fTrie = NULL; + ucptrie_close(fTrie); + fTrie = nullptr; if (fUDataMem) { udata_close(fUDataMem); } else if (!fDontFreeData) { @@ -223,9 +230,16 @@ void RBBIDataWrapper::printTable(const char *heading, const RBBIStateTable *tab uint32_t c; uint32_t s; - RBBIDebugPrintf(" %s\n", heading); + RBBIDebugPrintf("%s\n", heading); - RBBIDebugPrintf("State | Acc LA TagIx"); + RBBIDebugPrintf(" fDictCategoriesStart: %d\n", table->fDictCategoriesStart); + RBBIDebugPrintf(" fLookAheadResultsSize: %d\n", table->fLookAheadResultsSize); + RBBIDebugPrintf(" Flags: %4x RBBI_LOOKAHEAD_HARD_BREAK=%s RBBI_BOF_REQUIRED=%s RBBI_8BITS_ROWS=%s\n", + table->fFlags, + table->fFlags & RBBI_LOOKAHEAD_HARD_BREAK ? "T" : "F", + table->fFlags & RBBI_BOF_REQUIRED ? "T" : "F", + table->fFlags & RBBI_8BITS_ROWS ? "T" : "F"); + RBBIDebugPrintf("\nState | Acc LA TagIx"); for (c=0; cfCatCount; c++) {RBBIDebugPrintf("%3d ", c);} RBBIDebugPrintf("\n------|---------------"); for (c=0;cfCatCount; c++) { RBBIDebugPrintf("----"); @@ -236,12 +250,20 @@ void RBBIDataWrapper::printTable(const char *heading, const RBBIStateTable *tab RBBIDebugPrintf(" N U L L T A B L E\n\n"); return; } + UBool use8Bits = table->fFlags & RBBI_8BITS_ROWS; for (s=0; sfNumStates; s++) { RBBIStateTableRow *row = (RBBIStateTableRow *) (table->fTableData + (table->fRowLen * s)); - RBBIDebugPrintf("%4d | %3d %3d %3d ", s, row->fAccepting, row->fLookAhead, row->fTagIdx); - for (c=0; cfCatCount; c++) { - RBBIDebugPrintf("%3d ", row->fNextState[c]); + if (use8Bits) { + RBBIDebugPrintf("%4d | %3d %3d %3d ", s, row->r8.fAccepting, row->r8.fLookAhead, row->r8.fTagsIdx); + for (c=0; cfCatCount; c++) { + RBBIDebugPrintf("%3d ", row->r8.fNextState[c]); + } + } else { + RBBIDebugPrintf("%4d | %3d %3d %3d ", s, row->r16.fAccepting, row->r16.fLookAhead, row->r16.fTagsIdx); + for (c=0; cfCatCount; c++) { + RBBIDebugPrintf("%3d ", row->r16.fNextState[c]); + } } RBBIDebugPrintf("\n"); } @@ -382,10 +404,23 @@ ubrk_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outD tableLength = ds->readUInt32(rbbiDH->fFTableLen); if (tableLength > 0) { + RBBIStateTable *rbbiST = (RBBIStateTable *)(inBytes+tableStartOffset); + UBool use8Bits = ds->readUInt32(rbbiST->fFlags) & RBBI_8BITS_ROWS; + ds->swapArray32(ds, inBytes+tableStartOffset, topSize, outBytes+tableStartOffset, status); - ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize, - outBytes+tableStartOffset+topSize, status); + + // Swap the state table if the table is in 16 bits. + if (use8Bits) { + if (outBytes != inBytes) { + uprv_memmove(outBytes+tableStartOffset+topSize, + inBytes+tableStartOffset+topSize, + tableLength-topSize); + } + } else { + ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize, + outBytes+tableStartOffset+topSize, status); + } } // Reverse state table. Same layout as forward table, above. @@ -393,19 +428,35 @@ ubrk_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outD tableLength = ds->readUInt32(rbbiDH->fRTableLen); if (tableLength > 0) { + RBBIStateTable *rbbiST = (RBBIStateTable *)(inBytes+tableStartOffset); + UBool use8Bits = ds->readUInt32(rbbiST->fFlags) & RBBI_8BITS_ROWS; + ds->swapArray32(ds, inBytes+tableStartOffset, topSize, outBytes+tableStartOffset, status); - ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize, - outBytes+tableStartOffset+topSize, status); + + // Swap the state table if the table is in 16 bits. + if (use8Bits) { + if (outBytes != inBytes) { + uprv_memmove(outBytes+tableStartOffset+topSize, + inBytes+tableStartOffset+topSize, + tableLength-topSize); + } + } else { + ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize, + outBytes+tableStartOffset+topSize, status); + } } // Trie table for character categories - utrie2_swap(ds, inBytes+ds->readUInt32(rbbiDH->fTrie), ds->readUInt32(rbbiDH->fTrieLen), - outBytes+ds->readUInt32(rbbiDH->fTrie), status); - - // Source Rules Text. It's UChar data - ds->swapArray16(ds, inBytes+ds->readUInt32(rbbiDH->fRuleSource), ds->readUInt32(rbbiDH->fRuleSourceLen), - outBytes+ds->readUInt32(rbbiDH->fRuleSource), status); + ucptrie_swap(ds, inBytes+ds->readUInt32(rbbiDH->fTrie), ds->readUInt32(rbbiDH->fTrieLen), + outBytes+ds->readUInt32(rbbiDH->fTrie), status); + + // Source Rules Text. It's UTF8 data + if (outBytes != inBytes) { + uprv_memmove(outBytes+ds->readUInt32(rbbiDH->fRuleSource), + inBytes+ds->readUInt32(rbbiDH->fRuleSource), + ds->readUInt32(rbbiDH->fRuleSourceLen)); + } // Table of rule status values. It's all int_32 values ds->swapArray32(ds, inBytes+ds->readUInt32(rbbiDH->fStatusTable), ds->readUInt32(rbbiDH->fStatusTableLen), diff --git a/deps/icu-small/source/common/rbbidata.h b/deps/icu-small/source/common/rbbidata.h index 96e4649533f068..5d725deba4c262 100644 --- a/deps/icu-small/source/common/rbbidata.h +++ b/deps/icu-small/source/common/rbbidata.h @@ -49,16 +49,17 @@ ubrk_swap(const UDataSwapper *ds, #ifdef __cplusplus +#include "unicode/ucptrie.h" #include "unicode/uobject.h" #include "unicode/unistr.h" #include "unicode/uversion.h" #include "umutex.h" -#include "utrie2.h" + U_NAMESPACE_BEGIN // The current RBBI data format version. -static const uint8_t RBBI_DATA_FORMAT_VERSION[] = {5, 0, 0, 0}; +static const uint8_t RBBI_DATA_FORMAT_VERSION[] = {6, 0, 0, 0}; /* * The following structs map exactly onto the raw data from ICU common data file. @@ -94,49 +95,61 @@ struct RBBIDataHeader { -struct RBBIStateTableRow { - int16_t fAccepting; /* Non-zero if this row is for an accepting state. */ - /* Value 0: not an accepting state. */ - /* -1: Unconditional Accepting state. */ - /* positive: Look-ahead match has completed. */ - /* Actual boundary position happened earlier */ - /* Value here == fLookAhead in earlier */ - /* state, at actual boundary pos. */ - int16_t fLookAhead; /* Non-zero if this row is for a state that */ - /* corresponds to a '/' in the rule source. */ - /* Value is the same as the fAccepting */ - /* value for the rule (which will appear */ - /* in a different state. */ - int16_t fTagIdx; /* Non-zero if this row covers a {tagged} position */ - /* from a rule. Value is the index in the */ - /* StatusTable of the set of matching */ - /* tags (rule status values) */ - int16_t fReserved; - uint16_t fNextState[1]; /* Next State, indexed by char category. */ - /* Variable-length array declared with length 1 */ - /* to disable bounds checkers. */ - /* Array Size is actually fData->fHeader->fCatCount*/ - /* CAUTION: see RBBITableBuilder::getTableSize() */ - /* before changing anything here. */ +template +struct RBBIStateTableRowT { + T fAccepting; // Non-zero if this row is for an accepting state. + // Value 0: not an accepting state. + // 1: (ACCEPTING_UNCONDITIONAL) Unconditional Accepting state. + // >1: Look-ahead match has completed. + // Actual boundary position happened earlier. + // Value here == fLookAhead in earlier + // state, at actual boundary pos. + T fLookAhead; // Non-zero if this row is for a state that + // corresponds to a '/' in the rule source. + // Value is the same as the fAccepting + // value for the rule (which will appear + // in a different state. + T fTagsIdx; // Non-zero if this row covers a {tagged} position + // from a rule. Value is the index in the + // StatusTable of the set of matching + // tags (rule status values) + T fNextState[1]; // Next State, indexed by char category. + // Variable-length array declared with length 1 + // to disable bounds checkers. + // Array Size is actually fData->fHeader->fCatCount + // CAUTION: see RBBITableBuilder::getTableSize() + // before changing anything here. }; +typedef RBBIStateTableRowT RBBIStateTableRow8; +typedef RBBIStateTableRowT RBBIStateTableRow16; + +constexpr uint16_t ACCEPTING_UNCONDITIONAL = 1; // Value constant for RBBIStateTableRow::fAccepting + +union RBBIStateTableRow { + RBBIStateTableRow16 r16; + RBBIStateTableRow8 r8; +}; struct RBBIStateTable { - uint32_t fNumStates; /* Number of states. */ - uint32_t fRowLen; /* Length of a state table row, in bytes. */ - uint32_t fFlags; /* Option Flags for this state table */ - uint32_t fReserved; /* reserved */ - char fTableData[1]; /* First RBBIStateTableRow begins here. */ - /* Variable-length array declared with length 1 */ - /* to disable bounds checkers. */ - /* (making it char[] simplifies ugly address */ - /* arithmetic for indexing variable length rows.) */ + uint32_t fNumStates; // Number of states. + uint32_t fRowLen; // Length of a state table row, in bytes. + uint32_t fDictCategoriesStart; // Char category number of the first dictionary + // char class, or the the largest category number + 1 + // if there are no dictionary categories. + uint32_t fLookAheadResultsSize; // Size of run-time array required for holding + // look-ahead results. Indexed by row.fLookAhead. + uint32_t fFlags; // Option Flags for this state table. + char fTableData[1]; // First RBBIStateTableRow begins here. + // Variable-length array declared with length 1 + // to disable bounds checkers. + // (making it char[] simplifies ugly address + // arithmetic for indexing variable length rows.) }; -typedef enum { - RBBI_LOOKAHEAD_HARD_BREAK = 1, - RBBI_BOF_REQUIRED = 2 -} RBBIStateTableFlags; +constexpr uint32_t RBBI_LOOKAHEAD_HARD_BREAK = 1; +constexpr uint32_t RBBI_BOF_REQUIRED = 2; +constexpr uint32_t RBBI_8BITS_ROWS = 4; /* */ @@ -170,13 +183,13 @@ class RBBIDataWrapper : public UMemory { const RBBIDataHeader *fHeader; const RBBIStateTable *fForwardTable; const RBBIStateTable *fReverseTable; - const UChar *fRuleSource; + const char *fRuleSource; const int32_t *fRuleStatusTable; /* number of int32_t values in the rule status table. Used to sanity check indexing */ int32_t fStatusMaxIdx; - UTrie2 *fTrie; + UCPTrie *fTrie; private: u_atomic_int32_t fRefCount; @@ -184,8 +197,8 @@ class RBBIDataWrapper : public UMemory { UnicodeString fRuleString; UBool fDontFreeData; - RBBIDataWrapper(const RBBIDataWrapper &other); /* forbid copying of this class */ - RBBIDataWrapper &operator=(const RBBIDataWrapper &other); /* forbid copying of this class */ + RBBIDataWrapper(const RBBIDataWrapper &other) = delete; /* forbid copying of this class */ + RBBIDataWrapper &operator=(const RBBIDataWrapper &other) = delete; /* forbid copying of this class */ }; diff --git a/deps/icu-small/source/common/rbbinode.h b/deps/icu-small/source/common/rbbinode.h index e33662167fe3fd..ef4e4ccac7f08e 100644 --- a/deps/icu-small/source/common/rbbinode.h +++ b/deps/icu-small/source/common/rbbinode.h @@ -79,7 +79,7 @@ class RBBINode : public UMemory { // corresponds to columns in the final // state transition table. - UBool fLookAheadEnd; // For endMark nodes, set TRUE if + UBool fLookAheadEnd; // For endMark nodes, set true if // marking the end of a look-ahead rule. UBool fRuleRoot; // True if this node is the root of a rule. diff --git a/deps/icu-small/source/common/rbbirb.cpp b/deps/icu-small/source/common/rbbirb.cpp index 4df96532643d06..09c8d3de7e6687 100644 --- a/deps/icu-small/source/common/rbbirb.cpp +++ b/deps/icu-small/source/common/rbbirb.cpp @@ -22,6 +22,7 @@ #include "unicode/uniset.h" #include "unicode/uchar.h" #include "unicode/uchriter.h" +#include "unicode/ustring.h" #include "unicode/parsepos.h" #include "unicode/parseerr.h" @@ -154,7 +155,14 @@ RBBIDataHeader *RBBIRuleBuilder::flattenData() { int32_t reverseTableSize = align8(fForwardTable->getSafeTableSize()); int32_t trieSize = align8(fSetBuilder->getTrieSize()); int32_t statusTableSize = align8(fRuleStatusVals->size() * sizeof(int32_t)); - int32_t rulesSize = align8((fStrippedRules.length()+1) * sizeof(UChar)); + + int32_t rulesLengthInUTF8 = 0; + u_strToUTF8WithSub(0, 0, &rulesLengthInUTF8, + fStrippedRules.getBuffer(), fStrippedRules.length(), + 0xfffd, nullptr, fStatus); + *fStatus = U_ZERO_ERROR; + + int32_t rulesSize = align8((rulesLengthInUTF8+1)); int32_t totalSize = headerSize + forwardTableSize @@ -197,11 +205,11 @@ RBBIDataHeader *RBBIRuleBuilder::flattenData() { data->fRTableLen = reverseTableSize; data->fTrie = data->fRTable + data->fRTableLen; - data->fTrieLen = fSetBuilder->getTrieSize(); - data->fStatusTable = data->fTrie + trieSize; + data->fTrieLen = trieSize; + data->fStatusTable = data->fTrie + data->fTrieLen; data->fStatusTableLen= statusTableSize; data->fRuleSource = data->fStatusTable + statusTableSize; - data->fRuleSourceLen = fStrippedRules.length() * sizeof(UChar); + data->fRuleSourceLen = rulesLengthInUTF8; uprv_memset(data->fReserved, 0, sizeof(data->fReserved)); @@ -214,7 +222,12 @@ RBBIDataHeader *RBBIRuleBuilder::flattenData() { ruleStatusTable[i] = fRuleStatusVals->elementAti(i); } - fStrippedRules.extract((UChar *)((uint8_t *)data+data->fRuleSource), rulesSize/2+1, *fStatus); + u_strToUTF8WithSub((char *)data+data->fRuleSource, rulesSize, &rulesLengthInUTF8, + fStrippedRules.getBuffer(), fStrippedRules.length(), + 0xfffd, nullptr, fStatus); + if (U_FAILURE(*fStatus)) { + return NULL; + } return data; } @@ -274,9 +287,7 @@ RBBIDataHeader *RBBIRuleBuilder::build(UErrorCode &status) { // // UnicodeSet processing. - // Munge the Unicode Sets to create a set of character categories. - // Generate the mapping tables (TRIE) from input code points to - // the character categories. + // Munge the Unicode Sets to create an initial set of character categories. // fSetBuilder->buildRanges(); @@ -290,6 +301,12 @@ RBBIDataHeader *RBBIRuleBuilder::build(UErrorCode &status) { } fForwardTable->buildForwardTable(); + + // State table and character category optimization. + // Merge equivalent rows and columns. + // Note that this process alters the initial set of character categories, + // causing the representation of UnicodeSets in the parse tree to become invalid. + optimizeTables(); fForwardTable->buildSafeReverseTable(status); @@ -302,6 +319,9 @@ RBBIDataHeader *RBBIRuleBuilder::build(UErrorCode &status) { } #endif + // Generate the mapping tables (TRIE) from input code points to + // the character categories. + // fSetBuilder->buildTrie(); // diff --git a/deps/icu-small/source/common/rbbiscan.cpp b/deps/icu-small/source/common/rbbiscan.cpp index da8246ba6f1e47..947a07304fd8b1 100644 --- a/deps/icu-small/source/common/rbbiscan.cpp +++ b/deps/icu-small/source/common/rbbiscan.cpp @@ -829,16 +829,14 @@ static const UChar chRParen = 0x29; UnicodeString RBBIRuleScanner::stripRules(const UnicodeString &rules) { UnicodeString strippedRules; int32_t rulesLength = rules.length(); - bool skippingSpaces = false; for (int32_t idx=0; idxfStatus; - fRangeList = 0; - fTrie = 0; + fRangeList = nullptr; + fMutableTrie = nullptr; + fTrie = nullptr; fTrieSize = 0; fGroupCount = 0; - fSawBOF = FALSE; + fSawBOF = false; } @@ -79,7 +80,8 @@ RBBISetBuilder::~RBBISetBuilder() delete r; } - utrie2_close(fTrie); + ucptrie_close(fTrie); + umutablecptrie_close(fMutableTrie); } @@ -194,24 +196,47 @@ void RBBISetBuilder::buildRanges() { // // Numbering: # 0 (state table column 0) is unused. // # 1 is reserved - table column 1 is for end-of-input - // # 2 is reserved - table column 2 is for beginning-in-input + // # 2 is reserved - table column 2 is for beginning-of-input // # 3 is the first range list. // RangeDescriptor *rlSearchRange; - for (rlRange = fRangeList; rlRange!=0; rlRange=rlRange->fNext) { + int32_t dictGroupCount = 0; + + for (rlRange = fRangeList; rlRange!=nullptr; rlRange=rlRange->fNext) { for (rlSearchRange=fRangeList; rlSearchRange != rlRange; rlSearchRange=rlSearchRange->fNext) { if (rlRange->fIncludesSets->equals(*rlSearchRange->fIncludesSets)) { rlRange->fNum = rlSearchRange->fNum; + rlRange->fIncludesDict = rlSearchRange->fIncludesDict; break; } } if (rlRange->fNum == 0) { - fGroupCount ++; - rlRange->fNum = fGroupCount+2; - rlRange->setDictionaryFlag(); - addValToSets(rlRange->fIncludesSets, fGroupCount+2); + rlRange->fFirstInGroup = true; + if (rlRange->isDictionaryRange()) { + rlRange->fNum = ++dictGroupCount; + rlRange->fIncludesDict = true; + } else { + fGroupCount++; + rlRange->fNum = fGroupCount+2; + addValToSets(rlRange->fIncludesSets, rlRange->fNum); + } + } + } + + // Move the character category numbers for any dictionary ranges up, so that they + // immediately follow the non-dictionary ranges. + + fDictCategoriesStart = fGroupCount + 3; + for (rlRange = fRangeList; rlRange!=nullptr; rlRange=rlRange->fNext) { + if (rlRange->fIncludesDict) { + rlRange->fNum += fDictCategoriesStart - 1; + if (rlRange->fFirstInGroup) { + addValToSets(rlRange->fIncludesSets, rlRange->fNum); + } } } + fGroupCount += dictGroupCount; + // Handle input sets that contain the special string {eof}. // Column 1 of the state table is reserved for EOF on input. @@ -220,13 +245,11 @@ void RBBISetBuilder::buildRanges() { // references to {bof}.) // Add this column value (1 or 2) to the equivalent expression // subtree for each UnicodeSet that contains the string {eof} - // Because {bof} and {eof} are not a characters in the normal sense, - // they doesn't affect the computation of ranges or TRIE. - static const UChar eofUString[] = {0x65, 0x6f, 0x66, 0}; - static const UChar bofUString[] = {0x62, 0x6f, 0x66, 0}; + // Because {bof} and {eof} are not characters in the normal sense, + // they don't affect the computation of the ranges or TRIE. - UnicodeString eofString(eofUString); - UnicodeString bofString(bofUString); + UnicodeString eofString(u"eof"); + UnicodeString bofString(u"bof"); for (ni=0; ; ni++) { // Loop over each of the UnicodeSets encountered in the input rules usetNode = (RBBINode *)this->fRB->fUSetNodes->elementAt(ni); if (usetNode==NULL) { @@ -253,19 +276,17 @@ void RBBISetBuilder::buildRanges() { // range group number. // void RBBISetBuilder::buildTrie() { - RangeDescriptor *rlRange; - - fTrie = utrie2_open(0, // Initial value for all code points. + fMutableTrie = umutablecptrie_open( + 0, // Initial value for all code points. 0, // Error value for out-of-range input. fStatus); - for (rlRange = fRangeList; rlRange!=0 && U_SUCCESS(*fStatus); rlRange=rlRange->fNext) { - utrie2_setRange32(fTrie, - rlRange->fStartChar, // Range start - rlRange->fEndChar, // Range end (inclusive) - rlRange->fNum, // value for range - TRUE, // Overwrite previously written values - fStatus); + for (RangeDescriptor *range = fRangeList; range!=nullptr && U_SUCCESS(*fStatus); range=range->fNext) { + umutablecptrie_setRange(fMutableTrie, + range->fStartChar, // Range start + range->fEndChar, // Range end (inclusive) + range->fNum, // value for range + fStatus); } } @@ -273,16 +294,21 @@ void RBBISetBuilder::buildTrie() { void RBBISetBuilder::mergeCategories(IntPair categories) { U_ASSERT(categories.first >= 1); U_ASSERT(categories.second > categories.first); + U_ASSERT((categories.first < fDictCategoriesStart && categories.second < fDictCategoriesStart) || + (categories.first >= fDictCategoriesStart && categories.second >= fDictCategoriesStart)); + for (RangeDescriptor *rd = fRangeList; rd != nullptr; rd = rd->fNext) { - int32_t rangeNum = rd->fNum & ~DICT_BIT; - int32_t rangeDict = rd->fNum & DICT_BIT; + int32_t rangeNum = rd->fNum; if (rangeNum == categories.second) { - rd->fNum = categories.first | rangeDict; + rd->fNum = categories.first; } else if (rangeNum > categories.second) { rd->fNum--; } } --fGroupCount; + if (categories.second <= fDictCategoriesStart) { + --fDictCategoriesStart; + } } @@ -295,15 +321,18 @@ int32_t RBBISetBuilder::getTrieSize() { if (U_FAILURE(*fStatus)) { return 0; } - utrie2_freeze(fTrie, UTRIE2_16_VALUE_BITS, fStatus); - fTrieSize = utrie2_serialize(fTrie, - NULL, // Buffer - 0, // Capacity - fStatus); - if (*fStatus == U_BUFFER_OVERFLOW_ERROR) { - *fStatus = U_ZERO_ERROR; + if (fTrie == nullptr) { + bool use8Bits = getNumCharCategories() <= kMaxCharCategoriesFor8BitsTrie; + fTrie = umutablecptrie_buildImmutable( + fMutableTrie, + UCPTRIE_TYPE_FAST, + use8Bits ? UCPTRIE_VALUE_BITS_8 : UCPTRIE_VALUE_BITS_16, + fStatus); + fTrieSize = ucptrie_toBinary(fTrie, nullptr, 0, fStatus); + if (*fStatus == U_BUFFER_OVERFLOW_ERROR) { + *fStatus = U_ZERO_ERROR; + } } - // RBBIDebugPrintf("Trie table size is %d\n", trieSize); return fTrieSize; } @@ -316,9 +345,9 @@ int32_t RBBISetBuilder::getTrieSize() { // //----------------------------------------------------------------------------------- void RBBISetBuilder::serializeTrie(uint8_t *where) { - utrie2_serialize(fTrie, - where, // Buffer - fTrieSize, // Capacity + ucptrie_toBinary(fTrie, + where, // Buffer + fTrieSize, // Capacity fStatus); } @@ -384,6 +413,16 @@ int32_t RBBISetBuilder::getNumCharCategories() const { } +//------------------------------------------------------------------------ +// +// getDictCategoriesStart +// +//------------------------------------------------------------------------ +int32_t RBBISetBuilder::getDictCategoriesStart() const { + return fDictCategoriesStart; +} + + //------------------------------------------------------------------------ // // sawBOF @@ -403,7 +442,7 @@ UBool RBBISetBuilder::sawBOF() const { UChar32 RBBISetBuilder::getFirstChar(int32_t category) const { RangeDescriptor *rlRange; UChar32 retVal = (UChar32)-1; - for (rlRange = fRangeList; rlRange!=0; rlRange=rlRange->fNext) { + for (rlRange = fRangeList; rlRange!=nullptr; rlRange=rlRange->fNext) { if (rlRange->fNum == category) { retVal = rlRange->fStartChar; break; @@ -413,7 +452,6 @@ UChar32 RBBISetBuilder::getFirstChar(int32_t category) const { } - //------------------------------------------------------------------------ // // printRanges A debugging function. @@ -426,16 +464,16 @@ void RBBISetBuilder::printRanges() { int i; RBBIDebugPrintf("\n\n Nonoverlapping Ranges ...\n"); - for (rlRange = fRangeList; rlRange!=0; rlRange=rlRange->fNext) { - RBBIDebugPrintf("%2i %4x-%4x ", rlRange->fNum, rlRange->fStartChar, rlRange->fEndChar); + for (rlRange = fRangeList; rlRange!=nullptr; rlRange=rlRange->fNext) { + RBBIDebugPrintf("%4x-%4x ", rlRange->fStartChar, rlRange->fEndChar); for (i=0; ifIncludesSets->size(); i++) { RBBINode *usetNode = (RBBINode *)rlRange->fIncludesSets->elementAt(i); - UnicodeString setName = UNICODE_STRING("anon", 4); + UnicodeString setName {u"anon"}; RBBINode *setRef = usetNode->fParent; - if (setRef != NULL) { + if (setRef != nullptr) { RBBINode *varRef = setRef->fParent; - if (varRef != NULL && varRef->fType == RBBINode::varRef) { + if (varRef != nullptr && varRef->fType == RBBINode::varRef) { setName = varRef->fText; } } @@ -455,19 +493,15 @@ void RBBISetBuilder::printRanges() { //------------------------------------------------------------------------ #ifdef RBBI_DEBUG void RBBISetBuilder::printRangeGroups() { - RangeDescriptor *rlRange; - RangeDescriptor *tRange; int i; - int lastPrintedGroupNum = 0; RBBIDebugPrintf("\nRanges grouped by Unicode Set Membership...\n"); - for (rlRange = fRangeList; rlRange!=0; rlRange=rlRange->fNext) { - int groupNum = rlRange->fNum & 0xbfff; - if (groupNum > lastPrintedGroupNum) { - lastPrintedGroupNum = groupNum; + for (RangeDescriptor *rlRange = fRangeList; rlRange!=nullptr; rlRange=rlRange->fNext) { + if (rlRange->fFirstInGroup) { + int groupNum = rlRange->fNum; RBBIDebugPrintf("%2i ", groupNum); - if (rlRange->fNum & DICT_BIT) { RBBIDebugPrintf(" ");} + if (groupNum >= fDictCategoriesStart) { RBBIDebugPrintf(" ");} for (i=0; ifIncludesSets->size(); i++) { RBBINode *usetNode = (RBBINode *)rlRange->fIncludesSets->elementAt(i); @@ -483,7 +517,7 @@ void RBBISetBuilder::printRangeGroups() { } i = 0; - for (tRange = rlRange; tRange != 0; tRange = tRange->fNext) { + for (RangeDescriptor *tRange = rlRange; tRange != nullptr; tRange = tRange->fNext) { if (tRange->fNum == rlRange->fNum) { if (i++ % 5 == 0) { RBBIDebugPrintf("\n "); @@ -550,28 +584,22 @@ void RBBISetBuilder::printSets() { // //------------------------------------------------------------------------------------- -RangeDescriptor::RangeDescriptor(const RangeDescriptor &other, UErrorCode &status) { - int i; - - this->fStartChar = other.fStartChar; - this->fEndChar = other.fEndChar; - this->fNum = other.fNum; - this->fNext = NULL; - UErrorCode oldstatus = status; - this->fIncludesSets = new UVector(status); - if (U_FAILURE(oldstatus)) { - status = oldstatus; - } +RangeDescriptor::RangeDescriptor(const RangeDescriptor &other, UErrorCode &status) : + fStartChar(other.fStartChar), fEndChar {other.fEndChar}, fNum {other.fNum}, + fIncludesDict{other.fIncludesDict}, fFirstInGroup{other.fFirstInGroup} { + if (U_FAILURE(status)) { return; } - /* test for NULL */ - if (this->fIncludesSets == 0) { + fIncludesSets = new UVector(status); + if (this->fIncludesSets == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; + } + if (U_FAILURE(status)) { return; } - for (i=0; isize(); i++) { + for (int32_t i=0; isize(); i++) { this->fIncludesSets->addElement(other.fIncludesSets->elementAt(i), status); } } @@ -583,24 +611,13 @@ RangeDescriptor::RangeDescriptor(const RangeDescriptor &other, UErrorCode &statu // //------------------------------------------------------------------------------------- RangeDescriptor::RangeDescriptor(UErrorCode &status) { - this->fStartChar = 0; - this->fEndChar = 0; - this->fNum = 0; - this->fNext = NULL; - UErrorCode oldstatus = status; - this->fIncludesSets = new UVector(status); - if (U_FAILURE(oldstatus)) { - status = oldstatus; - } if (U_FAILURE(status)) { return; } - /* test for NULL */ - if(this->fIncludesSets == 0) { + fIncludesSets = new UVector(status); + if (fIncludesSets == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; - return; } - } @@ -611,7 +628,7 @@ RangeDescriptor::RangeDescriptor(UErrorCode &status) { //------------------------------------------------------------------------------------- RangeDescriptor::~RangeDescriptor() { delete fIncludesSets; - fIncludesSets = NULL; + fIncludesSets = nullptr; } //------------------------------------------------------------------------------------- @@ -622,7 +639,7 @@ RangeDescriptor::~RangeDescriptor() { void RangeDescriptor::split(UChar32 where, UErrorCode &status) { U_ASSERT(where>fStartChar && where<=fEndChar); RangeDescriptor *nr = new RangeDescriptor(*this, status); - if(nr == 0) { + if(nr == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -641,27 +658,22 @@ void RangeDescriptor::split(UChar32 where, UErrorCode &status) { //------------------------------------------------------------------------------------- // -// RangeDescriptor::setDictionaryFlag +// RangeDescriptor::isDictionaryRange // -// Character Category Numbers that include characters from -// the original Unicode Set named "dictionary" have bit 14 -// set to 1. The RBBI runtime engine uses this to trigger -// use of the word dictionary. +// Test whether this range includes characters from +// the original Unicode Set named "dictionary". // -// This function looks through the Unicode Sets that it -// (the range) includes, and sets the bit in fNum when -// "dictionary" is among them. +// This function looks through the Unicode Sets that +// the range includes, checking for one named "dictionary" // // TODO: a faster way would be to find the set node for // "dictionary" just once, rather than looking it // up by name every time. // //------------------------------------------------------------------------------------- -void RangeDescriptor::setDictionaryFlag() { - int i; - +bool RangeDescriptor::isDictionaryRange() { static const char16_t *dictionary = u"dictionary"; - for (i=0; isize(); i++) { + for (int32_t i=0; isize(); i++) { RBBINode *usetNode = (RBBINode *)fIncludesSets->elementAt(i); RBBINode *setRef = usetNode->fParent; if (setRef != nullptr) { @@ -669,16 +681,14 @@ void RangeDescriptor::setDictionaryFlag() { if (varRef && varRef->fType == RBBINode::varRef) { const UnicodeString *setName = &varRef->fText; if (setName->compare(dictionary, -1) == 0) { - fNum |= RBBISetBuilder::DICT_BIT; - break; + return true; } } } } + return false; } - - U_NAMESPACE_END #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ diff --git a/deps/icu-small/source/common/rbbisetb.h b/deps/icu-small/source/common/rbbisetb.h index ed6a76b1214621..6409a4ea579832 100644 --- a/deps/icu-small/source/common/rbbisetb.h +++ b/deps/icu-small/source/common/rbbisetb.h @@ -16,9 +16,10 @@ #if !UCONFIG_NO_BREAK_ITERATION +#include "unicode/ucptrie.h" +#include "unicode/umutablecptrie.h" #include "unicode/uobject.h" #include "rbbirb.h" -#include "utrie2.h" #include "uvector.h" U_NAMESPACE_BEGIN @@ -40,25 +41,26 @@ U_NAMESPACE_BEGIN // class RangeDescriptor : public UMemory { public: - UChar32 fStartChar; // Start of range, unicode 32 bit value. - UChar32 fEndChar; // End of range, unicode 32 bit value. - int32_t fNum; // runtime-mapped input value for this range. - UVector *fIncludesSets; // vector of the the original - // Unicode sets that include this range. - // (Contains ptrs to uset nodes) - RangeDescriptor *fNext; // Next RangeDescriptor in the linked list. + UChar32 fStartChar {}; // Start of range, unicode 32 bit value. + UChar32 fEndChar {}; // End of range, unicode 32 bit value. + int32_t fNum {0}; // runtime-mapped input value for this range. + bool fIncludesDict {false}; // True if the range includes $dictionary. + bool fFirstInGroup {false}; // True if first range in a group with the same fNum. + UVector *fIncludesSets {nullptr}; // vector of the the original + // Unicode sets that include this range. + // (Contains ptrs to uset nodes) + RangeDescriptor *fNext {nullptr}; // Next RangeDescriptor in the linked list. RangeDescriptor(UErrorCode &status); RangeDescriptor(const RangeDescriptor &other, UErrorCode &status); ~RangeDescriptor(); void split(UChar32 where, UErrorCode &status); // Spit this range in two at "where", with // where appearing in the second (higher) part. - void setDictionaryFlag(); // Check whether this range appears as part of + bool isDictionaryRange(); // Check whether this range appears as part of // the Unicode set named "dictionary" -private: - RangeDescriptor(const RangeDescriptor &other); // forbid copying of this class - RangeDescriptor &operator=(const RangeDescriptor &other); // forbid copying of this class + RangeDescriptor(const RangeDescriptor &other) = delete; // forbid default copying of this class + RangeDescriptor &operator=(const RangeDescriptor &other) = delete; // forbid assigning of this class }; @@ -89,6 +91,8 @@ class RBBISetBuilder : public UMemory { int32_t getNumCharCategories() const; // CharCategories are the same as input symbol set to the // runtime state machine, which are the same as // columns in the DFA state table + int32_t getDictCategoriesStart() const; // First char category that includes $dictionary, or + // last category + 1 if there are no dictionary categories. int32_t getTrieSize() /*const*/; // Size in bytes of the serialized Trie. void serializeTrie(uint8_t *where); // write out the serialized Trie. UChar32 getFirstChar(int32_t val) const; @@ -101,8 +105,6 @@ class RBBISetBuilder : public UMemory { */ void mergeCategories(IntPair categories); - static constexpr int32_t DICT_BIT = 0x4000; - #ifdef RBBI_DEBUG void printSets(); void printRanges(); @@ -114,24 +116,22 @@ class RBBISetBuilder : public UMemory { #endif private: - void numberSets(); - RBBIRuleBuilder *fRB; // The RBBI Rule Compiler that owns us. UErrorCode *fStatus; RangeDescriptor *fRangeList; // Head of the linked list of RangeDescriptors - UTrie2 *fTrie; // The mapping TRIE that is the end result of processing - uint32_t fTrieSize; // the Unicode Sets. + UMutableCPTrie *fMutableTrie; // The mapping TRIE that is the end result of processing + UCPTrie *fTrie; // the Unicode Sets. + uint32_t fTrieSize; - // Groups correspond to character categories - - // groups of ranges that are in the same original UnicodeSets. - // fGroupCount is the index of the last used group. - // fGroupCount+1 is also the number of columns in the RBBI state table being compiled. - // State table column 0 is not used. Column 1 is for end-of-input. - // column 2 is for group 0. Funny counting. + // Number of range groups, which are groups of ranges that are in the same original UnicodeSets. int32_t fGroupCount; + // The number of the first dictionary char category. + // If there are no Dictionary categories, set to the last category + 1. + int32_t fDictCategoriesStart; + UBool fSawBOF; RBBISetBuilder(const RBBISetBuilder &other); // forbid copying of this class diff --git a/deps/icu-small/source/common/rbbitblb.cpp b/deps/icu-small/source/common/rbbitblb.cpp index 3b1edc6a15c700..65b597c4a936b0 100644 --- a/deps/icu-small/source/common/rbbitblb.cpp +++ b/deps/icu-small/source/common/rbbitblb.cpp @@ -28,6 +28,8 @@ U_NAMESPACE_BEGIN +const int32_t kMaxStateFor8BitsTable = 255; + RBBITableBuilder::RBBITableBuilder(RBBIRuleBuilder *rb, RBBINode **rootNode, UErrorCode &status) : fRB(rb), fTree(*rootNode), @@ -712,7 +714,6 @@ void RBBITableBuilder::mapLookAheadRules() { return; } fLookAheadRuleMap->setSize(fRB->fScanner->numRules() + 1); - int32_t laSlotsInUse = 0; for (int32_t n=0; nsize(); n++) { RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(n); @@ -749,7 +750,7 @@ void RBBITableBuilder::mapLookAheadRules() { } if (laSlotForState == 0) { - laSlotForState = ++laSlotsInUse; + laSlotForState = ++fLASlotsInUse; } // For each look ahead node covered by this state, @@ -805,23 +806,23 @@ void RBBITableBuilder::flagAcceptingStates() { if (sd->fPositions->indexOf(endMarker) >= 0) { // Any non-zero value for fAccepting means this is an accepting node. // The value is what will be returned to the user as the break status. - // If no other value was specified, force it to -1. + // If no other value was specified, force it to ACCEPTING_UNCONDITIONAL (1). if (sd->fAccepting==0) { // State hasn't been marked as accepting yet. Do it now. sd->fAccepting = fLookAheadRuleMap->elementAti(endMarker->fVal); if (sd->fAccepting == 0) { - sd->fAccepting = -1; + sd->fAccepting = ACCEPTING_UNCONDITIONAL; } } - if (sd->fAccepting==-1 && endMarker->fVal != 0) { + if (sd->fAccepting==ACCEPTING_UNCONDITIONAL && endMarker->fVal != 0) { // Both lookahead and non-lookahead accepting for this state. // Favor the look-ahead, because a look-ahead match needs to // immediately stop the run-time engine. First match, not longest. sd->fAccepting = fLookAheadRuleMap->elementAti(endMarker->fVal); } // implicit else: - // if sd->fAccepting already had a value other than 0 or -1, leave it be. + // if sd->fAccepting already had a value other than 0 or 1, leave it be. } } } @@ -855,7 +856,7 @@ void RBBITableBuilder::flagLookAheadStates() { int32_t positionsIdx = sd->fPositions->indexOf(lookAheadNode); if (positionsIdx >= 0) { U_ASSERT(lookAheadNode == sd->fPositions->elementAt(positionsIdx)); - int32_t lookaheadSlot = fLookAheadRuleMap->elementAti(lookAheadNode->fVal); + uint32_t lookaheadSlot = fLookAheadRuleMap->elementAti(lookAheadNode->fVal); U_ASSERT(sd->fLookAhead == 0 || sd->fLookAhead == lookaheadSlot); // if (sd->fLookAhead != 0 && sd->fLookAhead != lookaheadSlot) { // printf("%s:%d Bingo. sd->fLookAhead:%d lookaheadSlot:%d\n", @@ -1148,7 +1149,13 @@ bool RBBITableBuilder::findDuplCharClassFrom(IntPair *categories) { int32_t numCols = fRB->fSetBuilder->getNumCharCategories(); for (; categories->first < numCols-1; categories->first++) { - for (categories->second=categories->first+1; categories->second < numCols; categories->second++) { + // Note: dictionary & non-dictionary columns cannot be merged. + // The limitSecond value prevents considering mixed pairs. + // Dictionary categories are >= DictCategoriesStart. + // Non dict categories are < DictCategoriesStart. + int limitSecond = categories->first < fRB->fSetBuilder->getDictCategoriesStart() ? + fRB->fSetBuilder->getDictCategoriesStart() : numCols; + for (categories->second=categories->first+1; categories->second < limitSecond; categories->second++) { // Initialized to different values to prevent returning true if numStates = 0 (implies no duplicates). uint16_t table_base = 0; uint16_t table_dupl = 1; @@ -1335,11 +1342,18 @@ int32_t RBBITableBuilder::getTableSize() const { numRows = fDStates->size(); numCols = fRB->fSetBuilder->getNumCharCategories(); - rowSize = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t)*numCols; + if (use8BitsForTable()) { + rowSize = offsetof(RBBIStateTableRow8, fNextState) + sizeof(int8_t)*numCols; + } else { + rowSize = offsetof(RBBIStateTableRow16, fNextState) + sizeof(int16_t)*numCols; + } size += numRows * rowSize; return size; } +bool RBBITableBuilder::use8BitsForTable() const { + return fDStates->size() <= kMaxStateFor8BitsTable; +} //----------------------------------------------------------------------------- // @@ -1364,27 +1378,47 @@ void RBBITableBuilder::exportTable(void *where) { return; } - table->fRowLen = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t) * catCount; table->fNumStates = fDStates->size(); + table->fDictCategoriesStart = fRB->fSetBuilder->getDictCategoriesStart(); + table->fLookAheadResultsSize = fLASlotsInUse == ACCEPTING_UNCONDITIONAL ? 0 : fLASlotsInUse + 1; table->fFlags = 0; + if (use8BitsForTable()) { + table->fRowLen = offsetof(RBBIStateTableRow8, fNextState) + sizeof(uint8_t) * catCount; + table->fFlags |= RBBI_8BITS_ROWS; + } else { + table->fRowLen = offsetof(RBBIStateTableRow16, fNextState) + sizeof(int16_t) * catCount; + } if (fRB->fLookAheadHardBreak) { table->fFlags |= RBBI_LOOKAHEAD_HARD_BREAK; } if (fRB->fSetBuilder->sawBOF()) { table->fFlags |= RBBI_BOF_REQUIRED; } - table->fReserved = 0; for (state=0; statefNumStates; state++) { RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(state); RBBIStateTableRow *row = (RBBIStateTableRow *)(table->fTableData + state*table->fRowLen); - U_ASSERT (-32768 < sd->fAccepting && sd->fAccepting <= 32767); - U_ASSERT (-32768 < sd->fLookAhead && sd->fLookAhead <= 32767); - row->fAccepting = (int16_t)sd->fAccepting; - row->fLookAhead = (int16_t)sd->fLookAhead; - row->fTagIdx = (int16_t)sd->fTagsIdx; - for (col=0; colfNextState[col] = (uint16_t)sd->fDtran->elementAti(col); + if (use8BitsForTable()) { + U_ASSERT (sd->fAccepting <= 255); + U_ASSERT (sd->fLookAhead <= 255); + U_ASSERT (0 <= sd->fTagsIdx && sd->fTagsIdx <= 255); + row->r8.fAccepting = sd->fAccepting; + row->r8.fLookAhead = sd->fLookAhead; + row->r8.fTagsIdx = sd->fTagsIdx; + for (col=0; colfDtran->elementAti(col) <= kMaxStateFor8BitsTable); + row->r8.fNextState[col] = sd->fDtran->elementAti(col); + } + } else { + U_ASSERT (sd->fAccepting <= 0xffff); + U_ASSERT (sd->fLookAhead <= 0xffff); + U_ASSERT (0 <= sd->fTagsIdx && sd->fTagsIdx <= 0xffff); + row->r16.fAccepting = sd->fAccepting; + row->r16.fLookAhead = sd->fLookAhead; + row->r16.fTagsIdx = sd->fTagsIdx; + for (col=0; colr16.fNextState[col] = sd->fDtran->elementAti(col); + } } } } @@ -1520,11 +1554,18 @@ int32_t RBBITableBuilder::getSafeTableSize() const { numRows = fSafeTable->size(); numCols = fRB->fSetBuilder->getNumCharCategories(); - rowSize = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t)*numCols; + if (use8BitsForSafeTable()) { + rowSize = offsetof(RBBIStateTableRow8, fNextState) + sizeof(int8_t)*numCols; + } else { + rowSize = offsetof(RBBIStateTableRow16, fNextState) + sizeof(int16_t)*numCols; + } size += numRows * rowSize; return size; } +bool RBBITableBuilder::use8BitsForSafeTable() const { + return fSafeTable->size() <= kMaxStateFor8BitsTable; +} //----------------------------------------------------------------------------- // @@ -1549,20 +1590,33 @@ void RBBITableBuilder::exportSafeTable(void *where) { return; } - table->fRowLen = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t) * catCount; table->fNumStates = fSafeTable->size(); table->fFlags = 0; - table->fReserved = 0; + if (use8BitsForSafeTable()) { + table->fRowLen = offsetof(RBBIStateTableRow8, fNextState) + sizeof(uint8_t) * catCount; + table->fFlags |= RBBI_8BITS_ROWS; + } else { + table->fRowLen = offsetof(RBBIStateTableRow16, fNextState) + sizeof(int16_t) * catCount; + } for (state=0; statefNumStates; state++) { UnicodeString *rowString = (UnicodeString *)fSafeTable->elementAt(state); RBBIStateTableRow *row = (RBBIStateTableRow *)(table->fTableData + state*table->fRowLen); - row->fAccepting = 0; - row->fLookAhead = 0; - row->fTagIdx = 0; - row->fReserved = 0; - for (col=0; colfNextState[col] = rowString->charAt(col); + if (use8BitsForSafeTable()) { + row->r8.fAccepting = 0; + row->r8.fLookAhead = 0; + row->r8.fTagsIdx = 0; + for (col=0; colcharAt(col) <= kMaxStateFor8BitsTable); + row->r8.fNextState[col] = static_cast(rowString->charAt(col)); + } + } else { + row->r16.fAccepting = 0; + row->r16.fLookAhead = 0; + row->r16.fTagsIdx = 0; + for (col=0; colr16.fNextState[col] = rowString->charAt(col); + } } } } @@ -1600,12 +1654,12 @@ void RBBITableBuilder::printStates() { RBBIDebugPrintf("state | i n p u t s y m b o l s \n"); RBBIDebugPrintf(" | Acc LA Tag"); for (c=0; cfSetBuilder->getNumCharCategories(); c++) { - RBBIDebugPrintf(" %2d", c); + RBBIDebugPrintf(" %3d", c); } RBBIDebugPrintf("\n"); RBBIDebugPrintf(" |---------------"); for (c=0; cfSetBuilder->getNumCharCategories(); c++) { - RBBIDebugPrintf("---"); + RBBIDebugPrintf("----"); } RBBIDebugPrintf("\n"); @@ -1614,7 +1668,7 @@ void RBBITableBuilder::printStates() { RBBIDebugPrintf(" %3d | " , n); RBBIDebugPrintf("%3d %3d %5d ", sd->fAccepting, sd->fLookAhead, sd->fTagsIdx); for (c=0; cfSetBuilder->getNumCharCategories(); c++) { - RBBIDebugPrintf(" %2d", sd->fDtran->elementAti(c)); + RBBIDebugPrintf(" %3d", sd->fDtran->elementAti(c)); } RBBIDebugPrintf("\n"); } diff --git a/deps/icu-small/source/common/rbbitblb.h b/deps/icu-small/source/common/rbbitblb.h index c2b574fe1b8f93..fe3db8d7bf1ae8 100644 --- a/deps/icu-small/source/common/rbbitblb.h +++ b/deps/icu-small/source/common/rbbitblb.h @@ -20,6 +20,7 @@ #include "unicode/uobject.h" #include "unicode/rbbi.h" +#include "rbbidata.h" #include "rbbirb.h" #include "rbbinode.h" @@ -53,6 +54,9 @@ class RBBITableBuilder : public UMemory { */ void exportTable(void *where); + /** Use 8 bits to encode the forward table */ + bool use8BitsForTable() const; + /** * Find duplicate (redundant) character classes. Begin looking with categories.first. * Duplicate, if found are returned in the categories parameter. @@ -85,6 +89,8 @@ class RBBITableBuilder : public UMemory { */ void exportSafeTable(void *where); + /** Use 8 bits to encode the safe reverse table */ + bool use8BitsForSafeTable() const; private: void calcNullable(RBBINode *n); @@ -179,9 +185,15 @@ class RBBITableBuilder : public UMemory { /** Map from rule number (fVal in look ahead nodes) to sequential lookahead index. */ UVector32 *fLookAheadRuleMap = nullptr; + /* Counter used when assigning lookahead rule numbers. + * Contains the last look-ahead number already in use. + * The first look-ahead number is 2; Number 1 (ACCEPTING_UNCONDITIONAL) is reserved + * for non-lookahead accepting states. See the declarations of RBBIStateTableRowT. */ + int32_t fLASlotsInUse = ACCEPTING_UNCONDITIONAL; + - RBBITableBuilder(const RBBITableBuilder &other); // forbid copying of this class - RBBITableBuilder &operator=(const RBBITableBuilder &other); // forbid copying of this class + RBBITableBuilder(const RBBITableBuilder &other) = delete; // forbid copying of this class + RBBITableBuilder &operator=(const RBBITableBuilder &other) = delete; // forbid copying of this class }; // @@ -190,8 +202,8 @@ class RBBITableBuilder : public UMemory { class RBBIStateDescriptor : public UMemory { public: UBool fMarked; - int32_t fAccepting; - int32_t fLookAhead; + uint32_t fAccepting; + uint32_t fLookAhead; UVector *fTagVals; int32_t fTagsIdx; UVector *fPositions; // Set of parse tree positions associated diff --git a/deps/icu-small/source/common/resource.h b/deps/icu-small/source/common/resource.h index 5199b858880770..3795694412a058 100644 --- a/deps/icu-small/source/common/resource.h +++ b/deps/icu-small/source/common/resource.h @@ -60,7 +60,7 @@ class U_COMMON_API ResourceArray { /** * @param i Array item index. * @param value Output-only, receives the value of the i'th item. - * @return TRUE if i is non-negative and less than getSize(). + * @return true if i is non-negative and less than getSize(). */ UBool getValue(int32_t i, ResourceValue &value) const; @@ -97,14 +97,14 @@ class U_COMMON_API ResourceTable { * @param i Table item index. * @param key Output-only, receives the key of the i'th item. * @param value Output-only, receives the value of the i'th item. - * @return TRUE if i is non-negative and less than getSize(). + * @return true if i is non-negative and less than getSize(). */ UBool getKeyAndValue(int32_t i, const char *&key, ResourceValue &value) const; /** * @param key Key string to find in the table. * @param value Output-only, receives the value of the item with that key. - * @return TRUE if the table contains the key. + * @return true if the table contains the key. */ UBool findValue(const char *key, ResourceValue &value) const; @@ -141,7 +141,7 @@ class U_COMMON_API ResourceValue : public UObject { inline UnicodeString getUnicodeString(UErrorCode &errorCode) const { int32_t len = 0; const UChar *r = getString(len, errorCode); - return UnicodeString(TRUE, r, len); + return UnicodeString(true, r, len); } /** @@ -152,7 +152,7 @@ class U_COMMON_API ResourceValue : public UObject { inline UnicodeString getAliasUnicodeString(UErrorCode &errorCode) const { int32_t len = 0; const UChar *r = getAliasString(len, errorCode); - return UnicodeString(TRUE, r, len); + return UnicodeString(true, r, len); } /** @@ -199,7 +199,7 @@ class U_COMMON_API ResourceValue : public UObject { * CLDR no-fallback data values of (three empty-set symbols)=={2205, 2205, 2205} * when enumerating tables with fallback from the specific resource bundle to root. * - * @return TRUE if this is a no-inheritance marker string + * @return true if this is a no-inheritance marker string */ virtual UBool isNoInheritanceMarker() const = 0; diff --git a/deps/icu-small/source/common/ruleiter.h b/deps/icu-small/source/common/ruleiter.h index b6edc657aff261..f397f8bccd7817 100644 --- a/deps/icu-small/source/common/ruleiter.h +++ b/deps/icu-small/source/common/ruleiter.h @@ -114,7 +114,7 @@ class RuleCharacterIterator : public UMemory { * character. * @param options one or more of the following options, bitwise-OR-ed * together: PARSE_VARIABLES, PARSE_ESCAPES, SKIP_WHITESPACE. - * @param isEscaped output parameter set to TRUE if the character + * @param isEscaped output parameter set to true if the character * was escaped * @param ec input-output error code. An error will only be set by * this routing if options includes PARSE_VARIABLES and an unknown diff --git a/deps/icu-small/source/common/serv.h b/deps/icu-small/source/common/serv.h index 70695839a8f3ce..6a3d1915afdf5a 100644 --- a/deps/icu-small/source/common/serv.h +++ b/deps/icu-small/source/common/serv.h @@ -138,16 +138,16 @@ class U_COMMON_API ICUServiceKey : public UObject { * must eventually return false. This implementation has no fallbacks * and always returns false.

* - * @return TRUE if the ICUServiceKey changed to a valid fallback value. + * @return true if the ICUServiceKey changed to a valid fallback value. */ virtual UBool fallback(); /** - *

Return TRUE if a key created from id matches, or would eventually + *

Return true if a key created from id matches, or would eventually * fallback to match, the canonical ID of this ICUServiceKey.

* * @param id the id to test. - * @return TRUE if this ICUServiceKey's canonical ID is a fallback of id. + * @return true if this ICUServiceKey's canonical ID is a fallback of id. */ virtual UBool isFallbackOf(const UnicodeString& id) const; @@ -291,15 +291,15 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory { public: /** *

Construct a SimpleFactory that maps a single ID to a single - * service instance. If visible is TRUE, the ID will be visible. + * service instance. If visible is true, the ID will be visible. * The instance must not be NULL. The SimpleFactory will adopt * the instance, which must not be changed subsequent to this call.

* * @param instanceToAdopt the service instance to adopt. * @param id the ID to assign to this service instance. - * @param visible if TRUE, the ID will be visible. + * @param visible if true, the ID will be visible. */ - SimpleFactory(UObject* instanceToAdopt, const UnicodeString& id, UBool visible = TRUE); + SimpleFactory(UObject* instanceToAdopt, const UnicodeString& id, UBool visible = true); /** *

Destructor.

@@ -318,7 +318,7 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory { virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const; /** - *

This implementation adds a mapping from ID -> this to result if visible is TRUE, + *

This implementation adds a mapping from ID -> this to result if visible is true, * otherwise it removes ID from result.

* * @param result the mapping table to update. @@ -327,7 +327,7 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory { virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const; /** - *

This implementation returns the factory ID if it equals id and visible is TRUE, + *

This implementation returns the factory ID if it equals id and visible is true, * otherwise it returns the empty string. (This implementation provides * no localized id information.)

* @@ -427,8 +427,8 @@ class U_COMMON_API StringPair : public UMemory { UErrorCode& status); /** - *

Return TRUE if either string of the pair is bogus.

- * @return TRUE if either string of the pair is bogus. + *

Return true if either string of the pair is bogus.

+ * @return true if either string of the pair is bogus. */ UBool isBogus() const; @@ -761,7 +761,7 @@ class U_COMMON_API ICUService : public ICUNotifier { /** *

A convenience override of registerInstance(UObject*, const UnicodeString&, UBool) - * that defaults visible to TRUE.

+ * that defaults visible to true.

* * @param objToAdopt the object to register and adopt. * @param id the ID to assign to this object. @@ -774,7 +774,7 @@ class U_COMMON_API ICUService : public ICUNotifier { /** *

Register a service instance with the provided ID. The ID will be * canonicalized. The canonicalized ID will be returned by - * getVisibleIDs if visible is TRUE. The service instance will be adopted and + * getVisibleIDs if visible is true. The service instance will be adopted and * must not be modified subsequent to this call.

* *

This issues a serviceChanged notification to registered listeners.

@@ -784,7 +784,7 @@ class U_COMMON_API ICUService : public ICUNotifier { * * @param objToAdopt the object to register and adopt. * @param id the ID to assign to this object. - * @param visible TRUE if getVisibleIDs is to return this ID. + * @param visible true if getVisibleIDs is to return this ID. * @param status the error code status. * @return a registry key that can be passed to unregister() to unregister * (and discard) this instance. @@ -820,7 +820,7 @@ class U_COMMON_API ICUService : public ICUNotifier { * * @param rkey the registry key. * @param status the error code status. - * @return TRUE if the call successfully unregistered the factory. + * @return true if the call successfully unregistered the factory. */ virtual UBool unregister(URegistryKey rkey, UErrorCode& status); @@ -833,9 +833,9 @@ class U_COMMON_API ICUService : public ICUNotifier { virtual void reset(void); /** - *

Return TRUE if the service is in its default state.

+ *

Return true if the service is in its default state.

* - *

The default implementation returns TRUE if there are no + *

The default implementation returns true if there are no * factories registered.

*/ virtual UBool isDefault(void) const; @@ -877,7 +877,7 @@ class U_COMMON_API ICUService : public ICUNotifier { * * @param instanceToAdopt the service instance to adopt. * @param id the ID to assign to this service instance. - * @param visible if TRUE, the ID will be visible. + * @param visible if true, the ID will be visible. * @param status the error code status. * @return an instance of ICUServiceFactory that maps this instance to the provided ID. */ @@ -885,7 +885,7 @@ class U_COMMON_API ICUService : public ICUNotifier { /** *

Reinitialize the factory list to its default state. After this call, isDefault() - * must return TRUE.

+ * must return true.

* *

This issues a serviceChanged notification to registered listeners.

* @@ -928,7 +928,7 @@ class U_COMMON_API ICUService : public ICUNotifier { * different listeners.

* * @param l the listener to test. - * @return TRUE if the service accepts the listener. + * @return true if the service accepts the listener. */ virtual UBool acceptsListener(const EventListener& l) const; diff --git a/deps/icu-small/source/common/servnotf.h b/deps/icu-small/source/common/servnotf.h index cf92fc169e927f..7918a672473b10 100644 --- a/deps/icu-small/source/common/servnotf.h +++ b/deps/icu-small/source/common/servnotf.h @@ -105,7 +105,7 @@ private: UVector* listeners; protected: /** - * Subclasses implement this to return TRUE if the listener is + * Subclasses implement this to return true if the listener is * of the appropriate type. */ virtual UBool acceptsListener(const EventListener& l) const = 0; diff --git a/deps/icu-small/source/common/sharedobject.h b/deps/icu-small/source/common/sharedobject.h index 878594c7ffa772..0565de6608a094 100644 --- a/deps/icu-small/source/common/sharedobject.h +++ b/deps/icu-small/source/common/sharedobject.h @@ -90,13 +90,13 @@ class U_COMMON_API SharedObject : public UObject { int32_t getRefCount() const; /** - * If noHardReferences() == TRUE then this object has no hard references. + * If noHardReferences() == true then this object has no hard references. * Must be called only from within the internals of UnifiedCache. */ inline UBool noHardReferences() const { return getRefCount() == 0; } /** - * If hasHardReferences() == TRUE then this object has hard references. + * If hasHardReferences() == true then this object has hard references. * Must be called only from within the internals of UnifiedCache. */ inline UBool hasHardReferences() const { return getRefCount() != 0; } diff --git a/deps/icu-small/source/common/simpleformatter.cpp b/deps/icu-small/source/common/simpleformatter.cpp index 76d8f54efd4aea..f7f7aead6171bb 100644 --- a/deps/icu-small/source/common/simpleformatter.cpp +++ b/deps/icu-small/source/common/simpleformatter.cpp @@ -263,6 +263,8 @@ UnicodeString SimpleFormatter::getTextWithNoArguments( sb.append(compiledPattern + i, n); i += n; } else if (n < offsetsLength) { + // TODO(ICU-20406): This does not distinguish between "{0}{1}" and "{1}{0}". + // Consider removing this function and replacing it with an iterator interface. offsets[n] = sb.length(); } } diff --git a/deps/icu-small/source/common/uassert.h b/deps/icu-small/source/common/uassert.h index 15cd55c873487c..afd31eeffd91a4 100644 --- a/deps/icu-small/source/common/uassert.h +++ b/deps/icu-small/source/common/uassert.h @@ -32,7 +32,7 @@ # include # define U_ASSERT(exp) assert(exp) #elif U_CPLUSPLUS_VERSION -# define U_ASSERT(exp) void() +# define U_ASSERT(exp) (void)0 #else # define U_ASSERT(exp) #endif diff --git a/deps/icu-small/source/common/ubidi_props.cpp b/deps/icu-small/source/common/ubidi_props.cpp index 4141c21938a740..afcc4aaf4f99d7 100644 --- a/deps/icu-small/source/common/ubidi_props.cpp +++ b/deps/icu-small/source/common/ubidi_props.cpp @@ -248,7 +248,7 @@ u_charMirror(UChar32 c) { return ubidi_getMirror(c); } -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 u_getBidiPairedBracket(UChar32 c) { return ubidi_getPairedBracket(c); } diff --git a/deps/icu-small/source/common/ubidiimp.h b/deps/icu-small/source/common/ubidiimp.h index 9746b2bc103102..e48fc6f941621b 100644 --- a/deps/icu-small/source/common/ubidiimp.h +++ b/deps/icu-small/source/common/ubidiimp.h @@ -26,6 +26,14 @@ /* miscellaneous definitions ---------------------------------------------- */ +// ICU-20853=ICU-20935 Solaris #defines CS and ES in sys/regset.h +#ifdef CS +# undef CS +#endif +#ifdef ES +# undef ES +#endif + typedef uint8_t DirProp; typedef uint32_t Flags; @@ -451,26 +459,26 @@ ubidi_getMemory(BidiMemoryForAllocation *pMemory, int32_t *pSize, UBool mayAlloc /* additional macros used by ubidi_open() - always allow allocation */ #define getInitialDirPropsMemory(pBiDi, length) \ ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->dirPropsMemory, &(pBiDi)->dirPropsSize, \ - TRUE, (length)) + true, (length)) #define getInitialLevelsMemory(pBiDi, length) \ ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->levelsMemory, &(pBiDi)->levelsSize, \ - TRUE, (length)) + true, (length)) #define getInitialOpeningsMemory(pBiDi, length) \ ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->openingsMemory, &(pBiDi)->openingsSize, \ - TRUE, (length)*sizeof(Opening)) + true, (length)*sizeof(Opening)) #define getInitialParasMemory(pBiDi, length) \ ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->parasMemory, &(pBiDi)->parasSize, \ - TRUE, (length)*sizeof(Para)) + true, (length)*sizeof(Para)) #define getInitialRunsMemory(pBiDi, length) \ ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->runsMemory, &(pBiDi)->runsSize, \ - TRUE, (length)*sizeof(Run)) + true, (length)*sizeof(Run)) #define getInitialIsolatesMemory(pBiDi, length) \ ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->isolatesMemory, &(pBiDi)->isolatesSize, \ - TRUE, (length)*sizeof(Isolate)) + true, (length)*sizeof(Isolate)) #endif diff --git a/deps/icu-small/source/common/ubiditransform.cpp b/deps/icu-small/source/common/ubiditransform.cpp index bb3ce8cb934d43..ab3dcbe14c0cfe 100644 --- a/deps/icu-small/source/common/ubiditransform.cpp +++ b/deps/icu-small/source/common/ubiditransform.cpp @@ -89,7 +89,7 @@ struct UBiDiTransform { uint32_t letters; /* letter option for ArabicShaping */ }; -U_DRAFT UBiDiTransform* U_EXPORT2 +U_CAPI UBiDiTransform* U_EXPORT2 ubiditransform_open(UErrorCode *pErrorCode) { UBiDiTransform *pBiDiTransform = NULL; @@ -102,7 +102,7 @@ ubiditransform_open(UErrorCode *pErrorCode) return pBiDiTransform; } -U_DRAFT void U_EXPORT2 +U_CAPI void U_EXPORT2 ubiditransform_close(UBiDiTransform *pBiDiTransform) { if (pBiDiTransform != NULL) { @@ -434,7 +434,7 @@ findMatchingScheme(UBiDiLevel inLevel, UBiDiLevel outLevel, return NULL; } -U_DRAFT uint32_t U_EXPORT2 +U_CAPI uint32_t U_EXPORT2 ubiditransform_transform(UBiDiTransform *pBiDiTransform, const UChar *src, int32_t srcLength, UChar *dest, int32_t destSize, diff --git a/deps/icu-small/source/common/ucase.cpp b/deps/icu-small/source/common/ucase.cpp index 57a40327905c00..c2180629fb436a 100644 --- a/deps/icu-small/source/common/ucase.cpp +++ b/deps/icu-small/source/common/ucase.cpp @@ -707,6 +707,7 @@ ucase_isCaseSensitive(UChar32 c) { #define is_r(c) ((c)=='r' || (c)=='R') #define is_t(c) ((c)=='t' || (c)=='T') #define is_u(c) ((c)=='u' || (c)=='U') +#define is_y(c) ((c)=='y' || (c)=='Y') #define is_z(c) ((c)=='z' || (c)=='Z') /* separator? */ @@ -804,6 +805,18 @@ ucase_getCaseLocale(const char *locale) { return UCASE_LOC_DUTCH; } } + } else if(c=='h') { + /* hy or hye? *not* hyw */ + c=*locale++; + if(is_y(c)) { + c=*locale++; + if(is_e(c)) { + c=*locale; + } + if(is_sep(c)) { + return UCASE_LOC_ARMENIAN; + } + } } } else { // uppercase c @@ -868,6 +881,18 @@ ucase_getCaseLocale(const char *locale) { return UCASE_LOC_DUTCH; } } + } else if(c=='H') { + /* hy or hye? *not* hyw */ + c=*locale++; + if(is_y(c)) { + c=*locale++; + if(is_e(c)) { + c=*locale; + } + if(is_sep(c)) { + return UCASE_LOC_ARMENIAN; + } + } } } return UCASE_LOC_ROOT; @@ -1229,6 +1254,17 @@ toUpperOrTitle(UChar32 c, */ *pString=nullptr; return 0; /* remove the dot (continue without output) */ + } else if(c==0x0587) { + // See ICU-13416: + // և ligature ech-yiwn + // uppercases to ԵՒ=ech+yiwn by default and in Western Armenian, + // but to ԵՎ=ech+vew in Eastern Armenian. + if(loc==UCASE_LOC_ARMENIAN) { + *pString=upperNotTitle ? u"ԵՎ" : u"Եվ"; + } else { + *pString=upperNotTitle ? u"ԵՒ" : u"Եւ"; + } + return 2; } else { /* no known conditional special case mapping, use a normal mapping */ } diff --git a/deps/icu-small/source/common/ucase.h b/deps/icu-small/source/common/ucase.h index b0a453b87e8afa..a018f82b81b229 100644 --- a/deps/icu-small/source/common/ucase.h +++ b/deps/icu-small/source/common/ucase.h @@ -56,7 +56,8 @@ enum { UCASE_LOC_TURKISH, UCASE_LOC_LITHUANIAN, UCASE_LOC_GREEK, - UCASE_LOC_DUTCH + UCASE_LOC_DUTCH, + UCASE_LOC_ARMENIAN }; /** @@ -117,7 +118,7 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa); * the string itself is added as well as part of its code points' closure. * It must be length>=0. * - * @return TRUE if the string was found + * @return true if the string was found */ U_CFUNC UBool U_EXPORT2 ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa); diff --git a/deps/icu-small/source/common/ucase_props_data.h b/deps/icu-small/source/common/ucase_props_data.h index 7c97230957024a..aead6d58d1ec9c 100644 --- a/deps/icu-small/source/common/ucase_props_data.h +++ b/deps/icu-small/source/common/ucase_props_data.h @@ -13,7 +13,7 @@ static const UVersionInfo ucase_props_dataVersion={0xd,0,0,0}; -static const int32_t ucase_props_indexes[UCASE_IX_TOP]={0x10,0x70ca,0x6098,0x687,0x172,0,0,0,0,0,0,0,0,0,0,3}; +static const int32_t ucase_props_indexes[UCASE_IX_TOP]={0x10,0x70c2,0x6098,0x683,0x172,0,0,0,0,0,0,0,0,0,0,3}; static const uint16_t ucase_props_trieIndex[12356]={ 0x336,0x33e,0x346,0x34e,0x35c,0x364,0x36c,0x374,0x37c,0x384,0x38b,0x393,0x39b,0x3a3,0x3ab,0x3b3, @@ -411,18 +411,18 @@ static const uint16_t ucase_props_trieIndex[12356]={ 0,0,0,0,0,4,4,4,4,0,0,0,0,0,0,0, 0,0,0,0,0,0,4,0,0,4,4,0,0,0,0,0, 0,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,4,0,0,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a, -0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a, -0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0,0x179a,0,0,0,0,0,0x179a,0,0, -0x17b9,0x17e9,0x1819,0x1849,0x1879,0x18a9,0x18d9,0x1909,0x1939,0x1969,0x1999,0x19c9,0x19f9,0x1a29,0x1a59,0x1a89, -0x1ab9,0x1ae9,0x1b19,0x1b49,0x1b79,0x1ba9,0x1bd9,0x1c09,0x1c39,0x1c69,0x1c99,0x1cc9,0x1cf9,0x1d29,0x1d59,0x1d89, -0x1db9,0x1de9,0x1e19,0x1e49,0x1e79,0x1ea9,0x1ed9,0x1f09,0x1f39,0x1f69,0x1f99,0,4,0x1fc9,0x1ff9,0x2029, +0,4,0,0,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a, +0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a, +0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0,0x175a,0,0,0,0,0,0x175a,0,0, +0x1779,0x17a9,0x17d9,0x1809,0x1839,0x1869,0x1899,0x18c9,0x18f9,0x1929,0x1959,0x1989,0x19b9,0x19e9,0x1a19,0x1a49, +0x1a79,0x1aa9,0x1ad9,0x1b09,0x1b39,0x1b69,0x1b99,0x1bc9,0x1bf9,0x1c29,0x1c59,0x1c89,0x1cb9,0x1ce9,0x1d19,0x1d49, +0x1d79,0x1da9,0x1dd9,0x1e09,0x1e39,0x1e69,0x1e99,0x1ec9,0x1ef9,0x1f29,0x1f59,0,4,0x1f89,0x1fb9,0x1fe9, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44, -0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a, -0x207a,0x207a,0x207a,0x207a,0x207a,0x207a,0,0,0x2099,0x20c9,0x20f9,0x2129,0x2159,0x2189,0,0, -0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a, -0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a, +0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a, +0x203a,0x203a,0x203a,0x203a,0x203a,0x203a,0,0,0x2059,0x2089,0x20b9,0x20e9,0x2119,0x2149,0,0, +0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a, +0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,4,4,0x64,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,4, @@ -458,9 +458,9 @@ static const uint16_t ucase_props_trieIndex[12356]={ 0,0,0,0,4,4,4,4,4,4,4,4,0,0,4,0x64, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,4,4,4,4,4,4,0,0, -0x21b9,0x21e9,0x2219,0x2249,0x2279,0x22c9,0x2319,0x2349,0x2379,0,0,0,0,0,0,0, -0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa, -0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0,0,0x23aa,0x23aa,0x23aa, +0x2179,0x21a9,0x21d9,0x2209,0x2239,0x2289,0x22d9,0x2309,0x2339,0,0,0,0,0,0,0, +0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a, +0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0,0,0x236a,0x236a,0x236a, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0x44,0x44,0x44,0,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x64,0x64,0x64,0x64, 0x44,0,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0,0,0,0,0x64,0,0, @@ -470,10 +470,10 @@ static const uint16_t ucase_props_trieIndex[12356]={ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,0x25,5,5,5,5,5,5,5,5,1,1,1,1,1, -1,1,1,1,1,1,1,1,5,0x23c9,1,1,1,0x23e9,1,1, +1,1,1,1,1,1,1,1,5,0x2389,1,1,1,0x23a9,1,1, 5,5,5,5,0x25,5,5,5,0x25,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x2409,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x23c9,1, 1,1,1,1,1,1,0x21,1,1,1,1,5,5,5,5,5, 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, 0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0x64,0,0x44,0x64,0x64,0x44,0x64, @@ -481,27 +481,27 @@ static const uint16_t ucase_props_trieIndex[12356]={ 0x64,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xffb1,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x242a,0x2469,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0x23ea,0x2429,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x24a9,0x2529,0x25a9,0x2629,0x26a9,0x2729,1,1,0x275a,1,0x92,0xff91,0x92,0xff91, +0x92,0xff91,0x2469,0x24e9,0x2569,0x25e9,0x2669,0x26e9,1,1,0x271a,1,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xffb1,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x411,0x411,0x411,0x411, 0x411,0x411,0x411,0x411,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0x411,0x411,0x411,0x411, 0x411,0x411,0,0,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0,0,0x411,0x411,0x411,0x411, 0x411,0x411,0x411,0x411,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0x411,0x411,0x411,0x411, 0x411,0x411,0x411,0x411,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0x411,0x411,0x411,0x411, -0x411,0x411,0,0,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0,0,0x27a9,0x411,0x2829,0x411, -0x28d9,0x411,0x2989,0x411,0,0xfc12,0,0xfc12,0,0xfc12,0,0xfc12,0x411,0x411,0x411,0x411, +0x411,0x411,0,0,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0,0,0x2769,0x411,0x27e9,0x411, +0x2899,0x411,0x2949,0x411,0,0xfc12,0,0xfc12,0,0xfc12,0,0xfc12,0x411,0x411,0x411,0x411, 0x411,0x411,0x411,0x411,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0x2511,0x2511,0x2b11,0x2b11, -0x2b11,0x2b11,0x3211,0x3211,0x4011,0x4011,0x3811,0x3811,0x3f11,0x3f11,0,0,0x2a39,0x2aa9,0x2b19,0x2b89, -0x2bf9,0x2c69,0x2cd9,0x2d49,0x2dbb,0x2e2b,0x2e9b,0x2f0b,0x2f7b,0x2feb,0x305b,0x30cb,0x3139,0x31a9,0x3219,0x3289, -0x32f9,0x3369,0x33d9,0x3449,0x34bb,0x352b,0x359b,0x360b,0x367b,0x36eb,0x375b,0x37cb,0x3839,0x38a9,0x3919,0x3989, -0x39f9,0x3a69,0x3ad9,0x3b49,0x3bbb,0x3c2b,0x3c9b,0x3d0b,0x3d7b,0x3deb,0x3e5b,0x3ecb,0x411,0x411,0x3f39,0x3fb9, -0x4029,0,0x40a9,0x4129,0xfc12,0xfc12,0xdb12,0xdb12,0x41db,4,0x4249,4,4,4,0x4299,0x4319, -0x4389,0,0x4409,0x4489,0xd512,0xd512,0xd512,0xd512,0x453b,4,4,4,0x411,0x411,0x45a9,0x4659, -0,0,0x4729,0x47a9,0xfc12,0xfc12,0xce12,0xce12,0,4,4,4,0x411,0x411,0x4859,0x4909, -0x49d9,0x391,0x4a59,0x4ad9,0xfc12,0xfc12,0xc812,0xc812,0xfc92,4,4,4,0,0,0x4b89,0x4c09, -0x4c79,0,0x4cf9,0x4d79,0xc012,0xc012,0xc112,0xc112,0x4e2b,4,4,0,0,0,0,0, +0x2b11,0x2b11,0x3211,0x3211,0x4011,0x4011,0x3811,0x3811,0x3f11,0x3f11,0,0,0x29f9,0x2a69,0x2ad9,0x2b49, +0x2bb9,0x2c29,0x2c99,0x2d09,0x2d7b,0x2deb,0x2e5b,0x2ecb,0x2f3b,0x2fab,0x301b,0x308b,0x30f9,0x3169,0x31d9,0x3249, +0x32b9,0x3329,0x3399,0x3409,0x347b,0x34eb,0x355b,0x35cb,0x363b,0x36ab,0x371b,0x378b,0x37f9,0x3869,0x38d9,0x3949, +0x39b9,0x3a29,0x3a99,0x3b09,0x3b7b,0x3beb,0x3c5b,0x3ccb,0x3d3b,0x3dab,0x3e1b,0x3e8b,0x411,0x411,0x3ef9,0x3f79, +0x3fe9,0,0x4069,0x40e9,0xfc12,0xfc12,0xdb12,0xdb12,0x419b,4,0x4209,4,4,4,0x4259,0x42d9, +0x4349,0,0x43c9,0x4449,0xd512,0xd512,0xd512,0xd512,0x44fb,4,4,4,0x411,0x411,0x4569,0x4619, +0,0,0x46e9,0x4769,0xfc12,0xfc12,0xce12,0xce12,0,4,4,4,0x411,0x411,0x4819,0x48c9, +0x4999,0x391,0x4a19,0x4a99,0xfc12,0xfc12,0xc812,0xc812,0xfc92,4,4,4,0,0,0x4b49,0x4bc9, +0x4c39,0,0x4cb9,0x4d39,0xc012,0xc012,0xc112,0xc112,0x4deb,4,4,0,0,0,0,0, 0,0,0,0,0,0,0,4,4,4,4,4,0,0,0,0, 0,0,0,0,4,4,0,0,0,0,0,0,4,0,0,4, 0,0,4,4,4,4,4,0,0,0,0,0,0,0,0,0, @@ -515,8 +515,8 @@ static const uint16_t ucase_props_trieIndex[12356]={ 0x64,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2, 0,0,1,2,2,2,1,1,2,2,2,1,0,2,0,0, -0,2,2,2,2,2,0,0,0,0,0,0,2,0,0x4e9a,0, -2,0,0x4eda,0x4f1a,2,2,0,1,2,2,0xe12,2,1,0,0,0, +0,2,2,2,2,2,0,0,0,0,0,0,2,0,0x4e5a,0, +2,0,0x4e9a,0x4eda,2,2,0,1,2,2,0xe12,2,1,0,0,0, 0,1,0,0,1,1,2,2,0,0,0,0,0,2,1,1, 0x21,0x21,0,0,0,0,0xf211,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0x812,0x812,0x812,0x812,0x812,0x812,0x812,0x812, @@ -531,14 +531,14 @@ static const uint16_t ucase_props_trieIndex[12356]={ 0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812, 0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811, 0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811, -0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0,0x92,0xff91,0x4f5a,0x4f7a,0x4f9a,0x4fb9,0x4fd9,0x92, -0xff91,0x92,0xff91,0x92,0xff91,0x4ffa,0x501a,0x503a,0x505a,1,0x92,0xff91,1,0x92,0xff91,1, -1,1,1,1,0x25,5,0x507a,0x507a,0x92,0xff91,0x92,0xff91,1,0,0,0, +0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0,0x92,0xff91,0x4f1a,0x4f3a,0x4f5a,0x4f79,0x4f99,0x92, +0xff91,0x92,0xff91,0x92,0xff91,0x4fba,0x4fda,0x4ffa,0x501a,1,0x92,0xff91,1,0x92,0xff91,1, +1,1,1,1,0x25,5,0x503a,0x503a,0x92,0xff91,0x92,0xff91,1,0,0,0, 0,0,0,0x92,0xff91,0x92,0xff91,0x44,0x44,0x44,0x92,0xff91,0,0,0,0, -0,0,0,0,0,0,0,0,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099, -0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099, -0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0,0x5099,0,0,0,0, -0,0x5099,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059, +0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059, +0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0,0x5059,0,0,0,0, +0,0x5059,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0x64,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, @@ -552,7 +552,7 @@ static const uint16_t ucase_props_trieIndex[12356]={ 0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x92,0xff91,0x92,0xff91,0x50ba,0x50f9,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0x92,0xff91,0x92,0xff91,0x92,0xff91,0x507a,0x50b9,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0,0x44, 4,4,4,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0,4, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, @@ -564,11 +564,11 @@ static const uint16_t ucase_props_trieIndex[12356]={ 4,4,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, 1,1,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,5,1,1,1,1,1,1,1,1,0x92,0xff91,0x92, -0xff91,0x513a,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,4,4,4,0x92, -0xff91,0x515a,1,0,0x92,0xff91,0x92,0xff91,0x1811,1,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x92,0xff91,0x92,0xff91,0x517a,0x519a,0x51ba,0x51da,0x517a,1,0x51fa,0x521a,0x523a,0x525a, +0xff91,0x50fa,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,4,4,4,0x92, +0xff91,0x511a,1,0,0x92,0xff91,0x92,0xff91,0x1811,1,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0x92,0xff91,0x92,0xff91,0x92,0xff91,0x513a,0x515a,0x517a,0x519a,0x513a,1,0x51ba,0x51da,0x51fa,0x521a, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0,0,0x92,0xff91, -0xe812,0x527a,0x529a,0x92,0xff91,0x92,0xff91,0,0,0,0,0,0,0,0,0, +0xe812,0x523a,0x525a,0x92,0xff91,0x92,0xff91,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0x92,0xff91,0, 5,5,1,0,0,0,0,0,0,0,4,0,0,0,0x64,0, 0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0, @@ -597,17 +597,17 @@ static const uint16_t ucase_props_trieIndex[12356]={ 0,0,0,0,4,4,0,0,0,0,0,4,4,0,0x64,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,0x52b9,1,1,1,1,1,1,1,4,5,5,5,5, +1,1,1,0x5279,1,1,1,1,1,1,1,4,5,5,5,5, 1,1,1,1,1,1,1,1,1,4,4,4,0,0,0,0, -0x52d9,0x5309,0x5339,0x5369,0x5399,0x53c9,0x53f9,0x5429,0x5459,0x5489,0x54b9,0x54e9,0x5519,0x5549,0x5579,0x55a9, -0x5bd9,0x5c09,0x5c39,0x5c69,0x5c99,0x5cc9,0x5cf9,0x5d29,0x5d59,0x5d89,0x5db9,0x5de9,0x5e19,0x5e49,0x5e79,0x5ea9, -0x5ed9,0x5f09,0x5f39,0x5f69,0x5f99,0x5fc9,0x5ff9,0x6029,0x6059,0x6089,0x60b9,0x60e9,0x6119,0x6149,0x6179,0x61a9, -0x55d9,0x5609,0x5639,0x5669,0x5699,0x56c9,0x56f9,0x5729,0x5759,0x5789,0x57b9,0x57e9,0x5819,0x5849,0x5879,0x58a9, -0x58d9,0x5909,0x5939,0x5969,0x5999,0x59c9,0x59f9,0x5a29,0x5a59,0x5a89,0x5ab9,0x5ae9,0x5b19,0x5b49,0x5b79,0x5ba9, +0x5299,0x52c9,0x52f9,0x5329,0x5359,0x5389,0x53b9,0x53e9,0x5419,0x5449,0x5479,0x54a9,0x54d9,0x5509,0x5539,0x5569, +0x5b99,0x5bc9,0x5bf9,0x5c29,0x5c59,0x5c89,0x5cb9,0x5ce9,0x5d19,0x5d49,0x5d79,0x5da9,0x5dd9,0x5e09,0x5e39,0x5e69, +0x5e99,0x5ec9,0x5ef9,0x5f29,0x5f59,0x5f89,0x5fb9,0x5fe9,0x6019,0x6049,0x6079,0x60a9,0x60d9,0x6109,0x6139,0x6169, +0x5599,0x55c9,0x55f9,0x5629,0x5659,0x5689,0x56b9,0x56e9,0x5719,0x5749,0x5779,0x57a9,0x57d9,0x5809,0x5839,0x5869, +0x5899,0x58c9,0x58f9,0x5929,0x5959,0x5989,0x59b9,0x59e9,0x5a19,0x5a49,0x5a79,0x5aa9,0x5ad9,0x5b09,0x5b39,0x5b69, 0,0,0,0,0,4,0,0,4,0,0,0,0,0x64,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x61d9,0x6259,0x62d9,0x6359,0x6409,0x64b9,0x6559,0,0,0,0,0,0,0,0,0, -0,0,0,0x65f9,0x6679,0x66f9,0x6779,0x67f9,0,0,0,0,0,0,0x64,0, +0x6199,0x6219,0x6299,0x6319,0x63c9,0x6479,0x6519,0,0,0,0,0,0,0,0,0, +0,0,0,0x65b9,0x6639,0x66b9,0x6739,0x67b9,0,0,0,0,0,0,0x64,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4, 4,4,4,4,0,0,0,4,0,0,0,0,0,0,0,0, @@ -791,7 +791,7 @@ static const uint16_t ucase_props_trieIndex[12356]={ 0,0,0,0 }; -static const uint16_t ucase_props_exceptions[1671]={ +static const uint16_t ucase_props_exceptions[1667]={ 0xc850,0x20,2,0x130,0x131,0x4810,0x20,0x841,0x6b,1,0x212a,0x841,0x73,1,0x17f,0x5c50, 0x20,2,0x130,0x131,0x844,0x4b,1,0x212a,0x844,0x53,1,0x17f,0x806,0x3bc,0x39c,0x841, 0xe5,1,0x212b,0x8c0,1,0x2220,0x73,0x73,0x53,0x53,0x53,0x73,0x1e9e,0x844,0xc5,1, @@ -815,88 +815,88 @@ static const uint16_t ucase_props_exceptions[1671]={ 0x43e,1,0x1c82,0x841,0x441,1,0x1c83,0x841,0x442,2,0x1c84,0x1c85,0x841,0x44a,1,0x1c86, 0x844,0x412,1,0x1c80,0x844,0x414,1,0x1c81,0x844,0x41e,1,0x1c82,0x844,0x421,1,0x1c83, 0x844,0x422,2,0x1c84,0x1c85,0x844,0x42a,1,0x1c86,0x841,0x463,1,0x1c87,0x844,0x462,1, -0x1c87,0x880,0x2220,0x565,0x582,0x535,0x552,0x535,0x582,0x810,0x1c60,0x80c,0x1c90,0x10d0,0x80c,0x1c91, -0x10d1,0x80c,0x1c92,0x10d2,0x80c,0x1c93,0x10d3,0x80c,0x1c94,0x10d4,0x80c,0x1c95,0x10d5,0x80c,0x1c96,0x10d6, -0x80c,0x1c97,0x10d7,0x80c,0x1c98,0x10d8,0x80c,0x1c99,0x10d9,0x80c,0x1c9a,0x10da,0x80c,0x1c9b,0x10db,0x80c, -0x1c9c,0x10dc,0x80c,0x1c9d,0x10dd,0x80c,0x1c9e,0x10de,0x80c,0x1c9f,0x10df,0x80c,0x1ca0,0x10e0,0x80c,0x1ca1, -0x10e1,0x80c,0x1ca2,0x10e2,0x80c,0x1ca3,0x10e3,0x80c,0x1ca4,0x10e4,0x80c,0x1ca5,0x10e5,0x80c,0x1ca6,0x10e6, -0x80c,0x1ca7,0x10e7,0x80c,0x1ca8,0x10e8,0x80c,0x1ca9,0x10e9,0x80c,0x1caa,0x10ea,0x80c,0x1cab,0x10eb,0x80c, -0x1cac,0x10ec,0x80c,0x1cad,0x10ed,0x80c,0x1cae,0x10ee,0x80c,0x1caf,0x10ef,0x80c,0x1cb0,0x10f0,0x80c,0x1cb1, -0x10f1,0x80c,0x1cb2,0x10f2,0x80c,0x1cb3,0x10f3,0x80c,0x1cb4,0x10f4,0x80c,0x1cb5,0x10f5,0x80c,0x1cb6,0x10f6, -0x80c,0x1cb7,0x10f7,0x80c,0x1cb8,0x10f8,0x80c,0x1cb9,0x10f9,0x80c,0x1cba,0x10fa,0x80c,0x1cbd,0x10fd,0x80c, -0x1cbe,0x10fe,0x80c,0x1cbf,0x10ff,0xa10,0x97d0,0xa10,8,0x806,0x13f0,0x13f0,0x806,0x13f1,0x13f1,0x806, -0x13f2,0x13f2,0x806,0x13f3,0x13f3,0x806,0x13f4,0x13f4,0x806,0x13f5,0x13f5,0x806,0x432,0x412,0x806,0x434, -0x414,0x806,0x43e,0x41e,0x806,0x441,0x421,0x846,0x442,0x422,1,0x1c85,0x846,0x442,0x422,1, -0x1c84,0x806,0x44a,0x42a,0x806,0x463,0x462,0x806,0xa64b,0xa64a,0xc10,0xbc0,0x810,0x8a04,0x810,0xee6, -0x810,0x8a38,0x841,0x1e61,1,0x1e9b,0x844,0x1e60,1,0x1e9b,0x880,0x2220,0x68,0x331,0x48,0x331, -0x48,0x331,0x880,0x2220,0x74,0x308,0x54,0x308,0x54,0x308,0x880,0x2220,0x77,0x30a,0x57,0x30a, -0x57,0x30a,0x880,0x2220,0x79,0x30a,0x59,0x30a,0x59,0x30a,0x880,0x2220,0x61,0x2be,0x41,0x2be, -0x41,0x2be,0x806,0x1e61,0x1e60,0xc90,0x1dbf,0x20,0x73,0x73,0x880,0x2220,0x3c5,0x313,0x3a5,0x313, -0x3a5,0x313,0x880,0x3330,0x3c5,0x313,0x300,0x3a5,0x313,0x300,0x3a5,0x313,0x300,0x880,0x3330,0x3c5, -0x313,0x301,0x3a5,0x313,0x301,0x3a5,0x313,0x301,0x880,0x3330,0x3c5,0x313,0x342,0x3a5,0x313,0x342, -0x3a5,0x313,0x342,0x890,8,0x220,0x1f00,0x3b9,0x1f08,0x399,0x890,8,0x220,0x1f01,0x3b9,0x1f09, -0x399,0x890,8,0x220,0x1f02,0x3b9,0x1f0a,0x399,0x890,8,0x220,0x1f03,0x3b9,0x1f0b,0x399,0x890, -8,0x220,0x1f04,0x3b9,0x1f0c,0x399,0x890,8,0x220,0x1f05,0x3b9,0x1f0d,0x399,0x890,8,0x220, -0x1f06,0x3b9,0x1f0e,0x399,0x890,8,0x220,0x1f07,0x3b9,0x1f0f,0x399,0xc90,8,0x220,0x1f00,0x3b9, -0x1f08,0x399,0xc90,8,0x220,0x1f01,0x3b9,0x1f09,0x399,0xc90,8,0x220,0x1f02,0x3b9,0x1f0a,0x399, -0xc90,8,0x220,0x1f03,0x3b9,0x1f0b,0x399,0xc90,8,0x220,0x1f04,0x3b9,0x1f0c,0x399,0xc90,8, -0x220,0x1f05,0x3b9,0x1f0d,0x399,0xc90,8,0x220,0x1f06,0x3b9,0x1f0e,0x399,0xc90,8,0x220,0x1f07, -0x3b9,0x1f0f,0x399,0x890,8,0x220,0x1f20,0x3b9,0x1f28,0x399,0x890,8,0x220,0x1f21,0x3b9,0x1f29, -0x399,0x890,8,0x220,0x1f22,0x3b9,0x1f2a,0x399,0x890,8,0x220,0x1f23,0x3b9,0x1f2b,0x399,0x890, -8,0x220,0x1f24,0x3b9,0x1f2c,0x399,0x890,8,0x220,0x1f25,0x3b9,0x1f2d,0x399,0x890,8,0x220, -0x1f26,0x3b9,0x1f2e,0x399,0x890,8,0x220,0x1f27,0x3b9,0x1f2f,0x399,0xc90,8,0x220,0x1f20,0x3b9, -0x1f28,0x399,0xc90,8,0x220,0x1f21,0x3b9,0x1f29,0x399,0xc90,8,0x220,0x1f22,0x3b9,0x1f2a,0x399, -0xc90,8,0x220,0x1f23,0x3b9,0x1f2b,0x399,0xc90,8,0x220,0x1f24,0x3b9,0x1f2c,0x399,0xc90,8, -0x220,0x1f25,0x3b9,0x1f2d,0x399,0xc90,8,0x220,0x1f26,0x3b9,0x1f2e,0x399,0xc90,8,0x220,0x1f27, -0x3b9,0x1f2f,0x399,0x890,8,0x220,0x1f60,0x3b9,0x1f68,0x399,0x890,8,0x220,0x1f61,0x3b9,0x1f69, -0x399,0x890,8,0x220,0x1f62,0x3b9,0x1f6a,0x399,0x890,8,0x220,0x1f63,0x3b9,0x1f6b,0x399,0x890, -8,0x220,0x1f64,0x3b9,0x1f6c,0x399,0x890,8,0x220,0x1f65,0x3b9,0x1f6d,0x399,0x890,8,0x220, -0x1f66,0x3b9,0x1f6e,0x399,0x890,8,0x220,0x1f67,0x3b9,0x1f6f,0x399,0xc90,8,0x220,0x1f60,0x3b9, -0x1f68,0x399,0xc90,8,0x220,0x1f61,0x3b9,0x1f69,0x399,0xc90,8,0x220,0x1f62,0x3b9,0x1f6a,0x399, -0xc90,8,0x220,0x1f63,0x3b9,0x1f6b,0x399,0xc90,8,0x220,0x1f64,0x3b9,0x1f6c,0x399,0xc90,8, -0x220,0x1f65,0x3b9,0x1f6d,0x399,0xc90,8,0x220,0x1f66,0x3b9,0x1f6e,0x399,0xc90,8,0x220,0x1f67, -0x3b9,0x1f6f,0x399,0x880,0x2220,0x1f70,0x3b9,0x1fba,0x399,0x1fba,0x345,0x890,9,0x220,0x3b1,0x3b9, -0x391,0x399,0x880,0x2220,0x3ac,0x3b9,0x386,0x399,0x386,0x345,0x880,0x2220,0x3b1,0x342,0x391,0x342, -0x391,0x342,0x880,0x3330,0x3b1,0x342,0x3b9,0x391,0x342,0x399,0x391,0x342,0x345,0xc90,9,0x220, -0x3b1,0x3b9,0x391,0x399,0x846,0x3b9,0x399,1,0x345,0x880,0x2220,0x1f74,0x3b9,0x1fca,0x399,0x1fca, -0x345,0x890,9,0x220,0x3b7,0x3b9,0x397,0x399,0x880,0x2220,0x3ae,0x3b9,0x389,0x399,0x389,0x345, -0x880,0x2220,0x3b7,0x342,0x397,0x342,0x397,0x342,0x880,0x3330,0x3b7,0x342,0x3b9,0x397,0x342,0x399, -0x397,0x342,0x345,0xc90,9,0x220,0x3b7,0x3b9,0x397,0x399,0x880,0x3330,0x3b9,0x308,0x300,0x399, -0x308,0x300,0x399,0x308,0x300,0x8c0,1,0x3330,0x3b9,0x308,0x301,0x399,0x308,0x301,0x399,0x308, -0x301,0x390,0x880,0x2220,0x3b9,0x342,0x399,0x342,0x399,0x342,0x880,0x3330,0x3b9,0x308,0x342,0x399, -0x308,0x342,0x399,0x308,0x342,0x880,0x3330,0x3c5,0x308,0x300,0x3a5,0x308,0x300,0x3a5,0x308,0x300, -0x8c0,1,0x3330,0x3c5,0x308,0x301,0x3a5,0x308,0x301,0x3a5,0x308,0x301,0x3b0,0x880,0x2220,0x3c1, -0x313,0x3a1,0x313,0x3a1,0x313,0x880,0x2220,0x3c5,0x342,0x3a5,0x342,0x3a5,0x342,0x880,0x3330,0x3c5, -0x308,0x342,0x3a5,0x308,0x342,0x3a5,0x308,0x342,0x880,0x2220,0x1f7c,0x3b9,0x1ffa,0x399,0x1ffa,0x345, -0x890,9,0x220,0x3c9,0x3b9,0x3a9,0x399,0x880,0x2220,0x3ce,0x3b9,0x38f,0x399,0x38f,0x345,0x880, -0x2220,0x3c9,0x342,0x3a9,0x342,0x3a9,0x342,0x880,0x3330,0x3c9,0x342,0x3b9,0x3a9,0x342,0x399,0x3a9, -0x342,0x345,0xc90,9,0x220,0x3c9,0x3b9,0x3a9,0x399,0xc50,0x1d5d,1,0x3a9,0xc50,0x20bf,1, -0x4b,0xc50,0x2046,1,0xc5,0xc10,0x29f7,0xc10,0xee6,0xc10,0x29e7,0xc10,0x2a2b,0xc10,0x2a28,0xc10, -0x2a1c,0xc10,0x29fd,0xc10,0x2a1f,0xc10,0x2a1e,0xc10,0x2a3f,0xc10,0x1c60,0x841,0xa64b,1,0x1c88,0x844, -0xa64a,1,0x1c88,0xc10,0x8a04,0xc10,0xa528,0xc10,0xa544,0xc10,0xa54f,0xc10,0xa54b,0xc10,0xa541,0xc10, -0xa512,0xc10,0xa52a,0xc10,0xa515,0x810,0x3a0,0xc10,0xa543,0xc10,0x8a38,0xc10,0x3a0,0x806,0x13a0,0x13a0, -0x806,0x13a1,0x13a1,0x806,0x13a2,0x13a2,0x806,0x13a3,0x13a3,0x806,0x13a4,0x13a4,0x806,0x13a5,0x13a5,0x806, -0x13a6,0x13a6,0x806,0x13a7,0x13a7,0x806,0x13a8,0x13a8,0x806,0x13a9,0x13a9,0x806,0x13aa,0x13aa,0x806,0x13ab, -0x13ab,0x806,0x13ac,0x13ac,0x806,0x13ad,0x13ad,0x806,0x13ae,0x13ae,0x806,0x13af,0x13af,0x806,0x13b0,0x13b0, -0x806,0x13b1,0x13b1,0x806,0x13b2,0x13b2,0x806,0x13b3,0x13b3,0x806,0x13b4,0x13b4,0x806,0x13b5,0x13b5,0x806, -0x13b6,0x13b6,0x806,0x13b7,0x13b7,0x806,0x13b8,0x13b8,0x806,0x13b9,0x13b9,0x806,0x13ba,0x13ba,0x806,0x13bb, -0x13bb,0x806,0x13bc,0x13bc,0x806,0x13bd,0x13bd,0x806,0x13be,0x13be,0x806,0x13bf,0x13bf,0x806,0x13c0,0x13c0, -0x806,0x13c1,0x13c1,0x806,0x13c2,0x13c2,0x806,0x13c3,0x13c3,0x806,0x13c4,0x13c4,0x806,0x13c5,0x13c5,0x806, -0x13c6,0x13c6,0x806,0x13c7,0x13c7,0x806,0x13c8,0x13c8,0x806,0x13c9,0x13c9,0x806,0x13ca,0x13ca,0x806,0x13cb, -0x13cb,0x806,0x13cc,0x13cc,0x806,0x13cd,0x13cd,0x806,0x13ce,0x13ce,0x806,0x13cf,0x13cf,0x806,0x13d0,0x13d0, -0x806,0x13d1,0x13d1,0x806,0x13d2,0x13d2,0x806,0x13d3,0x13d3,0x806,0x13d4,0x13d4,0x806,0x13d5,0x13d5,0x806, -0x13d6,0x13d6,0x806,0x13d7,0x13d7,0x806,0x13d8,0x13d8,0x806,0x13d9,0x13d9,0x806,0x13da,0x13da,0x806,0x13db, -0x13db,0x806,0x13dc,0x13dc,0x806,0x13dd,0x13dd,0x806,0x13de,0x13de,0x806,0x13df,0x13df,0x806,0x13e0,0x13e0, -0x806,0x13e1,0x13e1,0x806,0x13e2,0x13e2,0x806,0x13e3,0x13e3,0x806,0x13e4,0x13e4,0x806,0x13e5,0x13e5,0x806, -0x13e6,0x13e6,0x806,0x13e7,0x13e7,0x806,0x13e8,0x13e8,0x806,0x13e9,0x13e9,0x806,0x13ea,0x13ea,0x806,0x13eb, -0x13eb,0x806,0x13ec,0x13ec,0x806,0x13ed,0x13ed,0x806,0x13ee,0x13ee,0x806,0x13ef,0x13ef,0x880,0x2220,0x66, -0x66,0x46,0x46,0x46,0x66,0x880,0x2220,0x66,0x69,0x46,0x49,0x46,0x69,0x880,0x2220,0x66, -0x6c,0x46,0x4c,0x46,0x6c,0x880,0x3330,0x66,0x66,0x69,0x46,0x46,0x49,0x46,0x66,0x69, -0x880,0x3330,0x66,0x66,0x6c,0x46,0x46,0x4c,0x46,0x66,0x6c,0x8c0,1,0x2220,0x73,0x74, -0x53,0x54,0x53,0x74,0xfb06,0x8c0,1,0x2220,0x73,0x74,0x53,0x54,0x53,0x74,0xfb05,0x880, -0x2220,0x574,0x576,0x544,0x546,0x544,0x576,0x880,0x2220,0x574,0x565,0x544,0x535,0x544,0x565,0x880, -0x2220,0x574,0x56b,0x544,0x53b,0x544,0x56b,0x880,0x2220,0x57e,0x576,0x54e,0x546,0x54e,0x576,0x880, -0x2220,0x574,0x56d,0x544,0x53d,0x544,0x56d +0x1c87,0x4880,0x20,0x565,0x582,0x810,0x1c60,0x80c,0x1c90,0x10d0,0x80c,0x1c91,0x10d1,0x80c,0x1c92,0x10d2, +0x80c,0x1c93,0x10d3,0x80c,0x1c94,0x10d4,0x80c,0x1c95,0x10d5,0x80c,0x1c96,0x10d6,0x80c,0x1c97,0x10d7,0x80c, +0x1c98,0x10d8,0x80c,0x1c99,0x10d9,0x80c,0x1c9a,0x10da,0x80c,0x1c9b,0x10db,0x80c,0x1c9c,0x10dc,0x80c,0x1c9d, +0x10dd,0x80c,0x1c9e,0x10de,0x80c,0x1c9f,0x10df,0x80c,0x1ca0,0x10e0,0x80c,0x1ca1,0x10e1,0x80c,0x1ca2,0x10e2, +0x80c,0x1ca3,0x10e3,0x80c,0x1ca4,0x10e4,0x80c,0x1ca5,0x10e5,0x80c,0x1ca6,0x10e6,0x80c,0x1ca7,0x10e7,0x80c, +0x1ca8,0x10e8,0x80c,0x1ca9,0x10e9,0x80c,0x1caa,0x10ea,0x80c,0x1cab,0x10eb,0x80c,0x1cac,0x10ec,0x80c,0x1cad, +0x10ed,0x80c,0x1cae,0x10ee,0x80c,0x1caf,0x10ef,0x80c,0x1cb0,0x10f0,0x80c,0x1cb1,0x10f1,0x80c,0x1cb2,0x10f2, +0x80c,0x1cb3,0x10f3,0x80c,0x1cb4,0x10f4,0x80c,0x1cb5,0x10f5,0x80c,0x1cb6,0x10f6,0x80c,0x1cb7,0x10f7,0x80c, +0x1cb8,0x10f8,0x80c,0x1cb9,0x10f9,0x80c,0x1cba,0x10fa,0x80c,0x1cbd,0x10fd,0x80c,0x1cbe,0x10fe,0x80c,0x1cbf, +0x10ff,0xa10,0x97d0,0xa10,8,0x806,0x13f0,0x13f0,0x806,0x13f1,0x13f1,0x806,0x13f2,0x13f2,0x806,0x13f3, +0x13f3,0x806,0x13f4,0x13f4,0x806,0x13f5,0x13f5,0x806,0x432,0x412,0x806,0x434,0x414,0x806,0x43e,0x41e, +0x806,0x441,0x421,0x846,0x442,0x422,1,0x1c85,0x846,0x442,0x422,1,0x1c84,0x806,0x44a,0x42a, +0x806,0x463,0x462,0x806,0xa64b,0xa64a,0xc10,0xbc0,0x810,0x8a04,0x810,0xee6,0x810,0x8a38,0x841,0x1e61, +1,0x1e9b,0x844,0x1e60,1,0x1e9b,0x880,0x2220,0x68,0x331,0x48,0x331,0x48,0x331,0x880,0x2220, +0x74,0x308,0x54,0x308,0x54,0x308,0x880,0x2220,0x77,0x30a,0x57,0x30a,0x57,0x30a,0x880,0x2220, +0x79,0x30a,0x59,0x30a,0x59,0x30a,0x880,0x2220,0x61,0x2be,0x41,0x2be,0x41,0x2be,0x806,0x1e61, +0x1e60,0xc90,0x1dbf,0x20,0x73,0x73,0x880,0x2220,0x3c5,0x313,0x3a5,0x313,0x3a5,0x313,0x880,0x3330, +0x3c5,0x313,0x300,0x3a5,0x313,0x300,0x3a5,0x313,0x300,0x880,0x3330,0x3c5,0x313,0x301,0x3a5,0x313, +0x301,0x3a5,0x313,0x301,0x880,0x3330,0x3c5,0x313,0x342,0x3a5,0x313,0x342,0x3a5,0x313,0x342,0x890, +8,0x220,0x1f00,0x3b9,0x1f08,0x399,0x890,8,0x220,0x1f01,0x3b9,0x1f09,0x399,0x890,8,0x220, +0x1f02,0x3b9,0x1f0a,0x399,0x890,8,0x220,0x1f03,0x3b9,0x1f0b,0x399,0x890,8,0x220,0x1f04,0x3b9, +0x1f0c,0x399,0x890,8,0x220,0x1f05,0x3b9,0x1f0d,0x399,0x890,8,0x220,0x1f06,0x3b9,0x1f0e,0x399, +0x890,8,0x220,0x1f07,0x3b9,0x1f0f,0x399,0xc90,8,0x220,0x1f00,0x3b9,0x1f08,0x399,0xc90,8, +0x220,0x1f01,0x3b9,0x1f09,0x399,0xc90,8,0x220,0x1f02,0x3b9,0x1f0a,0x399,0xc90,8,0x220,0x1f03, +0x3b9,0x1f0b,0x399,0xc90,8,0x220,0x1f04,0x3b9,0x1f0c,0x399,0xc90,8,0x220,0x1f05,0x3b9,0x1f0d, +0x399,0xc90,8,0x220,0x1f06,0x3b9,0x1f0e,0x399,0xc90,8,0x220,0x1f07,0x3b9,0x1f0f,0x399,0x890, +8,0x220,0x1f20,0x3b9,0x1f28,0x399,0x890,8,0x220,0x1f21,0x3b9,0x1f29,0x399,0x890,8,0x220, +0x1f22,0x3b9,0x1f2a,0x399,0x890,8,0x220,0x1f23,0x3b9,0x1f2b,0x399,0x890,8,0x220,0x1f24,0x3b9, +0x1f2c,0x399,0x890,8,0x220,0x1f25,0x3b9,0x1f2d,0x399,0x890,8,0x220,0x1f26,0x3b9,0x1f2e,0x399, +0x890,8,0x220,0x1f27,0x3b9,0x1f2f,0x399,0xc90,8,0x220,0x1f20,0x3b9,0x1f28,0x399,0xc90,8, +0x220,0x1f21,0x3b9,0x1f29,0x399,0xc90,8,0x220,0x1f22,0x3b9,0x1f2a,0x399,0xc90,8,0x220,0x1f23, +0x3b9,0x1f2b,0x399,0xc90,8,0x220,0x1f24,0x3b9,0x1f2c,0x399,0xc90,8,0x220,0x1f25,0x3b9,0x1f2d, +0x399,0xc90,8,0x220,0x1f26,0x3b9,0x1f2e,0x399,0xc90,8,0x220,0x1f27,0x3b9,0x1f2f,0x399,0x890, +8,0x220,0x1f60,0x3b9,0x1f68,0x399,0x890,8,0x220,0x1f61,0x3b9,0x1f69,0x399,0x890,8,0x220, +0x1f62,0x3b9,0x1f6a,0x399,0x890,8,0x220,0x1f63,0x3b9,0x1f6b,0x399,0x890,8,0x220,0x1f64,0x3b9, +0x1f6c,0x399,0x890,8,0x220,0x1f65,0x3b9,0x1f6d,0x399,0x890,8,0x220,0x1f66,0x3b9,0x1f6e,0x399, +0x890,8,0x220,0x1f67,0x3b9,0x1f6f,0x399,0xc90,8,0x220,0x1f60,0x3b9,0x1f68,0x399,0xc90,8, +0x220,0x1f61,0x3b9,0x1f69,0x399,0xc90,8,0x220,0x1f62,0x3b9,0x1f6a,0x399,0xc90,8,0x220,0x1f63, +0x3b9,0x1f6b,0x399,0xc90,8,0x220,0x1f64,0x3b9,0x1f6c,0x399,0xc90,8,0x220,0x1f65,0x3b9,0x1f6d, +0x399,0xc90,8,0x220,0x1f66,0x3b9,0x1f6e,0x399,0xc90,8,0x220,0x1f67,0x3b9,0x1f6f,0x399,0x880, +0x2220,0x1f70,0x3b9,0x1fba,0x399,0x1fba,0x345,0x890,9,0x220,0x3b1,0x3b9,0x391,0x399,0x880,0x2220, +0x3ac,0x3b9,0x386,0x399,0x386,0x345,0x880,0x2220,0x3b1,0x342,0x391,0x342,0x391,0x342,0x880,0x3330, +0x3b1,0x342,0x3b9,0x391,0x342,0x399,0x391,0x342,0x345,0xc90,9,0x220,0x3b1,0x3b9,0x391,0x399, +0x846,0x3b9,0x399,1,0x345,0x880,0x2220,0x1f74,0x3b9,0x1fca,0x399,0x1fca,0x345,0x890,9,0x220, +0x3b7,0x3b9,0x397,0x399,0x880,0x2220,0x3ae,0x3b9,0x389,0x399,0x389,0x345,0x880,0x2220,0x3b7,0x342, +0x397,0x342,0x397,0x342,0x880,0x3330,0x3b7,0x342,0x3b9,0x397,0x342,0x399,0x397,0x342,0x345,0xc90, +9,0x220,0x3b7,0x3b9,0x397,0x399,0x880,0x3330,0x3b9,0x308,0x300,0x399,0x308,0x300,0x399,0x308, +0x300,0x8c0,1,0x3330,0x3b9,0x308,0x301,0x399,0x308,0x301,0x399,0x308,0x301,0x390,0x880,0x2220, +0x3b9,0x342,0x399,0x342,0x399,0x342,0x880,0x3330,0x3b9,0x308,0x342,0x399,0x308,0x342,0x399,0x308, +0x342,0x880,0x3330,0x3c5,0x308,0x300,0x3a5,0x308,0x300,0x3a5,0x308,0x300,0x8c0,1,0x3330,0x3c5, +0x308,0x301,0x3a5,0x308,0x301,0x3a5,0x308,0x301,0x3b0,0x880,0x2220,0x3c1,0x313,0x3a1,0x313,0x3a1, +0x313,0x880,0x2220,0x3c5,0x342,0x3a5,0x342,0x3a5,0x342,0x880,0x3330,0x3c5,0x308,0x342,0x3a5,0x308, +0x342,0x3a5,0x308,0x342,0x880,0x2220,0x1f7c,0x3b9,0x1ffa,0x399,0x1ffa,0x345,0x890,9,0x220,0x3c9, +0x3b9,0x3a9,0x399,0x880,0x2220,0x3ce,0x3b9,0x38f,0x399,0x38f,0x345,0x880,0x2220,0x3c9,0x342,0x3a9, +0x342,0x3a9,0x342,0x880,0x3330,0x3c9,0x342,0x3b9,0x3a9,0x342,0x399,0x3a9,0x342,0x345,0xc90,9, +0x220,0x3c9,0x3b9,0x3a9,0x399,0xc50,0x1d5d,1,0x3a9,0xc50,0x20bf,1,0x4b,0xc50,0x2046,1, +0xc5,0xc10,0x29f7,0xc10,0xee6,0xc10,0x29e7,0xc10,0x2a2b,0xc10,0x2a28,0xc10,0x2a1c,0xc10,0x29fd,0xc10, +0x2a1f,0xc10,0x2a1e,0xc10,0x2a3f,0xc10,0x1c60,0x841,0xa64b,1,0x1c88,0x844,0xa64a,1,0x1c88,0xc10, +0x8a04,0xc10,0xa528,0xc10,0xa544,0xc10,0xa54f,0xc10,0xa54b,0xc10,0xa541,0xc10,0xa512,0xc10,0xa52a,0xc10, +0xa515,0x810,0x3a0,0xc10,0xa543,0xc10,0x8a38,0xc10,0x3a0,0x806,0x13a0,0x13a0,0x806,0x13a1,0x13a1,0x806, +0x13a2,0x13a2,0x806,0x13a3,0x13a3,0x806,0x13a4,0x13a4,0x806,0x13a5,0x13a5,0x806,0x13a6,0x13a6,0x806,0x13a7, +0x13a7,0x806,0x13a8,0x13a8,0x806,0x13a9,0x13a9,0x806,0x13aa,0x13aa,0x806,0x13ab,0x13ab,0x806,0x13ac,0x13ac, +0x806,0x13ad,0x13ad,0x806,0x13ae,0x13ae,0x806,0x13af,0x13af,0x806,0x13b0,0x13b0,0x806,0x13b1,0x13b1,0x806, +0x13b2,0x13b2,0x806,0x13b3,0x13b3,0x806,0x13b4,0x13b4,0x806,0x13b5,0x13b5,0x806,0x13b6,0x13b6,0x806,0x13b7, +0x13b7,0x806,0x13b8,0x13b8,0x806,0x13b9,0x13b9,0x806,0x13ba,0x13ba,0x806,0x13bb,0x13bb,0x806,0x13bc,0x13bc, +0x806,0x13bd,0x13bd,0x806,0x13be,0x13be,0x806,0x13bf,0x13bf,0x806,0x13c0,0x13c0,0x806,0x13c1,0x13c1,0x806, +0x13c2,0x13c2,0x806,0x13c3,0x13c3,0x806,0x13c4,0x13c4,0x806,0x13c5,0x13c5,0x806,0x13c6,0x13c6,0x806,0x13c7, +0x13c7,0x806,0x13c8,0x13c8,0x806,0x13c9,0x13c9,0x806,0x13ca,0x13ca,0x806,0x13cb,0x13cb,0x806,0x13cc,0x13cc, +0x806,0x13cd,0x13cd,0x806,0x13ce,0x13ce,0x806,0x13cf,0x13cf,0x806,0x13d0,0x13d0,0x806,0x13d1,0x13d1,0x806, +0x13d2,0x13d2,0x806,0x13d3,0x13d3,0x806,0x13d4,0x13d4,0x806,0x13d5,0x13d5,0x806,0x13d6,0x13d6,0x806,0x13d7, +0x13d7,0x806,0x13d8,0x13d8,0x806,0x13d9,0x13d9,0x806,0x13da,0x13da,0x806,0x13db,0x13db,0x806,0x13dc,0x13dc, +0x806,0x13dd,0x13dd,0x806,0x13de,0x13de,0x806,0x13df,0x13df,0x806,0x13e0,0x13e0,0x806,0x13e1,0x13e1,0x806, +0x13e2,0x13e2,0x806,0x13e3,0x13e3,0x806,0x13e4,0x13e4,0x806,0x13e5,0x13e5,0x806,0x13e6,0x13e6,0x806,0x13e7, +0x13e7,0x806,0x13e8,0x13e8,0x806,0x13e9,0x13e9,0x806,0x13ea,0x13ea,0x806,0x13eb,0x13eb,0x806,0x13ec,0x13ec, +0x806,0x13ed,0x13ed,0x806,0x13ee,0x13ee,0x806,0x13ef,0x13ef,0x880,0x2220,0x66,0x66,0x46,0x46,0x46, +0x66,0x880,0x2220,0x66,0x69,0x46,0x49,0x46,0x69,0x880,0x2220,0x66,0x6c,0x46,0x4c,0x46, +0x6c,0x880,0x3330,0x66,0x66,0x69,0x46,0x46,0x49,0x46,0x66,0x69,0x880,0x3330,0x66,0x66, +0x6c,0x46,0x46,0x4c,0x46,0x66,0x6c,0x8c0,1,0x2220,0x73,0x74,0x53,0x54,0x53,0x74, +0xfb06,0x8c0,1,0x2220,0x73,0x74,0x53,0x54,0x53,0x74,0xfb05,0x880,0x2220,0x574,0x576,0x544, +0x546,0x544,0x576,0x880,0x2220,0x574,0x565,0x544,0x535,0x544,0x565,0x880,0x2220,0x574,0x56b,0x544, +0x53b,0x544,0x56b,0x880,0x2220,0x57e,0x576,0x54e,0x546,0x54e,0x576,0x880,0x2220,0x574,0x56d,0x544, +0x53d,0x544,0x56d }; static const uint16_t ucase_props_unfold[370]={ diff --git a/deps/icu-small/source/common/ucasemap_imp.h b/deps/icu-small/source/common/ucasemap_imp.h index 7788fd93710305..e17a0ae5a36b6d 100644 --- a/deps/icu-small/source/common/ucasemap_imp.h +++ b/deps/icu-small/source/common/ucasemap_imp.h @@ -68,15 +68,15 @@ class BreakIterator; // unicode/brkiter.h class ByteSink; class Locale; // unicode/locid.h -/** Returns TRUE if the options are valid. Otherwise FALSE, and sets an error. */ +/** Returns true if the options are valid. Otherwise false, and sets an error. */ inline UBool ustrcase_checkTitleAdjustmentOptions(uint32_t options, UErrorCode &errorCode) { - if (U_FAILURE(errorCode)) { return FALSE; } + if (U_FAILURE(errorCode)) { return false; } if ((options & U_TITLECASE_ADJUSTMENT_MASK) == U_TITLECASE_ADJUSTMENT_MASK) { // Both options together. errorCode = U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + return false; } - return TRUE; + return true; } inline UBool ustrcase_isLNS(UChar32 c) { diff --git a/deps/icu-small/source/common/ucln_cmn.h b/deps/icu-small/source/common/ucln_cmn.h index b837fb946296a1..44b73e94da791f 100644 --- a/deps/icu-small/source/common/ucln_cmn.h +++ b/deps/icu-small/source/common/ucln_cmn.h @@ -38,6 +38,8 @@ typedef enum ECleanupCommonType { UCLN_COMMON_SERVICE, UCLN_COMMON_LOCALE_KEY_TYPE, UCLN_COMMON_LOCALE, + UCLN_COMMON_LOCALE_ALIAS, + UCLN_COMMON_LOCALE_KNOWN_CANONICALIZED, UCLN_COMMON_LOCALE_AVAILABLE, UCLN_COMMON_LIKELY_SUBTAGS, UCLN_COMMON_LOCALE_DISTANCE, diff --git a/deps/icu-small/source/common/ucln_imp.h b/deps/icu-small/source/common/ucln_imp.h index 2e985669793b82..b08c6e8368b1a3 100644 --- a/deps/icu-small/source/common/ucln_imp.h +++ b/deps/icu-small/source/common/ucln_imp.h @@ -78,7 +78,7 @@ * Use the ANSI C 'atexit' function. Note that this mechanism does not * guarantee the order of cleanup relative to other users of ICU! */ -static UBool gAutoCleanRegistered = FALSE; +static UBool gAutoCleanRegistered = false; static void ucln_atexit_handler() { @@ -88,7 +88,7 @@ static void ucln_atexit_handler() static void ucln_registerAutomaticCleanup() { if(!gAutoCleanRegistered) { - gAutoCleanRegistered = TRUE; + gAutoCleanRegistered = true; atexit(&ucln_atexit_handler); } } @@ -135,7 +135,7 @@ U_CAPI void U_EXPORT2 UCLN_FINI () */ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { - BOOL status = TRUE; + BOOL status = true; switch(fdwReason) { case DLL_PROCESS_ATTACH: diff --git a/deps/icu-small/source/common/ucnv_bld.cpp b/deps/icu-small/source/common/ucnv_bld.cpp index 1c2363ea89981f..0e198892f1bdfb 100644 --- a/deps/icu-small/source/common/ucnv_bld.cpp +++ b/deps/icu-small/source/common/ucnv_bld.cpp @@ -262,7 +262,7 @@ static UBool U_CALLCONV ucnv_cleanup(void) { } U_CAPI void U_EXPORT2 -ucnv_enableCleanup() { +ucnv_enableCleanup(void) { ucln_common_registerCleanup(UCLN_COMMON_UCNV, ucnv_cleanup); } diff --git a/deps/icu-small/source/common/ucnv_bld.h b/deps/icu-small/source/common/ucnv_bld.h index caa263f56d938b..43e6c09ac0b0f8 100644 --- a/deps/icu-small/source/common/ucnv_bld.h +++ b/deps/icu-small/source/common/ucnv_bld.h @@ -101,8 +101,8 @@ struct UConverterSharedData { const UConverterStaticData *staticData; /* pointer to the static (non changing) data. */ - UBool sharedDataCached; /* TRUE: shared data is in cache, don't destroy on ucnv_close() if 0 ref. FALSE: shared data isn't in the cache, do attempt to clean it up if the ref is 0 */ - /** If FALSE, then referenceCounter is not used. Must not change after initialization. */ + UBool sharedDataCached; /* true: shared data is in cache, don't destroy on ucnv_close() if 0 ref. false: shared data isn't in the cache, do attempt to clean it up if the ref is 0 */ + /** If false, then referenceCounter is not used. Must not change after initialization. */ UBool isReferenceCounted; const UConverterImpl *impl; /* vtable-style struct of mostly function pointers */ @@ -128,7 +128,7 @@ struct UConverterSharedData { #define UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(pStaticData, pImpl) \ { \ sizeof(UConverterSharedData), ~((uint32_t)0), \ - NULL, pStaticData, FALSE, FALSE, pImpl, \ + NULL, pStaticData, false, false, pImpl, \ 0, UCNV_MBCS_TABLE_INITIALIZER \ } @@ -181,9 +181,9 @@ struct UConverter { uint32_t options; /* options flags from UConverterOpen, may contain additional bits */ - UBool sharedDataIsCached; /* TRUE: shared data is in cache, don't destroy on ucnv_close() if 0 ref. FALSE: shared data isn't in the cache, do attempt to clean it up if the ref is 0 */ - UBool isCopyLocal; /* TRUE if UConverter is not owned and not released in ucnv_close() (stack-allocated, safeClone(), etc.) */ - UBool isExtraLocal; /* TRUE if extraInfo is not owned and not released in ucnv_close() (stack-allocated, safeClone(), etc.) */ + UBool sharedDataIsCached; /* true: shared data is in cache, don't destroy on ucnv_close() if 0 ref. false: shared data isn't in the cache, do attempt to clean it up if the ref is 0 */ + UBool isCopyLocal; /* true if UConverter is not owned and not released in ucnv_close() (stack-allocated, safeClone(), etc.) */ + UBool isExtraLocal; /* true if extraInfo is not owned and not released in ucnv_close() (stack-allocated, safeClone(), etc.) */ UBool useFallback; int8_t toULength; /* number of bytes in toUBytes */ @@ -289,7 +289,7 @@ ucnv_swap(const UDataSwapper *ds, UErrorCode *pErrorCode); U_CAPI void U_EXPORT2 -ucnv_enableCleanup(); +ucnv_enableCleanup(void); #endif diff --git a/deps/icu-small/source/common/ucnv_cnv.h b/deps/icu-small/source/common/ucnv_cnv.h index a996e2959784cf..345a1998e44883 100644 --- a/deps/icu-small/source/common/ucnv_cnv.h +++ b/deps/icu-small/source/common/ucnv_cnv.h @@ -59,7 +59,7 @@ typedef struct { } UConverterLoadArgs; #define UCNV_LOAD_ARGS_INITIALIZER \ - { (int32_t)sizeof(UConverterLoadArgs), 0, FALSE, FALSE, 0, 0, NULL, NULL, NULL } + { (int32_t)sizeof(UConverterLoadArgs), 0, false, false, 0, 0, NULL, NULL, NULL } typedef void (*UConverterLoad) (UConverterSharedData *sharedData, UConverterLoadArgs *pArgs, @@ -267,8 +267,8 @@ extern const UConverterSharedData U_CDECL_END /** Always use fallbacks from codepage to Unicode */ -#define TO_U_USE_FALLBACK(useFallback) TRUE -#define UCNV_TO_U_USE_FALLBACK(cnv) TRUE +#define TO_U_USE_FALLBACK(useFallback) true +#define UCNV_TO_U_USE_FALLBACK(cnv) true /** Use fallbacks from Unicode to codepage when cnv->useFallback or for private-use code points */ #define IS_PRIVATE_USE(c) ((uint32_t)((c)-0xe000)<0x1900 || (uint32_t)((c)-0xf0000)<0x20000) diff --git a/deps/icu-small/source/common/ucnv_u8.cpp b/deps/icu-small/source/common/ucnv_u8.cpp index 878d67304c7d89..9cf4a81ab2ef36 100644 --- a/deps/icu-small/source/common/ucnv_u8.cpp +++ b/deps/icu-small/source/common/ucnv_u8.cpp @@ -707,9 +707,9 @@ ucnv_UTF8FromUTF8(UConverterFromUnicodeArgs *pFromUArgs, // Do not go back into the bytes that will be read for finishing a partial // sequence from the previous buffer. - int32_t length=count-toULimit; + int32_t length=count-toULength; U8_TRUNCATE_IF_INCOMPLETE(source, 0, length); - count=toULimit+length; + count=toULength+length; } if(c!=0) { diff --git a/deps/icu-small/source/common/ucnvmbcs.h b/deps/icu-small/source/common/ucnvmbcs.h index a750b92e499c6e..ddc55b20fec271 100644 --- a/deps/icu-small/source/common/ucnvmbcs.h +++ b/deps/icu-small/source/common/ucnvmbcs.h @@ -420,7 +420,7 @@ typedef struct UConverterMBCSTable { NULL, \ 0, \ 0, 0, \ - FALSE, \ + false, \ 0, \ \ /* roundtrips */ \ diff --git a/deps/icu-small/source/common/ucol_swp.h b/deps/icu-small/source/common/ucol_swp.h index fd8be9aa54ff45..0c2990a85ecfc2 100644 --- a/deps/icu-small/source/common/ucol_swp.h +++ b/deps/icu-small/source/common/ucol_swp.h @@ -31,7 +31,7 @@ * Does the data look like a collation binary? * @internal */ -U_INTERNAL UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucol_looksLikeCollationBinary(const UDataSwapper *ds, const void *inData, int32_t length); diff --git a/deps/icu-small/source/common/ucurr.cpp b/deps/icu-small/source/common/ucurr.cpp index 391b08083b899a..8d213dfcfcb516 100644 --- a/deps/icu-small/source/common/ucurr.cpp +++ b/deps/icu-small/source/common/ucurr.cpp @@ -91,6 +91,8 @@ static const char VAR_DELIM = '_'; // Tag for localized display names (symbols) of currencies static const char CURRENCIES[] = "Currencies"; static const char CURRENCIES_NARROW[] = "Currencies%narrow"; +static const char CURRENCIES_FORMAL[] = "Currencies%formal"; +static const char CURRENCIES_VARIANT[] = "Currencies%variant"; static const char CURRENCYPLURALS[] = "CurrencyPlurals"; // ISO codes mapping table @@ -649,7 +651,7 @@ ucurr_getName(const UChar* currency, } int32_t choice = (int32_t) nameStyle; - if (choice < 0 || choice > 2) { + if (choice < 0 || choice > 4) { *ec = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -684,9 +686,22 @@ ucurr_getName(const UChar* currency, ec2 = U_ZERO_ERROR; LocalUResourceBundlePointer rb(ures_open(U_ICUDATA_CURR, loc, &ec2)); - if (nameStyle == UCURR_NARROW_SYMBOL_NAME) { + if (nameStyle == UCURR_NARROW_SYMBOL_NAME || nameStyle == UCURR_FORMAL_SYMBOL_NAME || nameStyle == UCURR_VARIANT_SYMBOL_NAME) { CharString key; - key.append(CURRENCIES_NARROW, ec2); + switch (nameStyle) { + case UCURR_NARROW_SYMBOL_NAME: + key.append(CURRENCIES_NARROW, ec2); + break; + case UCURR_FORMAL_SYMBOL_NAME: + key.append(CURRENCIES_FORMAL, ec2); + break; + case UCURR_VARIANT_SYMBOL_NAME: + key.append(CURRENCIES_VARIANT, ec2); + break; + default: + *ec = U_UNSUPPORTED_ERROR; + return 0; + } key.append("/", ec2); key.append(buf, ec2); s = ures_getStringByKeyWithFallback(rb.getAlias(), key.data(), len, &ec2); @@ -1610,7 +1625,7 @@ ucurr_getDefaultFractionDigits(const UChar* currency, UErrorCode* ec) { return ucurr_getDefaultFractionDigitsForUsage(currency,UCURR_USAGE_STANDARD,ec); } -U_DRAFT int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucurr_getDefaultFractionDigitsForUsage(const UChar* currency, const UCurrencyUsage usage, UErrorCode* ec) { int32_t fracDigits = 0; if (U_SUCCESS(*ec)) { @@ -1633,7 +1648,7 @@ ucurr_getRoundingIncrement(const UChar* currency, UErrorCode* ec) { return ucurr_getRoundingIncrementForUsage(currency, UCURR_USAGE_STANDARD, ec); } -U_DRAFT double U_EXPORT2 +U_CAPI double U_EXPORT2 ucurr_getRoundingIncrementForUsage(const UChar* currency, const UCurrencyUsage usage, UErrorCode* ec) { double result = 0.0; @@ -2259,7 +2274,6 @@ ucurr_countCurrencies(const char* locale, // local variables UErrorCode localStatus = U_ZERO_ERROR; char id[ULOC_FULLNAME_CAPACITY]; - uloc_getKeywordValue(locale, "currency", id, ULOC_FULLNAME_CAPACITY, &localStatus); // get country or country_variant in `id' idForLocale(locale, id, sizeof(id), ec); @@ -2375,7 +2389,6 @@ ucurr_forLocaleAndDate(const char* locale, // local variables UErrorCode localStatus = U_ZERO_ERROR; char id[ULOC_FULLNAME_CAPACITY]; - resLen = uloc_getKeywordValue(locale, "currency", id, ULOC_FULLNAME_CAPACITY, &localStatus); // get country or country_variant in `id' idForLocale(locale, id, sizeof(id), ec); diff --git a/deps/icu-small/source/common/uelement.h b/deps/icu-small/source/common/uelement.h index 9d45f09fb87f65..e4d16afe4e2753 100644 --- a/deps/icu-small/source/common/uelement.h +++ b/deps/icu-small/source/common/uelement.h @@ -46,7 +46,7 @@ typedef union UElement UElement; * An element-equality (boolean) comparison function. * @param e1 An element (object or integer) * @param e2 An element (object or integer) - * @return TRUE if the two elements are equal. + * @return true if the two elements are equal. */ typedef UBool U_CALLCONV UElementsAreEqual(const UElement e1, const UElement e2); diff --git a/deps/icu-small/source/common/uinvchar.cpp b/deps/icu-small/source/common/uinvchar.cpp index ac9716066f22b7..7fce257baf0912 100644 --- a/deps/icu-small/source/common/uinvchar.cpp +++ b/deps/icu-small/source/common/uinvchar.cpp @@ -579,7 +579,7 @@ uprv_ebcdicToLowercaseAscii(char c) { return (char)lowercaseAsciiFromEbcdic[(uint8_t)c]; } -U_INTERNAL uint8_t* U_EXPORT2 +U_CAPI uint8_t* U_EXPORT2 uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n) { uint8_t *orig_dst = dst; @@ -600,7 +600,7 @@ uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n) return orig_dst; } -U_INTERNAL uint8_t* U_EXPORT2 +U_CAPI uint8_t* U_EXPORT2 uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n) { uint8_t *orig_dst = dst; diff --git a/deps/icu-small/source/common/uinvchar.h b/deps/icu-small/source/common/uinvchar.h index a43cfcd98286fe..9b7a9bd114172e 100644 --- a/deps/icu-small/source/common/uinvchar.h +++ b/deps/icu-small/source/common/uinvchar.h @@ -33,11 +33,11 @@ * * @param s Input string pointer. * @param length Length of the string, can be -1 if NUL-terminated. - * @return TRUE if s contains only invariant characters. + * @return true if s contains only invariant characters. * * @internal (ICU 2.8) */ -U_INTERNAL UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uprv_isInvariantString(const char *s, int32_t length); /** @@ -46,11 +46,11 @@ uprv_isInvariantString(const char *s, int32_t length); * * @param s Input string pointer. * @param length Length of the string, can be -1 if NUL-terminated. - * @return TRUE if s contains only invariant characters. + * @return true if s contains only invariant characters. * * @internal (ICU 2.8) */ -U_INTERNAL UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uprv_isInvariantUString(const UChar *s, int32_t length); /** @@ -141,7 +141,7 @@ uprv_isEbcdicAtSign(char c); * Compare two EBCDIC invariant-character strings in ASCII order. * @internal */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2); /** @@ -161,7 +161,7 @@ uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2); * Converts an EBCDIC invariant character to ASCII. * @internal */ -U_INTERNAL char U_EXPORT2 +U_CAPI char U_EXPORT2 uprv_ebcdicToAscii(char c); /** @@ -181,7 +181,7 @@ uprv_ebcdicToAscii(char c); * Converts an EBCDIC invariant character to lowercase ASCII. * @internal */ -U_INTERNAL char U_EXPORT2 +U_CAPI char U_EXPORT2 uprv_ebcdicToLowercaseAscii(char c); /** @@ -202,7 +202,7 @@ uprv_ebcdicToLowercaseAscii(char c); * @internal * @see uprv_strncpy */ -U_INTERNAL uint8_t* U_EXPORT2 +U_CAPI uint8_t* U_EXPORT2 uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n); @@ -211,7 +211,7 @@ uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n); * @internal * @see uprv_strncpy */ -U_INTERNAL uint8_t* U_EXPORT2 +U_CAPI uint8_t* U_EXPORT2 uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n); diff --git a/deps/icu-small/source/common/uloc.cpp b/deps/icu-small/source/common/uloc.cpp index 0e235d7958ceb1..522f33dbe243a9 100644 --- a/deps/icu-small/source/common/uloc.cpp +++ b/deps/icu-small/source/common/uloc.cpp @@ -50,9 +50,6 @@ #include "uassert.h" #include "charstr.h" -#include -#include /* for sprintf */ - U_NAMESPACE_USE /* ### Declarations **************************************************/ @@ -60,12 +57,6 @@ U_NAMESPACE_USE /* Locale stuff from locid.cpp */ U_CFUNC void locale_set_default(const char *id); U_CFUNC const char *locale_get_default(void); -U_CFUNC int32_t -locale_getKeywords(const char *localeID, - char prev, - char *keywords, int32_t keywordCapacity, - UBool valuesToo, - UErrorCode *status); /* ### Data tables **************************************************/ @@ -601,12 +592,12 @@ compareKeywordStructs(const void * /*context*/, const void *left, const void *ri return uprv_strcmp(leftString, rightString); } -static void -_getKeywords(const char *localeID, - char prev, - ByteSink& sink, - UBool valuesToo, - UErrorCode *status) +U_CFUNC void +ulocimp_getKeywords(const char *localeID, + char prev, + ByteSink& sink, + UBool valuesToo, + UErrorCode *status) { KeywordStruct keywordList[ULOC_MAX_NO_KEYWORDS]; @@ -722,18 +713,18 @@ _getKeywords(const char *localeID, } } -U_CFUNC int32_t -locale_getKeywords(const char *localeID, - char prev, - char *keywords, int32_t keywordCapacity, - UBool valuesToo, - UErrorCode *status) { +U_CAPI int32_t U_EXPORT2 +uloc_getKeywordValue(const char* localeID, + const char* keywordName, + char* buffer, int32_t bufferCapacity, + UErrorCode* status) +{ if (U_FAILURE(*status)) { return 0; } - CheckedArrayByteSink sink(keywords, keywordCapacity); - _getKeywords(localeID, prev, sink, valuesToo, status); + CheckedArrayByteSink sink(buffer, bufferCapacity); + ulocimp_getKeywordValue(localeID, keywordName, sink, status); int32_t reslen = sink.NumberOfBytesAppended(); @@ -744,26 +735,22 @@ locale_getKeywords(const char *localeID, if (sink.Overflowed()) { *status = U_BUFFER_OVERFLOW_ERROR; } else { - u_terminateChars(keywords, keywordCapacity, reslen, status); + u_terminateChars(buffer, bufferCapacity, reslen, status); } return reslen; } -U_CAPI int32_t U_EXPORT2 -uloc_getKeywordValue(const char* localeID, - const char* keywordName, - char* buffer, int32_t bufferCapacity, - UErrorCode* status) +U_CAPI void U_EXPORT2 +ulocimp_getKeywordValue(const char* localeID, + const char* keywordName, + icu::ByteSink& sink, + UErrorCode* status) { - if (buffer != nullptr) { - buffer[0] = '\0'; - } const char* startSearchHere = NULL; const char* nextSeparator = NULL; char keywordNameBuffer[ULOC_KEYWORD_BUFFER_LEN]; char localeKeywordNameBuffer[ULOC_KEYWORD_BUFFER_LEN]; - int32_t result = 0; if(status && U_SUCCESS(*status) && localeID) { char tempBuffer[ULOC_FULLNAME_CAPACITY]; @@ -771,12 +758,12 @@ uloc_getKeywordValue(const char* localeID, if (keywordName == NULL || keywordName[0] == 0) { *status = U_ILLEGAL_ARGUMENT_ERROR; - return 0; + return; } locale_canonKeywordName(keywordNameBuffer, keywordName, status); if(U_FAILURE(*status)) { - return 0; + return; } if (_hasBCP47Extension(localeID)) { @@ -788,7 +775,7 @@ uloc_getKeywordValue(const char* localeID, startSearchHere = locale_getKeywordsStart(tmpLocaleID); if(startSearchHere == NULL) { /* no keywords, return at once */ - return 0; + return; } /* find the first keyword */ @@ -800,7 +787,7 @@ uloc_getKeywordValue(const char* localeID, nextSeparator = uprv_strchr(startSearchHere, '='); if(!nextSeparator) { *status = U_ILLEGAL_ARGUMENT_ERROR; /* key must have =value */ - return 0; + return; } /* strip leading & trailing spaces (TC decided to tolerate these) */ while(*startSearchHere == ' ') { @@ -814,20 +801,20 @@ uloc_getKeywordValue(const char* localeID, /* copy & normalize keyName from locale */ if (startSearchHere == keyValueTail) { *status = U_ILLEGAL_ARGUMENT_ERROR; /* empty keyword name in passed-in locale */ - return 0; + return; } keyValueLen = 0; while (startSearchHere < keyValueTail) { if (!UPRV_ISALPHANUM(*startSearchHere)) { *status = U_ILLEGAL_ARGUMENT_ERROR; /* malformed keyword name */ - return 0; + return; } if (keyValueLen < ULOC_KEYWORD_BUFFER_LEN - 1) { localeKeywordNameBuffer[keyValueLen++] = uprv_tolower(*startSearchHere++); } else { /* keyword name too long for internal buffer */ *status = U_INTERNAL_PROGRAM_ERROR; - return 0; + return; } } localeKeywordNameBuffer[keyValueLen] = 0; /* terminate */ @@ -848,28 +835,20 @@ uloc_getKeywordValue(const char* localeID, /* Now copy the value, but check well-formedness */ if (nextSeparator == keyValueTail) { *status = U_ILLEGAL_ARGUMENT_ERROR; /* empty key value name in passed-in locale */ - return 0; + return; } - keyValueLen = 0; while (nextSeparator < keyValueTail) { if (!UPRV_ISALPHANUM(*nextSeparator) && !UPRV_OK_VALUE_PUNCTUATION(*nextSeparator)) { *status = U_ILLEGAL_ARGUMENT_ERROR; /* malformed key value */ - return 0; - } - if (keyValueLen < bufferCapacity) { - /* Should we lowercase value to return here? Tests expect as-is. */ - buffer[keyValueLen++] = *nextSeparator++; - } else { /* keep advancing so we return correct length in case of overflow */ - keyValueLen++; - nextSeparator++; + return; } + /* Should we lowercase value to return here? Tests expect as-is. */ + sink.Append(nextSeparator++, 1); } - result = u_terminateChars(buffer, bufferCapacity, keyValueLen, status); - return result; + return; } } } - return 0; } U_CAPI int32_t U_EXPORT2 @@ -892,7 +871,6 @@ uloc_setKeywordValue(const char* keywordName, char* startSearchHere = NULL; char* keywordStart = NULL; CharString updatedKeysAndValues; - int32_t updatedKeysAndValuesLen; UBool handledInputKeyAndValue = FALSE; char keyValuePrefix = '@'; @@ -1072,18 +1050,10 @@ uloc_setKeywordValue(const char* keywordName, return bufLen; } - updatedKeysAndValuesLen = updatedKeysAndValues.length(); - /* needLen = length of the part before '@' + length of updated key-value part including '@' */ - needLen = (int32_t)(startSearchHere - buffer) + updatedKeysAndValuesLen; - if(needLen >= bufferCapacity) { - *status = U_BUFFER_OVERFLOW_ERROR; - return needLen; /* no change */ - } - if (updatedKeysAndValuesLen > 0) { - uprv_strncpy(startSearchHere, updatedKeysAndValues.data(), updatedKeysAndValuesLen); - } - buffer[needLen]=0; - return needLen; + // needLen = length of the part before '@' + needLen = (int32_t)(startSearchHere - buffer); + return needLen + updatedKeysAndValues.extract( + startSearchHere, bufferCapacity - needLen, *status); } /* ### ID parsing implementation **************************************************/ @@ -1148,7 +1118,7 @@ uloc_getCurrentLanguageID(const char* oldID){ * * TODO try to use this in Locale */ -static CharString +CharString U_EXPORT2 ulocimp_getLanguage(const char *localeID, const char **pEnd, UErrorCode &status) { @@ -1193,21 +1163,7 @@ ulocimp_getLanguage(const char *localeID, return result; } -U_CFUNC int32_t -ulocimp_getLanguage(const char *localeID, - char *language, int32_t languageCapacity, - const char **pEnd) { - ErrorCode status; - CharString result = ulocimp_getLanguage(localeID, pEnd, status); - if (status.isFailure()) { - return 0; - } - int32_t reslen = result.length(); - uprv_memcpy(language, result.data(), std::min(reslen, languageCapacity)); - return reslen; -} - -static CharString +CharString U_EXPORT2 ulocimp_getScript(const char *localeID, const char **pEnd, UErrorCode &status) { @@ -1241,21 +1197,7 @@ ulocimp_getScript(const char *localeID, return result; } -U_CFUNC int32_t -ulocimp_getScript(const char *localeID, - char *script, int32_t scriptCapacity, - const char **pEnd) { - ErrorCode status; - CharString result = ulocimp_getScript(localeID, pEnd, status); - if (status.isFailure()) { - return 0; - } - int32_t reslen = result.length(); - uprv_memcpy(script, result.data(), std::min(reslen, scriptCapacity)); - return reslen; -} - -static CharString +CharString U_EXPORT2 ulocimp_getCountry(const char *localeID, const char **pEnd, UErrorCode &status) { @@ -1290,29 +1232,15 @@ ulocimp_getCountry(const char *localeID, return result; } -U_CFUNC int32_t -ulocimp_getCountry(const char *localeID, - char *country, int32_t countryCapacity, - const char **pEnd) { - ErrorCode status; - CharString result = ulocimp_getCountry(localeID, pEnd, status); - if (status.isFailure()) { - return 0; - } - int32_t reslen = result.length(); - uprv_memcpy(country, result.data(), std::min(reslen, countryCapacity)); - return reslen; -} - /** * @param needSeparator if true, then add leading '_' if any variants * are added to 'variant' */ static void -_getVariantEx(const char *localeID, - char prev, - ByteSink& sink, - UBool needSeparator) { +_getVariant(const char *localeID, + char prev, + ByteSink& sink, + UBool needSeparator) { UBool hasVariant = FALSE; /* get one or more variant tags and separate them with '_' */ @@ -1353,23 +1281,6 @@ _getVariantEx(const char *localeID, } } -static int32_t -_getVariantEx(const char *localeID, - char prev, - char *variant, int32_t variantCapacity, - UBool needSeparator) { - CheckedArrayByteSink sink(variant, variantCapacity); - _getVariantEx(localeID, prev, sink, needSeparator); - return sink.NumberOfBytesAppended(); -} - -static int32_t -_getVariant(const char *localeID, - char prev, - char *variant, int32_t variantCapacity) { - return _getVariantEx(localeID, prev, variant, variantCapacity, FALSE); -} - /* Keyword enumeration */ typedef struct UKeywordsContext { @@ -1466,9 +1377,6 @@ U_CAPI UEnumeration* U_EXPORT2 uloc_openKeywords(const char* localeID, UErrorCode* status) { - int32_t i=0; - char keywords[256]; - int32_t keywordsCapacity = 256; char tempBuffer[ULOC_FULLNAME_CAPACITY]; const char* tmpLocaleID; @@ -1486,34 +1394,42 @@ uloc_openKeywords(const char* localeID, } /* Skip the language */ - ulocimp_getLanguage(tmpLocaleID, NULL, 0, &tmpLocaleID); + ulocimp_getLanguage(tmpLocaleID, &tmpLocaleID, *status); + if (U_FAILURE(*status)) { + return 0; + } + if(_isIDSeparator(*tmpLocaleID)) { const char *scriptID; /* Skip the script if available */ - ulocimp_getScript(tmpLocaleID+1, NULL, 0, &scriptID); + ulocimp_getScript(tmpLocaleID+1, &scriptID, *status); + if (U_FAILURE(*status)) { + return 0; + } if(scriptID != tmpLocaleID+1) { /* Found optional script */ tmpLocaleID = scriptID; } /* Skip the Country */ if (_isIDSeparator(*tmpLocaleID)) { - ulocimp_getCountry(tmpLocaleID+1, NULL, 0, &tmpLocaleID); - if(_isIDSeparator(*tmpLocaleID)) { - _getVariant(tmpLocaleID+1, *tmpLocaleID, NULL, 0); + ulocimp_getCountry(tmpLocaleID+1, &tmpLocaleID, *status); + if (U_FAILURE(*status)) { + return 0; } } } /* keywords are located after '@' */ if((tmpLocaleID = locale_getKeywordsStart(tmpLocaleID)) != NULL) { - i=locale_getKeywords(tmpLocaleID+1, '@', keywords, keywordsCapacity, FALSE, status); - } - - if(i) { - return uloc_openKeywordList(keywords, i, status); - } else { - return NULL; + CharString keywords; + CharStringByteSink sink(&keywords); + ulocimp_getKeywords(tmpLocaleID+1, '@', sink, FALSE, status); + if (U_FAILURE(*status)) { + return NULL; + } + return uloc_openKeywordList(keywords.data(), keywords.length(), status); } + return NULL; } @@ -1605,7 +1521,7 @@ _canonicalize(const char* localeID, variantSize = -tag.length(); { CharStringByteSink s(&tag); - _getVariantEx(tmpLocaleID+1, *tmpLocaleID, s, FALSE); + _getVariant(tmpLocaleID+1, *tmpLocaleID, s, FALSE); } variantSize += tag.length(); if (variantSize > 0) { @@ -1667,7 +1583,7 @@ _canonicalize(const char* localeID, int32_t posixVariantSize = -tag.length(); { CharStringByteSink s(&tag); - _getVariantEx(tmpLocaleID+1, '@', s, (UBool)(variantSize > 0)); + _getVariant(tmpLocaleID+1, '@', s, (UBool)(variantSize > 0)); } posixVariantSize += tag.length(); if (posixVariantSize > 0) { @@ -1696,7 +1612,7 @@ _canonicalize(const char* localeID, (!separatorIndicator || separatorIndicator > keywordAssign)) { sink.Append("@", 1); ++fieldCount; - _getKeywords(tmpLocaleID+1, '@', sink, TRUE, err); + ulocimp_getKeywords(tmpLocaleID+1, '@', sink, TRUE, err); } } } @@ -1745,7 +1661,6 @@ uloc_getLanguage(const char* localeID, UErrorCode* err) { /* uloc_getLanguage will return a 2 character iso-639 code if one exists. *CWB*/ - int32_t i=0; if (err==NULL || U_FAILURE(*err)) { return 0; @@ -1755,8 +1670,7 @@ uloc_getLanguage(const char* localeID, localeID=uloc_getDefault(); } - i=ulocimp_getLanguage(localeID, language, languageCapacity, NULL); - return u_terminateChars(language, languageCapacity, i, err); + return ulocimp_getLanguage(localeID, NULL, *err).extract(language, languageCapacity, *err); } U_CAPI int32_t U_EXPORT2 @@ -1765,8 +1679,6 @@ uloc_getScript(const char* localeID, int32_t scriptCapacity, UErrorCode* err) { - int32_t i=0; - if(err==NULL || U_FAILURE(*err)) { return 0; } @@ -1776,11 +1688,15 @@ uloc_getScript(const char* localeID, } /* skip the language */ - ulocimp_getLanguage(localeID, NULL, 0, &localeID); + ulocimp_getLanguage(localeID, &localeID, *err); + if (U_FAILURE(*err)) { + return 0; + } + if(_isIDSeparator(*localeID)) { - i=ulocimp_getScript(localeID+1, script, scriptCapacity, NULL); + return ulocimp_getScript(localeID+1, NULL, *err).extract(script, scriptCapacity, *err); } - return u_terminateChars(script, scriptCapacity, i, err); + return u_terminateChars(script, scriptCapacity, 0, err); } U_CAPI int32_t U_EXPORT2 @@ -1789,8 +1705,6 @@ uloc_getCountry(const char* localeID, int32_t countryCapacity, UErrorCode* err) { - int32_t i=0; - if(err==NULL || U_FAILURE(*err)) { return 0; } @@ -1800,20 +1714,27 @@ uloc_getCountry(const char* localeID, } /* Skip the language */ - ulocimp_getLanguage(localeID, NULL, 0, &localeID); + ulocimp_getLanguage(localeID, &localeID, *err); + if (U_FAILURE(*err)) { + return 0; + } + if(_isIDSeparator(*localeID)) { const char *scriptID; /* Skip the script if available */ - ulocimp_getScript(localeID+1, NULL, 0, &scriptID); + ulocimp_getScript(localeID+1, &scriptID, *err); + if (U_FAILURE(*err)) { + return 0; + } if(scriptID != localeID+1) { /* Found optional script */ localeID = scriptID; } if(_isIDSeparator(*localeID)) { - i=ulocimp_getCountry(localeID+1, country, countryCapacity, NULL); + return ulocimp_getCountry(localeID+1, NULL, *err).extract(country, countryCapacity, *err); } } - return u_terminateChars(country, countryCapacity, i, err); + return u_terminateChars(country, countryCapacity, 0, err); } U_CAPI int32_t U_EXPORT2 @@ -1840,11 +1761,18 @@ uloc_getVariant(const char* localeID, } /* Skip the language */ - ulocimp_getLanguage(tmpLocaleID, NULL, 0, &tmpLocaleID); + ulocimp_getLanguage(tmpLocaleID, &tmpLocaleID, *err); + if (U_FAILURE(*err)) { + return 0; + } + if(_isIDSeparator(*tmpLocaleID)) { const char *scriptID; /* Skip the script if available */ - ulocimp_getScript(tmpLocaleID+1, NULL, 0, &scriptID); + ulocimp_getScript(tmpLocaleID+1, &scriptID, *err); + if (U_FAILURE(*err)) { + return 0; + } if(scriptID != tmpLocaleID+1) { /* Found optional script */ tmpLocaleID = scriptID; @@ -1852,7 +1780,10 @@ uloc_getVariant(const char* localeID, /* Skip the Country */ if (_isIDSeparator(*tmpLocaleID)) { const char *cntryID; - ulocimp_getCountry(tmpLocaleID+1, NULL, 0, &cntryID); + ulocimp_getCountry(tmpLocaleID+1, &cntryID, *err); + if (U_FAILURE(*err)) { + return 0; + } if (cntryID != tmpLocaleID+1) { /* Found optional country */ tmpLocaleID = cntryID; @@ -1862,18 +1793,24 @@ uloc_getVariant(const char* localeID, if (tmpLocaleID != cntryID && _isIDSeparator(tmpLocaleID[1])) { tmpLocaleID++; } - i=_getVariant(tmpLocaleID+1, *tmpLocaleID, variant, variantCapacity); + + CheckedArrayByteSink sink(variant, variantCapacity); + _getVariant(tmpLocaleID+1, *tmpLocaleID, sink, FALSE); + + i = sink.NumberOfBytesAppended(); + + if (U_FAILURE(*err)) { + return i; + } + + if (sink.Overflowed()) { + *err = U_BUFFER_OVERFLOW_ERROR; + return i; + } } } } - /* removed by weiv. We don't want to handle POSIX variants anymore. Use canonicalization function */ - /* if we do not have a variant tag yet then try a POSIX variant after '@' */ -/* - if(!haveVariant && (localeID=uprv_strrchr(localeID, '@'))!=NULL) { - i=_getVariant(localeID+1, '@', variant, variantCapacity); - } -*/ return u_terminateChars(variant, variantCapacity, i, err); } @@ -1905,7 +1842,7 @@ uloc_getName(const char* localeID, return reslen; } -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ulocimp_getName(const char* localeID, ByteSink& sink, UErrorCode* err) @@ -1941,7 +1878,7 @@ uloc_getBaseName(const char* localeID, return reslen; } -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ulocimp_getBaseName(const char* localeID, ByteSink& sink, UErrorCode* err) @@ -1977,7 +1914,7 @@ uloc_canonicalize(const char* localeID, return reslen; } -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ulocimp_canonicalize(const char* localeID, ByteSink& sink, UErrorCode* err) @@ -2058,22 +1995,22 @@ uloc_getLCID(const char* localeID) // uprv_convertToLCID does not support keywords other than collation. // Remove all keywords except collation. int32_t len; - char collVal[ULOC_KEYWORDS_CAPACITY]; char tmpLocaleID[ULOC_FULLNAME_CAPACITY]; - len = uloc_getKeywordValue(localeID, "collation", collVal, - UPRV_LENGTHOF(collVal) - 1, &status); - - if (U_SUCCESS(status) && len > 0) { - collVal[len] = 0; + CharString collVal; + { + CharStringByteSink sink(&collVal); + ulocimp_getKeywordValue(localeID, "collation", sink, &status); + } + if (U_SUCCESS(status) && !collVal.isEmpty()) { len = uloc_getBaseName(localeID, tmpLocaleID, UPRV_LENGTHOF(tmpLocaleID) - 1, &status); if (U_SUCCESS(status) && len > 0) { tmpLocaleID[len] = 0; - len = uloc_setKeywordValue("collation", collVal, tmpLocaleID, + len = uloc_setKeywordValue("collation", collVal.data(), tmpLocaleID, UPRV_LENGTHOF(tmpLocaleID) - len - 1, &status); if (U_SUCCESS(status) && len > 0) { diff --git a/deps/icu-small/source/common/uloc_tag.cpp b/deps/icu-small/source/common/uloc_tag.cpp index 3bdeddbe066d96..d2d938753182d8 100644 --- a/deps/icu-small/source/common/uloc_tag.cpp +++ b/deps/icu-small/source/common/uloc_tag.cpp @@ -15,6 +15,7 @@ #include "unicode/uenum.h" #include "unicode/uloc.h" #include "ustr_imp.h" +#include "bytesinkutil.h" #include "charstr.h" #include "cmemory.h" #include "cstring.h" @@ -53,7 +54,7 @@ typedef struct ULanguageTag { VariantListEntry *variants; ExtensionListEntry *extensions; const char *privateuse; - const char *grandfathered; + const char *legacy; } ULanguageTag; #define MINLEN 2 @@ -85,8 +86,9 @@ static const char LOCALE_TYPE_YES[] = "yes"; Updated on 2018-09-12 from https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry . - This table has 2 parts. The parts for Grandfathered tags is generated by the - following scripts from the IANA language tag registry. + This table has 2 parts. The part for + legacy language tags (marked as “Type: grandfathered” in BCP 47) + is generated by the following scripts from the IANA language tag registry. curl https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry |\ egrep -A 7 'Type: grandfathered' | \ @@ -100,8 +102,8 @@ static const char LOCALE_TYPE_YES[] = "yes"; values. They may have to be removed for the strict BCP 47 compliance. */ -static const char* const GRANDFATHERED[] = { -/* grandfathered preferred */ +static const char* const LEGACY[] = { +/* legacy preferred */ "art-lojban", "jbo", "en-gb-oed", "en-gb-oxendict", "i-ami", "ami", @@ -124,7 +126,7 @@ static const char* const GRANDFATHERED[] = { "zh-min-nan", "nan", "zh-xiang", "hsn", - // Grandfathered tags with no preferred value in the IANA + // Legacy tags with no preferred value in the IANA // registry. Kept for now for the backward compatibility // because ICU has mapped them this way. "cel-gaulish", "xtg-x-cel-gaulish", @@ -346,7 +348,7 @@ ultag_getPrivateUse(const ULanguageTag* langtag); #if 0 static const char* -ultag_getGrandfathered(const ULanguageTag* langtag); +ultag_getLegacy(const ULanguageTag* langtag); #endif U_NAMESPACE_BEGIN @@ -986,7 +988,7 @@ _initializeULanguageTag(ULanguageTag* langtag) { langtag->variants = NULL; langtag->extensions = NULL; - langtag->grandfathered = EMPTY; + langtag->legacy = EMPTY; langtag->privateuse = EMPTY; } @@ -1268,35 +1270,17 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st UBool isBcpUExt; while (TRUE) { - icu::CharString buf; key = uenum_next(keywordEnum.getAlias(), NULL, status); if (key == NULL) { break; } - char* buffer; - int32_t resultCapacity = ULOC_KEYWORD_AND_VALUES_CAPACITY; - - for (;;) { - buffer = buf.getAppendBuffer( - /*minCapacity=*/resultCapacity, - /*desiredCapacityHint=*/resultCapacity, - resultCapacity, - tmpStatus); - - if (U_FAILURE(tmpStatus)) { - break; - } - len = uloc_getKeywordValue( - localeID, key, buffer, resultCapacity, &tmpStatus); - - if (tmpStatus != U_BUFFER_OVERFLOW_ERROR) { - break; - } - - resultCapacity = len; - tmpStatus = U_ZERO_ERROR; + icu::CharString buf; + { + icu::CharStringByteSink sink(&buf); + ulocimp_getKeywordValue(localeID, key, sink, &tmpStatus); } + len = buf.length(); if (U_FAILURE(tmpStatus)) { if (tmpStatus == U_MEMORY_ALLOCATION_ERROR) { @@ -1312,11 +1296,6 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st continue; } - buf.append(buffer, len, tmpStatus); - if (tmpStatus == U_STRING_NOT_TERMINATED_WARNING) { - tmpStatus = U_ZERO_ERROR; // Terminators provided by CharString. - } - keylen = (int32_t)uprv_strlen(key); isBcpUExt = (keylen > 1); @@ -1395,32 +1374,18 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st no known mapping. This implementation normalizes the value to lower case */ - icu::CharString* extBuf = extBufPool.create(); + icu::CharString* extBuf = extBufPool.create(buf, tmpStatus); + if (extBuf == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; break; } - int32_t bcpValueLen = static_cast(uprv_strlen(bcpValue)); - int32_t resultCapacity; - char* pExtBuf = extBuf->getAppendBuffer( - /*minCapacity=*/bcpValueLen, - /*desiredCapacityHint=*/bcpValueLen, - resultCapacity, - tmpStatus); - if (U_FAILURE(tmpStatus)) { - *status = tmpStatus; - break; - } - - uprv_strcpy(pExtBuf, bcpValue); - T_CString_toLowerCase(pExtBuf); - - extBuf->append(pExtBuf, bcpValueLen, tmpStatus); if (U_FAILURE(tmpStatus)) { *status = tmpStatus; break; } + T_CString_toLowerCase(extBuf->data()); bcpValue = extBuf->data(); } } else { @@ -2023,11 +1988,12 @@ _appendPrivateuseToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool #define PRIV 0x0080 /** - * Ticket #12705 - Visual Studio 2015 Update 3 contains a new code optimizer which has problems optimizing - * this function. (See https://blogs.msdn.microsoft.com/vcblog/2016/05/04/new-code-optimizer/ ) - * As a workaround, we will turn off optimization just for this function on VS2015 Update 3 and above. + * Ticket #12705 - The optimizer in Visual Studio 2015 Update 3 has problems optimizing this function. + * As a work-around, optimization is disabled for this function on VS2015 and VS2017. + * This work-around should be removed once the following versions of Visual Studio are no + * longer supported: All versions of VS2015/VS2017, and versions of VS2019 below 16.4. */ -#if (defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 190024210)) +#if defined(_MSC_VER) && (_MSC_VER >= 1900) && (_MSC_VER < 1924) #pragma optimize( "", off ) #endif @@ -2042,7 +2008,7 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta char *pExtValueSubtag, *pExtValueSubtagEnd; int32_t i; UBool privateuseVar = FALSE; - int32_t grandfatheredLen = 0; + int32_t legacyLen = 0; if (parsedLen != NULL) { *parsedLen = 0; @@ -2082,25 +2048,25 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta } size_t parsedLenDelta = 0; - // Grandfathered tag will be consider together. Grandfathered tag with intervening + // Legacy tag will be consider together. Legacy tag with intervening // script and region such as art-DE-lojban or art-Latn-lojban won't be // matched. - /* check if the tag is grandfathered */ - for (i = 0; i < UPRV_LENGTHOF(GRANDFATHERED); i += 2) { - int32_t checkGrandfatheredLen = static_cast(uprv_strlen(GRANDFATHERED[i])); - if (tagLen < checkGrandfatheredLen) { + /* check if the tag is legacy */ + for (i = 0; i < UPRV_LENGTHOF(LEGACY); i += 2) { + int32_t checkLegacyLen = static_cast(uprv_strlen(LEGACY[i])); + if (tagLen < checkLegacyLen) { continue; } - if (tagLen > checkGrandfatheredLen && tagBuf[checkGrandfatheredLen] != '-') { + if (tagLen > checkLegacyLen && tagBuf[checkLegacyLen] != '-') { // make sure next char is '-'. continue; } - if (uprv_strnicmp(GRANDFATHERED[i], tagBuf, checkGrandfatheredLen) == 0) { + if (uprv_strnicmp(LEGACY[i], tagBuf, checkLegacyLen) == 0) { int32_t newTagLength; - grandfatheredLen = checkGrandfatheredLen; /* back up for output parsedLen */ - int32_t replacementLen = static_cast(uprv_strlen(GRANDFATHERED[i+1])); - newTagLength = replacementLen + tagLen - checkGrandfatheredLen; + legacyLen = checkLegacyLen; /* back up for output parsedLen */ + int32_t replacementLen = static_cast(uprv_strlen(LEGACY[i+1])); + newTagLength = replacementLen + tagLen - checkLegacyLen; if (tagLen < newTagLength) { uprv_free(tagBuf); tagBuf = (char*)uprv_malloc(newTagLength + 1); @@ -2111,16 +2077,16 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta t->buf = tagBuf; tagLen = newTagLength; } - parsedLenDelta = checkGrandfatheredLen - replacementLen; - uprv_strcpy(t->buf, GRANDFATHERED[i + 1]); - if (checkGrandfatheredLen != tagLen) { - uprv_strcpy(t->buf + replacementLen, tag + checkGrandfatheredLen); + parsedLenDelta = checkLegacyLen - replacementLen; + uprv_strcpy(t->buf, LEGACY[i + 1]); + if (checkLegacyLen != tagLen) { + uprv_strcpy(t->buf + replacementLen, tag + checkLegacyLen); } break; } } - if (grandfatheredLen == 0) { + if (legacyLen == 0) { for (i = 0; i < UPRV_LENGTHOF(REDUNDANT); i += 2) { const char* redundantTag = REDUNDANT[i]; size_t redundantTagLen = uprv_strlen(redundantTag); @@ -2440,10 +2406,8 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta return t.orphan(); } -/** -* Ticket #12705 - Turn optimization back on. -*/ -#if (defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 190024210)) +// Ticket #12705 - Turn optimization back on. +#if defined(_MSC_VER) && (_MSC_VER >= 1900) && (_MSC_VER < 1924) #pragma optimize( "", on ) #endif @@ -2608,8 +2572,8 @@ ultag_getPrivateUse(const ULanguageTag* langtag) { #if 0 static const char* -ultag_getGrandfathered(const ULanguageTag* langtag) { - return langtag->grandfathered; +ultag_getLegacy(const ULanguageTag* langtag) { + return langtag->legacy; } #endif @@ -2720,14 +2684,17 @@ ulocimp_toLanguageTag(const char* localeID, key = uenum_next(kwdEnum.getAlias(), &len, &tmpStatus); if (len == 1 && *key == PRIVATEUSE) { - char buf[ULOC_KEYWORD_AND_VALUES_CAPACITY]; - buf[0] = PRIVATEUSE; - buf[1] = SEP; - len = uloc_getKeywordValue(localeID, key, &buf[2], sizeof(buf) - 2, &tmpStatus); + icu::CharString buf; + { + icu::CharStringByteSink sink(&buf); + ulocimp_getKeywordValue(localeID, key, sink, &tmpStatus); + } if (U_SUCCESS(tmpStatus)) { - if (ultag_isPrivateuseValueSubtags(&buf[2], len)) { + if (ultag_isPrivateuseValueSubtags(buf.data(), buf.length())) { /* return private use only tag */ - sink.Append(buf, len + 2); + static const char PREFIX[] = { PRIVATEUSE, SEP }; + sink.Append(PREFIX, sizeof(PREFIX)); + sink.Append(buf.data(), buf.length()); done = TRUE; } else if (strict) { *status = U_ILLEGAL_ARGUMENT_ERROR; diff --git a/deps/icu-small/source/common/ulocimp.h b/deps/icu-small/source/common/ulocimp.h index 98b95dddfe75bc..a686759f32e3e1 100644 --- a/deps/icu-small/source/common/ulocimp.h +++ b/deps/icu-small/source/common/ulocimp.h @@ -13,6 +13,8 @@ #include "unicode/bytestream.h" #include "unicode/uloc.h" +#include "charstr.h" + /** * Create an iterator over the specified keywords list * @param keywordList double-null terminated list. Will be copied. @@ -38,7 +40,7 @@ uloc_getTableStringWithFallback( int32_t *pLength, UErrorCode *pErrorCode); -/*returns TRUE if a is an ID separator FALSE otherwise*/ +/*returns true if a is an ID separator false otherwise*/ #define _isIDSeparator(a) (a == '_' || a == '-') U_CFUNC const char* @@ -47,42 +49,55 @@ uloc_getCurrentCountryID(const char* oldID); U_CFUNC const char* uloc_getCurrentLanguageID(const char* oldID); -U_CFUNC int32_t +U_CFUNC void +ulocimp_getKeywords(const char *localeID, + char prev, + icu::ByteSink& sink, + UBool valuesToo, + UErrorCode *status); + +icu::CharString U_EXPORT2 ulocimp_getLanguage(const char *localeID, - char *language, int32_t languageCapacity, - const char **pEnd); + const char **pEnd, + UErrorCode &status); -U_CFUNC int32_t +icu::CharString U_EXPORT2 ulocimp_getScript(const char *localeID, - char *script, int32_t scriptCapacity, - const char **pEnd); + const char **pEnd, + UErrorCode &status); -U_CFUNC int32_t +icu::CharString U_EXPORT2 ulocimp_getCountry(const char *localeID, - char *country, int32_t countryCapacity, - const char **pEnd); + const char **pEnd, + UErrorCode &status); -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ulocimp_getName(const char* localeID, icu::ByteSink& sink, UErrorCode* err); -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ulocimp_getBaseName(const char* localeID, icu::ByteSink& sink, UErrorCode* err); -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ulocimp_canonicalize(const char* localeID, icu::ByteSink& sink, UErrorCode* err); +U_CAPI void U_EXPORT2 +ulocimp_getKeywordValue(const char* localeID, + const char* keywordName, + icu::ByteSink& sink, + UErrorCode* status); + /** * Writes a well-formed language tag for this locale ID. * - * **Note**: When `strict` is FALSE, any locale fields which do not satisfy the + * **Note**: When `strict` is false, any locale fields which do not satisfy the * BCP47 syntax requirement will be omitted from the result. When `strict` is - * TRUE, this function sets U_ILLEGAL_ARGUMENT_ERROR to the `err` if any locale + * true, this function sets U_ILLEGAL_ARGUMENT_ERROR to the `err` if any locale * fields do not satisfy the BCP47 syntax requirement. * * @param localeID the input locale ID @@ -96,7 +111,7 @@ ulocimp_canonicalize(const char* localeID, * * @internal ICU 64 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ulocimp_toLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, @@ -107,13 +122,17 @@ ulocimp_toLanguageTag(const char* localeID, * If the specified language tag contains any ill-formed subtags, * the first such subtag and all following subtags are ignored. *

- * This implements the 'Language-Tag' production of BCP47, and so - * supports grandfathered (regular and irregular) as well as private - * use language tags. Private use tags are represented as 'x-whatever', - * and grandfathered tags are converted to their canonical replacements - * where they exist. Note that a few grandfathered tags have no modern - * replacement, these will be converted using the fallback described in + * This implements the 'Language-Tag' production of BCP 47, and so + * supports legacy language tags (marked as “Type: grandfathered” in BCP 47) + * (regular and irregular) as well as private use language tags. + * + * Private use tags are represented as 'x-whatever', + * and legacy tags are converted to their canonical replacements where they exist. + * + * Note that a few legacy tags have no modern replacement; + * these will be converted using the fallback described in * the first paragraph, so some information might be lost. + * * @param langtag the input BCP47 language tag. * @param tagLen the length of langtag, or -1 to call uprv_strlen(). * @param sink the output sink receiving a locale ID for the @@ -135,7 +154,7 @@ ulocimp_forLanguageTag(const char* langtag, * Get the region to use for supplemental data lookup. Uses * (1) any region specified by locale tag "rg"; if none then * (2) any unicode_region_tag in the locale ID; if none then - * (3) if inferRegion is TRUE, the region suggested by + * (3) if inferRegion is true, the region suggested by * getLikelySubtags on the localeID. * If no region is found, returns length 0. * @@ -143,7 +162,7 @@ ulocimp_forLanguageTag(const char* langtag, * The complete locale ID (with keywords) from which * to get the region to use for supplemental data. * @param inferRegion - * If TRUE, will try to infer region from localeID if + * If true, will try to infer region from localeID if * no other region is found. * @param region * Buffer in which to put the region ID found; should @@ -189,7 +208,7 @@ ulocimp_getRegionForSupplementalData(const char *localeID, UBool inferRegion, * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. * @internal ICU 64 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ulocimp_addLikelySubtags(const char* localeID, icu::ByteSink& sink, UErrorCode* err); @@ -223,7 +242,7 @@ ulocimp_addLikelySubtags(const char* localeID, * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. * @internal ICU 64 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ulocimp_minimizeSubtags(const char* localeID, icu::ByteSink& sink, UErrorCode* err); @@ -279,4 +298,10 @@ ulocimp_toBcpType(const char* key, const char* type, UBool* isKnownKey, UBool* i U_CFUNC const char* ulocimp_toLegacyType(const char* key, const char* type, UBool* isKnownKey, UBool* isSpecialType); +/* Function for testing purpose */ +U_CAPI const char* const* ulocimp_getKnownCanonicalizedLocaleForTest(int32_t* length); + +// Return true if the value is already canonicalized. +U_CAPI bool ulocimp_isCanonicalizedLocaleForTest(const char* localeName); + #endif diff --git a/deps/icu-small/source/common/umutex.h b/deps/icu-small/source/common/umutex.h index 7588bcc5d9aed6..57955353d0d6ff 100644 --- a/deps/icu-small/source/common/umutex.h +++ b/deps/icu-small/source/common/umutex.h @@ -262,13 +262,13 @@ class U_COMMON_API UMutex { * the global ICU mutex. Recursive locks are an error * and may cause a deadlock on some platforms. */ -U_INTERNAL void U_EXPORT2 umtx_lock(UMutex* mutex); +U_CAPI void U_EXPORT2 umtx_lock(UMutex* mutex); /* Unlock a mutex. * @param mutex The given mutex to be unlocked. Pass NULL to specify * the global ICU mutex. */ -U_INTERNAL void U_EXPORT2 umtx_unlock (UMutex* mutex); +U_CAPI void U_EXPORT2 umtx_unlock (UMutex* mutex); U_NAMESPACE_END diff --git a/deps/icu-small/source/common/unicode/appendable.h b/deps/icu-small/source/common/unicode/appendable.h index 4beacaf6583620..fc99254de14e58 100644 --- a/deps/icu-small/source/common/unicode/appendable.h +++ b/deps/icu-small/source/common/unicode/appendable.h @@ -45,7 +45,7 @@ class UnicodeString; * * The methods do not take UErrorCode parameters. * If an error occurs (e.g., out-of-memory), - * in addition to returning FALSE from failing operations, + * in addition to returning false from failing operations, * the implementation must prevent unexpected behavior (e.g., crashes) * from further calls and should make the error condition available separately * (e.g., store a UErrorCode, make/keep a UnicodeString bogus). @@ -62,7 +62,7 @@ class U_COMMON_API Appendable : public UObject { /** * Appends a 16-bit code unit. * @param c code unit - * @return TRUE if the operation succeeded + * @return true if the operation succeeded * @stable ICU 4.8 */ virtual UBool appendCodeUnit(char16_t c) = 0; @@ -71,7 +71,7 @@ class U_COMMON_API Appendable : public UObject { * Appends a code point. * The default implementation calls appendCodeUnit(char16_t) once or twice. * @param c code point 0..0x10ffff - * @return TRUE if the operation succeeded + * @return true if the operation succeeded * @stable ICU 4.8 */ virtual UBool appendCodePoint(UChar32 c); @@ -81,7 +81,7 @@ class U_COMMON_API Appendable : public UObject { * The default implementation calls appendCodeUnit(char16_t) for each code unit. * @param s string, must not be NULL if length!=0 * @param length string length, or -1 if NUL-terminated - * @return TRUE if the operation succeeded + * @return true if the operation succeeded * @stable ICU 4.8 */ virtual UBool appendString(const char16_t *s, int32_t length); @@ -90,9 +90,9 @@ class U_COMMON_API Appendable : public UObject { * Tells the object that the caller is going to append roughly * appendCapacity char16_ts. A subclass might use this to pre-allocate * a larger buffer if necessary. - * The default implementation does nothing. (It always returns TRUE.) + * The default implementation does nothing. (It always returns true.) * @param appendCapacity estimated number of char16_ts that will be appended - * @return TRUE if the operation succeeded + * @return true if the operation succeeded * @stable ICU 4.8 */ virtual UBool reserveAppendCapacity(int32_t appendCapacity); @@ -171,7 +171,7 @@ class U_COMMON_API UnicodeStringAppendable : public Appendable { /** * Appends a 16-bit code unit to the string. * @param c code unit - * @return TRUE if the operation succeeded + * @return true if the operation succeeded * @stable ICU 4.8 */ virtual UBool appendCodeUnit(char16_t c); @@ -179,7 +179,7 @@ class U_COMMON_API UnicodeStringAppendable : public Appendable { /** * Appends a code point to the string. * @param c code point 0..0x10ffff - * @return TRUE if the operation succeeded + * @return true if the operation succeeded * @stable ICU 4.8 */ virtual UBool appendCodePoint(UChar32 c); @@ -188,7 +188,7 @@ class U_COMMON_API UnicodeStringAppendable : public Appendable { * Appends a string to the UnicodeString. * @param s string, must not be NULL if length!=0 * @param length string length, or -1 if NUL-terminated - * @return TRUE if the operation succeeded + * @return true if the operation succeeded * @stable ICU 4.8 */ virtual UBool appendString(const char16_t *s, int32_t length); @@ -197,7 +197,7 @@ class U_COMMON_API UnicodeStringAppendable : public Appendable { * Tells the UnicodeString that the caller is going to append roughly * appendCapacity char16_ts. * @param appendCapacity estimated number of char16_ts that will be appended - * @return TRUE if the operation succeeded + * @return true if the operation succeeded * @stable ICU 4.8 */ virtual UBool reserveAppendCapacity(int32_t appendCapacity); diff --git a/deps/icu-small/source/common/unicode/brkiter.h b/deps/icu-small/source/common/unicode/brkiter.h index b944497345479b..9bba5fcccc319d 100644 --- a/deps/icu-small/source/common/unicode/brkiter.h +++ b/deps/icu-small/source/common/unicode/brkiter.h @@ -564,7 +564,7 @@ class U_COMMON_API BreakIterator : public UObject { * BreakIterator::createXXXInstance to avoid undefined behavior. * @param key the registry key returned by a previous call to registerInstance * @param status the in/out status code, no special meanings are assigned - * @return TRUE if the iterator for the key was successfully unregistered + * @return true if the iterator for the key was successfully unregistered * @stable ICU 2.4 */ static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status); @@ -655,7 +655,7 @@ class U_COMMON_API BreakIterator : public UObject { inline UBool BreakIterator::isBufferClone() { - return FALSE; + return false; } #endif /* U_HIDE_DEPRECATED_API */ diff --git a/deps/icu-small/source/common/unicode/bytestream.h b/deps/icu-small/source/common/unicode/bytestream.h index 33505a34299818..73d498397c744c 100644 --- a/deps/icu-small/source/common/unicode/bytestream.h +++ b/deps/icu-small/source/common/unicode/bytestream.h @@ -197,7 +197,7 @@ class U_COMMON_API CheckedArrayByteSink : public ByteSink { * Returns the sink to its original state, without modifying the buffer. * Useful for reusing both the buffer and the sink for multiple streams. * Resets the state to NumberOfBytesWritten()=NumberOfBytesAppended()=0 - * and Overflowed()=FALSE. + * and Overflowed()=false. * @return *this * @stable ICU 4.6 */ @@ -236,7 +236,7 @@ class U_COMMON_API CheckedArrayByteSink : public ByteSink { /** * Returns true if any bytes were discarded, i.e., if there was an * attempt to write more than 'capacity' bytes. - * @return TRUE if more than 'capacity' bytes were Append()ed + * @return true if more than 'capacity' bytes were Append()ed * @stable ICU 4.2 */ UBool Overflowed() const { return overflowed_; } diff --git a/deps/icu-small/source/common/unicode/bytestrie.h b/deps/icu-small/source/common/unicode/bytestrie.h index 51405f64a10e64..85f802df420262 100644 --- a/deps/icu-small/source/common/unicode/bytestrie.h +++ b/deps/icu-small/source/common/unicode/bytestrie.h @@ -97,14 +97,13 @@ class U_COMMON_API BytesTrie : public UMemory { return *this; } -#ifndef U_HIDE_DRAFT_API /** * Returns the state of this trie as a 64-bit integer. * The state value is never 0. * * @return opaque state value * @see resetToState64 - * @draft ICU 65 + * @stable ICU 65 */ uint64_t getState64() const { return (static_cast(remainingMatchLength_ + 2) << kState64RemainingShift) | @@ -123,14 +122,13 @@ class U_COMMON_API BytesTrie : public UMemory { * @see getState64 * @see resetToState * @see reset - * @draft ICU 65 + * @stable ICU 65 */ BytesTrie &resetToState64(uint64_t state) { remainingMatchLength_ = static_cast(state >> kState64RemainingShift) - 2; pos_ = bytes_ + (state & kState64PosMask); return *this; } -#endif /* U_HIDE_DRAFT_API */ /** * BytesTrie state object, for saving a trie's current state @@ -253,16 +251,16 @@ class U_COMMON_API BytesTrie : public UMemory { /** * Determines whether all byte sequences reachable from the current state * map to the same value. - * @param uniqueValue Receives the unique value, if this function returns TRUE. + * @param uniqueValue Receives the unique value, if this function returns true. * (output-only) - * @return TRUE if all byte sequences reachable from the current state + * @return true if all byte sequences reachable from the current state * map to the same value. * @stable ICU 4.8 */ inline UBool hasUniqueValue(int32_t &uniqueValue) const { const uint8_t *pos=pos_; // Skip the rest of a pending linear-match node. - return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, FALSE, uniqueValue); + return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, false, uniqueValue); } /** @@ -321,7 +319,7 @@ class U_COMMON_API BytesTrie : public UMemory { Iterator &reset(); /** - * @return TRUE if there are more elements. + * @return true if there are more elements. * @stable ICU 4.8 */ UBool hasNext() const; @@ -337,7 +335,7 @@ class U_COMMON_API BytesTrie : public UMemory { * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) - * @return TRUE if there is another element. + * @return true if there is another element. * @stable ICU 4.8 */ UBool next(UErrorCode &errorCode); diff --git a/deps/icu-small/source/common/unicode/bytestriebuilder.h b/deps/icu-small/source/common/unicode/bytestriebuilder.h index e58f18755ef959..eafe5a28c3ef05 100644 --- a/deps/icu-small/source/common/unicode/bytestriebuilder.h +++ b/deps/icu-small/source/common/unicode/bytestriebuilder.h @@ -101,9 +101,10 @@ class U_COMMON_API BytesTrieBuilder : public StringTrieBuilder { * Multiple calls to buildStringPiece() return StringPieces referring to the * builder's same byte array, without rebuilding. * If buildStringPiece() is called after build(), the trie will be - * re-serialized into a new array. - * If build() is called after buildStringPiece(), the trie object will become - * the owner of the previously returned array. + * re-serialized into a new array (because build() passes on ownership). + * If build() is called after buildStringPiece(), the trie object returned + * by build() will become the owner of the underlying string for the + * previously returned StringPiece. * After clear() has been called, a new array will be used as well. * @param buildOption Build option, see UStringTrieBuildOption. * @param errorCode Standard ICU error code. Its input value must @@ -139,7 +140,7 @@ class U_COMMON_API BytesTrieBuilder : public StringTrieBuilder { virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t byteIndex, int32_t count) const; virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, char16_t byte) const; - virtual UBool matchNodesCanHaveValues() const { return FALSE; } + virtual UBool matchNodesCanHaveValues() const { return false; } virtual int32_t getMaxBranchLinearSubNodeLength() const { return BytesTrie::kMaxBranchLinearSubNodeLength; } virtual int32_t getMinLinearMatch() const { return BytesTrie::kMinLinearMatch; } diff --git a/deps/icu-small/source/common/unicode/caniter.h b/deps/icu-small/source/common/unicode/caniter.h index 87c946c2b4db56..8ba4cc7daad3c1 100644 --- a/deps/icu-small/source/common/unicode/caniter.h +++ b/deps/icu-small/source/common/unicode/caniter.h @@ -25,11 +25,11 @@ */ /** Should permutation skip characters with combining class zero - * Should be either TRUE or FALSE. This is a compile time option + * Should be either true or false. This is a compile time option * @stable ICU 2.4 */ #ifndef CANITER_SKIP_ZEROES -#define CANITER_SKIP_ZEROES TRUE +#define CANITER_SKIP_ZEROES true #endif U_NAMESPACE_BEGIN diff --git a/deps/icu-small/source/common/unicode/chariter.h b/deps/icu-small/source/common/unicode/chariter.h index 7e4f446bb0f8a8..f7ecd8e0036ce2 100644 --- a/deps/icu-small/source/common/unicode/chariter.h +++ b/deps/icu-small/source/common/unicode/chariter.h @@ -65,7 +65,7 @@ U_NAMESPACE_BEGIN * check for the end of the iteration. When there are no more * characters in the text object: *

    - *
  • The hasNext() function returns FALSE.
  • + *
  • The hasNext() function returns false.
  • *
  • nextPostInc() and next32PostInc() return DONE * when one attempts to read beyond the end of the text object.
  • *
@@ -165,11 +165,11 @@ class U_COMMON_API ForwardCharacterIterator : public UObject { virtual UChar32 next32PostInc(void) = 0; /** - * Returns FALSE if there are no more code units or code points + * Returns false if there are no more code units or code points * at or after the current position in the iteration range. * This is used with nextPostInc() or next32PostInc() in forward * iteration. - * @returns FALSE if there are no more code units or code points + * @returns false if there are no more code units or code points * at or after the current position in the iteration range. * @stable ICU 2.0 */ @@ -535,12 +535,12 @@ class U_COMMON_API CharacterIterator : public ForwardCharacterIterator { virtual UChar32 previous32(void) = 0; /** - * Returns FALSE if there are no more code units or code points + * Returns false if there are no more code units or code points * before the current position in the iteration range. * This is used with previous() or previous32() in backward * iteration. - * @return FALSE if there are no more code units or code points - * before the current position in the iteration range, return TRUE otherwise. + * @return false if there are no more code units or code points + * before the current position in the iteration range, return true otherwise. * @stable ICU 2.0 */ virtual UBool hasPrevious() = 0; diff --git a/deps/icu-small/source/common/unicode/docmain.h b/deps/icu-small/source/common/unicode/docmain.h index 2b38692997dd9a..f09d7e1dc29cec 100644 --- a/deps/icu-small/source/common/unicode/docmain.h +++ b/deps/icu-small/source/common/unicode/docmain.h @@ -53,10 +53,10 @@ * *

Architecture (User's Guide)

* * *
@@ -149,7 +149,7 @@ * * * Number Range Formatting
(includes currency and unit ranges) - * (no C API) + * unumberrangeformatter.h * icu::number::NumberRangeFormatter * * diff --git a/deps/icu-small/source/common/unicode/dtintrv.h b/deps/icu-small/source/common/unicode/dtintrv.h index 325faa3ccb92cb..7932ea660fa4dd 100644 --- a/deps/icu-small/source/common/unicode/dtintrv.h +++ b/deps/icu-small/source/common/unicode/dtintrv.h @@ -106,14 +106,14 @@ class U_COMMON_API DateInterval : public UObject { /** * Equality operator. - * @return TRUE if the two DateIntervals are the same + * @return true if the two DateIntervals are the same * @stable ICU 4.0 */ virtual UBool operator==(const DateInterval& other) const; /** * Non-equality operator - * @return TRUE if the two DateIntervals are not the same + * @return true if the two DateIntervals are not the same * @stable ICU 4.0 */ inline UBool operator!=(const DateInterval& other) const; diff --git a/deps/icu-small/source/common/unicode/edits.h b/deps/icu-small/source/common/unicode/edits.h index c3ceaccb3b3802..bfa07fa6765b73 100644 --- a/deps/icu-small/source/common/unicode/edits.h +++ b/deps/icu-small/source/common/unicode/edits.h @@ -159,7 +159,7 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @param outErrorCode Set to an error code if it does not contain one already * and an error occurred while recording edits. * Otherwise unchanged. - * @return TRUE if U_FAILURE(outErrorCode) + * @return true if U_FAILURE(outErrorCode) * @stable ICU 59 */ UBool copyErrorTo(UErrorCode &outErrorCode) const; @@ -171,7 +171,7 @@ class U_COMMON_API Edits U_FINAL : public UMemory { */ int32_t lengthDelta() const { return delta; } /** - * @return TRUE if there are any change edits + * @return true if there are any change edits * @stable ICU 59 */ UBool hasChanges() const { return numChanges != 0; } @@ -207,8 +207,8 @@ class U_COMMON_API Edits U_FINAL : public UMemory { */ Iterator() : array(nullptr), index(0), length(0), - remaining(0), onlyChanges_(FALSE), coarse(FALSE), - dir(0), changed(FALSE), oldLength_(0), newLength_(0), + remaining(0), onlyChanges_(false), coarse(false), + dir(0), changed(false), oldLength_(0), newLength_(0), srcIndex(0), replIndex(0), destIndex(0) {} /** * Copy constructor. @@ -226,7 +226,7 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) - * @return TRUE if there is another edit + * @return true if there is another edit * @stable ICU 59 */ UBool next(UErrorCode &errorCode) { return next(onlyChanges_, errorCode); } @@ -247,11 +247,11 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) - * @return TRUE if the edit for the source index was found + * @return true if the edit for the source index was found * @stable ICU 59 */ UBool findSourceIndex(int32_t i, UErrorCode &errorCode) { - return findIndex(i, TRUE, errorCode) == 0; + return findIndex(i, true, errorCode) == 0; } /** @@ -270,11 +270,11 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) - * @return TRUE if the edit for the destination index was found + * @return true if the edit for the destination index was found * @stable ICU 60 */ UBool findDestinationIndex(int32_t i, UErrorCode &errorCode) { - return findIndex(i, FALSE, errorCode) == 0; + return findIndex(i, false, errorCode) == 0; } /** @@ -328,8 +328,8 @@ class U_COMMON_API Edits U_FINAL : public UMemory { /** * Returns whether the edit currently represented by the iterator is a change edit. * - * @return TRUE if this edit replaces oldLength() units with newLength() different ones. - * FALSE if oldLength units remain unchanged. + * @return true if this edit replaces oldLength() units with newLength() different ones. + * false if oldLength units remain unchanged. * @stable ICU 59 */ UBool hasChange() const { return changed; } @@ -347,8 +347,8 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * {@link #destinationIndex}, or in the replacement string, which starts at * {@link #replacementIndex}. * - * @return the number of units in the modified string, if hasChange() is TRUE. - * Same as oldLength if hasChange() is FALSE. + * @return the number of units in the modified string, if hasChange() is true. + * Same as oldLength if hasChange() is false. * @stable ICU 59 */ int32_t newLength() const { return newLength_; } @@ -436,7 +436,7 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @stable ICU 59 */ Iterator getCoarseChangesIterator() const { - return Iterator(array, length, TRUE, TRUE); + return Iterator(array, length, true, true); } /** @@ -448,7 +448,7 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @stable ICU 59 */ Iterator getCoarseIterator() const { - return Iterator(array, length, FALSE, TRUE); + return Iterator(array, length, false, true); } /** @@ -460,7 +460,7 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @stable ICU 59 */ Iterator getFineChangesIterator() const { - return Iterator(array, length, TRUE, FALSE); + return Iterator(array, length, true, false); } /** @@ -471,7 +471,7 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @stable ICU 59 */ Iterator getFineIterator() const { - return Iterator(array, length, FALSE, FALSE); + return Iterator(array, length, false, false); } /** diff --git a/deps/icu-small/source/common/unicode/filteredbrk.h b/deps/icu-small/source/common/unicode/filteredbrk.h index 42936763259e2d..8b07e39ae12bb6 100644 --- a/deps/icu-small/source/common/unicode/filteredbrk.h +++ b/deps/icu-small/source/common/unicode/filteredbrk.h @@ -85,8 +85,8 @@ class U_COMMON_API FilteredBreakIteratorBuilder : public UObject { * by the iterator. * @param string the string to suppress, such as "Mr." * @param status error code - * @return returns TRUE if the string was not present and now added, - * FALSE if the call was a no-op because the string was already being suppressed. + * @return returns true if the string was not present and now added, + * false if the call was a no-op because the string was already being suppressed. * @stable ICU 56 */ virtual UBool suppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0; @@ -98,8 +98,8 @@ class U_COMMON_API FilteredBreakIteratorBuilder : public UObject { * locale data which may be suppressing certain strings. * @param string the exception to remove * @param status error code - * @return returns TRUE if the string was present and now removed, - * FALSE if the call was a no-op because the string was not being suppressed. + * @return returns true if the string was present and now removed, + * false if the call was a no-op because the string was not being suppressed. * @stable ICU 56 */ virtual UBool unsuppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0; diff --git a/deps/icu-small/source/common/unicode/icudataver.h b/deps/icu-small/source/common/unicode/icudataver.h index d5c728da880f8f..a82cb3d89d9d99 100644 --- a/deps/icu-small/source/common/unicode/icudataver.h +++ b/deps/icu-small/source/common/unicode/icudataver.h @@ -38,6 +38,6 @@ * * @stable ICU 49 */ -U_STABLE void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status); +U_CAPI void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status); #endif diff --git a/deps/icu-small/source/common/unicode/icuplug.h b/deps/icu-small/source/common/unicode/icuplug.h index 827cbe94b61cf8..2bd51ff8dfc050 100644 --- a/deps/icu-small/source/common/unicode/icuplug.h +++ b/deps/icu-small/source/common/unicode/icuplug.h @@ -208,7 +208,7 @@ typedef UPlugTokenReturn (U_EXPORT2 UPlugEntrypoint) ( * @param dontUnload set true if this plugin can't be unloaded * @internal ICU 4.4 Technology Preview */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload); /** @@ -217,7 +217,7 @@ uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload); * @param level the level of this plugin * @internal ICU 4.4 Technology Preview */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uplug_setPlugLevel(UPlugData *plug, UPlugLevel level); /** @@ -226,7 +226,7 @@ uplug_setPlugLevel(UPlugData *plug, UPlugLevel level); * @return the level of this plugin * @internal ICU 4.4 Technology Preview */ -U_INTERNAL UPlugLevel U_EXPORT2 +U_CAPI UPlugLevel U_EXPORT2 uplug_getPlugLevel(UPlugData *plug); /** @@ -236,7 +236,7 @@ uplug_getPlugLevel(UPlugData *plug); * @return the lowest level of plug which can currently load * @internal ICU 4.4 Technology Preview */ -U_INTERNAL UPlugLevel U_EXPORT2 +U_CAPI UPlugLevel U_EXPORT2 uplug_getCurrentLevel(void); @@ -245,7 +245,7 @@ uplug_getCurrentLevel(void); * @return The error code of this plugin's load attempt. * @internal ICU 4.4 Technology Preview */ -U_INTERNAL UErrorCode U_EXPORT2 +U_CAPI UErrorCode U_EXPORT2 uplug_getPlugLoadStatus(UPlugData *plug); /** @@ -254,7 +254,7 @@ uplug_getPlugLoadStatus(UPlugData *plug); * @param name the name of this plugin. The first UPLUG_NAME_MAX characters willi be copied into a new buffer. * @internal ICU 4.4 Technology Preview */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uplug_setPlugName(UPlugData *plug, const char *name); /** @@ -263,7 +263,7 @@ uplug_setPlugName(UPlugData *plug, const char *name); * @return the name of this plugin * @internal ICU 4.4 Technology Preview */ -U_INTERNAL const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 uplug_getPlugName(UPlugData *plug); /** @@ -272,7 +272,7 @@ uplug_getPlugName(UPlugData *plug); * @return the symbol name, or NULL * @internal ICU 4.4 Technology Preview */ -U_INTERNAL const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 uplug_getSymbolName(UPlugData *plug); /** @@ -282,7 +282,7 @@ uplug_getSymbolName(UPlugData *plug); * @return the library name, or NULL * @internal ICU 4.4 Technology Preview */ -U_INTERNAL const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 uplug_getLibraryName(UPlugData *plug, UErrorCode *status); /** @@ -292,7 +292,7 @@ uplug_getLibraryName(UPlugData *plug, UErrorCode *status); * @return the library, or NULL * @internal ICU 4.4 Technology Preview */ -U_INTERNAL void * U_EXPORT2 +U_CAPI void * U_EXPORT2 uplug_getLibrary(UPlugData *plug); /** @@ -301,7 +301,7 @@ uplug_getLibrary(UPlugData *plug); * @return the context, or NULL if not set * @internal ICU 4.4 Technology Preview */ -U_INTERNAL void * U_EXPORT2 +U_CAPI void * U_EXPORT2 uplug_getContext(UPlugData *plug); /** @@ -310,7 +310,7 @@ uplug_getContext(UPlugData *plug); * @param context new context to set * @internal ICU 4.4 Technology Preview */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uplug_setContext(UPlugData *plug, void *context); @@ -321,7 +321,7 @@ uplug_setContext(UPlugData *plug, void *context); * @return configuration string, or else null. * @internal ICU 4.4 Technology Preview */ -U_INTERNAL const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 uplug_getConfiguration(UPlugData *plug); /** @@ -339,7 +339,7 @@ uplug_getConfiguration(UPlugData *plug); * @return the next oldest plugin, or NULL if no more. * @internal ICU 4.4 Technology Preview */ -U_INTERNAL UPlugData* U_EXPORT2 +U_CAPI UPlugData* U_EXPORT2 uplug_nextPlug(UPlugData *prior); /** @@ -354,7 +354,7 @@ uplug_nextPlug(UPlugData *prior); * @return the new UPlugData associated with this plugin, or NULL if error. * @internal ICU 4.4 Technology Preview */ -U_INTERNAL UPlugData* U_EXPORT2 +U_CAPI UPlugData* U_EXPORT2 uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status); @@ -368,7 +368,7 @@ uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UE * @return the new UPlugData associated with this plugin, or NULL if error. * @internal ICU 4.4 Technology Preview */ -U_INTERNAL UPlugData* U_EXPORT2 +U_CAPI UPlugData* U_EXPORT2 uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status); /** @@ -378,7 +378,7 @@ uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *conf * @param status error result * @internal ICU 4.4 Technology Preview */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uplug_removePlug(UPlugData *plug, UErrorCode *status); #endif /* U_HIDE_INTERNAL_API */ diff --git a/deps/icu-small/source/common/unicode/idna.h b/deps/icu-small/source/common/unicode/idna.h index 6dfcfe48db28f1..1305dc604842eb 100644 --- a/deps/icu-small/source/common/unicode/idna.h +++ b/deps/icu-small/source/common/unicode/idna.h @@ -95,7 +95,7 @@ class U_COMMON_API IDNA : public UObject { /** * Converts a single domain name label into its ASCII form for DNS lookup. - * If any processing step fails, then info.hasErrors() will be TRUE and + * If any processing step fails, then info.hasErrors() will be true and * the result might not be an ASCII string. * The label might be modified according to the types of errors. * Labels with severe errors will be left in (or turned into) their Unicode form. @@ -119,7 +119,7 @@ class U_COMMON_API IDNA : public UObject { /** * Converts a single domain name label into its Unicode form for human-readable display. - * If any processing step fails, then info.hasErrors() will be TRUE. + * If any processing step fails, then info.hasErrors() will be true. * The label might be modified according to the types of errors. * * The UErrorCode indicates an error only in exceptional cases, @@ -141,7 +141,7 @@ class U_COMMON_API IDNA : public UObject { /** * Converts a whole domain name into its ASCII form for DNS lookup. - * If any processing step fails, then info.hasErrors() will be TRUE and + * If any processing step fails, then info.hasErrors() will be true and * the result might not be an ASCII string. * The domain name might be modified according to the types of errors. * Labels with severe errors will be left in (or turned into) their Unicode form. @@ -165,7 +165,7 @@ class U_COMMON_API IDNA : public UObject { /** * Converts a whole domain name into its Unicode form for human-readable display. - * If any processing step fails, then info.hasErrors() will be TRUE. + * If any processing step fails, then info.hasErrors() will be true. * The domain name might be modified according to the types of errors. * * The UErrorCode indicates an error only in exceptional cases, @@ -273,10 +273,10 @@ class U_COMMON_API IDNAInfo : public UMemory { * Constructor for stack allocation. * @stable ICU 4.6 */ - IDNAInfo() : errors(0), labelErrors(0), isTransDiff(FALSE), isBiDi(FALSE), isOkBiDi(TRUE) {} + IDNAInfo() : errors(0), labelErrors(0), isTransDiff(false), isBiDi(false), isOkBiDi(true) {} /** * Were there IDNA processing errors? - * @return TRUE if there were processing errors + * @return true if there were processing errors * @stable ICU 4.6 */ UBool hasErrors() const { return errors!=0; } @@ -288,7 +288,7 @@ class U_COMMON_API IDNAInfo : public UMemory { */ uint32_t getErrors() const { return errors; } /** - * Returns TRUE if transitional and nontransitional processing produce different results. + * Returns true if transitional and nontransitional processing produce different results. * This is the case when the input label or domain name contains * one or more deviation characters outside a Punycode label (see UTS #46). *
    @@ -297,7 +297,7 @@ class U_COMMON_API IDNAInfo : public UMemory { *
  • With transitional processing, such characters are * mapped (sharp s/sigma) or removed (joiner/nonjoiner). *
- * @return TRUE if transitional and nontransitional processing produce different results + * @return true if transitional and nontransitional processing produce different results * @stable ICU 4.6 */ UBool isTransitionalDifferent() const { return isTransDiff; } @@ -310,9 +310,9 @@ class U_COMMON_API IDNAInfo : public UMemory { void reset() { errors=labelErrors=0; - isTransDiff=FALSE; - isBiDi=FALSE; - isOkBiDi=TRUE; + isTransDiff=false; + isBiDi=false; + isOkBiDi=true; } uint32_t errors, labelErrors; diff --git a/deps/icu-small/source/common/unicode/localebuilder.h b/deps/icu-small/source/common/unicode/localebuilder.h index c5836fe27021b3..27a894de101def 100644 --- a/deps/icu-small/source/common/unicode/localebuilder.h +++ b/deps/icu-small/source/common/unicode/localebuilder.h @@ -1,5 +1,5 @@ // © 2018 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html #ifndef __LOCALEBUILDER_H__ #define __LOCALEBUILDER_H__ @@ -92,11 +92,12 @@ class U_COMMON_API LocaleBuilder : public UObject { /** * Resets the LocaleBuilder to match the provided * [Unicode Locale Identifier](http://www.unicode.org/reports/tr35/tr35.html#unicode_locale_id) . - * Discards the existing state. the empty string cause the builder to be - * reset, like {@link #clear}. Grandfathered tags are converted to their - * canonical form before being processed. Otherwise, the language - * tag must be well-formed, or else the build() method will later - * report an U_ILLEGAL_ARGUMENT_ERROR. + * Discards the existing state. + * The empty string causes the builder to be reset, like {@link #clear}. + * Legacy language tags (marked as “Type: grandfathered” in BCP 47) + * are converted to their canonical form before being processed. + * Otherwise, the language tag must be well-formed, + * or else the build() method will later report an U_ILLEGAL_ARGUMENT_ERROR. * *

This method clears the internal UErrorCode. * @@ -278,18 +279,16 @@ class U_COMMON_API LocaleBuilder : public UObject { */ Locale build(UErrorCode& status); -#ifndef U_HIDE_DRAFT_API /** * Sets the UErrorCode if an error occurred while recording sets. * Preserves older error codes in the outErrorCode. * @param outErrorCode Set to an error code that occurred while setting subtags. * Unchanged if there is no such error or if outErrorCode * already contained an error. - * @return TRUE if U_FAILURE(outErrorCode) - * @draft ICU 65 + * @return true if U_FAILURE(outErrorCode) + * @stable ICU 65 */ UBool copyErrorTo(UErrorCode &outErrorCode) const; -#endif /* U_HIDE_DRAFT_API */ private: friend class LocaleMatcher::Result; diff --git a/deps/icu-small/source/common/unicode/localematcher.h b/deps/icu-small/source/common/unicode/localematcher.h index 2e1a7a349f3983..63a68b0b7fb3d3 100644 --- a/deps/icu-small/source/common/unicode/localematcher.h +++ b/deps/icu-small/source/common/unicode/localematcher.h @@ -1,5 +1,5 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // localematcher.h // created: 2019may08 Markus W. Scherer @@ -20,26 +20,24 @@ * \brief C++ API: Locale matcher: User's desired locales vs. application's supported locales. */ -#ifndef U_FORCE_HIDE_DRAFT_API - /** * Builder option for whether the language subtag or the script subtag is most important. * - * @see Builder#setFavorSubtag(ULocMatchFavorSubtag) - * @draft ICU 65 + * @see LocaleMatcher::Builder#setFavorSubtag(ULocMatchFavorSubtag) + * @stable ICU 65 */ enum ULocMatchFavorSubtag { /** * Language differences are most important, then script differences, then region differences. * (This is the default behavior.) * - * @draft ICU 65 + * @stable ICU 65 */ ULOCMATCH_FAVOR_LANGUAGE, /** * Makes script differences matter relatively more than language differences. * - * @draft ICU 65 + * @stable ICU 65 */ ULOCMATCH_FAVOR_SCRIPT }; @@ -51,14 +49,14 @@ typedef enum ULocMatchFavorSubtag ULocMatchFavorSubtag; * Builder option for whether all desired locales are treated equally or * earlier ones are preferred. * - * @see Builder#setDemotionPerDesiredLocale(ULocMatchDemotion) - * @draft ICU 65 + * @see LocaleMatcher::Builder#setDemotionPerDesiredLocale(ULocMatchDemotion) + * @stable ICU 65 */ enum ULocMatchDemotion { /** * All desired locales are treated equally. * - * @draft ICU 65 + * @stable ICU 65 */ ULOCMATCH_DEMOTION_NONE, /** @@ -85,7 +83,7 @@ enum ULocMatchDemotion { * this is possible in future versions of the data.) * * - * @draft ICU 65 + * @stable ICU 65 */ ULOCMATCH_DEMOTION_REGION }; @@ -93,6 +91,8 @@ enum ULocMatchDemotion { typedef enum ULocMatchDemotion ULocMatchDemotion; #endif +#ifndef U_FORCE_HIDE_DRAFT_API + /** * Builder option for whether to include or ignore one-way (fallback) match data. * The LocaleMatcher uses CLDR languageMatch data which includes fallback (oneway=true) entries. @@ -107,7 +107,7 @@ typedef enum ULocMatchDemotion ULocMatchDemotion; * if there is a decent match for the original UI language, we want to use it, * but not if it is merely a fallback. * - * @see Builder#setDirection(ULocMatchDirection) + * @see LocaleMatcher::Builder#setDirection(ULocMatchDirection) * @draft ICU 67 */ enum ULocMatchDirection { @@ -129,6 +129,8 @@ enum ULocMatchDirection { typedef enum ULocMatchDirection ULocMatchDirection; #endif +#endif // U_FORCE_HIDE_DRAFT_API + struct UHashtable; U_NAMESPACE_BEGIN @@ -181,7 +183,7 @@ class XLikelySubtags; * *

This class is not intended for public subclassing. * - * @draft ICU 65 + * @stable ICU 65 */ class U_COMMON_API LocaleMatcher : public UMemory { public: @@ -189,7 +191,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * Data for the best-matching pair of a desired and a supported locale. * Movable but not copyable. * - * @draft ICU 65 + * @stable ICU 65 */ class U_COMMON_API Result : public UMemory { public: @@ -198,14 +200,14 @@ class U_COMMON_API LocaleMatcher : public UMemory { * This object will have the same contents that the source object had. * * @param src Result to move contents from. - * @draft ICU 65 + * @stable ICU 65 */ Result(Result &&src) U_NOEXCEPT; /** * Destructor. * - * @draft ICU 65 + * @stable ICU 65 */ ~Result(); @@ -214,28 +216,27 @@ class U_COMMON_API LocaleMatcher : public UMemory { * This object will have the same contents that the source object had. * * @param src Result to move contents from. - * @draft ICU 65 + * @stable ICU 65 */ Result &operator=(Result &&src) U_NOEXCEPT; -#ifndef U_HIDE_DRAFT_API /** * Returns the best-matching desired locale. * nullptr if the list of desired locales is empty or if none matched well enough. * * @return the best-matching desired locale, or nullptr. - * @draft ICU 65 + * @stable ICU 65 */ inline const Locale *getDesiredLocale() const { return desiredLocale; } /** * Returns the best-matching supported locale. * If none matched well enough, this is the default locale. - * The default locale is nullptr if the list of supported locales is empty and - * no explicit default locale is set. + * The default locale is nullptr if Builder::setNoDefaultLocale() was called, + * or if the list of supported locales is empty and no explicit default locale is set. * * @return the best-matching supported locale, or nullptr. - * @draft ICU 65 + * @stable ICU 65 */ inline const Locale *getSupportedLocale() const { return supportedLocale; } @@ -244,7 +245,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * -1 if the list of desired locales is empty or if none matched well enough. * * @return the index of the best-matching desired locale, or -1. - * @draft ICU 65 + * @stable ICU 65 */ inline int32_t getDesiredIndex() const { return desiredIndex; } @@ -256,7 +257,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * -1 if the list of supported locales is empty or if none matched well enough. * * @return the index of the best-matching supported locale, or -1. - * @draft ICU 65 + * @stable ICU 65 */ inline int32_t getSupportedIndex() const { return supportedIndex; } @@ -270,10 +271,9 @@ class U_COMMON_API LocaleMatcher : public UMemory { *

Example: desired=ar-SA-u-nu-latn, supported=ar-EG, resolved locale=ar-SA-u-nu-latn * * @return a locale combining the best-matching desired and supported locales. - * @draft ICU 65 + * @stable ICU 65 */ Locale makeResolvedLocale(UErrorCode &errorCode) const; -#endif // U_HIDE_DRAFT_API private: Result(const Locale *desired, const Locale *supported, @@ -298,8 +298,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * LocaleMatcher builder. * Movable but not copyable. * - * @see LocaleMatcher#builder() - * @draft ICU 65 + * @stable ICU 65 */ class U_COMMON_API Builder : public UMemory { public: @@ -307,7 +306,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * Constructs a builder used in chaining parameters for building a LocaleMatcher. * * @return a new Builder object - * @draft ICU 65 + * @stable ICU 65 */ Builder() {} @@ -316,14 +315,14 @@ class U_COMMON_API LocaleMatcher : public UMemory { * This builder will have the same contents that the source builder had. * * @param src Builder to move contents from. - * @draft ICU 65 + * @stable ICU 65 */ Builder(Builder &&src) U_NOEXCEPT; /** * Destructor. * - * @draft ICU 65 + * @stable ICU 65 */ ~Builder(); @@ -332,11 +331,10 @@ class U_COMMON_API LocaleMatcher : public UMemory { * This builder will have the same contents that the source builder had. * * @param src Builder to move contents from. - * @draft ICU 65 + * @stable ICU 65 */ Builder &operator=(Builder &&src) U_NOEXCEPT; -#ifndef U_HIDE_DRAFT_API /** * Parses an Accept-Language string * (RFC 2616 Section 14.4), @@ -346,7 +344,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * * @param locales the Accept-Language string of locales to set * @return this Builder object - * @draft ICU 65 + * @stable ICU 65 */ Builder &setSupportedLocalesFromListString(StringPiece locales); @@ -357,7 +355,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * * @param locales the list of locale * @return this Builder object - * @draft ICU 65 + * @stable ICU 65 */ Builder &setSupportedLocales(Locale::Iterator &locales); @@ -372,7 +370,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * @param begin Start of range. * @param end Exclusive end of range. * @return this Builder object - * @draft ICU 65 + * @stable ICU 65 */ template Builder &setSupportedLocales(Iter begin, Iter end) { @@ -397,7 +395,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * @param end Exclusive end of range. * @param converter Converter from *begin to const Locale & or compatible. * @return this Builder object - * @draft ICU 65 + * @stable ICU 65 */ template Builder &setSupportedLocalesViaConverter(Iter begin, Iter end, Conv converter) { @@ -415,17 +413,31 @@ class U_COMMON_API LocaleMatcher : public UMemory { * * @param locale another locale * @return this Builder object - * @draft ICU 65 + * @stable ICU 65 */ Builder &addSupportedLocale(const Locale &locale); +#ifndef U_HIDE_DRAFT_API + /** + * Sets no default locale. + * There will be no explicit or implicit default locale. + * If there is no good match, then the matcher will return nullptr for the + * best supported locale. + * + * @draft ICU 68 + */ + Builder &setNoDefaultLocale(); +#endif // U_HIDE_DRAFT_API + /** * Sets the default locale; if nullptr, or if it is not set explicitly, * then the first supported locale is used as the default locale. + * There is no default locale at all (nullptr will be returned instead) + * if setNoDefaultLocale() is called. * * @param defaultLocale the default locale (will be copied) * @return this Builder object - * @draft ICU 65 + * @stable ICU 65 */ Builder &setDefaultLocale(const Locale *defaultLocale); @@ -437,7 +449,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * * @param subtag the subtag to favor * @return this Builder object - * @draft ICU 65 + * @stable ICU 65 */ Builder &setFavorSubtag(ULocMatchFavorSubtag subtag); @@ -447,10 +459,11 @@ class U_COMMON_API LocaleMatcher : public UMemory { * * @param demotion the demotion per desired locale to set. * @return this Builder object - * @draft ICU 65 + * @stable ICU 65 */ Builder &setDemotionPerDesiredLocale(ULocMatchDemotion demotion); +#ifndef U_HIDE_DRAFT_API /** * Option for whether to include or ignore one-way (fallback) match data. * By default, they are included. @@ -465,6 +478,32 @@ class U_COMMON_API LocaleMatcher : public UMemory { } return *this; } +#endif // U_HIDE_DRAFT_API + +#ifndef U_HIDE_DRAFT_API + /** + * Sets the maximum distance for an acceptable match. + * The matcher will return a match for a pair of locales only if + * they match at least as well as the pair given here. + * + * For example, setMaxDistance(en-US, en-GB) limits matches to ones where the + * (desired, support) locales have a distance no greater than a region subtag difference. + * This is much stricter than the CLDR default. + * + * The details of locale matching are subject to changes in + * CLDR data and in the algorithm. + * Specifying a maximum distance in relative terms via a sample pair of locales + * insulates from changes that affect all distance metrics similarly, + * but some changes will necessarily affect relative distances between + * different pairs of locales. + * + * @param desired the desired locale for distance comparison. + * @param supported the supported locale for distance comparison. + * @return this Builder object + * @draft ICU 68 + */ + Builder &setMaxDistance(const Locale &desired, const Locale &supported); +#endif // U_HIDE_DRAFT_API /** * Sets the UErrorCode if an error occurred while setting parameters. @@ -473,8 +512,8 @@ class U_COMMON_API LocaleMatcher : public UMemory { * @param outErrorCode Set to an error code if it does not contain one already * and an error occurred while setting parameters. * Otherwise unchanged. - * @return TRUE if U_FAILURE(outErrorCode) - * @draft ICU 65 + * @return true if U_FAILURE(outErrorCode) + * @stable ICU 65 */ UBool copyErrorTo(UErrorCode &outErrorCode) const; @@ -485,11 +524,10 @@ class U_COMMON_API LocaleMatcher : public UMemory { * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) - * @return new LocaleMatcher. - * @draft ICU 65 + * @return LocaleMatcher + * @stable ICU 65 */ LocaleMatcher build(UErrorCode &errorCode) const; -#endif // U_HIDE_DRAFT_API private: friend class LocaleMatcher; @@ -505,8 +543,11 @@ class U_COMMON_API LocaleMatcher : public UMemory { int32_t thresholdDistance_ = -1; ULocMatchDemotion demotion_ = ULOCMATCH_DEMOTION_REGION; Locale *defaultLocale_ = nullptr; + bool withDefault_ = true; ULocMatchFavorSubtag favor_ = ULOCMATCH_FAVOR_LANGUAGE; ULocMatchDirection direction_ = ULOCMATCH_DIRECTION_WITH_ONE_WAY; + Locale *maxDistanceDesired_ = nullptr; + Locale *maxDistanceSupported_ = nullptr; }; // FYI No public LocaleMatcher constructors in C++; use the Builder. @@ -515,13 +556,13 @@ class U_COMMON_API LocaleMatcher : public UMemory { * Move copy constructor; might modify the source. * This matcher will have the same settings that the source matcher had. * @param src source matcher - * @draft ICU 65 + * @stable ICU 65 */ LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT; /** * Destructor. - * @draft ICU 65 + * @stable ICU 65 */ ~LocaleMatcher(); @@ -531,11 +572,10 @@ class U_COMMON_API LocaleMatcher : public UMemory { * The behavior is undefined if *this and src are the same object. * @param src source matcher * @return *this - * @draft ICU 65 + * @stable ICU 65 */ LocaleMatcher &operator=(LocaleMatcher &&src) U_NOEXCEPT; -#ifndef U_HIDE_DRAFT_API /** * Returns the supported locale which best matches the desired locale. * @@ -544,7 +584,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) * @return the best-matching supported locale. - * @draft ICU 65 + * @stable ICU 65 */ const Locale *getBestMatch(const Locale &desiredLocale, UErrorCode &errorCode) const; @@ -556,7 +596,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) * @return the best-matching supported locale. - * @draft ICU 65 + * @stable ICU 65 */ const Locale *getBestMatch(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const; @@ -572,7 +612,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) * @return the best-matching supported locale. - * @draft ICU 65 + * @stable ICU 65 */ const Locale *getBestMatchForListString(StringPiece desiredLocaleList, UErrorCode &errorCode) const; @@ -586,7 +626,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) * @return the best-matching pair of the desired and a supported locale. - * @draft ICU 65 + * @stable ICU 65 */ Result getBestMatchResult(const Locale &desiredLocale, UErrorCode &errorCode) const; @@ -600,9 +640,25 @@ class U_COMMON_API LocaleMatcher : public UMemory { * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) * @return the best-matching pair of a desired and a supported locale. - * @draft ICU 65 + * @stable ICU 65 */ Result getBestMatchResult(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const; + +#ifndef U_HIDE_DRAFT_API + /** + * Returns true if the pair of locales matches acceptably. + * This is influenced by Builder options such as setDirection(), setFavorSubtag(), + * and setMaxDistance(). + * + * @param desired The desired locale. + * @param supported The supported locale. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return true if the pair of locales matches acceptably. + * @draft ICU 68 + */ + UBool isMatch(const Locale &desired, const Locale &supported, UErrorCode &errorCode) const; #endif // U_HIDE_DRAFT_API #ifndef U_HIDE_INTERNAL_API @@ -660,6 +716,5 @@ class U_COMMON_API LocaleMatcher : public UMemory { U_NAMESPACE_END -#endif // U_FORCE_HIDE_DRAFT_API #endif // U_SHOW_CPLUSPLUS_API #endif // __LOCALEMATCHER_H__ diff --git a/deps/icu-small/source/common/unicode/localpointer.h b/deps/icu-small/source/common/unicode/localpointer.h index 61c3020918e578..2a65f2d382d2d8 100644 --- a/deps/icu-small/source/common/unicode/localpointer.h +++ b/deps/icu-small/source/common/unicode/localpointer.h @@ -88,13 +88,13 @@ class LocalPointerBase { ~LocalPointerBase() { /* delete ptr; */ } /** * NULL check. - * @return TRUE if ==NULL + * @return true if ==NULL * @stable ICU 4.4 */ UBool isNull() const { return ptr==NULL; } /** * NULL check. - * @return TRUE if !=NULL + * @return true if !=NULL * @stable ICU 4.4 */ UBool isValid() const { return ptr!=NULL; } diff --git a/deps/icu-small/source/common/unicode/locid.h b/deps/icu-small/source/common/unicode/locid.h index ee8697b0a57f3e..877c8014b0b3a7 100644 --- a/deps/icu-small/source/common/unicode/locid.h +++ b/deps/icu-small/source/common/unicode/locid.h @@ -253,7 +253,7 @@ class U_COMMON_API Locale : public UObject { /** * Construct a locale from language, country, variant. * If an error occurs, then the constructed object will be "bogus" - * (isBogus() will return TRUE). + * (isBogus() will return true). * * @param language Lowercase two-letter or three-letter ISO-639 code. * This parameter can instead be an ICU style C locale (e.g. "en_US"), @@ -393,13 +393,17 @@ class U_COMMON_API Locale : public UObject { * If the specified language tag contains any ill-formed subtags, * the first such subtag and all following subtags are ignored. *

- * This implements the 'Language-Tag' production of BCP47, and so - * supports grandfathered (regular and irregular) as well as private - * use language tags. Private use tags are represented as 'x-whatever', - * and grandfathered tags are converted to their canonical replacements - * where they exist. Note that a few grandfathered tags have no modern - * replacement, these will be converted using the fallback described in + * This implements the 'Language-Tag' production of BCP 47, and so + * supports legacy language tags (marked as “Type: grandfathered” in BCP 47) + * (regular and irregular) as well as private use language tags. + * + * Private use tags are represented as 'x-whatever', + * and legacy tags are converted to their canonical replacements where they exist. + * + * Note that a few legacy tags have no modern replacement; + * these will be converted using the fallback described in * the first paragraph, so some information might be lost. + * * @param tag the input BCP47 language tag. * @param status error information if creating the Locale failed. * @return the Locale for the specified BCP47 language tag. @@ -795,14 +799,14 @@ class U_COMMON_API Locale : public UObject { /** * Returns whether this locale's script is written right-to-left. * If there is no script subtag, then the likely script is used, see uloc_addLikelySubtags(). - * If no likely script is known, then FALSE is returned. + * If no likely script is known, then false is returned. * * A script is right-to-left according to the CLDR script metadata * which corresponds to whether the script's letters have Bidi_Class=R or AL. * - * Returns TRUE for "ar" and "en-Hebr", FALSE for "zh" and "fa-Cyrl". + * Returns true for "ar" and "en-Hebr", false for "zh" and "fa-Cyrl". * - * @return TRUE if the locale's script is written right-to-left + * @return true if the locale's script is written right-to-left * @stable ICU 54 */ UBool isRightToLeft() const; @@ -956,7 +960,7 @@ class U_COMMON_API Locale : public UObject { /** * Gets the bogus state. Locale object can be bogus if it doesn't exist - * @return FALSE if it is a real locale, TRUE if it is a bogus locale + * @return false if it is a real locale, true if it is a bogus locale * @stable ICU 2.1 */ inline UBool isBogus(void) const; @@ -1005,32 +1009,31 @@ class U_COMMON_API Locale : public UObject { */ virtual UClassID getDynamicClassID() const; -#ifndef U_HIDE_DRAFT_API /** * A Locale iterator interface similar to a Java Iterator. - * @draft ICU 65 + * @stable ICU 65 */ class U_COMMON_API Iterator /* not : public UObject because this is an interface/mixin class */ { public: - /** @draft ICU 65 */ + /** @stable ICU 65 */ virtual ~Iterator(); /** - * @return TRUE if next() can be called again. - * @draft ICU 65 + * @return true if next() can be called again. + * @stable ICU 65 */ virtual UBool hasNext() const = 0; /** * @return the next locale. - * @draft ICU 65 + * @stable ICU 65 */ virtual const Locale &next() = 0; }; /** * A generic Locale iterator implementation over Locale input iterators. - * @draft ICU 65 + * @stable ICU 65 */ template class RangeIterator : public Iterator, public UMemory { @@ -1042,19 +1045,19 @@ class U_COMMON_API Locale : public UObject { * * @param begin Start of range. * @param end Exclusive end of range. - * @draft ICU 65 + * @stable ICU 65 */ RangeIterator(Iter begin, Iter end) : it_(begin), end_(end) {} /** - * @return TRUE if next() can be called again. - * @draft ICU 65 + * @return true if next() can be called again. + * @stable ICU 65 */ UBool hasNext() const override { return it_ != end_; } /** * @return the next locale. - * @draft ICU 65 + * @stable ICU 65 */ const Locale &next() override { return *it_++; } @@ -1066,7 +1069,7 @@ class U_COMMON_API Locale : public UObject { /** * A generic Locale iterator implementation over Locale input iterators. * Calls the converter to convert each *begin to a const Locale &. - * @draft ICU 65 + * @stable ICU 65 */ template class ConvertingIterator : public Iterator, public UMemory { @@ -1079,20 +1082,20 @@ class U_COMMON_API Locale : public UObject { * @param begin Start of range. * @param end Exclusive end of range. * @param converter Converter from *begin to const Locale & or compatible. - * @draft ICU 65 + * @stable ICU 65 */ ConvertingIterator(Iter begin, Iter end, Conv converter) : it_(begin), end_(end), converter_(converter) {} /** - * @return TRUE if next() can be called again. - * @draft ICU 65 + * @return true if next() can be called again. + * @stable ICU 65 */ UBool hasNext() const override { return it_ != end_; } /** * @return the next locale. - * @draft ICU 65 + * @stable ICU 65 */ const Locale &next() override { return converter_(*it_++); } @@ -1101,7 +1104,6 @@ class U_COMMON_API Locale : public UObject { const Iter end_; Conv converter_; }; -#endif // U_HIDE_DRAFT_API protected: /* only protected for testing purposes. DO NOT USE. */ #ifndef U_HIDE_INTERNAL_API diff --git a/deps/icu-small/source/common/unicode/messagepattern.h b/deps/icu-small/source/common/unicode/messagepattern.h index 04f00a8757d783..98e7b70b1fcc13 100644 --- a/deps/icu-small/source/common/unicode/messagepattern.h +++ b/deps/icu-small/source/common/unicode/messagepattern.h @@ -265,7 +265,7 @@ typedef enum UMessagePatternArgType UMessagePatternArgType; /** * \def UMSGPAT_ARG_TYPE_HAS_PLURAL_STYLE - * Returns TRUE if the argument type has a plural style part sequence and semantics, + * Returns true if the argument type has a plural style part sequence and semantics, * for example UMSGPAT_ARG_TYPE_PLURAL and UMSGPAT_ARG_TYPE_SELECTORDINAL. * @stable ICU 50 */ @@ -523,14 +523,14 @@ class U_COMMON_API MessagePattern : public UObject { /** * @param other another object to compare with. - * @return TRUE if this object is equivalent to the other one. + * @return true if this object is equivalent to the other one. * @stable ICU 4.8 */ UBool operator==(const MessagePattern &other) const; /** * @param other another object to compare with. - * @return FALSE if this object is equivalent to the other one. + * @return false if this object is equivalent to the other one. * @stable ICU 4.8 */ inline UBool operator!=(const MessagePattern &other) const { @@ -564,7 +564,7 @@ class U_COMMON_API MessagePattern : public UObject { /** * Does the parsed pattern have named arguments like {first_name}? - * @return TRUE if the parsed pattern has at least one named argument. + * @return true if the parsed pattern has at least one named argument. * @stable ICU 4.8 */ UBool hasNamedArguments() const { @@ -573,7 +573,7 @@ class U_COMMON_API MessagePattern : public UObject { /** * Does the parsed pattern have numbered arguments like {2}? - * @return TRUE if the parsed pattern has at least one numbered argument. + * @return true if the parsed pattern has at least one numbered argument. * @stable ICU 4.8 */ UBool hasNumberedArguments() const { @@ -664,7 +664,7 @@ class U_COMMON_API MessagePattern : public UObject { * Compares the part's substring with the input string s. * @param part a part of this MessagePattern. * @param s a string. - * @return TRUE if getSubstring(part).equals(s). + * @return true if getSubstring(part).equals(s). * @stable ICU 4.8 */ UBool partSubstringMatches(const Part &part, const UnicodeString &s) const { @@ -785,7 +785,7 @@ class U_COMMON_API MessagePattern : public UObject { * Indicates whether the Part type has a numeric value. * If so, then that numeric value can be retrieved via MessagePattern.getNumericValue(). * @param type The Part type to be tested. - * @return TRUE if the Part type has a numeric value. + * @return true if the Part type has a numeric value. * @stable ICU 4.8 */ static UBool hasNumericValue(UMessagePatternPartType type) { @@ -794,14 +794,14 @@ class U_COMMON_API MessagePattern : public UObject { /** * @param other another object to compare with. - * @return TRUE if this object is equivalent to the other one. + * @return true if this object is equivalent to the other one. * @stable ICU 4.8 */ UBool operator==(const Part &other) const; /** * @param other another object to compare with. - * @return FALSE if this object is equivalent to the other one. + * @return false if this object is equivalent to the other one. * @stable ICU 4.8 */ inline UBool operator!=(const Part &other) const { @@ -869,7 +869,7 @@ class U_COMMON_API MessagePattern : public UObject { * Parses a number from the specified message substring. * @param start start index into the message string * @param limit limit index into the message string, must be startFALSE, only canonical + * If this argument is false, only canonical * decomposition will be performed. * @param options the optional features to be enabled (0 for no options) * @param result The composed string (on output). @@ -256,7 +256,7 @@ class U_COMMON_API Normalizer : public UObject { * * @param source the string to be decomposed. * @param compat Perform compatibility decomposition. - * If this argument is FALSE, only canonical + * If this argument is false, only canonical * decomposition will be performed. * @param options the optional features to be enabled (0 for no options) * @param result The decomposed string (on output). @@ -315,7 +315,7 @@ class U_COMMON_API Normalizer : public UObject { * never a "maybe". * For NFD, NFKD, and FCD, both functions work exactly the same. * For NFC and NFKC where quickCheck may return "maybe", this function will - * perform further tests to arrive at a TRUE/FALSE result. + * perform further tests to arrive at a true/false result. * * @param src String that is to be tested if it is in a normalization format. * @param mode Which normalization form to test for. @@ -577,7 +577,7 @@ class U_COMMON_API Normalizer : public UObject { int32_t endIndex(void) const; /** - * Returns TRUE when both iterators refer to the same character in the same + * Returns true when both iterators refer to the same character in the same * input text. * * @param that a Normalizer object to compare this one to @@ -587,7 +587,7 @@ class U_COMMON_API Normalizer : public UObject { UBool operator==(const Normalizer& that) const; /** - * Returns FALSE when both iterators refer to the same character in the same + * Returns false when both iterators refer to the same character in the same * input text. * * @param that a Normalizer object to compare this one to @@ -655,8 +655,8 @@ class U_COMMON_API Normalizer : public UObject { * It is possible to specify multiple options that are all turned on or off. * * @param option the option(s) whose value is/are to be set. - * @param value the new setting for the option. Use TRUE to - * turn the option(s) on and FALSE to turn it/them off. + * @param value the new setting for the option. Use true to + * turn the option(s) on and false to turn it/them off. * * @see #getOption * @deprecated ICU 56 Use Normalizer2 instead. @@ -666,11 +666,11 @@ class U_COMMON_API Normalizer : public UObject { /** * Determine whether an option is turned on or off. - * If multiple options are specified, then the result is TRUE if any + * If multiple options are specified, then the result is true if any * of them are set. *

* @param option the option(s) that are to be checked - * @return TRUE if any of the option(s) are set + * @return true if any of the option(s) are set * @see #setOption * @deprecated ICU 56 Use Normalizer2 instead. */ diff --git a/deps/icu-small/source/common/unicode/parsepos.h b/deps/icu-small/source/common/unicode/parsepos.h index ae5754b8d75132..d6129fd4f1604f 100644 --- a/deps/icu-small/source/common/unicode/parsepos.h +++ b/deps/icu-small/source/common/unicode/parsepos.h @@ -97,14 +97,14 @@ class U_COMMON_API ParsePosition : public UObject { /** * Equality operator. - * @return TRUE if the two parse positions are equal, FALSE otherwise. + * @return true if the two parse positions are equal, false otherwise. * @stable ICU 2.0 */ inline UBool operator==(const ParsePosition& that) const; /** * Equality operator. - * @return TRUE if the two parse positions are not equal, FALSE otherwise. + * @return true if the two parse positions are not equal, false otherwise. * @stable ICU 2.0 */ inline UBool operator!=(const ParsePosition& that) const; @@ -196,9 +196,9 @@ inline UBool ParsePosition::operator==(const ParsePosition& copy) const { if(index != copy.index || errorIndex != copy.errorIndex) - return FALSE; + return false; else - return TRUE; + return true; } inline UBool diff --git a/deps/icu-small/source/common/unicode/putil.h b/deps/icu-small/source/common/unicode/putil.h index 14bb99ccc545b2..f8c510dacc75fc 100644 --- a/deps/icu-small/source/common/unicode/putil.h +++ b/deps/icu-small/source/common/unicode/putil.h @@ -66,7 +66,7 @@ * * @stable ICU 2.0 */ -U_STABLE const char* U_EXPORT2 u_getDataDirectory(void); +U_CAPI const char* U_EXPORT2 u_getDataDirectory(void); /** @@ -88,7 +88,7 @@ U_STABLE const char* U_EXPORT2 u_getDataDirectory(void); * @see u_init * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory); +U_CAPI void U_EXPORT2 u_setDataDirectory(const char *directory); #ifndef U_HIDE_INTERNAL_API /** @@ -99,7 +99,7 @@ U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory); * @return the time zone data override directory. * @internal */ -U_INTERNAL const char * U_EXPORT2 u_getTimeZoneFilesDirectory(UErrorCode *status); +U_CAPI const char * U_EXPORT2 u_getTimeZoneFilesDirectory(UErrorCode *status); /** * Set the time zone files override directory. @@ -109,7 +109,7 @@ U_INTERNAL const char * U_EXPORT2 u_getTimeZoneFilesDirectory(UErrorCode *status * will access the time zone data. * @internal */ -U_INTERNAL void U_EXPORT2 u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status); +U_CAPI void U_EXPORT2 u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status); #endif /* U_HIDE_INTERNAL_API */ @@ -155,7 +155,7 @@ U_INTERNAL void U_EXPORT2 u_setTimeZoneFilesDirectory(const char *path, UErrorCo * @see U_CHARSET_FAMILY * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_charsToUChars(const char *cs, UChar *us, int32_t length); /** @@ -177,7 +177,7 @@ u_charsToUChars(const char *cs, UChar *us, int32_t length); * @see U_CHARSET_FAMILY * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_UCharsToChars(const UChar *us, char *cs, int32_t length); #endif diff --git a/deps/icu-small/source/common/unicode/rbbi.h b/deps/icu-small/source/common/unicode/rbbi.h index 7825f603a51c1b..65117f616cdf5b 100644 --- a/deps/icu-small/source/common/unicode/rbbi.h +++ b/deps/icu-small/source/common/unicode/rbbi.h @@ -32,6 +32,8 @@ #include "unicode/parseerr.h" #include "unicode/schriter.h" +struct UCPTrie; + U_NAMESPACE_BEGIN /** @internal */ @@ -140,6 +142,11 @@ class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator { */ UBool fDone; + /** + * Array of look-ahead tentative results. + */ + int32_t *fLookAheadMatches; + //======================================================================= // constructors //======================================================================= @@ -246,20 +253,20 @@ class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator { RuleBasedBreakIterator& operator=(const RuleBasedBreakIterator& that); /** - * Equality operator. Returns TRUE if both BreakIterators are of the + * Equality operator. Returns true if both BreakIterators are of the * same class, have the same behavior, and iterate over the same text. * @param that The BreakIterator to be compared for equality - * @return TRUE if both BreakIterators are of the + * @return true if both BreakIterators are of the * same class, have the same behavior, and iterate over the same text. * @stable ICU 2.0 */ virtual UBool operator==(const BreakIterator& that) const; /** - * Not-equal operator. If operator== returns TRUE, this returns FALSE, + * Not-equal operator. If operator== returns true, this returns false, * and vice versa. * @param that The BreakIterator to be compared for inequality - * @return TRUE if both BreakIterators are not same. + * @return true if both BreakIterators are not same. * @stable ICU 2.0 */ inline UBool operator!=(const BreakIterator& that) const; @@ -659,6 +666,28 @@ class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator { */ int32_t handleNext(); + /* + * Templatized version of handleNext() and handleSafePrevious(). + * + * There will be exactly four instantiations, two each for 8 and 16 bit tables, + * two each for 8 and 16 bit trie. + * Having separate instantiations for the table types keeps conditional tests of + * the table type out of the inner loops, at the expense of replicated code. + * + * The template parameter for the Trie access function is a value, not a type. + * Doing it this way, the compiler will inline the Trie function in the + * expanded functions. (Both the 8 and 16 bit access functions have the same type + * signature) + */ + + typedef uint16_t (*PTrieFunc)(const UCPTrie *, UChar32); + + template + int32_t handleSafePrevious(int32_t fromPosition); + + template + int32_t handleNext(); + /** * This function returns the appropriate LanguageBreakEngine for a @@ -681,7 +710,6 @@ class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator { * @internal */ void dumpTables(); - #endif /* U_HIDE_INTERNAL_API */ }; diff --git a/deps/icu-small/source/common/unicode/resbund.h b/deps/icu-small/source/common/unicode/resbund.h index 708a3423d2ae2b..63ffa506e77eec 100644 --- a/deps/icu-small/source/common/unicode/resbund.h +++ b/deps/icu-small/source/common/unicode/resbund.h @@ -286,7 +286,7 @@ class U_COMMON_API ResourceBundle : public UObject { /** * Checks whether the resource has another element to iterate over. * - * @return TRUE if there are more elements, FALSE if there is no more elements + * @return true if there are more elements, false if there is no more elements * @stable ICU 2.0 */ UBool diff --git a/deps/icu-small/source/common/unicode/simpleformatter.h b/deps/icu-small/source/common/unicode/simpleformatter.h index 9414bca3085ad4..6d9c04ace2359a 100644 --- a/deps/icu-small/source/common/unicode/simpleformatter.h +++ b/deps/icu-small/source/common/unicode/simpleformatter.h @@ -125,7 +125,7 @@ class U_COMMON_API SimpleFormatter U_FINAL : public UMemory { * @param errorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax. - * @return TRUE if U_SUCCESS(errorCode). + * @return true if U_SUCCESS(errorCode). * @stable ICU 57 */ UBool applyPattern(const UnicodeString &pattern, UErrorCode &errorCode) { @@ -144,7 +144,7 @@ class U_COMMON_API SimpleFormatter U_FINAL : public UMemory { * Must fulfill U_SUCCESS before the function call. * Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax and * too few or too many arguments. - * @return TRUE if U_SUCCESS(errorCode). + * @return true if U_SUCCESS(errorCode). * @stable ICU 57 */ UBool applyPatternMinMaxArguments(const UnicodeString &pattern, diff --git a/deps/icu-small/source/common/unicode/strenum.h b/deps/icu-small/source/common/unicode/strenum.h index e813cd84b3413a..5d1600156e32e9 100644 --- a/deps/icu-small/source/common/unicode/strenum.h +++ b/deps/icu-small/source/common/unicode/strenum.h @@ -196,7 +196,7 @@ class U_COMMON_API StringEnumeration : public UObject { * Compares this enumeration to other to check if both are equal * * @param that The other string enumeration to compare this object to - * @return TRUE if the enumerations are equal. FALSE if not. + * @return true if the enumerations are equal. false if not. * @stable ICU 3.6 */ virtual UBool operator==(const StringEnumeration& that)const; @@ -204,7 +204,7 @@ class U_COMMON_API StringEnumeration : public UObject { * Compares this enumeration to other to check if both are not equal * * @param that The other string enumeration to compare this object to - * @return TRUE if the enumerations are equal. FALSE if not. + * @return true if the enumerations are equal. false if not. * @stable ICU 3.6 */ virtual UBool operator!=(const StringEnumeration& that)const; diff --git a/deps/icu-small/source/common/unicode/stringpiece.h b/deps/icu-small/source/common/unicode/stringpiece.h index 19fbe2e22eb032..58053cfd5c3108 100644 --- a/deps/icu-small/source/common/unicode/stringpiece.h +++ b/deps/icu-small/source/common/unicode/stringpiece.h @@ -111,7 +111,6 @@ class U_COMMON_API StringPiece : public UMemory { #endif #endif // U_HIDE_DRAFT_API -#ifndef U_HIDE_DRAFT_API /** * Constructs from some other implementation of a string piece class, from any * C++ record type that has these two methods: @@ -132,7 +131,7 @@ class U_COMMON_API StringPiece : public UMemory { * as from std::u8string_view. * * @param str the other string piece - * @draft ICU 65 + * @stable ICU 65 */ template (str.data())), length_(static_cast(str.size())) {} -#endif // U_HIDE_DRAFT_API /** * Constructs from a const char * pointer and a specified length. @@ -209,7 +207,7 @@ class U_COMMON_API StringPiece : public UMemory { int32_t length() const { return length_; } /** * Returns whether the string is empty. - * @return TRUE if the string is empty + * @return true if the string is empty * @stable ICU 4.2 */ UBool empty() const { return length_ == 0; } @@ -331,7 +329,7 @@ class U_COMMON_API StringPiece : public UMemory { * Global operator == for StringPiece * @param x The first StringPiece to compare. * @param y The second StringPiece to compare. - * @return TRUE if the string data is equal + * @return true if the string data is equal * @stable ICU 4.8 */ U_EXPORT UBool U_EXPORT2 @@ -341,7 +339,7 @@ operator==(const StringPiece& x, const StringPiece& y); * Global operator != for StringPiece * @param x The first StringPiece to compare. * @param y The second StringPiece to compare. - * @return TRUE if the string data is not equal + * @return true if the string data is not equal * @stable ICU 4.8 */ inline UBool operator!=(const StringPiece& x, const StringPiece& y) { diff --git a/deps/icu-small/source/common/unicode/stringtriebuilder.h b/deps/icu-small/source/common/unicode/stringtriebuilder.h index 2860cbf5513b8e..efd2d49206ca2d 100644 --- a/deps/icu-small/source/common/unicode/stringtriebuilder.h +++ b/deps/icu-small/source/common/unicode/stringtriebuilder.h @@ -279,10 +279,10 @@ class U_COMMON_API StringTrieBuilder : public UObject { */ class ValueNode : public Node { public: - ValueNode(int32_t initialHash) : Node(initialHash), hasValue(FALSE), value(0) {} + ValueNode(int32_t initialHash) : Node(initialHash), hasValue(false), value(0) {} virtual UBool operator==(const Node &other) const; void setValue(int32_t v) { - hasValue=TRUE; + hasValue=true; value=v; hash=hash*37u+v; } diff --git a/deps/icu-small/source/common/unicode/ubidi.h b/deps/icu-small/source/common/unicode/ubidi.h index f4875c8801efd6..63d0e45cb7f3c5 100644 --- a/deps/icu-small/source/common/unicode/ubidi.h +++ b/deps/icu-small/source/common/unicode/ubidi.h @@ -21,7 +21,10 @@ #include "unicode/utypes.h" #include "unicode/uchar.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** *\file @@ -496,7 +499,7 @@ typedef struct UBiDi UBiDi; * @return An empty UBiDi object. * @stable ICU 2.0 */ -U_STABLE UBiDi * U_EXPORT2 +U_CAPI UBiDi * U_EXPORT2 ubidi_open(void); /** @@ -533,7 +536,7 @@ ubidi_open(void); * @return An empty UBiDi object with preallocated memory. * @stable ICU 2.0 */ -U_STABLE UBiDi * U_EXPORT2 +U_CAPI UBiDi * U_EXPORT2 ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode); /** @@ -556,7 +559,7 @@ ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode); * @see ubidi_setLine * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_close(UBiDi *pBiDi); #if U_SHOW_CPLUSPLUS_API @@ -594,7 +597,7 @@ U_NAMESPACE_END * this "inverse Bidi" and that the current implementation provides only an * approximation of "inverse Bidi".

* - *

With isInverse set to TRUE, + *

With isInverse set to true, * this function changes the behavior of some of the subsequent functions * in a way that they can be used for the inverse Bidi algorithm. * Specifically, runs of text with numeric characters will be treated in a @@ -607,12 +610,12 @@ U_NAMESPACE_END * the runs of the logically ordered output.

* *

Calling this function with argument isInverse set to - * TRUE is equivalent to calling + * true is equivalent to calling * ubidi_setReorderingMode with argument * reorderingMode * set to #UBIDI_REORDER_INVERSE_NUMBERS_AS_L.
* Calling this function with argument isInverse set to - * FALSE is equivalent to calling + * false is equivalent to calling * ubidi_setReorderingMode with argument * reorderingMode * set to #UBIDI_REORDER_DEFAULT. @@ -626,18 +629,18 @@ U_NAMESPACE_END * @see ubidi_setReorderingMode * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse); /** * Is this Bidi object set to perform the inverse Bidi algorithm? *

Note: calling this function after setting the reordering mode with - * ubidi_setReorderingMode will return TRUE if the + * ubidi_setReorderingMode will return true if the * reordering mode was set to #UBIDI_REORDER_INVERSE_NUMBERS_AS_L, - * FALSE for all other values.

+ * false for all other values.

* * @param pBiDi is a UBiDi object. - * @return TRUE if the Bidi object is set to perform the inverse Bidi algorithm + * @return true if the Bidi object is set to perform the inverse Bidi algorithm * by handling numbers as L. * * @see ubidi_setInverse @@ -645,7 +648,7 @@ ubidi_setInverse(UBiDi *pBiDi, UBool isInverse); * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ubidi_isInverse(UBiDi *pBiDi); /** @@ -668,7 +671,7 @@ ubidi_isInverse(UBiDi *pBiDi); * @see ubidi_setPara * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR); /** @@ -676,13 +679,13 @@ ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR); * successive paragraphs progress from left to right? * * @param pBiDi is a UBiDi object. - * @return TRUE if the Bidi object is set to allocate level 0 to block + * @return true if the Bidi object is set to allocate level 0 to block * separators. * * @see ubidi_orderParagraphsLTR * @stable ICU 3.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ubidi_isOrderParagraphsLTR(UBiDi *pBiDi); /** @@ -714,7 +717,7 @@ typedef enum UBiDiReorderingMode { * @stable ICU 3.6 */ UBIDI_REORDER_RUNS_ONLY, /** Visual to Logical algorithm which handles numbers like L - * (same algorithm as selected by ubidi_setInverse(TRUE). + * (same algorithm as selected by ubidi_setInverse(true). * @see ubidi_setInverse * @stable ICU 3.6 */ UBIDI_REORDER_INVERSE_NUMBERS_AS_L, @@ -833,7 +836,7 @@ typedef enum UBiDiReorderingMode { * reordered sequence (the option #UBIDI_INSERT_LRM_FOR_NUMERIC can * be used with function ubidi_writeReordered to this end. This * mode is equivalent to calling ubidi_setInverse() with - * argument isInverse set to TRUE. + * argument isInverse set to true. * *
  • When the reordering mode is set to * #UBIDI_REORDER_INVERSE_LIKE_DIRECT, the "direct" Logical to Visual @@ -886,7 +889,7 @@ typedef enum UBiDiReorderingMode { * @see ubidi_writeReordered * @stable ICU 3.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode); /** @@ -897,7 +900,7 @@ ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode); * @see ubidi_setReorderingMode * @stable ICU 3.6 */ -U_STABLE UBiDiReorderingMode U_EXPORT2 +U_CAPI UBiDiReorderingMode U_EXPORT2 ubidi_getReorderingMode(UBiDi *pBiDi); /** @@ -935,7 +938,7 @@ typedef enum UBiDiReorderingOption { * *

    If this option is set in conjunction with reordering mode * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L or with calling - * ubidi_setInverse(TRUE), it implies + * ubidi_setInverse(true), it implies * option #UBIDI_INSERT_LRM_FOR_NUMERIC * in calls to function ubidi_writeReordered().

    * @@ -1016,7 +1019,7 @@ typedef enum UBiDiReorderingOption { * *

    When the UBIDI_OPTION_STREAMING option is used, * it is recommended to call ubidi_orderParagraphsLTR() with - * argument orderParagraphsLTR set to TRUE before + * argument orderParagraphsLTR set to true before * calling ubidi_setPara so that later paragraphs may be * concatenated to previous paragraphs on the right.

    * @@ -1042,7 +1045,7 @@ typedef enum UBiDiReorderingOption { * @see ubidi_getReorderingOptions * @stable ICU 3.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions); /** @@ -1053,7 +1056,7 @@ ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions); * @see ubidi_setReorderingOptions * @stable ICU 3.6 */ -U_STABLE uint32_t U_EXPORT2 +U_CAPI uint32_t U_EXPORT2 ubidi_getReorderingOptions(UBiDi *pBiDi); /** @@ -1140,7 +1143,7 @@ ubidi_getReorderingOptions(UBiDi *pBiDi); * @see ubidi_setPara * @stable ICU 4.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_setContext(UBiDi *pBiDi, const UChar *prologue, int32_t proLength, const UChar *epilogue, int32_t epiLength, @@ -1228,7 +1231,7 @@ ubidi_setContext(UBiDi *pBiDi, * @param pErrorCode must be a valid pointer to an error code value. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels, UErrorCode *pErrorCode); @@ -1279,7 +1282,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, * @see ubidi_getProcessedLength * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_setLine(const UBiDi *pParaBiDi, int32_t start, int32_t limit, UBiDi *pLineBiDi, @@ -1300,7 +1303,7 @@ ubidi_setLine(const UBiDi *pParaBiDi, * @see UBiDiDirection * @stable ICU 2.0 */ -U_STABLE UBiDiDirection U_EXPORT2 +U_CAPI UBiDiDirection U_EXPORT2 ubidi_getDirection(const UBiDi *pBiDi); /** @@ -1330,7 +1333,7 @@ ubidi_getDirection(const UBiDi *pBiDi); * @see UBiDiDirection * @stable ICU 4.6 */ -U_STABLE UBiDiDirection U_EXPORT2 +U_CAPI UBiDiDirection U_EXPORT2 ubidi_getBaseDirection(const UChar *text, int32_t length ); /** @@ -1344,7 +1347,7 @@ ubidi_getBaseDirection(const UChar *text, int32_t length ); * @see ubidi_setLine * @stable ICU 2.0 */ -U_STABLE const UChar * U_EXPORT2 +U_CAPI const UChar * U_EXPORT2 ubidi_getText(const UBiDi *pBiDi); /** @@ -1355,7 +1358,7 @@ ubidi_getText(const UBiDi *pBiDi); * @return The length of the text that the UBiDi object was created for. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_getLength(const UBiDi *pBiDi); /** @@ -1373,7 +1376,7 @@ ubidi_getLength(const UBiDi *pBiDi); * @see ubidi_getParagraphByIndex * @stable ICU 2.0 */ -U_STABLE UBiDiLevel U_EXPORT2 +U_CAPI UBiDiLevel U_EXPORT2 ubidi_getParaLevel(const UBiDi *pBiDi); /** @@ -1384,7 +1387,7 @@ ubidi_getParaLevel(const UBiDi *pBiDi); * @return The number of paragraphs. * @stable ICU 3.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_countParagraphs(UBiDi *pBiDi); /** @@ -1421,7 +1424,7 @@ ubidi_countParagraphs(UBiDi *pBiDi); * @see ubidi_getProcessedLength * @stable ICU 3.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart, int32_t *pParaLimit, UBiDiLevel *pParaLevel, UErrorCode *pErrorCode); @@ -1453,7 +1456,7 @@ ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart, * * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex, int32_t *pParaStart, int32_t *pParaLimit, UBiDiLevel *pParaLevel, UErrorCode *pErrorCode); @@ -1473,7 +1476,7 @@ ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex, * @see ubidi_getProcessedLength * @stable ICU 2.0 */ -U_STABLE UBiDiLevel U_EXPORT2 +U_CAPI UBiDiLevel U_EXPORT2 ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex); /** @@ -1494,7 +1497,7 @@ ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex); * @see ubidi_getProcessedLength * @stable ICU 2.0 */ -U_STABLE const UBiDiLevel * U_EXPORT2 +U_CAPI const UBiDiLevel * U_EXPORT2 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode); /** @@ -1521,7 +1524,7 @@ ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode); * @see ubidi_getProcessedLength * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition, int32_t *pLogicalLimit, UBiDiLevel *pLevel); @@ -1540,7 +1543,7 @@ ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition, * @return The number of runs. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode); /** @@ -1599,7 +1602,7 @@ ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode); * to avoid these issues. * @stable ICU 2.0 */ -U_STABLE UBiDiDirection U_EXPORT2 +U_CAPI UBiDiDirection U_EXPORT2 ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex, int32_t *pLogicalStart, int32_t *pLength); @@ -1640,7 +1643,7 @@ ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex, * @see ubidi_getProcessedLength * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode); /** @@ -1675,7 +1678,7 @@ ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode) * @see ubidi_getResultLength * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode); /** @@ -1718,7 +1721,7 @@ ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode) * @see ubidi_getResultLength * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode); /** @@ -1754,7 +1757,7 @@ ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode); * @see ubidi_getResultLength * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode); /** @@ -1777,7 +1780,7 @@ ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode); * The index map will result in indexMap[logicalIndex]==visualIndex. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap); /** @@ -1800,7 +1803,7 @@ ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap * The index map will result in indexMap[visualIndex]==logicalIndex. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap); /** @@ -1835,7 +1838,7 @@ ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap) * @see UBIDI_MAP_NOWHERE * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length); /** option flags for ubidi_writeReordered() */ @@ -1940,7 +1943,7 @@ ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length); * @see UBIDI_OPTION_STREAMING * @stable ICU 3.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_getProcessedLength(const UBiDi *pBiDi); /** @@ -1970,7 +1973,7 @@ ubidi_getProcessedLength(const UBiDi *pBiDi); * @see UBIDI_OPTION_REMOVE_CONTROLS * @stable ICU 3.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_getResultLength(const UBiDi *pBiDi); U_CDECL_BEGIN @@ -2028,7 +2031,7 @@ U_CDECL_END * @see UBiDiClassCallback * @stable ICU 3.6 */ -U_STABLE UCharDirection U_EXPORT2 +U_CAPI UCharDirection U_EXPORT2 ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c); /** @@ -2058,7 +2061,7 @@ ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c); * @see ubidi_getClassCallback * @stable ICU 3.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn, const void *newContext, UBiDiClassCallback **oldFn, const void **oldContext, UErrorCode *pErrorCode); @@ -2075,7 +2078,7 @@ ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn, * @see ubidi_setClassCallback * @stable ICU 3.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context); /** @@ -2143,7 +2146,7 @@ ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **conte * @see ubidi_getProcessedLength * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_writeReordered(UBiDi *pBiDi, UChar *dest, int32_t destSize, uint16_t options, @@ -2195,7 +2198,7 @@ ubidi_writeReordered(UBiDi *pBiDi, * @return The length of the output string. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_writeReverse(const UChar *src, int32_t srcLength, UChar *dest, int32_t destSize, uint16_t options, diff --git a/deps/icu-small/source/common/unicode/ubiditransform.h b/deps/icu-small/source/common/unicode/ubiditransform.h index 5c08ed5df0fd90..2dd7564010de17 100644 --- a/deps/icu-small/source/common/unicode/ubiditransform.h +++ b/deps/icu-small/source/common/unicode/ubiditransform.h @@ -21,7 +21,10 @@ #include "unicode/utypes.h" #include "unicode/ubidi.h" #include "unicode/uchar.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** * \file @@ -147,10 +150,10 @@ typedef struct UBiDiTransform UBiDiTransform; * calling ubidi_setPara with * paraLevel == UBIDI_DEFAULT_RTL,
  • *
  • : this is equivalent to - * calling ubidi_setInverse(UBiDi*, TRUE) and then + * calling ubidi_setInverse(UBiDi*, true) and then * ubidi_setPara with paraLevel == UBIDI_LTR,
  • *
  • : this is equivalent to - * calling ubidi_setInverse(UBiDi*, TRUE) and then + * calling ubidi_setInverse(UBiDi*, true) and then * ubidi_setPara with paraLevel == UBIDI_RTL.
  • * * All combinations that involve the Visual RTL scheme are unsupported by @@ -245,7 +248,7 @@ typedef struct UBiDiTransform UBiDiTransform; * @see u_shapeArabic * @stable ICU 58 */ -U_STABLE uint32_t U_EXPORT2 +U_CAPI uint32_t U_EXPORT2 ubiditransform_transform(UBiDiTransform *pBiDiTransform, const UChar *src, int32_t srcLength, UChar *dest, int32_t destSize, @@ -291,14 +294,14 @@ ubiditransform_transform(UBiDiTransform *pBiDiTransform, * @return An empty UBiDiTransform object. * @stable ICU 58 */ -U_STABLE UBiDiTransform* U_EXPORT2 +U_CAPI UBiDiTransform* U_EXPORT2 ubiditransform_open(UErrorCode *pErrorCode); /** * Deallocates the given UBiDiTransform object. * @stable ICU 58 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubiditransform_close(UBiDiTransform *pBidiTransform); #if U_SHOW_CPLUSPLUS_API diff --git a/deps/icu-small/source/common/unicode/ubrk.h b/deps/icu-small/source/common/unicode/ubrk.h index 73c1553b243957..37189a85984b68 100644 --- a/deps/icu-small/source/common/unicode/ubrk.h +++ b/deps/icu-small/source/common/unicode/ubrk.h @@ -13,7 +13,10 @@ #include "unicode/utypes.h" #include "unicode/uloc.h" #include "unicode/utext.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** * A text-break iterator. @@ -238,7 +241,7 @@ typedef enum USentenceBreakTag { * @see ubrk_openRules * @stable ICU 2.0 */ -U_STABLE UBreakIterator* U_EXPORT2 +U_CAPI UBreakIterator* U_EXPORT2 ubrk_open(UBreakIteratorType type, const char *locale, const UChar *text, @@ -260,7 +263,7 @@ ubrk_open(UBreakIteratorType type, * @see ubrk_open * @stable ICU 2.2 */ -U_STABLE UBreakIterator* U_EXPORT2 +U_CAPI UBreakIterator* U_EXPORT2 ubrk_openRules(const UChar *rules, int32_t rulesLength, const UChar *text, @@ -288,7 +291,7 @@ ubrk_openRules(const UChar *rules, * @see ubrk_getBinaryRules * @stable ICU 59 */ -U_STABLE UBreakIterator* U_EXPORT2 +U_CAPI UBreakIterator* U_EXPORT2 ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength, const UChar * text, int32_t textLength, UErrorCode * status); @@ -311,7 +314,7 @@ ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength, * @return pointer to the new clone * @stable ICU 2.0 */ -U_STABLE UBreakIterator * U_EXPORT2 +U_CAPI UBreakIterator * U_EXPORT2 ubrk_safeClone( const UBreakIterator *bi, void *stackBuffer, @@ -334,7 +337,7 @@ ubrk_safeClone( * @param bi The break iterator to close. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubrk_close(UBreakIterator *bi); #if U_SHOW_CPLUSPLUS_API @@ -368,7 +371,7 @@ U_NAMESPACE_END * @param status The error code * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubrk_setText(UBreakIterator* bi, const UChar* text, int32_t textLength, @@ -392,7 +395,7 @@ ubrk_setText(UBreakIterator* bi, * @param status The error code * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubrk_setUText(UBreakIterator* bi, UText* text, UErrorCode* status); @@ -407,7 +410,7 @@ ubrk_setUText(UBreakIterator* bi, * \ref ubrk_first, or \ref ubrk_last. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubrk_current(const UBreakIterator *bi); /** @@ -419,7 +422,7 @@ ubrk_current(const UBreakIterator *bi); * @see ubrk_previous * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubrk_next(UBreakIterator *bi); /** @@ -431,7 +434,7 @@ ubrk_next(UBreakIterator *bi); * @see ubrk_next * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubrk_previous(UBreakIterator *bi); /** @@ -441,7 +444,7 @@ ubrk_previous(UBreakIterator *bi); * @see ubrk_last * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubrk_first(UBreakIterator *bi); /** @@ -453,7 +456,7 @@ ubrk_first(UBreakIterator *bi); * @see ubrk_first * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubrk_last(UBreakIterator *bi); /** @@ -465,7 +468,7 @@ ubrk_last(UBreakIterator *bi); * @see ubrk_following * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubrk_preceding(UBreakIterator *bi, int32_t offset); @@ -478,7 +481,7 @@ ubrk_preceding(UBreakIterator *bi, * @see ubrk_preceding * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubrk_following(UBreakIterator *bi, int32_t offset); @@ -491,7 +494,7 @@ ubrk_following(UBreakIterator *bi, * @see ubrk_countAvailable * @stable ICU 2.0 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 ubrk_getAvailable(int32_t index); /** @@ -502,7 +505,7 @@ ubrk_getAvailable(int32_t index); * @see ubrk_getAvailable * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubrk_countAvailable(void); @@ -515,7 +518,7 @@ ubrk_countAvailable(void); * @return True if "offset" is a boundary position. * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ubrk_isBoundary(UBreakIterator *bi, int32_t offset); /** @@ -527,7 +530,7 @@ ubrk_isBoundary(UBreakIterator *bi, int32_t offset); * For word break iterators, the possible values are defined in enum UWordBreak. * @stable ICU 2.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubrk_getRuleStatus(UBreakIterator *bi); /** @@ -547,7 +550,7 @@ ubrk_getRuleStatus(UBreakIterator *bi); * the most recent boundary returned by the break iterator. * @stable ICU 3.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, UErrorCode *status); /** @@ -559,7 +562,7 @@ ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, * @return locale string * @stable ICU 2.8 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCode* status); /** @@ -587,7 +590,7 @@ ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCo * * @stable ICU 49 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubrk_refreshUText(UBreakIterator *bi, UText *text, UErrorCode *status); @@ -618,7 +621,7 @@ ubrk_refreshUText(UBreakIterator *bi, * @see ubrk_openBinaryRules * @stable ICU 59 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubrk_getBinaryRules(UBreakIterator *bi, uint8_t * binaryRules, int32_t rulesCapacity, UErrorCode * status); diff --git a/deps/icu-small/source/common/unicode/ucasemap.h b/deps/icu-small/source/common/unicode/ucasemap.h index 6b253e3d638475..d1c1b483ab337e 100644 --- a/deps/icu-small/source/common/unicode/ucasemap.h +++ b/deps/icu-small/source/common/unicode/ucasemap.h @@ -22,10 +22,13 @@ #define __UCASEMAP_H__ #include "unicode/utypes.h" -#include "unicode/localpointer.h" #include "unicode/stringoptions.h" #include "unicode/ustring.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + /** * \file * \brief C API: Unicode case mapping functions using a UCaseMap service object. @@ -69,7 +72,7 @@ typedef struct UCaseMap UCaseMap; /**< C typedef for struct UCaseMap. @stable IC * @see U_TITLECASE_NO_BREAK_ADJUSTMENT * @stable ICU 3.4 */ -U_STABLE UCaseMap * U_EXPORT2 +U_CAPI UCaseMap * U_EXPORT2 ucasemap_open(const char *locale, uint32_t options, UErrorCode *pErrorCode); /** @@ -77,7 +80,7 @@ ucasemap_open(const char *locale, uint32_t options, UErrorCode *pErrorCode); * @param csm Object to be closed. * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucasemap_close(UCaseMap *csm); #if U_SHOW_CPLUSPLUS_API @@ -105,7 +108,7 @@ U_NAMESPACE_END * @return locale ID * @stable ICU 3.4 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ucasemap_getLocale(const UCaseMap *csm); /** @@ -114,7 +117,7 @@ ucasemap_getLocale(const UCaseMap *csm); * @return options bit set * @stable ICU 3.4 */ -U_STABLE uint32_t U_EXPORT2 +U_CAPI uint32_t U_EXPORT2 ucasemap_getOptions(const UCaseMap *csm); /** @@ -128,7 +131,7 @@ ucasemap_getOptions(const UCaseMap *csm); * @see ucasemap_open * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucasemap_setLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode); /** @@ -142,7 +145,7 @@ ucasemap_setLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode); * @see ucasemap_open * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucasemap_setOptions(UCaseMap *csm, uint32_t options, UErrorCode *pErrorCode); #if !UCONFIG_NO_BREAK_ITERATION @@ -154,7 +157,7 @@ ucasemap_setOptions(UCaseMap *csm, uint32_t options, UErrorCode *pErrorCode); * @return titlecasing break iterator * @stable ICU 3.8 */ -U_STABLE const UBreakIterator * U_EXPORT2 +U_CAPI const UBreakIterator * U_EXPORT2 ucasemap_getBreakIterator(const UCaseMap *csm); /** @@ -177,7 +180,7 @@ ucasemap_getBreakIterator(const UCaseMap *csm); * @see ucasemap_utf8ToTitle * @stable ICU 3.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode *pErrorCode); /** @@ -226,7 +229,7 @@ ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode * @see u_strToTitle * @stable ICU 3.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucasemap_toTitle(UCaseMap *csm, UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, @@ -257,7 +260,7 @@ ucasemap_toTitle(UCaseMap *csm, * @see u_strToLower * @stable ICU 3.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucasemap_utf8ToLower(const UCaseMap *csm, char *dest, int32_t destCapacity, const char *src, int32_t srcLength, @@ -286,7 +289,7 @@ ucasemap_utf8ToLower(const UCaseMap *csm, * @see u_strToUpper * @stable ICU 3.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucasemap_utf8ToUpper(const UCaseMap *csm, char *dest, int32_t destCapacity, const char *src, int32_t srcLength, @@ -338,7 +341,7 @@ ucasemap_utf8ToUpper(const UCaseMap *csm, * @see U_TITLECASE_NO_BREAK_ADJUSTMENT * @stable ICU 3.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucasemap_utf8ToTitle(UCaseMap *csm, char *dest, int32_t destCapacity, const char *src, int32_t srcLength, @@ -376,7 +379,7 @@ ucasemap_utf8ToTitle(UCaseMap *csm, * @see U_FOLD_CASE_EXCLUDE_SPECIAL_I * @stable ICU 3.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucasemap_utf8FoldCase(const UCaseMap *csm, char *dest, int32_t destCapacity, const char *src, int32_t srcLength, diff --git a/deps/icu-small/source/common/unicode/ucat.h b/deps/icu-small/source/common/unicode/ucat.h index f9c18b47d6c9b8..a177639a76bfcb 100644 --- a/deps/icu-small/source/common/unicode/ucat.h +++ b/deps/icu-small/source/common/unicode/ucat.h @@ -103,7 +103,7 @@ typedef UResourceBundle* u_nl_catd; * * @stable ICU 2.6 */ -U_STABLE u_nl_catd U_EXPORT2 +U_CAPI u_nl_catd U_EXPORT2 u_catopen(const char* name, const char* locale, UErrorCode* ec); /** @@ -114,7 +114,7 @@ u_catopen(const char* name, const char* locale, UErrorCode* ec); * * @stable ICU 2.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_catclose(u_nl_catd catd); /** @@ -149,7 +149,7 @@ u_catclose(u_nl_catd catd); * * @stable ICU 2.6 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 u_catgets(u_nl_catd catd, int32_t set_num, int32_t msg_num, const UChar* s, int32_t* len, UErrorCode* ec); diff --git a/deps/icu-small/source/common/unicode/uchar.h b/deps/icu-small/source/common/unicode/uchar.h index 3b55b2326dfc1f..1e0f82e706c482 100644 --- a/deps/icu-small/source/common/unicode/uchar.h +++ b/deps/icu-small/source/common/unicode/uchar.h @@ -80,7 +80,7 @@ U_CDECL_BEGIN * and the ICU User Guide chapter on Properties (http://icu-project.org/userguide/properties.html). * * Many properties are accessible via generic functions that take a UProperty selector. - * - u_hasBinaryProperty() returns a binary value (TRUE/FALSE) per property and code point. + * - u_hasBinaryProperty() returns a binary value (true/false) per property and code point. * - u_getIntPropertyValue() returns an integer value per property and code point. * For each supported enumerated or catalog property, there is * an enum type for all of the property's values, and @@ -2586,8 +2586,8 @@ typedef enum UVerticalOrientation { * @param c Code point to test. * @param which UProperty selector constant, identifies which binary property to check. * Must be UCHAR_BINARY_START<=which(remainingMatchLength_ + 2) << kState64RemainingShift) | @@ -123,14 +122,13 @@ class U_COMMON_API UCharsTrie : public UMemory { * @see getState64 * @see resetToState * @see reset - * @draft ICU 65 + * @stable ICU 65 */ UCharsTrie &resetToState64(uint64_t state) { remainingMatchLength_ = static_cast(state >> kState64RemainingShift) - 2; pos_ = uchars_ + (state & kState64PosMask); return *this; } -#endif /* U_HIDE_DRAFT_API */ /** * UCharsTrie state object, for saving a trie's current state @@ -268,16 +266,16 @@ class U_COMMON_API UCharsTrie : public UMemory { /** * Determines whether all strings reachable from the current state * map to the same value. - * @param uniqueValue Receives the unique value, if this function returns TRUE. + * @param uniqueValue Receives the unique value, if this function returns true. * (output-only) - * @return TRUE if all strings reachable from the current state + * @return true if all strings reachable from the current state * map to the same value. * @stable ICU 4.8 */ inline UBool hasUniqueValue(int32_t &uniqueValue) const { const char16_t *pos=pos_; // Skip the rest of a pending linear-match node. - return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, FALSE, uniqueValue); + return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, false, uniqueValue); } /** @@ -335,7 +333,7 @@ class U_COMMON_API UCharsTrie : public UMemory { Iterator &reset(); /** - * @return TRUE if there are more elements. + * @return true if there are more elements. * @stable ICU 4.8 */ UBool hasNext() const; @@ -351,7 +349,7 @@ class U_COMMON_API UCharsTrie : public UMemory { * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) - * @return TRUE if there is another element. + * @return true if there is another element. * @stable ICU 4.8 */ UBool next(UErrorCode &errorCode); @@ -371,7 +369,7 @@ class U_COMMON_API UCharsTrie : public UMemory { UBool truncateAndStop() { pos_=NULL; value_=-1; // no real value for str - return TRUE; + return true; } const char16_t *branchNext(const char16_t *pos, int32_t length, UErrorCode &errorCode); diff --git a/deps/icu-small/source/common/unicode/ucharstriebuilder.h b/deps/icu-small/source/common/unicode/ucharstriebuilder.h index 540dcc047fd563..15657702f9d024 100644 --- a/deps/icu-small/source/common/unicode/ucharstriebuilder.h +++ b/deps/icu-small/source/common/unicode/ucharstriebuilder.h @@ -101,9 +101,10 @@ class U_COMMON_API UCharsTrieBuilder : public StringTrieBuilder { * Multiple calls to buildUnicodeString() set the UnicodeStrings to the * builder's same char16_t array, without rebuilding. * If buildUnicodeString() is called after build(), the trie will be - * re-serialized into a new array. - * If build() is called after buildUnicodeString(), the trie object will become - * the owner of the previously returned array. + * re-serialized into a new array (because build() passes on ownership). + * If build() is called after buildUnicodeString(), the trie object returned + * by build() will become the owner of the underlying data for the + * previously returned UnicodeString. * After clear() has been called, a new array will be used as well. * @param buildOption Build option, see UStringTrieBuildOption. * @param result A UnicodeString which will be set to the char16_t-serialized @@ -147,7 +148,7 @@ class U_COMMON_API UCharsTrieBuilder : public StringTrieBuilder { virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t count) const; virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const; - virtual UBool matchNodesCanHaveValues() const { return TRUE; } + virtual UBool matchNodesCanHaveValues() const { return true; } virtual int32_t getMaxBranchLinearSubNodeLength() const { return UCharsTrie::kMaxBranchLinearSubNodeLength; } virtual int32_t getMinLinearMatch() const { return UCharsTrie::kMinLinearMatch; } diff --git a/deps/icu-small/source/common/unicode/uchriter.h b/deps/icu-small/source/common/unicode/uchriter.h index bee842cc259f07..84309b2416d136 100644 --- a/deps/icu-small/source/common/unicode/uchriter.h +++ b/deps/icu-small/source/common/unicode/uchriter.h @@ -274,11 +274,11 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { virtual UChar32 next32PostInc(void); /** - * Returns FALSE if there are no more code units or code points + * Returns false if there are no more code units or code points * at or after the current position in the iteration range. * This is used with nextPostInc() or next32PostInc() in forward * iteration. - * @return FALSE if there are no more code units or code points + * @return false if there are no more code units or code points * at or after the current position in the iteration range. * @stable ICU 2.0 */ @@ -303,11 +303,11 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { virtual UChar32 previous32(void); /** - * Returns FALSE if there are no more code units or code points + * Returns false if there are no more code units or code points * before the current position in the iteration range. * This is used with previous() or previous32() in backward * iteration. - * @return FALSE if there are no more code units or code points + * @return false if there are no more code units or code points * before the current position in the iteration range. * @stable ICU 2.0 */ diff --git a/deps/icu-small/source/common/unicode/uclean.h b/deps/icu-small/source/common/unicode/uclean.h index ab0cd6da6ba780..f03593964a4edd 100644 --- a/deps/icu-small/source/common/unicode/uclean.h +++ b/deps/icu-small/source/common/unicode/uclean.h @@ -49,7 +49,7 @@ * * @stable ICU 2.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_init(UErrorCode *status); #ifndef U_HIDE_SYSTEM_API @@ -98,7 +98,7 @@ u_init(UErrorCode *status); * @stable ICU 2.0 * @system */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_cleanup(void); U_CDECL_BEGIN @@ -148,7 +148,7 @@ typedef void U_CALLCONV UMemFreeFn (const void *context, void *mem); * @stable ICU 2.8 * @system */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_setMemoryFunctions(const void *context, UMemAllocFn * U_CALLCONV_FPTR a, UMemReallocFn * U_CALLCONV_FPTR r, UMemFreeFn * U_CALLCONV_FPTR f, UErrorCode *status); diff --git a/deps/icu-small/source/common/unicode/ucnv.h b/deps/icu-small/source/common/unicode/ucnv.h index ec7c5f350b4973..58f271cfb5adf2 100644 --- a/deps/icu-small/source/common/unicode/ucnv.h +++ b/deps/icu-small/source/common/unicode/ucnv.h @@ -51,7 +51,10 @@ #include "unicode/ucnv_err.h" #include "unicode/uenum.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API #if !defined(USET_DEFINED) && !defined(U_IN_DOXYGEN) @@ -308,7 +311,7 @@ U_CDECL_END * lexically follows name2. * @stable ICU 2.0 */ -U_STABLE int U_EXPORT2 +U_CAPI int U_EXPORT2 ucnv_compareNames(const char *name1, const char *name2); @@ -362,7 +365,7 @@ ucnv_compareNames(const char *name1, const char *name2); * @see ucnv_compareNames * @stable ICU 2.0 */ -U_STABLE UConverter* U_EXPORT2 +U_CAPI UConverter* U_EXPORT2 ucnv_open(const char *converterName, UErrorCode *err); @@ -392,7 +395,7 @@ ucnv_open(const char *converterName, UErrorCode *err); * @see ucnv_compareNames * @stable ICU 2.0 */ -U_STABLE UConverter* U_EXPORT2 +U_CAPI UConverter* U_EXPORT2 ucnv_openU(const UChar *name, UErrorCode *err); @@ -460,7 +463,7 @@ ucnv_openU(const UChar *name, * @see UConverterPlatform * @stable ICU 2.0 */ -U_STABLE UConverter* U_EXPORT2 +U_CAPI UConverter* U_EXPORT2 ucnv_openCCSID(int32_t codepage, UConverterPlatform platform, UErrorCode * err); @@ -476,7 +479,7 @@ ucnv_openCCSID(int32_t codepage, *

    The name will NOT be looked up in the alias mechanism, nor will the converter be * stored in the converter cache or the alias table. The only way to open further converters * is call this function multiple times, or use the ucnv_safeClone() function to clone a - * 'master' converter.

    + * 'primary' converter.

    * *

    A future version of ICU may add alias table lookups and/or caching * to this function.

    @@ -495,7 +498,7 @@ ucnv_openCCSID(int32_t codepage, * @see ucnv_close * @stable ICU 2.2 */ -U_STABLE UConverter* U_EXPORT2 +U_CAPI UConverter* U_EXPORT2 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err); /** @@ -537,7 +540,7 @@ ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode * @return pointer to the new clone * @stable ICU 2.0 */ -U_STABLE UConverter * U_EXPORT2 +U_CAPI UConverter * U_EXPORT2 ucnv_safeClone(const UConverter *cnv, void *stackBuffer, int32_t *pBufferSize, @@ -566,7 +569,7 @@ ucnv_safeClone(const UConverter *cnv, * @see ucnv_openCCSID * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_close(UConverter * converter); #if U_SHOW_CPLUSPLUS_API @@ -605,7 +608,7 @@ U_NAMESPACE_END * @see ucnv_setSubstChars * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_getSubstChars(const UConverter *converter, char *subChars, int8_t *len, @@ -630,7 +633,7 @@ ucnv_getSubstChars(const UConverter *converter, * @see ucnv_getSubstChars * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_setSubstChars(UConverter *converter, const char *subChars, int8_t len, @@ -663,7 +666,7 @@ ucnv_setSubstChars(UConverter *converter, * @see ucnv_getSubstChars * @stable ICU 3.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_setSubstString(UConverter *cnv, const UChar *s, int32_t length, @@ -682,7 +685,7 @@ ucnv_setSubstString(UConverter *cnv, * U_INDEX_OUTOFBOUNDS_ERROR will be returned. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_getInvalidChars(const UConverter *converter, char *errBytes, int8_t *len, @@ -701,7 +704,7 @@ ucnv_getInvalidChars(const UConverter *converter, * U_INDEX_OUTOFBOUNDS_ERROR will be returned. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_getInvalidUChars(const UConverter *converter, UChar *errUChars, int8_t *len, @@ -714,7 +717,7 @@ ucnv_getInvalidUChars(const UConverter *converter, * @param converter the Unicode converter * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_reset(UConverter *converter); /** @@ -725,7 +728,7 @@ ucnv_reset(UConverter *converter); * @param converter the Unicode converter * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_resetToUnicode(UConverter *converter); /** @@ -736,7 +739,7 @@ ucnv_resetToUnicode(UConverter *converter); * @param converter the Unicode converter * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_resetFromUnicode(UConverter *converter); /** @@ -789,7 +792,7 @@ ucnv_resetFromUnicode(UConverter *converter); * @see ucnv_getMinCharSize * @stable ICU 2.0 */ -U_STABLE int8_t U_EXPORT2 +U_CAPI int8_t U_EXPORT2 ucnv_getMaxCharSize(const UConverter *converter); /** @@ -822,7 +825,7 @@ ucnv_getMaxCharSize(const UConverter *converter); * @see ucnv_getMaxCharSize * @stable ICU 2.0 */ -U_STABLE int8_t U_EXPORT2 +U_CAPI int8_t U_EXPORT2 ucnv_getMinCharSize(const UConverter *converter); /** @@ -839,7 +842,7 @@ ucnv_getMinCharSize(const UConverter *converter); * @see ucnv_getName * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucnv_getDisplayName(const UConverter *converter, const char *displayLocale, UChar *displayName, @@ -856,7 +859,7 @@ ucnv_getDisplayName(const UConverter *converter, * @see ucnv_getDisplayName * @stable ICU 2.0 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ucnv_getName(const UConverter *converter, UErrorCode *err); /** @@ -882,7 +885,7 @@ ucnv_getName(const UConverter *converter, UErrorCode *err); * @see ucnv_getPlatform * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucnv_getCCSID(const UConverter *converter, UErrorCode *err); @@ -896,7 +899,7 @@ ucnv_getCCSID(const UConverter *converter, * @return The codepage platform * @stable ICU 2.0 */ -U_STABLE UConverterPlatform U_EXPORT2 +U_CAPI UConverterPlatform U_EXPORT2 ucnv_getPlatform(const UConverter *converter, UErrorCode *err); @@ -908,14 +911,14 @@ ucnv_getPlatform(const UConverter *converter, * @return the type of the converter * @stable ICU 2.0 */ -U_STABLE UConverterType U_EXPORT2 +U_CAPI UConverterType U_EXPORT2 ucnv_getType(const UConverter * converter); /** * Gets the "starter" (lead) bytes for converters of type MBCS. * Will fill in an U_ILLEGAL_ARGUMENT_ERROR if converter passed in * is not MBCS. Fills in an array of type UBool, with the value of the byte - * as offset to the array. For example, if (starters[0x20] == TRUE) at return, + * as offset to the array. For example, if (starters[0x20] == true) at return, * it means that the byte 0x20 is a starter byte in this converter. * Context pointers are always owned by the caller. * @@ -926,7 +929,7 @@ ucnv_getType(const UConverter * converter); * @see ucnv_getType * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_getStarters(const UConverter* converter, UBool starters[256], UErrorCode* err); @@ -997,7 +1000,7 @@ typedef enum UConverterUnicodeSet { * @see uset_close * @stable ICU 2.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_getUnicodeSet(const UConverter *cnv, USet *setFillIn, UConverterUnicodeSet whichSet, @@ -1014,7 +1017,7 @@ ucnv_getUnicodeSet(const UConverter *cnv, * @see ucnv_setToUCallBack * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_getToUCallBack (const UConverter * converter, UConverterToUCallback *action, const void **context); @@ -1030,7 +1033,7 @@ ucnv_getToUCallBack (const UConverter * converter, * @see ucnv_setFromUCallBack * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_getFromUCallBack (const UConverter * converter, UConverterFromUCallback *action, const void **context); @@ -1050,7 +1053,7 @@ ucnv_getFromUCallBack (const UConverter * converter, * @see ucnv_getToUCallBack * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_setToUCallBack (UConverter * converter, UConverterToUCallback newAction, const void* newContext, @@ -1073,7 +1076,7 @@ ucnv_setToUCallBack (UConverter * converter, * @see ucnv_getFromUCallBack * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_setFromUCallBack (UConverter * converter, UConverterFromUCallback newAction, const void *newContext, @@ -1100,7 +1103,7 @@ ucnv_setFromUCallBack (UConverter * converter, * consumed. At that point, the caller should reset the source and * sourceLimit pointers to point to the next chunk. * - * At the end of the stream (flush==TRUE), the input is completely consumed + * At the end of the stream (flush==true), the input is completely consumed * when *source==sourceLimit and no error code is set. * The converter object is then automatically reset by this function. * (This means that a converter need not be reset explicitly between data @@ -1125,9 +1128,9 @@ ucnv_setFromUCallBack (UConverter * converter, * e.g: offsets[3] is equal to 6, it means that the target[3] was a result of transcoding source[6] * For output data carried across calls, and other data without a specific source character * (such as from escape sequences or callbacks) -1 will be placed for offsets. - * @param flush set to TRUE if the current source buffer is the last available - * chunk of the source, FALSE otherwise. Note that if a failing status is returned, - * this function may have to be called multiple times with flush set to TRUE until + * @param flush set to true if the current source buffer is the last available + * chunk of the source, false otherwise. Note that if a failing status is returned, + * this function may have to be called multiple times with flush set to true until * the source buffer is consumed. * @param err the error status. U_ILLEGAL_ARGUMENT_ERROR will be set if the * converter is NULL. @@ -1139,7 +1142,7 @@ ucnv_setFromUCallBack (UConverter * converter, * @see ucnv_setToUCallBack * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_fromUnicode (UConverter * converter, char **target, const char *targetLimit, @@ -1169,7 +1172,7 @@ ucnv_fromUnicode (UConverter * converter, * consumed. At that point, the caller should reset the source and * sourceLimit pointers to point to the next chunk. * - * At the end of the stream (flush==TRUE), the input is completely consumed + * At the end of the stream (flush==true), the input is completely consumed * when *source==sourceLimit and no error code is set * The converter object is then automatically reset by this function. * (This means that a converter need not be reset explicitly between data @@ -1193,9 +1196,9 @@ ucnv_fromUnicode (UConverter * converter, * e.g: offsets[3] is equal to 6, it means that the target[3] was a result of transcoding source[6] * For output data carried across calls, and other data without a specific source character * (such as from escape sequences or callbacks) -1 will be placed for offsets. - * @param flush set to TRUE if the current source buffer is the last available - * chunk of the source, FALSE otherwise. Note that if a failing status is returned, - * this function may have to be called multiple times with flush set to TRUE until + * @param flush set to true if the current source buffer is the last available + * chunk of the source, false otherwise. Note that if a failing status is returned, + * this function may have to be called multiple times with flush set to true until * the source buffer is consumed. * @param err the error status. U_ILLEGAL_ARGUMENT_ERROR will be set if the * converter is NULL. @@ -1208,7 +1211,7 @@ ucnv_fromUnicode (UConverter * converter, * @see ucnv_getNextUChar * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_toUnicode(UConverter *converter, UChar **target, const UChar *targetLimit, @@ -1245,7 +1248,7 @@ ucnv_toUnicode(UConverter *converter, * @see UCNV_GET_MAX_BYTES_FOR_STRING * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucnv_fromUChars(UConverter *cnv, char *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, @@ -1277,7 +1280,7 @@ ucnv_fromUChars(UConverter *cnv, * @see ucnv_convert * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucnv_toUChars(UConverter *cnv, UChar *dest, int32_t destCapacity, const char *src, int32_t srcLength, @@ -1295,7 +1298,7 @@ ucnv_toUChars(UConverter *cnv, * - Convenient. * * Limitations compared to ucnv_toUnicode(): - * - Always assumes flush=TRUE. + * - Always assumes flush=true. * This makes ucnv_getNextUChar() unsuitable for "streaming" conversion, * that is, for where the input is supplied in multiple buffers, * because ucnv_getNextUChar() will assume the end of the input at the end @@ -1306,7 +1309,7 @@ ucnv_toUChars(UConverter *cnv, * ucnv_getNextUChar() uses the current state of the converter * (unlike ucnv_toUChars() which always resets first). * However, if ucnv_getNextUChar() is called after ucnv_toUnicode() - * stopped in the middle of a character sequence (with flush=FALSE), + * stopped in the middle of a character sequence (with flush=false), * then ucnv_getNextUChar() will always use the slower ucnv_toUnicode() * internally until the next character boundary. * (This is new in ICU 2.6. In earlier releases, ucnv_getNextUChar() had to @@ -1353,7 +1356,7 @@ ucnv_toUChars(UConverter *cnv, * @see ucnv_convert * @stable ICU 2.0 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 ucnv_getNextUChar(UConverter * converter, const char **source, const char * sourceLimit, @@ -1385,7 +1388,7 @@ ucnv_getNextUChar(UConverter * converter, * * ucnv_convertEx() also provides further convenience: * - an option to reset the converters at the beginning - * (if reset==TRUE, see parameters; + * (if reset==true, see parameters; * also sets *pivotTarget=*pivotSource=pivotStart) * - allow NUL-terminated input * (only a single NUL byte, will not work for charsets with multi-byte NULs) @@ -1442,7 +1445,7 @@ ucnv_getNextUChar(UConverter * converter, * &target, u8+capacity, * &s, s+length, * NULL, NULL, NULL, NULL, - * TRUE, TRUE, + * true, true, * pErrorCode); * * myReleaseCachedUTF8Converter(utf8Cnv); @@ -1474,7 +1477,7 @@ ucnv_getNextUChar(UConverter * converter, * It must be pivotStart<=*pivotSource<=*pivotTarget<=pivotLimit * and pivotStartNULL is returned. Owned by the library. * @stable ICU 2.0 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode); /** @@ -1853,7 +1856,7 @@ ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorC * @see ucnv_getStandardName * @stable ICU 2.4 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode); /** @@ -1870,7 +1873,7 @@ ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErro * @see ucnv_setDefaultName * @stable ICU 2.0 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ucnv_getDefaultName(void); #ifndef U_HIDE_SYSTEM_API @@ -1890,7 +1893,7 @@ ucnv_getDefaultName(void); * @system * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_setDefaultName(const char *name); #endif /* U_HIDE_SYSTEM_API */ @@ -1911,18 +1914,18 @@ ucnv_setDefaultName(const char *name); * @see ucnv_isAmbiguous * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen); /** * Determines if the converter contains ambiguous mappings of the same * character or not. * @param cnv the converter to be tested - * @return TRUE if the converter contains ambiguous mapping of the same - * character, FALSE otherwise. + * @return true if the converter contains ambiguous mapping of the same + * character, false otherwise. * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucnv_isAmbiguous(const UConverter *cnv); /** @@ -1935,12 +1938,12 @@ ucnv_isAmbiguous(const UConverter *cnv); * http://www.icu-project.org/userguide/conversion-data.html#ucmformat * * @param cnv The converter to set the fallback mapping usage on. - * @param usesFallback TRUE if the user wants the converter to take advantage of the fallback - * mapping, FALSE otherwise. + * @param usesFallback true if the user wants the converter to take advantage of the fallback + * mapping, false otherwise. * @stable ICU 2.0 * @see ucnv_usesFallback */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_setFallback(UConverter *cnv, UBool usesFallback); /** @@ -1948,11 +1951,11 @@ ucnv_setFallback(UConverter *cnv, UBool usesFallback); * This flag has restrictions, see ucnv_setFallback(). * * @param cnv The converter to be tested - * @return TRUE if the converter uses fallback, FALSE otherwise. + * @return true if the converter uses fallback, false otherwise. * @stable ICU 2.0 * @see ucnv_setFallback */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucnv_usesFallback(const UConverter *cnv); /** @@ -1984,7 +1987,7 @@ ucnv_usesFallback(const UConverter *cnv); * @return The name of the encoding detected. NULL if encoding is not detected. * @stable ICU 2.4 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 ucnv_detectUnicodeSignature(const char* source, int32_t sourceLength, int32_t *signatureLength, @@ -2001,7 +2004,7 @@ ucnv_detectUnicodeSignature(const char* source, * @return The number of UChars in the state. -1 if an error is encountered. * @stable ICU 3.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status); /** @@ -2015,7 +2018,7 @@ ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status); * @return The number of chars in the state. -1 if an error is encountered. * @stable ICU 3.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status); /** @@ -2027,13 +2030,13 @@ ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status); * but a UTF-32 converter encodes each code point with 4 bytes. * Note: This method is not intended to be used to determine whether the charset has a * fixed ratio of bytes to Unicode codes units for any particular Unicode encoding form. - * FALSE is returned with the UErrorCode if error occurs or cnv is NULL. + * false is returned with the UErrorCode if error occurs or cnv is NULL. * @param cnv The converter to be tested * @param status ICU error code in/out paramter - * @return TRUE if the converter is fixed-width + * @return true if the converter is fixed-width * @stable ICU 4.8 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status); #endif diff --git a/deps/icu-small/source/common/unicode/ucnv_cb.h b/deps/icu-small/source/common/unicode/ucnv_cb.h index 632cc0b35f26c5..18240990dbaed9 100644 --- a/deps/icu-small/source/common/unicode/ucnv_cb.h +++ b/deps/icu-small/source/common/unicode/ucnv_cb.h @@ -84,7 +84,7 @@ * @see ucnv_cbFromUWriteSub * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_cbFromUWriteBytes (UConverterFromUnicodeArgs *args, const char* source, int32_t length, @@ -104,7 +104,7 @@ ucnv_cbFromUWriteBytes (UConverterFromUnicodeArgs *args, * @see ucnv_cbFromUWriteBytes * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnv_cbFromUWriteSub (UConverterFromUnicodeArgs *args, int32_t offsetIndex, UErrorCode * err); @@ -121,7 +121,7 @@ ucnv_cbFromUWriteSub (UConverterFromUnicodeArgs *args, * @see ucnv_cbToUWriteSub * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args, +U_CAPI void U_EXPORT2 ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args, const UChar** source, const UChar* sourceLimit, int32_t offsetIndex, @@ -140,7 +140,7 @@ U_STABLE void U_EXPORT2 ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args, * @see ucnv_cbToUWriteSub * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 ucnv_cbToUWriteUChars (UConverterToUnicodeArgs *args, +U_CAPI void U_EXPORT2 ucnv_cbToUWriteUChars (UConverterToUnicodeArgs *args, const UChar* source, int32_t length, int32_t offsetIndex, @@ -156,7 +156,7 @@ U_STABLE void U_EXPORT2 ucnv_cbToUWriteUChars (UConverterToUnicodeArgs *args, * @see ucnv_cbToUWriteUChars * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 ucnv_cbToUWriteSub (UConverterToUnicodeArgs *args, +U_CAPI void U_EXPORT2 ucnv_cbToUWriteSub (UConverterToUnicodeArgs *args, int32_t offsetIndex, UErrorCode * err); #endif diff --git a/deps/icu-small/source/common/unicode/ucnv_err.h b/deps/icu-small/source/common/unicode/ucnv_err.h index 08c96c14407c22..bff90f0ba1e1d4 100644 --- a/deps/icu-small/source/common/unicode/ucnv_err.h +++ b/deps/icu-small/source/common/unicode/ucnv_err.h @@ -193,7 +193,7 @@ typedef enum { */ typedef struct { uint16_t size; /**< The size of this struct. @stable ICU 2.0 */ - UBool flush; /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0 */ + UBool flush; /**< The internal state of converter will be reset and data flushed if set to true. @stable ICU 2.0 */ UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */ const UChar *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */ const UChar *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */ @@ -209,7 +209,7 @@ typedef struct { */ typedef struct { uint16_t size; /**< The size of this struct @stable ICU 2.0 */ - UBool flush; /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0 */ + UBool flush; /**< The internal state of converter will be reset and data flushed if set to true. @stable ICU 2.0 */ UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */ const char *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */ const char *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */ @@ -233,7 +233,7 @@ typedef struct { * @param err This should always be set to a failure status prior to calling. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP ( +U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP ( const void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar* codeUnits, @@ -257,7 +257,7 @@ U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP ( * @param err This should always be set to a failure status prior to calling. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP ( +U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP ( const void *context, UConverterToUnicodeArgs *toUArgs, const char* codeUnits, @@ -284,7 +284,7 @@ U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP ( * otherwise this value will be set to a failure status. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP ( +U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP ( const void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar* codeUnits, @@ -314,7 +314,7 @@ U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP ( * @see ucnv_setSubstChars * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE ( +U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE ( const void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar* codeUnits, @@ -370,7 +370,7 @@ U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE ( * otherwise this value will be set to a failure status. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE ( +U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE ( const void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar* codeUnits, @@ -398,7 +398,7 @@ U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE ( * otherwise this value will be set to a failure status. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP ( +U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP ( const void *context, UConverterToUnicodeArgs *toUArgs, const char* codeUnits, @@ -424,7 +424,7 @@ U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP ( * otherwise this value will be set to a failure status. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE ( +U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE ( const void *context, UConverterToUnicodeArgs *toUArgs, const char* codeUnits, @@ -450,7 +450,7 @@ U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE ( * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE ( +U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE ( const void *context, UConverterToUnicodeArgs *toUArgs, const char* codeUnits, diff --git a/deps/icu-small/source/common/unicode/ucnvsel.h b/deps/icu-small/source/common/unicode/ucnvsel.h index 5fee53f179ace7..b84bc86bed2659 100644 --- a/deps/icu-small/source/common/unicode/ucnvsel.h +++ b/deps/icu-small/source/common/unicode/ucnvsel.h @@ -29,7 +29,10 @@ #include "unicode/utf16.h" #include "unicode/uenum.h" #include "unicode/ucnv.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** * \file @@ -72,7 +75,7 @@ typedef struct UConverterSelector UConverterSelector; * * @stable ICU 4.2 */ -U_STABLE UConverterSelector* U_EXPORT2 +U_CAPI UConverterSelector* U_EXPORT2 ucnvsel_open(const char* const* converterList, int32_t converterListSize, const USet* excludedCodePoints, const UConverterUnicodeSet whichSet, UErrorCode* status); @@ -90,7 +93,7 @@ ucnvsel_open(const char* const* converterList, int32_t converterListSize, * * @stable ICU 4.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucnvsel_close(UConverterSelector *sel); #if U_SHOW_CPLUSPLUS_API @@ -127,7 +130,7 @@ U_NAMESPACE_END * * @stable ICU 4.2 */ -U_STABLE UConverterSelector* U_EXPORT2 +U_CAPI UConverterSelector* U_EXPORT2 ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* status); /** @@ -144,7 +147,7 @@ ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* statu * * @stable ICU 4.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucnvsel_serialize(const UConverterSelector* sel, void* buffer, int32_t bufferCapacity, UErrorCode* status); @@ -162,7 +165,7 @@ ucnvsel_serialize(const UConverterSelector* sel, * * @stable ICU 4.2 */ -U_STABLE UEnumeration * U_EXPORT2 +U_CAPI UEnumeration * U_EXPORT2 ucnvsel_selectForString(const UConverterSelector* sel, const UChar *s, int32_t length, UErrorCode *status); @@ -180,7 +183,7 @@ ucnvsel_selectForString(const UConverterSelector* sel, * * @stable ICU 4.2 */ -U_STABLE UEnumeration * U_EXPORT2 +U_CAPI UEnumeration * U_EXPORT2 ucnvsel_selectForUTF8(const UConverterSelector* sel, const char *s, int32_t length, UErrorCode *status); diff --git a/deps/icu-small/source/common/unicode/ucptrie.h b/deps/icu-small/source/common/unicode/ucptrie.h index be06a227928286..b95491b183e9af 100644 --- a/deps/icu-small/source/common/unicode/ucptrie.h +++ b/deps/icu-small/source/common/unicode/ucptrie.h @@ -8,11 +8,13 @@ #define __UCPTRIE_H__ #include "unicode/utypes.h" - -#include "unicode/localpointer.h" #include "unicode/ucpmap.h" #include "unicode/utf8.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + U_CDECL_BEGIN /** @@ -580,11 +582,11 @@ enum { // Do not conditionalize with #ifndef U_HIDE_INTERNAL_API, needed for public API /** @internal */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucptrie_internalSmallIndex(const UCPTrie *trie, UChar32 c); /** @internal */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucptrie_internalSmallU8Index(const UCPTrie *trie, int32_t lt1, uint8_t t2, uint8_t t3); /** @@ -592,7 +594,7 @@ ucptrie_internalSmallU8Index(const UCPTrie *trie, int32_t lt1, uint8_t t2, uint8 * Do not call directly. * @internal */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucptrie_internalU8PrevIndex(const UCPTrie *trie, UChar32 c, const uint8_t *start, const uint8_t *src); diff --git a/deps/icu-small/source/common/unicode/ucurr.h b/deps/icu-small/source/common/unicode/ucurr.h index 7149e7adf13067..4e115cd01e0fb6 100644 --- a/deps/icu-small/source/common/unicode/ucurr.h +++ b/deps/icu-small/source/common/unicode/ucurr.h @@ -78,7 +78,7 @@ typedef enum UCurrencyUsage UCurrencyUsage; * invalid. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucurr_forLocale(const char* locale, UChar* buff, int32_t buffCapacity, @@ -113,7 +113,29 @@ typedef enum UCurrNameStyle { * * @stable ICU 61 */ - UCURR_NARROW_SYMBOL_NAME + UCURR_NARROW_SYMBOL_NAME, + +#ifndef U_HIDE_DRAFT_API + /** + * Selector for getName() indicating the formal currency symbol. + * The formal currency symbol is similar to the regular currency + * symbol, but it always takes the form used in formal settings + * such as banking; for example, "NT$" instead of "$" for TWD in zh-TW. + * + * @draft ICU 68 + */ + UCURR_FORMAL_SYMBOL_NAME, + + /** + * Selector for getName() indicating the variant currency symbol. + * The variant symbol for a currency is an alternative symbol + * that is not necessarily as widely used as the regular symbol. + * + * @draft ICU 68 + */ + UCURR_VARIANT_SYMBOL_NAME +#endif // U_HIDE_DRAFT_API + } UCurrNameStyle; #if !UCONFIG_NO_SERVICE @@ -133,7 +155,7 @@ typedef const void* UCurrRegistryKey; * if there was an error. * @stable ICU 2.6 */ -U_STABLE UCurrRegistryKey U_EXPORT2 +U_CAPI UCurrRegistryKey U_EXPORT2 ucurr_register(const UChar* isoCode, const char* locale, UErrorCode* status); @@ -145,10 +167,10 @@ ucurr_register(const UChar* isoCode, * restored. * @param key the registry key returned by a previous call to ucurr_register * @param status the in/out status code, no special meanings are assigned - * @return TRUE if the currency for this key was successfully unregistered + * @return true if the currency for this key was successfully unregistered * @stable ICU 2.6 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucurr_unregister(UCurrRegistryKey key, UErrorCode* status); #endif /* UCONFIG_NO_SERVICE */ @@ -159,7 +181,7 @@ ucurr_unregister(UCurrRegistryKey key, UErrorCode* status); * @param currency null-terminated 3-letter ISO 4217 code * @param locale locale in which to display currency * @param nameStyle selector for which kind of name to return - * @param isChoiceFormat always set to FALSE, or can be NULL; + * @param isChoiceFormat always set to false, or can be NULL; * display names are static strings; * since ICU 4.4, ChoiceFormat patterns are no longer supported * @param len fill-in parameter to receive length of result @@ -169,7 +191,7 @@ ucurr_unregister(UCurrRegistryKey key, UErrorCode* status); * returned. * @stable ICU 2.6 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ucurr_getName(const UChar* currency, const char* locale, UCurrNameStyle nameStyle, @@ -183,7 +205,7 @@ ucurr_getName(const UChar* currency, * currency object in the en_US locale is "US dollar" or "US dollars". * @param currency null-terminated 3-letter ISO 4217 code * @param locale locale in which to display currency - * @param isChoiceFormat always set to FALSE, or can be NULL; + * @param isChoiceFormat always set to false, or can be NULL; * display names are static strings; * since ICU 4.4, ChoiceFormat patterns are no longer supported * @param pluralCount plural count @@ -194,7 +216,7 @@ ucurr_getName(const UChar* currency, * returned. * @stable ICU 4.2 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ucurr_getPluralName(const UChar* currency, const char* locale, UBool* isChoiceFormat, @@ -219,7 +241,7 @@ ucurr_getPluralName(const UChar* currency, * displayed, or 0 if there is an error * @stable ICU 3.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucurr_getDefaultFractionDigits(const UChar* currency, UErrorCode* ec); @@ -240,7 +262,7 @@ ucurr_getDefaultFractionDigits(const UChar* currency, * displayed, or 0 if there is an error * @stable ICU 54 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucurr_getDefaultFractionDigitsForUsage(const UChar* currency, const UCurrencyUsage usage, UErrorCode* ec); @@ -255,7 +277,7 @@ ucurr_getDefaultFractionDigitsForUsage(const UChar* currency, * or 0.0 if there is an error * @stable ICU 3.0 */ -U_STABLE double U_EXPORT2 +U_CAPI double U_EXPORT2 ucurr_getRoundingIncrement(const UChar* currency, UErrorCode* ec); @@ -269,7 +291,7 @@ ucurr_getRoundingIncrement(const UChar* currency, * or 0.0 if there is an error * @stable ICU 54 */ -U_STABLE double U_EXPORT2 +U_CAPI double U_EXPORT2 ucurr_getRoundingIncrementForUsage(const UChar* currency, const UCurrencyUsage usage, UErrorCode* ec); @@ -326,7 +348,7 @@ typedef enum UCurrCurrencyType { * @param pErrorCode Error code * @stable ICU 3.2 */ -U_STABLE UEnumeration * U_EXPORT2 +U_CAPI UEnumeration * U_EXPORT2 ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode); /** @@ -351,11 +373,11 @@ ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode); * @param errorCode * ICU error code * - * @return TRUE if the given ISO 4217 3-letter code is supported on the specified date range. + * @return true if the given ISO 4217 3-letter code is supported on the specified date range. * * @stable ICU 4.8 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucurr_isAvailable(const UChar* isoCode, UDate from, UDate to, @@ -375,7 +397,7 @@ ucurr_isAvailable(const UChar* isoCode, * values are invalid. * @stable ICU 4.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucurr_countCurrencies(const char* locale, UDate date, UErrorCode* ec); @@ -399,7 +421,7 @@ ucurr_countCurrencies(const char* locale, * invalid. * @stable ICU 4.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucurr_forLocaleAndDate(const char* locale, UDate date, int32_t index, @@ -423,7 +445,7 @@ ucurr_forLocaleAndDate(const char* locale, * @return a string enumeration over keyword values for the given key and the locale. * @stable ICU 4.2 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 ucurr_getKeywordValuesForLocale(const char* key, const char* locale, UBool commonlyUsed, @@ -438,7 +460,7 @@ ucurr_getKeywordValuesForLocale(const char* key, * @return The ISO 4217 numeric code of the currency * @stable ICU 49 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucurr_getNumericCode(const UChar* currency); #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/common/unicode/udata.h b/deps/icu-small/source/common/unicode/udata.h index 8236877b443d3d..88c0dded118d00 100644 --- a/deps/icu-small/source/common/unicode/udata.h +++ b/deps/icu-small/source/common/unicode/udata.h @@ -20,7 +20,10 @@ #define __UDATA_H__ #include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API U_CDECL_BEGIN @@ -166,8 +169,8 @@ typedef struct UDataMemory UDataMemory; * @param pInfo A pointer to the UDataInfo structure * of data that has been loaded and will be returned * by udata_openChoice() if this function - * returns TRUE. - * @return TRUE if the current data memory is acceptable + * returns true. + * @return true if the current data memory is acceptable * @stable ICU 2.0 */ typedef UBool U_CALLCONV @@ -197,7 +200,7 @@ UDataMemoryIsAcceptable(void *context, * @see udata_openChoice * @stable ICU 2.0 */ -U_STABLE UDataMemory * U_EXPORT2 +U_CAPI UDataMemory * U_EXPORT2 udata_open(const char *path, const char *type, const char *name, UErrorCode *pErrorCode); @@ -239,7 +242,7 @@ udata_open(const char *path, const char *type, const char *name, * This may be NULL or empty. * @param name A string that specifies the name of the data. * @param isAcceptable This function is called to verify that loaded data - * is useful for the client code. If it returns FALSE + * is useful for the client code. If it returns false * for all data items, then udata_openChoice() * will return with an error. * @param context Arbitrary parameter to be passed into isAcceptable. @@ -249,7 +252,7 @@ udata_open(const char *path, const char *type, const char *name, * to get a pointer to the actual data. * @stable ICU 2.0 */ -U_STABLE UDataMemory * U_EXPORT2 +U_CAPI UDataMemory * U_EXPORT2 udata_openChoice(const char *path, const char *type, const char *name, UDataMemoryIsAcceptable *isAcceptable, void *context, UErrorCode *pErrorCode); @@ -261,7 +264,7 @@ udata_openChoice(const char *path, const char *type, const char *name, * @param pData The pointer to data memory object * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 udata_close(UDataMemory *pData); /** @@ -273,7 +276,7 @@ udata_close(UDataMemory *pData); * @param pData The pointer to data memory object * @stable ICU 2.0 */ -U_STABLE const void * U_EXPORT2 +U_CAPI const void * U_EXPORT2 udata_getMemory(UDataMemory *pData); /** @@ -294,7 +297,7 @@ udata_getMemory(UDataMemory *pData); * adjusted and only part of the structure will be filled. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 udata_getInfo(UDataMemory *pData, UDataInfo *pInfo); /** @@ -303,7 +306,7 @@ udata_getInfo(UDataMemory *pData, UDataInfo *pInfo); * area in memory. * * ICU data must be at least 8-aligned, and should be 16-aligned. - * See http://userguide.icu-project.org/icudata + * See https://unicode-org.github.io/icu/userguide/icudata * * The format of this data is that of the icu common data file, as is * generated by the pkgdata tool with mode=common or mode=dll. @@ -340,7 +343,7 @@ udata_getInfo(UDataMemory *pData, UDataInfo *pInfo); * @param err outgoing error status U_USING_DEFAULT_WARNING, U_UNSUPPORTED_ERROR * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 udata_setCommonData(const void *data, UErrorCode *err); @@ -350,7 +353,7 @@ udata_setCommonData(const void *data, UErrorCode *err); * pointer. * * ICU data must be at least 8-aligned, and should be 16-aligned. - * See http://userguide.icu-project.org/icudata + * See https://unicode-org.github.io/icu/userguide/icudata * * The format of this data is that of the icu common data file, like 'icudt26l.dat' * or the corresponding shared library (DLL) file. @@ -371,7 +374,7 @@ udata_setCommonData(const void *data, UErrorCode *err); * @see udata_setCommonData * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 udata_setAppData(const char *packageName, const void *data, UErrorCode *err); /** @@ -410,7 +413,7 @@ typedef enum UDataFileAccess { * @see UDataFileAccess * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 udata_setFileAccess(UDataFileAccess access, UErrorCode *status); U_CDECL_END diff --git a/deps/icu-small/source/common/unicode/udisplaycontext.h b/deps/icu-small/source/common/unicode/udisplaycontext.h index 398481c6812247..6e1421798054f6 100644 --- a/deps/icu-small/source/common/unicode/udisplaycontext.h +++ b/deps/icu-small/source/common/unicode/udisplaycontext.h @@ -156,7 +156,8 @@ enum UDisplayContext { UDISPCTX_SUBSTITUTE = (UDISPCTX_TYPE_SUBSTITUTE_HANDLING<<8) + 0, /** * A possible setting for SUBSTITUTE_HANDLING: - * Returns a null value when no data is available. + * Returns a null value with error code set to U_ILLEGAL_ARGUMENT_ERROR when no + * data is available. * @stable ICU 58 */ UDISPCTX_NO_SUBSTITUTE = (UDISPCTX_TYPE_SUBSTITUTE_HANDLING<<8) + 1 diff --git a/deps/icu-small/source/common/unicode/uenum.h b/deps/icu-small/source/common/unicode/uenum.h index eb8ecdf88b6ec5..f1c506934bec87 100644 --- a/deps/icu-small/source/common/unicode/uenum.h +++ b/deps/icu-small/source/common/unicode/uenum.h @@ -20,13 +20,14 @@ #define __UENUM_H #include "unicode/utypes.h" -#include "unicode/localpointer.h" #if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" + U_NAMESPACE_BEGIN class StringEnumeration; U_NAMESPACE_END -#endif +#endif // U_SHOW_CPLUSPLUS_API /** * \file @@ -49,7 +50,7 @@ typedef struct UEnumeration UEnumeration; * @param en UEnumeration structure pointer * @stable ICU 2.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uenum_close(UEnumeration* en); #if U_SHOW_CPLUSPLUS_API @@ -85,7 +86,7 @@ U_NAMESPACE_END * @return number of elements in the iterator * @stable ICU 2.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uenum_count(UEnumeration* en, UErrorCode* status); /** @@ -109,7 +110,7 @@ uenum_count(UEnumeration* en, UErrorCode* status); * traversed, returns NULL. * @stable ICU 2.2 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 uenum_unext(UEnumeration* en, int32_t* resultLength, UErrorCode* status); @@ -142,7 +143,7 @@ uenum_unext(UEnumeration* en, * traversed, returns NULL. * @stable ICU 2.2 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uenum_next(UEnumeration* en, int32_t* resultLength, UErrorCode* status); @@ -156,7 +157,7 @@ uenum_next(UEnumeration* en, * the iterator is out of sync with its service. * @stable ICU 2.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uenum_reset(UEnumeration* en, UErrorCode* status); #if U_SHOW_CPLUSPLUS_API @@ -170,7 +171,7 @@ uenum_reset(UEnumeration* en, UErrorCode* status); * @return a UEnumeration wrapping the adopted StringEnumeration. * @stable ICU 4.2 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 uenum_openFromStringEnumeration(icu::StringEnumeration* adopted, UErrorCode* ec); #endif @@ -186,7 +187,7 @@ uenum_openFromStringEnumeration(icu::StringEnumeration* adopted, UErrorCode* ec) * @see uenum_close * @stable ICU 50 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 uenum_openUCharStringsEnumeration(const UChar* const strings[], int32_t count, UErrorCode* ec); @@ -201,7 +202,7 @@ uenum_openUCharStringsEnumeration(const UChar* const strings[], int32_t count, * @see uenum_close * @stable ICU 50 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 uenum_openCharStringsEnumeration(const char* const strings[], int32_t count, UErrorCode* ec); diff --git a/deps/icu-small/source/common/unicode/uidna.h b/deps/icu-small/source/common/unicode/uidna.h index cb79ba8545008e..1f75562555c3c2 100644 --- a/deps/icu-small/source/common/unicode/uidna.h +++ b/deps/icu-small/source/common/unicode/uidna.h @@ -23,9 +23,13 @@ #if !UCONFIG_NO_IDNA -#include "unicode/localpointer.h" +#include #include "unicode/parseerr.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + /** * \file * \brief C API: Internationalizing Domain Names in Applications (IDNA) @@ -138,7 +142,7 @@ typedef struct UIDNA UIDNA; /**< C typedef for struct UIDNA. @stable ICU 4.6 */ * @return the UTS #46 UIDNA instance, if successful * @stable ICU 4.6 */ -U_STABLE UIDNA * U_EXPORT2 +U_CAPI UIDNA * U_EXPORT2 uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode); /** @@ -146,7 +150,7 @@ uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode); * @param idna UIDNA instance to be closed * @stable ICU 4.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uidna_close(UIDNA *idna); #if U_SHOW_CPLUSPLUS_API @@ -182,7 +186,7 @@ typedef struct UIDNAInfo { /** sizeof(UIDNAInfo) @stable ICU 4.6 */ int16_t size; /** - * Set to TRUE if transitional and nontransitional processing produce different results. + * Set to true if transitional and nontransitional processing produce different results. * For details see C++ IDNAInfo::isTransitionalDifferent(). * @stable ICU 4.6 */ @@ -204,7 +208,7 @@ typedef struct UIDNAInfo { */ #define UIDNA_INFO_INITIALIZER { \ (int16_t)sizeof(UIDNAInfo), \ - FALSE, FALSE, \ + false, false, \ 0, 0, 0 } /** @@ -230,7 +234,7 @@ typedef struct UIDNAInfo { * @return destination string length * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uidna_labelToASCII(const UIDNA *idna, const UChar *label, int32_t length, UChar *dest, int32_t capacity, @@ -257,7 +261,7 @@ uidna_labelToASCII(const UIDNA *idna, * @return destination string length * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uidna_labelToUnicode(const UIDNA *idna, const UChar *label, int32_t length, UChar *dest, int32_t capacity, @@ -286,7 +290,7 @@ uidna_labelToUnicode(const UIDNA *idna, * @return destination string length * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uidna_nameToASCII(const UIDNA *idna, const UChar *name, int32_t length, UChar *dest, int32_t capacity, @@ -313,7 +317,7 @@ uidna_nameToASCII(const UIDNA *idna, * @return destination string length * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uidna_nameToUnicode(const UIDNA *idna, const UChar *name, int32_t length, UChar *dest, int32_t capacity, @@ -338,7 +342,7 @@ uidna_nameToUnicode(const UIDNA *idna, * @return destination string length * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uidna_labelToASCII_UTF8(const UIDNA *idna, const char *label, int32_t length, char *dest, int32_t capacity, @@ -361,7 +365,7 @@ uidna_labelToASCII_UTF8(const UIDNA *idna, * @return destination string length * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uidna_labelToUnicodeUTF8(const UIDNA *idna, const char *label, int32_t length, char *dest, int32_t capacity, @@ -384,7 +388,7 @@ uidna_labelToUnicodeUTF8(const UIDNA *idna, * @return destination string length * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uidna_nameToASCII_UTF8(const UIDNA *idna, const char *name, int32_t length, char *dest, int32_t capacity, @@ -407,7 +411,7 @@ uidna_nameToASCII_UTF8(const UIDNA *idna, * @return destination string length * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uidna_nameToUnicodeUTF8(const UIDNA *idna, const char *name, int32_t length, char *dest, int32_t capacity, diff --git a/deps/icu-small/source/common/unicode/uiter.h b/deps/icu-small/source/common/unicode/uiter.h index 3b8537204cecfa..7dbe1266668f24 100644 --- a/deps/icu-small/source/common/unicode/uiter.h +++ b/deps/icu-small/source/common/unicode/uiter.h @@ -492,7 +492,7 @@ struct UCharIterator { * @see UnicodeString::char32At() * @stable ICU 2.1 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 uiter_current32(UCharIterator *iter); /** @@ -509,7 +509,7 @@ uiter_current32(UCharIterator *iter); * @see U16_NEXT * @stable ICU 2.1 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 uiter_next32(UCharIterator *iter); /** @@ -526,7 +526,7 @@ uiter_next32(UCharIterator *iter); * @see U16_PREV * @stable ICU 2.1 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 uiter_previous32(UCharIterator *iter); /** @@ -547,7 +547,7 @@ uiter_previous32(UCharIterator *iter); * @see UITER_NO_STATE * @stable ICU 2.6 */ -U_STABLE uint32_t U_EXPORT2 +U_CAPI uint32_t U_EXPORT2 uiter_getState(const UCharIterator *iter); /** @@ -565,7 +565,7 @@ uiter_getState(const UCharIterator *iter); * @see UCharIteratorSetState * @stable ICU 2.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode); /** @@ -590,7 +590,7 @@ uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode); * @see UCharIterator * @stable ICU 2.1 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uiter_setString(UCharIterator *iter, const UChar *s, int32_t length); /** @@ -613,7 +613,7 @@ uiter_setString(UCharIterator *iter, const UChar *s, int32_t length); * @see uiter_setString * @stable ICU 2.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length); /** @@ -649,7 +649,7 @@ uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length); * @see UCharIterator * @stable ICU 2.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length); #if U_SHOW_CPLUSPLUS_API @@ -674,7 +674,7 @@ uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length); * @see UCharIterator * @stable ICU 2.1 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uiter_setCharacterIterator(UCharIterator *iter, icu::CharacterIterator *charIter); /** @@ -699,7 +699,7 @@ uiter_setCharacterIterator(UCharIterator *iter, icu::CharacterIterator *charIter * @see UCharIterator * @stable ICU 2.1 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uiter_setReplaceable(UCharIterator *iter, const icu::Replaceable *rep); #endif diff --git a/deps/icu-small/source/common/unicode/uldnames.h b/deps/icu-small/source/common/unicode/uldnames.h index 3a3c0a06573c36..10f0e91e5526e4 100644 --- a/deps/icu-small/source/common/unicode/uldnames.h +++ b/deps/icu-small/source/common/unicode/uldnames.h @@ -16,10 +16,13 @@ */ #include "unicode/utypes.h" -#include "unicode/localpointer.h" #include "unicode/uscript.h" #include "unicode/udisplaycontext.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + /** * Enum used in LocaleDisplayNames::createInstance. * @stable ICU 4.4 @@ -65,7 +68,7 @@ typedef struct ULocaleDisplayNames ULocaleDisplayNames; * @param pErrorCode the status code * @stable ICU 4.4 */ -U_STABLE ULocaleDisplayNames * U_EXPORT2 +U_CAPI ULocaleDisplayNames * U_EXPORT2 uldn_open(const char * locale, UDialectHandling dialectHandling, UErrorCode *pErrorCode); @@ -75,7 +78,7 @@ uldn_open(const char * locale, * @param ldn the ULocaleDisplayNames instance to be closed * @stable ICU 4.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uldn_close(ULocaleDisplayNames *ldn); #if U_SHOW_CPLUSPLUS_API @@ -106,7 +109,7 @@ U_NAMESPACE_END * @return the display locale * @stable ICU 4.4 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 uldn_getLocale(const ULocaleDisplayNames *ldn); /** @@ -115,7 +118,7 @@ uldn_getLocale(const ULocaleDisplayNames *ldn); * @return the dialect handling enum * @stable ICU 4.4 */ -U_STABLE UDialectHandling U_EXPORT2 +U_CAPI UDialectHandling U_EXPORT2 uldn_getDialectHandling(const ULocaleDisplayNames *ldn); /* names for entire locales */ @@ -131,7 +134,7 @@ uldn_getDialectHandling(const ULocaleDisplayNames *ldn); * greater than maxResultSize, the returned name will be truncated. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uldn_localeDisplayName(const ULocaleDisplayNames *ldn, const char *locale, UChar *result, @@ -151,7 +154,7 @@ uldn_localeDisplayName(const ULocaleDisplayNames *ldn, * greater than maxResultSize, the returned name will be truncated. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uldn_languageDisplayName(const ULocaleDisplayNames *ldn, const char *lang, UChar *result, @@ -169,7 +172,7 @@ uldn_languageDisplayName(const ULocaleDisplayNames *ldn, * greater than maxResultSize, the returned name will be truncated. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uldn_scriptDisplayName(const ULocaleDisplayNames *ldn, const char *script, UChar *result, @@ -187,7 +190,7 @@ uldn_scriptDisplayName(const ULocaleDisplayNames *ldn, * greater than maxResultSize, the returned name will be truncated. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uldn_scriptCodeDisplayName(const ULocaleDisplayNames *ldn, UScriptCode scriptCode, UChar *result, @@ -205,7 +208,7 @@ uldn_scriptCodeDisplayName(const ULocaleDisplayNames *ldn, * greater than maxResultSize, the returned name will be truncated. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uldn_regionDisplayName(const ULocaleDisplayNames *ldn, const char *region, UChar *result, @@ -223,7 +226,7 @@ uldn_regionDisplayName(const ULocaleDisplayNames *ldn, * greater than maxResultSize, the returned name will be truncated. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uldn_variantDisplayName(const ULocaleDisplayNames *ldn, const char *variant, UChar *result, @@ -241,7 +244,7 @@ uldn_variantDisplayName(const ULocaleDisplayNames *ldn, * greater than maxResultSize, the returned name will be truncated. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uldn_keyDisplayName(const ULocaleDisplayNames *ldn, const char *key, UChar *result, @@ -260,7 +263,7 @@ uldn_keyDisplayName(const ULocaleDisplayNames *ldn, * greater than maxResultSize, the returned name will be truncated. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn, const char *key, const char *value, @@ -282,7 +285,7 @@ uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn, * @return a ULocaleDisplayNames instance * @stable ICU 51 */ -U_STABLE ULocaleDisplayNames * U_EXPORT2 +U_CAPI ULocaleDisplayNames * U_EXPORT2 uldn_openForContext(const char * locale, UDisplayContext *contexts, int32_t length, UErrorCode *pErrorCode); @@ -296,7 +299,7 @@ uldn_openForContext(const char * locale, UDisplayContext *contexts, * @return the UDisplayContextValue for the specified type. * @stable ICU 51 */ -U_STABLE UDisplayContext U_EXPORT2 +U_CAPI UDisplayContext U_EXPORT2 uldn_getContext(const ULocaleDisplayNames *ldn, UDisplayContextType type, UErrorCode *pErrorCode); diff --git a/deps/icu-small/source/common/unicode/uloc.h b/deps/icu-small/source/common/unicode/uloc.h index a10ab526cec141..56fb4c9b3769e0 100644 --- a/deps/icu-small/source/common/unicode/uloc.h +++ b/deps/icu-small/source/common/unicode/uloc.h @@ -371,7 +371,7 @@ typedef enum { * @system * @stable ICU 2.0 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uloc_getDefault(void); /** @@ -391,7 +391,7 @@ uloc_getDefault(void); * @system * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uloc_setDefault(const char* localeID, UErrorCode* status); #endif /* U_HIDE_SYSTEM_API */ @@ -408,7 +408,7 @@ uloc_setDefault(const char* localeID, * than languageCapacity, the returned language code will be truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getLanguage(const char* localeID, char* language, int32_t languageCapacity, @@ -426,7 +426,7 @@ uloc_getLanguage(const char* localeID, * than scriptCapacity, the returned language code will be truncated. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getScript(const char* localeID, char* script, int32_t scriptCapacity, @@ -444,7 +444,7 @@ uloc_getScript(const char* localeID, * than countryCapacity, the returned country code will be truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getCountry(const char* localeID, char* country, int32_t countryCapacity, @@ -462,7 +462,7 @@ uloc_getCountry(const char* localeID, * than variantCapacity, the returned variant code will be truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getVariant(const char* localeID, char* variant, int32_t variantCapacity, @@ -485,7 +485,7 @@ uloc_getVariant(const char* localeID, * than nameCapacity, the returned full name will be truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getName(const char* localeID, char* name, int32_t nameCapacity, @@ -508,7 +508,7 @@ uloc_getName(const char* localeID, * than nameCapacity, the returned full name will be truncated. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_canonicalize(const char* localeID, char* name, int32_t nameCapacity, @@ -521,7 +521,7 @@ uloc_canonicalize(const char* localeID, * @return language the ISO language code for localeID * @stable ICU 2.0 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uloc_getISO3Language(const char* localeID); @@ -532,7 +532,7 @@ uloc_getISO3Language(const char* localeID); * @return country the ISO country code for localeID * @stable ICU 2.0 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uloc_getISO3Country(const char* localeID); /** @@ -546,26 +546,31 @@ uloc_getISO3Country(const char* localeID); * @return country the Win32 LCID for localeID * @stable ICU 2.0 */ -U_STABLE uint32_t U_EXPORT2 +U_CAPI uint32_t U_EXPORT2 uloc_getLCID(const char* localeID); /** * Gets the language name suitable for display for the specified locale. * * @param locale the locale to get the ISO language code with - * @param displayLocale Specifies the locale to be used to display the name. In other words, - * if the locale's language code is "en", passing Locale::getFrench() for - * inLocale would result in "Anglais", while passing Locale::getGerman() - * for inLocale would result in "Englisch". + * @param displayLocale Specifies the locale to be used to display the name. In + * other words, if the locale's language code is "en", passing + * Locale::getFrench() for inLocale would result in "Anglais", + * while passing Locale::getGerman() for inLocale would result + * in "Englisch". * @param language the displayable language code for localeID * @param languageCapacity the size of the language buffer to store the - * displayable language code with - * @param status error information if retrieving the displayable language code failed - * @return the actual buffer size needed for the displayable language code. If it's greater - * than languageCapacity, the returned language code will be truncated. + * displayable language code with. + * @param status error information if retrieving the displayable language code + * failed. U_USING_DEFAULT_WARNING indicates that no data was + * found from the locale resources and a case canonicalized + * language code is placed into language as fallback. + * @return the actual buffer size needed for the displayable language code. If + * it's greater than languageCapacity, the returned language + * code will be truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getDisplayLanguage(const char* locale, const char* displayLocale, UChar* language, @@ -575,20 +580,26 @@ uloc_getDisplayLanguage(const char* locale, /** * Gets the script name suitable for display for the specified locale. * - * @param locale the locale to get the displayable script code with. NULL may be used to specify the default. - * @param displayLocale Specifies the locale to be used to display the name. In other words, - * if the locale's language code is "en", passing Locale::getFrench() for - * inLocale would result in "", while passing Locale::getGerman() - * for inLocale would result in "". NULL may be used to specify the default. - * @param script the displayable script for the localeID - * @param scriptCapacity the size of the script buffer to store the - * displayable script code with - * @param status error information if retrieving the displayable script code failed - * @return the actual buffer size needed for the displayable script code. If it's greater - * than scriptCapacity, the returned displayable script code will be truncated. + * @param locale the locale to get the displayable script code with. NULL may be + * used to specify the default. + * @param displayLocale Specifies the locale to be used to display the name. In + * other words, if the locale's language code is "en", passing + * Locale::getFrench() for inLocale would result in "", while + * passing Locale::getGerman() for inLocale would result in "". + * NULL may be used to specify the default. + * @param script the displayable script for the localeID. + * @param scriptCapacity the size of the script buffer to store the displayable + * script code with. + * @param status error information if retrieving the displayable script code + * failed. U_USING_DEFAULT_WARNING indicates that no data was + * found from the locale resources and a case canonicalized + * script code is placed into script as fallback. + * @return the actual buffer size needed for the displayable script code. If + * it's greater than scriptCapacity, the returned displayable + * script code will be truncated. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getDisplayScript(const char* locale, const char* displayLocale, UChar* script, @@ -597,23 +608,30 @@ uloc_getDisplayScript(const char* locale, /** * Gets the country name suitable for display for the specified locale. - * Warning: this is for the region part of a valid locale ID; it cannot just be the region code (like "FR"). - * To get the display name for a region alone, or for other options, use ULocaleDisplayNames instead. - * - * @param locale the locale to get the displayable country code with. NULL may be used to specify the default. - * @param displayLocale Specifies the locale to be used to display the name. In other words, - * if the locale's language code is "en", passing Locale::getFrench() for - * inLocale would result in "Anglais", while passing Locale::getGerman() - * for inLocale would result in "Englisch". NULL may be used to specify the default. - * @param country the displayable country code for localeID + * Warning: this is for the region part of a valid locale ID; it cannot just be + * the region code (like "FR"). To get the display name for a region alone, or + * for other options, use ULocaleDisplayNames instead. + * + * @param locale the locale to get the displayable country code with. NULL may + * be used to specify the default. + * @param displayLocale Specifies the locale to be used to display the name. In + * other words, if the locale's language code is "en", passing + * Locale::getFrench() for inLocale would result in "Anglais", + * while passing Locale::getGerman() for inLocale would result + * in "Englisch". NULL may be used to specify the default. + * @param country the displayable country code for localeID. * @param countryCapacity the size of the country buffer to store the - * displayable country code with - * @param status error information if retrieving the displayable country code failed - * @return the actual buffer size needed for the displayable country code. If it's greater - * than countryCapacity, the returned displayable country code will be truncated. + * displayable country code with. + * @param status error information if retrieving the displayable country code + * failed. U_USING_DEFAULT_WARNING indicates that no data was + * found from the locale resources and a case canonicalized + * country code is placed into country as fallback. + * @return the actual buffer size needed for the displayable country code. If + * it's greater than countryCapacity, the returned displayable + * country code will be truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getDisplayCountry(const char* locale, const char* displayLocale, UChar* country, @@ -624,20 +642,26 @@ uloc_getDisplayCountry(const char* locale, /** * Gets the variant name suitable for display for the specified locale. * - * @param locale the locale to get the displayable variant code with. NULL may be used to specify the default. - * @param displayLocale Specifies the locale to be used to display the name. In other words, - * if the locale's language code is "en", passing Locale::getFrench() for - * inLocale would result in "Anglais", while passing Locale::getGerman() - * for inLocale would result in "Englisch". NULL may be used to specify the default. - * @param variant the displayable variant code for localeID + * @param locale the locale to get the displayable variant code with. NULL may + * be used to specify the default. + * @param displayLocale Specifies the locale to be used to display the name. In + * other words, if the locale's language code is "en", passing + * Locale::getFrench() for inLocale would result in "Anglais", + * while passing Locale::getGerman() for inLocale would result + * in "Englisch". NULL may be used to specify the default. + * @param variant the displayable variant code for localeID. * @param variantCapacity the size of the variant buffer to store the - * displayable variant code with - * @param status error information if retrieving the displayable variant code failed - * @return the actual buffer size needed for the displayable variant code. If it's greater - * than variantCapacity, the returned displayable variant code will be truncated. + * displayable variant code with. + * @param status error information if retrieving the displayable variant code + * failed. U_USING_DEFAULT_WARNING indicates that no data was + * found from the locale resources and a case canonicalized + * variant code is placed into variant as fallback. + * @return the actual buffer size needed for the displayable variant code. If + * it's greater than variantCapacity, the returned displayable + * variant code will be truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getDisplayVariant(const char* locale, const char* displayLocale, UChar* variant, @@ -645,8 +669,8 @@ uloc_getDisplayVariant(const char* locale, UErrorCode* status); /** - * Gets the keyword name suitable for display for the specified locale. - * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display + * Gets the keyword name suitable for display for the specified locale. E.g: + * for the locale string de_DE\@collation=PHONEBOOK, this API gets the display * string for the keyword collation. * Usage: * @@ -680,11 +704,13 @@ uloc_getDisplayVariant(const char* locale, * result without writing any of the result string (pre-flighting). * @param status error information if retrieving the displayable string failed. * Should not be NULL and should not indicate failure on entry. + * U_USING_DEFAULT_WARNING indicates that no data was found from the locale + * resources and the keyword is placed into dest as fallback. * @return the actual buffer size needed for the displayable variant code. * @see #uloc_openKeywords * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getDisplayKeyword(const char* keyword, const char* displayLocale, UChar* dest, @@ -707,10 +733,12 @@ uloc_getDisplayKeyword(const char* keyword, * result without writing any of the result string (pre-flighting). * @param status error information if retrieving the displayable string failed. * Should not be NULL and must not indicate failure on entry. + * U_USING_DEFAULT_WARNING indicates that no data was found from the locale + * resources and the value of the keyword is placed into dest as fallback. * @return the actual buffer size needed for the displayable variant code. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getDisplayKeywordValue( const char* locale, const char* keyword, const char* displayLocale, @@ -733,7 +761,7 @@ uloc_getDisplayKeywordValue( const char* locale, * than maxResultSize, the returned displayable name will be truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getDisplayName(const char* localeID, const char* inLocaleID, UChar* result, @@ -757,7 +785,7 @@ uloc_getDisplayName(const char* localeID, * @return a specified locale name of all available locales * @stable ICU 2.0 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uloc_getAvailable(int32_t n); /** @@ -766,21 +794,19 @@ uloc_getAvailable(int32_t n); * @return the size of the locale list * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 uloc_countAvailable(void); - -#ifndef U_HIDE_DRAFT_API +U_CAPI int32_t U_EXPORT2 uloc_countAvailable(void); /** * Types for uloc_getAvailableByType and uloc_countAvailableByType. * - * @draft ICU 65 + * @stable ICU 65 */ typedef enum ULocAvailableType { /** * Locales that return data when passed to ICU APIs, * but not including legacy or alias locales. * - * @draft ICU 65 + * @stable ICU 65 */ ULOC_AVAILABLE_DEFAULT, @@ -798,7 +824,7 @@ typedef enum ULocAvailableType { * ULOC_AVAILABLE_DEFAULT. To get both sets at the same time, use * ULOC_AVAILABLE_WITH_LEGACY_ALIASES. * - * @draft ICU 65 + * @stable ICU 65 */ ULOC_AVAILABLE_ONLY_LEGACY_ALIASES, @@ -806,7 +832,7 @@ typedef enum ULocAvailableType { * The union of the locales in ULOC_AVAILABLE_DEFAULT and * ULOC_AVAILABLE_ONLY_LEGACY_ALIAS. * - * @draft ICU 65 + * @stable ICU 65 */ ULOC_AVAILABLE_WITH_LEGACY_ALIASES, @@ -827,13 +853,11 @@ typedef enum ULocAvailableType { * @param type Type choice from ULocAvailableType. * @param status Set if an error occurred. * @return a UEnumeration owned by the caller, or nullptr on failure. - * @draft ICU 65 + * @stable ICU 65 */ -U_DRAFT UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 uloc_openAvailableByType(ULocAvailableType type, UErrorCode* status); -#endif // U_HIDE_DRAFT_API - /** * * Gets a list of all available 2-letter language codes defined in ISO 639, @@ -845,7 +869,7 @@ uloc_openAvailableByType(ULocAvailableType type, UErrorCode* status); * @return a list of all available language codes * @stable ICU 2.0 */ -U_STABLE const char* const* U_EXPORT2 +U_CAPI const char* const* U_EXPORT2 uloc_getISOLanguages(void); /** @@ -857,7 +881,7 @@ uloc_getISOLanguages(void); * @return a list of all available country codes * @stable ICU 2.0 */ -U_STABLE const char* const* U_EXPORT2 +U_CAPI const char* const* U_EXPORT2 uloc_getISOCountries(void); /** @@ -873,7 +897,7 @@ uloc_getISOCountries(void); * @return The length of the parent locale ID. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getParent(const char* localeID, char* parent, int32_t parentCapacity, @@ -904,7 +928,7 @@ uloc_getParent(const char* localeID, * than nameCapacity, the returned full name will be truncated. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getBaseName(const char* localeID, char* name, int32_t nameCapacity, @@ -919,7 +943,7 @@ uloc_getBaseName(const char* localeID, * @return enumeration of keywords or NULL if there are no keywords. * @stable ICU 2.8 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 uloc_openKeywords(const char* localeID, UErrorCode* status); @@ -936,7 +960,7 @@ uloc_openKeywords(const char* localeID, * @return the length of keyword value * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getKeywordValue(const char* localeID, const char* keywordName, char* buffer, int32_t bufferCapacity, @@ -973,7 +997,7 @@ uloc_getKeywordValue(const char* localeID, * @see uloc_getKeywordValue * @stable ICU 3.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_setKeywordValue(const char* keywordName, const char* keywordValue, char* buffer, int32_t bufferCapacity, @@ -982,18 +1006,18 @@ uloc_setKeywordValue(const char* keywordName, /** * Returns whether the locale's script is written right-to-left. * If there is no script subtag, then the likely script is used, see uloc_addLikelySubtags(). - * If no likely script is known, then FALSE is returned. + * If no likely script is known, then false is returned. * * A script is right-to-left according to the CLDR script metadata * which corresponds to whether the script's letters have Bidi_Class=R or AL. * - * Returns TRUE for "ar" and "en-Hebr", FALSE for "zh" and "fa-Cyrl". + * Returns true for "ar" and "en-Hebr", false for "zh" and "fa-Cyrl". * * @param locale input locale ID - * @return TRUE if the locale's script is written right-to-left + * @return true if the locale's script is written right-to-left * @stable ICU 54 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uloc_isRightToLeft(const char *locale); /** @@ -1017,7 +1041,7 @@ typedef enum { * @return an enum indicating the layout orientation for characters. * @stable ICU 4.0 */ -U_STABLE ULayoutType U_EXPORT2 +U_CAPI ULayoutType U_EXPORT2 uloc_getCharacterOrientation(const char* localeId, UErrorCode *status); @@ -1029,7 +1053,7 @@ uloc_getCharacterOrientation(const char* localeId, * @return an enum indicating the layout orientation for lines. * @stable ICU 4.0 */ -U_STABLE ULayoutType U_EXPORT2 +U_CAPI ULayoutType U_EXPORT2 uloc_getLineOrientation(const char* localeId, UErrorCode *status); @@ -1076,7 +1100,7 @@ typedef enum { * @return length needed for the locale. * @stable ICU 3.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, UAcceptResult *outResult, const char *httpAcceptLanguage, @@ -1101,7 +1125,7 @@ uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, * @return length needed for the locale. * @stable ICU 3.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_acceptLanguage(char *result, int32_t resultAvailable, UAcceptResult *outResult, const char **acceptList, int32_t acceptListCount, @@ -1121,7 +1145,7 @@ uloc_acceptLanguage(char *result, int32_t resultAvailable, * @return actual the actual size of the locale ID, not including NUL-termination * @stable ICU 3.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity, UErrorCode *status); @@ -1159,7 +1183,7 @@ uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity, * On error, the return value is -1. * @stable ICU 4.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_addLikelySubtags(const char* localeID, char* maximizedLocaleID, int32_t maximizedLocaleIDCapacity, @@ -1199,7 +1223,7 @@ uloc_addLikelySubtags(const char* localeID, * On error, the return value is -1. * @stable ICU 4.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_minimizeSubtags(const char* localeID, char* minimizedLocaleID, int32_t minimizedLocaleIDCapacity, @@ -1210,13 +1234,17 @@ uloc_minimizeSubtags(const char* localeID, * If the specified language tag contains any ill-formed subtags, * the first such subtag and all following subtags are ignored. *

    - * This implements the 'Language-Tag' production of BCP47, and so - * supports grandfathered (regular and irregular) as well as private - * use language tags. Private use tags are represented as 'x-whatever', - * and grandfathered tags are converted to their canonical replacements - * where they exist. Note that a few grandfathered tags have no modern - * replacement, these will be converted using the fallback described in + * This implements the 'Language-Tag' production of BCP 47, and so + * supports legacy language tags (marked as “Type: grandfathered” in BCP 47) + * (regular and irregular) as well as private use language tags. + * + * Private use tags are represented as 'x-whatever', + * and legacy tags are converted to their canonical replacements where they exist. + * + * Note that a few legacy tags have no modern replacement; + * these will be converted using the fallback described in * the first paragraph, so some information might be lost. + * * @param langtag the input BCP47 language tag. * @param localeID the output buffer receiving a locale ID for the * specified BCP47 language tag. @@ -1228,7 +1256,7 @@ uloc_minimizeSubtags(const char* localeID, * @return the length of the locale ID. * @stable ICU 4.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_forLanguageTag(const char* langtag, char* localeID, int32_t localeIDCapacity, @@ -1238,10 +1266,10 @@ uloc_forLanguageTag(const char* langtag, /** * Returns a well-formed language tag for this locale ID. *

    - * Note: When strict is FALSE, any locale + * Note: When strict is false, any locale * fields which do not satisfy the BCP47 syntax requirement will * be omitted from the result. When strict is - * TRUE, this function sets U_ILLEGAL_ARGUMENT_ERROR to the + * true, this function sets U_ILLEGAL_ARGUMENT_ERROR to the * err if any locale fields do not satisfy the * BCP47 syntax requirement. * @param localeID the input locale ID @@ -1256,7 +1284,7 @@ uloc_forLanguageTag(const char* langtag, * @return The length of the BCP47 language tag. * @stable ICU 4.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_toLanguageTag(const char* localeID, char* langtag, int32_t langtagCapacity, @@ -1284,7 +1312,7 @@ uloc_toLanguageTag(const char* localeID, * @see uloc_toLegacyKey * @stable ICU 54 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uloc_toUnicodeLocaleKey(const char* keyword); /** @@ -1315,7 +1343,7 @@ uloc_toUnicodeLocaleKey(const char* keyword); * @see uloc_toLegacyType * @stable ICU 54 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uloc_toUnicodeLocaleType(const char* keyword, const char* value); /** @@ -1330,7 +1358,7 @@ uloc_toUnicodeLocaleType(const char* keyword, const char* value); * @see toUnicodeLocaleKey * @stable ICU 54 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uloc_toLegacyKey(const char* keyword); /** @@ -1359,7 +1387,7 @@ uloc_toLegacyKey(const char* keyword); * @see toUnicodeLocaleType * @stable ICU 54 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uloc_toLegacyType(const char* keyword, const char* value); #endif /*_ULOC*/ diff --git a/deps/icu-small/source/common/unicode/umachine.h b/deps/icu-small/source/common/unicode/umachine.h index ff5deb8d01786a..219d1ee1911d02 100644 --- a/deps/icu-small/source/common/unicode/umachine.h +++ b/deps/icu-small/source/common/unicode/umachine.h @@ -49,12 +49,13 @@ * ANSI C headers: * stddef.h defines wchar_t */ +#include #include /*==========================================================================*/ -/* For C wrappers, we use the symbol U_STABLE. */ +/* For C wrappers, we use the symbol U_CAPI. */ /* This works properly if the includer is C or C++. */ -/* Functions are declared U_STABLE return-type U_EXPORT2 function-name()... */ +/* Functions are declared U_CAPI return-type U_EXPORT2 function-name()... */ /*==========================================================================*/ /** @@ -107,15 +108,15 @@ /** This is used to declare a function as a public ICU C API @stable ICU 2.0*/ #define U_CAPI U_CFUNC U_EXPORT -/** This is used to declare a function as a stable public ICU C API*/ +/** Obsolete/same as U_CAPI; was used to declare a function as a stable public ICU C API*/ #define U_STABLE U_CAPI -/** This is used to declare a function as a draft public ICU C API */ +/** Obsolete/same as U_CAPI; was used to declare a function as a draft public ICU C API */ #define U_DRAFT U_CAPI /** This is used to declare a function as a deprecated public ICU C API */ #define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED -/** This is used to declare a function as an obsolete public ICU C API */ +/** Obsolete/same as U_CAPI; was used to declare a function as an obsolete public ICU C API */ #define U_OBSOLETE U_CAPI -/** This is used to declare a function as an internal ICU C API */ +/** Obsolete/same as U_CAPI; was used to declare a function as an internal ICU C API */ #define U_INTERNAL U_CAPI /** @@ -170,11 +171,11 @@ /** * \def UPRV_BLOCK_MACRO_END - * Defined as "while (FALSE)" by default. + * Defined as "while (false)" by default. * @internal */ #ifndef UPRV_BLOCK_MACRO_END -#define UPRV_BLOCK_MACRO_END while (FALSE) +#define UPRV_BLOCK_MACRO_END while (false) #endif /*==========================================================================*/ @@ -257,18 +258,59 @@ /* Boolean data type */ /*==========================================================================*/ -/** The ICU boolean type @stable ICU 2.0 */ +/** + * The ICU boolean type, a signed-byte integer. + * ICU-specific for historical reasons: The C and C++ standards used to not define type bool. + * Also provides a fixed type definition, as opposed to + * type bool whose details (e.g., sizeof) may vary by compiler and between C and C++. + * + * @stable ICU 2.0 + */ typedef int8_t UBool; +/** + * \def U_DEFINE_FALSE_AND_TRUE + * Normally turns off defining macros FALSE=0 & TRUE=1 in public ICU headers. + * These obsolete macros sometimes break compilation of other code that + * defines enum constants or similar with these names. + * C++ has long defined bool/false/true. + * C99 also added definitions for these, although as macros; see stdbool.h. + * + * You may transitionally define U_DEFINE_FALSE_AND_TRUE=1 if you need time to migrate code. + * + * @internal ICU 68 + */ +#ifdef U_DEFINE_FALSE_AND_TRUE + // Use the predefined value. +#elif defined(U_COMBINED_IMPLEMENTATION) || \ + defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || \ + defined(U_IO_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION) || \ + defined(U_TOOLUTIL_IMPLEMENTATION) + // Inside ICU: Keep FALSE & TRUE available. +# define U_DEFINE_FALSE_AND_TRUE 1 +#else + // Outside ICU: Avoid collision with non-macro definitions of FALSE & TRUE. +# define U_DEFINE_FALSE_AND_TRUE 0 +#endif + +#if U_DEFINE_FALSE_AND_TRUE || defined(U_IN_DOXYGEN) #ifndef TRUE -/** The TRUE value of a UBool @stable ICU 2.0 */ +/** + * The TRUE value of a UBool. + * + * @deprecated ICU 68 Use standard "true" instead. + */ # define TRUE 1 #endif #ifndef FALSE -/** The FALSE value of a UBool @stable ICU 2.0 */ +/** + * The FALSE value of a UBool. + * + * @deprecated ICU 68 Use standard "false" instead. + */ # define FALSE 0 #endif - +#endif // U_DEFINE_FALSE_AND_TRUE /*==========================================================================*/ /* Unicode data types */ diff --git a/deps/icu-small/source/common/unicode/umutablecptrie.h b/deps/icu-small/source/common/unicode/umutablecptrie.h index f2af36477d5300..5325d58147ab1f 100644 --- a/deps/icu-small/source/common/unicode/umutablecptrie.h +++ b/deps/icu-small/source/common/unicode/umutablecptrie.h @@ -9,11 +9,14 @@ #include "unicode/utypes.h" -#include "unicode/localpointer.h" #include "unicode/ucpmap.h" #include "unicode/ucptrie.h" #include "unicode/utf8.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + U_CDECL_BEGIN /** diff --git a/deps/icu-small/source/common/unicode/unimatch.h b/deps/icu-small/source/common/unicode/unimatch.h index 2d3c5210c38e25..10efd3d007a5ca 100644 --- a/deps/icu-small/source/common/unicode/unimatch.h +++ b/deps/icu-small/source/common/unicode/unimatch.h @@ -115,11 +115,11 @@ class U_COMMON_API UnicodeMatcher /* not : public UObject because this is an int * considered for matching will be text.charAt(limit-1) in the * forward direction or text.charAt(limit+1) in the backward * direction. - * @param incremental if TRUE, then assume further characters may + * @param incremental if true, then assume further characters may * be inserted at limit and check for partial matching. Otherwise * assume the text as given is complete. * @return a match degree value indicating a full match, a partial - * match, or a mismatch. If incremental is FALSE then + * match, or a mismatch. If incremental is false then * U_PARTIAL_MATCH should never be returned. * @stable ICU 2.4 */ @@ -134,17 +134,17 @@ class U_COMMON_API UnicodeMatcher /* not : public UObject because this is an int * will produce another matcher that is equal to this one. * @param result the string to receive the pattern. Previous * contents will be deleted. - * @param escapeUnprintable if TRUE then convert unprintable + * @param escapeUnprintable if true then convert unprintable * character to their hex escape representations, \\uxxxx or * \\Uxxxxxxxx. Unprintable characters are those other than * U+000A, U+0020..U+007E. * @stable ICU 2.4 */ virtual UnicodeString& toPattern(UnicodeString& result, - UBool escapeUnprintable = FALSE) const = 0; + UBool escapeUnprintable = false) const = 0; /** - * Returns TRUE if this matcher will match a character c, where c + * Returns true if this matcher will match a character c, where c * & 0xFF == v, at offset, in the forward direction (with limit > * offset). This is used by RuleBasedTransliterator for * indexing. diff --git a/deps/icu-small/source/common/unicode/uniset.h b/deps/icu-small/source/common/unicode/uniset.h index 18cc9376442a2f..4179507af18e6f 100644 --- a/deps/icu-small/source/common/unicode/uniset.h +++ b/deps/icu-small/source/common/unicode/uniset.h @@ -325,7 +325,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * A bogus set has no value. It is different from an empty set. * It can be used to indicate that no set value is available. * - * @return TRUE if the set is bogus/invalid, FALSE otherwise + * @return true if the set is bogus/invalid, false otherwise * @see setToBogus() * @stable ICU 4.0 */ @@ -333,7 +333,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { /** * Make this UnicodeSet object invalid. - * The string will test TRUE with isBogus(). + * The string will test true with isBogus(). * * A bogus set has no value. It is different from an empty set. * It can be used to indicate that no set value is available. @@ -563,7 +563,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { /** * Determines whether the set has been frozen (made immutable) or not. * See the ICU4J Freezable interface for details. - * @return TRUE/FALSE for whether the set has been frozen + * @return true/false for whether the set has been frozen * @see freeze * @see cloneAsThawed * @stable ICU 3.8 @@ -700,14 +700,14 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * A frozen set will not be modified. * @param result the string to receive the rules. Previous * contents will be deleted. - * @param escapeUnprintable if TRUE then convert unprintable + * @param escapeUnprintable if true then convert unprintable * character to their hex escape representations, \\uxxxx or * \\Uxxxxxxxx. Unprintable characters are those other than * U+000A, U+0020..U+007E. * @stable ICU 2.0 */ virtual UnicodeString& toPattern(UnicodeString& result, - UBool escapeUnprintable = FALSE) const; + UBool escapeUnprintable = false) const; /** * Modifies this set to contain those code points which have the given value @@ -1636,7 +1636,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { static const UnicodeSet* getInclusions(int32_t src, UErrorCode &status); /** - * A filter that returns TRUE if the given code point should be + * A filter that returns true if the given code point should be * included in the UnicodeSet being constructed. */ typedef UBool (*Filter)(UChar32 codePoint, void* context); diff --git a/deps/icu-small/source/common/unicode/unistr.h b/deps/icu-small/source/common/unicode/unistr.h index da79053765acf6..456389f265fea0 100644 --- a/deps/icu-small/source/common/unicode/unistr.h +++ b/deps/icu-small/source/common/unicode/unistr.h @@ -45,7 +45,7 @@ struct UConverter; // unicode/ucnv.h /** * \ingroup ustring_ustrlen */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strlen(const UChar *s); #endif @@ -113,9 +113,9 @@ class UnicodeStringAppendable; // unicode/appendable.h * @stable ICU 2.0 */ #if !U_CHAR16_IS_TYPEDEF -# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, u ## cs, _length) +# define UNICODE_STRING(cs, _length) icu::UnicodeString(true, u ## cs, _length) #else -# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const char16_t*)u ## cs, _length) +# define UNICODE_STRING(cs, _length) icu::UnicodeString(true, (const char16_t*)u ## cs, _length) #endif /** @@ -227,7 +227,7 @@ class UnicodeStringAppendable; // unicode/appendable.h * The UnicodeString class is not suitable for subclassing. * * For an overview of Unicode strings in C and C++ see the - * [User Guide Strings chapter](http://userguide.icu-project.org/strings#TOC-Strings-in-C-C-). + * [User Guide Strings chapter](https://unicode-org.github.io/icu/userguide/strings#strings-in-cc). * * In ICU, a Unicode string consists of 16-bit Unicode *code units*. * A Unicode character may be stored with either one code unit @@ -285,7 +285,7 @@ class UnicodeStringAppendable; // unicode/appendable.h * significant performance improvements. * Also, the internal buffer is accessible via special functions. * For details see the - * [User Guide Strings chapter](http://userguide.icu-project.org/strings#TOC-Maximizing-Performance-with-the-UnicodeString-Storage-Model). + * [User Guide Strings chapter](https://unicode-org.github.io/icu/userguide/strings#maximizing-performance-with-the-unicodestring-storage-model). * * @see utf.h * @see CharacterIterator @@ -320,8 +320,8 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Equality operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. - * @return TRUE if `text` contains the same characters as this one, - * FALSE otherwise. + * @return true if `text` contains the same characters as this one, + * false otherwise. * @stable ICU 2.0 */ inline UBool operator== (const UnicodeString& text) const; @@ -329,8 +329,8 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Inequality operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. - * @return FALSE if `text` contains the same characters as this one, - * TRUE otherwise. + * @return false if `text` contains the same characters as this one, + * true otherwise. * @stable ICU 2.0 */ inline UBool operator!= (const UnicodeString& text) const; @@ -338,8 +338,8 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Greater than operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. - * @return TRUE if the characters in this are bitwise - * greater than the characters in `text`, FALSE otherwise + * @return true if the characters in this are bitwise + * greater than the characters in `text`, false otherwise * @stable ICU 2.0 */ inline UBool operator> (const UnicodeString& text) const; @@ -347,8 +347,8 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Less than operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. - * @return TRUE if the characters in this are bitwise - * less than the characters in `text`, FALSE otherwise + * @return true if the characters in this are bitwise + * less than the characters in `text`, false otherwise * @stable ICU 2.0 */ inline UBool operator< (const UnicodeString& text) const; @@ -356,8 +356,8 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Greater than or equal operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. - * @return TRUE if the characters in this are bitwise - * greater than or equal to the characters in `text`, FALSE otherwise + * @return true if the characters in this are bitwise + * greater than or equal to the characters in `text`, false otherwise * @stable ICU 2.0 */ inline UBool operator>= (const UnicodeString& text) const; @@ -365,8 +365,8 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Less than or equal operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. - * @return TRUE if the characters in this are bitwise - * less than or equal to the characters in `text`, FALSE otherwise + * @return true if the characters in this are bitwise + * less than or equal to the characters in `text`, false otherwise * @stable ICU 2.0 */ inline UBool operator<= (const UnicodeString& text) const; @@ -855,8 +855,8 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Determine if this starts with the characters in `text` * @param text The text to match. - * @return TRUE if this starts with the characters in `text`, - * FALSE otherwise + * @return true if this starts with the characters in `text`, + * false otherwise * @stable ICU 2.0 */ inline UBool startsWith(const UnicodeString& text) const; @@ -867,8 +867,8 @@ class U_COMMON_API UnicodeString : public Replaceable * @param srcText The text to match. * @param srcStart the offset into `srcText` to start matching * @param srcLength the number of characters in `srcText` to match - * @return TRUE if this starts with the characters in `text`, - * FALSE otherwise + * @return true if this starts with the characters in `text`, + * false otherwise * @stable ICU 2.0 */ inline UBool startsWith(const UnicodeString& srcText, @@ -879,8 +879,8 @@ class U_COMMON_API UnicodeString : public Replaceable * Determine if this starts with the characters in `srcChars` * @param srcChars The characters to match. * @param srcLength the number of characters in `srcChars` - * @return TRUE if this starts with the characters in `srcChars`, - * FALSE otherwise + * @return true if this starts with the characters in `srcChars`, + * false otherwise * @stable ICU 2.0 */ inline UBool startsWith(ConstChar16Ptr srcChars, @@ -892,7 +892,7 @@ class U_COMMON_API UnicodeString : public Replaceable * @param srcChars The characters to match. * @param srcStart the offset into `srcText` to start matching * @param srcLength the number of characters in `srcChars` to match - * @return TRUE if this ends with the characters in `srcChars`, FALSE otherwise + * @return true if this ends with the characters in `srcChars`, false otherwise * @stable ICU 2.0 */ inline UBool startsWith(const char16_t *srcChars, @@ -902,8 +902,8 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Determine if this ends with the characters in `text` * @param text The text to match. - * @return TRUE if this ends with the characters in `text`, - * FALSE otherwise + * @return true if this ends with the characters in `text`, + * false otherwise * @stable ICU 2.0 */ inline UBool endsWith(const UnicodeString& text) const; @@ -914,8 +914,8 @@ class U_COMMON_API UnicodeString : public Replaceable * @param srcText The text to match. * @param srcStart the offset into `srcText` to start matching * @param srcLength the number of characters in `srcText` to match - * @return TRUE if this ends with the characters in `text`, - * FALSE otherwise + * @return true if this ends with the characters in `text`, + * false otherwise * @stable ICU 2.0 */ inline UBool endsWith(const UnicodeString& srcText, @@ -926,8 +926,8 @@ class U_COMMON_API UnicodeString : public Replaceable * Determine if this ends with the characters in `srcChars` * @param srcChars The characters to match. * @param srcLength the number of characters in `srcChars` - * @return TRUE if this ends with the characters in `srcChars`, - * FALSE otherwise + * @return true if this ends with the characters in `srcChars`, + * false otherwise * @stable ICU 2.0 */ inline UBool endsWith(ConstChar16Ptr srcChars, @@ -939,8 +939,8 @@ class U_COMMON_API UnicodeString : public Replaceable * @param srcChars The characters to match. * @param srcStart the offset into `srcText` to start matching * @param srcLength the number of characters in `srcChars` to match - * @return TRUE if this ends with the characters in `srcChars`, - * FALSE otherwise + * @return true if this ends with the characters in `srcChars`, + * false otherwise * @stable ICU 2.0 */ inline UBool endsWith(const char16_t *srcChars, @@ -1804,7 +1804,7 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Determine if this string is empty. - * @return TRUE if this string contains 0 characters, FALSE otherwise. + * @return true if this string contains 0 characters, false otherwise. * @stable ICU 2.0 */ inline UBool isEmpty(void) const; @@ -1832,12 +1832,12 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Determine if this object contains a valid string. * A bogus string has no value. It is different from an empty string, - * although in both cases isEmpty() returns TRUE and length() returns 0. + * although in both cases isEmpty() returns true and length() returns 0. * setToBogus() and isBogus() can be used to indicate that no string value is available. * For a bogus string, getBuffer() and getTerminatedBuffer() return NULL, and * length() returns 0. * - * @return TRUE if the string is bogus/invalid, FALSE otherwise + * @return true if the string is bogus/invalid, false otherwise * @see setToBogus() * @stable ICU 2.0 */ @@ -2067,7 +2067,7 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Make this UnicodeString object invalid. - * The string will test TRUE with isBogus(). + * The string will test true with isBogus(). * * A bogus string has no value. It is different from an empty string. * It can be used to indicate that no string value is available. @@ -2459,7 +2459,7 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Replaceable API - * @return TRUE if it has MetaData + * @return true if it has MetaData * @stable ICU 2.4 */ virtual UBool hasMetaData() const; @@ -2590,7 +2590,7 @@ class U_COMMON_API UnicodeString : public Replaceable * @param targetLength the desired length of the string * @param padChar the character to use for padding. Defaults to * space (U+0020) - * @return TRUE if the text was padded, FALSE otherwise. + * @return true if the text was padded, false otherwise. * @stable ICU 2.0 */ UBool padLeading(int32_t targetLength, @@ -2604,7 +2604,7 @@ class U_COMMON_API UnicodeString : public Replaceable * @param targetLength the desired length of the string * @param padChar the character to use for padding. Defaults to * space (U+0020) - * @return TRUE if the text was padded, FALSE otherwise. + * @return true if the text was padded, false otherwise. * @stable ICU 2.0 */ UBool padTrailing(int32_t targetLength, @@ -2613,7 +2613,7 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Truncate this UnicodeString to the `targetLength`. * @param targetLength the desired length of this UnicodeString. - * @return TRUE if the text was truncated, FALSE otherwise + * @return true if the text was truncated, false otherwise * @stable ICU 2.0 */ inline UBool truncate(int32_t targetLength); @@ -3615,7 +3615,7 @@ class U_COMMON_API UnicodeString : public Replaceable void unBogus(); // implements assigment operator, copy constructor, and fastCopyFrom() - UnicodeString ©From(const UnicodeString &src, UBool fastCopy=FALSE); + UnicodeString ©From(const UnicodeString &src, UBool fastCopy=false); // Copies just the fields without memory management. void copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) U_NOEXCEPT; @@ -3668,13 +3668,13 @@ class U_COMMON_API UnicodeString : public Replaceable * the buffer is refCounted (shared), and refCount>1, or * the buffer is too small. * - * Return FALSE if memory could not be allocated. + * Return false if memory could not be allocated. */ UBool cloneArrayIfNeeded(int32_t newCapacity = -1, int32_t growCapacity = -1, - UBool doCopyArray = TRUE, + UBool doCopyArray = true, int32_t **pBufferToDelete = 0, - UBool forceClone = FALSE); + UBool forceClone = false); /** * Common function for UnicodeString case mappings. @@ -4732,12 +4732,12 @@ UnicodeString::truncate(int32_t targetLength) if(isBogus() && targetLength == 0) { // truncate(0) of a bogus string makes the string empty and non-bogus unBogus(); - return FALSE; + return false; } else if((uint32_t)targetLength < (uint32_t)length()) { setLength(targetLength); - return TRUE; + return true; } else { - return FALSE; + return false; } } diff --git a/deps/icu-small/source/common/unicode/unorm.h b/deps/icu-small/source/common/unicode/unorm.h index 09dd366a968c1b..c3c57582d449d5 100644 --- a/deps/icu-small/source/common/unicode/unorm.h +++ b/deps/icu-small/source/common/unicode/unorm.h @@ -274,7 +274,7 @@ unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, * never a "maybe". * For NFD, NFKD, and FCD, both functions work exactly the same. * For NFC and NFKC where quickCheck may return "maybe", this function will - * perform further tests to arrive at a TRUE/FALSE result. + * perform further tests to arrive at a true/false result. * * @param src String that is to be tested if it is in a normalization format. * @param srcLength Length of source to test, or -1 if NUL-terminated. @@ -358,10 +358,10 @@ unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength, * It is useful for operations like a normalizing transliterator, where one would * not want to replace a piece of text if it is not modified. * - * If doNormalize==TRUE and pNeededToNormalize!=NULL then *pNeeded... is set TRUE + * If doNormalize==true and pNeededToNormalize!=NULL then *pNeeded... is set true * if the normalization was necessary. * - * If doNormalize==FALSE then *pNeededToNormalize will be set to FALSE. + * If doNormalize==false then *pNeededToNormalize will be set to false. * * If the buffer overflows, then *pNeededToNormalize will be undefined; * essentially, whenever U_FAILURE is true (like in buffer overflows), this result @@ -373,11 +373,11 @@ unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength, * @param mode The normalization mode. * @param options The normalization options, ORed together (0 for no options). * @param doNormalize Indicates if the source text up to the next boundary - * is to be normalized (TRUE) or just copied (FALSE). + * is to be normalized (true) or just copied (false). * @param pNeededToNormalize Output flag indicating if the normalization resulted in * different text from the input. * Not defined if an error occurs including buffer overflow. - * Always FALSE if !doNormalize. + * Always false if !doNormalize. * @param pErrorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return Length of output (number of UChars) when successful or buffer overflow. @@ -406,11 +406,11 @@ unorm_next(UCharIterator *src, * @param mode The normalization mode. * @param options The normalization options, ORed together (0 for no options). * @param doNormalize Indicates if the source text up to the next boundary - * is to be normalized (TRUE) or just copied (FALSE). + * is to be normalized (true) or just copied (false). * @param pNeededToNormalize Output flag indicating if the normalization resulted in * different text from the input. * Not defined if an error occurs including buffer overflow. - * Always FALSE if !doNormalize. + * Always false if !doNormalize. * @param pErrorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return Length of output (number of UChars) when successful or buffer overflow. diff --git a/deps/icu-small/source/common/unicode/unorm2.h b/deps/icu-small/source/common/unicode/unorm2.h index a9bd02f256361f..24417b7103c12e 100644 --- a/deps/icu-small/source/common/unicode/unorm2.h +++ b/deps/icu-small/source/common/unicode/unorm2.h @@ -31,10 +31,13 @@ */ #include "unicode/utypes.h" -#include "unicode/localpointer.h" #include "unicode/stringoptions.h" #include "unicode/uset.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + /** * Constants for normalization modes. * For details about standard Unicode normalization forms @@ -132,7 +135,7 @@ typedef struct UNormalizer2 UNormalizer2; /**< C typedef for struct UNormalizer * @return the requested Normalizer2, if successful * @stable ICU 49 */ -U_STABLE const UNormalizer2 * U_EXPORT2 +U_CAPI const UNormalizer2 * U_EXPORT2 unorm2_getNFCInstance(UErrorCode *pErrorCode); /** @@ -146,7 +149,7 @@ unorm2_getNFCInstance(UErrorCode *pErrorCode); * @return the requested Normalizer2, if successful * @stable ICU 49 */ -U_STABLE const UNormalizer2 * U_EXPORT2 +U_CAPI const UNormalizer2 * U_EXPORT2 unorm2_getNFDInstance(UErrorCode *pErrorCode); /** @@ -160,7 +163,7 @@ unorm2_getNFDInstance(UErrorCode *pErrorCode); * @return the requested Normalizer2, if successful * @stable ICU 49 */ -U_STABLE const UNormalizer2 * U_EXPORT2 +U_CAPI const UNormalizer2 * U_EXPORT2 unorm2_getNFKCInstance(UErrorCode *pErrorCode); /** @@ -174,7 +177,7 @@ unorm2_getNFKCInstance(UErrorCode *pErrorCode); * @return the requested Normalizer2, if successful * @stable ICU 49 */ -U_STABLE const UNormalizer2 * U_EXPORT2 +U_CAPI const UNormalizer2 * U_EXPORT2 unorm2_getNFKDInstance(UErrorCode *pErrorCode); /** @@ -188,7 +191,7 @@ unorm2_getNFKDInstance(UErrorCode *pErrorCode); * @return the requested Normalizer2, if successful * @stable ICU 49 */ -U_STABLE const UNormalizer2 * U_EXPORT2 +U_CAPI const UNormalizer2 * U_EXPORT2 unorm2_getNFKCCasefoldInstance(UErrorCode *pErrorCode); /** @@ -212,7 +215,7 @@ unorm2_getNFKCCasefoldInstance(UErrorCode *pErrorCode); * @return the requested UNormalizer2, if successful * @stable ICU 4.4 */ -U_STABLE const UNormalizer2 * U_EXPORT2 +U_CAPI const UNormalizer2 * U_EXPORT2 unorm2_getInstance(const char *packageName, const char *name, UNormalization2Mode mode, @@ -233,7 +236,7 @@ unorm2_getInstance(const char *packageName, * @return the requested UNormalizer2, if successful * @stable ICU 4.4 */ -U_STABLE UNormalizer2 * U_EXPORT2 +U_CAPI UNormalizer2 * U_EXPORT2 unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode *pErrorCode); /** @@ -242,7 +245,7 @@ unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode * @param norm2 UNormalizer2 instance to be closed * @stable ICU 4.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 unorm2_close(UNormalizer2 *norm2); #if U_SHOW_CPLUSPLUS_API @@ -280,7 +283,7 @@ U_NAMESPACE_END * @return dest * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unorm2_normalize(const UNormalizer2 *norm2, const UChar *src, int32_t length, UChar *dest, int32_t capacity, @@ -303,7 +306,7 @@ unorm2_normalize(const UNormalizer2 *norm2, * @return first * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2, UChar *first, int32_t firstLength, int32_t firstCapacity, const UChar *second, int32_t secondLength, @@ -326,7 +329,7 @@ unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2, * @return first * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unorm2_append(const UNormalizer2 *norm2, UChar *first, int32_t firstLength, int32_t firstCapacity, const UChar *second, int32_t secondLength, @@ -351,7 +354,7 @@ unorm2_append(const UNormalizer2 *norm2, * @return the non-negative length of c's decomposition, if there is one; otherwise a negative value * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unorm2_getDecomposition(const UNormalizer2 *norm2, UChar32 c, UChar *decomposition, int32_t capacity, UErrorCode *pErrorCode); @@ -385,7 +388,7 @@ unorm2_getDecomposition(const UNormalizer2 *norm2, * @return the non-negative length of c's raw decomposition, if there is one; otherwise a negative value * @stable ICU 49 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unorm2_getRawDecomposition(const UNormalizer2 *norm2, UChar32 c, UChar *decomposition, int32_t capacity, UErrorCode *pErrorCode); @@ -405,7 +408,7 @@ unorm2_getRawDecomposition(const UNormalizer2 *norm2, * @return The non-negative composite code point if there is one; otherwise a negative value. * @stable ICU 49 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 unorm2_composePair(const UNormalizer2 *norm2, UChar32 a, UChar32 b); /** @@ -417,7 +420,7 @@ unorm2_composePair(const UNormalizer2 *norm2, UChar32 a, UChar32 b); * @return c's combining class * @stable ICU 49 */ -U_STABLE uint8_t U_EXPORT2 +U_CAPI uint8_t U_EXPORT2 unorm2_getCombiningClass(const UNormalizer2 *norm2, UChar32 c); /** @@ -433,10 +436,10 @@ unorm2_getCombiningClass(const UNormalizer2 *norm2, UChar32 c); * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) - * @return TRUE if s is normalized + * @return true if s is normalized * @stable ICU 4.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 unorm2_isNormalized(const UNormalizer2 *norm2, const UChar *s, int32_t length, UErrorCode *pErrorCode); @@ -458,7 +461,7 @@ unorm2_isNormalized(const UNormalizer2 *norm2, * @return UNormalizationCheckResult * @stable ICU 4.4 */ -U_STABLE UNormalizationCheckResult U_EXPORT2 +U_CAPI UNormalizationCheckResult U_EXPORT2 unorm2_quickCheck(const UNormalizer2 *norm2, const UChar *s, int32_t length, UErrorCode *pErrorCode); @@ -487,7 +490,7 @@ unorm2_quickCheck(const UNormalizer2 *norm2, * @return "yes" span end index * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unorm2_spanQuickCheckYes(const UNormalizer2 *norm2, const UChar *s, int32_t length, UErrorCode *pErrorCode); @@ -498,10 +501,10 @@ unorm2_spanQuickCheckYes(const UNormalizer2 *norm2, * For details see the Normalizer2 base class documentation. * @param norm2 UNormalizer2 instance * @param c character to test - * @return TRUE if c has a normalization boundary before it + * @return true if c has a normalization boundary before it * @stable ICU 4.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 unorm2_hasBoundaryBefore(const UNormalizer2 *norm2, UChar32 c); /** @@ -510,10 +513,10 @@ unorm2_hasBoundaryBefore(const UNormalizer2 *norm2, UChar32 c); * For details see the Normalizer2 base class documentation. * @param norm2 UNormalizer2 instance * @param c character to test - * @return TRUE if c has a normalization boundary after it + * @return true if c has a normalization boundary after it * @stable ICU 4.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 unorm2_hasBoundaryAfter(const UNormalizer2 *norm2, UChar32 c); /** @@ -521,10 +524,10 @@ unorm2_hasBoundaryAfter(const UNormalizer2 *norm2, UChar32 c); * For details see the Normalizer2 base class documentation. * @param norm2 UNormalizer2 instance * @param c character to test - * @return TRUE if c is normalization-inert + * @return true if c is normalization-inert * @stable ICU 4.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 unorm2_isInert(const UNormalizer2 *norm2, UChar32 c); /** @@ -593,7 +596,7 @@ unorm2_isInert(const UNormalizer2 *norm2, UChar32 c); * * @stable ICU 2.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unorm_compare(const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, uint32_t options, diff --git a/deps/icu-small/source/common/unicode/urename.h b/deps/icu-small/source/common/unicode/urename.h index 30f4b7af39adc5..20232cd209c2d6 100644 --- a/deps/icu-small/source/common/unicode/urename.h +++ b/deps/icu-small/source/common/unicode/urename.h @@ -130,7 +130,6 @@ #define izrule_getStaticClassID U_ICU_ENTRY_POINT_RENAME(izrule_getStaticClassID) #define izrule_isEquivalentTo U_ICU_ENTRY_POINT_RENAME(izrule_isEquivalentTo) #define izrule_open U_ICU_ENTRY_POINT_RENAME(izrule_open) -#define locale_getKeywords U_ICU_ENTRY_POINT_RENAME(locale_getKeywords) #define locale_getKeywordsStart U_ICU_ENTRY_POINT_RENAME(locale_getKeywordsStart) #define locale_get_default U_ICU_ENTRY_POINT_RENAME(locale_get_default) #define locale_set_default U_ICU_ENTRY_POINT_RENAME(locale_set_default) @@ -918,9 +917,11 @@ #define udtitvfmt_format U_ICU_ENTRY_POINT_RENAME(udtitvfmt_format) #define udtitvfmt_formatCalendarToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatCalendarToResult) #define udtitvfmt_formatToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatToResult) +#define udtitvfmt_getContext U_ICU_ENTRY_POINT_RENAME(udtitvfmt_getContext) #define udtitvfmt_open U_ICU_ENTRY_POINT_RENAME(udtitvfmt_open) #define udtitvfmt_openResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_openResult) #define udtitvfmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(udtitvfmt_resultAsValue) +#define udtitvfmt_setContext U_ICU_ENTRY_POINT_RENAME(udtitvfmt_setContext) #define uenum_close U_ICU_ENTRY_POINT_RENAME(uenum_close) #define uenum_count U_ICU_ENTRY_POINT_RENAME(uenum_count) #define uenum_next U_ICU_ENTRY_POINT_RENAME(uenum_next) @@ -1079,7 +1080,6 @@ #define uloc_getDisplayLanguage U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayLanguage) #define uloc_getDisplayName U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayName) #define uloc_getDisplayScript U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayScript) -#define uloc_getDisplayScriptInContext U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayScriptInContext) #define uloc_getDisplayVariant U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayVariant) #define uloc_getISO3Country U_ICU_ENTRY_POINT_RENAME(uloc_getISO3Country) #define uloc_getISO3Language U_ICU_ENTRY_POINT_RENAME(uloc_getISO3Language) @@ -1123,10 +1123,14 @@ #define ulocimp_forLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocimp_forLanguageTag) #define ulocimp_getBaseName U_ICU_ENTRY_POINT_RENAME(ulocimp_getBaseName) #define ulocimp_getCountry U_ICU_ENTRY_POINT_RENAME(ulocimp_getCountry) +#define ulocimp_getKeywordValue U_ICU_ENTRY_POINT_RENAME(ulocimp_getKeywordValue) +#define ulocimp_getKeywords U_ICU_ENTRY_POINT_RENAME(ulocimp_getKeywords) +#define ulocimp_getKnownCanonicalizedLocaleForTest U_ICU_ENTRY_POINT_RENAME(ulocimp_getKnownCanonicalizedLocaleForTest) #define ulocimp_getLanguage U_ICU_ENTRY_POINT_RENAME(ulocimp_getLanguage) #define ulocimp_getName U_ICU_ENTRY_POINT_RENAME(ulocimp_getName) #define ulocimp_getRegionForSupplementalData U_ICU_ENTRY_POINT_RENAME(ulocimp_getRegionForSupplementalData) #define ulocimp_getScript U_ICU_ENTRY_POINT_RENAME(ulocimp_getScript) +#define ulocimp_isCanonicalizedLocaleForTest U_ICU_ENTRY_POINT_RENAME(ulocimp_isCanonicalizedLocaleForTest) #define ulocimp_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_minimizeSubtags) #define ulocimp_toBcpKey U_ICU_ENTRY_POINT_RENAME(ulocimp_toBcpKey) #define ulocimp_toBcpType U_ICU_ENTRY_POINT_RENAME(ulocimp_toBcpType) @@ -1245,7 +1249,18 @@ #define unumf_resultAsValue U_ICU_ENTRY_POINT_RENAME(unumf_resultAsValue) #define unumf_resultGetAllFieldPositions U_ICU_ENTRY_POINT_RENAME(unumf_resultGetAllFieldPositions) #define unumf_resultNextFieldPosition U_ICU_ENTRY_POINT_RENAME(unumf_resultNextFieldPosition) +#define unumf_resultToDecimalNumber U_ICU_ENTRY_POINT_RENAME(unumf_resultToDecimalNumber) #define unumf_resultToString U_ICU_ENTRY_POINT_RENAME(unumf_resultToString) +#define unumrf_close U_ICU_ENTRY_POINT_RENAME(unumrf_close) +#define unumrf_closeResult U_ICU_ENTRY_POINT_RENAME(unumrf_closeResult) +#define unumrf_formatDecimalRange U_ICU_ENTRY_POINT_RENAME(unumrf_formatDecimalRange) +#define unumrf_formatDoubleRange U_ICU_ENTRY_POINT_RENAME(unumrf_formatDoubleRange) +#define unumrf_openForSkeletonWithCollapseAndIdentityFallback U_ICU_ENTRY_POINT_RENAME(unumrf_openForSkeletonWithCollapseAndIdentityFallback) +#define unumrf_openResult U_ICU_ENTRY_POINT_RENAME(unumrf_openResult) +#define unumrf_resultAsValue U_ICU_ENTRY_POINT_RENAME(unumrf_resultAsValue) +#define unumrf_resultGetFirstDecimalNumber U_ICU_ENTRY_POINT_RENAME(unumrf_resultGetFirstDecimalNumber) +#define unumrf_resultGetIdentityResult U_ICU_ENTRY_POINT_RENAME(unumrf_resultGetIdentityResult) +#define unumrf_resultGetSecondDecimalNumber U_ICU_ENTRY_POINT_RENAME(unumrf_resultGetSecondDecimalNumber) #define unumsys_close U_ICU_ENTRY_POINT_RENAME(unumsys_close) #define unumsys_getDescription U_ICU_ENTRY_POINT_RENAME(unumsys_getDescription) #define unumsys_getName U_ICU_ENTRY_POINT_RENAME(unumsys_getName) @@ -1259,6 +1274,7 @@ #define uplrules_open U_ICU_ENTRY_POINT_RENAME(uplrules_open) #define uplrules_openForType U_ICU_ENTRY_POINT_RENAME(uplrules_openForType) #define uplrules_select U_ICU_ENTRY_POINT_RENAME(uplrules_select) +#define uplrules_selectForRange U_ICU_ENTRY_POINT_RENAME(uplrules_selectForRange) #define uplrules_selectFormatted U_ICU_ENTRY_POINT_RENAME(uplrules_selectFormatted) #define uplrules_selectWithFormat U_ICU_ENTRY_POINT_RENAME(uplrules_selectWithFormat) #define uplug_closeLibrary U_ICU_ENTRY_POINT_RENAME(uplug_closeLibrary) diff --git a/deps/icu-small/source/common/unicode/ures.h b/deps/icu-small/source/common/unicode/ures.h index 839779fada804d..fff84043e84785 100644 --- a/deps/icu-small/source/common/unicode/ures.h +++ b/deps/icu-small/source/common/unicode/ures.h @@ -27,7 +27,10 @@ #include "unicode/utypes.h" #include "unicode/uloc.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** * \file @@ -163,7 +166,7 @@ typedef enum { * @see ures_close * @stable ICU 2.0 */ -U_STABLE UResourceBundle* U_EXPORT2 +U_CAPI UResourceBundle* U_EXPORT2 ures_open(const char* packageName, const char* locale, UErrorCode* status); @@ -186,7 +189,7 @@ ures_open(const char* packageName, * @see ures_close * @stable ICU 2.0 */ -U_STABLE UResourceBundle* U_EXPORT2 +U_CAPI UResourceBundle* U_EXPORT2 ures_openDirect(const char* packageName, const char* locale, UErrorCode* status); @@ -209,7 +212,7 @@ ures_openDirect(const char* packageName, * @see ures_open * @stable ICU 2.0 */ -U_STABLE UResourceBundle* U_EXPORT2 +U_CAPI UResourceBundle* U_EXPORT2 ures_openU(const UChar* packageName, const char* locale, UErrorCode* status); @@ -245,7 +248,7 @@ ures_countArrayItems(const UResourceBundle* resourceBundle, * @see ures_open * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ures_close(UResourceBundle* resourceBundle); #if U_SHOW_CPLUSPLUS_API @@ -291,7 +294,7 @@ ures_getVersionNumber(const UResourceBundle* resourceBundle); * as specified in the resource bundle or its parent. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ures_getVersion(const UResourceBundle* resB, UVersionInfo versionInfo); @@ -325,7 +328,7 @@ ures_getLocale(const UResourceBundle* resourceBundle, * @return A Locale name * @stable ICU 2.8 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 ures_getLocaleByType(const UResourceBundle* resourceBundle, ULocDataLocaleType type, UErrorCode* status); @@ -348,7 +351,7 @@ ures_getLocaleByType(const UResourceBundle* resourceBundle, * @param status The error code. * @internal */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 ures_openFillIn(UResourceBundle *r, const char* packageName, const char* localeID, @@ -372,7 +375,7 @@ ures_openFillIn(UResourceBundle *r, * @see ures_getUInt * @stable ICU 2.0 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ures_getString(const UResourceBundle* resourceBundle, int32_t* len, UErrorCode* status); @@ -383,10 +386,10 @@ ures_getString(const UResourceBundle* resourceBundle, * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() * or equivalent. * - * If forceCopy==TRUE, then the string is always written to the dest buffer + * If forceCopy==true, then the string is always written to the dest buffer * and dest is returned. * - * If forceCopy==FALSE, then the string is returned as a pointer if possible, + * If forceCopy==false, then the string is returned as a pointer if possible, * without needing a dest buffer (it can be NULL). If the string needs to be * copied or transformed, then it may be placed into dest at an arbitrary offset. * @@ -404,10 +407,10 @@ ures_getString(const UResourceBundle* resourceBundle, * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. * Can be NULL, meaning capacity=0 and the string length is not * returned to the caller. - * @param forceCopy If TRUE, then the output string will always be written to + * @param forceCopy If true, then the output string will always be written to * dest, with U_BUFFER_OVERFLOW_ERROR and * U_STRING_NOT_TERMINATED_WARNING set if appropriate. - * If FALSE, then the dest buffer may or may not contain a + * If false, then the dest buffer may or may not contain a * copy of the string. dest may or may not be modified. * If a copy needs to be written, then the UErrorCode parameter * indicates overflow etc. as usual. @@ -424,7 +427,7 @@ ures_getString(const UResourceBundle* resourceBundle, * @see u_strToUTF8 * @stable ICU 3.6 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ures_getUTF8String(const UResourceBundle *resB, char *dest, int32_t *length, UBool forceCopy, @@ -447,7 +450,7 @@ ures_getUTF8String(const UResourceBundle *resB, * @see ures_getUInt * @stable ICU 2.0 */ -U_STABLE const uint8_t* U_EXPORT2 +U_CAPI const uint8_t* U_EXPORT2 ures_getBinary(const UResourceBundle* resourceBundle, int32_t* len, UErrorCode* status); @@ -469,7 +472,7 @@ ures_getBinary(const UResourceBundle* resourceBundle, * @see ures_getUInt * @stable ICU 2.0 */ -U_STABLE const int32_t* U_EXPORT2 +U_CAPI const int32_t* U_EXPORT2 ures_getIntVector(const UResourceBundle* resourceBundle, int32_t* len, UErrorCode* status); @@ -490,7 +493,7 @@ ures_getIntVector(const UResourceBundle* resourceBundle, * @see ures_getString * @stable ICU 2.0 */ -U_STABLE uint32_t U_EXPORT2 +U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resourceBundle, UErrorCode *status); @@ -510,7 +513,7 @@ ures_getUInt(const UResourceBundle* resourceBundle, * @see ures_getString * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ures_getInt(const UResourceBundle* resourceBundle, UErrorCode *status); @@ -524,7 +527,7 @@ ures_getInt(const UResourceBundle* resourceBundle, * @return number of resources in a given resource. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ures_getSize(const UResourceBundle *resourceBundle); /** @@ -535,7 +538,7 @@ ures_getSize(const UResourceBundle *resourceBundle); * @see UResType * @stable ICU 2.0 */ -U_STABLE UResType U_EXPORT2 +U_CAPI UResType U_EXPORT2 ures_getType(const UResourceBundle *resourceBundle); /** @@ -546,7 +549,7 @@ ures_getType(const UResourceBundle *resourceBundle); * @return a key associated to this resource, or NULL if it doesn't have a key * @stable ICU 2.0 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ures_getKey(const UResourceBundle *resourceBundle); /* ITERATION API @@ -559,17 +562,17 @@ ures_getKey(const UResourceBundle *resourceBundle); * @param resourceBundle a resource * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ures_resetIterator(UResourceBundle *resourceBundle); /** * Checks whether the given resource has another element to iterate over. * * @param resourceBundle a resource - * @return TRUE if there are more elements, FALSE if there is no more elements + * @return true if there are more elements, false if there is no more elements * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ures_hasNext(const UResourceBundle *resourceBundle); /** @@ -584,7 +587,7 @@ ures_hasNext(const UResourceBundle *resourceBundle); * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it * @stable ICU 2.0 */ -U_STABLE UResourceBundle* U_EXPORT2 +U_CAPI UResourceBundle* U_EXPORT2 ures_getNextResource(UResourceBundle *resourceBundle, UResourceBundle *fillIn, UErrorCode *status); @@ -601,7 +604,7 @@ ures_getNextResource(UResourceBundle *resourceBundle, * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. * @stable ICU 2.0 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resourceBundle, int32_t* len, const char ** key, @@ -619,7 +622,7 @@ ures_getNextString(UResourceBundle *resourceBundle, * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it * @stable ICU 2.0 */ -U_STABLE UResourceBundle* U_EXPORT2 +U_CAPI UResourceBundle* U_EXPORT2 ures_getByIndex(const UResourceBundle *resourceBundle, int32_t indexR, UResourceBundle *fillIn, @@ -636,7 +639,7 @@ ures_getByIndex(const UResourceBundle *resourceBundle, * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. * @stable ICU 2.0 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resourceBundle, int32_t indexS, int32_t* len, @@ -648,10 +651,10 @@ ures_getStringByIndex(const UResourceBundle *resourceBundle, * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() * or equivalent. * - * If forceCopy==TRUE, then the string is always written to the dest buffer + * If forceCopy==true, then the string is always written to the dest buffer * and dest is returned. * - * If forceCopy==FALSE, then the string is returned as a pointer if possible, + * If forceCopy==false, then the string is returned as a pointer if possible, * without needing a dest buffer (it can be NULL). If the string needs to be * copied or transformed, then it may be placed into dest at an arbitrary offset. * @@ -670,10 +673,10 @@ ures_getStringByIndex(const UResourceBundle *resourceBundle, * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. * Can be NULL, meaning capacity=0 and the string length is not * returned to the caller. - * @param forceCopy If TRUE, then the output string will always be written to + * @param forceCopy If true, then the output string will always be written to * dest, with U_BUFFER_OVERFLOW_ERROR and * U_STRING_NOT_TERMINATED_WARNING set if appropriate. - * If FALSE, then the dest buffer may or may not contain a + * If false, then the dest buffer may or may not contain a * copy of the string. dest may or may not be modified. * If a copy needs to be written, then the UErrorCode parameter * indicates overflow etc. as usual. @@ -690,7 +693,7 @@ ures_getStringByIndex(const UResourceBundle *resourceBundle, * @see u_strToUTF8 * @stable ICU 3.6 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ures_getUTF8StringByIndex(const UResourceBundle *resB, int32_t stringIndex, char *dest, int32_t *pLength, @@ -709,7 +712,7 @@ ures_getUTF8StringByIndex(const UResourceBundle *resB, * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it * @stable ICU 2.0 */ -U_STABLE UResourceBundle* U_EXPORT2 +U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resourceBundle, const char* key, UResourceBundle *fillIn, @@ -727,7 +730,7 @@ ures_getByKey(const UResourceBundle *resourceBundle, * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. * @stable ICU 2.0 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, const char* key, int32_t* len, @@ -741,10 +744,10 @@ ures_getStringByKey(const UResourceBundle *resB, * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() * or equivalent. * - * If forceCopy==TRUE, then the string is always written to the dest buffer + * If forceCopy==true, then the string is always written to the dest buffer * and dest is returned. * - * If forceCopy==FALSE, then the string is returned as a pointer if possible, + * If forceCopy==false, then the string is returned as a pointer if possible, * without needing a dest buffer (it can be NULL). If the string needs to be * copied or transformed, then it may be placed into dest at an arbitrary offset. * @@ -763,10 +766,10 @@ ures_getStringByKey(const UResourceBundle *resB, * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. * Can be NULL, meaning capacity=0 and the string length is not * returned to the caller. - * @param forceCopy If TRUE, then the output string will always be written to + * @param forceCopy If true, then the output string will always be written to * dest, with U_BUFFER_OVERFLOW_ERROR and * U_STRING_NOT_TERMINATED_WARNING set if appropriate. - * If FALSE, then the dest buffer may or may not contain a + * If false, then the dest buffer may or may not contain a * copy of the string. dest may or may not be modified. * If a copy needs to be written, then the UErrorCode parameter * indicates overflow etc. as usual. @@ -783,7 +786,7 @@ ures_getStringByKey(const UResourceBundle *resB, * @see u_strToUTF8 * @stable ICU 3.6 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ures_getUTF8StringByKey(const UResourceBundle *resB, const char *key, char *dest, int32_t *pLength, @@ -811,7 +814,7 @@ ures_getUnicodeString(const UResourceBundle *resB, UErrorCode* status) { int32_t len = 0; const UChar *r = ures_getString(resB, &len, status); if(U_SUCCESS(*status)) { - result.setTo(TRUE, r, len); + result.setTo(true, r, len); } else { result.setToBogus(); } @@ -836,7 +839,7 @@ ures_getNextUnicodeString(UResourceBundle *resB, const char ** key, UErrorCode* int32_t len = 0; const UChar* r = ures_getNextString(resB, &len, key, status); if(U_SUCCESS(*status)) { - result.setTo(TRUE, r, len); + result.setTo(true, r, len); } else { result.setToBogus(); } @@ -858,7 +861,7 @@ ures_getUnicodeStringByIndex(const UResourceBundle *resB, int32_t indexS, UError int32_t len = 0; const UChar* r = ures_getStringByIndex(resB, indexS, &len, status); if(U_SUCCESS(*status)) { - result.setTo(TRUE, r, len); + result.setTo(true, r, len); } else { result.setToBogus(); } @@ -881,7 +884,7 @@ ures_getUnicodeStringByKey(const UResourceBundle *resB, const char* key, UErrorC int32_t len = 0; const UChar* r = ures_getStringByKey(resB, key, &len, status); if(U_SUCCESS(*status)) { - result.setTo(TRUE, r, len); + result.setTo(true, r, len); } else { result.setToBogus(); } @@ -900,7 +903,7 @@ U_NAMESPACE_END * @param status error code * @stable ICU 3.2 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 ures_openAvailableLocales(const char *packageName, UErrorCode *status); diff --git a/deps/icu-small/source/common/unicode/uscript.h b/deps/icu-small/source/common/unicode/uscript.h index 53d57abed14cd0..8448afda761550 100644 --- a/deps/icu-small/source/common/unicode/uscript.h +++ b/deps/icu-small/source/common/unicode/uscript.h @@ -514,7 +514,7 @@ typedef enum UScriptCode { * @return The number of script codes filled in the buffer passed in * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uscript_getCode(const char* nameOrAbbrOrLocale,UScriptCode* fillIn,int32_t capacity,UErrorCode *err); /** @@ -527,7 +527,7 @@ uscript_getCode(const char* nameOrAbbrOrLocale,UScriptCode* fillIn,int32_t capac * or NULL if scriptCode is invalid * @stable ICU 2.4 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uscript_getName(UScriptCode scriptCode); /** @@ -539,7 +539,7 @@ uscript_getName(UScriptCode scriptCode); * @return short script name (4-letter code), or NULL if scriptCode is invalid * @stable ICU 2.4 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uscript_getShortName(UScriptCode scriptCode); /** @@ -550,7 +550,7 @@ uscript_getShortName(UScriptCode scriptCode); * @return The UScriptCode, or 0 if codepoint is invalid * @stable ICU 2.4 */ -U_STABLE UScriptCode U_EXPORT2 +U_CAPI UScriptCode U_EXPORT2 uscript_getScript(UChar32 codepoint, UErrorCode *err); /** @@ -562,10 +562,10 @@ uscript_getScript(UChar32 codepoint, UErrorCode *err); * For more information, see UAX #24: http://www.unicode.org/reports/tr24/. * @param c code point * @param sc script code - * @return TRUE if sc is in Script_Extensions(c) + * @return true if sc is in Script_Extensions(c) * @stable ICU 49 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uscript_hasScript(UChar32 c, UScriptCode sc); /** @@ -597,7 +597,7 @@ uscript_hasScript(UChar32 c, UScriptCode sc); * written to scripts unless U_BUFFER_OVERFLOW_ERROR indicates insufficient capacity * @stable ICU 49 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uscript_getScriptExtensions(UChar32 c, UScriptCode *scripts, int32_t capacity, UErrorCode *errorCode); @@ -636,7 +636,7 @@ typedef enum UScriptUsage { * @return the string length, even if U_BUFFER_OVERFLOW_ERROR * @stable ICU 51 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uscript_getSampleString(UScriptCode script, UChar *dest, int32_t capacity, UErrorCode *pErrorCode); #if U_SHOW_CPLUSPLUS_API @@ -668,41 +668,41 @@ uscript_getSampleUnicodeString(UScriptCode script); * @see UScriptUsage * @stable ICU 51 */ -U_STABLE UScriptUsage U_EXPORT2 +U_CAPI UScriptUsage U_EXPORT2 uscript_getUsage(UScriptCode script); /** - * Returns TRUE if the script is written right-to-left. + * Returns true if the script is written right-to-left. * For example, Arab and Hebr. * * @param script script code - * @return TRUE if the script is right-to-left + * @return true if the script is right-to-left * @stable ICU 51 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uscript_isRightToLeft(UScriptCode script); /** - * Returns TRUE if the script allows line breaks between letters (excluding hyphenation). + * Returns true if the script allows line breaks between letters (excluding hyphenation). * Such a script typically requires dictionary-based line breaking. * For example, Hani and Thai. * * @param script script code - * @return TRUE if the script allows line breaks between letters + * @return true if the script allows line breaks between letters * @stable ICU 51 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uscript_breaksBetweenLetters(UScriptCode script); /** - * Returns TRUE if in modern (or most recent) usage of the script case distinctions are customary. + * Returns true if in modern (or most recent) usage of the script case distinctions are customary. * For example, Latn and Cyrl. * * @param script script code - * @return TRUE if the script is cased + * @return true if the script is cased * @stable ICU 51 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uscript_isCased(UScriptCode script); #endif diff --git a/deps/icu-small/source/common/unicode/uset.h b/deps/icu-small/source/common/unicode/uset.h index ef6bbb5c38f3fb..473cc6fbae4e0d 100644 --- a/deps/icu-small/source/common/unicode/uset.h +++ b/deps/icu-small/source/common/unicode/uset.h @@ -31,7 +31,10 @@ #include "unicode/utypes.h" #include "unicode/uchar.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API #ifndef USET_DEFINED @@ -158,7 +161,7 @@ typedef enum USetSpanCondition { * Continues a span() while there is no set element at the current position. * Increments by one code point at a time. * Stops before the first set element (character or string). - * (For code points only, this is like while contains(current)==FALSE). + * (For code points only, this is like while contains(current)==false). * * When span() returns, the substring between where it started and the position * it returned consists only of characters that are not in the set, @@ -169,7 +172,7 @@ typedef enum USetSpanCondition { USET_SPAN_NOT_CONTAINED = 0, /** * Spans the longest substring that is a concatenation of set elements (characters or strings). - * (For characters only, this is like while contains(current)==TRUE). + * (For characters only, this is like while contains(current)==true). * * When span() returns, the substring between where it started and the position * it returned consists only of set elements (characters or strings) that are in the set. @@ -185,7 +188,7 @@ typedef enum USetSpanCondition { /** * Continues a span() while there is a set element at the current position. * Increments by the longest matching element at each position. - * (For characters only, this is like while contains(current)==TRUE). + * (For characters only, this is like while contains(current)==true). * * When span() returns, the substring between where it started and the position * it returned consists only of set elements (characters or strings) that are in the set. @@ -260,7 +263,7 @@ typedef struct USerializedSet { * it when done. * @stable ICU 4.2 */ -U_STABLE USet* U_EXPORT2 +U_CAPI USet* U_EXPORT2 uset_openEmpty(void); /** @@ -273,7 +276,7 @@ uset_openEmpty(void); * it when done. * @stable ICU 2.4 */ -U_STABLE USet* U_EXPORT2 +U_CAPI USet* U_EXPORT2 uset_open(UChar32 start, UChar32 end); /** @@ -285,7 +288,7 @@ uset_open(UChar32 start, UChar32 end); * @param ec the error code * @stable ICU 2.4 */ -U_STABLE USet* U_EXPORT2 +U_CAPI USet* U_EXPORT2 uset_openPattern(const UChar* pattern, int32_t patternLength, UErrorCode* ec); @@ -300,7 +303,7 @@ uset_openPattern(const UChar* pattern, int32_t patternLength, * @param ec the error code * @stable ICU 2.4 */ -U_STABLE USet* U_EXPORT2 +U_CAPI USet* U_EXPORT2 uset_openPatternOptions(const UChar* pattern, int32_t patternLength, uint32_t options, UErrorCode* ec); @@ -311,7 +314,7 @@ uset_openPatternOptions(const UChar* pattern, int32_t patternLength, * @param set the object to dispose of * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_close(USet* set); #if U_SHOW_CPLUSPLUS_API @@ -342,19 +345,19 @@ U_NAMESPACE_END * @see uset_cloneAsThawed * @stable ICU 3.8 */ -U_STABLE USet * U_EXPORT2 +U_CAPI USet * U_EXPORT2 uset_clone(const USet *set); /** * Determines whether the set has been frozen (made immutable) or not. * See the ICU4J Freezable interface for details. * @param set the set - * @return TRUE/FALSE for whether the set has been frozen + * @return true/false for whether the set has been frozen * @see uset_freeze * @see uset_cloneAsThawed * @stable ICU 3.8 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_isFrozen(const USet *set); /** @@ -371,7 +374,7 @@ uset_isFrozen(const USet *set); * @see uset_cloneAsThawed * @stable ICU 3.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_freeze(USet *set); /** @@ -384,7 +387,7 @@ uset_freeze(USet *set); * @see uset_clone * @stable ICU 3.8 */ -U_STABLE USet * U_EXPORT2 +U_CAPI USet * U_EXPORT2 uset_cloneAsThawed(const USet *set); /** @@ -396,7 +399,7 @@ uset_cloneAsThawed(const USet *set); * @param end last character in the set, inclusive * @stable ICU 3.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_set(USet* set, UChar32 start, UChar32 end); @@ -421,7 +424,7 @@ uset_set(USet* set, * * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_applyPattern(USet *set, const UChar *pattern, int32_t patternLength, uint32_t options, @@ -449,7 +452,7 @@ uset_applyPattern(USet *set, * * @stable ICU 3.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_applyIntPropertyValue(USet* set, UProperty prop, int32_t value, UErrorCode* ec); @@ -488,7 +491,7 @@ uset_applyIntPropertyValue(USet* set, * * @stable ICU 3.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_applyPropertyAlias(USet* set, const UChar *prop, int32_t propLength, const UChar *value, int32_t valueLength, @@ -503,7 +506,7 @@ uset_applyPropertyAlias(USet* set, * @param pos the given position * @stable ICU 3.2 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_resemblesPattern(const UChar *pattern, int32_t patternLength, int32_t pos); @@ -514,7 +517,7 @@ uset_resemblesPattern(const UChar *pattern, int32_t patternLength, * @param set the set * @param result the string to receive the rules, may be NULL * @param resultCapacity the capacity of result, may be 0 if result is NULL - * @param escapeUnprintable if TRUE then convert unprintable + * @param escapeUnprintable if true then convert unprintable * character to their hex escape representations, \\uxxxx or * \\Uxxxxxxxx. Unprintable characters are those other than * U+000A, U+0020..U+007E. @@ -522,7 +525,7 @@ uset_resemblesPattern(const UChar *pattern, int32_t patternLength, * @return length of string, possibly larger than resultCapacity * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_toPattern(const USet* set, UChar* result, int32_t resultCapacity, UBool escapeUnprintable, @@ -530,13 +533,13 @@ uset_toPattern(const USet* set, /** * Adds the given character to the given USet. After this call, - * uset_contains(set, c) will return TRUE. + * uset_contains(set, c) will return true. * A frozen set will not be modified. * @param set the object to which to add the character * @param c the character to add * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_add(USet* set, UChar32 c); /** @@ -551,31 +554,31 @@ uset_add(USet* set, UChar32 c); * @param additionalSet the source set whose elements are to be added to this set. * @stable ICU 2.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_addAll(USet* set, const USet *additionalSet); /** * Adds the given range of characters to the given USet. After this call, - * uset_contains(set, start, end) will return TRUE. + * uset_contains(set, start, end) will return true. * A frozen set will not be modified. * @param set the object to which to add the character * @param start the first character of the range to add, inclusive * @param end the last character of the range to add, inclusive * @stable ICU 2.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_addRange(USet* set, UChar32 start, UChar32 end); /** * Adds the given string to the given USet. After this call, - * uset_containsString(set, str, strLen) will return TRUE. + * uset_containsString(set, str, strLen) will return true. * A frozen set will not be modified. * @param set the object to which to add the character * @param str the string to add * @param strLen the length of the string or -1 if null terminated. * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_addString(USet* set, const UChar* str, int32_t strLen); /** @@ -587,42 +590,42 @@ uset_addString(USet* set, const UChar* str, int32_t strLen); * @param strLen the length of the string or -1 if null terminated. * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_addAllCodePoints(USet* set, const UChar *str, int32_t strLen); /** * Removes the given character from the given USet. After this call, - * uset_contains(set, c) will return FALSE. + * uset_contains(set, c) will return false. * A frozen set will not be modified. * @param set the object from which to remove the character * @param c the character to remove * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_remove(USet* set, UChar32 c); /** * Removes the given range of characters from the given USet. After this call, - * uset_contains(set, start, end) will return FALSE. + * uset_contains(set, start, end) will return false. * A frozen set will not be modified. * @param set the object to which to add the character * @param start the first character of the range to remove, inclusive * @param end the last character of the range to remove, inclusive * @stable ICU 2.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_removeRange(USet* set, UChar32 start, UChar32 end); /** * Removes the given string to the given USet. After this call, - * uset_containsString(set, str, strLen) will return FALSE. + * uset_containsString(set, str, strLen) will return false. * A frozen set will not be modified. * @param set the object to which to add the character * @param str the string to remove * @param strLen the length of the string or -1 if null terminated. * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_removeString(USet* set, const UChar* str, int32_t strLen); /** @@ -636,7 +639,7 @@ uset_removeString(USet* set, const UChar* str, int32_t strLen); * removed from this set * @stable ICU 3.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_removeAll(USet* set, const USet* removeSet); /** @@ -653,7 +656,7 @@ uset_removeAll(USet* set, const USet* removeSet); * to this set. * @stable ICU 3.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_retain(USet* set, UChar32 start, UChar32 end); /** @@ -668,7 +671,7 @@ uset_retain(USet* set, UChar32 start, UChar32 end); * @param retain set that defines which elements this set will retain * @stable ICU 3.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_retainAll(USet* set, const USet* retain); /** @@ -679,7 +682,7 @@ uset_retainAll(USet* set, const USet* retain); * @param set the object on which to perfrom the compact * @stable ICU 3.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_compact(USet* set); /** @@ -690,7 +693,7 @@ uset_compact(USet* set); * @param set the set * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_complement(USet* set); /** @@ -704,7 +707,7 @@ uset_complement(USet* set); * from this set. * @stable ICU 3.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_complementAll(USet* set, const USet* complement); /** @@ -714,7 +717,7 @@ uset_complementAll(USet* set, const USet* complement); * @param set the set * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_clear(USet* set); /** @@ -743,7 +746,7 @@ uset_clear(USet* set); * are ignored. * @stable ICU 4.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_closeOver(USet* set, int32_t attributes); /** @@ -752,51 +755,51 @@ uset_closeOver(USet* set, int32_t attributes); * @param set the set * @stable ICU 4.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_removeAllStrings(USet* set); /** - * Returns TRUE if the given USet contains no characters and no + * Returns true if the given USet contains no characters and no * strings. * @param set the set * @return true if set is empty * @stable ICU 2.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_isEmpty(const USet* set); /** - * Returns TRUE if the given USet contains the given character. + * Returns true if the given USet contains the given character. * This function works faster with a frozen set. * @param set the set * @param c The codepoint to check for within the set * @return true if set contains c * @stable ICU 2.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_contains(const USet* set, UChar32 c); /** - * Returns TRUE if the given USet contains all characters c + * Returns true if the given USet contains all characters c * where start <= c && c <= end. * @param set the set * @param start the first character of the range to test, inclusive * @param end the last character of the range to test, inclusive - * @return TRUE if set contains the range + * @return true if set contains the range * @stable ICU 2.2 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_containsRange(const USet* set, UChar32 start, UChar32 end); /** - * Returns TRUE if the given USet contains the given string. + * Returns true if the given USet contains the given string. * @param set the set * @param str the string * @param strLen the length of the string or -1 if null terminated. * @return true if set contains str * @stable ICU 2.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_containsString(const USet* set, const UChar* str, int32_t strLen); /** @@ -809,7 +812,7 @@ uset_containsString(const USet* set, const UChar* str, int32_t strLen); * @return an index from 0..size()-1, or -1 * @stable ICU 3.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_indexOf(const USet* set, UChar32 c); /** @@ -822,7 +825,7 @@ uset_indexOf(const USet* set, UChar32 c); * @return the character at the given index, or (UChar32)-1. * @stable ICU 3.2 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 uset_charAt(const USet* set, int32_t charIndex); /** @@ -833,7 +836,7 @@ uset_charAt(const USet* set, int32_t charIndex); * contained in set * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_size(const USet* set); /** @@ -844,7 +847,7 @@ uset_size(const USet* set); * and/or strings contained in set * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_getItemCount(const USet* set); /** @@ -865,7 +868,7 @@ uset_getItemCount(const USet* set); * itemIndex is out of range * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_getItem(const USet* set, int32_t itemIndex, UChar32* start, UChar32* end, UChar* str, int32_t strCapacity, @@ -879,7 +882,7 @@ uset_getItem(const USet* set, int32_t itemIndex, * @return true if the test condition is met * @stable ICU 3.2 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_containsAll(const USet* set1, const USet* set2); /** @@ -892,7 +895,7 @@ uset_containsAll(const USet* set1, const USet* set2); * @return true if the test condition is met * @stable ICU 3.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_containsAllCodePoints(const USet* set, const UChar *str, int32_t strLen); /** @@ -903,7 +906,7 @@ uset_containsAllCodePoints(const USet* set, const UChar *str, int32_t strLen); * @return true if the test condition is met * @stable ICU 3.2 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_containsNone(const USet* set1, const USet* set2); /** @@ -914,7 +917,7 @@ uset_containsNone(const USet* set1, const USet* set2); * @return true if the test condition is met * @stable ICU 3.2 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_containsSome(const USet* set1, const USet* set2); /** @@ -936,7 +939,7 @@ uset_containsSome(const USet* set1, const USet* set2); * @stable ICU 3.8 * @see USetSpanCondition */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_span(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition); /** @@ -957,7 +960,7 @@ uset_span(const USet *set, const UChar *s, int32_t length, USetSpanCondition spa * @stable ICU 3.8 * @see USetSpanCondition */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition); /** @@ -979,7 +982,7 @@ uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCondition * @stable ICU 3.8 * @see USetSpanCondition */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_spanUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition); /** @@ -1000,7 +1003,7 @@ uset_spanUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition * @stable ICU 3.8 * @see USetSpanCondition */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_spanBackUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition); /** @@ -1011,7 +1014,7 @@ uset_spanBackUTF8(const USet *set, const char *s, int32_t length, USetSpanCondit * @return true if the test condition is met * @stable ICU 3.2 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_equals(const USet* set1, const USet* set2); /********************************************************************* @@ -1067,7 +1070,7 @@ uset_equals(const USet* set1, const USet* set2); * than U_BUFFER_OVERFLOW_ERROR. * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode* pErrorCode); /** @@ -1078,7 +1081,7 @@ uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode * @return true if the given array is valid, otherwise false * @stable ICU 2.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcLength); /** @@ -1088,18 +1091,18 @@ uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcL * @param c The codepoint to set * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_setSerializedToOne(USerializedSet* fillSet, UChar32 c); /** - * Returns TRUE if the given USerializedSet contains the given + * Returns true if the given USerializedSet contains the given * character. * @param set the serialized set * @param c The codepoint to check for within the set * @return true if set contains c * @stable ICU 2.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_serializedContains(const USerializedSet* set, UChar32 c); /** @@ -1111,7 +1114,7 @@ uset_serializedContains(const USerializedSet* set, UChar32 c); * contained in set * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_getSerializedRangeCount(const USerializedSet* set); /** @@ -1127,7 +1130,7 @@ uset_getSerializedRangeCount(const USerializedSet* set); * @return true if rangeIndex is valid, otherwise false * @stable ICU 2.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, UChar32* pStart, UChar32* pEnd); diff --git a/deps/icu-small/source/common/unicode/usetiter.h b/deps/icu-small/source/common/unicode/usetiter.h index f3f470f95aa5f5..45d268a05c9b90 100644 --- a/deps/icu-small/source/common/unicode/usetiter.h +++ b/deps/icu-small/source/common/unicode/usetiter.h @@ -176,7 +176,7 @@ class U_COMMON_API UnicodeSetIterator : public UObject { * If there are no more elements in the set, return false. * *

    - * If isString() == TRUE, the value is a + * If isString() == true, the value is a * string, otherwise the value is a * single code point. Elements of either type can be retrieved * with the function getString(), while elements of @@ -197,7 +197,7 @@ class U_COMMON_API UnicodeSetIterator : public UObject { /** * Returns the next element in the set, either a code point range * or a string. If there are no more elements in the set, return - * false. If isString() == TRUE, the value is a + * false. If isString() == true, the value is a * string and can be accessed with getString(). Otherwise the value is a * range of one or more code points from getCodepoint() to * getCodepointeEnd() inclusive. @@ -205,7 +205,7 @@ class U_COMMON_API UnicodeSetIterator : public UObject { *

    The order of iteration is all code points ranges in sorted * order, followed by all strings sorted order. Ranges are * disjoint and non-contiguous. The value returned from getString() - * is undefined unless isString() == TRUE. Do not mix calls to + * is undefined unless isString() == true. Do not mix calls to * next() and nextRange() without calling * reset() between them. The results of doing so are * undefined. diff --git a/deps/icu-small/source/common/unicode/ushape.h b/deps/icu-small/source/common/unicode/ushape.h index 3064e0857281c5..9a85b73e4cba80 100644 --- a/deps/icu-small/source/common/unicode/ushape.h +++ b/deps/icu-small/source/common/unicode/ushape.h @@ -98,7 +98,7 @@ * the return value indicates the necessary destination buffer size. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_shapeArabic(const UChar *source, int32_t sourceLength, UChar *dest, int32_t destSize, uint32_t options, diff --git a/deps/icu-small/source/common/unicode/usprep.h b/deps/icu-small/source/common/unicode/usprep.h index 7cdc6cdd18ea6b..be06189e2e9e6d 100644 --- a/deps/icu-small/source/common/unicode/usprep.h +++ b/deps/icu-small/source/common/unicode/usprep.h @@ -25,7 +25,10 @@ */ #include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** * @@ -181,7 +184,7 @@ typedef enum UStringPrepProfileType { * @see usprep_close() * @stable ICU 2.8 */ -U_STABLE UStringPrepProfile* U_EXPORT2 +U_CAPI UStringPrepProfile* U_EXPORT2 usprep_open(const char* path, const char* fileName, UErrorCode* status); @@ -197,7 +200,7 @@ usprep_open(const char* path, * @see usprep_close() * @stable ICU 4.2 */ -U_STABLE UStringPrepProfile* U_EXPORT2 +U_CAPI UStringPrepProfile* U_EXPORT2 usprep_openByType(UStringPrepProfileType type, UErrorCode* status); @@ -206,7 +209,7 @@ usprep_openByType(UStringPrepProfileType type, * @param profile The profile to close * @stable ICU 2.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 usprep_close(UStringPrepProfile* profile); #if U_SHOW_CPLUSPLUS_API @@ -257,7 +260,7 @@ U_NAMESPACE_END * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 usprep_prepare( const UStringPrepProfile* prep, const UChar* src, int32_t srcLength, UChar* dest, int32_t destCapacity, diff --git a/deps/icu-small/source/common/unicode/ustring.h b/deps/icu-small/source/common/unicode/ustring.h index 0d2274a0cabb51..3243acbb7ebfce 100644 --- a/deps/icu-small/source/common/unicode/ustring.h +++ b/deps/icu-small/source/common/unicode/ustring.h @@ -89,7 +89,7 @@ * @return The number of UChars in chars, minus the terminator. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strlen(const UChar *s); /*@}*/ @@ -106,7 +106,7 @@ u_strlen(const UChar *s); * @return The number of code points in the specified code units. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_countChar32(const UChar *s, int32_t length); /** @@ -127,7 +127,7 @@ u_countChar32(const UChar *s, int32_t length); * than 'number'. Same as (u_countChar32(s, length)>number). * @stable ICU 2.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number); /** @@ -140,7 +140,7 @@ u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number); * @return A pointer to dst. * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strcat(UChar *dst, const UChar *src); @@ -158,7 +158,7 @@ u_strcat(UChar *dst, * @return A pointer to dst. * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strncat(UChar *dst, const UChar *src, int32_t n); @@ -183,7 +183,7 @@ u_strncat(UChar *dst, * @see u_strFindFirst * @see u_strFindLast */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strstr(const UChar *s, const UChar *substring); /** @@ -207,7 +207,7 @@ u_strstr(const UChar *s, const UChar *substring); * @see u_strstr * @see u_strFindLast */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); /** @@ -227,7 +227,7 @@ u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t s * @see u_strstr * @see u_strFindFirst */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strchr(const UChar *s, UChar c); /** @@ -247,7 +247,7 @@ u_strchr(const UChar *s, UChar c); * @see u_strstr * @see u_strFindFirst */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strchr32(const UChar *s, UChar32 c); /** @@ -270,7 +270,7 @@ u_strchr32(const UChar *s, UChar32 c); * @see u_strFindFirst * @see u_strFindLast */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strrstr(const UChar *s, const UChar *substring); /** @@ -294,7 +294,7 @@ u_strrstr(const UChar *s, const UChar *substring); * @see u_strstr * @see u_strFindLast */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); /** @@ -314,7 +314,7 @@ u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t su * @see u_strrstr * @see u_strFindLast */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strrchr(const UChar *s, UChar c); /** @@ -334,7 +334,7 @@ u_strrchr(const UChar *s, UChar c); * @see u_strrstr * @see u_strFindLast */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strrchr32(const UChar *s, UChar32 c); /** @@ -349,7 +349,7 @@ u_strrchr32(const UChar *s, UChar32 c); * characters in matchSet, or NULL if no such character is found. * @stable ICU 2.0 */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strpbrk(const UChar *string, const UChar *matchSet); /** @@ -365,7 +365,7 @@ u_strpbrk(const UChar *string, const UChar *matchSet); * @see u_strspn * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strcspn(const UChar *string, const UChar *matchSet); /** @@ -381,7 +381,7 @@ u_strcspn(const UChar *string, const UChar *matchSet); * @see u_strcspn * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strspn(const UChar *string, const UChar *matchSet); /** @@ -409,7 +409,7 @@ u_strspn(const UChar *string, const UChar *matchSet); * when there are no more tokens. * @stable ICU 2.0 */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strtok_r(UChar *src, const UChar *delim, UChar **saveState); @@ -424,7 +424,7 @@ u_strtok_r(UChar *src, * value if s1 is bitwise greater than s2. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strcmp(const UChar *s1, const UChar *s2); @@ -439,7 +439,7 @@ u_strcmp(const UChar *s1, * in code point order * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strcmpCodePointOrder(const UChar *s1, const UChar *s2); /** @@ -462,14 +462,14 @@ u_strcmpCodePointOrder(const UChar *s1, const UChar *s2); * @param s2 Second source string. * @param length2 Length of second source string, or -1 if NUL-terminated. * - * @param codePointOrder Choose between code unit order (FALSE) - * and code point order (TRUE). + * @param codePointOrder Choose between code unit order (false) + * and code point order (true). * * @return <0 or 0 or >0 as usual for string comparisons * * @stable ICU 2.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strCompare(const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, UBool codePointOrder); @@ -485,8 +485,8 @@ u_strCompare(const UChar *s1, int32_t length1, * * @param iter1 First source string iterator. * @param iter2 Second source string iterator. - * @param codePointOrder Choose between code unit order (FALSE) - * and code point order (TRUE). + * @param codePointOrder Choose between code unit order (false) + * and code point order (true). * * @return <0 or 0 or >0 as usual for string comparisons * @@ -494,7 +494,7 @@ u_strCompare(const UChar *s1, int32_t length1, * * @stable ICU 2.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder); /** @@ -537,7 +537,7 @@ u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrde * * @stable ICU 2.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strCaseCompare(const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, uint32_t options, @@ -555,7 +555,7 @@ u_strCaseCompare(const UChar *s1, int32_t length1, * value if s1 is bitwise greater than s2. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strncmp(const UChar *ucs1, const UChar *ucs2, int32_t n); @@ -573,7 +573,7 @@ u_strncmp(const UChar *ucs1, * in code point order * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n); /** @@ -595,7 +595,7 @@ u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n); * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options); /** @@ -619,7 +619,7 @@ u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options); * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options); /** @@ -643,7 +643,7 @@ u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options); * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options); /** @@ -654,7 +654,7 @@ u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options) * @return A pointer to dst. * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strcpy(UChar *dst, const UChar *src); @@ -669,7 +669,7 @@ u_strcpy(UChar *dst, * @return A pointer to dst. * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strncpy(UChar *dst, const UChar *src, int32_t n); @@ -686,7 +686,7 @@ u_strncpy(UChar *dst, * @return A pointer to dst. * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst, +U_CAPI UChar* U_EXPORT2 u_uastrcpy(UChar *dst, const char *src ); /** @@ -701,7 +701,7 @@ U_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst, * @return A pointer to dst. * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst, +U_CAPI UChar* U_EXPORT2 u_uastrncpy(UChar *dst, const char *src, int32_t n); @@ -715,7 +715,7 @@ U_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst, * @return A pointer to dst. * @stable ICU 2.0 */ -U_STABLE char* U_EXPORT2 u_austrcpy(char *dst, +U_CAPI char* U_EXPORT2 u_austrcpy(char *dst, const UChar *src ); /** @@ -730,7 +730,7 @@ U_STABLE char* U_EXPORT2 u_austrcpy(char *dst, * @return A pointer to dst. * @stable ICU 2.0 */ -U_STABLE char* U_EXPORT2 u_austrncpy(char *dst, +U_CAPI char* U_EXPORT2 u_austrncpy(char *dst, const UChar *src, int32_t n ); @@ -744,7 +744,7 @@ U_STABLE char* U_EXPORT2 u_austrncpy(char *dst, * @return A pointer to dest * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_memcpy(UChar *dest, const UChar *src, int32_t count); /** @@ -755,7 +755,7 @@ u_memcpy(UChar *dest, const UChar *src, int32_t count); * @return A pointer to dest * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_memmove(UChar *dest, const UChar *src, int32_t count); /** @@ -767,7 +767,7 @@ u_memmove(UChar *dest, const UChar *src, int32_t count); * @return A pointer to dest. * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_memset(UChar *dest, UChar c, int32_t count); /** @@ -781,7 +781,7 @@ u_memset(UChar *dest, UChar c, int32_t count); * When buf1 > buf2, a positive number is returned. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count); /** @@ -797,7 +797,7 @@ u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count); * in code point order * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count); /** @@ -817,7 +817,7 @@ u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count); * @see u_memchr32 * @see u_strFindFirst */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_memchr(const UChar *s, UChar c, int32_t count); /** @@ -837,7 +837,7 @@ u_memchr(const UChar *s, UChar c, int32_t count); * @see u_memchr * @see u_strFindFirst */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_memchr32(const UChar *s, UChar32 c, int32_t count); /** @@ -857,7 +857,7 @@ u_memchr32(const UChar *s, UChar32 c, int32_t count); * @see u_memrchr32 * @see u_strFindLast */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_memrchr(const UChar *s, UChar c, int32_t count); /** @@ -877,7 +877,7 @@ u_memrchr(const UChar *s, UChar c, int32_t count); * @see u_memrchr * @see u_strFindLast */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_memrchr32(const UChar *s, UChar32 c, int32_t count); /** @@ -903,13 +903,13 @@ u_memrchr32(const UChar *s, UChar32 c, int32_t count); * * U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11); * U_STRING_DECL(ustringVar2, "jumps 5%", 8); - * static UBool didInit=FALSE; + * static UBool didInit=false; * * int32_t function() { * if(!didInit) { * U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11); * U_STRING_INIT(ustringVar2, "jumps 5%", 8); - * didInit=TRUE; + * didInit=true; * } * return u_strcmp(ustringVar1, ustringVar2); * } @@ -992,7 +992,7 @@ u_memrchr32(const UChar *s, UChar32 c, int32_t count); * @see UnicodeString#unescapeAt() * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_unescape(const char *src, UChar *dest, int32_t destCapacity); @@ -1040,7 +1040,7 @@ U_CDECL_END * @see UnicodeString#unescapeAt() * @stable ICU 2.0 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 u_unescapeAt(UNESCAPE_CHAR_AT charAt, int32_t *offset, int32_t length, @@ -1066,7 +1066,7 @@ u_unescapeAt(UNESCAPE_CHAR_AT charAt, * only some of the result was written to the destination buffer. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strToUpper(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, const char *locale, @@ -1092,7 +1092,7 @@ u_strToUpper(UChar *dest, int32_t destCapacity, * only some of the result was written to the destination buffer. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strToLower(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, const char *locale, @@ -1138,7 +1138,7 @@ u_strToLower(UChar *dest, int32_t destCapacity, * only some of the result was written to the destination buffer. * @stable ICU 2.1 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strToTitle(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, UBreakIterator *titleIter, @@ -1171,7 +1171,7 @@ u_strToTitle(UChar *dest, int32_t destCapacity, * only some of the result was written to the destination buffer. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strFoldCase(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, uint32_t options, @@ -1200,7 +1200,7 @@ u_strFoldCase(UChar *dest, int32_t destCapacity, * @return The pointer to destination buffer. * @stable ICU 2.0 */ -U_STABLE wchar_t* U_EXPORT2 +U_CAPI wchar_t* U_EXPORT2 u_strToWCS(wchar_t *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1229,7 +1229,7 @@ u_strToWCS(wchar_t *dest, * @return The pointer to destination buffer. * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strFromWCS(UChar *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1260,7 +1260,7 @@ u_strFromWCS(UChar *dest, * @see u_strToUTF8WithSub * @see u_strFromUTF8 */ -U_STABLE char* U_EXPORT2 +U_CAPI char* U_EXPORT2 u_strToUTF8(char *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1290,7 +1290,7 @@ u_strToUTF8(char *dest, * @see u_strFromUTF8WithSub * @see u_strFromUTF8Lenient */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strFromUTF8(UChar *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1333,7 +1333,7 @@ u_strFromUTF8(UChar *dest, * @see u_strFromUTF8WithSub * @stable ICU 3.6 */ -U_STABLE char* U_EXPORT2 +U_CAPI char* U_EXPORT2 u_strToUTF8WithSub(char *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1378,7 +1378,7 @@ u_strToUTF8WithSub(char *dest, * @see u_strToUTF8WithSub * @stable ICU 3.6 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strFromUTF8WithSub(UChar *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1438,7 +1438,7 @@ u_strFromUTF8WithSub(UChar *dest, * @see u_strToUTF8WithSub * @stable ICU 3.6 */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strFromUTF8Lenient(UChar *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1468,7 +1468,7 @@ u_strFromUTF8Lenient(UChar *dest, * @see u_strFromUTF32 * @stable ICU 2.0 */ -U_STABLE UChar32* U_EXPORT2 +U_CAPI UChar32* U_EXPORT2 u_strToUTF32(UChar32 *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1498,7 +1498,7 @@ u_strToUTF32(UChar32 *dest, * @see u_strToUTF32 * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strFromUTF32(UChar *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1541,7 +1541,7 @@ u_strFromUTF32(UChar *dest, * @see u_strFromUTF32WithSub * @stable ICU 4.2 */ -U_STABLE UChar32* U_EXPORT2 +U_CAPI UChar32* U_EXPORT2 u_strToUTF32WithSub(UChar32 *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1585,7 +1585,7 @@ u_strToUTF32WithSub(UChar32 *dest, * @see u_strToUTF32WithSub * @stable ICU 4.2 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strFromUTF32WithSub(UChar *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1626,7 +1626,7 @@ u_strFromUTF32WithSub(UChar *dest, * @see u_strToUTF8WithSub * @see u_strFromJavaModifiedUTF8WithSub */ -U_STABLE char* U_EXPORT2 +U_CAPI char* U_EXPORT2 u_strToJavaModifiedUTF8( char *dest, int32_t destCapacity, @@ -1676,7 +1676,7 @@ u_strToJavaModifiedUTF8( * @see u_strToJavaModifiedUTF8 * @stable ICU 4.4 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strFromJavaModifiedUTF8WithSub( UChar *dest, int32_t destCapacity, diff --git a/deps/icu-small/source/common/unicode/utext.h b/deps/icu-small/source/common/unicode/utext.h index d36c1c035e70f1..084362be78fc9d 100644 --- a/deps/icu-small/source/common/unicode/utext.h +++ b/deps/icu-small/source/common/unicode/utext.h @@ -180,7 +180,7 @@ typedef struct UText UText; /**< C typedef for struct UText. @stable ICU 3.6 */ * * @stable ICU 3.4 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 utext_close(UText *ut); /** @@ -204,7 +204,7 @@ utext_close(UText *ut); * will always be used and returned. * @stable ICU 3.4 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status); @@ -222,7 +222,7 @@ utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status); * will always be used and returned. * @stable ICU 3.4 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status); @@ -239,7 +239,7 @@ utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status); * will always be used and returned. * @stable ICU 3.4 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 utext_openUnicodeString(UText *ut, icu::UnicodeString *s, UErrorCode *status); @@ -255,7 +255,7 @@ utext_openUnicodeString(UText *ut, icu::UnicodeString *s, UErrorCode *status); * will always be used and returned. * @stable ICU 3.4 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 utext_openConstUnicodeString(UText *ut, const icu::UnicodeString *s, UErrorCode *status); @@ -271,7 +271,7 @@ utext_openConstUnicodeString(UText *ut, const icu::UnicodeString *s, UErrorCode * @see Replaceable * @stable ICU 3.4 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 utext_openReplaceable(UText *ut, icu::Replaceable *rep, UErrorCode *status); /** @@ -286,7 +286,7 @@ utext_openReplaceable(UText *ut, icu::Replaceable *rep, UErrorCode *status); * @see Replaceable * @stable ICU 3.4 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 utext_openCharacterIterator(UText *ut, icu::CharacterIterator *ci, UErrorCode *status); #endif @@ -323,7 +323,7 @@ utext_openCharacterIterator(UText *ut, icu::CharacterIterator *ci, UErrorCode *s * shallow clones provide some protection against errors of this type by * disabling text modification via the cloned UText. * - * A shallow clone made with the readOnly parameter == FALSE will preserve the + * A shallow clone made with the readOnly parameter == false will preserve the * utext_isWritable() state of the source object. Note, however, that * write operations must be avoided while more than one UText exists that refer * to the same underlying text. @@ -339,8 +339,8 @@ utext_openCharacterIterator(UText *ut, icu::CharacterIterator *ci, UErrorCode *s * If non-NULL, must refer to an already existing UText, which will then * be reset to become the clone. * @param src The UText to be cloned. - * @param deep TRUE to request a deep clone, FALSE for a shallow clone. - * @param readOnly TRUE to request that the cloned UText have read only access to the + * @param deep true to request a deep clone, false for a shallow clone. + * @param readOnly true to request that the cloned UText have read only access to the * underlying text. * @param status Errors are returned here. For deep clones, U_UNSUPPORTED_ERROR @@ -349,7 +349,7 @@ utext_openCharacterIterator(UText *ut, icu::CharacterIterator *ci, UErrorCode *s * @return The newly created clone, or NULL if the clone operation failed. * @stable ICU 3.4 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCode *status); @@ -357,14 +357,14 @@ utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCod * Compare two UText objects for equality. * UTexts are equal if they are iterating over the same text, and * have the same iteration position within the text. - * If either or both of the parameters are NULL, the comparison is FALSE. + * If either or both of the parameters are NULL, the comparison is false. * * @param a The first of the two UTexts to compare. * @param b The other UText to be compared. - * @return TRUE if the two UTexts are equal. + * @return true if the two UTexts are equal. * @stable ICU 3.6 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 utext_equals(const UText *a, const UText *b); @@ -385,11 +385,11 @@ utext_equals(const UText *a, const UText *b); * * @stable ICU 3.4 */ -U_STABLE int64_t U_EXPORT2 +U_CAPI int64_t U_EXPORT2 utext_nativeLength(UText *ut); /** - * Return TRUE if calculating the length of the text could be expensive. + * Return true if calculating the length of the text could be expensive. * Finding the length of NUL terminated strings is considered to be expensive. * * Note that the value of this function may change @@ -398,10 +398,10 @@ utext_nativeLength(UText *ut); * be expensive to report it. * * @param ut the text to be accessed. - * @return TRUE if determining the length of the text could be time consuming. + * @return true if determining the length of the text could be time consuming. * @stable ICU 3.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 utext_isLengthExpensive(const UText *ut); /** @@ -429,7 +429,7 @@ utext_isLengthExpensive(const UText *ut); * @return the code point at the specified index. * @stable ICU 3.4 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 utext_char32At(UText *ut, int64_t nativeIndex); @@ -443,7 +443,7 @@ utext_char32At(UText *ut, int64_t nativeIndex); * @return the Unicode code point at the current iterator position. * @stable ICU 3.4 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 utext_current32(UText *ut); @@ -465,7 +465,7 @@ utext_current32(UText *ut); * @see UTEXT_NEXT32 * @stable ICU 3.4 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 utext_next32(UText *ut); @@ -486,7 +486,7 @@ utext_next32(UText *ut); * @see UTEXT_PREVIOUS32 * @stable ICU 3.4 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 utext_previous32(UText *ut); @@ -508,7 +508,7 @@ utext_previous32(UText *ut); * or U_SENTINEL (-1) if it is out of bounds. * @stable ICU 3.4 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 utext_next32From(UText *ut, int64_t nativeIndex); @@ -528,7 +528,7 @@ utext_next32From(UText *ut, int64_t nativeIndex); * * @stable ICU 3.4 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 utext_previous32From(UText *ut, int64_t nativeIndex); /** @@ -543,7 +543,7 @@ utext_previous32From(UText *ut, int64_t nativeIndex); * @return the current index position, in the native units of the text provider. * @stable ICU 3.4 */ -U_STABLE int64_t U_EXPORT2 +U_CAPI int64_t U_EXPORT2 utext_getNativeIndex(const UText *ut); /** @@ -569,7 +569,7 @@ utext_getNativeIndex(const UText *ut); * @param nativeIndex the native unit index of the new iteration position. * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 utext_setNativeIndex(UText *ut, int64_t nativeIndex); /** @@ -584,11 +584,11 @@ utext_setNativeIndex(UText *ut, int64_t nativeIndex); * * @param ut the text to be accessed. * @param delta the signed number of code points to move the iteration position. - * @return TRUE if the position could be moved the requested number of positions while + * @return true if the position could be moved the requested number of positions while * staying within the range [0 - text length]. * @stable ICU 3.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 utext_moveIndex32(UText *ut, int32_t delta); /** @@ -613,7 +613,7 @@ utext_moveIndex32(UText *ut, int32_t delta); * or zero if the current position is at the start of the text. * @stable ICU 3.6 */ -U_STABLE int64_t U_EXPORT2 +U_CAPI int64_t U_EXPORT2 utext_getPreviousNativeIndex(UText *ut); @@ -651,7 +651,7 @@ utext_getPreviousNativeIndex(UText *ut); * * @stable ICU 3.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 utext_extract(UText *ut, int64_t nativeStart, int64_t nativeLimit, UChar *dest, int32_t destCapacity, @@ -768,16 +768,16 @@ utext_extract(UText *ut, /** - * Return TRUE if the text can be written (modified) with utext_replace() or + * Return true if the text can be written (modified) with utext_replace() or * utext_copy(). For the text to be writable, the text provider must * be of a type that supports writing and the UText must not be frozen. * - * Attempting to modify text when utext_isWriteable() is FALSE will fail - + * Attempting to modify text when utext_isWriteable() is false will fail - * the text will not be modified, and an error will be returned from the function * that attempted the modification. * * @param ut the UText to be tested. - * @return TRUE if the text is modifiable. + * @return true if the text is modifiable. * * @see utext_freeze() * @see utext_replace() @@ -785,7 +785,7 @@ utext_extract(UText *ut, * @stable ICU 3.4 * */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 utext_isWritable(const UText *ut); @@ -794,10 +794,10 @@ utext_isWritable(const UText *ut); * @see Replaceable::hasMetaData() * * @param ut The UText to be tested - * @return TRUE if the underlying text includes meta data. + * @return true if the underlying text includes meta data. * @stable ICU 3.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 utext_hasMetaData(const UText *ut); @@ -808,7 +808,7 @@ utext_hasMetaData(const UText *ut); * newly inserted replacement text. * * This function is only available on UText types that support writing, - * that is, ones where utext_isWritable() returns TRUE. + * that is, ones where utext_isWritable() returns true. * * When using this function, there should be only a single UText opened onto the * underlying native text string. Behavior after a replace operation @@ -828,7 +828,7 @@ utext_hasMetaData(const UText *ut); * * @stable ICU 3.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 utext_replace(UText *ut, int64_t nativeStart, int64_t nativeLimit, const UChar *replacementText, int32_t replacementLength, @@ -850,7 +850,7 @@ utext_replace(UText *ut, * at the destination position. * * This function is only available on UText types that support writing, - * that is, ones where utext_isWritable() returns TRUE. + * that is, ones where utext_isWritable() returns true. * * When using this function, there should be only a single UText opened onto the * underlying native text string. Behavior after a copy operation @@ -863,12 +863,12 @@ utext_replace(UText *ut, * to be copied. * @param destIndex The native destination index to which the source substring is * copied or moved. - * @param move If TRUE, then the substring is moved, not copied/duplicated. + * @param move If true, then the substring is moved, not copied/duplicated. * @param status receives any error status. Possible errors include U_NO_WRITE_PERMISSION * * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 utext_copy(UText *ut, int64_t nativeStart, int64_t nativeLimit, int64_t destIndex, @@ -897,7 +897,7 @@ utext_copy(UText *ut, * @see utext_isWritable() * @stable ICU 3.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 utext_freeze(UText *ut); @@ -972,7 +972,7 @@ enum { * @param dest A UText struct to be filled in with the result of the clone operation, * or NULL if the clone function should heap-allocate a new UText struct. * @param src The UText to be cloned. - * @param deep TRUE to request a deep clone, FALSE for a shallow clone. + * @param deep true to request a deep clone, false for a shallow clone. * @param status Errors are returned here. For deep clones, U_UNSUPPORTED_ERROR * should be returned if the text provider is unable to clone the * original text. @@ -1008,9 +1008,9 @@ UTextNativeLength(UText *ut); * * @param ut the UText being accessed. * @param nativeIndex Requested index of the text to be accessed. - * @param forward If TRUE, then the returned chunk must contain text + * @param forward If true, then the returned chunk must contain text * starting from the index, so that start<=indexUsage: * ICU coding guidelines for if() statements should be followed when using these macros. @@ -124,7 +124,7 @@ /** * Is this code point a Unicode noncharacter? * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U_IS_UNICODE_NONCHAR(c) \ @@ -145,7 +145,7 @@ * and that boundary is tested first for performance. * * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U_IS_UNICODE_CHAR(c) \ @@ -155,7 +155,7 @@ /** * Is this code point a BMP code point (U+0000..U+ffff)? * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.8 */ #define U_IS_BMP(c) ((uint32_t)(c)<=0xffff) @@ -163,7 +163,7 @@ /** * Is this code point a supplementary code point (U+10000..U+10ffff)? * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.8 */ #define U_IS_SUPPLEMENTARY(c) ((uint32_t)((c)-0x10000)<=0xfffff) @@ -171,7 +171,7 @@ /** * Is this code point a lead surrogate (U+d800..U+dbff)? * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U_IS_LEAD(c) (((c)&0xfffffc00)==0xd800) @@ -179,7 +179,7 @@ /** * Is this code point a trail surrogate (U+dc00..U+dfff)? * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00) @@ -187,7 +187,7 @@ /** * Is this code point a surrogate (U+d800..U+dfff)? * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800) @@ -196,7 +196,7 @@ * Assuming c is a surrogate code point (U_IS_SURROGATE(c)), * is it a lead surrogate? * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U_IS_SURROGATE_LEAD(c) (((c)&0x400)==0) @@ -205,7 +205,7 @@ * Assuming c is a surrogate code point (U_IS_SURROGATE(c)), * is it a trail surrogate? * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 4.2 */ #define U_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0) diff --git a/deps/icu-small/source/common/unicode/utf16.h b/deps/icu-small/source/common/unicode/utf16.h index 3315214ae69d86..9d68902d2de0f3 100644 --- a/deps/icu-small/source/common/unicode/utf16.h +++ b/deps/icu-small/source/common/unicode/utf16.h @@ -23,7 +23,7 @@ * This file defines macros to deal with 16-bit Unicode (UTF-16) code units and strings. * * For more information see utf.h and the ICU User Guide Strings chapter - * (http://userguide.icu-project.org/strings). + * (https://unicode-org.github.io/icu/userguide/strings). * * Usage: * ICU coding guidelines for if() statements should be followed when using these macros. @@ -34,6 +34,7 @@ #ifndef __UTF16_H__ #define __UTF16_H__ +#include #include "unicode/umachine.h" #ifndef __UTF_H__ # include "unicode/utf.h" @@ -44,7 +45,7 @@ /** * Does this code unit alone encode a code point (BMP, not a surrogate)? * @param c 16-bit code unit - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U16_IS_SINGLE(c) !U_IS_SURROGATE(c) @@ -52,7 +53,7 @@ /** * Is this code unit a lead surrogate (U+d800..U+dbff)? * @param c 16-bit code unit - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800) @@ -60,7 +61,7 @@ /** * Is this code unit a trail surrogate (U+dc00..U+dfff)? * @param c 16-bit code unit - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00) @@ -68,7 +69,7 @@ /** * Is this code unit a surrogate (U+d800..U+dfff)? * @param c 16-bit code unit - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U16_IS_SURROGATE(c) U_IS_SURROGATE(c) @@ -77,7 +78,7 @@ * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)), * is it a lead surrogate? * @param c 16-bit code unit - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0) @@ -86,7 +87,7 @@ * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)), * is it a trail surrogate? * @param c 16-bit code unit - * @return TRUE or FALSE + * @return true or false * @stable ICU 4.2 */ #define U16_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0) @@ -379,13 +380,13 @@ * "Safe" macro, checks for a valid code point. * If a surrogate pair is written, checks for sufficient space in the string. * If the code point is not valid or a trail surrogate does not fit, - * then isError is set to TRUE. + * then isError is set to true. * * @param s const UChar * string buffer * @param i string offset, must be i>10)+0xd7c0); \ (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \ } else /* c>0x10ffff or not enough space */ { \ - (isError)=TRUE; \ + (isError)=true; \ } \ } UPRV_BLOCK_MACRO_END diff --git a/deps/icu-small/source/common/unicode/utf8.h b/deps/icu-small/source/common/unicode/utf8.h index bb001303747efe..58bda2cbe51290 100644 --- a/deps/icu-small/source/common/unicode/utf8.h +++ b/deps/icu-small/source/common/unicode/utf8.h @@ -23,7 +23,7 @@ * This file defines macros to deal with 8-bit Unicode (UTF-8) code units (bytes) and strings. * * For more information see utf.h and the ICU User Guide Strings chapter - * (http://userguide.icu-project.org/strings). + * (https://unicode-org.github.io/icu/userguide/strings). * * Usage: * ICU coding guidelines for if() statements should be followed when using these macros. @@ -34,6 +34,7 @@ #ifndef __UTF8_H__ #define __UTF8_H__ +#include #include "unicode/umachine.h" #ifndef __UTF_H__ # include "unicode/utf.h" @@ -117,48 +118,48 @@ * Function for handling "next code point" with error-checking. * * This is internal since it is not meant to be called directly by external clients; - * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this + * however it is called by public macros in this * file and thus must remain stable, and should not be hidden when other internal * functions are hidden (otherwise public macros would fail to compile). * @internal */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, UBool strict); /** * Function for handling "append code point" with error-checking. * * This is internal since it is not meant to be called directly by external clients; - * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this + * however it is called by public macros in this * file and thus must remain stable, and should not be hidden when other internal * functions are hidden (otherwise public macros would fail to compile). * @internal */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool *pIsError); /** * Function for handling "previous code point" with error-checking. * * This is internal since it is not meant to be called directly by external clients; - * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this + * however it is called by public macros in this * file and thus must remain stable, and should not be hidden when other internal * functions are hidden (otherwise public macros would fail to compile). * @internal */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, UBool strict); /** * Function for handling "skip backward one code point" with error-checking. * * This is internal since it is not meant to be called directly by external clients; - * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this + * however it is called by public macros in this * file and thus must remain stable, and should not be hidden when other internal * functions are hidden (otherwise public macros would fail to compile). * @internal */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); /* single-code point definitions -------------------------------------------- */ @@ -166,7 +167,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); /** * Does this code unit (byte) encode a code point by itself (US-ASCII 0..0x7f)? * @param c 8-bit code unit (byte) - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U8_IS_SINGLE(c) (((c)&0x80)==0) @@ -174,7 +175,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); /** * Is this code unit (byte) a UTF-8 lead byte? (0xC2..0xF4) * @param c 8-bit code unit (byte) - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U8_IS_LEAD(c) ((uint8_t)((c)-0xc2)<=0x32) @@ -183,7 +184,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); /** * Is this code unit (byte) a UTF-8 trail byte? (0x80..0xBF) * @param c 8-bit code unit (byte) - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U8_IS_TRAIL(c) ((int8_t)(c)<-0x40) @@ -445,13 +446,13 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * "Safe" macro, checks for a valid code point. * If a non-ASCII code point is written, checks for sufficient space in the string. * If the code point is not valid or trail bytes do not fit, - * then isError is set to TRUE. + * then isError is set to true. * * @param s const uint8_t * string buffer * @param i int32_t string offset, must be i>6)&0x3f)|0x80); \ (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \ } else { \ - (isError)=TRUE; \ + (isError)=true; \ } \ } UPRV_BLOCK_MACRO_END diff --git a/deps/icu-small/source/common/unicode/utf_old.h b/deps/icu-small/source/common/unicode/utf_old.h index b2428e6b31e282..160f5ad0a9f248 100644 --- a/deps/icu-small/source/common/unicode/utf_old.h +++ b/deps/icu-small/source/common/unicode/utf_old.h @@ -109,7 +109,7 @@ * Where such a distinction is useful, there are two versions of the macros, "unsafe" and "safe" * ones with ..._UNSAFE and ..._SAFE suffixes. The unsafe macros are fast but may cause * program failures if the strings are not well-formed. The safe macros have an additional, boolean - * parameter "strict". If strict is FALSE, then only illegal sequences are detected. + * parameter "strict". If strict is false, then only illegal sequences are detected. * Otherwise, irregular sequences and non-characters are detected as well (like single surrogates). * Safe macros return special error code points for illegal/irregular sequences: * Typically, U+ffff, or values that would result in a code unit sequence of the same length @@ -181,7 +181,7 @@ typedef int32_t UTextOffset; /** * The default choice for general Unicode string macros is to use the ..._SAFE macro implementations - * with strict=FALSE. + * with strict=false. * * @deprecated ICU 2.4. Obsolete, see utf_old.h. */ diff --git a/deps/icu-small/source/common/unicode/utrace.h b/deps/icu-small/source/common/unicode/utrace.h index c7d51ff44f5bf7..bb8e3e8109cc66 100644 --- a/deps/icu-small/source/common/unicode/utrace.h +++ b/deps/icu-small/source/common/unicode/utrace.h @@ -112,11 +112,9 @@ typedef enum UTraceFunctionNumber { UTRACE_COLLATION_LIMIT, #endif // U_HIDE_DEPRECATED_API -#ifndef U_HIDE_DRAFT_API - /** * The lowest resource/data location. - * @draft ICU 65 + * @stable ICU 65 */ UTRACE_UDATA_START=0x3000, @@ -133,7 +131,7 @@ typedef enum UTraceFunctionNumber { * - "get" (a path was loaded, but the value was not accessed) * - "getalias" (a path was loaded, and an alias was resolved) * - * @draft ICU 65 + * @stable ICU 65 */ UTRACE_UDATA_RESOURCE=UTRACE_UDATA_START, @@ -141,7 +139,7 @@ typedef enum UTraceFunctionNumber { * Indicates that a resource bundle was opened. * * Provides one C-style string to UTraceData: file name. - * @draft ICU 65 + * @stable ICU 65 */ UTRACE_UDATA_BUNDLE, @@ -150,7 +148,7 @@ typedef enum UTraceFunctionNumber { * * Provides one C-style string to UTraceData: file name. * - * @draft ICU 65 + * @stable ICU 65 */ UTRACE_UDATA_DATA_FILE, @@ -163,12 +161,10 @@ typedef enum UTraceFunctionNumber { * * Provides one C-style string to UTraceData: file name. * - * @draft ICU 65 + * @stable ICU 65 */ UTRACE_UDATA_RES_FILE, -#endif // U_HIDE_DRAFT_API - #ifndef U_HIDE_INTERNAL_API /** * One more than the highest normal resource/data trace location. @@ -249,7 +245,7 @@ typedef enum UTraceFunctionNumber { * @param traceLevel A UTraceLevel value. * @stable ICU 2.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 utrace_setLevel(int32_t traceLevel); /** @@ -257,7 +253,7 @@ utrace_setLevel(int32_t traceLevel); * @return The UTraceLevel value being used by ICU. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 utrace_getLevel(void); /* Trace function pointers types ----------------------------- */ @@ -331,7 +327,7 @@ UTraceData(const void *context, int32_t fnNumber, int32_t level, * * @stable ICU 2.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 utrace_setFunctions(const void *context, UTraceEntry *e, UTraceExit *x, UTraceData *d); @@ -345,7 +341,7 @@ utrace_setFunctions(const void *context, * @param d The currently installed UTraceData function. * @stable ICU 2.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 utrace_getFunctions(const void **context, UTraceEntry **e, UTraceExit **x, UTraceData **d); @@ -467,7 +463,7 @@ utrace_getFunctions(const void **context, * If buffer capacity is insufficient, the required capacity is returned. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt, va_list args); @@ -488,7 +484,7 @@ utrace_vformat(char *outBuf, int32_t capacity, * If buffer capacity is insufficient, the required capacity is returned. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 utrace_format(char *outBuf, int32_t capacity, int32_t indent, const char *fmt, ...); @@ -505,7 +501,7 @@ utrace_format(char *outBuf, int32_t capacity, * @see UTraceFunctionNumber * @stable ICU 2.8 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 utrace_functionName(int32_t fnNumber); U_CDECL_END diff --git a/deps/icu-small/source/common/unicode/utypes.h b/deps/icu-small/source/common/unicode/utypes.h index c98de9e6fc3dad..6c57218db8d477 100644 --- a/deps/icu-small/source/common/unicode/utypes.h +++ b/deps/icu-small/source/common/unicode/utypes.h @@ -479,13 +479,23 @@ typedef enum UErrorCode { U_COLLATOR_VERSION_MISMATCH = 28, /**< Collator version is not compatible with the base version */ U_USELESS_COLLATOR_ERROR = 29, /**< Collator is options only and no base is specified */ U_NO_WRITE_PERMISSION = 30, /**< Attempt to modify read-only or constant data. */ +#ifndef U_HIDE_DRAFT_API + /** + * The input is impractically long for an operation. + * It is rejected because it may lead to problems such as excessive + * processing time, stack depth, or heap memory requirements. + * + * @draft ICU 68 + */ + U_INPUT_TOO_LONG_ERROR = 31, +#endif // U_HIDE_DRAFT_API #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest standard error code. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ - U_STANDARD_ERROR_LIMIT, + U_STANDARD_ERROR_LIMIT = 32, #endif // U_HIDE_DEPRECATED_API /* @@ -715,7 +725,7 @@ typedef enum UErrorCode { * in the UErrorCode enum above. * @stable ICU 2.0 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 u_errorName(UErrorCode code); diff --git a/deps/icu-small/source/common/unicode/uvernum.h b/deps/icu-small/source/common/unicode/uvernum.h index c66776d10b5826..a4cbb9e0fe8661 100644 --- a/deps/icu-small/source/common/unicode/uvernum.h +++ b/deps/icu-small/source/common/unicode/uvernum.h @@ -60,7 +60,7 @@ * This value will change in the subsequent releases of ICU * @stable ICU 2.4 */ -#define U_ICU_VERSION_MAJOR_NUM 67 +#define U_ICU_VERSION_MAJOR_NUM 68 /** The current ICU minor version as an integer. * This value will change in the subsequent releases of ICU @@ -86,7 +86,7 @@ * This value will change in the subsequent releases of ICU * @stable ICU 2.6 */ -#define U_ICU_VERSION_SUFFIX _67 +#define U_ICU_VERSION_SUFFIX _68 /** * \def U_DEF2_ICU_ENTRY_POINT_RENAME @@ -139,7 +139,7 @@ * This value will change in the subsequent releases of ICU * @stable ICU 2.4 */ -#define U_ICU_VERSION "67.1" +#define U_ICU_VERSION "68.1" /** * The current ICU library major version number as a string, for library name suffixes. @@ -148,17 +148,17 @@ * Until ICU 4.8, this was the combination of the single-digit major and minor ICU version numbers * into one string without dots ("48"). * Since ICU 49, it is the double-digit major ICU version number. - * See http://userguide.icu-project.org/design#TOC-Version-Numbers-in-ICU + * See https://unicode-org.github.io/icu/userguide/design#version-numbers-in-icu * * @stable ICU 2.6 */ -#define U_ICU_VERSION_SHORT "67" +#define U_ICU_VERSION_SHORT "68" #ifndef U_HIDE_INTERNAL_API /** Data version in ICU4C. * @internal ICU 4.4 Internal Use Only **/ -#define U_ICU_DATA_VERSION "67.1" +#define U_ICU_DATA_VERSION "68.1" #endif /* U_HIDE_INTERNAL_API */ /*=========================================================================== diff --git a/deps/icu-small/source/common/unicode/uversion.h b/deps/icu-small/source/common/unicode/uversion.h index c8c7a374c820b2..dde3059261047c 100644 --- a/deps/icu-small/source/common/unicode/uversion.h +++ b/deps/icu-small/source/common/unicode/uversion.h @@ -141,7 +141,7 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; * values of up to 255 each. * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_versionFromString(UVersionInfo versionArray, const char *versionString); /** @@ -155,7 +155,7 @@ u_versionFromString(UVersionInfo versionArray, const char *versionString); * fields with values of up to 255 each. * @stable ICU 4.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_versionFromUString(UVersionInfo versionArray, const UChar *versionString); @@ -171,7 +171,7 @@ u_versionFromUString(UVersionInfo versionArray, const UChar *versionString); * The buffer size must be at least U_MAX_VERSION_STRING_LENGTH. * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_versionToString(const UVersionInfo versionArray, char *versionString); /** @@ -182,6 +182,6 @@ u_versionToString(const UVersionInfo versionArray, char *versionString); * @param versionArray the version # information, the result will be filled in * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_getVersion(UVersionInfo versionArray); #endif diff --git a/deps/icu-small/source/common/unifiedcache.cpp b/deps/icu-small/source/common/unifiedcache.cpp index f2dd916559588c..493ab79f6d9067 100644 --- a/deps/icu-small/source/common/unifiedcache.cpp +++ b/deps/icu-small/source/common/unifiedcache.cpp @@ -311,7 +311,7 @@ void UnifiedCache::_putNew( } keyToAdopt->fCreationStatus = creationStatus; if (value->softRefCount == 0) { - _registerMaster(keyToAdopt, value); + _registerPrimary(keyToAdopt, value); } void *oldValue = uhash_put(fHashtable, keyToAdopt, (void *) value, &status); U_ASSERT(oldValue == nullptr); @@ -338,7 +338,7 @@ void UnifiedCache::_putIfAbsentAndGet( } else { _put(element, value, status); } - // Run an eviction slice. This will run even if we added a master entry + // Run an eviction slice. This will run even if we added a primary entry // which doesn't increase the unused count, but that is still o.k _runEvictionSlice(); } @@ -403,9 +403,9 @@ void UnifiedCache::_get( } } -void UnifiedCache::_registerMaster( +void UnifiedCache::_registerPrimary( const CacheKeyBase *theKey, const SharedObject *value) const { - theKey->fIsMaster = true; + theKey->fIsPrimary = true; value->cachePtr = this; ++fNumValuesTotal; ++fNumValuesInUse; @@ -420,7 +420,7 @@ void UnifiedCache::_put( const SharedObject *oldValue = (const SharedObject *) element->value.pointer; theKey->fCreationStatus = status; if (value->softRefCount == 0) { - _registerMaster(theKey, value); + _registerPrimary(theKey, value); } value->softRefCount++; UHashElement *ptr = const_cast(element); @@ -474,9 +474,9 @@ UBool UnifiedCache::_isEvictable(const UHashElement *element) const return FALSE; } - // We can evict entries that are either not a master or have just + // We can evict entries that are either not a primary or have just // one reference (The one reference being from the cache itself). - return (!theKey->fIsMaster || (theValue->softRefCount == 1 && theValue->noHardReferences())); + return (!theKey->fIsPrimary || (theValue->softRefCount == 1 && theValue->noHardReferences())); } void UnifiedCache::removeSoftRef(const SharedObject *value) const { diff --git a/deps/icu-small/source/common/unifiedcache.h b/deps/icu-small/source/common/unifiedcache.h index 5c0bd76f4a2b94..865f4545105cb6 100644 --- a/deps/icu-small/source/common/unifiedcache.h +++ b/deps/icu-small/source/common/unifiedcache.h @@ -34,13 +34,13 @@ class UnifiedCache; */ class U_COMMON_API CacheKeyBase : public UObject { public: - CacheKeyBase() : fCreationStatus(U_ZERO_ERROR), fIsMaster(FALSE) {} + CacheKeyBase() : fCreationStatus(U_ZERO_ERROR), fIsPrimary(false) {} /** * Copy constructor. Needed to support cloning. */ CacheKeyBase(const CacheKeyBase &other) - : UObject(other), fCreationStatus(other.fCreationStatus), fIsMaster(FALSE) { } + : UObject(other), fCreationStatus(other.fCreationStatus), fIsPrimary(false) { } virtual ~CacheKeyBase(); /** @@ -88,7 +88,7 @@ class U_COMMON_API CacheKeyBase : public UObject { } private: mutable UErrorCode fCreationStatus; - mutable UBool fIsMaster; + mutable UBool fIsPrimary; friend class UnifiedCache; }; @@ -147,10 +147,10 @@ class LocaleCacheKey : public CacheKey { virtual UBool operator == (const CacheKeyBase &other) const { // reflexive if (this == &other) { - return TRUE; + return true; } if (!CacheKey::operator == (other)) { - return FALSE; + return false; } // We know this and other are of same class because operator== on // CacheKey returned true. @@ -359,7 +359,7 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { /** * Flushes the contents of the cache. If cache values hold references to other - * cache values then _flush should be called in a loop until it returns FALSE. + * cache values then _flush should be called in a loop until it returns false. * * On entry, gCacheMutex must be held. * On exit, those values with are evictable are flushed. @@ -370,7 +370,7 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { * hard (external) references are not deleted, but are detached from * the cache, so that a subsequent removeRefs can delete them. * _flush is not thread safe when all is true. - * @return TRUE if any value in cache was flushed or FALSE otherwise. + * @return true if any value in cache was flushed or false otherwise. */ UBool _flush(UBool all) const; @@ -395,11 +395,11 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { * Attempts to fetch value and status for key from cache. * On entry, gCacheMutex must not be held value must be NULL and status must * be U_ZERO_ERROR. - * On exit, either returns FALSE (In this - * case caller should try to create the object) or returns TRUE with value + * On exit, either returns false (In this + * case caller should try to create the object) or returns true with value * pointing to the fetched value and status set to fetched status. When - * FALSE is returned status may be set to failure if an in progress hash - * entry could not be made but value will remain unchanged. When TRUE is + * false is returned status may be set to failure if an in progress hash + * entry could not be made but value will remain unchanged. When true is * returned, caller must call removeRef() on value. */ UBool _poll( @@ -463,17 +463,17 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { void _runEvictionSlice() const; /** - * Register a master cache entry. A master key is the first key to create + * Register a primary cache entry. A primary key is the first key to create * a given SharedObject value. Subsequent keys whose create function - * produce referneces to an already existing SharedObject are not masters - + * produce referneces to an already existing SharedObject are not primary - * they can be evicted and subsequently recreated. * * On entry, gCacheMutex must be held. - * On exit, items in use count incremented, entry is marked as a master + * On exit, items in use count incremented, entry is marked as a primary * entry, and value registered with cache so that subsequent calls to * addRef() and removeRef() on it correctly interact with the cache. */ - void _registerMaster(const CacheKeyBase *theKey, const SharedObject *value) const; + void _registerPrimary(const CacheKeyBase *theKey, const SharedObject *value) const; /** * Store a value and creation error status in given hash entry. diff --git a/deps/icu-small/source/common/uniquecharstr.h b/deps/icu-small/source/common/uniquecharstr.h new file mode 100644 index 00000000000000..10cc924f7f9eb2 --- /dev/null +++ b/deps/icu-small/source/common/uniquecharstr.h @@ -0,0 +1,98 @@ +// © 2020 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// uniquecharstr.h +// created: 2020sep01 Frank Yung-Fong Tang + +#ifndef __UNIQUECHARSTR_H__ +#define __UNIQUECHARSTR_H__ + +#include "charstr.h" +#include "uassert.h" +#include "uhash.h" + +U_NAMESPACE_BEGIN + +/** + * Stores NUL-terminated strings with duplicate elimination. + * Checks for unique UTF-16 string pointers and converts to invariant characters. + * + * Intended to be stack-allocated. Add strings, get a unique number for each, + * freeze the object, get a char * pointer for each string, + * call orphanCharStrings() to capture the string storage, and let this object go out of scope. + */ +class UniqueCharStrings { +public: + UniqueCharStrings(UErrorCode &errorCode) : strings(nullptr) { + // Note: We hash on string contents but store stable char16_t * pointers. + // If the strings are stored in resource bundles which should be built with + // duplicate elimination, then we should be able to hash on just the pointer values. + uhash_init(&map, uhash_hashUChars, uhash_compareUChars, uhash_compareLong, &errorCode); + if (U_FAILURE(errorCode)) { return; } + strings = new CharString(); + if (strings == nullptr) { + errorCode = U_MEMORY_ALLOCATION_ERROR; + } + } + ~UniqueCharStrings() { + uhash_close(&map); + delete strings; + } + + /** Returns/orphans the CharString that contains all strings. */ + CharString *orphanCharStrings() { + CharString *result = strings; + strings = nullptr; + return result; + } + + /** + * Adds a string and returns a unique number for it. + * The string's buffer contents must not change, nor move around in memory, + * while this UniqueCharStrings is in use. + * The string contents must be NUL-terminated exactly at s.length(). + * + * Best used with read-only-alias UnicodeString objects that point to + * stable storage, such as strings returned by resource bundle functions. + */ + int32_t add(const UnicodeString &s, UErrorCode &errorCode) { + if (U_FAILURE(errorCode)) { return 0; } + if (isFrozen) { + errorCode = U_NO_WRITE_PERMISSION; + return 0; + } + // The string points into the resource bundle. + const char16_t *p = s.getBuffer(); + int32_t oldIndex = uhash_geti(&map, p); + if (oldIndex != 0) { // found duplicate + return oldIndex; + } + // Explicit NUL terminator for the previous string. + // The strings object is also terminated with one implicit NUL. + strings->append(0, errorCode); + int32_t newIndex = strings->length(); + strings->appendInvariantChars(s, errorCode); + uhash_puti(&map, const_cast(p), newIndex, &errorCode); + return newIndex; + } + + void freeze() { isFrozen = true; } + + /** + * Returns a string pointer for its unique number, if this object is frozen. + * Otherwise nullptr. + */ + const char *get(int32_t i) const { + U_ASSERT(isFrozen); + return isFrozen && i > 0 ? strings->data() + i : nullptr; + } + +private: + UHashtable map; + CharString *strings; + bool isFrozen = false; +}; + +U_NAMESPACE_END + +#endif // __UNIQUECHARSTR_H__ diff --git a/deps/icu-small/source/common/unisetspan.h b/deps/icu-small/source/common/unisetspan.h index f1e78ff3ee2b00..9a1307a9078aab 100644 --- a/deps/icu-small/source/common/unisetspan.h +++ b/deps/icu-small/source/common/unisetspan.h @@ -65,8 +65,8 @@ class UnicodeSetStringSpan : public UMemory { /* * Do the strings need to be checked in span() etc.? - * @return TRUE if strings need to be checked (call span() here), - * FALSE if not (use a BMPSet for best performance). + * @return true if strings need to be checked (call span() here), + * false if not (use a BMPSet for best performance). */ inline UBool needsStringSpanUTF16(); inline UBool needsStringSpanUTF8(); diff --git a/deps/icu-small/source/common/unormimp.h b/deps/icu-small/source/common/unormimp.h index 7f280551f7ef8e..e09c5c1c916773 100644 --- a/deps/icu-small/source/common/unormimp.h +++ b/deps/icu-small/source/common/unormimp.h @@ -418,7 +418,7 @@ enum { * The same bit is used for NFC and NFKC; (c) differs for them. * As usual, we build the "not skippable" flags so that unassigned * code points get a 0 bit. - * This bit is only valid after (a)..(e) test FALSE; test NFD_NO before (f) as well. + * This bit is only valid after (a)..(e) test false; test NFD_NO before (f) as well. * Test Hangul LV syllables entirely in code. * * diff --git a/deps/icu-small/source/common/uresbund.cpp b/deps/icu-small/source/common/uresbund.cpp index f4efb8ccab5a0b..743df1f8c505ce 100644 --- a/deps/icu-small/source/common/uresbund.cpp +++ b/deps/icu-small/source/common/uresbund.cpp @@ -1792,7 +1792,7 @@ ures_findSubResource(const UResourceBundle *resB, char* path, UResourceBundle *f return result; } -U_INTERNAL const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ures_getStringByKeyWithFallback(const UResourceBundle *resB, const char* inKey, int32_t* len, @@ -2210,7 +2210,7 @@ ures_getUTF8StringByKey(const UResourceBundle *resB, * INTERNAL: Get the name of the first real locale (not placeholder) * that has resource bundle data. */ -U_INTERNAL const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 ures_getLocaleInternal(const UResourceBundle* resourceBundle, UErrorCode* status) { if (status==NULL || U_FAILURE(*status)) { @@ -2357,7 +2357,7 @@ ures_openDirect(const char* path, const char* localeID, UErrorCode* status) { * * Same as ures_open(), but uses the fill-in parameter and does not allocate a new bundle. */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 ures_openFillIn(UResourceBundle *r, const char* path, const char* localeID, UErrorCode* status) { if(U_SUCCESS(*status) && r == NULL) { @@ -2370,7 +2370,7 @@ ures_openFillIn(UResourceBundle *r, const char* path, /** * Same as ures_openDirect(), but uses the fill-in parameter and does not allocate a new bundle. */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 ures_openDirectFillIn(UResourceBundle *r, const char* path, const char* localeID, UErrorCode* status) { if(U_SUCCESS(*status) && r == NULL) { *status = U_ILLEGAL_ARGUMENT_ERROR; @@ -2420,7 +2420,7 @@ ures_countArrayItems(const UResourceBundle* resourceBundle, * @see ures_getVersion * @internal */ -U_INTERNAL const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 ures_getVersionNumberInternal(const UResourceBundle *resourceBundle) { if (!resourceBundle) return NULL; @@ -3016,7 +3016,7 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status) } #if 0 /* This code isn't needed, and given the documentation warnings the implementation is suspect */ -U_INTERNAL UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ures_equal(const UResourceBundle* res1, const UResourceBundle* res2){ if(res1==NULL || res2==NULL){ return res1==res2; /* pointer comparision */ @@ -3052,7 +3052,7 @@ ures_equal(const UResourceBundle* res1, const UResourceBundle* res2){ } return TRUE; } -U_INTERNAL UResourceBundle* U_EXPORT2 +U_CAPI UResourceBundle* U_EXPORT2 ures_clone(const UResourceBundle* res, UErrorCode* status){ UResourceBundle* bundle = NULL; UResourceBundle* ret = NULL; @@ -3068,7 +3068,7 @@ ures_clone(const UResourceBundle* res, UErrorCode* status){ } return ret; } -U_INTERNAL const UResourceBundle* U_EXPORT2 +U_CAPI const UResourceBundle* U_EXPORT2 ures_getParentBundle(const UResourceBundle* res){ if(res==NULL){ return NULL; @@ -3077,7 +3077,7 @@ ures_getParentBundle(const UResourceBundle* res){ } #endif -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 ures_getVersionByKey(const UResourceBundle* res, const char *key, UVersionInfo ver, UErrorCode *status) { const UChar *str; int32_t len; diff --git a/deps/icu-small/source/common/uresdata.cpp b/deps/icu-small/source/common/uresdata.cpp index 1bb938be62c35b..4e3309f497522c 100644 --- a/deps/icu-small/source/common/uresdata.cpp +++ b/deps/icu-small/source/common/uresdata.cpp @@ -963,7 +963,7 @@ res_findResource(const ResourceData *pResData, Resource r, char** path, const ch if(t2 == RES_BOGUS) { /* if we fail to get the resource by key, maybe we got an index */ indexR = uprv_strtol(pathP, &closeIndex, 10); - if(indexR >= 0 && *closeIndex == 0) { + if(indexR >= 0 && *closeIndex == 0 && (*pathP != '0' || closeIndex - pathP == 1)) { /* if we indeed have an index, try to get the item by index */ t2 = res_getTableItemByIndex(pResData, t1, indexR, key); } // else t2 is already RES_BOGUS diff --git a/deps/icu-small/source/common/uresdata.h b/deps/icu-small/source/common/uresdata.h index d1b67babf29049..7c2152e57b500d 100644 --- a/deps/icu-small/source/common/uresdata.h +++ b/deps/icu-small/source/common/uresdata.h @@ -402,7 +402,7 @@ typedef struct ResourceData { /* * Read a resource bundle from memory. */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 res_read(ResourceData *pResData, const UDataInfo *pInfo, const void *inBytes, int32_t length, UErrorCode *errorCode); @@ -422,7 +422,7 @@ res_load(ResourceData *pResData, U_CFUNC void res_unload(ResourceData *pResData); -U_INTERNAL UResType U_EXPORT2 +U_CAPI UResType U_EXPORT2 res_getPublicType(Resource res); /////////////////////////////////////////////////////////////////////////// @@ -434,31 +434,31 @@ res_getPublicType(Resource res); * and set its length in *pLength. * Returns NULL if not found. */ -U_INTERNAL const UChar * U_EXPORT2 +U_CAPI const UChar * U_EXPORT2 res_getStringNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength); -U_INTERNAL const uint8_t * U_EXPORT2 +U_CAPI const uint8_t * U_EXPORT2 res_getBinaryNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength); -U_INTERNAL const int32_t * U_EXPORT2 +U_CAPI const int32_t * U_EXPORT2 res_getIntVectorNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength); -U_INTERNAL const UChar * U_EXPORT2 +U_CAPI const UChar * U_EXPORT2 res_getAlias(const ResourceData *pResData, Resource res, int32_t *pLength); -U_INTERNAL Resource U_EXPORT2 +U_CAPI Resource U_EXPORT2 res_getResource(const ResourceData *pResData, const char *key); -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 res_countArrayItems(const ResourceData *pResData, Resource res); -U_INTERNAL Resource U_EXPORT2 +U_CAPI Resource U_EXPORT2 res_getArrayItem(const ResourceData *pResData, Resource array, int32_t indexS); -U_INTERNAL Resource U_EXPORT2 +U_CAPI Resource U_EXPORT2 res_getTableItemByIndex(const ResourceData *pResData, Resource table, int32_t indexS, const char ** key); -U_INTERNAL Resource U_EXPORT2 +U_CAPI Resource U_EXPORT2 res_getTableItemByKey(const ResourceData *pResData, Resource table, int32_t *indexS, const char* * key); /** diff --git a/deps/icu-small/source/common/uresimp.h b/deps/icu-small/source/common/uresimp.h index 2e477dfad3e98f..12154dcb7c68d4 100644 --- a/deps/icu-small/source/common/uresimp.h +++ b/deps/icu-small/source/common/uresimp.h @@ -157,7 +157,7 @@ U_CFUNC const char* ures_getName(const UResourceBundle* resB); U_CFUNC const char* ures_getPath(const UResourceBundle* resB); /** * If anything was in the RB cache, dump it to the screen. - * @return TRUE if there was anything into the cache + * @return true if there was anything into the cache */ U_CAPI UBool U_EXPORT2 ures_dumpCacheContents(void); #endif @@ -218,7 +218,7 @@ ures_findSubResource(const UResourceBundle *resB, * @param isAvailable If non-null, pointer to fillin parameter that indicates whether the * requested locale was available. The locale is defined as 'available' if it physically * exists within the specified tree. - * @param omitDefault if TRUE, omit keyword and value if default. 'de_DE\@collation=standard' -> 'de_DE' + * @param omitDefault if true, omit keyword and value if default. 'de_DE\@collation=standard' -> 'de_DE' * @param status error code * @return the actual buffer size needed for the full locale. If it's greater * than resultCapacity, the returned full name will be truncated and an error code will be returned. diff --git a/deps/icu-small/source/common/ustr_imp.h b/deps/icu-small/source/common/ustr_imp.h index 85d8e6d8ee6970..5b249ade3d21bb 100644 --- a/deps/icu-small/source/common/ustr_imp.h +++ b/deps/icu-small/source/common/ustr_imp.h @@ -29,7 +29,7 @@ /** * Compare two strings in code point order or code unit order. * Works in strcmp style (both lengths -1), - * strncmp style (lengths equal and >=0, flag TRUE), + * strncmp style (lengths equal and >=0, flag true), * and memcmp/UnicodeString style (at least one length >=0). */ U_CFUNC int32_t U_EXPORT2 @@ -37,13 +37,13 @@ uprv_strCompare(const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, UBool strncmpStyle, UBool codePointOrder); -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ustr_hashUCharsN(const UChar *str, int32_t length); -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ustr_hashCharsN(const char *str, int32_t length); -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ustr_hashICharsN(const char *str, int32_t length); /** @@ -53,7 +53,7 @@ ustr_hashICharsN(const char *str, int32_t length); * @return If UChar is a lowercase ASCII character, returns the uppercase version. * Otherwise, returns the input character. */ -U_INTERNAL UChar U_EXPORT2 +U_CAPI UChar U_EXPORT2 u_asciiToUpper(UChar c); // TODO: Add u_asciiToLower if/when there is a need for it. @@ -70,28 +70,28 @@ u_asciiToUpper(UChar c); * @param pErrorCode ICU error code. * @return length */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_terminateUChars(UChar *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode); /** * NUL-terminate a char * string if possible. * Same as u_terminateUChars() but for a different string type. */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_terminateChars(char *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode); /** * NUL-terminate a UChar32 * string if possible. * Same as u_terminateUChars() but for a different string type. */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_terminateUChar32s(UChar32 *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode); /** * NUL-terminate a wchar_t * string if possible. * Same as u_terminateUChars() but for a different string type. */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_terminateWChars(wchar_t *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode); /** @@ -133,7 +133,7 @@ class UTF8 { * @param t The i-th byte following the lead byte. * @param i The index (1..3) of byte t in the byte sequence. 0 length) { + tailLimit = length; + } + c = (UChar) u_unescapeAt(charAt, &ahead, tailLimit, + context); } if (U16_IS_TRAIL(c)) { *offset = ahead; diff --git a/deps/icu-small/source/common/util.h b/deps/icu-small/source/common/util.h index a2be25056e9acb..2a709e408a2698 100644 --- a/deps/icu-small/source/common/util.h +++ b/deps/icu-small/source/common/util.h @@ -64,8 +64,8 @@ class U_COMMON_API ICU_Utility /* not : public UObject because all methods are s /** * Escape unprintable characters using \uxxxx notation for U+0000 to * U+FFFF and \Uxxxxxxxx for U+10000 and above. If the character is - * printable ASCII, then do nothing and return FALSE. Otherwise, - * append the escaped notation and return TRUE. + * printable ASCII, then do nothing and return false. Otherwise, + * append the escaped notation and return true. */ static UBool escapeUnprintable(UnicodeString& result, UChar32 c); @@ -95,7 +95,7 @@ class U_COMMON_API ICU_Utility /* not : public UObject because all methods are s * after pos, or str.length(), if there is none. */ static int32_t skipWhitespace(const UnicodeString& str, int32_t& pos, - UBool advance = FALSE); + UBool advance = false); /** * Skip over Pattern_White_Space in a Replaceable. diff --git a/deps/icu-small/source/common/utrie.h b/deps/icu-small/source/common/utrie.h index 532ba778eb6ed1..2fd2c461ffb250 100644 --- a/deps/icu-small/source/common/utrie.h +++ b/deps/icu-small/source/common/utrie.h @@ -460,13 +460,13 @@ UTrieEnumValue(const void *context, uint32_t value); * of code points with the same value as retrieved from the trie and * transformed by the UTrieEnumValue function. * - * The callback function can stop the enumeration by returning FALSE. + * The callback function can stop the enumeration by returning false. * * @param context an opaque pointer, as passed into utrie_enum() * @param start the first code point in a contiguous range with value * @param limit one past the last code point in a contiguous range with value * @param value the value that is set for all code points in [start..limit[ - * @return FALSE to stop the enumeration + * @return false to stop the enumeration */ typedef UBool U_CALLCONV UTrieEnumRange(const void *context, UChar32 start, UChar32 limit, uint32_t value); @@ -667,7 +667,7 @@ utrie_getData(UNewTrie *trie, int32_t *pLength); * @param trie the build-time trie * @param c the code point * @param value the value - * @return FALSE if a failure occurred (illegal argument or data array overrun) + * @return false if a failure occurred (illegal argument or data array overrun) */ U_CAPI UBool U_EXPORT2 utrie_set32(UNewTrie *trie, UChar32 c, uint32_t value); @@ -677,7 +677,7 @@ utrie_set32(UNewTrie *trie, UChar32 c, uint32_t value); * * @param trie the build-time trie * @param c the code point - * @param pInBlockZero if not NULL, then *pInBlockZero is set to TRUE + * @param pInBlockZero if not NULL, then *pInBlockZero is set to true * iff the value is retrieved from block 0; * block 0 is the all-initial-value initial block * @return the value @@ -688,14 +688,14 @@ utrie_get32(UNewTrie *trie, UChar32 c, UBool *pInBlockZero); /** * Set a value in a range of code points [start..limit[. * All code points c with start<=cswapArray32(ds, &inTrie->signature, 4, &outTrie->signature, pErrorCode); ds->swapArray16(ds, &inTrie->options, 12, &outTrie->options, pErrorCode); - /* swap the index and the data */ + /* swap the index */ + const uint16_t *inIndex=reinterpret_cast(inTrie+1); + uint16_t *outIndex=reinterpret_cast(outTrie+1); + ds->swapArray16(ds, inIndex, trie.indexLength*2, outIndex, pErrorCode); + + /* swap the data */ + const uint16_t *inData=inIndex+trie.indexLength; + uint16_t *outData=outIndex+trie.indexLength; switch(valueWidth) { case UCPTRIE_VALUE_BITS_16: - ds->swapArray16(ds, inTrie+1, (trie.indexLength+dataLength)*2, outTrie+1, pErrorCode); + ds->swapArray16(ds, inData, dataLength*2, outData, pErrorCode); break; case UCPTRIE_VALUE_BITS_32: - ds->swapArray16(ds, inTrie+1, trie.indexLength*2, outTrie+1, pErrorCode); - ds->swapArray32(ds, (const uint16_t *)(inTrie+1)+trie.indexLength, dataLength*4, - (uint16_t *)(outTrie+1)+trie.indexLength, pErrorCode); + ds->swapArray32(ds, inData, dataLength*4, outData, pErrorCode); break; case UCPTRIE_VALUE_BITS_8: - ds->swapArray16(ds, inTrie+1, trie.indexLength*2, outTrie+1, pErrorCode); if(inTrie!=outTrie) { - uprv_memmove((outTrie+1)+trie.indexLength, (inTrie+1)+trie.indexLength, dataLength); + uprv_memmove(outData, inData, dataLength); } break; default: diff --git a/deps/icu-small/source/common/uts46.cpp b/deps/icu-small/source/common/uts46.cpp index b9e6cb023bb379..f25b4e12f124ca 100644 --- a/deps/icu-small/source/common/uts46.cpp +++ b/deps/icu-small/source/common/uts46.cpp @@ -714,6 +714,16 @@ UTS46::processLabel(UnicodeString &dest, UBool wasPunycode; if(labelLength>=4 && label[0]==0x78 && label[1]==0x6e && label[2]==0x2d && label[3]==0x2d) { // Label starts with "xn--", try to un-Punycode it. + // In IDNA2008, labels like "xn--" (decodes to an empty string) and + // "xn--ASCII-" (decodes to just "ASCII") fail the round-trip validation from + // comparing the ToUnicode input with the back-to-ToASCII output. + // They are alternate encodings of the respective ASCII labels. + // Ignore "xn---" here: It will fail Punycode.decode() which logically comes before + // the round-trip verification. + if(labelLength==4 || (labelLength>5 && label[labelLength-1]==u'-')) { + info.labelErrors|=UIDNA_ERROR_INVALID_ACE_LABEL; + return markBadACELabel(dest, labelStart, labelLength, toASCII, info, errorCode); + } wasPunycode=TRUE; UChar *unicodeBuffer=fromPunycode.getBuffer(-1); // capacity==-1: most labels should fit if(unicodeBuffer==NULL) { @@ -925,10 +935,10 @@ UTS46::markBadACELabel(UnicodeString &dest, UBool isASCII=TRUE; UBool onlyLDH=TRUE; const UChar *label=dest.getBuffer()+labelStart; - // Ok to cast away const because we own the UnicodeString. - UChar *s=(UChar *)label+4; // After the initial "xn--". const UChar *limit=label+labelLength; - do { + // Start after the initial "xn--". + // Ok to cast away const because we own the UnicodeString. + for(UChar *s=const_cast(label+4); sTo do * diff --git a/deps/icu-small/source/common/uvectr32.h b/deps/icu-small/source/common/uvectr32.h index 91a2dd2009eecb..92746a4f4782d8 100644 --- a/deps/icu-small/source/common/uvectr32.h +++ b/deps/icu-small/source/common/uvectr32.h @@ -214,7 +214,7 @@ class U_COMMON_API UVector32 : public UObject { inline UBool UVector32::ensureCapacity(int32_t minimumCapacity, UErrorCode &status) { if ((minimumCapacity >= 0) && (capacity >= minimumCapacity)) { - return TRUE; + return true; } else { return expandCapacity(minimumCapacity, status); } @@ -233,7 +233,7 @@ inline void UVector32::addElement(int32_t elem, UErrorCode &status) { } inline int32_t *UVector32::reserveBlock(int32_t size, UErrorCode &status) { - if (ensureCapacity(count+size, status) == FALSE) { + if (ensureCapacity(count+size, status) == false) { return NULL; } int32_t *rp = elements+count; diff --git a/deps/icu-small/source/common/uvectr64.h b/deps/icu-small/source/common/uvectr64.h index 6d26863eabc00d..4dab16396c1d13 100644 --- a/deps/icu-small/source/common/uvectr64.h +++ b/deps/icu-small/source/common/uvectr64.h @@ -203,7 +203,7 @@ class U_COMMON_API UVector64 : public UObject { inline UBool UVector64::ensureCapacity(int32_t minimumCapacity, UErrorCode &status) { if ((minimumCapacity >= 0) && (capacity >= minimumCapacity)) { - return TRUE; + return true; } else { return expandCapacity(minimumCapacity, status); } @@ -222,7 +222,7 @@ inline void UVector64::addElement(int64_t elem, UErrorCode &status) { } inline int64_t *UVector64::reserveBlock(int32_t size, UErrorCode &status) { - if (ensureCapacity(count+size, status) == FALSE) { + if (ensureCapacity(count+size, status) == false) { return NULL; } int64_t *rp = elements+count; diff --git a/deps/icu-small/source/common/wintz.cpp b/deps/icu-small/source/common/wintz.cpp index 115512e704cced..047f4290f10d0e 100644 --- a/deps/icu-small/source/common/wintz.cpp +++ b/deps/icu-small/source/common/wintz.cpp @@ -16,11 +16,12 @@ #if U_PLATFORM_USES_ONLY_WIN32_API #include "wintz.h" +#include "charstr.h" #include "cmemory.h" #include "cstring.h" #include "unicode/ures.h" -#include "unicode/ustring.h" +#include "unicode/unistr.h" #include "uresimp.h" #ifndef WIN32_LEAN_AND_MEAN @@ -35,89 +36,111 @@ U_NAMESPACE_BEGIN -// The max size of TimeZoneKeyName is 128, defined in DYNAMIC_TIME_ZONE_INFORMATION -#define MAX_TIMEZONE_ID_LENGTH 128 - /** * Main Windows time zone detection function. * Returns the Windows time zone converted to an ICU time zone as a heap-allocated buffer, or nullptr upon failure. -* Note: We use the Win32 API GetDynamicTimeZoneInformation to get the current time zone info. -* This API returns a non-localized time zone name, which we can then map to an ICU time zone name. +* +* Note: We use the Win32 API GetDynamicTimeZoneInformation (available since Vista+) to get the current time zone info. +* This API returns a non-localized time zone name, which is mapped to an ICU time zone ID (~ Olsen ID). */ -U_INTERNAL const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uprv_detectWindowsTimeZone() { - UErrorCode status = U_ZERO_ERROR; - char* icuid = nullptr; - char dynamicTZKeyName[MAX_TIMEZONE_ID_LENGTH]; - char tmpid[MAX_TIMEZONE_ID_LENGTH]; - int32_t len; - int id = GEOID_NOT_AVAILABLE; - int errorCode; - wchar_t ISOcodeW[3] = {}; /* 2 letter ISO code in UTF-16 */ - char ISOcode[3] = {}; /* 2 letter ISO code in UTF-8 */ - + // Obtain the DYNAMIC_TIME_ZONE_INFORMATION info to get the non-localized time zone name. DYNAMIC_TIME_ZONE_INFORMATION dynamicTZI; uprv_memset(&dynamicTZI, 0, sizeof(dynamicTZI)); - uprv_memset(dynamicTZKeyName, 0, sizeof(dynamicTZKeyName)); - uprv_memset(tmpid, 0, sizeof(tmpid)); + SYSTEMTIME systemTimeAllZero; + uprv_memset(&systemTimeAllZero, 0, sizeof(systemTimeAllZero)); - /* Obtain TIME_ZONE_INFORMATION from the API and get the non-localized time zone name. */ - if (TIME_ZONE_ID_INVALID == GetDynamicTimeZoneInformation(&dynamicTZI)) { + if (GetDynamicTimeZoneInformation(&dynamicTZI) == TIME_ZONE_ID_INVALID) { return nullptr; } - id = GetUserGeoID(GEOCLASS_NATION); - errorCode = GetGeoInfoW(id, GEO_ISO2, ISOcodeW, 3, 0); - - // convert from wchar_t* (UTF-16 on Windows) to char* (UTF-8). - u_strToUTF8(ISOcode, UPRV_LENGTHOF(ISOcode), nullptr, - reinterpret_cast(ISOcodeW), UPRV_LENGTHOF(ISOcodeW), &status); - - LocalUResourceBundlePointer bundle(ures_openDirect(nullptr, "windowsZones", &status)); - ures_getByKey(bundle.getAlias(), "mapTimezones", bundle.getAlias(), &status); + // If the DST setting has been turned off in the Control Panel, then return "Etc/GMT". + // + // Note: This logic is based on how the Control Panel itself determines if DST is 'off' on Windows. + // The code is somewhat convoluted; in a sort of pseudo-code it looks like this: + // + // IF (GetDynamicTimeZoneInformation != TIME_ZONE_ID_INVALID) && (DynamicDaylightTimeDisabled != 0) && + // (StandardDate == DaylightDate) && + // ( + // (TimeZoneKeyName != Empty && StandardDate == 0) || + // (TimeZoneKeyName == Empty && StandardDate != 0) + // ) + // THEN + // DST setting is "Disabled". + // + if (dynamicTZI.DynamicDaylightTimeDisabled != 0 && + uprv_memcmp(&dynamicTZI.StandardDate, &dynamicTZI.DaylightDate, sizeof(dynamicTZI.StandardDate)) == 0 && + ((dynamicTZI.TimeZoneKeyName[0] != L'\0' && uprv_memcmp(&dynamicTZI.StandardDate, &systemTimeAllZero, sizeof(systemTimeAllZero)) == 0) || + (dynamicTZI.TimeZoneKeyName[0] == L'\0' && uprv_memcmp(&dynamicTZI.StandardDate, &systemTimeAllZero, sizeof(systemTimeAllZero)) != 0))) + { + LONG utcOffsetMins = dynamicTZI.Bias; + if (utcOffsetMins == 0) { + return uprv_strdup("Etc/UTC"); + } - // convert from wchar_t* (UTF-16 on Windows) to char* (UTF-8). - u_strToUTF8(dynamicTZKeyName, UPRV_LENGTHOF(dynamicTZKeyName), nullptr, - reinterpret_cast(dynamicTZI.TimeZoneKeyName), -1, &status); + // No way to support when DST is turned off and the offset in minutes is not a multiple of 60. + if (utcOffsetMins % 60 == 0) { + char gmtOffsetTz[11] = {}; // "Etc/GMT+dd" is 11-char long with a terminal null. + // Note '-' before 'utcOffsetMin'. The timezone ID's sign convention + // is that a timezone ahead of UTC is Etc/GMT- and a timezone + // behind UTC is Etc/GMT+. + int ret = snprintf(gmtOffsetTz, UPRV_LENGTHOF(gmtOffsetTz), "Etc/GMT%+d", -utcOffsetMins / 60); + if (ret > 0 && ret < UPRV_LENGTHOF(gmtOffsetTz)) { + return uprv_strdup(gmtOffsetTz); + } + } + } - if (U_FAILURE(status)) { + // If DST is NOT disabled, but we have an empty TimeZoneKeyName, then it is unclear + // what we should do as this should not happen. + if (dynamicTZI.TimeZoneKeyName[0] == 0) { return nullptr; } - if (dynamicTZI.TimeZoneKeyName[0] != 0) { - StackUResourceBundle winTZ; - ures_getByKey(bundle.getAlias(), dynamicTZKeyName, winTZ.getAlias(), &status); + CharString winTZ; + UErrorCode status = U_ZERO_ERROR; + winTZ.appendInvariantChars(UnicodeString(TRUE, dynamicTZI.TimeZoneKeyName, -1), status); - if (U_SUCCESS(status)) { - const UChar* icuTZ = nullptr; - if (errorCode != 0) { - icuTZ = ures_getStringByKey(winTZ.getAlias(), ISOcode, &len, &status); - } - if (errorCode == 0 || icuTZ == nullptr) { - /* fallback to default "001" and reset status */ - status = U_ZERO_ERROR; - icuTZ = ures_getStringByKey(winTZ.getAlias(), "001", &len, &status); - } + // Map Windows Timezone name (non-localized) to ICU timezone ID (~ Olson timezone id). + StackUResourceBundle winTZBundle; + ures_openDirectFillIn(winTZBundle.getAlias(), nullptr, "windowsZones", &status); + ures_getByKey(winTZBundle.getAlias(), "mapTimezones", winTZBundle.getAlias(), &status); + ures_getByKey(winTZBundle.getAlias(), winTZ.data(), winTZBundle.getAlias(), &status); - if (U_SUCCESS(status)) { - int index = 0; + if (U_FAILURE(status)) { + return nullptr; + } - while (!(*icuTZ == '\0' || *icuTZ == ' ')) { - // time zone IDs only contain ASCII invariant characters. - tmpid[index++] = (char)(*icuTZ++); - } - tmpid[index] = '\0'; - } + // Note: Since the ISO 3166 country/region codes are all invariant ASCII chars, we can + // directly downcast from wchar_t to do the conversion. + // We could call the A version of the GetGeoInfo API, but that would be slightly slower than calling the W API, + // as the A version of the API will end up calling MultiByteToWideChar anyways internally. + wchar_t regionCodeW[3] = {}; + char regionCode[3] = {}; // 2 letter ISO 3166 country/region code made entirely of invariant chars. + int geoId = GetUserGeoID(GEOCLASS_NATION); + int regionCodeLen = GetGeoInfoW(geoId, GEO_ISO2, regionCodeW, UPRV_LENGTHOF(regionCodeW), 0); + + const UChar *icuTZ16 = nullptr; + int32_t tzLen; + + if (regionCodeLen != 0) { + for (int i = 0; i < UPRV_LENGTHOF(regionCodeW); i++) { + regionCode[i] = static_cast(regionCodeW[i]); } + icuTZ16 = ures_getStringByKey(winTZBundle.getAlias(), regionCode, &tzLen, &status); } - - // Copy the timezone ID to icuid to be returned. - if (tmpid[0] != 0) { - icuid = uprv_strdup(tmpid); + if (regionCodeLen == 0 || U_FAILURE(status)) { + // fallback to default "001" (world) + status = U_ZERO_ERROR; + icuTZ16 = ures_getStringByKey(winTZBundle.getAlias(), "001", &tzLen, &status); } - return icuid; + // Note: cloneData returns nullptr if the status is a failure, so this + // will return nullptr if the above look-up fails. + CharString icuTZStr; + return icuTZStr.appendInvariantChars(icuTZ16, tzLen, status).cloneData(status); } U_NAMESPACE_END diff --git a/deps/icu-small/source/common/wintz.h b/deps/icu-small/source/common/wintz.h index 9140d2729a98f8..b1ac8c07903738 100644 --- a/deps/icu-small/source/common/wintz.h +++ b/deps/icu-small/source/common/wintz.h @@ -28,7 +28,7 @@ U_CDECL_BEGIN typedef struct _TIME_ZONE_INFORMATION TIME_ZONE_INFORMATION; U_CDECL_END -U_INTERNAL const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uprv_detectWindowsTimeZone(); #endif /* U_PLATFORM_USES_ONLY_WIN32_API */ diff --git a/deps/icu-small/source/data/in/icudt67l.dat.bz2 b/deps/icu-small/source/data/in/icudt68l.dat.bz2 similarity index 55% rename from deps/icu-small/source/data/in/icudt67l.dat.bz2 rename to deps/icu-small/source/data/in/icudt68l.dat.bz2 index 60bc3e084f4322..fcee4ecfa17efe 100644 Binary files a/deps/icu-small/source/data/in/icudt67l.dat.bz2 and b/deps/icu-small/source/data/in/icudt68l.dat.bz2 differ diff --git a/deps/icu-small/source/i18n/buddhcal.h b/deps/icu-small/source/i18n/buddhcal.h index c3ffa6a41d3565..e5ce18883ac039 100644 --- a/deps/icu-small/source/i18n/buddhcal.h +++ b/deps/icu-small/source/i18n/buddhcal.h @@ -174,7 +174,7 @@ class BuddhistCalendar : public GregorianCalendar { UBool useMonth) const; /** - * Returns TRUE because the Buddhist Calendar does have a default century + * Returns true because the Buddhist Calendar does have a default century * @internal */ virtual UBool haveDefaultCentury() const; diff --git a/deps/icu-small/source/i18n/calendar.cpp b/deps/icu-small/source/i18n/calendar.cpp index e8b718f3c4619d..df256c154d7a4f 100644 --- a/deps/icu-small/source/i18n/calendar.cpp +++ b/deps/icu-small/source/i18n/calendar.cpp @@ -266,7 +266,7 @@ static ECalType getCalendarTypeForLocale(const char *locid) { //TODO: ULOC_FULL_NAME is out of date and too small.. char canonicalName[256]; - // canonicalize, so grandfathered variant will be transformed to keywords + // Canonicalize, so that an old-style variant will be transformed to keywords. // e.g ja_JP_TRADITIONAL -> ja_JP@calendar=japanese // NOTE: Since ICU-20187, ja_JP_TRADITIONAL no longer canonicalizes, and // the Gregorian calendar is returned instead. @@ -870,7 +870,7 @@ Calendar::createInstance(const TimeZone& zone, UErrorCode& success) Calendar* U_EXPORT2 Calendar::createInstance(const Locale& aLocale, UErrorCode& success) { - return createInstance(TimeZone::createDefault(), aLocale, success); + return createInstance(TimeZone::forLocaleOrDefault(aLocale), aLocale, success); } // ------------------------------------- Adopting diff --git a/deps/icu-small/source/i18n/cecal.cpp b/deps/icu-small/source/i18n/cecal.cpp index 458fe2f3049b9d..3389b728697db3 100644 --- a/deps/icu-small/source/i18n/cecal.cpp +++ b/deps/icu-small/source/i18n/cecal.cpp @@ -49,7 +49,7 @@ static const int32_t LIMITS[UCAL_FIELD_COUNT][4] = { //------------------------------------------------------------------------- CECalendar::CECalendar(const Locale& aLocale, UErrorCode& success) -: Calendar(TimeZone::createDefault(), aLocale, success) +: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success) { setTimeInMillis(getNow(), success); } diff --git a/deps/icu-small/source/i18n/cecal.h b/deps/icu-small/source/i18n/cecal.h index c380f0bea30523..80dab70f6ff0bf 100644 --- a/deps/icu-small/source/i18n/cecal.h +++ b/deps/icu-small/source/i18n/cecal.h @@ -88,7 +88,7 @@ class U_I18N_API CECalendar : public Calendar { virtual UBool inDaylightTime(UErrorCode&) const; /** - * Returns TRUE because Coptic/Ethiopic Calendar does have a default century + * Returns true because Coptic/Ethiopic Calendar does have a default century * @internal */ virtual UBool haveDefaultCentury() const; diff --git a/deps/icu-small/source/i18n/chnsecal.cpp b/deps/icu-small/source/i18n/chnsecal.cpp index 2ff9f755afe1f1..2ab08dd33925b2 100644 --- a/deps/icu-small/source/i18n/chnsecal.cpp +++ b/deps/icu-small/source/i18n/chnsecal.cpp @@ -123,7 +123,7 @@ ChineseCalendar* ChineseCalendar::clone() const { } ChineseCalendar::ChineseCalendar(const Locale& aLocale, UErrorCode& success) -: Calendar(TimeZone::createDefault(), aLocale, success), +: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success), isLeapYear(FALSE), fEpochYear(CHINESE_EPOCH_YEAR), fZoneAstroCalc(getChineseCalZoneAstroCalc()) @@ -133,7 +133,7 @@ ChineseCalendar::ChineseCalendar(const Locale& aLocale, UErrorCode& success) ChineseCalendar::ChineseCalendar(const Locale& aLocale, int32_t epochYear, const TimeZone* zoneAstroCalc, UErrorCode &success) -: Calendar(TimeZone::createDefault(), aLocale, success), +: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success), isLeapYear(FALSE), fEpochYear(epochYear), fZoneAstroCalc(zoneAstroCalc) diff --git a/deps/icu-small/source/i18n/chnsecal.h b/deps/icu-small/source/i18n/chnsecal.h index c7c063738145e7..77a68a48929e10 100644 --- a/deps/icu-small/source/i18n/chnsecal.h +++ b/deps/icu-small/source/i18n/chnsecal.h @@ -242,7 +242,7 @@ class U_I18N_API ChineseCalendar : public Calendar { /** - * Returns TRUE because the Islamic Calendar does have a default century + * Returns true because the Islamic Calendar does have a default century * @internal */ virtual UBool haveDefaultCentury() const; diff --git a/deps/icu-small/source/i18n/collation.h b/deps/icu-small/source/i18n/collation.h index e9256c9c12c5a7..ecbba29057f03a 100644 --- a/deps/icu-small/source/i18n/collation.h +++ b/deps/icu-small/source/i18n/collation.h @@ -356,7 +356,7 @@ class U_I18N_API Collation { } /** - * @return TRUE if the ce32 yields one or more CEs without further data lookups + * @return true if the ce32 yields one or more CEs without further data lookups */ static UBool isSelfContainedCE32(uint32_t ce32) { return !isSpecialCE32(ce32) || diff --git a/deps/icu-small/source/i18n/collationbuilder.h b/deps/icu-small/source/i18n/collationbuilder.h index 2f20050f93ba1d..82f0459748f051 100644 --- a/deps/icu-small/source/i18n/collationbuilder.h +++ b/deps/icu-small/source/i18n/collationbuilder.h @@ -42,7 +42,7 @@ class U_I18N_API CollationBuilder : public CollationRuleParser::Sink { CollationBuilder(const CollationTailoring *base, UErrorCode &errorCode); virtual ~CollationBuilder(); - void disableFastLatin() { fastLatinEnabled = FALSE; } + void disableFastLatin() { fastLatinEnabled = false; } CollationTailoring *parseAndBuild(const UnicodeString &ruleString, const UVersionInfo rulesVersion, diff --git a/deps/icu-small/source/i18n/collationdatabuilder.h b/deps/icu-small/source/i18n/collationdatabuilder.h index fee444deee77dc..6ae77772fd5a46 100644 --- a/deps/icu-small/source/i18n/collationdatabuilder.h +++ b/deps/icu-small/source/i18n/collationdatabuilder.h @@ -73,12 +73,12 @@ class U_I18N_API CollationDataBuilder : public UObject { } /** - * @return TRUE if this builder has mappings (e.g., add() has been called) + * @return true if this builder has mappings (e.g., add() has been called) */ UBool hasMappings() const { return modified; } /** - * @return TRUE if c has CEs in this builder + * @return true if c has CEs in this builder */ UBool isAssigned(UChar32 c) const; @@ -118,7 +118,7 @@ class U_I18N_API CollationDataBuilder : public UObject { * @param primary primary weight for 'start' * @param step per-code point primary-weight increment * @param errorCode ICU in/out error code - * @return TRUE if an OFFSET_TAG range was used for start..end + * @return true if an OFFSET_TAG range was used for start..end */ UBool maybeSetPrimaryRange(UChar32 start, UChar32 end, uint32_t primary, int32_t step, @@ -150,7 +150,7 @@ class U_I18N_API CollationDataBuilder : public UObject { void optimize(const UnicodeSet &set, UErrorCode &errorCode); void suppressContractions(const UnicodeSet &set, UErrorCode &errorCode); - void enableFastLatin() { fastLatinEnabled = TRUE; } + void enableFastLatin() { fastLatinEnabled = true; } virtual void build(CollationData &data, UErrorCode &errorCode); /** diff --git a/deps/icu-small/source/i18n/collationfcd.h b/deps/icu-small/source/i18n/collationfcd.h index ec7167d76bab75..3a5738efb24a7c 100644 --- a/deps/icu-small/source/i18n/collationfcd.h +++ b/deps/icu-small/source/i18n/collationfcd.h @@ -84,7 +84,7 @@ class U_I18N_API CollationFCD { // Handles all of Unicode 0..10FFFF. // c can be negative, e.g., U_SENTINEL. // U+0300 is the first character with lccc!=0. - if(c < 0x300) { return FALSE; } + if(c < 0x300) { return false; } if(c > 0xffff) { c = U16_LEAD(c); } int32_t i; return @@ -101,7 +101,7 @@ class U_I18N_API CollationFCD { * This is a fast and imprecise test. * * @param c a code point - * @return TRUE if c is U+0F73, U+0F75 or U+0F81 or one of several other Tibetan characters + * @return true if c is U+0F73, U+0F75 or U+0F81 or one of several other Tibetan characters */ static inline UBool maybeTibetanCompositeVowel(UChar32 c) { return (c & 0x1fff01) == 0xf01; @@ -116,7 +116,7 @@ class U_I18N_API CollationFCD { * They have distinct lccc/tccc combinations: 129/130 or 129/132. * * @param fcd16 the FCD value (lccc/tccc combination) of a code point - * @return TRUE if fcd16 is from U+0F73, U+0F75 or U+0F81 + * @return true if fcd16 is from U+0F73, U+0F75 or U+0F81 */ static inline UBool isFCD16OfTibetanCompositeVowel(uint16_t fcd16) { return fcd16 == 0x8182 || fcd16 == 0x8184; diff --git a/deps/icu-small/source/i18n/collationiterator.h b/deps/icu-small/source/i18n/collationiterator.h index 12e05b4482fab2..869f0956c34d0d 100644 --- a/deps/icu-small/source/i18n/collationiterator.h +++ b/deps/icu-small/source/i18n/collationiterator.h @@ -76,9 +76,9 @@ class U_I18N_API CollationIterator : public UObject { // (Rather than buffer.getCapacity().) if(length < INITIAL_CAPACITY || ensureAppendCapacity(1, errorCode)) { ++length; - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -251,9 +251,9 @@ class U_I18N_API CollationIterator : public UObject { virtual UBool foundNULTerminator(); /** - * @return FALSE if surrogate code points U+D800..U+DFFF + * @return false if surrogate code points U+D800..U+DFFF * map to their own implicit primary weights (for UTF-16), - * or TRUE if they map to CE(U+FFFD) (for UTF-8) + * or true if they map to CE(U+FFFD) (for UTF-8) */ virtual UBool forbidSurrogateCodePoints() const; diff --git a/deps/icu-small/source/i18n/collationkeys.h b/deps/icu-small/source/i18n/collationkeys.h index 60d9e50c0d9106..c526a4f14f2df8 100644 --- a/deps/icu-small/source/i18n/collationkeys.h +++ b/deps/icu-small/source/i18n/collationkeys.h @@ -65,7 +65,7 @@ class SortKeyByteSink : public ByteSink { } UBool Overflowed() const { return appended_ > capacity_; } - /** @return FALSE if memory allocation failed */ + /** @return false if memory allocation failed */ UBool IsOk() const { return buffer_ != NULL; } protected: @@ -94,8 +94,8 @@ class U_I18N_API CollationKeys /* not : public UObject because all methods are s virtual ~LevelCallback(); /** * @param level The next level about to be written to the ByteSink. - * @return TRUE if the level is to be written - * (the base class implementation always returns TRUE) + * @return true if the level is to be written + * (the base class implementation always returns true) */ virtual UBool needToWrite(Collation::Level level); }; @@ -103,7 +103,7 @@ class U_I18N_API CollationKeys /* not : public UObject because all methods are s /** * Writes the sort key bytes for minLevel up to the iterator data's strength. * Optionally writes the case level. - * Stops writing levels when callback.needToWrite(level) returns FALSE. + * Stops writing levels when callback.needToWrite(level) returns false. * Separates levels with the LEVEL_SEPARATOR_BYTE * but does not write a TERMINATOR_BYTE. */ diff --git a/deps/icu-small/source/i18n/collationtailoring.h b/deps/icu-small/source/i18n/collationtailoring.h index e1bc34c7d7683b..5fc2bac2d307fb 100644 --- a/deps/icu-small/source/i18n/collationtailoring.h +++ b/deps/icu-small/source/i18n/collationtailoring.h @@ -50,7 +50,7 @@ struct U_I18N_API CollationTailoring : public SharedObject { virtual ~CollationTailoring(); /** - * Returns TRUE if the constructor could not initialize properly. + * Returns true if the constructor could not initialize properly. */ UBool isBogus() { return settings == NULL; } diff --git a/deps/icu-small/source/i18n/collationweights.h b/deps/icu-small/source/i18n/collationweights.h index d8cee79e33fd87..bbd88b27e9e3d7 100644 --- a/deps/icu-small/source/i18n/collationweights.h +++ b/deps/icu-small/source/i18n/collationweights.h @@ -62,7 +62,7 @@ class U_I18N_API CollationWeights : public UMemory { * weights less than this one. * @param n The number of collation element weights w necessary such that * lowerLimitclone(): nullptr; fTimePattern = (itvfmt.fTimePattern)? itvfmt.fTimePattern->clone(): nullptr; fDateTimeFormat = (itvfmt.fDateTimeFormat)? itvfmt.fDateTimeFormat->clone(): nullptr; + fCapitalizationContext = itvfmt.fCapitalizationContext; } return *this; } @@ -239,7 +243,7 @@ DateIntervalFormat::operator==(const Format& other) const { if (fDateFormat && fmt->fDateFormat && (*fDateFormat != *fmt->fDateFormat)) {return FALSE;} } // note: fFromCalendar and fToCalendar hold no persistent state, and therefore do not participate in operator ==. - // fDateFormat has the master calendar for the DateIntervalFormat. + // fDateFormat has the primary calendar for the DateIntervalFormat. if (fSkeleton != fmt->fSkeleton) {return FALSE;} if (fDatePattern != fmt->fDatePattern && (fDatePattern == nullptr || fmt->fDatePattern == nullptr)) {return FALSE;} if (fDatePattern && fmt->fDatePattern && (*fDatePattern != *fmt->fDatePattern)) {return FALSE;} @@ -254,6 +258,7 @@ DateIntervalFormat::operator==(const Format& other) const { if (fIntervalPatterns[i].secondPart != fmt->fIntervalPatterns[i].secondPart ) {return FALSE;} if (fIntervalPatterns[i].laterDateFirst != fmt->fIntervalPatterns[i].laterDateFirst) {return FALSE;} } + if (fCapitalizationContext != fmt->fCapitalizationContext) {return FALSE;} return TRUE; } @@ -409,6 +414,7 @@ UnicodeString& DateIntervalFormat::formatIntervalImpl( } +// The following is only called from within the gFormatterMutex lock UnicodeString& DateIntervalFormat::formatImpl(Calendar& fromCalendar, Calendar& toCalendar, @@ -464,6 +470,11 @@ DateIntervalFormat::formatImpl(Calendar& fromCalendar, if ( U_FAILURE(status) ) { return appendTo; } + UErrorCode tempStatus = U_ZERO_ERROR; // for setContext, ignored + // Set up fDateFormat to handle the first or only part of the interval + // (override later for any second part). Inside lock, OK to modify fDateFormat. + fDateFormat->setContext(fCapitalizationContext, tempStatus); + if ( field == UCAL_FIELD_COUNT ) { /* ignore the millisecond etc. small fields' difference. * use single date when all the above are the same. @@ -521,6 +532,9 @@ DateIntervalFormat::formatImpl(Calendar& fromCalendar, if ( !intervalPattern.secondPart.isEmpty() ) { fDateFormat->applyPattern(intervalPattern.secondPart); + // No capitalization for second part of interval + tempStatus = U_ZERO_ERROR; + fDateFormat->setContext(UDISPCTX_CAPITALIZATION_NONE, tempStatus); fDateFormat->_format(*secondCal, appendTo, fphandler, status); } fDateFormat->applyPattern(originalPattern); @@ -583,7 +597,7 @@ DateIntervalFormat::adoptTimeZone(TimeZone* zone) if (fDateFormat != nullptr) { fDateFormat->adoptTimeZone(zone); } - // The fDateFormat has the master calendar for the DateIntervalFormat and has + // The fDateFormat has the primary calendar for the DateIntervalFormat and has // ownership of any adopted TimeZone; fFromCalendar and fToCalendar are internal // work clones of that calendar (and should not also be given ownership of the // adopted TimeZone). @@ -601,7 +615,7 @@ DateIntervalFormat::setTimeZone(const TimeZone& zone) if (fDateFormat != nullptr) { fDateFormat->setTimeZone(zone); } - // The fDateFormat has the master calendar for the DateIntervalFormat; + // The fDateFormat has the primary calendar for the DateIntervalFormat; // fFromCalendar and fToCalendar are internal work clones of that calendar. if (fFromCalendar) { fFromCalendar->setTimeZone(zone); @@ -622,6 +636,30 @@ DateIntervalFormat::getTimeZone() const return *(TimeZone::createDefault()); } +void +DateIntervalFormat::setContext(UDisplayContext value, UErrorCode& status) +{ + if (U_FAILURE(status)) + return; + if ( (UDisplayContextType)((uint32_t)value >> 8) == UDISPCTX_TYPE_CAPITALIZATION ) { + fCapitalizationContext = value; + } else { + status = U_ILLEGAL_ARGUMENT_ERROR; + } +} + +UDisplayContext +DateIntervalFormat::getContext(UDisplayContextType type, UErrorCode& status) const +{ + if (U_FAILURE(status)) + return (UDisplayContext)0; + if (type != UDISPCTX_TYPE_CAPITALIZATION) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return (UDisplayContext)0; + } + return fCapitalizationContext; +} + DateIntervalFormat::DateIntervalFormat(const Locale& locale, DateIntervalInfo* dtItvInfo, const UnicodeString* skeleton, @@ -633,7 +671,8 @@ DateIntervalFormat::DateIntervalFormat(const Locale& locale, fLocale(locale), fDatePattern(nullptr), fTimePattern(nullptr), - fDateTimeFormat(nullptr) + fDateTimeFormat(nullptr), + fCapitalizationContext(UDISPCTX_CAPITALIZATION_NONE) { LocalPointer info(dtItvInfo, status); LocalPointer dtfmt(static_cast( @@ -751,7 +790,7 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { /* the difference between time skeleton and normalizedTimeSkeleton are: * 1. (Formerly, normalized time skeleton folded 'H' to 'h'; no longer true) - * 2. 'a' is omitted in normalized time skeleton. + * 2. (Formerly, 'a' was omitted in normalized time skeleton; this is now handled elsewhere) * 3. there is only one appearance for 'h' or 'H', 'm','v', 'z' in normalized * time skeleton * @@ -760,7 +799,8 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { * 2. 'E' and 'EE' are normalized into 'EEE' * 3. 'MM' is normalized into 'M' */ - getDateTimeSkeleton(fSkeleton, dateSkeleton, normalizedDateSkeleton, + UnicodeString convertedSkeleton = normalizeHourMetacharacters(fSkeleton); + getDateTimeSkeleton(convertedSkeleton, dateSkeleton, normalizedDateSkeleton, timeSkeleton, normalizedTimeSkeleton); #ifdef DTITVFMT_DEBUG @@ -899,6 +939,91 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { +UnicodeString +DateIntervalFormat::normalizeHourMetacharacters(const UnicodeString& skeleton) const { + UnicodeString result = skeleton; + + UChar hourMetachar = u'\0'; + int32_t metacharStart = 0; + int32_t metacharCount = 0; + for (int32_t i = 0; i < result.length(); i++) { + UChar c = result[i]; + if (c == LOW_J || c == CAP_J || c == CAP_C) { + if (hourMetachar == u'\0') { + hourMetachar = c; + metacharStart = i; + } + ++metacharCount; + } else { + if (hourMetachar != u'\0') { + break; + } + } + } + + if (hourMetachar != u'\0') { + UErrorCode err = U_ZERO_ERROR; + UChar hourChar = CAP_H; + UChar dayPeriodChar = LOW_A; + UnicodeString convertedPattern = DateFormat::getBestPattern(fLocale, UnicodeString(hourMetachar), err); + + if (U_SUCCESS(err)) { + // strip literal text from the pattern (so literal characters don't get mistaken for pattern + // characters-- such as the 'h' in 'Uhr' in Germam) + int32_t firstQuotePos; + while ((firstQuotePos = convertedPattern.indexOf(u'\'')) != -1) { + int32_t secondQuotePos = convertedPattern.indexOf(u'\'', firstQuotePos + 1); + if (secondQuotePos == -1) { + secondQuotePos = firstQuotePos; + } + convertedPattern.replace(firstQuotePos, (secondQuotePos - firstQuotePos) + 1, UnicodeString()); + } + + if (convertedPattern.indexOf(LOW_H) != -1) { + hourChar = LOW_H; + } else if (convertedPattern.indexOf(CAP_K) != -1) { + hourChar = CAP_K; + } else if (convertedPattern.indexOf(LOW_K) != -1) { + hourChar = LOW_K; + } + + if (convertedPattern.indexOf(LOW_B) != -1) { + dayPeriodChar = LOW_B; + } else if (convertedPattern.indexOf(CAP_B) != -1) { + dayPeriodChar = CAP_B; + } + } + + if (hourChar == CAP_H || hourChar == LOW_K) { + result.replace(metacharStart, metacharCount, hourChar); + } else { + UnicodeString hourAndDayPeriod(hourChar); + switch (metacharCount) { + case 1: + case 2: + default: + hourAndDayPeriod.append(UnicodeString(dayPeriodChar)); + break; + case 3: + case 4: + for (int32_t i = 0; i < 4; i++) { + hourAndDayPeriod.append(dayPeriodChar); + } + break; + case 5: + case 6: + for (int32_t i = 0; i < 5; i++) { + hourAndDayPeriod.append(dayPeriodChar); + } + break; + } + result.replace(metacharStart, metacharCount, hourAndDayPeriod); + } + } + return result; +} + + void U_EXPORT2 DateIntervalFormat::getDateTimeSkeleton(const UnicodeString& skeleton, UnicodeString& dateSkeleton, @@ -911,11 +1036,10 @@ DateIntervalFormat::getDateTimeSkeleton(const UnicodeString& skeleton, int32_t dCount = 0; int32_t MCount = 0; int32_t yCount = 0; - int32_t hCount = 0; - int32_t HCount = 0; int32_t mCount = 0; int32_t vCount = 0; int32_t zCount = 0; + UChar hourChar = u'\0'; int32_t i; for (i = 0; i < skeleton.length(); ++i) { @@ -956,17 +1080,14 @@ DateIntervalFormat::getDateTimeSkeleton(const UnicodeString& skeleton, normalizedDateSkeleton.append(ch); dateSkeleton.append(ch); break; - case LOW_A: - // 'a' is implicitly handled - timeSkeleton.append(ch); - break; case LOW_H: - timeSkeleton.append(ch); - ++hCount; - break; case CAP_H: + case LOW_K: + case CAP_K: timeSkeleton.append(ch); - ++HCount; + if (hourChar == u'\0') { + hourChar = ch; + } break; case LOW_M: timeSkeleton.append(ch); @@ -980,14 +1101,15 @@ DateIntervalFormat::getDateTimeSkeleton(const UnicodeString& skeleton, ++vCount; timeSkeleton.append(ch); break; + case LOW_A: case CAP_V: case CAP_Z: - case LOW_K: - case CAP_K: case LOW_J: case LOW_S: case CAP_S: case CAP_A: + case LOW_B: + case CAP_B: timeSkeleton.append(ch); normalizedTimeSkeleton.append(ch); break; @@ -1023,11 +1145,8 @@ DateIntervalFormat::getDateTimeSkeleton(const UnicodeString& skeleton, } /* generate normalized form for time */ - if ( HCount != 0 ) { - normalizedTimeSkeleton.append(CAP_H); - } - else if ( hCount != 0 ) { - normalizedTimeSkeleton.append(LOW_H); + if ( hourChar != u'\0' ) { + normalizedTimeSkeleton.append(hourChar); } if ( mCount != 0 ) { normalizedTimeSkeleton.append(LOW_M); @@ -1335,10 +1454,11 @@ DateIntervalFormat::setIntervalPattern(UCalendarDateFields field, } } if ( !pattern.isEmpty() ) { - if ( differenceInfo != 0 ) { + UBool suppressDayPeriodField = fSkeleton.indexOf(CAP_J) != -1; + if ( differenceInfo != 0 || suppressDayPeriodField) { UnicodeString adjustIntervalPattern; adjustFieldWidth(*skeleton, *bestSkeleton, pattern, differenceInfo, - adjustIntervalPattern); + suppressDayPeriodField, adjustIntervalPattern); setIntervalPattern(field, adjustIntervalPattern); } else { setIntervalPattern(field, pattern); @@ -1425,6 +1545,7 @@ DateIntervalFormat::splitPatternInto2Part(const UnicodeString& intervalPattern) return (i - count); } +// The following is only called from fallbackFormat, i.e. within the gFormatterMutex lock void DateIntervalFormat::fallbackFormatRange( Calendar& fromCalendar, Calendar& toCalendar, @@ -1441,12 +1562,15 @@ void DateIntervalFormat::fallbackFormatRange( int32_t offsets[2]; UnicodeString patternBody = sf.getTextWithNoArguments(offsets, 2); + UErrorCode tempStatus = U_ZERO_ERROR; // for setContext, ignored // TODO(ICU-20406): Use SimpleFormatter Iterator interface when available. if (offsets[0] < offsets[1]) { firstIndex = 0; appendTo.append(patternBody.tempSubStringBetween(0, offsets[0])); fDateFormat->_format(fromCalendar, appendTo, fphandler, status); appendTo.append(patternBody.tempSubStringBetween(offsets[0], offsets[1])); + // No capitalization for second part of interval + fDateFormat->setContext(UDISPCTX_CAPITALIZATION_NONE, tempStatus); fDateFormat->_format(toCalendar, appendTo, fphandler, status); appendTo.append(patternBody.tempSubStringBetween(offsets[1])); } else { @@ -1454,11 +1578,14 @@ void DateIntervalFormat::fallbackFormatRange( appendTo.append(patternBody.tempSubStringBetween(0, offsets[1])); fDateFormat->_format(toCalendar, appendTo, fphandler, status); appendTo.append(patternBody.tempSubStringBetween(offsets[1], offsets[0])); + // No capitalization for second part of interval + fDateFormat->setContext(UDISPCTX_CAPITALIZATION_NONE, tempStatus); fDateFormat->_format(fromCalendar, appendTo, fphandler, status); appendTo.append(patternBody.tempSubStringBetween(offsets[0])); } } +// The following is only called from formatImpl, i.e. within the gFormatterMutex lock UnicodeString& DateIntervalFormat::fallbackFormat(Calendar& fromCalendar, Calendar& toCalendar, @@ -1483,6 +1610,7 @@ DateIntervalFormat::fallbackFormat(Calendar& fromCalendar, UnicodeString fullPattern; // for saving the pattern in fDateFormat fDateFormat->toPattern(fullPattern); // save current pattern, restore later + UErrorCode tempStatus = U_ZERO_ERROR; // for setContext, ignored // {0} is time range // {1} is single date portion // TODO(ICU-20406): Use SimpleFormatter Iterator interface when available. @@ -1492,6 +1620,8 @@ DateIntervalFormat::fallbackFormat(Calendar& fromCalendar, fallbackFormatRange(fromCalendar, toCalendar, appendTo, firstIndex, fphandler, status); appendTo.append(patternBody.tempSubStringBetween(offsets[0], offsets[1])); fDateFormat->applyPattern(*fDatePattern); + // No capitalization for second portion + fDateFormat->setContext(UDISPCTX_CAPITALIZATION_NONE, tempStatus); fDateFormat->_format(fromCalendar, appendTo, fphandler, status); appendTo.append(patternBody.tempSubStringBetween(offsets[1])); } else { @@ -1500,6 +1630,8 @@ DateIntervalFormat::fallbackFormat(Calendar& fromCalendar, fDateFormat->_format(fromCalendar, appendTo, fphandler, status); appendTo.append(patternBody.tempSubStringBetween(offsets[1], offsets[0])); fDateFormat->applyPattern(*fTimePattern); + // No capitalization for second portion + fDateFormat->setContext(UDISPCTX_CAPITALIZATION_NONE, tempStatus); fallbackFormatRange(fromCalendar, toCalendar, appendTo, firstIndex, fphandler, status); appendTo.append(patternBody.tempSubStringBetween(offsets[0])); } @@ -1530,6 +1662,7 @@ DateIntervalFormat::adjustFieldWidth(const UnicodeString& inputSkeleton, const UnicodeString& bestMatchSkeleton, const UnicodeString& bestIntervalPattern, int8_t differenceInfo, + UBool suppressDayPeriodField, UnicodeString& adjustedPtn) { adjustedPtn = bestIntervalPattern; int32_t inputSkeletonFieldWidth[] = @@ -1556,19 +1689,44 @@ DateIntervalFormat::adjustFieldWidth(const UnicodeString& inputSkeleton, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + const int8_t PATTERN_CHAR_BASE = 0x41; + DateIntervalInfo::parseSkeleton(inputSkeleton, inputSkeletonFieldWidth); DateIntervalInfo::parseSkeleton(bestMatchSkeleton, bestMatchSkeletonFieldWidth); + if (suppressDayPeriodField) { + adjustedPtn.findAndReplace(UnicodeString(LOW_A), UnicodeString()); + adjustedPtn.findAndReplace(UnicodeString(" "), UnicodeString(" ")); + adjustedPtn.trim(); + } if ( differenceInfo == 2 ) { - adjustedPtn.findAndReplace(UnicodeString((UChar)0x76 /* v */), - UnicodeString((UChar)0x7a /* z */)); + if (inputSkeleton.indexOf(LOW_Z) != -1) { + adjustedPtn.findAndReplace(UnicodeString(LOW_V), + UnicodeString(LOW_Z)); + } + if (inputSkeleton.indexOf(CAP_K) != -1) { + adjustedPtn.findAndReplace(UnicodeString(LOW_H), + UnicodeString(CAP_K)); + } + if (inputSkeleton.indexOf(LOW_K) != -1) { + adjustedPtn.findAndReplace(UnicodeString(CAP_H), + UnicodeString(LOW_K)); + } + if (inputSkeleton.indexOf(LOW_B) != -1) { + adjustedPtn.findAndReplace(UnicodeString(LOW_A), + UnicodeString(LOW_B)); + } } + if (adjustedPtn.indexOf(LOW_A) != -1 && bestMatchSkeletonFieldWidth[LOW_A - PATTERN_CHAR_BASE] == 0) { + bestMatchSkeletonFieldWidth[LOW_A - PATTERN_CHAR_BASE] = 1; + } + if (adjustedPtn.indexOf(LOW_B) != -1 && bestMatchSkeletonFieldWidth[LOW_B - PATTERN_CHAR_BASE] == 0) { + bestMatchSkeletonFieldWidth[LOW_B - PATTERN_CHAR_BASE] = 1; + } UBool inQuote = false; UChar prevCh = 0; int32_t count = 0; - const int8_t PATTERN_CHAR_BASE = 0x41; - // loop through the pattern string character by character int32_t adjustedPtnLength = adjustedPtn.length(); int32_t i; diff --git a/deps/icu-small/source/i18n/dtitvinf.cpp b/deps/icu-small/source/i18n/dtitvinf.cpp index 25536346ec74f0..39fd44a392d694 100644 --- a/deps/icu-small/source/i18n/dtitvinf.cpp +++ b/deps/icu-small/source/i18n/dtitvinf.cpp @@ -339,6 +339,9 @@ struct DateIntervalInfo::DateIntervalSink : public ResourceSink { return UCAL_DATE; } else if (c0 == 'a') { return UCAL_AM_PM; + } else if (c0 == 'B') { + // TODO: Using AM/PM as a proxy for flexible day period isn't really correct, but it's close + return UCAL_AM_PM; } else if (c0 == 'h' || c0 == 'H') { return UCAL_HOUR; } else if (c0 == 'm') { @@ -594,20 +597,23 @@ DateIntervalInfo::getBestSkeleton(const UnicodeString& skeleton, const int32_t DIFFERENT_FIELD = 0x1000; const int32_t STRING_NUMERIC_DIFFERENCE = 0x100; const int32_t BASE = 0x41; - const UChar CHAR_V = 0x0076; - const UChar CHAR_Z = 0x007A; - // hack for 'v' and 'z'. - // resource bundle only have time skeletons ending with 'v', - // but not for time skeletons ending with 'z'. - UBool replaceZWithV = false; + // hack for certain alternate characters + // resource bundles only have time skeletons containing 'v', 'h', and 'H' + // but not time skeletons containing 'z', 'K', or 'k' + // the skeleton may also include 'a' or 'b', which never occur in the resource bundles, so strip them out too + UBool replacedAlternateChars = false; const UnicodeString* inputSkeleton = &skeleton; UnicodeString copySkeleton; - if ( skeleton.indexOf(CHAR_Z) != -1 ) { + if ( skeleton.indexOf(LOW_Z) != -1 || skeleton.indexOf(LOW_K) != -1 || skeleton.indexOf(CAP_K) != -1 || skeleton.indexOf(LOW_A) != -1 || skeleton.indexOf(LOW_B) != -1 ) { copySkeleton = skeleton; - copySkeleton.findAndReplace(UnicodeString(CHAR_Z), UnicodeString(CHAR_V)); + copySkeleton.findAndReplace(UnicodeString(LOW_Z), UnicodeString(LOW_V)); + copySkeleton.findAndReplace(UnicodeString(LOW_K), UnicodeString(CAP_H)); + copySkeleton.findAndReplace(UnicodeString(CAP_K), UnicodeString(LOW_H)); + copySkeleton.findAndReplace(UnicodeString(LOW_A), UnicodeString()); + copySkeleton.findAndReplace(UnicodeString(LOW_B), UnicodeString()); inputSkeleton = ©Skeleton; - replaceZWithV = true; + replacedAlternateChars = true; } parseSkeleton(*inputSkeleton, inputSkeletonFieldWidth); @@ -616,7 +622,7 @@ DateIntervalInfo::getBestSkeleton(const UnicodeString& skeleton, // 0 means exact the same skeletons; // 1 means having the same field, but with different length, - // 2 means only z/v differs + // 2 means only z/v, h/K, or H/k differs // -1 means having different field. bestMatchDistanceInfo = 0; int8_t fieldLength = UPRV_LENGTHOF(skeletonFieldWidth); @@ -672,7 +678,7 @@ DateIntervalInfo::getBestSkeleton(const UnicodeString& skeleton, break; } } - if ( replaceZWithV && bestMatchDistanceInfo != -1 ) { + if ( replacedAlternateChars && bestMatchDistanceInfo != -1 ) { bestMatchDistanceInfo = 2; } return bestSkeleton; diff --git a/deps/icu-small/source/i18n/dtptngen.cpp b/deps/icu-small/source/i18n/dtptngen.cpp index 279fb49a7aa9b9..78273ef01e2281 100644 --- a/deps/icu-small/source/i18n/dtptngen.cpp +++ b/deps/icu-small/source/i18n/dtptngen.cpp @@ -311,6 +311,16 @@ DateTimePatternGenerator::createInstance(const Locale& locale, UErrorCode& statu return U_SUCCESS(status) ? result.orphan() : nullptr; } +DateTimePatternGenerator* U_EXPORT2 +DateTimePatternGenerator::createInstanceNoStdPat(const Locale& locale, UErrorCode& status) { + if (U_FAILURE(status)) { + return nullptr; + } + LocalPointer result( + new DateTimePatternGenerator(locale, status, true), status); + return U_SUCCESS(status) ? result.orphan() : nullptr; +} + DateTimePatternGenerator* U_EXPORT2 DateTimePatternGenerator::createEmptyInstance(UErrorCode& status) { if (U_FAILURE(status)) { @@ -336,7 +346,7 @@ DateTimePatternGenerator::DateTimePatternGenerator(UErrorCode &status) : } } -DateTimePatternGenerator::DateTimePatternGenerator(const Locale& locale, UErrorCode &status) : +DateTimePatternGenerator::DateTimePatternGenerator(const Locale& locale, UErrorCode &status, UBool skipStdPatterns) : skipMatcher(nullptr), fAvailableFormatKeyHash(nullptr), fDefaultHourFormatChar(0), @@ -350,7 +360,7 @@ DateTimePatternGenerator::DateTimePatternGenerator(const Locale& locale, UErrorC internalErrorCode = status = U_MEMORY_ALLOCATION_ERROR; } else { - initData(locale, status); + initData(locale, status, skipStdPatterns); } } @@ -489,13 +499,15 @@ enum AllowedHourFormat{ } // namespace void -DateTimePatternGenerator::initData(const Locale& locale, UErrorCode &status) { +DateTimePatternGenerator::initData(const Locale& locale, UErrorCode &status, UBool skipStdPatterns) { //const char *baseLangName = locale.getBaseName(); // unused skipMatcher = nullptr; fAvailableFormatKeyHash=nullptr; addCanonicalItems(status); - addICUPatterns(locale, status); + if (!skipStdPatterns) { // skip to prevent circular dependency when called from SimpleDateFormat::construct + addICUPatterns(locale, status); + } addCLDRData(locale, status); setDateTimeFromCalendar(locale, status); setDecimalSymbols(locale, status); @@ -893,7 +905,7 @@ DateTimePatternGenerator::getCalendarTypeToUse(const Locale& locale, CharString& err = localStatus; return; } - if (calendarTypeLen < ULOC_KEYWORDS_CAPACITY) { + if (calendarTypeLen > 0 && calendarTypeLen < ULOC_KEYWORDS_CAPACITY) { destination.clear().append(calendarType, -1, err); if (U_FAILURE(err)) { return; } } diff --git a/deps/icu-small/source/i18n/dtptngen_impl.h b/deps/icu-small/source/i18n/dtptngen_impl.h index ade9f57331e769..9b9442d5787142 100644 --- a/deps/icu-small/source/i18n/dtptngen_impl.h +++ b/deps/icu-small/source/i18n/dtptngen_impl.h @@ -195,7 +195,7 @@ class FormatParser : public UMemory { void getQuoteLiteral(UnicodeString& quote, int32_t *itemIndex); UBool isPatternSeparator(const UnicodeString& field) const; static UBool isQuoteLiteral(const UnicodeString& s); - static int32_t getCanonicalIndex(const UnicodeString& s) { return getCanonicalIndex(s, TRUE); } + static int32_t getCanonicalIndex(const UnicodeString& s) { return getCanonicalIndex(s, true); } static int32_t getCanonicalIndex(const UnicodeString& s, UBool strict); private: diff --git a/deps/icu-small/source/i18n/fmtable.cpp b/deps/icu-small/source/i18n/fmtable.cpp index 10a6fdb0ff3441..44c3087fb91aa6 100644 --- a/deps/icu-small/source/i18n/fmtable.cpp +++ b/deps/icu-small/source/i18n/fmtable.cpp @@ -895,7 +895,7 @@ U_NAMESPACE_END U_NAMESPACE_USE -U_DRAFT UFormattable* U_EXPORT2 +U_CAPI UFormattable* U_EXPORT2 ufmt_open(UErrorCode *status) { if( U_FAILURE(*status) ) { return NULL; @@ -908,14 +908,14 @@ ufmt_open(UErrorCode *status) { return fmt; } -U_DRAFT void U_EXPORT2 +U_CAPI void U_EXPORT2 ufmt_close(UFormattable *fmt) { Formattable *obj = Formattable::fromUFormattable(fmt); delete obj; } -U_INTERNAL UFormattableType U_EXPORT2 +U_CAPI UFormattableType U_EXPORT2 ufmt_getType(const UFormattable *fmt, UErrorCode *status) { if(U_FAILURE(*status)) { return (UFormattableType)UFMT_COUNT; @@ -925,27 +925,27 @@ ufmt_getType(const UFormattable *fmt, UErrorCode *status) { } -U_INTERNAL UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ufmt_isNumeric(const UFormattable *fmt) { const Formattable *obj = Formattable::fromUFormattable(fmt); return obj->isNumeric(); } -U_DRAFT UDate U_EXPORT2 +U_CAPI UDate U_EXPORT2 ufmt_getDate(const UFormattable *fmt, UErrorCode *status) { const Formattable *obj = Formattable::fromUFormattable(fmt); return obj->getDate(*status); } -U_DRAFT double U_EXPORT2 +U_CAPI double U_EXPORT2 ufmt_getDouble(UFormattable *fmt, UErrorCode *status) { Formattable *obj = Formattable::fromUFormattable(fmt); return obj->getDouble(*status); } -U_DRAFT int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ufmt_getLong(UFormattable *fmt, UErrorCode *status) { Formattable *obj = Formattable::fromUFormattable(fmt); @@ -953,7 +953,7 @@ ufmt_getLong(UFormattable *fmt, UErrorCode *status) { } -U_DRAFT const void *U_EXPORT2 +U_CAPI const void *U_EXPORT2 ufmt_getObject(const UFormattable *fmt, UErrorCode *status) { const Formattable *obj = Formattable::fromUFormattable(fmt); @@ -966,7 +966,7 @@ ufmt_getObject(const UFormattable *fmt, UErrorCode *status) { return ret; } -U_DRAFT const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ufmt_getUChars(UFormattable *fmt, int32_t *len, UErrorCode *status) { Formattable *obj = Formattable::fromUFormattable(fmt); @@ -986,7 +986,7 @@ ufmt_getUChars(UFormattable *fmt, int32_t *len, UErrorCode *status) { return str.getTerminatedBuffer(); } -U_DRAFT int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ufmt_getArrayLength(const UFormattable* fmt, UErrorCode *status) { const Formattable *obj = Formattable::fromUFormattable(fmt); @@ -995,7 +995,7 @@ ufmt_getArrayLength(const UFormattable* fmt, UErrorCode *status) { return count; } -U_DRAFT UFormattable * U_EXPORT2 +U_CAPI UFormattable * U_EXPORT2 ufmt_getArrayItemByIndex(UFormattable* fmt, int32_t n, UErrorCode *status) { Formattable *obj = Formattable::fromUFormattable(fmt); int32_t count; @@ -1010,7 +1010,7 @@ ufmt_getArrayItemByIndex(UFormattable* fmt, int32_t n, UErrorCode *status) { } } -U_DRAFT const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ufmt_getDecNumChars(UFormattable *fmt, int32_t *len, UErrorCode *status) { if(U_FAILURE(*status)) { return ""; @@ -1031,7 +1031,7 @@ ufmt_getDecNumChars(UFormattable *fmt, int32_t *len, UErrorCode *status) { } } -U_DRAFT int64_t U_EXPORT2 +U_CAPI int64_t U_EXPORT2 ufmt_getInt64(UFormattable *fmt, UErrorCode *status) { Formattable *obj = Formattable::fromUFormattable(fmt); return obj->getInt64(*status); diff --git a/deps/icu-small/source/i18n/fmtable_cnv.cpp b/deps/icu-small/source/i18n/fmtable_cnv.cpp index 9a647927797dbd..bc3847b6963e70 100644 --- a/deps/icu-small/source/i18n/fmtable_cnv.cpp +++ b/deps/icu-small/source/i18n/fmtable_cnv.cpp @@ -30,8 +30,6 @@ U_NAMESPACE_BEGIN // ------------------------------------- // Creates a formattable object with a char* string. // This API is useless. The API that takes a UnicodeString is actually just as good. -// This is just a grandfathered API. - Formattable::Formattable(const char* stringToCopy) { init(); diff --git a/deps/icu-small/source/i18n/format.cpp b/deps/icu-small/source/i18n/format.cpp index e5abbe9eb0fa7d..a010defff93c40 100644 --- a/deps/icu-small/source/i18n/format.cpp +++ b/deps/icu-small/source/i18n/format.cpp @@ -26,7 +26,7 @@ #include "unicode/utypes.h" #ifndef U_I18N_IMPLEMENTATION -#error U_I18N_IMPLEMENTATION not set - must be set for all ICU source files in i18n/ - see http://userguide.icu-project.org/howtouseicu +#error U_I18N_IMPLEMENTATION not set - must be set for all ICU source files in i18n/ - see https://unicode-org.github.io/icu/userguide/howtouseicu #endif /* diff --git a/deps/icu-small/source/i18n/formatted_string_builder.h b/deps/icu-small/source/i18n/formatted_string_builder.h index 4567dc1d66b0ce..92bcf07d782cde 100644 --- a/deps/icu-small/source/i18n/formatted_string_builder.h +++ b/deps/icu-small/source/i18n/formatted_string_builder.h @@ -25,7 +25,7 @@ class FormattedValueStringBuilderImpl; * *

      *
    1. Efficient prepend as well as append. - *
    2. Keeps tracks of Fields in an efficient manner. + *
    3. Keeps track of Fields in an efficient manner. *
    * * See also FormattedValueStringBuilderImpl. @@ -55,7 +55,6 @@ class U_I18N_API FormattedStringBuilder : public UMemory { // Convention: bottom 4 bits for field, top 4 bits for field category. // Field category 0 implies the number category so that the number field // literals can be directly passed as a Field type. - // See the helper functions in "StringBuilderFieldUtils" below. // Exported as U_I18N_API so it can be used by other exports on Windows. struct U_I18N_API Field { uint8_t bits; diff --git a/deps/icu-small/source/i18n/formattedval_impl.h b/deps/icu-small/source/i18n/formattedval_impl.h index 73ae9a3ea2ab3a..8005b0abb4d848 100644 --- a/deps/icu-small/source/i18n/formattedval_impl.h +++ b/deps/icu-small/source/i18n/formattedval_impl.h @@ -69,6 +69,9 @@ U_NAMESPACE_BEGIN /** * Implementation of FormattedValue using FieldPositionHandler to accept fields. + * + * TODO(ICU-20897): This class is unused. If it is not needed when fixing ICU-20897, + * it should be deleted. */ class FormattedValueFieldPositionIteratorImpl : public UMemory, public FormattedValue { public: @@ -114,6 +117,18 @@ class FormattedValueFieldPositionIteratorImpl : public UMemory, public Formatted }; +// Export an explicit template instantiation of the MaybeStackArray that +// is used as a data member of CEBuffer. +// +// When building DLLs for Windows this is required even though +// no direct access to the MaybeStackArray leaks out of the i18n library. +// +// See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples. +// +#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN +template class U_I18N_API MaybeStackArray; +#endif + /** * Implementation of FormattedValue based on FormattedStringBuilder. * @@ -147,12 +162,17 @@ class U_I18N_API FormattedValueStringBuilderImpl : public UMemory, public Format return fString; } + void appendSpanIndex(int32_t index); + void prependSpanIndex(int32_t index); + private: FormattedStringBuilder fString; FormattedStringBuilder::Field fNumericField; + MaybeStackArray spanIndices; bool nextPositionImpl(ConstrainedFieldPosition& cfpos, FormattedStringBuilder::Field numericField, UErrorCode& status) const; static bool isIntOrGroup(FormattedStringBuilder::Field field); + static bool isTrimmable(FormattedStringBuilder::Field field); int32_t trimBack(int32_t limit) const; int32_t trimFront(int32_t start) const; }; @@ -211,7 +231,7 @@ struct UFormattedValueImpl : public UMemory, public UFormattedValueApiHelper { return fData->appendTo(appendable, status); \ } \ UBool Name::nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const { \ - UPRV_FORMATTED_VALUE_METHOD_GUARD(FALSE) \ + UPRV_FORMATTED_VALUE_METHOD_GUARD(false) \ return fData->nextPosition(cfpos, status); \ } @@ -230,7 +250,7 @@ struct UFormattedValueImpl : public UMemory, public UFormattedValueApiHelper { } \ return static_cast(impl)->exportForC(); \ } \ - U_DRAFT const UFormattedValue* U_EXPORT2 \ + U_CAPI const UFormattedValue* U_EXPORT2 \ Prefix ## _resultAsValue (const CType* uresult, UErrorCode* ec) { \ const ImplType* result = HelperType::validate(uresult, *ec); \ if (U_FAILURE(*ec)) { return nullptr; } \ diff --git a/deps/icu-small/source/i18n/formattedval_sbimpl.cpp b/deps/icu-small/source/i18n/formattedval_sbimpl.cpp index dfe3af6686df2f..b2ae4c34c0a66d 100644 --- a/deps/icu-small/source/i18n/formattedval_sbimpl.cpp +++ b/deps/icu-small/source/i18n/formattedval_sbimpl.cpp @@ -15,6 +15,7 @@ #include "formatted_string_builder.h" #include "number_utils.h" #include "static_unicode_sets.h" +#include "unicode/listformatter.h" U_NAMESPACE_BEGIN @@ -102,14 +103,25 @@ static constexpr Field kEndField = Field(0xf, 0xf); bool FormattedValueStringBuilderImpl::nextPositionImpl(ConstrainedFieldPosition& cfpos, Field numericField, UErrorCode& /*status*/) const { int32_t fieldStart = -1; Field currField = kUndefinedField; + UFieldCategory spanCategory = UFIELD_CATEGORY_UNDEFINED; + int32_t spanValue; for (int32_t i = fString.fZero + cfpos.getLimit(); i <= fString.fZero + fString.fLength; i++) { Field _field = (i < fString.fZero + fString.fLength) ? fString.getFieldPtr()[i] : kEndField; // Case 1: currently scanning a field. if (currField != kUndefinedField) { if (currField != _field) { int32_t end = i - fString.fZero; + // Handle span fields; don't trim them + if (spanCategory != UFIELD_CATEGORY_UNDEFINED) { + cfpos.setState( + spanCategory, + spanValue, + fieldStart, + end); + return true; + } // Grouping separators can be whitespace; don't throw them out! - if (currField != Field(UFIELD_CATEGORY_NUMBER, UNUM_GROUPING_SEPARATOR_FIELD)) { + if (isTrimmable(currField)) { end = trimBack(i - fString.fZero); } if (end <= fieldStart) { @@ -120,7 +132,7 @@ bool FormattedValueStringBuilderImpl::nextPositionImpl(ConstrainedFieldPosition& continue; } int32_t start = fieldStart; - if (currField != Field(UFIELD_CATEGORY_NUMBER, UNUM_GROUPING_SEPARATOR_FIELD)) { + if (isTrimmable(currField)) { start = trimFront(start); } cfpos.setState(currField.getCategory(), currField.getField(), start, end); @@ -154,7 +166,8 @@ bool FormattedValueStringBuilderImpl::nextPositionImpl(ConstrainedFieldPosition& || cfpos.getField() != numericField.getField()) && fString.getFieldPtr()[i - 1].isNumeric() && !_field.isNumeric()) { - int j = i - 1; + // Re-wind to the beginning of the field and then emit it + int32_t j = i - 1; for (; j >= fString.fZero && fString.getFieldPtr()[j].isNumeric(); j--) {} cfpos.setState( numericField.getCategory(), @@ -163,6 +176,23 @@ bool FormattedValueStringBuilderImpl::nextPositionImpl(ConstrainedFieldPosition& i - fString.fZero); return true; } + // Special case: emit normalField if we are pointing at the end of spanField. + if (i > fString.fZero) { + auto elementField = fString.getFieldPtr()[i-1]; + if (elementField == Field(UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD) + && cfpos.matchesField(elementField.getCategory(), elementField.getField()) + && (cfpos.getLimit() < i - fString.fZero || cfpos.getCategory() != elementField.getCategory())) { + // Re-wind to the beginning of the field and then emit it + int32_t j = i - 1; + for (; j >= fString.fZero && fString.getFieldPtr()[j] == fString.getFieldPtr()[i-1]; j--) {} + cfpos.setState( + elementField.getCategory(), + elementField.getField(), + j - fString.fZero + 1, + i - fString.fZero); + return true; + } + } // Special case: skip over INTEGER; will be coalesced later. if (_field == Field(UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD)) { _field = kUndefinedField; @@ -172,6 +202,23 @@ bool FormattedValueStringBuilderImpl::nextPositionImpl(ConstrainedFieldPosition& continue; } // Case 3: check for field starting at this position + // Case 3a: Need to add a SpanField + if (_field == Field(UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD) + // don't return the same field twice in a row: + && (i == fString.fZero + || fString.getFieldPtr()[i-1].getCategory() != UFIELD_CATEGORY_LIST + || fString.getFieldPtr()[i-1].getField() != ULISTFMT_ELEMENT_FIELD)) { + int64_t si = cfpos.getInt64IterationContext(); + spanValue = spanIndices[si]; + cfpos.setInt64IterationContext(si + 1); + if (cfpos.matchesField(UFIELD_CATEGORY_LIST_SPAN, spanValue)) { + spanCategory = UFIELD_CATEGORY_LIST_SPAN; + fieldStart = i - fString.fZero; + currField = _field; + continue; + } + } + // Case 3b: No SpanField or SpanField did not match if (cfpos.matchesField(_field.getCategory(), _field.getField())) { fieldStart = i - fString.fZero; currField = _field; @@ -182,11 +229,33 @@ bool FormattedValueStringBuilderImpl::nextPositionImpl(ConstrainedFieldPosition& return false; } +void FormattedValueStringBuilderImpl::appendSpanIndex(int32_t position) { + if (spanIndices.getCapacity() <= position) { + spanIndices.resize(position * 2); + } + spanIndices[position] = position; +} + +void FormattedValueStringBuilderImpl::prependSpanIndex(int32_t position) { + if (spanIndices.getCapacity() <= position) { + spanIndices.resize(position * 2); + } + for (int32_t i = 0; i < position; i++) { + spanIndices[i+1] = spanIndices[i]; + } + spanIndices[0] = position; +} + bool FormattedValueStringBuilderImpl::isIntOrGroup(Field field) { return field == Field(UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD) || field == Field(UFIELD_CATEGORY_NUMBER, UNUM_GROUPING_SEPARATOR_FIELD); } +bool FormattedValueStringBuilderImpl::isTrimmable(Field field) { + return field != Field(UFIELD_CATEGORY_NUMBER, UNUM_GROUPING_SEPARATOR_FIELD) + && field.getCategory() != UFIELD_CATEGORY_LIST; +} + int32_t FormattedValueStringBuilderImpl::trimBack(int32_t limit) const { return unisets::get(unisets::DEFAULT_IGNORABLES)->spanBack( fString.getCharPtr() + fString.fZero, diff --git a/deps/icu-small/source/i18n/formattedvalue.cpp b/deps/icu-small/source/i18n/formattedvalue.cpp index e2c9c42fc88a36..79ecf0a841cf9b 100644 --- a/deps/icu-small/source/i18n/formattedvalue.cpp +++ b/deps/icu-small/source/i18n/formattedvalue.cpp @@ -193,7 +193,7 @@ ucfpos_close(UConstrainedFieldPosition* ptr) { } -U_DRAFT const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ufmtval_getString( const UFormattedValue* ufmtval, int32_t* pLength, @@ -213,7 +213,7 @@ ufmtval_getString( } -U_DRAFT UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ufmtval_nextPosition( const UFormattedValue* ufmtval, UConstrainedFieldPosition* ucfpos, diff --git a/deps/icu-small/source/i18n/fphdlimp.h b/deps/icu-small/source/i18n/fphdlimp.h index b9fa9b218149d4..4fb0c7b6fe686e 100644 --- a/deps/icu-small/source/i18n/fphdlimp.h +++ b/deps/icu-small/source/i18n/fphdlimp.h @@ -41,8 +41,8 @@ class U_I18N_API FieldPositionHandler: public UMemory { class FieldPositionOnlyHandler : public FieldPositionHandler { FieldPosition& pos; - UBool acceptFirstOnly = FALSE; - UBool seenFirst = FALSE; + UBool acceptFirstOnly = false; + UBool seenFirst = false; public: FieldPositionOnlyHandler(FieldPosition& pos); diff --git a/deps/icu-small/source/i18n/gregocal.cpp b/deps/icu-small/source/i18n/gregocal.cpp index 028ab05aa9accc..38a20dd93fb704 100644 --- a/deps/icu-small/source/i18n/gregocal.cpp +++ b/deps/icu-small/source/i18n/gregocal.cpp @@ -185,7 +185,7 @@ fIsGregorian(TRUE), fInvertGregorian(FALSE) // ------------------------------------- GregorianCalendar::GregorianCalendar(const Locale& aLocale, UErrorCode& status) -: Calendar(TimeZone::createDefault(), aLocale, status), +: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, status), fGregorianCutover(kPapalCutover), fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582), fIsGregorian(TRUE), fInvertGregorian(FALSE) diff --git a/deps/icu-small/source/i18n/gregoimp.h b/deps/icu-small/source/i18n/gregoimp.h index eb3844f8523eeb..edcae9dbcc65ff 100644 --- a/deps/icu-small/source/i18n/gregoimp.h +++ b/deps/icu-small/source/i18n/gregoimp.h @@ -148,9 +148,9 @@ class ClockMath { class Grego { public: /** - * Return TRUE if the given year is a leap year. + * Return true if the given year is a leap year. * @param year Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc. - * @return TRUE if the year is a leap year + * @return true if the year is a leap year */ static inline UBool isLeapYear(int32_t year); diff --git a/deps/icu-small/source/i18n/hebrwcal.cpp b/deps/icu-small/source/i18n/hebrwcal.cpp index 085ded784651a6..98cbb4a1050d01 100644 --- a/deps/icu-small/source/i18n/hebrwcal.cpp +++ b/deps/icu-small/source/i18n/hebrwcal.cpp @@ -155,7 +155,7 @@ U_NAMESPACE_BEGIN * @internal */ HebrewCalendar::HebrewCalendar(const Locale& aLocale, UErrorCode& success) -: Calendar(TimeZone::createDefault(), aLocale, success) +: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success) { setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly. @@ -393,7 +393,8 @@ int32_t HebrewCalendar::startOfYear(int32_t year, UErrorCode &status) int32_t day = CalendarCache::get(&gCache, year, status); if (day == 0) { - int32_t months = (235 * year - 234) / 19; // # of months before year + // # of months before year + int32_t months = (int32_t)ClockMath::floorDivide((235 * (int64_t)year - 234), (int64_t)19); int64_t frac = (int64_t)months * MONTH_FRACT + BAHARAD; // Fractional part of day # day = months * 29 + (int32_t)(frac / DAY_PARTS); // Whole # part of calculation @@ -566,8 +567,8 @@ void HebrewCalendar::validateField(UCalendarDateFields field, UErrorCode &status */ void HebrewCalendar::handleComputeFields(int32_t julianDay, UErrorCode &status) { int32_t d = julianDay - 347997; - double m = ((d * (double)DAY_PARTS)/ (double) MONTH_PARTS); // Months (approx) - int32_t year = (int32_t)( ((19. * m + 234.) / 235.) + 1.); // Years (approx) + double m = ClockMath::floorDivide((d * (double)DAY_PARTS), (double) MONTH_PARTS); // Months (approx) + int32_t year = (int32_t)(ClockMath::floorDivide((19. * m + 234.), 235.) + 1.); // Years (approx) int32_t ys = startOfYear(year, status); // 1st day of year int32_t dayOfYear = (d - ys); diff --git a/deps/icu-small/source/i18n/hebrwcal.h b/deps/icu-small/source/i18n/hebrwcal.h index 97e8511705e776..34450ffa61855d 100644 --- a/deps/icu-small/source/i18n/hebrwcal.h +++ b/deps/icu-small/source/i18n/hebrwcal.h @@ -386,7 +386,7 @@ class U_I18N_API HebrewCalendar : public Calendar { virtual UBool inDaylightTime(UErrorCode& status) const; /** - * Returns TRUE because the Hebrew Calendar does have a default century + * Returns true because the Hebrew Calendar does have a default century * @internal */ virtual UBool haveDefaultCentury() const; diff --git a/deps/icu-small/source/i18n/indiancal.cpp b/deps/icu-small/source/i18n/indiancal.cpp index f1266bb7757939..42a91c55e2f526 100644 --- a/deps/icu-small/source/i18n/indiancal.cpp +++ b/deps/icu-small/source/i18n/indiancal.cpp @@ -40,7 +40,7 @@ IndianCalendar* IndianCalendar::clone() const { } IndianCalendar::IndianCalendar(const Locale& aLocale, UErrorCode& success) - : Calendar(TimeZone::createDefault(), aLocale, success) + : Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success) { setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly. } @@ -83,7 +83,6 @@ static const int32_t LIMITS[UCAL_FIELD_COUNT][4] = { {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // IS_LEAP_MONTH }; -static const double JULIAN_EPOCH = 1721425.5; static const int32_t INDIAN_ERA_START = 78; static const int32_t INDIAN_YEAR_START = 80; @@ -96,7 +95,7 @@ int32_t IndianCalendar::handleGetLimit(UCalendarDateFields field, ELimitType lim */ static UBool isGregorianLeap(int32_t year) { - return ((year % 4) == 0) && (!(((year % 100) == 0) && ((year % 400) != 0))); + return Grego::isLeapYear(year); } //---------------------------------------------------------------------- @@ -137,56 +136,22 @@ int32_t IndianCalendar::handleGetYearLength(int32_t eyear) const { * Returns the Julian Day corresponding to gregorian date * * @param year The Gregorian year - * @param month The month in Gregorian Year + * @param month The month in Gregorian Year, 0 based. * @param date The date in Gregorian day in month */ static double gregorianToJD(int32_t year, int32_t month, int32_t date) { - double julianDay = (JULIAN_EPOCH - 1) + - (365 * (year - 1)) + - uprv_floor((year - 1) / 4) + - (-uprv_floor((year - 1) / 100)) + - uprv_floor((year - 1) / 400) + - uprv_floor((((367 * month) - 362) / 12) + - ((month <= 2) ? 0 : - (isGregorianLeap(year) ? -1 : -2) - ) + - date); - - return julianDay; + return Grego::fieldsToDay(year, month, date) + kEpochStartAsJulianDay - 0.5; } /* * Returns the Gregorian Date corresponding to a given Julian Day + * Month is 0 based. * @param jd The Julian Day */ static int32_t* jdToGregorian(double jd, int32_t gregorianDate[3]) { - double wjd, depoch, quadricent, dqc, cent, dcent, quad, dquad, yindex, yearday, leapadj; - int32_t year, month, day; - wjd = uprv_floor(jd - 0.5) + 0.5; - depoch = wjd - JULIAN_EPOCH; - quadricent = uprv_floor(depoch / 146097); - dqc = (int32_t)uprv_floor(depoch) % 146097; - cent = uprv_floor(dqc / 36524); - dcent = (int32_t)uprv_floor(dqc) % 36524; - quad = uprv_floor(dcent / 1461); - dquad = (int32_t)uprv_floor(dcent) % 1461; - yindex = uprv_floor(dquad / 365); - year = (int32_t)((quadricent * 400) + (cent * 100) + (quad * 4) + yindex); - if (!((cent == 4) || (yindex == 4))) { - year++; - } - yearday = wjd - gregorianToJD(year, 1, 1); - leapadj = ((wjd < gregorianToJD(year, 3, 1)) ? 0 - : - (isGregorianLeap(year) ? 1 : 2) - ); - month = (int32_t)uprv_floor((((yearday + leapadj) * 12) + 373) / 367); - day = (int32_t)(wjd - gregorianToJD(year, month, 1)) + 1; - - gregorianDate[0] = year; - gregorianDate[1] = month; - gregorianDate[2] = day; - + int32_t gdow; + Grego::dayToFields(jd - kEpochStartAsJulianDay, + gregorianDate[0], gregorianDate[1], gregorianDate[2], gdow); return gregorianDate; } @@ -203,11 +168,11 @@ static double IndianToJD(int32_t year, int32_t month, int32_t date) { if(isGregorianLeap(gyear)) { leapMonth = 31; - start = gregorianToJD(gyear, 3, 21); + start = gregorianToJD(gyear, 2 /* The third month in 0 based month */, 21); } else { leapMonth = 30; - start = gregorianToJD(gyear, 3, 22); + start = gregorianToJD(gyear, 2 /* The third month in 0 based month */, 22); } if (month == 1) { @@ -297,7 +262,7 @@ void IndianCalendar::handleComputeFields(int32_t julianDay, UErrorCode& /* stat gregorianYear = jdToGregorian(julianDay, gd)[0]; // Gregorian date for Julian day IndianYear = gregorianYear - INDIAN_ERA_START; // Year in Saka era - jdAtStartOfGregYear = gregorianToJD(gregorianYear, 1, 1); // JD at start of Gregorian year + jdAtStartOfGregYear = gregorianToJD(gregorianYear, 0, 1); // JD at start of Gregorian year yday = (int32_t)(julianDay - jdAtStartOfGregYear); // Day number in Gregorian year (starting from 0) if (yday < INDIAN_YEAR_START) { diff --git a/deps/icu-small/source/i18n/indiancal.h b/deps/icu-small/source/i18n/indiancal.h index 142597ce0e6b02..624cec73b53efc 100644 --- a/deps/icu-small/source/i18n/indiancal.h +++ b/deps/icu-small/source/i18n/indiancal.h @@ -147,7 +147,7 @@ class U_I18N_API IndianCalendar : public Calendar { * @param aLocale The given locale. * @param success Indicates the status of IndianCalendar object construction. * Returns U_ZERO_ERROR if constructed successfully. - * @param beCivil Whether the calendar should be civil (default-TRUE) or religious (FALSE) + * @param beCivil Whether the calendar should be civil (default-true) or religious (false) * @internal */ IndianCalendar(const Locale& aLocale, UErrorCode &success); @@ -303,7 +303,7 @@ class U_I18N_API IndianCalendar : public Calendar { /** - * Returns TRUE because the Indian Calendar does have a default century + * Returns true because the Indian Calendar does have a default century * @internal */ virtual UBool haveDefaultCentury() const; diff --git a/deps/icu-small/source/i18n/islamcal.cpp b/deps/icu-small/source/i18n/islamcal.cpp index 4e4a6648048208..6e21e51150ab88 100644 --- a/deps/icu-small/source/i18n/islamcal.cpp +++ b/deps/icu-small/source/i18n/islamcal.cpp @@ -232,7 +232,7 @@ IslamicCalendar* IslamicCalendar::clone() const { } IslamicCalendar::IslamicCalendar(const Locale& aLocale, UErrorCode& success, ECalculationType type) -: Calendar(TimeZone::createDefault(), aLocale, success), +: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success), cType(type) { setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly. @@ -368,7 +368,7 @@ int32_t IslamicCalendar::yearStart(int32_t year) const{ if (cType == CIVIL || cType == TBLA || (cType == UMALQURA && (year < UMALQURA_YEAR_START || year > UMALQURA_YEAR_END))) { - return (year-1)*354 + ClockMath::floorDivide((3+11*year),30); + return (year-1)*354 + ClockMath::floorDivide((3+11*(int64_t)year),(int64_t)30); } else if(cType==ASTRONOMICAL){ return trueMonthStart(12*(year-1)); } else { @@ -391,7 +391,7 @@ int32_t IslamicCalendar::monthStart(int32_t year, int32_t month) const { if (cType == CIVIL || cType == TBLA) { // This does not handle months out of the range 0..11 return (int32_t)uprv_ceil(29.5*month) - + (year-1)*354 + (int32_t)ClockMath::floorDivide((3+11*year),30); + + (year-1)*354 + (int32_t)ClockMath::floorDivide((3+11*(int64_t)year),(int64_t)30); } else if(cType==ASTRONOMICAL){ return trueMonthStart(12*(year-1) + month); } else { @@ -447,7 +447,8 @@ int32_t IslamicCalendar::trueMonthStart(int32_t month) const } } while (age < 0); } - start = (int32_t)ClockMath::floorDivide((origin - HIJRA_MILLIS), (double)kOneDay) + 1; + start = (int32_t)(ClockMath::floorDivide( + (int64_t)((int64_t)origin - HIJRA_MILLIS), (int64_t)kOneDay) + 1); CalendarCache::put(&gMonthCache, month, start, status); } trueMonthStartEnd : @@ -639,13 +640,14 @@ void IslamicCalendar::handleComputeFields(int32_t julianDay, UErrorCode &status) months--; } - year = months / 12 + 1; - month = months % 12; + year = months >= 0 ? ((months / 12) + 1) : ((months + 1 ) / 12); + month = ((months % 12) + 12 ) % 12; } else if(cType == UMALQURA) { int32_t umalquraStartdays = yearStart(UMALQURA_YEAR_START) ; if( days < umalquraStartdays){ //Use Civil calculation - year = (int)ClockMath::floorDivide( (double)(30 * days + 10646) , 10631.0 ); + year = (int32_t)ClockMath::floorDivide( + (30 * (int64_t)days + 10646) , (int64_t)10631.0 ); month = (int32_t)uprv_ceil((days - 29 - yearStart(year)) / 29.5 ); month = month<11?month:11; startDate = monthStart(year, month); diff --git a/deps/icu-small/source/i18n/islamcal.h b/deps/icu-small/source/i18n/islamcal.h index aad8f07be0f984..b4ead411da9e04 100644 --- a/deps/icu-small/source/i18n/islamcal.h +++ b/deps/icu-small/source/i18n/islamcal.h @@ -395,7 +395,7 @@ class U_I18N_API IslamicCalendar : public Calendar { /** - * Returns TRUE because the Islamic Calendar does have a default century + * Returns true because the Islamic Calendar does have a default century * @internal */ virtual UBool haveDefaultCentury() const; diff --git a/deps/icu-small/source/i18n/japancal.h b/deps/icu-small/source/i18n/japancal.h index ee86c4ed0e3b93..d313fcd99ab508 100644 --- a/deps/icu-small/source/i18n/japancal.h +++ b/deps/icu-small/source/i18n/japancal.h @@ -167,7 +167,7 @@ class JapaneseCalendar : public GregorianCalendar { virtual const char * getType() const; /** - * @return FALSE - no default century in Japanese + * @return false - no default century in Japanese * @internal */ virtual UBool haveDefaultCentury() const; diff --git a/deps/icu-small/source/i18n/listformatter.cpp b/deps/icu-small/source/i18n/listformatter.cpp index 4b27587555219c..ab04ac9080a5ab 100644 --- a/deps/icu-small/source/i18n/listformatter.cpp +++ b/deps/icu-small/source/i18n/listformatter.cpp @@ -52,10 +52,12 @@ class PatternHandler : public UObject { virtual PatternHandler* clone() const { return new PatternHandler(twoPattern, endPattern); } + /** Argument: final string in the list. */ virtual const SimpleFormatter& getTwoPattern(const UnicodeString&) const { return twoPattern; } + /** Argument: final string in the list. */ virtual const SimpleFormatter& getEndPattern(const UnicodeString&) const { return endPattern; } @@ -237,9 +239,9 @@ ListFormatInternal(const ListFormatInternal &other) : #if !UCONFIG_NO_FORMATTING -class FormattedListData : public FormattedValueFieldPositionIteratorImpl { +class FormattedListData : public FormattedValueStringBuilderImpl { public: - FormattedListData(UErrorCode& status) : FormattedValueFieldPositionIteratorImpl(5, status) {} + FormattedListData(UErrorCode&) : FormattedValueStringBuilderImpl(kUndefinedField) {} virtual ~FormattedListData(); }; @@ -557,50 +559,89 @@ ListFormatter::~ListFormatter() { delete owned; } -/** - * Joins first and second using the pattern pat. - * On entry offset is an offset into first or -1 if offset unspecified. - * On exit offset is offset of second in result if recordOffset was set - * Otherwise if it was >=0 it is set to point into result where it used - * to point into first. On exit, result is the join of first and second - * according to pat. Any previous value of result gets replaced. - */ -static void joinStringsAndReplace( - const SimpleFormatter& pat, - const UnicodeString& first, - const UnicodeString& second, - UnicodeString &result, - UBool recordOffset, - int32_t &offset, - int32_t *offsetFirst, - int32_t *offsetSecond, - UErrorCode& errorCode) { - if (U_FAILURE(errorCode)) { - return; - } - const UnicodeString *params[2] = {&first, &second}; - int32_t offsets[2]; - pat.formatAndReplace( - params, - UPRV_LENGTHOF(params), - result, - offsets, - UPRV_LENGTHOF(offsets), - errorCode); - if (U_FAILURE(errorCode)) { - return; +namespace { + +class FormattedListBuilder { +public: + LocalPointer data; + + /** For lists of length 1+ */ + FormattedListBuilder(const UnicodeString& start, UErrorCode& status) + : data(new FormattedListData(status), status) { + if (U_SUCCESS(status)) { + data->getStringRef().append( + start, + {UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD}, + status); + data->appendSpanIndex(0); + } } - if (offsets[0] == -1 || offsets[1] == -1) { - errorCode = U_INVALID_FORMAT_ERROR; - return; + + /** For lists of length 0 */ + FormattedListBuilder(UErrorCode& status) + : data(new FormattedListData(status), status) { } - if (recordOffset) { - offset = offsets[1]; - } else if (offset >= 0) { - offset += offsets[0]; + + void append(const SimpleFormatter& pattern, const UnicodeString& next, int32_t position, UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } + if (pattern.getArgumentLimit() != 2) { + status = U_INTERNAL_PROGRAM_ERROR; + return; + } + // In the pattern, {0} are the pre-existing elements and {1} is the new element. + int32_t offsets[] = {0, 0}; + UnicodeString temp = pattern.getTextWithNoArguments(offsets, 2); + if (offsets[0] <= offsets[1]) { + // prefix{0}infix{1}suffix + // Prepend prefix, then append infix, element, and suffix + data->getStringRef().insert( + 0, + temp.tempSubStringBetween(0, offsets[0]), + {UFIELD_CATEGORY_LIST, ULISTFMT_LITERAL_FIELD}, + status); + data->getStringRef().append( + temp.tempSubStringBetween(offsets[0], offsets[1]), + {UFIELD_CATEGORY_LIST, ULISTFMT_LITERAL_FIELD}, + status); + data->getStringRef().append( + next, + {UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD}, + status); + data->appendSpanIndex(position); + data->getStringRef().append( + temp.tempSubString(offsets[1]), + {UFIELD_CATEGORY_LIST, ULISTFMT_LITERAL_FIELD}, + status); + } else { + // prefix{1}infix{0}suffix + // Prepend infix, element, and prefix, then append suffix. + // (We prepend in reverse order because prepending at index 0 is fast.) + data->getStringRef().insert( + 0, + temp.tempSubStringBetween(offsets[1], offsets[0]), + {UFIELD_CATEGORY_LIST, ULISTFMT_LITERAL_FIELD}, + status); + data->getStringRef().insert( + 0, + next, + {UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD}, + status); + data->prependSpanIndex(position); + data->getStringRef().insert( + 0, + temp.tempSubStringBetween(0, offsets[1]), + {UFIELD_CATEGORY_LIST, ULISTFMT_LITERAL_FIELD}, + status); + data->getStringRef().append( + temp.tempSubString(offsets[0]), + {UFIELD_CATEGORY_LIST, ULISTFMT_LITERAL_FIELD}, + status); + } } - if (offsetFirst != nullptr) *offsetFirst = offsets[0]; - if (offsetSecond != nullptr) *offsetSecond = offsets[1]; +}; + } UnicodeString& ListFormatter::format( @@ -619,7 +660,19 @@ UnicodeString& ListFormatter::format( int32_t index, int32_t &offset, UErrorCode& errorCode) const { - return format_(items, nItems, appendTo, index, offset, nullptr, errorCode); +#if !UCONFIG_NO_FORMATTING + int32_t initialOffset = appendTo.length(); + auto result = formatStringsToValue(items, nItems, errorCode); + UnicodeStringAppendable appendable(appendTo); + result.appendTo(appendable, errorCode); + if (index >= 0) { + ConstrainedFieldPosition cfpos; + cfpos.constrainField(UFIELD_CATEGORY_LIST_SPAN, index); + result.nextPosition(cfpos, errorCode); + offset = initialOffset + cfpos.getStart(); + } +#endif + return appendTo; } #if !UCONFIG_NO_FORMATTING @@ -627,182 +680,68 @@ FormattedList ListFormatter::formatStringsToValue( const UnicodeString items[], int32_t nItems, UErrorCode& errorCode) const { - LocalPointer result(new FormattedListData(errorCode), errorCode); - if (U_FAILURE(errorCode)) { - return FormattedList(errorCode); + if (nItems == 0) { + FormattedListBuilder result(errorCode); + if (U_FAILURE(errorCode)) { + return FormattedList(errorCode); + } else { + return FormattedList(result.data.orphan()); + } + } else if (nItems == 1) { + FormattedListBuilder result(items[0], errorCode); + result.data->getStringRef().writeTerminator(errorCode); + if (U_FAILURE(errorCode)) { + return FormattedList(errorCode); + } else { + return FormattedList(result.data.orphan()); + } + } else if (nItems == 2) { + FormattedListBuilder result(items[0], errorCode); + if (U_FAILURE(errorCode)) { + return FormattedList(errorCode); + } + result.append( + data->patternHandler->getTwoPattern(items[1]), + items[1], + 1, + errorCode); + result.data->getStringRef().writeTerminator(errorCode); + if (U_FAILURE(errorCode)) { + return FormattedList(errorCode); + } else { + return FormattedList(result.data.orphan()); + } } - UnicodeString string; - int32_t offset; - auto handler = result->getHandler(errorCode); - handler.setCategory(UFIELD_CATEGORY_LIST); - format_(items, nItems, string, -1, offset, &handler, errorCode); - handler.getError(errorCode); - result->appendString(string, errorCode); + + FormattedListBuilder result(items[0], errorCode); if (U_FAILURE(errorCode)) { return FormattedList(errorCode); } - - // Add span fields and sort - ConstrainedFieldPosition cfpos; - cfpos.constrainField(UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD); - int32_t i = 0; - handler.setCategory(UFIELD_CATEGORY_LIST_SPAN); - while (result->nextPosition(cfpos, errorCode)) { - handler.addAttribute(i++, cfpos.getStart(), cfpos.getLimit()); + result.append( + data->startPattern, + items[1], + 1, + errorCode); + for (int32_t i = 2; i < nItems - 1; i++) { + result.append( + data->middlePattern, + items[i], + i, + errorCode); } - handler.getError(errorCode); + result.append( + data->patternHandler->getEndPattern(items[nItems-1]), + items[nItems-1], + nItems-1, + errorCode); + result.data->getStringRef().writeTerminator(errorCode); if (U_FAILURE(errorCode)) { return FormattedList(errorCode); + } else { + return FormattedList(result.data.orphan()); } - result->sort(); - - return FormattedList(result.orphan()); } #endif -UnicodeString& ListFormatter::format_( - const UnicodeString items[], - int32_t nItems, - UnicodeString& appendTo, - int32_t index, - int32_t &offset, - FieldPositionHandler* handler, - UErrorCode& errorCode) const { -#if !UCONFIG_NO_FORMATTING - offset = -1; - if (U_FAILURE(errorCode)) { - return appendTo; - } - if (data == nullptr) { - errorCode = U_INVALID_STATE_ERROR; - return appendTo; - } - - if (nItems <= 0) { - return appendTo; - } - if (nItems == 1) { - if (index == 0) { - offset = appendTo.length(); - } - if (handler != nullptr) { - handler->addAttribute(ULISTFMT_ELEMENT_FIELD, - appendTo.length(), - appendTo.length() + items[0].length()); - } - appendTo.append(items[0]); - return appendTo; - } - UnicodeString result(items[0]); - if (index == 0) { - offset = 0; - } - int32_t offsetFirst = 0; - int32_t offsetSecond = 0; - int32_t prefixLength = 0; - // for n items, there are 2 * (n + 1) boundary including 0 and the upper - // edge. - MaybeStackArray offsets((handler != nullptr) ? 2 * (nItems + 1): 0); - if (nItems == 2) { - joinStringsAndReplace( - data->patternHandler->getTwoPattern(items[1]), - result, - items[1], - result, - index == 1, - offset, - &offsetFirst, - &offsetSecond, - errorCode); - } else { - joinStringsAndReplace( - data->startPattern, - result, - items[1], - result, - index == 1, - offset, - &offsetFirst, - &offsetSecond, - errorCode); - } - if (handler != nullptr) { - offsets[0] = 0; - prefixLength += offsetFirst; - offsets[1] = offsetSecond - prefixLength; - } - if (nItems > 2) { - for (int32_t i = 2; i < nItems - 1; ++i) { - joinStringsAndReplace( - data->middlePattern, - result, - items[i], - result, - index == i, - offset, - &offsetFirst, - &offsetSecond, - errorCode); - if (handler != nullptr) { - prefixLength += offsetFirst; - offsets[i] = offsetSecond - prefixLength; - } - } - joinStringsAndReplace( - data->patternHandler->getEndPattern(items[nItems - 1]), - result, - items[nItems - 1], - result, - index == nItems - 1, - offset, - &offsetFirst, - &offsetSecond, - errorCode); - if (handler != nullptr) { - prefixLength += offsetFirst; - offsets[nItems - 1] = offsetSecond - prefixLength; - } - } - if (handler != nullptr) { - // If there are already some data in appendTo, we need to adjust the index - // by shifting that lenght while insert into handler. - int32_t shift = appendTo.length() + prefixLength; - // Output the ULISTFMT_ELEMENT_FIELD in the order of the input elements - for (int32_t i = 0; i < nItems; ++i) { - offsets[i + nItems] = offsets[i] + items[i].length() + shift; - offsets[i] += shift; - handler->addAttribute( - ULISTFMT_ELEMENT_FIELD, // id - offsets[i], // index - offsets[i + nItems]); // limit - } - // The locale pattern may reorder the items (such as in ur-IN locale), - // so we cannot assume the array is in accendning order. - // To handle the edging case, just insert the two ends into the array - // and sort. Then we output ULISTFMT_LITERAL_FIELD if the indecies - // between the even and odd position are not the same in the sorted array. - offsets[2 * nItems] = shift - prefixLength; - offsets[2 * nItems + 1] = result.length() + shift - prefixLength; - uprv_sortArray(offsets.getAlias(), 2 * (nItems + 1), sizeof(int32_t), - uprv_int32Comparator, nullptr, - false, &errorCode); - for (int32_t i = 0; i <= nItems; ++i) { - if (offsets[i * 2] != offsets[i * 2 + 1]) { - handler->addAttribute( - ULISTFMT_LITERAL_FIELD, // id - offsets[i * 2], // index - offsets[i * 2 + 1]); // limit - } - } - } - if (U_SUCCESS(errorCode)) { - if (offset >= 0) { - offset += appendTo.length(); - } - appendTo += result; - } -#endif - return appendTo; -} U_NAMESPACE_END diff --git a/deps/icu-small/source/i18n/measfmt.cpp b/deps/icu-small/source/i18n/measfmt.cpp index a98a6dda4705b5..3e7f7bae157cf7 100644 --- a/deps/icu-small/source/i18n/measfmt.cpp +++ b/deps/icu-small/source/i18n/measfmt.cpp @@ -861,7 +861,7 @@ UnicodeString &MeasureFormat::formatMeasuresSlowTrack( return appendTo; } // Fix up FieldPosition indexes if our field is found. - if (offset != -1) { + if (fieldPositionFoundIndex != -1 && offset != -1) { pos.setBeginIndex(fpos.getBeginIndex() + offset); pos.setEndIndex(fpos.getEndIndex() + offset); } diff --git a/deps/icu-small/source/i18n/measunit.cpp b/deps/icu-small/source/i18n/measunit.cpp index 2486ca9b15a05e..dab3abb5e21ff6 100644 --- a/deps/icu-small/source/i18n/measunit.cpp +++ b/deps/icu-small/source/i18n/measunit.cpp @@ -33,9 +33,9 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(MeasureUnit) // update this code, refer to: // http://site.icu-project.org/design/formatting/measureformat/updating-measure-unit // -// Start generated code - +// Start generated code for measunit.cpp +// Maps from Type ID to offset in gSubTypes. static const int32_t gOffsets[] = { 0, 2, @@ -50,45 +50,20 @@ static const int32_t gOffsets[] = { 368, 370, 374, - 381, - 402, + 382, 404, - 418, - 421, - 427, - 437, - 441, - 445, - 447, - 474 + 408, + 423, + 424, + 430, + 440, + 444, + 448, + 450, + 484 }; -static const int32_t gIndexes[] = { - 0, - 2, - 7, - 17, - 25, - 29, - 29, - 40, - 56, - 60, - 69, - 71, - 75, - 82, - 103, - 105, - 119, - 122, - 128, - 138, - 142, - 146, - 148, - 175 -}; +static const int32_t kCurrencyOffset = 5; // Must be sorted alphabetically. static const char * const gTypes[] = { @@ -493,6 +468,7 @@ static const char * const gSubTypes[] = { "hertz", "kilohertz", "megahertz", + "dot", "dot-per-centimeter", "dot-per-inch", "em", @@ -503,6 +479,7 @@ static const char * const gSubTypes[] = { "astronomical-unit", "centimeter", "decimeter", + "earth-radius", "fathom", "foot", "furlong", @@ -521,11 +498,14 @@ static const char * const gSubTypes[] = { "point", "solar-radius", "yard", + "candela", + "lumen", "lux", "solar-luminosity", "carat", "dalton", "earth-mass", + "grain", "gram", "kilogram", "metric-ton", @@ -537,9 +517,7 @@ static const char * const gSubTypes[] = { "solar-mass", "stone", "ton", - "", // TODO(ICU-21076): manual edit of what should have been generated by Java. - "percent", // TODO(ICU-21076): regenerate, deal with duplication. - "permille", // TODO(ICU-21076): regenerate, deal with duplication. + "", "gigawatt", "horsepower", "kilowatt", @@ -580,35 +558,28 @@ static const char * const gSubTypes[] = { "cup", "cup-metric", "deciliter", + "dessert-spoon", + "dessert-spoon-imperial", + "dram", + "drop", "fluid-ounce", "fluid-ounce-imperial", "gallon", "gallon-imperial", "hectoliter", + "jigger", "liter", "megaliter", "milliliter", + "pinch", "pint", "pint-metric", "quart", + "quart-imperial", "tablespoon", "teaspoon" }; -// Must be sorted by first value and then second value. -static int32_t unitPerUnitToSingleUnit[][4] = { - {378, 382, 12, 5}, - {378, 387, 12, 6}, - {388, 343, 19, 0}, - {390, 350, 19, 2}, - {392, 343, 19, 3}, - {392, 463, 4, 2}, - {392, 464, 4, 3}, - {411, 460, 3, 1}, - {414, 12, 18, 9}, - {466, 388, 4, 1} -}; - // Shortcuts to the base unit in order to make the default constructor fast static const int32_t kBaseTypeIdx = 16; static const int32_t kBaseSubTypeIdx = 0; @@ -781,14 +752,6 @@ MeasureUnit MeasureUnit::getMole() { return MeasureUnit(3, 3); } -MeasureUnit *MeasureUnit::createPartPerMillion(UErrorCode &status) { - return MeasureUnit::create(3, 6, status); -} - -MeasureUnit MeasureUnit::getPartPerMillion() { - return MeasureUnit(3, 6); -} - MeasureUnit *MeasureUnit::createPercent(UErrorCode &status) { return MeasureUnit::create(3, 4, status); } @@ -805,6 +768,14 @@ MeasureUnit MeasureUnit::getPermille() { return MeasureUnit(3, 5); } +MeasureUnit *MeasureUnit::createPartPerMillion(UErrorCode &status) { + return MeasureUnit::create(3, 6, status); +} + +MeasureUnit MeasureUnit::getPartPerMillion() { + return MeasureUnit(3, 6); +} + MeasureUnit *MeasureUnit::createPermyriad(UErrorCode &status) { return MeasureUnit::create(3, 7, status); } @@ -1213,62 +1184,70 @@ MeasureUnit MeasureUnit::getMegahertz() { return MeasureUnit(11, 3); } -MeasureUnit *MeasureUnit::createDotPerCentimeter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createDot(UErrorCode &status) { return MeasureUnit::create(12, 0, status); } -MeasureUnit MeasureUnit::getDotPerCentimeter() { +MeasureUnit MeasureUnit::getDot() { return MeasureUnit(12, 0); } -MeasureUnit *MeasureUnit::createDotPerInch(UErrorCode &status) { +MeasureUnit *MeasureUnit::createDotPerCentimeter(UErrorCode &status) { return MeasureUnit::create(12, 1, status); } -MeasureUnit MeasureUnit::getDotPerInch() { +MeasureUnit MeasureUnit::getDotPerCentimeter() { return MeasureUnit(12, 1); } -MeasureUnit *MeasureUnit::createEm(UErrorCode &status) { +MeasureUnit *MeasureUnit::createDotPerInch(UErrorCode &status) { return MeasureUnit::create(12, 2, status); } -MeasureUnit MeasureUnit::getEm() { +MeasureUnit MeasureUnit::getDotPerInch() { return MeasureUnit(12, 2); } -MeasureUnit *MeasureUnit::createMegapixel(UErrorCode &status) { +MeasureUnit *MeasureUnit::createEm(UErrorCode &status) { return MeasureUnit::create(12, 3, status); } -MeasureUnit MeasureUnit::getMegapixel() { +MeasureUnit MeasureUnit::getEm() { return MeasureUnit(12, 3); } -MeasureUnit *MeasureUnit::createPixel(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMegapixel(UErrorCode &status) { return MeasureUnit::create(12, 4, status); } -MeasureUnit MeasureUnit::getPixel() { +MeasureUnit MeasureUnit::getMegapixel() { return MeasureUnit(12, 4); } -MeasureUnit *MeasureUnit::createPixelPerCentimeter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createPixel(UErrorCode &status) { return MeasureUnit::create(12, 5, status); } -MeasureUnit MeasureUnit::getPixelPerCentimeter() { +MeasureUnit MeasureUnit::getPixel() { return MeasureUnit(12, 5); } -MeasureUnit *MeasureUnit::createPixelPerInch(UErrorCode &status) { +MeasureUnit *MeasureUnit::createPixelPerCentimeter(UErrorCode &status) { return MeasureUnit::create(12, 6, status); } -MeasureUnit MeasureUnit::getPixelPerInch() { +MeasureUnit MeasureUnit::getPixelPerCentimeter() { return MeasureUnit(12, 6); } +MeasureUnit *MeasureUnit::createPixelPerInch(UErrorCode &status) { + return MeasureUnit::create(12, 7, status); +} + +MeasureUnit MeasureUnit::getPixelPerInch() { + return MeasureUnit(12, 7); +} + MeasureUnit *MeasureUnit::createAstronomicalUnit(UErrorCode &status) { return MeasureUnit::create(13, 0, status); } @@ -1293,166 +1272,190 @@ MeasureUnit MeasureUnit::getDecimeter() { return MeasureUnit(13, 2); } -MeasureUnit *MeasureUnit::createFathom(UErrorCode &status) { +MeasureUnit *MeasureUnit::createEarthRadius(UErrorCode &status) { return MeasureUnit::create(13, 3, status); } -MeasureUnit MeasureUnit::getFathom() { +MeasureUnit MeasureUnit::getEarthRadius() { return MeasureUnit(13, 3); } -MeasureUnit *MeasureUnit::createFoot(UErrorCode &status) { +MeasureUnit *MeasureUnit::createFathom(UErrorCode &status) { return MeasureUnit::create(13, 4, status); } -MeasureUnit MeasureUnit::getFoot() { +MeasureUnit MeasureUnit::getFathom() { return MeasureUnit(13, 4); } -MeasureUnit *MeasureUnit::createFurlong(UErrorCode &status) { +MeasureUnit *MeasureUnit::createFoot(UErrorCode &status) { return MeasureUnit::create(13, 5, status); } -MeasureUnit MeasureUnit::getFurlong() { +MeasureUnit MeasureUnit::getFoot() { return MeasureUnit(13, 5); } -MeasureUnit *MeasureUnit::createInch(UErrorCode &status) { +MeasureUnit *MeasureUnit::createFurlong(UErrorCode &status) { return MeasureUnit::create(13, 6, status); } -MeasureUnit MeasureUnit::getInch() { +MeasureUnit MeasureUnit::getFurlong() { return MeasureUnit(13, 6); } -MeasureUnit *MeasureUnit::createKilometer(UErrorCode &status) { +MeasureUnit *MeasureUnit::createInch(UErrorCode &status) { return MeasureUnit::create(13, 7, status); } -MeasureUnit MeasureUnit::getKilometer() { +MeasureUnit MeasureUnit::getInch() { return MeasureUnit(13, 7); } -MeasureUnit *MeasureUnit::createLightYear(UErrorCode &status) { +MeasureUnit *MeasureUnit::createKilometer(UErrorCode &status) { return MeasureUnit::create(13, 8, status); } -MeasureUnit MeasureUnit::getLightYear() { +MeasureUnit MeasureUnit::getKilometer() { return MeasureUnit(13, 8); } -MeasureUnit *MeasureUnit::createMeter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createLightYear(UErrorCode &status) { return MeasureUnit::create(13, 9, status); } -MeasureUnit MeasureUnit::getMeter() { +MeasureUnit MeasureUnit::getLightYear() { return MeasureUnit(13, 9); } -MeasureUnit *MeasureUnit::createMicrometer(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMeter(UErrorCode &status) { return MeasureUnit::create(13, 10, status); } -MeasureUnit MeasureUnit::getMicrometer() { +MeasureUnit MeasureUnit::getMeter() { return MeasureUnit(13, 10); } -MeasureUnit *MeasureUnit::createMile(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMicrometer(UErrorCode &status) { return MeasureUnit::create(13, 11, status); } -MeasureUnit MeasureUnit::getMile() { +MeasureUnit MeasureUnit::getMicrometer() { return MeasureUnit(13, 11); } -MeasureUnit *MeasureUnit::createMileScandinavian(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMile(UErrorCode &status) { return MeasureUnit::create(13, 12, status); } -MeasureUnit MeasureUnit::getMileScandinavian() { +MeasureUnit MeasureUnit::getMile() { return MeasureUnit(13, 12); } -MeasureUnit *MeasureUnit::createMillimeter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMileScandinavian(UErrorCode &status) { return MeasureUnit::create(13, 13, status); } -MeasureUnit MeasureUnit::getMillimeter() { +MeasureUnit MeasureUnit::getMileScandinavian() { return MeasureUnit(13, 13); } -MeasureUnit *MeasureUnit::createNanometer(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMillimeter(UErrorCode &status) { return MeasureUnit::create(13, 14, status); } -MeasureUnit MeasureUnit::getNanometer() { +MeasureUnit MeasureUnit::getMillimeter() { return MeasureUnit(13, 14); } -MeasureUnit *MeasureUnit::createNauticalMile(UErrorCode &status) { +MeasureUnit *MeasureUnit::createNanometer(UErrorCode &status) { return MeasureUnit::create(13, 15, status); } -MeasureUnit MeasureUnit::getNauticalMile() { +MeasureUnit MeasureUnit::getNanometer() { return MeasureUnit(13, 15); } -MeasureUnit *MeasureUnit::createParsec(UErrorCode &status) { +MeasureUnit *MeasureUnit::createNauticalMile(UErrorCode &status) { return MeasureUnit::create(13, 16, status); } -MeasureUnit MeasureUnit::getParsec() { +MeasureUnit MeasureUnit::getNauticalMile() { return MeasureUnit(13, 16); } -MeasureUnit *MeasureUnit::createPicometer(UErrorCode &status) { +MeasureUnit *MeasureUnit::createParsec(UErrorCode &status) { return MeasureUnit::create(13, 17, status); } -MeasureUnit MeasureUnit::getPicometer() { +MeasureUnit MeasureUnit::getParsec() { return MeasureUnit(13, 17); } -MeasureUnit *MeasureUnit::createPoint(UErrorCode &status) { +MeasureUnit *MeasureUnit::createPicometer(UErrorCode &status) { return MeasureUnit::create(13, 18, status); } -MeasureUnit MeasureUnit::getPoint() { +MeasureUnit MeasureUnit::getPicometer() { return MeasureUnit(13, 18); } -MeasureUnit *MeasureUnit::createSolarRadius(UErrorCode &status) { +MeasureUnit *MeasureUnit::createPoint(UErrorCode &status) { return MeasureUnit::create(13, 19, status); } -MeasureUnit MeasureUnit::getSolarRadius() { +MeasureUnit MeasureUnit::getPoint() { return MeasureUnit(13, 19); } -MeasureUnit *MeasureUnit::createYard(UErrorCode &status) { +MeasureUnit *MeasureUnit::createSolarRadius(UErrorCode &status) { return MeasureUnit::create(13, 20, status); } -MeasureUnit MeasureUnit::getYard() { +MeasureUnit MeasureUnit::getSolarRadius() { return MeasureUnit(13, 20); } -MeasureUnit *MeasureUnit::createLux(UErrorCode &status) { +MeasureUnit *MeasureUnit::createYard(UErrorCode &status) { + return MeasureUnit::create(13, 21, status); +} + +MeasureUnit MeasureUnit::getYard() { + return MeasureUnit(13, 21); +} + +MeasureUnit *MeasureUnit::createCandela(UErrorCode &status) { return MeasureUnit::create(14, 0, status); } -MeasureUnit MeasureUnit::getLux() { +MeasureUnit MeasureUnit::getCandela() { return MeasureUnit(14, 0); } -MeasureUnit *MeasureUnit::createSolarLuminosity(UErrorCode &status) { +MeasureUnit *MeasureUnit::createLumen(UErrorCode &status) { return MeasureUnit::create(14, 1, status); } -MeasureUnit MeasureUnit::getSolarLuminosity() { +MeasureUnit MeasureUnit::getLumen() { return MeasureUnit(14, 1); } +MeasureUnit *MeasureUnit::createLux(UErrorCode &status) { + return MeasureUnit::create(14, 2, status); +} + +MeasureUnit MeasureUnit::getLux() { + return MeasureUnit(14, 2); +} + +MeasureUnit *MeasureUnit::createSolarLuminosity(UErrorCode &status) { + return MeasureUnit::create(14, 3, status); +} + +MeasureUnit MeasureUnit::getSolarLuminosity() { + return MeasureUnit(14, 3); +} + MeasureUnit *MeasureUnit::createCarat(UErrorCode &status) { return MeasureUnit::create(15, 0, status); } @@ -1477,94 +1480,102 @@ MeasureUnit MeasureUnit::getEarthMass() { return MeasureUnit(15, 2); } -MeasureUnit *MeasureUnit::createGram(UErrorCode &status) { +MeasureUnit *MeasureUnit::createGrain(UErrorCode &status) { return MeasureUnit::create(15, 3, status); } -MeasureUnit MeasureUnit::getGram() { +MeasureUnit MeasureUnit::getGrain() { return MeasureUnit(15, 3); } -MeasureUnit *MeasureUnit::createKilogram(UErrorCode &status) { +MeasureUnit *MeasureUnit::createGram(UErrorCode &status) { return MeasureUnit::create(15, 4, status); } -MeasureUnit MeasureUnit::getKilogram() { +MeasureUnit MeasureUnit::getGram() { return MeasureUnit(15, 4); } -MeasureUnit *MeasureUnit::createMetricTon(UErrorCode &status) { +MeasureUnit *MeasureUnit::createKilogram(UErrorCode &status) { return MeasureUnit::create(15, 5, status); } -MeasureUnit MeasureUnit::getMetricTon() { +MeasureUnit MeasureUnit::getKilogram() { return MeasureUnit(15, 5); } -MeasureUnit *MeasureUnit::createMicrogram(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMetricTon(UErrorCode &status) { return MeasureUnit::create(15, 6, status); } -MeasureUnit MeasureUnit::getMicrogram() { +MeasureUnit MeasureUnit::getMetricTon() { return MeasureUnit(15, 6); } -MeasureUnit *MeasureUnit::createMilligram(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMicrogram(UErrorCode &status) { return MeasureUnit::create(15, 7, status); } -MeasureUnit MeasureUnit::getMilligram() { +MeasureUnit MeasureUnit::getMicrogram() { return MeasureUnit(15, 7); } -MeasureUnit *MeasureUnit::createOunce(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMilligram(UErrorCode &status) { return MeasureUnit::create(15, 8, status); } -MeasureUnit MeasureUnit::getOunce() { +MeasureUnit MeasureUnit::getMilligram() { return MeasureUnit(15, 8); } -MeasureUnit *MeasureUnit::createOunceTroy(UErrorCode &status) { +MeasureUnit *MeasureUnit::createOunce(UErrorCode &status) { return MeasureUnit::create(15, 9, status); } -MeasureUnit MeasureUnit::getOunceTroy() { +MeasureUnit MeasureUnit::getOunce() { return MeasureUnit(15, 9); } -MeasureUnit *MeasureUnit::createPound(UErrorCode &status) { +MeasureUnit *MeasureUnit::createOunceTroy(UErrorCode &status) { return MeasureUnit::create(15, 10, status); } -MeasureUnit MeasureUnit::getPound() { +MeasureUnit MeasureUnit::getOunceTroy() { return MeasureUnit(15, 10); } -MeasureUnit *MeasureUnit::createSolarMass(UErrorCode &status) { +MeasureUnit *MeasureUnit::createPound(UErrorCode &status) { return MeasureUnit::create(15, 11, status); } -MeasureUnit MeasureUnit::getSolarMass() { +MeasureUnit MeasureUnit::getPound() { return MeasureUnit(15, 11); } -MeasureUnit *MeasureUnit::createStone(UErrorCode &status) { +MeasureUnit *MeasureUnit::createSolarMass(UErrorCode &status) { return MeasureUnit::create(15, 12, status); } -MeasureUnit MeasureUnit::getStone() { +MeasureUnit MeasureUnit::getSolarMass() { return MeasureUnit(15, 12); } -MeasureUnit *MeasureUnit::createTon(UErrorCode &status) { +MeasureUnit *MeasureUnit::createStone(UErrorCode &status) { return MeasureUnit::create(15, 13, status); } -MeasureUnit MeasureUnit::getTon() { +MeasureUnit MeasureUnit::getStone() { return MeasureUnit(15, 13); } +MeasureUnit *MeasureUnit::createTon(UErrorCode &status) { + return MeasureUnit::create(15, 14, status); +} + +MeasureUnit MeasureUnit::getTon() { + return MeasureUnit(15, 14); +} + MeasureUnit *MeasureUnit::createGigawatt(UErrorCode &status) { return MeasureUnit::create(17, 0, status); } @@ -1885,111 +1896,167 @@ MeasureUnit MeasureUnit::getDeciliter() { return MeasureUnit(22, 13); } -MeasureUnit *MeasureUnit::createFluidOunce(UErrorCode &status) { +MeasureUnit *MeasureUnit::createDessertSpoon(UErrorCode &status) { return MeasureUnit::create(22, 14, status); } -MeasureUnit MeasureUnit::getFluidOunce() { +MeasureUnit MeasureUnit::getDessertSpoon() { return MeasureUnit(22, 14); } -MeasureUnit *MeasureUnit::createFluidOunceImperial(UErrorCode &status) { +MeasureUnit *MeasureUnit::createDessertSpoonImperial(UErrorCode &status) { return MeasureUnit::create(22, 15, status); } -MeasureUnit MeasureUnit::getFluidOunceImperial() { +MeasureUnit MeasureUnit::getDessertSpoonImperial() { return MeasureUnit(22, 15); } -MeasureUnit *MeasureUnit::createGallon(UErrorCode &status) { +MeasureUnit *MeasureUnit::createDram(UErrorCode &status) { return MeasureUnit::create(22, 16, status); } -MeasureUnit MeasureUnit::getGallon() { +MeasureUnit MeasureUnit::getDram() { return MeasureUnit(22, 16); } -MeasureUnit *MeasureUnit::createGallonImperial(UErrorCode &status) { +MeasureUnit *MeasureUnit::createDrop(UErrorCode &status) { return MeasureUnit::create(22, 17, status); } -MeasureUnit MeasureUnit::getGallonImperial() { +MeasureUnit MeasureUnit::getDrop() { return MeasureUnit(22, 17); } -MeasureUnit *MeasureUnit::createHectoliter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createFluidOunce(UErrorCode &status) { return MeasureUnit::create(22, 18, status); } -MeasureUnit MeasureUnit::getHectoliter() { +MeasureUnit MeasureUnit::getFluidOunce() { return MeasureUnit(22, 18); } -MeasureUnit *MeasureUnit::createLiter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createFluidOunceImperial(UErrorCode &status) { return MeasureUnit::create(22, 19, status); } -MeasureUnit MeasureUnit::getLiter() { +MeasureUnit MeasureUnit::getFluidOunceImperial() { return MeasureUnit(22, 19); } -MeasureUnit *MeasureUnit::createMegaliter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createGallon(UErrorCode &status) { return MeasureUnit::create(22, 20, status); } -MeasureUnit MeasureUnit::getMegaliter() { +MeasureUnit MeasureUnit::getGallon() { return MeasureUnit(22, 20); } -MeasureUnit *MeasureUnit::createMilliliter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createGallonImperial(UErrorCode &status) { return MeasureUnit::create(22, 21, status); } -MeasureUnit MeasureUnit::getMilliliter() { +MeasureUnit MeasureUnit::getGallonImperial() { return MeasureUnit(22, 21); } -MeasureUnit *MeasureUnit::createPint(UErrorCode &status) { +MeasureUnit *MeasureUnit::createHectoliter(UErrorCode &status) { return MeasureUnit::create(22, 22, status); } -MeasureUnit MeasureUnit::getPint() { +MeasureUnit MeasureUnit::getHectoliter() { return MeasureUnit(22, 22); } -MeasureUnit *MeasureUnit::createPintMetric(UErrorCode &status) { +MeasureUnit *MeasureUnit::createJigger(UErrorCode &status) { return MeasureUnit::create(22, 23, status); } -MeasureUnit MeasureUnit::getPintMetric() { +MeasureUnit MeasureUnit::getJigger() { return MeasureUnit(22, 23); } -MeasureUnit *MeasureUnit::createQuart(UErrorCode &status) { +MeasureUnit *MeasureUnit::createLiter(UErrorCode &status) { return MeasureUnit::create(22, 24, status); } -MeasureUnit MeasureUnit::getQuart() { +MeasureUnit MeasureUnit::getLiter() { return MeasureUnit(22, 24); } -MeasureUnit *MeasureUnit::createTablespoon(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMegaliter(UErrorCode &status) { return MeasureUnit::create(22, 25, status); } -MeasureUnit MeasureUnit::getTablespoon() { +MeasureUnit MeasureUnit::getMegaliter() { return MeasureUnit(22, 25); } -MeasureUnit *MeasureUnit::createTeaspoon(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMilliliter(UErrorCode &status) { return MeasureUnit::create(22, 26, status); } -MeasureUnit MeasureUnit::getTeaspoon() { +MeasureUnit MeasureUnit::getMilliliter() { return MeasureUnit(22, 26); } -// End generated code +MeasureUnit *MeasureUnit::createPinch(UErrorCode &status) { + return MeasureUnit::create(22, 27, status); +} + +MeasureUnit MeasureUnit::getPinch() { + return MeasureUnit(22, 27); +} + +MeasureUnit *MeasureUnit::createPint(UErrorCode &status) { + return MeasureUnit::create(22, 28, status); +} + +MeasureUnit MeasureUnit::getPint() { + return MeasureUnit(22, 28); +} + +MeasureUnit *MeasureUnit::createPintMetric(UErrorCode &status) { + return MeasureUnit::create(22, 29, status); +} + +MeasureUnit MeasureUnit::getPintMetric() { + return MeasureUnit(22, 29); +} + +MeasureUnit *MeasureUnit::createQuart(UErrorCode &status) { + return MeasureUnit::create(22, 30, status); +} + +MeasureUnit MeasureUnit::getQuart() { + return MeasureUnit(22, 30); +} + +MeasureUnit *MeasureUnit::createQuartImperial(UErrorCode &status) { + return MeasureUnit::create(22, 31, status); +} + +MeasureUnit MeasureUnit::getQuartImperial() { + return MeasureUnit(22, 31); +} + +MeasureUnit *MeasureUnit::createTablespoon(UErrorCode &status) { + return MeasureUnit::create(22, 32, status); +} + +MeasureUnit MeasureUnit::getTablespoon() { + return MeasureUnit(22, 32); +} + +MeasureUnit *MeasureUnit::createTeaspoon(UErrorCode &status) { + return MeasureUnit::create(22, 33, status); +} + +MeasureUnit MeasureUnit::getTeaspoon() { + return MeasureUnit(22, 33); +} + +// End generated code for measunit.cpp static int32_t binarySearch( const char * const * array, int32_t start, int32_t end, StringPiece key) { @@ -2107,10 +2174,6 @@ UBool MeasureUnit::operator==(const UObject& other) const { return uprv_strcmp(getIdentifier(), rhs.getIdentifier()) == 0; } -int32_t MeasureUnit::getIndex() const { - return gIndexes[fTypeId] + fSubTypeId; -} - int32_t MeasureUnit::getAvailable( MeasureUnit *dest, int32_t destCapacity, @@ -2173,26 +2236,14 @@ StringEnumeration* MeasureUnit::getAvailableTypes(UErrorCode &errorCode) { return result; } -int32_t MeasureUnit::getIndexCount() { - return gIndexes[UPRV_LENGTHOF(gIndexes) - 1]; -} - -int32_t MeasureUnit::internalGetIndexForTypeAndSubtype(const char *type, const char *subtype) { - int32_t t = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), type); - if (t < 0) { - return t; - } - int32_t st = binarySearch(gSubTypes, gOffsets[t], gOffsets[t + 1], subtype); - if (st < 0) { - return st; - } - return gIndexes[t] + st - gOffsets[t]; -} - bool MeasureUnit::findBySubType(StringPiece subType, MeasureUnit* output) { + // Sanity checking kCurrencyOffset and final entry in gOffsets + U_ASSERT(uprv_strcmp(gTypes[kCurrencyOffset], "currency") == 0); + U_ASSERT(gOffsets[UPRV_LENGTHOF(gOffsets) - 1] == UPRV_LENGTHOF(gSubTypes)); + for (int32_t t = 0; t < UPRV_LENGTHOF(gOffsets) - 1; t++) { // Skip currency units - if (gIndexes[t] == gIndexes[t + 1]) { + if (t == kCurrencyOffset) { continue; } int32_t st = binarySearch(gSubTypes, gOffsets[t], gOffsets[t + 1], subType); @@ -2204,41 +2255,6 @@ bool MeasureUnit::findBySubType(StringPiece subType, MeasureUnit* output) { return false; } -MeasureUnit MeasureUnit::resolveUnitPerUnit( - const MeasureUnit &unit, const MeasureUnit &perUnit, bool* isResolved) { - int32_t unitOffset = unit.getOffset(); - int32_t perUnitOffset = perUnit.getOffset(); - if (unitOffset == -1 || perUnitOffset == -1) { - *isResolved = false; - return MeasureUnit(); - } - - // binary search for (unitOffset, perUnitOffset) - int32_t start = 0; - int32_t end = UPRV_LENGTHOF(unitPerUnitToSingleUnit); - while (start < end) { - int32_t mid = (start + end) / 2; - int32_t *midRow = unitPerUnitToSingleUnit[mid]; - if (unitOffset < midRow[0]) { - end = mid; - } else if (unitOffset > midRow[0]) { - start = mid + 1; - } else if (perUnitOffset < midRow[1]) { - end = mid; - } else if (perUnitOffset > midRow[1]) { - start = mid + 1; - } else { - // We found a resolution for our unit / per-unit combo - // return it. - *isResolved = true; - return MeasureUnit(midRow[2], midRow[3]); - } - } - - *isResolved = false; - return MeasureUnit(); -} - MeasureUnit *MeasureUnit::create(int typeId, int subTypeId, UErrorCode &status) { if (U_FAILURE(status)) { return NULL; @@ -2279,15 +2295,6 @@ void MeasureUnit::initCurrency(StringPiece isoCurrency) { fSubTypeId = result - gOffsets[fTypeId]; } -void MeasureUnit::initNoUnit(const char *subtype) { - int32_t result = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), "none"); - U_ASSERT(result != -1); - fTypeId = result; - result = binarySearch(gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], subtype); - U_ASSERT(result != -1); - fSubTypeId = result - gOffsets[fTypeId]; -} - void MeasureUnit::setTo(int32_t typeId, int32_t subTypeId) { fTypeId = typeId; fSubTypeId = subTypeId; @@ -2302,6 +2309,20 @@ int32_t MeasureUnit::getOffset() const { return gOffsets[fTypeId] + fSubTypeId; } +MeasureUnitImpl MeasureUnitImpl::copy(UErrorCode &status) const { + MeasureUnitImpl result; + result.complexity = complexity; + result.identifier.append(identifier, status); + for (int32_t i = 0; i < units.length(); i++) { + SingleUnitImpl *item = result.units.emplaceBack(*units[i]); + if (!item) { + status = U_MEMORY_ALLOCATION_ERROR; + return result; + } + } + return result; +} + U_NAMESPACE_END #endif /* !UNCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/i18n/measunit_extra.cpp b/deps/icu-small/source/i18n/measunit_extra.cpp index aeb60017a18fce..2eb3f066142967 100644 --- a/deps/icu-small/source/i18n/measunit_extra.cpp +++ b/deps/icu-small/source/i18n/measunit_extra.cpp @@ -12,20 +12,25 @@ // Helpful in toString methods and elsewhere. #define UNISTR_FROM_STRING_EXPLICIT -#include +#include "charstr.h" +#include "cmemory.h" #include "cstring.h" #include "measunit_impl.h" +#include "resource.h" #include "uarrsort.h" #include "uassert.h" #include "ucln_in.h" #include "umutex.h" -#include "unicode/errorcode.h" +#include "unicode/bytestrie.h" +#include "unicode/bytestriebuilder.h" #include "unicode/localpointer.h" #include "unicode/measunit.h" -#include "unicode/ucharstrie.h" -#include "unicode/ucharstriebuilder.h" - -#include "cstr.h" +#include "unicode/stringpiece.h" +#include "unicode/stringtriebuilder.h" +#include "unicode/ures.h" +#include "unicode/ustringtrie.h" +#include "uresimp.h" +#include U_NAMESPACE_BEGIN @@ -60,7 +65,7 @@ enum InitialCompoundPart { INITIAL_COMPOUND_PART_PER = kInitialCompoundPartOffset, }; -// Trie value offset for powers like "square-", "cubic-", "p2-" etc. +// Trie value offset for powers like "square-", "cubic-", "pow2-" etc. constexpr int32_t kPowerPartOffset = 256; enum PowerPart { @@ -110,119 +115,101 @@ const struct SIPrefixStrings { { "yocto", UMEASURE_SI_PREFIX_YOCTO }, }; -// TODO(ICU-21059): Get this list from data -const char16_t* const gSimpleUnits[] = { - u"candela", - u"carat", - u"gram", - u"ounce", - u"ounce-troy", - u"pound", - u"kilogram", - u"stone", - u"ton", - u"metric-ton", - u"earth-mass", - u"solar-mass", - u"point", - u"inch", - u"foot", - u"yard", - u"meter", - u"fathom", - u"furlong", - u"mile", - u"nautical-mile", - u"mile-scandinavian", - u"100-kilometer", - u"earth-radius", - u"solar-radius", - u"astronomical-unit", - u"light-year", - u"parsec", - u"second", - u"minute", - u"hour", - u"day", - u"day-person", - u"week", - u"week-person", - u"month", - u"month-person", - u"year", - u"year-person", - u"decade", - u"century", - u"ampere", - u"fahrenheit", - u"kelvin", - u"celsius", - u"arc-second", - u"arc-minute", - u"degree", - u"radian", - u"revolution", - u"item", - u"mole", - u"permillion", - u"permyriad", - u"permille", - u"percent", - u"karat", - u"portion", - u"bit", - u"byte", - u"dot", - u"pixel", - u"em", - u"hertz", - u"newton", - u"pound-force", - u"pascal", - u"bar", - u"atmosphere", - u"ofhg", - u"electronvolt", - u"dalton", - u"joule", - u"calorie", - u"british-thermal-unit", - u"foodcalorie", - u"therm-us", - u"watt", - u"horsepower", - u"solar-luminosity", - u"volt", - u"ohm", - u"dunam", - u"acre", - u"hectare", - u"teaspoon", - u"tablespoon", - u"fluid-ounce-imperial", - u"fluid-ounce", - u"cup", - u"cup-metric", - u"pint", - u"pint-metric", - u"quart", - u"liter", - u"gallon", - u"gallon-imperial", - u"bushel", - u"barrel", - u"knot", - u"g-force", - u"lux", +/** + * A ResourceSink that collects simple unit identifiers from the keys of the + * convertUnits table into an array, and adds these values to a TrieBuilder, + * with associated values being their index into this array plus a specified + * offset, to a trie. + * + * Example code: + * + * UErrorCode status = U_ZERO_ERROR; + * BytesTrieBuilder b(status); + * const char *unitIdentifiers[200]; + * SimpleUnitIdentifiersSink identifierSink(unitIdentifiers, 200, b, kTrieValueOffset); + * LocalUResourceBundlePointer unitsBundle(ures_openDirect(NULL, "units", &status)); + * ures_getAllItemsWithFallback(unitsBundle.getAlias(), "convertUnits", identifierSink, status); + */ +class SimpleUnitIdentifiersSink : public icu::ResourceSink { + public: + /** + * Constructor. + * @param out Array of char* to which the simple unit identifiers will be + * saved. + * @param outSize The size of `out`. + * @param trieBuilder The trie builder to which the simple unit identifier + * should be added. The trie builder must outlive this resource sink. + * @param trieValueOffset This is added to the index of the identifier in + * the `out` array, before adding to `trieBuilder` as the value + * associated with the identifier. + */ + explicit SimpleUnitIdentifiersSink(const char **out, int32_t outSize, BytesTrieBuilder &trieBuilder, + int32_t trieValueOffset) + : outArray(out), outSize(outSize), trieBuilder(trieBuilder), trieValueOffset(trieValueOffset), + outIndex(0) { + } + + /** + * Adds the table keys found in value to the output vector. + * @param key The key of the resource passed to `value`: the second + * parameter of the ures_getAllItemsWithFallback() call. + * @param value Should be a ResourceTable value, if + * ures_getAllItemsWithFallback() was called correctly for this sink. + * @param noFallback Ignored. + * @param status The standard ICU error code output parameter. + */ + void put(const char * /*key*/, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) { + ResourceTable table = value.getTable(status); + if (U_FAILURE(status)) return; + + if (outIndex + table.getSize() > outSize) { + status = U_INDEX_OUTOFBOUNDS_ERROR; + return; + } + + // Collect keys from the table resource. + const char *key; + for (int32_t i = 0; table.getKeyAndValue(i, key, value); ++i) { + U_ASSERT(i < table.getSize()); + U_ASSERT(outIndex < outSize); + if (uprv_strcmp(key, "kilogram") == 0) { + // For parsing, we use "gram", the prefixless metric mass unit. We + // thus ignore the SI Base Unit of Mass: it exists due to being the + // mass conversion target unit, but not needed for MeasureUnit + // parsing. + continue; + } + outArray[outIndex] = key; + trieBuilder.add(key, trieValueOffset + outIndex, status); + outIndex++; + } + } + + private: + const char **outArray; + int32_t outSize; + BytesTrieBuilder &trieBuilder; + int32_t trieValueOffset; + + int32_t outIndex; }; icu::UInitOnce gUnitExtrasInitOnce = U_INITONCE_INITIALIZER; -char16_t* kSerializedUnitExtrasStemTrie = nullptr; +// Array of simple unit IDs. +// +// The array memory itself is owned by this pointer, but the individual char* in +// that array point at static memory. (Note that these char* are also returned +// by SingleUnitImpl::getSimpleUnitID().) +const char **gSimpleUnits = nullptr; + +char *gSerializedUnitExtrasStemTrie = nullptr; UBool U_CALLCONV cleanupUnitExtras() { - uprv_free(kSerializedUnitExtrasStemTrie); - kSerializedUnitExtrasStemTrie = nullptr; + uprv_free(gSerializedUnitExtrasStemTrie); + gSerializedUnitExtrasStemTrie = nullptr; + uprv_free(gSimpleUnits); + gSimpleUnits = nullptr; gUnitExtrasInitOnce.reset(); return TRUE; } @@ -230,55 +217,75 @@ UBool U_CALLCONV cleanupUnitExtras() { void U_CALLCONV initUnitExtras(UErrorCode& status) { ucln_i18n_registerCleanup(UCLN_I18N_UNIT_EXTRAS, cleanupUnitExtras); - UCharsTrieBuilder b(status); + BytesTrieBuilder b(status); if (U_FAILURE(status)) { return; } // Add SI prefixes for (const auto& siPrefixInfo : gSIPrefixStrings) { - UnicodeString uSIPrefix(siPrefixInfo.string, -1, US_INV); - b.add(uSIPrefix, siPrefixInfo.value + kSIPrefixOffset, status); + b.add(siPrefixInfo.string, siPrefixInfo.value + kSIPrefixOffset, status); } if (U_FAILURE(status)) { return; } // Add syntax parts (compound, power prefixes) - b.add(u"-per-", COMPOUND_PART_PER, status); - b.add(u"-", COMPOUND_PART_TIMES, status); - b.add(u"-and-", COMPOUND_PART_AND, status); - b.add(u"per-", INITIAL_COMPOUND_PART_PER, status); - b.add(u"square-", POWER_PART_P2, status); - b.add(u"cubic-", POWER_PART_P3, status); - b.add(u"p2-", POWER_PART_P2, status); - b.add(u"p3-", POWER_PART_P3, status); - b.add(u"p4-", POWER_PART_P4, status); - b.add(u"p5-", POWER_PART_P5, status); - b.add(u"p6-", POWER_PART_P6, status); - b.add(u"p7-", POWER_PART_P7, status); - b.add(u"p8-", POWER_PART_P8, status); - b.add(u"p9-", POWER_PART_P9, status); - b.add(u"p10-", POWER_PART_P10, status); - b.add(u"p11-", POWER_PART_P11, status); - b.add(u"p12-", POWER_PART_P12, status); - b.add(u"p13-", POWER_PART_P13, status); - b.add(u"p14-", POWER_PART_P14, status); - b.add(u"p15-", POWER_PART_P15, status); + b.add("-per-", COMPOUND_PART_PER, status); + b.add("-", COMPOUND_PART_TIMES, status); + b.add("-and-", COMPOUND_PART_AND, status); + b.add("per-", INITIAL_COMPOUND_PART_PER, status); + b.add("square-", POWER_PART_P2, status); + b.add("cubic-", POWER_PART_P3, status); + b.add("pow2-", POWER_PART_P2, status); + b.add("pow3-", POWER_PART_P3, status); + b.add("pow4-", POWER_PART_P4, status); + b.add("pow5-", POWER_PART_P5, status); + b.add("pow6-", POWER_PART_P6, status); + b.add("pow7-", POWER_PART_P7, status); + b.add("pow8-", POWER_PART_P8, status); + b.add("pow9-", POWER_PART_P9, status); + b.add("pow10-", POWER_PART_P10, status); + b.add("pow11-", POWER_PART_P11, status); + b.add("pow12-", POWER_PART_P12, status); + b.add("pow13-", POWER_PART_P13, status); + b.add("pow14-", POWER_PART_P14, status); + b.add("pow15-", POWER_PART_P15, status); + if (U_FAILURE(status)) { return; } + + // Add sanctioned simple units by offset: simple units all have entries in + // units/convertUnits resources. + // TODO(ICU-21059): confirm whether this is clean enough, or whether we need to + // filter units' validity list instead. + LocalUResourceBundlePointer unitsBundle(ures_openDirect(NULL, "units", &status)); + LocalUResourceBundlePointer convertUnits( + ures_getByKey(unitsBundle.getAlias(), "convertUnits", NULL, &status)); if (U_FAILURE(status)) { return; } - // Add sanctioned simple units by offset - int32_t simpleUnitOffset = kSimpleUnitOffset; - for (auto simpleUnit : gSimpleUnits) { - b.add(simpleUnit, simpleUnitOffset++, status); + // Allocate enough space: with identifierSink below skipping kilogram, we're + // probably allocating one more than needed. + int32_t simpleUnitsCount = convertUnits.getAlias()->fSize; + int32_t arrayMallocSize = sizeof(char *) * simpleUnitsCount; + gSimpleUnits = static_cast(uprv_malloc(arrayMallocSize)); + if (gSimpleUnits == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; } + uprv_memset(gSimpleUnits, 0, arrayMallocSize); + + // Populate gSimpleUnits and build the associated trie. + SimpleUnitIdentifiersSink identifierSink(gSimpleUnits, simpleUnitsCount, b, kSimpleUnitOffset); + ures_getAllItemsWithFallback(unitsBundle.getAlias(), "convertUnits", identifierSink, status); // Build the CharsTrie // TODO: Use SLOW or FAST here? - UnicodeString result; - b.buildUnicodeString(USTRINGTRIE_BUILD_FAST, result, status); + StringPiece result = b.buildStringPiece(USTRINGTRIE_BUILD_FAST, status); if (U_FAILURE(status)) { return; } // Copy the result into the global constant pointer - size_t numBytes = result.length() * sizeof(char16_t); - kSerializedUnitExtrasStemTrie = static_cast(uprv_malloc(numBytes)); - uprv_memcpy(kSerializedUnitExtrasStemTrie, result.getBuffer(), numBytes); + size_t numBytes = result.length(); + gSerializedUnitExtrasStemTrie = static_cast(uprv_malloc(numBytes)); + if (gSerializedUnitExtrasStemTrie == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + uprv_memcpy(gSerializedUnitExtrasStemTrie, result.data(), numBytes); } class Token { @@ -385,7 +392,7 @@ class Parser { // should live longer than this Parser - and the parser shouldn't return any // references to that string. StringPiece fSource; - UCharsTrie fTrie; + BytesTrie fTrie; // Set to true when we've seen a "-per-" or a "per-", after which all units // are in the denominator. Until we find an "-and-", at which point the @@ -395,7 +402,7 @@ class Parser { Parser() : fSource(""), fTrie(u"") {} Parser(StringPiece source) - : fSource(source), fTrie(kSerializedUnitExtrasStemTrie) {} + : fSource(source), fTrie(gSerializedUnitExtrasStemTrie) {} inline bool hasNext() const { return fIndex < fSource.length(); @@ -640,11 +647,11 @@ void serializeSingle(const SingleUnitImpl& singleUnit, bool first, CharString& o } else if (posPower == 3) { output.append("cubic-", status); } else if (posPower < 10) { - output.append('p', status); + output.append("pow", status); output.append(posPower + '0', status); output.append('-', status); } else if (posPower <= 15) { - output.append("p1", status); + output.append("pow1", status); output.append('0' + (posPower % 10), status); output.append('-', status); } else { @@ -666,7 +673,7 @@ void serializeSingle(const SingleUnitImpl& singleUnit, bool first, CharString& o return; } - output.appendInvariantChars(gSimpleUnits[singleUnit.index], status); + output.append(singleUnit.getSimpleUnitID(), status); } /** @@ -777,6 +784,17 @@ MeasureUnit SingleUnitImpl::build(UErrorCode& status) const { return std::move(temp).build(status); } +const char *SingleUnitImpl::getSimpleUnitID() const { + return gSimpleUnits[index]; +} + +MeasureUnitImpl::MeasureUnitImpl(const MeasureUnitImpl &other, UErrorCode &status) { + *this = other.copy(status); +} + +MeasureUnitImpl::MeasureUnitImpl(const SingleUnitImpl &singleUnit, UErrorCode &status) { + this->append(singleUnit, status); +} MeasureUnitImpl MeasureUnitImpl::forIdentifier(StringPiece identifier, UErrorCode& status) { return Parser::from(identifier, status).parse(status); @@ -813,12 +831,26 @@ bool MeasureUnitImpl::append(const SingleUnitImpl& singleUnit, UErrorCode& statu return appendImpl(*this, singleUnit, status); } +MaybeStackVector MeasureUnitImpl::extractIndividualUnits(UErrorCode &status) const { + MaybeStackVector result; + + if (this->complexity != UMeasureUnitComplexity::UMEASURE_UNIT_MIXED) { + result.emplaceBackAndCheckErrorCode(status, *this, status); + return result; + } + + for (int32_t i = 0; i < units.length(); i++) { + result.emplaceBackAndCheckErrorCode(status, *units[i], status); + } + + return result; +} + MeasureUnit MeasureUnitImpl::build(UErrorCode& status) && { serialize(*this, status); return MeasureUnit(std::move(*this)); } - MeasureUnit MeasureUnit::forIdentifier(StringPiece identifier, UErrorCode& status) { return Parser::from(identifier, status).parse(status).build(status); } @@ -876,11 +908,15 @@ MeasureUnit MeasureUnit::product(const MeasureUnit& other, UErrorCode& status) c return std::move(impl).build(status); } -LocalArray MeasureUnit::splitToSingleUnits(int32_t& outCount, UErrorCode& status) const { +LocalArray MeasureUnit::splitToSingleUnitsImpl(int32_t& outCount, UErrorCode& status) const { MeasureUnitImpl temp; const MeasureUnitImpl& impl = MeasureUnitImpl::forMeasureUnit(*this, temp, status); outCount = impl.units.length(); MeasureUnit* arr = new MeasureUnit[outCount]; + if (arr == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return LocalArray(); + } for (int32_t i = 0; i < outCount; i++) { arr[i] = impl.units[i]->build(status); } diff --git a/deps/icu-small/source/i18n/measunit_impl.h b/deps/icu-small/source/i18n/measunit_impl.h index c886d3c29a38b2..1024cd65547ff1 100644 --- a/deps/icu-small/source/i18n/measunit_impl.h +++ b/deps/icu-small/source/i18n/measunit_impl.h @@ -22,7 +22,7 @@ static const char kDefaultCurrency8[] = "XXX"; /** * A struct representing a single unit (optional SI prefix and dimensionality). */ -struct SingleUnitImpl : public UMemory { +struct U_I18N_API SingleUnitImpl : public UMemory { /** * Gets a single unit from the MeasureUnit. If there are multiple single units, sets an error * code and returns the base dimensionless unit. Parses if necessary. @@ -32,6 +32,16 @@ struct SingleUnitImpl : public UMemory { /** Transform this SingleUnitImpl into a MeasureUnit, simplifying if possible. */ MeasureUnit build(UErrorCode& status) const; + /** + * Returns the "simple unit ID", without SI or dimensionality prefix: this + * instance may represent a square-kilometer, but only "meter" will be + * returned. + * + * The returned pointer points at memory that exists for the duration of the + * program's running. + */ + const char *getSimpleUnitID() const; + /** * Compare this SingleUnitImpl to another SingleUnitImpl for the sake of * sorting and coalescing. @@ -110,12 +120,27 @@ struct SingleUnitImpl : public UMemory { int32_t dimensionality = 1; }; +// Export explicit template instantiations of MaybeStackArray, MemoryPool and +// MaybeStackVector. This is required when building DLLs for Windows. (See +// datefmt.h, collationiterator.h, erarules.h and others for similar examples.) +#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN +template class U_I18N_API MaybeStackArray; +template class U_I18N_API MemoryPool; +template class U_I18N_API MaybeStackVector; +#endif /** * Internal representation of measurement units. Capable of representing all complexities of units, * including mixed and compound units. */ -struct MeasureUnitImpl : public UMemory { +struct U_I18N_API MeasureUnitImpl : public UMemory { + MeasureUnitImpl() = default; + MeasureUnitImpl(MeasureUnitImpl &&other) = default; + MeasureUnitImpl(const MeasureUnitImpl &other, UErrorCode &status); + MeasureUnitImpl(const SingleUnitImpl &singleUnit, UErrorCode &status); + + MeasureUnitImpl &operator=(MeasureUnitImpl &&other) noexcept = default; + /** Extract the MeasureUnitImpl from a MeasureUnit. */ static inline const MeasureUnitImpl* get(const MeasureUnit& measureUnit) { return measureUnit.fImpl; @@ -169,13 +194,17 @@ struct MeasureUnitImpl : public UMemory { /** * Create a copy of this MeasureUnitImpl. Don't use copy constructor to make this explicit. */ - inline MeasureUnitImpl copy(UErrorCode& status) const { - MeasureUnitImpl result; - result.complexity = complexity; - result.units.appendAll(units, status); - result.identifier.append(identifier, status); - return result; - } + MeasureUnitImpl copy(UErrorCode& status) const; + + /** + * Extracts the list of all the individual units inside the `MeasureUnitImpl`. + * For example: + * - if the `MeasureUnitImpl` is `foot-per-hour` + * it will return a list of 1 {`foot-per-hour`} + * - if the `MeasureUnitImpl` is `foot-and-inch` + * it will return a list of 2 { `foot`, `inch`} + */ + MaybeStackVector extractIndividualUnits(UErrorCode &status) const; /** Mutates this MeasureUnitImpl to take the reciprocal. */ void takeReciprocal(UErrorCode& status); @@ -206,7 +235,6 @@ struct MeasureUnitImpl : public UMemory { CharString identifier; }; - U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/i18n/measure.cpp b/deps/icu-small/source/i18n/measure.cpp index bffa44215e3cde..23adba100707aa 100644 --- a/deps/icu-small/source/i18n/measure.cpp +++ b/deps/icu-small/source/i18n/measure.cpp @@ -23,7 +23,7 @@ U_NAMESPACE_BEGIN UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Measure) -Measure::Measure() {} +Measure::Measure() : unit(nullptr) {} Measure::Measure(const Formattable& _number, MeasureUnit* adoptedUnit, UErrorCode& ec) : @@ -35,7 +35,7 @@ Measure::Measure(const Formattable& _number, MeasureUnit* adoptedUnit, } Measure::Measure(const Measure& other) : - UObject(other), unit(0) { + UObject(other), unit(nullptr) { *this = other; } @@ -43,7 +43,11 @@ Measure& Measure::operator=(const Measure& other) { if (this != &other) { delete unit; number = other.number; - unit = other.unit->clone(); + if (other.unit != nullptr) { + unit = other.unit->clone(); + } else { + unit = nullptr; + } } return *this; } diff --git a/deps/icu-small/source/i18n/nfrs.cpp b/deps/icu-small/source/i18n/nfrs.cpp index 659cfcbbf5a857..dd91d7833db111 100644 --- a/deps/icu-small/source/i18n/nfrs.cpp +++ b/deps/icu-small/source/i18n/nfrs.cpp @@ -37,7 +37,7 @@ enum { /** 0.x */ PROPER_FRACTION_RULE_INDEX = 2, /** x.0 */ - MASTER_RULE_INDEX = 3, + DEFAULT_RULE_INDEX = 3, /** Inf */ INFINITY_RULE_INDEX = 4, /** NaN */ @@ -278,8 +278,8 @@ void NFRuleSet::setNonNumericalRule(NFRule *rule) { else if (baseValue == NFRule::kProperFractionRule) { setBestFractionRule(PROPER_FRACTION_RULE_INDEX, rule, TRUE); } - else if (baseValue == NFRule::kMasterRule) { - setBestFractionRule(MASTER_RULE_INDEX, rule, TRUE); + else if (baseValue == NFRule::kDefaultRule) { + setBestFractionRule(DEFAULT_RULE_INDEX, rule, TRUE); } else if (baseValue == NFRule::kInfinityRule) { delete nonNumericalRules[INFINITY_RULE_INDEX]; @@ -323,7 +323,7 @@ NFRuleSet::~NFRuleSet() for (int i = 0; i < NON_NUMERICAL_RULE_LENGTH; i++) { if (i != IMPROPER_FRACTION_RULE_INDEX && i != PROPER_FRACTION_RULE_INDEX - && i != MASTER_RULE_INDEX) + && i != DEFAULT_RULE_INDEX) { delete nonNumericalRules[i]; } @@ -375,7 +375,7 @@ NFRuleSet::setDecimalFormatSymbols(const DecimalFormatSymbols &newSymbols, UErro rules[i]->setDecimalFormatSymbols(newSymbols, status); } // Switch the fraction rules to mirror the DecimalFormatSymbols. - for (int32_t nonNumericalIdx = IMPROPER_FRACTION_RULE_INDEX; nonNumericalIdx <= MASTER_RULE_INDEX; nonNumericalIdx++) { + for (int32_t nonNumericalIdx = IMPROPER_FRACTION_RULE_INDEX; nonNumericalIdx <= DEFAULT_RULE_INDEX; nonNumericalIdx++) { if (nonNumericalRules[nonNumericalIdx]) { for (uint32_t fIdx = 0; fIdx < fractionRules.size(); fIdx++) { NFRule *fractionRule = fractionRules[fIdx]; @@ -472,9 +472,9 @@ NFRuleSet::findDoubleRule(double number) const } } - // if there's a master rule, use it to format the number - if (nonNumericalRules[MASTER_RULE_INDEX]) { - return nonNumericalRules[MASTER_RULE_INDEX]; + // if there's a default rule, use it to format the number + if (nonNumericalRules[DEFAULT_RULE_INDEX]) { + return nonNumericalRules[DEFAULT_RULE_INDEX]; } // and if we haven't yet returned a rule, use findNormalRule() @@ -507,13 +507,13 @@ NFRuleSet::findNormalRule(int64_t number) const // do them in findRule(), because the version of format() that // takes a long bypasses findRule() and goes straight to this // function. This function does skip the fraction rules since - // we know the value is an integer (it also skips the master + // we know the value is an integer (it also skips the default // rule, since it's considered a fraction rule. Skipping the - // master rule in this function is also how we avoid infinite + // default rule in this function is also how we avoid infinite // recursion) // {dlf} unfortunately this fails if there are no rules except - // special rules. If there are no rules, use the master rule. + // special rules. If there are no rules, use the default rule. // binary-search the rule list for the applicable rule // (a rule is used for all values from its base value to @@ -553,8 +553,8 @@ NFRuleSet::findNormalRule(int64_t number) const } return result; } - // else use the master rule - return nonNumericalRules[MASTER_RULE_INDEX]; + // else use the default rule + return nonNumericalRules[DEFAULT_RULE_INDEX]; } /** @@ -792,7 +792,7 @@ NFRuleSet::appendRules(UnicodeString& result) const if (nonNumericalRules[i]) { if (rule->getBaseValue() == NFRule::kImproperFractionRule || rule->getBaseValue() == NFRule::kProperFractionRule - || rule->getBaseValue() == NFRule::kMasterRule) + || rule->getBaseValue() == NFRule::kDefaultRule) { for (uint32_t fIdx = 0; fIdx < fractionRules.size(); fIdx++) { NFRule *fractionRule = fractionRules[fIdx]; diff --git a/deps/icu-small/source/i18n/nfrs.h b/deps/icu-small/source/i18n/nfrs.h index c56fc0707851a7..e9b955ddff142d 100644 --- a/deps/icu-small/source/i18n/nfrs.h +++ b/deps/icu-small/source/i18n/nfrs.h @@ -36,7 +36,7 @@ class NFRuleSet : public UMemory { void parseRules(UnicodeString& rules, UErrorCode& status); void setNonNumericalRule(NFRule *rule); void setBestFractionRule(int32_t originalIndex, NFRule *newRule, UBool rememberRule); - void makeIntoFractionRuleSet() { fIsFractionRuleSet = TRUE; } + void makeIntoFractionRuleSet() { fIsFractionRuleSet = true; } ~NFRuleSet(); @@ -93,11 +93,11 @@ int64_t util64_fromDouble(double d); uint64_t util64_pow(uint32_t radix, uint16_t exponent); // convert n to digit string in buffer, return length of string -uint32_t util64_tou(int64_t n, UChar* buffer, uint32_t buflen, uint32_t radix = 10, UBool raw = FALSE); +uint32_t util64_tou(int64_t n, UChar* buffer, uint32_t buflen, uint32_t radix = 10, UBool raw = false); #ifdef RBNF_DEBUG int64_t util64_utoi(const UChar* str, uint32_t radix = 10); -uint32_t util64_toa(int64_t n, char* buffer, uint32_t buflen, uint32_t radix = 10, UBool raw = FALSE); +uint32_t util64_toa(int64_t n, char* buffer, uint32_t buflen, uint32_t radix = 10, UBool raw = false); int64_t util64_atoi(const char* str, uint32_t radix); #endif diff --git a/deps/icu-small/source/i18n/nfrule.cpp b/deps/icu-small/source/i18n/nfrule.cpp index b5e7892d5e68cb..cba41d14bb1fa8 100644 --- a/deps/icu-small/source/i18n/nfrule.cpp +++ b/deps/icu-small/source/i18n/nfrule.cpp @@ -153,7 +153,7 @@ NFRule::makeRules(UnicodeString& description, if ((rule1->baseValue > 0 && (rule1->baseValue % util64_pow(rule1->radix, rule1->exponent)) == 0) || rule1->getType() == kImproperFractionRule - || rule1->getType() == kMasterRule) { + || rule1->getType() == kDefaultRule) { // if it passes that test, new up the second rule. If the // rule set both rules will belong to is a fraction rule @@ -181,9 +181,9 @@ NFRule::makeRules(UnicodeString& description, } // if the description began with "x.0" and contains bracketed - // text, it describes both the master rule and the + // text, it describes both the default rule and the // improper fraction rule - else if (rule1->getType() == kMasterRule) { + else if (rule1->getType() == kDefaultRule) { rule2->baseValue = rule1->baseValue; rule1->setType(kImproperFractionRule); } @@ -376,7 +376,7 @@ NFRule::parseRuleDescriptor(UnicodeString& description, UErrorCode& status) decimalPoint = descriptor.charAt(1); } else if (firstChar == gX && lastChar == gZero) { - setBaseValue(kMasterRule, status); + setBaseValue(kDefaultRule, status); decimalPoint = descriptor.charAt(1); } else if (descriptor.compare(gNaN, 3) == 0) { @@ -663,7 +663,7 @@ NFRule::_appendRuleText(UnicodeString& result) const case kNegativeNumberRule: result.append(gMinusX, 2); break; case kImproperFractionRule: result.append(gX).append(decimalPoint == 0 ? gDot : decimalPoint).append(gX); break; case kProperFractionRule: result.append(gZero).append(decimalPoint == 0 ? gDot : decimalPoint).append(gX); break; - case kMasterRule: result.append(gX).append(decimalPoint == 0 ? gDot : decimalPoint).append(gZero); break; + case kDefaultRule: result.append(gX).append(decimalPoint == 0 ? gDot : decimalPoint).append(gZero); break; case kInfinityRule: result.append(gInf, 3); break; case kNaNRule: result.append(gNaN, 3); break; default: @@ -1297,6 +1297,10 @@ NFRule::prefixLength(const UnicodeString& str, const UnicodeString& prefix, UErr #if !UCONFIG_NO_COLLATION // go through all this grief if we're in lenient-parse mode if (formatter->isLenient()) { + // Check if non-lenient rule finds the text before call lenient parsing + if (str.startsWith(prefix)) { + return prefix.length(); + } // get the formatter's collator and use it to create two // collation element iterators, one over the target string // and another over the prefix (right now, we'll throw an @@ -1505,9 +1509,15 @@ NFRule::findText(const UnicodeString& str, return str.indexOf(key, startingAt); } else { - // but if lenient parsing is turned ON, we've got some work - // ahead of us - return findTextLenient(str, key, startingAt, length); + // Check if non-lenient rule finds the text before call lenient parsing + *length = key.length(); + int32_t pos = str.indexOf(key, startingAt); + if(pos >= 0) { + return pos; + } else { + // but if lenient parsing is turned ON, we've got some work ahead of us + return findTextLenient(str, key, startingAt, length); + } } } diff --git a/deps/icu-small/source/i18n/nfrule.h b/deps/icu-small/source/i18n/nfrule.h index 2b030390ea7dcb..12431c0dba33e8 100644 --- a/deps/icu-small/source/i18n/nfrule.h +++ b/deps/icu-small/source/i18n/nfrule.h @@ -38,7 +38,7 @@ class NFRule : public UMemory { kNegativeNumberRule = -1, kImproperFractionRule = -2, kProperFractionRule = -3, - kMasterRule = -4, + kDefaultRule = -4, kInfinityRule = -5, kNaNRule = -6, kOtherRule = -7 diff --git a/deps/icu-small/source/i18n/nfsubs.cpp b/deps/icu-small/source/i18n/nfsubs.cpp index 3733f0ca74d3e3..e3ea3938835ea3 100644 --- a/deps/icu-small/source/i18n/nfsubs.cpp +++ b/deps/icu-small/source/i18n/nfsubs.cpp @@ -342,7 +342,7 @@ NFSubstitution::makeSubstitution(int32_t pos, // IntegralPartSubstitution else if (rule->getBaseValue() == NFRule::kImproperFractionRule || rule->getBaseValue() == NFRule::kProperFractionRule - || rule->getBaseValue() == NFRule::kMasterRule) { + || rule->getBaseValue() == NFRule::kDefaultRule) { return new IntegralPartSubstitution(pos, ruleSet, description, status); } @@ -371,7 +371,7 @@ NFSubstitution::makeSubstitution(int32_t pos, // FractionalPartSubstitution else if (rule->getBaseValue() == NFRule::kImproperFractionRule || rule->getBaseValue() == NFRule::kProperFractionRule - || rule->getBaseValue() == NFRule::kMasterRule) { + || rule->getBaseValue() == NFRule::kDefaultRule) { return new FractionalPartSubstitution(pos, ruleSet, description, status); } diff --git a/deps/icu-small/source/i18n/nounit.cpp b/deps/icu-small/source/i18n/nounit.cpp deleted file mode 100644 index 1d4aa05506e98d..00000000000000 --- a/deps/icu-small/source/i18n/nounit.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// © 2017 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -#include "unicode/nounit.h" -#include "uassert.h" - -#if !UCONFIG_NO_FORMATTING - -U_NAMESPACE_BEGIN - -UOBJECT_DEFINE_RTTI_IMPLEMENTATION(NoUnit) - -NoUnit U_EXPORT2 NoUnit::base() { - return NoUnit(""); -} - -NoUnit U_EXPORT2 NoUnit::percent() { - return NoUnit("percent"); -} - -NoUnit U_EXPORT2 NoUnit::permille() { - return NoUnit("permille"); -} - -NoUnit::NoUnit(const char* subtype) { - initNoUnit(subtype); -} - -NoUnit::NoUnit(const NoUnit& other) : MeasureUnit(other) { -} - -NoUnit* NoUnit::clone() const { - return new NoUnit(*this); -} - -NoUnit::~NoUnit() { -} - - -U_NAMESPACE_END - -#endif diff --git a/deps/icu-small/source/i18n/number_asformat.h b/deps/icu-small/source/i18n/number_asformat.h index 7b0a1dee6f438b..3a2fe3185bee1c 100644 --- a/deps/icu-small/source/i18n/number_asformat.h +++ b/deps/icu-small/source/i18n/number_asformat.h @@ -25,7 +25,6 @@ namespace impl { * A wrapper around LocalizedNumberFormatter implementing the Format interface, enabling improved * compatibility with other APIs. * - * @draft ICU 62 * @see NumberFormatter */ class U_I18N_API LocalizedNumberFormatterAsFormat : public Format { diff --git a/deps/icu-small/source/i18n/number_capi.cpp b/deps/icu-small/source/i18n/number_capi.cpp index d61440d081e9fb..ef5f0a41ff07a4 100644 --- a/deps/icu-small/source/i18n/number_capi.cpp +++ b/deps/icu-small/source/i18n/number_capi.cpp @@ -13,6 +13,7 @@ #include "number_utypes.h" #include "numparse_types.h" #include "formattedval_impl.h" +#include "number_decnum.h" #include "unicode/numberformatter.h" #include "unicode/unumberformatter.h" @@ -196,6 +197,23 @@ unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPosition result->fData.getAllFieldPositions(fpih, *ec); } +U_CAPI int32_t U_EXPORT2 +unumf_resultToDecimalNumber( + const UFormattedNumber* uresult, + char* dest, + int32_t destCapacity, + UErrorCode* ec) { + const auto* result = UFormattedNumberApiHelper::validate(uresult, *ec); + if (U_FAILURE(*ec)) { + return 0; + } + DecNum decnum; + return result->fData.quantity + .toDecNum(decnum, *ec) + .toCharString(*ec) + .extract(dest, destCapacity, *ec); +} + U_CAPI void U_EXPORT2 unumf_close(UNumberFormatter* f) { UErrorCode localStatus = U_ZERO_ERROR; diff --git a/deps/icu-small/source/i18n/number_compact.cpp b/deps/icu-small/source/i18n/number_compact.cpp index e1fef8feb52298..d781b6fada234c 100644 --- a/deps/icu-small/source/i18n/number_compact.cpp +++ b/deps/icu-small/source/i18n/number_compact.cpp @@ -167,6 +167,11 @@ void CompactData::CompactDataSink::put(const char *key, ResourceValue &value, UB if (U_FAILURE(status)) { return; } for (int i4 = 0; pluralVariantsTable.getKeyAndValue(i4, key, value); ++i4) { + if (uprv_strcmp(key, "0") == 0 || uprv_strcmp(key, "1") == 0) { + // TODO(ICU-21258): Handle this case. For now, skip. + continue; + } + // Skip this magnitude/plural if we already have it from a child locale. // Note: This also skips USE_FALLBACK entries. StandardPlural::Form plural = StandardPlural::fromString(key, status); diff --git a/deps/icu-small/source/i18n/number_currencysymbols.cpp b/deps/icu-small/source/i18n/number_currencysymbols.cpp index 4d6fb2cb1d8dec..9208427904cceb 100644 --- a/deps/icu-small/source/i18n/number_currencysymbols.cpp +++ b/deps/icu-small/source/i18n/number_currencysymbols.cpp @@ -44,6 +44,16 @@ UnicodeString CurrencySymbols::getNarrowCurrencySymbol(UErrorCode& status) const return loadSymbol(UCURR_NARROW_SYMBOL_NAME, status); } +UnicodeString CurrencySymbols::getFormalCurrencySymbol(UErrorCode& status) const { + // Note: currently no override is available for formal currency symbol + return loadSymbol(UCURR_FORMAL_SYMBOL_NAME, status); +} + +UnicodeString CurrencySymbols::getVariantCurrencySymbol(UErrorCode& status) const { + // Note: currently no override is available for variant currency symbol + return loadSymbol(UCURR_VARIANT_SYMBOL_NAME, status); +} + UnicodeString CurrencySymbols::getCurrencySymbol(UErrorCode& status) const { if (!fCurrencySymbol.isBogus()) { return fCurrencySymbol; diff --git a/deps/icu-small/source/i18n/number_currencysymbols.h b/deps/icu-small/source/i18n/number_currencysymbols.h index 9996bf96ae08a1..7e38fdf8287e14 100644 --- a/deps/icu-small/source/i18n/number_currencysymbols.h +++ b/deps/icu-small/source/i18n/number_currencysymbols.h @@ -31,6 +31,10 @@ class U_I18N_API CurrencySymbols : public UMemory { UnicodeString getNarrowCurrencySymbol(UErrorCode& status) const; + UnicodeString getFormalCurrencySymbol(UErrorCode& status) const; + + UnicodeString getVariantCurrencySymbol(UErrorCode& status) const; + UnicodeString getCurrencySymbol(UErrorCode& status) const; UnicodeString getIntlCurrencySymbol(UErrorCode& status) const; diff --git a/deps/icu-small/source/i18n/number_decimalquantity.cpp b/deps/icu-small/source/i18n/number_decimalquantity.cpp index 5ce9c27cbf4a76..75af5e9974fc65 100644 --- a/deps/icu-small/source/i18n/number_decimalquantity.cpp +++ b/deps/icu-small/source/i18n/number_decimalquantity.cpp @@ -20,6 +20,7 @@ #include "charstr.h" #include "number_utils.h" #include "uassert.h" +#include "util.h" using namespace icu; using namespace icu::number; @@ -626,7 +627,7 @@ double DecimalQuantity::toDouble() const { &count); } -void DecimalQuantity::toDecNum(DecNum& output, UErrorCode& status) const { +DecNum& DecimalQuantity::toDecNum(DecNum& output, UErrorCode& status) const { // Special handling for zero if (precision == 0) { output.setTo("0", status); @@ -634,11 +635,15 @@ void DecimalQuantity::toDecNum(DecNum& output, UErrorCode& status) const { // Use the BCD constructor. We need to do a little bit of work to convert, though. // The decNumber constructor expects most-significant first, but we store least-significant first. - MaybeStackArray ubcd(precision); + MaybeStackArray ubcd(precision, status); + if (U_FAILURE(status)) { + return output; + } for (int32_t m = 0; m < precision; m++) { ubcd[precision - m - 1] = static_cast(getDigitPos(m)); } output.setTo(ubcd.getAlias(), precision, scale, isNegative(), status); + return output; } void DecimalQuantity::truncate() { @@ -1004,13 +1009,8 @@ void DecimalQuantity::shiftLeft(int32_t numDigits) { } if (usingBytes) { ensureCapacity(precision + numDigits); - int i = precision + numDigits - 1; - for (; i >= numDigits; i--) { - fBCD.bcdBytes.ptr[i] = fBCD.bcdBytes.ptr[i - numDigits]; - } - for (; i >= 0; i--) { - fBCD.bcdBytes.ptr[i] = 0; - } + uprv_memmove(fBCD.bcdBytes.ptr + numDigits, fBCD.bcdBytes.ptr, precision); + uprv_memset(fBCD.bcdBytes.ptr, 0, numDigits); } else { fBCD.bcdLong <<= (numDigits * 4); } @@ -1324,7 +1324,11 @@ bool DecimalQuantity::operator==(const DecimalQuantity& other) const { } UnicodeString DecimalQuantity::toString() const { - MaybeStackArray digits(precision + 1); + UErrorCode localStatus = U_ZERO_ERROR; + MaybeStackArray digits(precision + 1, localStatus); + if (U_FAILURE(localStatus)) { + return ICU_Utility::makeBogusString(); + } for (int32_t i = 0; i < precision; i++) { digits[i] = getDigitPos(precision - i - 1) + '0'; } diff --git a/deps/icu-small/source/i18n/number_decimalquantity.h b/deps/icu-small/source/i18n/number_decimalquantity.h index 53a9eb33b26caf..839424775a0d8d 100644 --- a/deps/icu-small/source/i18n/number_decimalquantity.h +++ b/deps/icu-small/source/i18n/number_decimalquantity.h @@ -20,7 +20,7 @@ namespace impl { class DecNum; /** - * An class for representing a number to be processed by the decimal formatting pipeline. Includes + * A class for representing a number to be processed by the decimal formatting pipeline. Includes * methods for rounding, plural rules, and decimal digit extraction. * *

    By design, this is NOT IMMUTABLE and NOT THREAD SAFE. It is intended to be an intermediate @@ -209,7 +209,7 @@ class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory { double toDouble() const; /** Computes a DecNum representation of this DecimalQuantity, saving it to the output parameter. */ - void toDecNum(DecNum& output, UErrorCode& status) const; + DecNum& toDecNum(DecNum& output, UErrorCode& status) const; DecimalQuantity &setToInt(int32_t n); @@ -217,7 +217,13 @@ class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory { DecimalQuantity &setToDouble(double n); - /** decNumber is similar to BigDecimal in Java. */ + /** + * Produces a DecimalQuantity that was parsed from a string by the decNumber + * C Library. + * + * decNumber is similar to BigDecimal in Java, and supports parsing strings + * such as "123.456621E+40". + */ DecimalQuantity &setToDecNumber(StringPiece n, UErrorCode& status); /** Internal method if the caller already has a DecNum. */ diff --git a/deps/icu-small/source/i18n/number_decnum.h b/deps/icu-small/source/i18n/number_decnum.h index 0c7399dbddd43b..3bb8d107807967 100644 --- a/deps/icu-small/source/i18n/number_decnum.h +++ b/deps/icu-small/source/i18n/number_decnum.h @@ -9,6 +9,7 @@ #include "decNumber.h" #include "charstr.h" +#include "bytesinkutil.h" U_NAMESPACE_BEGIN @@ -57,6 +58,13 @@ class U_I18N_API DecNum : public UMemory { void toString(ByteSink& output, UErrorCode& status) const; + inline CharString toCharString(UErrorCode& status) const { + CharString cstr; + CharStringByteSink sink(&cstr); + toString(sink, status); + return cstr; + } + inline const decNumber* getRawDecNumber() const { return fData.getAlias(); } diff --git a/deps/icu-small/source/i18n/number_fluent.cpp b/deps/icu-small/source/i18n/number_fluent.cpp index 9cdb8b7156e614..8569a36e5b260b 100644 --- a/deps/icu-small/source/i18n/number_fluent.cpp +++ b/deps/icu-small/source/i18n/number_fluent.cpp @@ -13,6 +13,7 @@ #include "number_asformat.h" #include "number_utils.h" #include "number_utypes.h" +#include "number_mapper.h" #include "util.h" #include "fphdlimp.h" @@ -273,6 +274,20 @@ Derived NumberFormatterSettings::scale(const Scale& scale)&& { return move; } +template +Derived NumberFormatterSettings::usage(const StringPiece usage) const& { + Derived copy(*this); + copy.fMacros.usage.set(usage); + return copy; +} + +template +Derived NumberFormatterSettings::usage(const StringPiece usage)&& { + Derived move(std::move(*this)); + move.fMacros.usage.set(usage); + return move; +} + template Derived NumberFormatterSettings::padding(const Padder& padder) const& { Derived copy(*this); @@ -400,7 +415,8 @@ LocalizedNumberFormatter::LocalizedNumberFormatter(const LNF& other) LocalizedNumberFormatter::LocalizedNumberFormatter(const NFS& other) : NFS(other) { - // No additional fields to assign (let call count and compiled formatter reset to defaults) + UErrorCode localStatus = U_ZERO_ERROR; // Can't bubble up the error + lnfCopyHelper(static_cast(other), localStatus); } LocalizedNumberFormatter::LocalizedNumberFormatter(LocalizedNumberFormatter&& src) U_NOEXCEPT @@ -408,38 +424,25 @@ LocalizedNumberFormatter::LocalizedNumberFormatter(LocalizedNumberFormatter&& sr LocalizedNumberFormatter::LocalizedNumberFormatter(NFS&& src) U_NOEXCEPT : NFS(std::move(src)) { - // For the move operators, copy over the compiled formatter. - // Note: if the formatter is not compiled, call count information is lost. - if (static_cast(src).fCompiled != nullptr) { - lnfMoveHelper(static_cast(src)); - } + lnfMoveHelper(std::move(static_cast(src))); } LocalizedNumberFormatter& LocalizedNumberFormatter::operator=(const LNF& other) { NFS::operator=(static_cast&>(other)); - // Reset to default values. - clear(); + UErrorCode localStatus = U_ZERO_ERROR; // Can't bubble up the error + lnfCopyHelper(other, localStatus); return *this; } LocalizedNumberFormatter& LocalizedNumberFormatter::operator=(LNF&& src) U_NOEXCEPT { NFS::operator=(static_cast&&>(src)); - // For the move operators, copy over the compiled formatter. - // Note: if the formatter is not compiled, call count information is lost. - if (static_cast(src).fCompiled != nullptr) { - // Formatter is compiled - lnfMoveHelper(static_cast(src)); - } else { - clear(); - } + lnfMoveHelper(std::move(src)); return *this; } -void LocalizedNumberFormatter::clear() { - // Reset to default values. +void LocalizedNumberFormatter::resetCompiled() { auto* callCount = reinterpret_cast(fUnsafeCallCount); umtx_storeRelease(*callCount, 0); - delete fCompiled; fCompiled = nullptr; } @@ -447,19 +450,56 @@ void LocalizedNumberFormatter::lnfMoveHelper(LNF&& src) { // Copy over the compiled formatter and set call count to INT32_MIN as in computeCompiled(). // Don't copy the call count directly because doing so requires a loadAcquire/storeRelease. // The bits themselves appear to be platform-dependent, so copying them might not be safe. - auto* callCount = reinterpret_cast(fUnsafeCallCount); - umtx_storeRelease(*callCount, INT32_MIN); delete fCompiled; - fCompiled = src.fCompiled; - // Reset the source object to leave it in a safe state. - auto* srcCallCount = reinterpret_cast(src.fUnsafeCallCount); - umtx_storeRelease(*srcCallCount, 0); - src.fCompiled = nullptr; + if (src.fCompiled != nullptr) { + auto* callCount = reinterpret_cast(fUnsafeCallCount); + umtx_storeRelease(*callCount, INT32_MIN); + fCompiled = src.fCompiled; + // Reset the source object to leave it in a safe state. + src.resetCompiled(); + } else { + resetCompiled(); + } + + // Unconditionally move the warehouse + delete fWarehouse; + fWarehouse = src.fWarehouse; + src.fWarehouse = nullptr; +} + +void LocalizedNumberFormatter::lnfCopyHelper(const LNF&, UErrorCode& status) { + // When copying, always reset the compiled formatter. + delete fCompiled; + resetCompiled(); + + // If MacroProps has a reference to AffixPatternProvider, we need to copy it. + // If MacroProps has a reference to PluralRules, copy that one, too. + delete fWarehouse; + if (fMacros.affixProvider || fMacros.rules) { + LocalPointer warehouse(new DecimalFormatWarehouse(), status); + if (U_FAILURE(status)) { + fWarehouse = nullptr; + return; + } + if (fMacros.affixProvider) { + warehouse->affixProvider.setTo(fMacros.affixProvider, status); + fMacros.affixProvider = &warehouse->affixProvider.get(); + } + if (fMacros.rules) { + warehouse->rules.adoptInsteadAndCheckErrorCode( + new PluralRules(*fMacros.rules), status); + fMacros.rules = warehouse->rules.getAlias(); + } + fWarehouse = warehouse.orphan(); + } else { + fWarehouse = nullptr; + } } LocalizedNumberFormatter::~LocalizedNumberFormatter() { delete fCompiled; + delete fWarehouse; } LocalizedNumberFormatter::LocalizedNumberFormatter(const MacroProps& macros, const Locale& locale) { @@ -480,123 +520,6 @@ LocalizedNumberFormatter UnlocalizedNumberFormatter::locale(const Locale& locale return LocalizedNumberFormatter(std::move(fMacros), locale); } -SymbolsWrapper::SymbolsWrapper(const SymbolsWrapper& other) { - doCopyFrom(other); -} - -SymbolsWrapper::SymbolsWrapper(SymbolsWrapper&& src) U_NOEXCEPT { - doMoveFrom(std::move(src)); -} - -SymbolsWrapper& SymbolsWrapper::operator=(const SymbolsWrapper& other) { - if (this == &other) { - return *this; - } - doCleanup(); - doCopyFrom(other); - return *this; -} - -SymbolsWrapper& SymbolsWrapper::operator=(SymbolsWrapper&& src) U_NOEXCEPT { - if (this == &src) { - return *this; - } - doCleanup(); - doMoveFrom(std::move(src)); - return *this; -} - -SymbolsWrapper::~SymbolsWrapper() { - doCleanup(); -} - -void SymbolsWrapper::setTo(const DecimalFormatSymbols& dfs) { - doCleanup(); - fType = SYMPTR_DFS; - fPtr.dfs = new DecimalFormatSymbols(dfs); -} - -void SymbolsWrapper::setTo(const NumberingSystem* ns) { - doCleanup(); - fType = SYMPTR_NS; - fPtr.ns = ns; -} - -void SymbolsWrapper::doCopyFrom(const SymbolsWrapper& other) { - fType = other.fType; - switch (fType) { - case SYMPTR_NONE: - // No action necessary - break; - case SYMPTR_DFS: - // Memory allocation failures are exposed in copyErrorTo() - if (other.fPtr.dfs != nullptr) { - fPtr.dfs = new DecimalFormatSymbols(*other.fPtr.dfs); - } else { - fPtr.dfs = nullptr; - } - break; - case SYMPTR_NS: - // Memory allocation failures are exposed in copyErrorTo() - if (other.fPtr.ns != nullptr) { - fPtr.ns = new NumberingSystem(*other.fPtr.ns); - } else { - fPtr.ns = nullptr; - } - break; - } -} - -void SymbolsWrapper::doMoveFrom(SymbolsWrapper&& src) { - fType = src.fType; - switch (fType) { - case SYMPTR_NONE: - // No action necessary - break; - case SYMPTR_DFS: - fPtr.dfs = src.fPtr.dfs; - src.fPtr.dfs = nullptr; - break; - case SYMPTR_NS: - fPtr.ns = src.fPtr.ns; - src.fPtr.ns = nullptr; - break; - } -} - -void SymbolsWrapper::doCleanup() { - switch (fType) { - case SYMPTR_NONE: - // No action necessary - break; - case SYMPTR_DFS: - delete fPtr.dfs; - break; - case SYMPTR_NS: - delete fPtr.ns; - break; - } -} - -bool SymbolsWrapper::isDecimalFormatSymbols() const { - return fType == SYMPTR_DFS; -} - -bool SymbolsWrapper::isNumberingSystem() const { - return fType == SYMPTR_NS; -} - -const DecimalFormatSymbols* SymbolsWrapper::getDecimalFormatSymbols() const { - U_ASSERT(fType == SYMPTR_DFS); - return fPtr.dfs; -} - -const NumberingSystem* SymbolsWrapper::getNumberingSystem() const { - U_ASSERT(fType == SYMPTR_NS); - return fPtr.ns; -} - - FormattedNumber LocalizedNumberFormatter::formatInt(int64_t value, UErrorCode& status) const { if (U_FAILURE(status)) { return FormattedNumber(U_ILLEGAL_ARGUMENT_ERROR); } auto results = new UFormattedNumberData(); @@ -676,9 +599,9 @@ LocalizedNumberFormatter::formatDecimalQuantity(const DecimalQuantity& dq, UErro void LocalizedNumberFormatter::formatImpl(impl::UFormattedNumberData* results, UErrorCode& status) const { if (computeCompiled(status)) { - fCompiled->format(results->quantity, results->getStringRef(), status); + fCompiled->format(results, status); } else { - NumberFormatterImpl::formatStatic(fMacros, results->quantity, results->getStringRef(), status); + NumberFormatterImpl::formatStatic(fMacros, results, status); } if (U_FAILURE(status)) { return; diff --git a/deps/icu-small/source/i18n/number_formatimpl.cpp b/deps/icu-small/source/i18n/number_formatimpl.cpp index 5bba09cfb5293e..9a9f3c8b71e01c 100644 --- a/deps/icu-small/source/i18n/number_formatimpl.cpp +++ b/deps/icu-small/source/i18n/number_formatimpl.cpp @@ -25,20 +25,20 @@ using namespace icu::number; using namespace icu::number::impl; -MicroPropsGenerator::~MicroPropsGenerator() = default; - - NumberFormatterImpl::NumberFormatterImpl(const MacroProps& macros, UErrorCode& status) : NumberFormatterImpl(macros, true, status) { } -int32_t NumberFormatterImpl::formatStatic(const MacroProps& macros, DecimalQuantity& inValue, - FormattedStringBuilder& outString, UErrorCode& status) { +int32_t NumberFormatterImpl::formatStatic(const MacroProps ¯os, UFormattedNumberData *results, + UErrorCode &status) { + DecimalQuantity &inValue = results->quantity; + FormattedStringBuilder &outString = results->getStringRef(); NumberFormatterImpl impl(macros, false, status); MicroProps& micros = impl.preProcessUnsafe(inValue, status); if (U_FAILURE(status)) { return 0; } int32_t length = writeNumber(micros, inValue, outString, 0, status); length += writeAffixes(micros, outString, 0, length, status); + results->outputUnit = std::move(micros.outputUnit); return length; } @@ -54,13 +54,15 @@ int32_t NumberFormatterImpl::getPrefixSuffixStatic(const MacroProps& macros, Sig // The "unsafe" method simply re-uses fMicros, eliminating the extra copy operation. // See MicroProps::processQuantity() for details. -int32_t NumberFormatterImpl::format(DecimalQuantity& inValue, FormattedStringBuilder& outString, - UErrorCode& status) const { +int32_t NumberFormatterImpl::format(UFormattedNumberData *results, UErrorCode &status) const { + DecimalQuantity &inValue = results->quantity; + FormattedStringBuilder &outString = results->getStringRef(); MicroProps micros; preProcess(inValue, micros, status); if (U_FAILURE(status)) { return 0; } int32_t length = writeNumber(micros, inValue, outString, 0, status); length += writeAffixes(micros, outString, 0, length, status); + results->outputUnit = std::move(micros.outputUnit); return length; } @@ -130,9 +132,10 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, // Pre-compute a few values for efficiency. bool isCurrency = utils::unitIsCurrency(macros.unit); - bool isNoUnit = utils::unitIsNoUnit(macros.unit); + bool isBaseUnit = utils::unitIsBaseUnit(macros.unit); bool isPercent = utils::unitIsPercent(macros.unit); bool isPermille = utils::unitIsPermille(macros.unit); + bool isCompactNotation = macros.notation.fType == Notation::NTN_COMPACT; bool isAccounting = macros.sign == UNUM_SIGN_ACCOUNTING || macros.sign == UNUM_SIGN_ACCOUNTING_ALWAYS || macros.sign == UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO; @@ -144,8 +147,20 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, if (macros.unitWidth != UNUM_UNIT_WIDTH_COUNT) { unitWidth = macros.unitWidth; } - bool isCldrUnit = !isCurrency && !isNoUnit && - (unitWidth == UNUM_UNIT_WIDTH_FULL_NAME || !(isPercent || isPermille)); + // Use CLDR unit data for all MeasureUnits (not currency and not + // no-unit), except use the dedicated percent pattern for percent and + // permille. However, use the CLDR unit data for percent/permille if a + // long name was requested OR if compact notation is being used, since + // compact notation overrides the middle modifier (micros.modMiddle) + // normally used for the percent pattern. + bool isCldrUnit = !isCurrency + && !isBaseUnit + && (unitWidth == UNUM_UNIT_WIDTH_FULL_NAME + || !(isPercent || isPermille) + || isCompactNotation + ); + bool isMixedUnit = isCldrUnit && (uprv_strcmp(macros.unit.getType(), "") == 0) && + macros.unit.getComplexity(status) == UMEASURE_UNIT_MIXED; // Select the numbering system. LocalPointer nsLocal; @@ -222,6 +237,27 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, /// START POPULATING THE DEFAULT MICROPROPS AND BUILDING THE MICROPROPS GENERATOR /// ///////////////////////////////////////////////////////////////////////////////////// + // Unit Preferences and Conversions as our first step + if (macros.usage.isSet()) { + if (!isCldrUnit) { + // We only support "usage" when the input unit is specified, and is + // a CLDR Unit. + status = U_ILLEGAL_ARGUMENT_ERROR; + return nullptr; + } + auto usagePrefsHandler = + new UsagePrefsHandler(macros.locale, macros.unit, macros.usage.fUsage, chain, status); + fUsagePrefsHandler.adoptInsteadAndCheckErrorCode(usagePrefsHandler, status); + chain = fUsagePrefsHandler.getAlias(); + } else if (isMixedUnit) { + MeasureUnitImpl temp; + const MeasureUnitImpl &outputUnit = MeasureUnitImpl::forMeasureUnit(macros.unit, temp, status); + auto unitConversionHandler = + new UnitConversionHandler(outputUnit.units[0]->build(status), macros.unit, chain, status); + fUnitConversionHandler.adoptInsteadAndCheckErrorCode(unitConversionHandler, status); + chain = fUnitConversionHandler.getAlias(); + } + // Multiplier if (macros.scale.isValid()) { fMicros.helpers.multiplier.setAndChain(macros.scale, chain); @@ -232,20 +268,18 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, Precision precision; if (!macros.precision.isBogus()) { precision = macros.precision; - } else if (macros.notation.fType == Notation::NTN_COMPACT) { + } else if (isCompactNotation) { precision = Precision::integer().withMinDigits(2); } else if (isCurrency) { precision = Precision::currency(UCURR_USAGE_STANDARD); + } else if (macros.usage.isSet()) { + // Bogus Precision - it will get set in the UsagePrefsHandler instead + precision = Precision(); } else { precision = Precision::maxFraction(6); } UNumberFormatRoundingMode roundingMode; - if (macros.roundingMode != kDefaultMode) { - roundingMode = macros.roundingMode; - } else { - // Temporary until ICU 64 - roundingMode = precision.fRoundingMode; - } + roundingMode = macros.roundingMode; fMicros.rounder = {precision, roundingMode, currency, status}; if (U_FAILURE(status)) { return nullptr; @@ -254,7 +288,7 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, // Grouping strategy if (!macros.grouper.isBogus()) { fMicros.grouping = macros.grouper; - } else if (macros.notation.fType == Notation::NTN_COMPACT) { + } else if (isCompactNotation) { // Compact notation uses minGrouping by default since ICU 59 fMicros.grouping = Grouper::forStrategy(UNUM_GROUPING_MIN2); } else { @@ -330,7 +364,8 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, patternModifier->setSymbols(fMicros.symbols, currency, unitWidth, nullptr, status); } if (safe) { - fImmutablePatternModifier.adoptInstead(patternModifier->createImmutable(status)); + fImmutablePatternModifier.adoptInsteadAndCheckErrorCode(patternModifier->createImmutable(status), + status); } if (U_FAILURE(status)) { return nullptr; @@ -338,24 +373,34 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, // Outer modifier (CLDR units and currency long names) if (isCldrUnit) { - fLongNameHandler.adoptInstead( - LongNameHandler::forMeasureUnit( - macros.locale, - macros.unit, - macros.perUnit, - unitWidth, - resolvePluralRules(macros.rules, macros.locale, status), - chain, - status)); - chain = fLongNameHandler.getAlias(); + if (macros.usage.isSet()) { + fLongNameMultiplexer.adoptInsteadAndCheckErrorCode( + LongNameMultiplexer::forMeasureUnits( + macros.locale, *fUsagePrefsHandler->getOutputUnits(), unitWidth, + resolvePluralRules(macros.rules, macros.locale, status), chain, status), + status); + chain = fLongNameMultiplexer.getAlias(); + } else if (isMixedUnit) { + fMixedUnitLongNameHandler.adoptInsteadAndCheckErrorCode(new MixedUnitLongNameHandler(), + status); + MixedUnitLongNameHandler::forMeasureUnit( + macros.locale, macros.unit, unitWidth, + resolvePluralRules(macros.rules, macros.locale, status), chain, + fMixedUnitLongNameHandler.getAlias(), status); + chain = fMixedUnitLongNameHandler.getAlias(); + } else { + fLongNameHandler.adoptInsteadAndCheckErrorCode(new LongNameHandler(), status); + LongNameHandler::forMeasureUnit(macros.locale, macros.unit, macros.perUnit, unitWidth, + resolvePluralRules(macros.rules, macros.locale, status), + chain, fLongNameHandler.getAlias(), status); + chain = fLongNameHandler.getAlias(); + } } else if (isCurrency && unitWidth == UNUM_UNIT_WIDTH_FULL_NAME) { - fLongNameHandler.adoptInstead( - LongNameHandler::forCurrencyLongNames( - macros.locale, - currency, - resolvePluralRules(macros.rules, macros.locale, status), - chain, - status)); + fLongNameHandler.adoptInsteadAndCheckErrorCode( + LongNameHandler::forCurrencyLongNames( + macros.locale, currency, resolvePluralRules(macros.rules, macros.locale, status), chain, + status), + status); chain = fLongNameHandler.getAlias(); } else { // No outer modifier required @@ -366,7 +411,7 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, } // Compact notation - if (macros.notation.fType == Notation::NTN_COMPACT) { + if (isCompactNotation) { CompactType compactType = (isCurrency && unitWidth != UNUM_UNIT_WIDTH_FULL_NAME) ? CompactType::TYPE_CURRENCY : CompactType::TYPE_DECIMAL; auto newCompactHandler = new CompactHandler( @@ -379,6 +424,9 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, safe, chain, status); + if (U_FAILURE(status)) { + return nullptr; + } if (newCompactHandler == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return nullptr; @@ -417,6 +465,7 @@ NumberFormatterImpl::resolvePluralRules(const PluralRules* rulesPtr, const Local int32_t NumberFormatterImpl::writeAffixes(const MicroProps& micros, FormattedStringBuilder& string, int32_t start, int32_t end, UErrorCode& status) { + U_ASSERT(micros.modOuter != nullptr); // Always apply the inner modifier (which is "strong"). int32_t length = micros.modInner->apply(string, start, end, status); if (micros.padding.isValid()) { diff --git a/deps/icu-small/source/i18n/number_formatimpl.h b/deps/icu-small/source/i18n/number_formatimpl.h index 084bc4a9d0b209..5cd549e54a363f 100644 --- a/deps/icu-small/source/i18n/number_formatimpl.h +++ b/deps/icu-small/source/i18n/number_formatimpl.h @@ -10,11 +10,13 @@ #include "number_types.h" #include "formatted_string_builder.h" #include "number_patternstring.h" +#include "number_usageprefs.h" #include "number_utils.h" #include "number_patternmodifier.h" #include "number_longnames.h" #include "number_compact.h" #include "number_microprops.h" +#include "number_utypes.h" U_NAMESPACE_BEGIN namespace number { namespace impl { @@ -34,9 +36,8 @@ class NumberFormatterImpl : public UMemory { /** * Builds and evaluates an "unsafe" MicroPropsGenerator, which is cheaper but can be used only once. */ - static int32_t - formatStatic(const MacroProps ¯os, DecimalQuantity &inValue, FormattedStringBuilder &outString, - UErrorCode &status); + static int32_t formatStatic(const MacroProps ¯os, UFormattedNumberData *results, + UErrorCode &status); /** * Prints only the prefix and suffix; used for DecimalFormat getters. @@ -51,7 +52,7 @@ class NumberFormatterImpl : public UMemory { /** * Evaluates the "safe" MicroPropsGenerator created by "fromMacros". */ - int32_t format(DecimalQuantity& inValue, FormattedStringBuilder& outString, UErrorCode& status) const; + int32_t format(UFormattedNumberData *results, UErrorCode &status) const; /** * Like format(), but saves the result into an output MicroProps without additional processing. @@ -82,7 +83,9 @@ class NumberFormatterImpl : public UMemory { int32_t end, UErrorCode& status); private: - // Head of the MicroPropsGenerator linked list: + // Head of the MicroPropsGenerator linked list. Subclasses' processQuantity + // methods process this list in a parent-first order, such that the last + // item added, which this points to, typically has its logic executed last. const MicroPropsGenerator *fMicroPropsGenerator = nullptr; // Tail of the list: @@ -90,13 +93,20 @@ class NumberFormatterImpl : public UMemory { // Other fields possibly used by the number formatting pipeline: // TODO: Convert more of these LocalPointers to value objects to reduce the number of news? + LocalPointer fUsagePrefsHandler; + LocalPointer fUnitConversionHandler; LocalPointer fSymbols; LocalPointer fRules; LocalPointer fPatternInfo; LocalPointer fScientificHandler; LocalPointer fPatternModifier; LocalPointer fImmutablePatternModifier; - LocalPointer fLongNameHandler; + LocalPointer fLongNameHandler; + // TODO: use a common base class that enables fLongNameHandler, + // fLongNameMultiplexer, and fMixedUnitLongNameHandler to be merged into one + // member? + LocalPointer fMixedUnitLongNameHandler; + LocalPointer fLongNameMultiplexer; LocalPointer fCompactHandler; // Value objects possibly used by the number formatting pipeline: diff --git a/deps/icu-small/source/i18n/number_grouping.cpp b/deps/icu-small/source/i18n/number_grouping.cpp index 41f727a458f943..6b1642cfd34abd 100644 --- a/deps/icu-small/source/i18n/number_grouping.cpp +++ b/deps/icu-small/source/i18n/number_grouping.cpp @@ -64,6 +64,13 @@ Grouper Grouper::forProperties(const DecimalFormatProperties& properties) { } void Grouper::setLocaleData(const impl::ParsedPatternInfo &patternInfo, const Locale& locale) { + if (fMinGrouping == -2) { + fMinGrouping = getMinGroupingForLocale(locale); + } else if (fMinGrouping == -3) { + fMinGrouping = static_cast(uprv_max(2, getMinGroupingForLocale(locale))); + } else { + // leave fMinGrouping alone + } if (fGrouping1 != -2 && fGrouping2 != -4) { return; } @@ -76,13 +83,6 @@ void Grouper::setLocaleData(const impl::ParsedPatternInfo &patternInfo, const Lo if (grouping3 == -1) { grouping2 = grouping1; } - if (fMinGrouping == -2) { - fMinGrouping = getMinGroupingForLocale(locale); - } else if (fMinGrouping == -3) { - fMinGrouping = static_cast(uprv_max(2, getMinGroupingForLocale(locale))); - } else { - // leave fMinGrouping alone - } fGrouping1 = grouping1; fGrouping2 = grouping2; } diff --git a/deps/icu-small/source/i18n/number_integerwidth.cpp b/deps/icu-small/source/i18n/number_integerwidth.cpp index d62aef444dca96..10b853423c847a 100644 --- a/deps/icu-small/source/i18n/number_integerwidth.cpp +++ b/deps/icu-small/source/i18n/number_integerwidth.cpp @@ -40,6 +40,9 @@ IntegerWidth IntegerWidth::truncateAt(int32_t maxInt) { } void IntegerWidth::apply(impl::DecimalQuantity& quantity, UErrorCode& status) const { + if (U_FAILURE(status)) { + return; + } if (fHasError) { status = U_ILLEGAL_ARGUMENT_ERROR; } else if (fUnion.minMaxInt.fMaxInt == -1) { diff --git a/deps/icu-small/source/i18n/number_longnames.cpp b/deps/icu-small/source/i18n/number_longnames.cpp index bb32d0381a507e..3891d532dea851 100644 --- a/deps/icu-small/source/i18n/number_longnames.cpp +++ b/deps/icu-small/source/i18n/number_longnames.cpp @@ -10,6 +10,7 @@ #include "ureslocs.h" #include "charstr.h" #include "uresimp.h" +#include "measunit_impl.h" #include "number_longnames.h" #include "number_microprops.h" #include @@ -22,8 +23,23 @@ using namespace icu::number::impl; namespace { +/** + * Display Name (this format has no placeholder). + * + * Used as an index into the LongNameHandler::simpleFormats array. Units + * resources cover the normal set of PluralRules keys, as well as `dnam` and + * `per` forms. + */ constexpr int32_t DNAM_INDEX = StandardPlural::Form::COUNT; +/** + * "per" form (e.g. "{0} per day" is day's "per" form). + * + * Used as an index into the LongNameHandler::simpleFormats array. Units + * resources cover the normal set of PluralRules keys, as well as `dnam` and + * `per` forms. + */ constexpr int32_t PER_INDEX = StandardPlural::Form::COUNT + 1; +// Number of keys in the array populated by PluralTableSink. constexpr int32_t ARRAY_LENGTH = StandardPlural::Form::COUNT + 2; static int32_t getIndex(const char* pluralKeyword, UErrorCode& status) { @@ -38,6 +54,11 @@ static int32_t getIndex(const char* pluralKeyword, UErrorCode& status) { } } +// Selects a string out of the `strings` array which corresponds to the +// specified plural form, with fallback to the OTHER form. +// +// The `strings` array must have ARRAY_LENGTH items: one corresponding to each +// of the plural forms, plus a display name ("dnam") and a "per" form. static UnicodeString getWithPlural( const UnicodeString* strings, StandardPlural::Form plural, @@ -87,6 +108,18 @@ class PluralTableSink : public ResourceSink { // NOTE: outArray MUST have room for all StandardPlural values. No bounds checking is performed. +/** + * Populates outArray with `locale`-specific values for `unit` through use of + * PluralTableSink. Only the set of basic units are supported! + * + * Reading from resources *unitsNarrow* and *unitsShort* (for width + * UNUM_UNIT_WIDTH_NARROW), or just *unitsShort* (for width + * UNUM_UNIT_WIDTH_SHORT). For other widths, it reads just "units". + * + * @param unit must have a type and subtype (i.e. it must be a unit listed in + * gTypes and gSubTypes in measunit.cpp). + * @param outArray must be of fixed length ARRAY_LENGTH. + */ void getMeasureData(const Locale &locale, const MeasureUnit &unit, const UNumberUnitWidth &width, UnicodeString *outArray, UErrorCode &status) { PluralTableSink sink(outArray); @@ -184,78 +217,107 @@ UnicodeString getPerUnitFormat(const Locale& locale, const UNumberUnitWidth &wid } // namespace -LongNameHandler* -LongNameHandler::forMeasureUnit(const Locale &loc, const MeasureUnit &unitRef, const MeasureUnit &perUnit, - const UNumberUnitWidth &width, const PluralRules *rules, - const MicroPropsGenerator *parent, UErrorCode &status) { - if (uprv_strlen(unitRef.getType()) == 0 || uprv_strlen(perUnit.getType()) == 0) { - // TODO(ICU-20941): Unsanctioned unit. Not yet fully supported. Set an error code. - status = U_UNSUPPORTED_ERROR; - return nullptr; - } +void LongNameHandler::forMeasureUnit(const Locale &loc, const MeasureUnit &unitRef, + const MeasureUnit &perUnit, const UNumberUnitWidth &width, + const PluralRules *rules, const MicroPropsGenerator *parent, + LongNameHandler *fillIn, UErrorCode &status) { + // Not valid for mixed units that aren't built-in units, and there should + // not be any built-in mixed units! + U_ASSERT(uprv_strcmp(unitRef.getType(), "") != 0 || + unitRef.getComplexity(status) != UMEASURE_UNIT_MIXED); + U_ASSERT(fillIn != nullptr); MeasureUnit unit = unitRef; if (uprv_strcmp(perUnit.getType(), "none") != 0) { // Compound unit: first try to simplify (e.g., meters per second is its own unit). - bool isResolved = false; - MeasureUnit resolved = MeasureUnit::resolveUnitPerUnit(unit, perUnit, &isResolved); - if (isResolved) { - unit = resolved; + MeasureUnit simplified = unit.product(perUnit.reciprocal(status), status); + if (uprv_strcmp(simplified.getType(), "") != 0) { + unit = simplified; } else { // No simplified form is available. - return forCompoundUnit(loc, unit, perUnit, width, rules, parent, status); + forCompoundUnit(loc, unit, perUnit, width, rules, parent, fillIn, status); + return; } } - auto* result = new LongNameHandler(rules, parent); - if (result == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - return nullptr; + if (uprv_strcmp(unit.getType(), "") == 0) { + // TODO(ICU-20941): Unsanctioned unit. Not yet fully supported. Set an + // error code. Once we support not-built-in units here, unitRef may be + // anything, but if not built-in, perUnit has to be "none". + status = U_UNSUPPORTED_ERROR; + return; } + UnicodeString simpleFormats[ARRAY_LENGTH]; getMeasureData(loc, unit, width, simpleFormats, status); - if (U_FAILURE(status)) { return result; } - result->simpleFormatsToModifiers(simpleFormats, {UFIELD_CATEGORY_NUMBER, UNUM_MEASURE_UNIT_FIELD}, status); - return result; + if (U_FAILURE(status)) { + return; + } + fillIn->rules = rules; + fillIn->parent = parent; + fillIn->simpleFormatsToModifiers(simpleFormats, {UFIELD_CATEGORY_NUMBER, UNUM_MEASURE_UNIT_FIELD}, + status); } -LongNameHandler* -LongNameHandler::forCompoundUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit, - const UNumberUnitWidth &width, const PluralRules *rules, - const MicroPropsGenerator *parent, UErrorCode &status) { - auto* result = new LongNameHandler(rules, parent); - if (result == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - return nullptr; +void LongNameHandler::forCompoundUnit(const Locale &loc, const MeasureUnit &unit, + const MeasureUnit &perUnit, const UNumberUnitWidth &width, + const PluralRules *rules, const MicroPropsGenerator *parent, + LongNameHandler *fillIn, UErrorCode &status) { + if (uprv_strcmp(unit.getType(), "") == 0 || uprv_strcmp(perUnit.getType(), "") == 0) { + // TODO(ICU-20941): Unsanctioned unit. Not yet fully supported. Set an + // error code. Once we support not-built-in units here, unitRef may be + // anything, but if not built-in, perUnit has to be "none". + status = U_UNSUPPORTED_ERROR; + return; + } + if (fillIn == nullptr) { + status = U_INTERNAL_PROGRAM_ERROR; + return; } UnicodeString primaryData[ARRAY_LENGTH]; getMeasureData(loc, unit, width, primaryData, status); - if (U_FAILURE(status)) { return result; } + if (U_FAILURE(status)) { + return; + } UnicodeString secondaryData[ARRAY_LENGTH]; getMeasureData(loc, perUnit, width, secondaryData, status); - if (U_FAILURE(status)) { return result; } + if (U_FAILURE(status)) { + return; + } UnicodeString perUnitFormat; if (!secondaryData[PER_INDEX].isBogus()) { perUnitFormat = secondaryData[PER_INDEX]; } else { UnicodeString rawPerUnitFormat = getPerUnitFormat(loc, width, status); - if (U_FAILURE(status)) { return result; } + if (U_FAILURE(status)) { + return; + } // rawPerUnitFormat is something like "{0}/{1}"; we need to substitute in the secondary unit. SimpleFormatter compiled(rawPerUnitFormat, 2, 2, status); - if (U_FAILURE(status)) { return result; } + if (U_FAILURE(status)) { + return; + } UnicodeString secondaryFormat = getWithPlural(secondaryData, StandardPlural::Form::ONE, status); - if (U_FAILURE(status)) { return result; } + if (U_FAILURE(status)) { + return; + } // Some "one" pattern may not contain "{0}". For example in "ar" or "ne" locale. SimpleFormatter secondaryCompiled(secondaryFormat, 0, 1, status); - if (U_FAILURE(status)) { return result; } + if (U_FAILURE(status)) { + return; + } UnicodeString secondaryString = secondaryCompiled.getTextWithNoArguments().trim(); // TODO: Why does UnicodeString need to be explicit in the following line? compiled.format(UnicodeString(u"{0}"), secondaryString, perUnitFormat, status); - if (U_FAILURE(status)) { return result; } + if (U_FAILURE(status)) { + return; + } } - result->multiSimpleFormatsToModifiers(primaryData, perUnitFormat, {UFIELD_CATEGORY_NUMBER, UNUM_MEASURE_UNIT_FIELD}, status); - return result; + fillIn->rules = rules; + fillIn->parent = parent; + fillIn->multiSimpleFormatsToModifiers(primaryData, perUnitFormat, + {UFIELD_CATEGORY_NUMBER, UNUM_MEASURE_UNIT_FIELD}, status); } UnicodeString LongNameHandler::getUnitDisplayName( @@ -338,7 +400,9 @@ void LongNameHandler::multiSimpleFormatsToModifiers(const UnicodeString *leadFor void LongNameHandler::processQuantity(DecimalQuantity &quantity, MicroProps µs, UErrorCode &status) const { - parent->processQuantity(quantity, micros, status); + if (parent != NULL) { + parent->processQuantity(quantity, micros, status); + } StandardPlural::Form pluralForm = utils::getPluralSafe(micros.rounder, rules, quantity, status); micros.modOuter = &fModifiers[pluralForm]; } @@ -347,4 +411,199 @@ const Modifier* LongNameHandler::getModifier(Signum /*signum*/, StandardPlural:: return &fModifiers[plural]; } +void MixedUnitLongNameHandler::forMeasureUnit(const Locale &loc, const MeasureUnit &mixedUnit, + const UNumberUnitWidth &width, const PluralRules *rules, + const MicroPropsGenerator *parent, + MixedUnitLongNameHandler *fillIn, UErrorCode &status) { + U_ASSERT(mixedUnit.getComplexity(status) == UMEASURE_UNIT_MIXED); + U_ASSERT(fillIn != nullptr); + + MeasureUnitImpl temp; + const MeasureUnitImpl& impl = MeasureUnitImpl::forMeasureUnit(mixedUnit, temp, status); + fillIn->fMixedUnitCount = impl.units.length(); + fillIn->fMixedUnitData.adoptInstead(new UnicodeString[fillIn->fMixedUnitCount * ARRAY_LENGTH]); + for (int32_t i = 0; i < fillIn->fMixedUnitCount; i++) { + // Grab data for each of the components. + UnicodeString *unitData = &fillIn->fMixedUnitData[i * ARRAY_LENGTH]; + getMeasureData(loc, impl.units[i]->build(status), width, unitData, status); + } + + UListFormatterWidth listWidth = ULISTFMT_WIDTH_SHORT; + if (width == UNUM_UNIT_WIDTH_NARROW) { + listWidth = ULISTFMT_WIDTH_NARROW; + } else if (width == UNUM_UNIT_WIDTH_FULL_NAME) { + // This might be the same as SHORT in most languages: + listWidth = ULISTFMT_WIDTH_WIDE; + } + fillIn->fListFormatter.adoptInsteadAndCheckErrorCode( + ListFormatter::createInstance(loc, ULISTFMT_TYPE_UNITS, listWidth, status), status); + fillIn->rules = rules; + fillIn->parent = parent; + + // We need a localised NumberFormatter for the integers of the bigger units + // (providing Arabic numerals, for example). + fillIn->fIntegerFormatter = NumberFormatter::withLocale(loc); +} + +void MixedUnitLongNameHandler::processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const { + U_ASSERT(fMixedUnitCount > 1); + if (parent != nullptr) { + parent->processQuantity(quantity, micros, status); + } + micros.modOuter = getMixedUnitModifier(quantity, micros, status); +} + +const Modifier *MixedUnitLongNameHandler::getMixedUnitModifier(DecimalQuantity &quantity, + MicroProps µs, + UErrorCode &status) const { + if (micros.mixedMeasuresCount == 0) { + U_ASSERT(micros.mixedMeasuresCount > 0); // Mixed unit: we must have more than one unit value + status = U_UNSUPPORTED_ERROR; + return µs.helpers.emptyWeakModifier; + } + // If we don't have at least one mixedMeasure, the LongNameHandler would be + // sufficient and we shouldn't be running MixedUnitLongNameHandler code: + U_ASSERT(micros.mixedMeasuresCount > 0); + // mixedMeasures does not contain the last value: + U_ASSERT(fMixedUnitCount == micros.mixedMeasuresCount + 1); + U_ASSERT(fListFormatter.isValid()); + + // Algorithm: + // + // For the mixed-units measurement of: "3 yard, 1 foot, 2.6 inch", we should + // find "3 yard" and "1 foot" in micros.mixedMeasures. + // + // Obtain long-names with plural forms corresponding to measure values: + // * {0} yards, {0} foot, {0} inches + // + // Format the integer values appropriately and modify with the format + // strings: + // - 3 yards, 1 foot + // + // Use ListFormatter to combine, with one placeholder: + // - 3 yards, 1 foot and {0} inches + // + // Return a SimpleModifier for this pattern, letting the rest of the + // pipeline take care of the remaining inches. + + LocalArray outputMeasuresList(new UnicodeString[fMixedUnitCount], status); + if (U_FAILURE(status)) { + return µs.helpers.emptyWeakModifier; + } + + for (int32_t i = 0; i < micros.mixedMeasuresCount; i++) { + DecimalQuantity fdec; + fdec.setToLong(micros.mixedMeasures[i]); + if (i > 0 && fdec.isNegative()) { + // If numbers are negative, only the first number needs to have its + // negative sign formatted. + fdec.negate(); + } + StandardPlural::Form pluralForm = utils::getStandardPlural(rules, fdec); + + UnicodeString simpleFormat = + getWithPlural(&fMixedUnitData[i * ARRAY_LENGTH], pluralForm, status); + SimpleFormatter compiledFormatter(simpleFormat, 0, 1, status); + + UnicodeString num; + auto appendable = UnicodeStringAppendable(num); + fIntegerFormatter.formatDecimalQuantity(fdec, status).appendTo(appendable, status); + compiledFormatter.format(num, outputMeasuresList[i], status); + // TODO(icu-units#67): fix field positions + } + + // Reiterated: we have at least one mixedMeasure: + U_ASSERT(micros.mixedMeasuresCount > 0); + // Thus if negative, a negative has already been formatted: + if (quantity.isNegative()) { + quantity.negate(); + } + + UnicodeString *finalSimpleFormats = &fMixedUnitData[(fMixedUnitCount - 1) * ARRAY_LENGTH]; + StandardPlural::Form finalPlural = utils::getPluralSafe(micros.rounder, rules, quantity, status); + UnicodeString finalSimpleFormat = getWithPlural(finalSimpleFormats, finalPlural, status); + SimpleFormatter finalFormatter(finalSimpleFormat, 0, 1, status); + finalFormatter.format(UnicodeString(u"{0}"), outputMeasuresList[fMixedUnitCount - 1], status); + + // Combine list into a "premixed" pattern + UnicodeString premixedFormatPattern; + fListFormatter->format(outputMeasuresList.getAlias(), fMixedUnitCount, premixedFormatPattern, + status); + SimpleFormatter premixedCompiled(premixedFormatPattern, 0, 1, status); + if (U_FAILURE(status)) { + return µs.helpers.emptyWeakModifier; + } + + // TODO(icu-units#67): fix field positions + // Return a SimpleModifier for the "premixed" pattern + micros.helpers.mixedUnitModifier = + SimpleModifier(premixedCompiled, kUndefinedField, false, {this, SIGNUM_POS_ZERO, finalPlural}); + return µs.helpers.mixedUnitModifier; +} + +const Modifier *MixedUnitLongNameHandler::getModifier(Signum /*signum*/, + StandardPlural::Form /*plural*/) const { + // TODO(units): investigate this method when investigating where + // LongNameHandler::getModifier() gets used. To be sure it remains + // unreachable: + UPRV_UNREACHABLE; + return nullptr; +} + +LongNameMultiplexer * +LongNameMultiplexer::forMeasureUnits(const Locale &loc, const MaybeStackVector &units, + const UNumberUnitWidth &width, const PluralRules *rules, + const MicroPropsGenerator *parent, UErrorCode &status) { + LocalPointer result(new LongNameMultiplexer(parent), status); + if (U_FAILURE(status)) { + return nullptr; + } + U_ASSERT(units.length() > 0); + if (result->fHandlers.resize(units.length()) == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return nullptr; + } + result->fMeasureUnits.adoptInstead(new MeasureUnit[units.length()]); + for (int32_t i = 0, length = units.length(); i < length; i++) { + const MeasureUnit& unit = *units[i]; + result->fMeasureUnits[i] = unit; + if (unit.getComplexity(status) == UMEASURE_UNIT_MIXED) { + MixedUnitLongNameHandler *mlnh = result->fMixedUnitHandlers.createAndCheckErrorCode(status); + MixedUnitLongNameHandler::forMeasureUnit(loc, unit, width, rules, NULL, mlnh, status); + result->fHandlers[i] = mlnh; + } else { + LongNameHandler *lnh = result->fLongNameHandlers.createAndCheckErrorCode(status); + LongNameHandler::forMeasureUnit(loc, unit, MeasureUnit(), width, rules, NULL, lnh, status); + result->fHandlers[i] = lnh; + } + if (U_FAILURE(status)) { + return nullptr; + } + } + return result.orphan(); +} + +void LongNameMultiplexer::processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const { + // We call parent->processQuantity() from the Multiplexer, instead of + // letting LongNameHandler handle it: we don't know which LongNameHandler to + // call until we've called the parent! + fParent->processQuantity(quantity, micros, status); + + // Call the correct LongNameHandler based on outputUnit + for (int i = 0; i < fHandlers.getCapacity(); i++) { + if (fMeasureUnits[i] == micros.outputUnit) { + fHandlers[i]->processQuantity(quantity, micros, status); + return; + } + } + if (U_FAILURE(status)) { + return; + } + // We shouldn't receive any outputUnit for which we haven't already got a + // LongNameHandler: + status = U_INTERNAL_PROGRAM_ERROR; +} + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/i18n/number_longnames.h b/deps/icu-small/source/i18n/number_longnames.h index a19425aa268af6..67f2316a9cd4bd 100644 --- a/deps/icu-small/source/i18n/number_longnames.h +++ b/deps/icu-small/source/i18n/number_longnames.h @@ -7,6 +7,8 @@ #ifndef __NUMBER_LONGNAMES_H__ #define __NUMBER_LONGNAMES_H__ +#include "cmemory.h" +#include "unicode/listformatter.h" #include "unicode/uversion.h" #include "number_utils.h" #include "number_modifiers.h" @@ -33,34 +35,206 @@ class LongNameHandler : public MicroPropsGenerator, public ModifierStore, public forCurrencyLongNames(const Locale &loc, const CurrencyUnit ¤cy, const PluralRules *rules, const MicroPropsGenerator *parent, UErrorCode &status); - static LongNameHandler* - forMeasureUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit, - const UNumberUnitWidth &width, const PluralRules *rules, - const MicroPropsGenerator *parent, UErrorCode &status); - + /** + * Construct a localized LongNameHandler for the specified MeasureUnit. + * + * Compound units can be constructed via `unit` and `perUnit`. Both of these + * must then be built-in units. + * + * Mixed units are not supported, use MixedUnitLongNameHandler::forMeasureUnit. + * + * This function uses a fillIn intead of returning a pointer, because we + * want to fill in instances in a MemoryPool (which cannot adopt pointers it + * didn't create itself). + * + * @param loc The desired locale. + * @param unit The measure unit to construct a LongNameHandler for. If + * `perUnit` is also defined, `unit` must not be a mixed unit. + * @param perUnit If `unit` is a mixed unit, `perUnit` must be "none". + * @param width Specifies the desired unit rendering. + * @param rules Does not take ownership. + * @param parent Does not take ownership. + * @param fillIn Required. + */ + static void forMeasureUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit, + const UNumberUnitWidth &width, const PluralRules *rules, + const MicroPropsGenerator *parent, LongNameHandler *fillIn, + UErrorCode &status); + + /** + * Selects the plural-appropriate Modifier from the set of fModifiers based + * on the plural form. + */ void processQuantity(DecimalQuantity &quantity, MicroProps µs, UErrorCode &status) const U_OVERRIDE; + // TODO(units): investigate whether we might run into Mixed Unit trouble + // with this. This override for ModifierStore::getModifier does not support + // mixed units: investigate under which circumstances it gets called (check + // both ImmutablePatternModifier and in NumberRangeFormatterImpl). const Modifier* getModifier(Signum signum, StandardPlural::Form plural) const U_OVERRIDE; private: + // A set of pre-computed modifiers, one for each plural form. SimpleModifier fModifiers[StandardPlural::Form::COUNT]; + // Not owned const PluralRules *rules; + // Not owned const MicroPropsGenerator *parent; LongNameHandler(const PluralRules *rules, const MicroPropsGenerator *parent) - : rules(rules), parent(parent) {} + : rules(rules), parent(parent) { + } - static LongNameHandler* - forCompoundUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit, - const UNumberUnitWidth &width, const PluralRules *rules, - const MicroPropsGenerator *parent, UErrorCode &status); + LongNameHandler() : rules(nullptr), parent(nullptr) { + } + + // Enables MemoryPool::emplaceBack(): requires access to + // the private constructors. + friend class MemoryPool; + + // Allow macrosToMicroGenerator to call the private default constructor. + friend class NumberFormatterImpl; + // Fills in LongNameHandler fields for formatting compound units identified + // via `unit` and `perUnit`. Both `unit` and `perUnit` need to be built-in + // units (for which data exists). + static void forCompoundUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit, + const UNumberUnitWidth &width, const PluralRules *rules, + const MicroPropsGenerator *parent, LongNameHandler *fillIn, + UErrorCode &status); + + // Sets fModifiers to use the patterns from `simpleFormats`. void simpleFormatsToModifiers(const UnicodeString *simpleFormats, Field field, UErrorCode &status); + + // Sets fModifiers to a combination of `leadFormats` (one per plural form) + // and `trailFormat` appended to each. + // + // With a leadFormat of "{0}m" and a trailFormat of "{0}/s", it produces a + // pattern of "{0}m/s" by inserting the leadFormat pattern into trailFormat. void multiSimpleFormatsToModifiers(const UnicodeString *leadFormats, UnicodeString trailFormat, Field field, UErrorCode &status); }; +// Similar to LongNameHandler, but only for MIXED units. +class MixedUnitLongNameHandler : public MicroPropsGenerator, public ModifierStore, public UMemory { + public: + /** + * Construct a localized MixedUnitLongNameHandler for the specified + * MeasureUnit. It must be a MIXED unit. + * + * This function uses a fillIn intead of returning a pointer, because we + * want to fill in instances in a MemoryPool (which cannot adopt pointers it + * didn't create itself). + * + * @param loc The desired locale. + * @param mixedUnit The mixed measure unit to construct a + * MixedUnitLongNameHandler for. + * @param width Specifies the desired unit rendering. + * @param rules Does not take ownership. + * @param parent Does not take ownership. + * @param fillIn Required. + */ + static void forMeasureUnit(const Locale &loc, const MeasureUnit &mixedUnit, + const UNumberUnitWidth &width, const PluralRules *rules, + const MicroPropsGenerator *parent, MixedUnitLongNameHandler *fillIn, + UErrorCode &status); + + /** + * Produces a plural-appropriate Modifier for a mixed unit: `quantity` is + * taken as the final smallest unit, while the larger unit values must be + * provided via `micros.mixedMeasures`. + */ + void processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const U_OVERRIDE; + + // Required for ModifierStore. And ModifierStore is required by + // SimpleModifier constructor's last parameter. We assert his will never get + // called though. + const Modifier *getModifier(Signum signum, StandardPlural::Form plural) const U_OVERRIDE; + + private: + // Not owned + const PluralRules *rules; + // Not owned + const MicroPropsGenerator *parent; + + // Total number of units in the MeasureUnit this handler was configured for: + // for "foot-and-inch", this will be 2. + int32_t fMixedUnitCount = 1; + // Stores unit data for each of the individual units. For each unit, it + // stores ARRAY_LENGTH strings, as returned by getMeasureData. (Each unit + // with index `i` has ARRAY_LENGTH strings starting at index + // `i*ARRAY_LENGTH` in this array.) + LocalArray fMixedUnitData; + // A localized NumberFormatter used to format the integer-valued bigger + // units of Mixed Unit measurements. + LocalizedNumberFormatter fIntegerFormatter; + // A localised list formatter for joining mixed units together. + LocalPointer fListFormatter; + + MixedUnitLongNameHandler(const PluralRules *rules, const MicroPropsGenerator *parent) + : rules(rules), parent(parent) { + } + + MixedUnitLongNameHandler() : rules(nullptr), parent(nullptr) { + } + + // Allow macrosToMicroGenerator to call the private default constructor. + friend class NumberFormatterImpl; + + // Enables MemoryPool::emplaceBack(): requires access to + // the private constructors. + friend class MemoryPool; + + // For a mixed unit, returns a Modifier that takes only one parameter: the + // smallest and final unit of the set. The bigger units' values and labels + // get baked into this Modifier, together with the unit label of the final + // unit. + const Modifier *getMixedUnitModifier(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const; +}; + +/** + * A MicroPropsGenerator that multiplexes between different LongNameHandlers, + * depending on the outputUnit. + * + * See processQuantity() for the input requirements. + */ +class LongNameMultiplexer : public MicroPropsGenerator, public UMemory { + public: + // Produces a multiplexer for LongNameHandlers, one for each unit in + // `units`. An individual unit might be a mixed unit. + static LongNameMultiplexer *forMeasureUnits(const Locale &loc, + const MaybeStackVector &units, + const UNumberUnitWidth &width, const PluralRules *rules, + const MicroPropsGenerator *parent, UErrorCode &status); + + // The output unit must be provided via `micros.outputUnit`, it must match + // one of the units provided to the factory function. + void processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const U_OVERRIDE; + + private: + /** + * Because we only know which LongNameHandler we wish to call after calling + * earlier MicroPropsGenerators in the chain, LongNameMultiplexer keeps the + * parent link, while the LongNameHandlers are given no parents. + */ + MemoryPool fLongNameHandlers; + MemoryPool fMixedUnitHandlers; + // Unowned pointers to instances owned by MaybeStackVectors. + MaybeStackArray fHandlers; + // Each MeasureUnit corresponds to the same-index MicroPropsGenerator + // pointed to in fHandlers. + LocalArray fMeasureUnits; + + const MicroPropsGenerator *fParent; + + LongNameMultiplexer(const MicroPropsGenerator *parent) : fParent(parent) { + } +}; + } // namespace impl } // namespace number U_NAMESPACE_END diff --git a/deps/icu-small/source/i18n/number_mapper.cpp b/deps/icu-small/source/i18n/number_mapper.cpp index ec617438c9a9e3..e2a0d284b7cf5d 100644 --- a/deps/icu-small/source/i18n/number_mapper.cpp +++ b/deps/icu-small/source/i18n/number_mapper.cpp @@ -92,6 +92,8 @@ MacroProps NumberPropertyMapper::oldToNew(const DecimalFormatProperties& propert int32_t minSig = properties.minimumSignificantDigits; int32_t maxSig = properties.maximumSignificantDigits; double roundingIncrement = properties.roundingIncrement; + // Not assigning directly to macros.roundingMode here: we change + // roundingMode if and when we also change macros.precision. RoundingMode roundingMode = properties.roundingMode.getOrDefault(UNUM_ROUND_HALFEVEN); bool explicitMinMaxFrac = minFrac != -1 || maxFrac != -1; bool explicitMinMaxSig = minSig != -1 || maxSig != -1; @@ -145,7 +147,7 @@ MacroProps NumberPropertyMapper::oldToNew(const DecimalFormatProperties& propert precision = Precision::constructCurrency(currencyUsage); } if (!precision.isBogus()) { - precision.fRoundingMode = roundingMode; + macros.roundingMode = roundingMode; macros.precision = precision; } @@ -239,7 +241,7 @@ MacroProps NumberPropertyMapper::oldToNew(const DecimalFormatProperties& propert // TODO: Reset maxSig_ = 1 + minFrac_ to follow the spec. macros.precision = Precision::constructSignificant(minSig_, maxSig_); } - macros.precision.fRoundingMode = roundingMode; + macros.roundingMode = roundingMode; } } diff --git a/deps/icu-small/source/i18n/number_mapper.h b/deps/icu-small/source/i18n/number_mapper.h index d18b8b3c438cf4..9ecd776b3b4795 100644 --- a/deps/icu-small/source/i18n/number_mapper.h +++ b/deps/icu-small/source/i18n/number_mapper.h @@ -136,6 +136,16 @@ class AutoAffixPatternProvider { } } + inline void setTo(const AffixPatternProvider* provider, UErrorCode& status) { + if (auto ptr = dynamic_cast(provider)) { + propertiesAPP = *ptr; + } else if (auto ptr = dynamic_cast(provider)) { + currencyPluralInfoAPP = *ptr; + } else { + status = U_INTERNAL_PROGRAM_ERROR; + } + } + inline const AffixPatternProvider& get() const { if (!currencyPluralInfoAPP.isBogus()) { return currencyPluralInfoAPP; @@ -153,9 +163,9 @@ class AutoAffixPatternProvider { /** * A struct for ownership of a few objects needed for formatting. */ -struct DecimalFormatWarehouse { +struct DecimalFormatWarehouse : public UMemory { AutoAffixPatternProvider affixProvider; - + LocalPointer rules; }; diff --git a/deps/icu-small/source/i18n/number_microprops.h b/deps/icu-small/source/i18n/number_microprops.h index 56512f5e6f94ac..058c5923b4567b 100644 --- a/deps/icu-small/source/i18n/number_microprops.h +++ b/deps/icu-small/source/i18n/number_microprops.h @@ -22,6 +22,56 @@ U_NAMESPACE_BEGIN namespace number { namespace impl { +/** + * A copyable container for the integer values of mixed unit measurements. + * + * If memory allocation fails during copying, no values are copied and status is + * set to U_MEMORY_ALLOCATION_ERROR. + */ +class IntMeasures : public MaybeStackArray { + public: + /** + * Default constructor initializes with internal T[stackCapacity] buffer. + * + * Stack Capacity: most mixed units are expected to consist of two or three + * subunits, so one or two integer measures should be enough. + */ + IntMeasures() : MaybeStackArray() { + } + + /** + * Copy constructor. + * + * If memory allocation fails during copying, no values are copied and + * status is set to U_MEMORY_ALLOCATION_ERROR. + */ + IntMeasures(const IntMeasures &other) : MaybeStackArray() { + this->operator=(other); + } + + // Assignment operator + IntMeasures &operator=(const IntMeasures &rhs) { + if (this == &rhs) { + return *this; + } + copyFrom(rhs, status); + return *this; + } + + /** Move constructor */ + IntMeasures(IntMeasures &&src) = default; + + /** Move assignment */ + IntMeasures &operator=(IntMeasures &&src) = default; + + UErrorCode status = U_ZERO_ERROR; +}; + +/** + * MicroProps is the first MicroPropsGenerator that should be should be called, + * producing an initialized MicroProps instance that will be passed on and + * modified throughout the rest of the chain of MicroPropsGenerator instances. + */ struct MicroProps : public MicroPropsGenerator { // NOTE: All of these fields are properly initialized in NumberFormatterImpl. @@ -36,19 +86,47 @@ struct MicroProps : public MicroPropsGenerator { // Note: This struct has no direct ownership of the following pointers. const DecimalFormatSymbols* symbols; + + // Pointers to Modifiers provided by the number formatting pipeline (when + // the value is known): + + // A Modifier provided by LongNameHandler, used for currency long names and + // units. If there is no LongNameHandler needed, this should be an + // EmptyModifier. (This is typically the third modifier applied.) const Modifier* modOuter; + // A Modifier for short currencies and compact notation. (This is typically + // the second modifier applied.) const Modifier* modMiddle = nullptr; + // A Modifier provided by ScientificHandler, used for scientific notation. + // This is typically the first modifier applied. const Modifier* modInner; // The following "helper" fields may optionally be used during the MicroPropsGenerator. // They live here to retain memory. struct { + // The ScientificModifier for which ScientificHandler is responsible. + // ScientificHandler::processQuantity() modifies this Modifier. ScientificModifier scientificModifier; + // EmptyModifier used for modOuter EmptyModifier emptyWeakModifier{false}; + // EmptyModifier used for modInner EmptyModifier emptyStrongModifier{true}; MultiplierFormatHandler multiplier; + // A Modifier used for Mixed Units. When formatting mixed units, + // LongNameHandler assigns this Modifier. + SimpleModifier mixedUnitModifier; } helpers; + // The MeasureUnit with which the output is represented. May also have + // UMEASURE_UNIT_MIXED complexity, in which case mixedMeasures comes into + // play. + MeasureUnit outputUnit; + + // In the case of mixed units, this is the set of integer-only units + // *preceding* the final unit. + IntMeasures mixedMeasures; + // Number of mixedMeasures that have been populated + int32_t mixedMeasuresCount = 0; MicroProps() = default; @@ -56,7 +134,23 @@ struct MicroProps : public MicroPropsGenerator { MicroProps& operator=(const MicroProps& other) = default; - void processQuantity(DecimalQuantity&, MicroProps& micros, UErrorCode& status) const U_OVERRIDE { + /** + * As MicroProps is the "base instance", this implementation of + * MicroPropsGenerator::processQuantity() just ensures that the output + * `micros` is correctly initialized. + * + * For the "safe" invocation of this function, micros must not be *this, + * such that a copy of the base instance is made. For the "unsafe" path, + * this function can be used only once, because the base MicroProps instance + * will be modified and thus not be available for re-use. + * + * @param quantity The quantity for consideration and optional mutation. + * @param micros The MicroProps instance to populate. If this parameter is + * not already `*this`, it will be overwritten with a copy of `*this`. + */ + void processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const U_OVERRIDE { + (void) quantity; (void) status; if (this == µs) { // Unsafe path: no need to perform a copy. @@ -65,6 +159,7 @@ struct MicroProps : public MicroPropsGenerator { U_ASSERT(exhausted); } else { // Safe path: copy self into the output micros. + U_ASSERT(!exhausted); micros = *this; } } diff --git a/deps/icu-small/source/i18n/number_modifiers.cpp b/deps/icu-small/source/i18n/number_modifiers.cpp index 3becb7ba852336..b7d825f499e4d2 100644 --- a/deps/icu-small/source/i18n/number_modifiers.cpp +++ b/deps/icu-small/source/i18n/number_modifiers.cpp @@ -25,13 +25,13 @@ const int32_t ARG_NUM_LIMIT = 0x100; icu::UInitOnce gDefaultCurrencySpacingInitOnce = U_INITONCE_INITIALIZER; UnicodeSet *UNISET_DIGIT = nullptr; -UnicodeSet *UNISET_NOTS = nullptr; +UnicodeSet *UNISET_NOTSZ = nullptr; UBool U_CALLCONV cleanupDefaultCurrencySpacing() { delete UNISET_DIGIT; UNISET_DIGIT = nullptr; - delete UNISET_NOTS; - UNISET_NOTS = nullptr; + delete UNISET_NOTSZ; + UNISET_NOTSZ = nullptr; gDefaultCurrencySpacingInitOnce.reset(); return TRUE; } @@ -39,13 +39,13 @@ UBool U_CALLCONV cleanupDefaultCurrencySpacing() { void U_CALLCONV initDefaultCurrencySpacing(UErrorCode &status) { ucln_i18n_registerCleanup(UCLN_I18N_CURRENCY_SPACING, cleanupDefaultCurrencySpacing); UNISET_DIGIT = new UnicodeSet(UnicodeString(u"[:digit:]"), status); - UNISET_NOTS = new UnicodeSet(UnicodeString(u"[:^S:]"), status); - if (UNISET_DIGIT == nullptr || UNISET_NOTS == nullptr) { + UNISET_NOTSZ = new UnicodeSet(UnicodeString(u"[[:^S:]&[:^Z:]]"), status); + if (UNISET_DIGIT == nullptr || UNISET_NOTSZ == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } UNISET_DIGIT->freeze(); - UNISET_NOTS->freeze(); + UNISET_NOTSZ->freeze(); } } // namespace @@ -469,8 +469,8 @@ CurrencySpacingEnabledModifier::getUnicodeSet(const DecimalFormatSymbols &symbol status); if (pattern.compare(u"[:digit:]", -1) == 0) { return *UNISET_DIGIT; - } else if (pattern.compare(u"[:^S:]", -1) == 0) { - return *UNISET_NOTS; + } else if (pattern.compare(u"[[:^S:]&[:^Z:]]", -1) == 0) { + return *UNISET_NOTSZ; } else { return UnicodeSet(pattern, status); } diff --git a/deps/icu-small/source/i18n/number_output.cpp b/deps/icu-small/source/i18n/number_output.cpp index 40192a9225b9de..7129b94e0f86e4 100644 --- a/deps/icu-small/source/i18n/number_output.cpp +++ b/deps/icu-small/source/i18n/number_output.cpp @@ -5,11 +5,13 @@ #if !UCONFIG_NO_FORMATTING +#include "unicode/measunit.h" #include "unicode/numberformatter.h" #include "number_utypes.h" #include "util.h" #include "number_decimalquantity.h" #include "number_decnum.h" +#include "numrange_impl.h" U_NAMESPACE_BEGIN namespace number { @@ -32,6 +34,11 @@ void FormattedNumber::getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpi fData->getAllFieldPositions(fpih, status); } +MeasureUnit FormattedNumber::getOutputUnit(UErrorCode& status) const { + UPRV_FORMATTED_VALUE_METHOD_GUARD(MeasureUnit()) + return fData->outputUnit; +} + void FormattedNumber::getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const { UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG) output = fData->quantity; @@ -41,6 +48,42 @@ void FormattedNumber::getDecimalQuantity(impl::DecimalQuantity& output, UErrorCo impl::UFormattedNumberData::~UFormattedNumberData() = default; +UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumberRange) + +#define UPRV_NOARG + +UnicodeString FormattedNumberRange::getFirstDecimal(UErrorCode& status) const { + UPRV_FORMATTED_VALUE_METHOD_GUARD(ICU_Utility::makeBogusString()) + return fData->quantity1.toScientificString(); +} + +UnicodeString FormattedNumberRange::getSecondDecimal(UErrorCode& status) const { + UPRV_FORMATTED_VALUE_METHOD_GUARD(ICU_Utility::makeBogusString()) + return fData->quantity2.toScientificString(); +} + +void FormattedNumberRange::getDecimalNumbers(ByteSink& sink1, ByteSink& sink2, UErrorCode& status) const { + UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG) + impl::DecNum decnum1; + impl::DecNum decnum2; + fData->quantity1.toDecNum(decnum1, status).toString(sink1, status); + fData->quantity2.toDecNum(decnum2, status).toString(sink2, status); +} + +UNumberRangeIdentityResult FormattedNumberRange::getIdentityResult(UErrorCode& status) const { + UPRV_FORMATTED_VALUE_METHOD_GUARD(UNUM_IDENTITY_RESULT_NOT_EQUAL) + return fData->identityResult; +} + +const impl::UFormattedNumberRangeData* FormattedNumberRange::getData(UErrorCode& status) const { + UPRV_FORMATTED_VALUE_METHOD_GUARD(nullptr) + return fData; +} + + +impl::UFormattedNumberRangeData::~UFormattedNumberRangeData() = default; + + } // namespace number U_NAMESPACE_END diff --git a/deps/icu-small/source/i18n/number_patternmodifier.cpp b/deps/icu-small/source/i18n/number_patternmodifier.cpp index 45602942aefe8e..314e7cb75ee169 100644 --- a/deps/icu-small/source/i18n/number_patternmodifier.cpp +++ b/deps/icu-small/source/i18n/number_patternmodifier.cpp @@ -294,14 +294,20 @@ UnicodeString MutablePatternModifier::getSymbol(AffixPatternType type) const { case AffixPatternType::TYPE_PERMILLE: return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPerMillSymbol); case AffixPatternType::TYPE_CURRENCY_SINGLE: { - // UnitWidth ISO and HIDDEN overrides the singular currency symbol. - if (fUnitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_ISO_CODE) { + switch (fUnitWidth) { + case UNumberUnitWidth::UNUM_UNIT_WIDTH_NARROW: + return fCurrencySymbols.getNarrowCurrencySymbol(localStatus); + case UNumberUnitWidth::UNUM_UNIT_WIDTH_SHORT: + return fCurrencySymbols.getCurrencySymbol(localStatus); + case UNumberUnitWidth::UNUM_UNIT_WIDTH_ISO_CODE: return fCurrencySymbols.getIntlCurrencySymbol(localStatus); - } else if (fUnitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_HIDDEN) { + case UNumberUnitWidth::UNUM_UNIT_WIDTH_FORMAL: + return fCurrencySymbols.getFormalCurrencySymbol(localStatus); + case UNumberUnitWidth::UNUM_UNIT_WIDTH_VARIANT: + return fCurrencySymbols.getVariantCurrencySymbol(localStatus); + case UNumberUnitWidth::UNUM_UNIT_WIDTH_HIDDEN: return UnicodeString(); - } else if (fUnitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_NARROW) { - return fCurrencySymbols.getNarrowCurrencySymbol(localStatus); - } else { + default: return fCurrencySymbols.getCurrencySymbol(localStatus); } } diff --git a/deps/icu-small/source/i18n/number_rounding.cpp b/deps/icu-small/source/i18n/number_rounding.cpp index 3ffce673ad0885..a8fd6bc892a8a5 100644 --- a/deps/icu-small/source/i18n/number_rounding.cpp +++ b/deps/icu-small/source/i18n/number_rounding.cpp @@ -5,13 +5,16 @@ #if !UCONFIG_NO_FORMATTING +#include "charstr.h" #include "uassert.h" #include "unicode/numberformatter.h" #include "number_types.h" #include "number_decimalquantity.h" #include "double-conversion.h" #include "number_roundingutils.h" +#include "number_skeletons.h" #include "putilimp.h" +#include "string_segment.h" using namespace icu; using namespace icu::number; @@ -19,6 +22,39 @@ using namespace icu::number::impl; using double_conversion::DoubleToStringConverter; +using icu::StringSegment; + +void number::impl::parseIncrementOption(const StringSegment &segment, + Precision &outPrecision, + UErrorCode &status) { + // Need to do char <-> UChar conversion... + U_ASSERT(U_SUCCESS(status)); + CharString buffer; + SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status); + + // Utilize DecimalQuantity/decNumber to parse this for us. + DecimalQuantity dq; + UErrorCode localStatus = U_ZERO_ERROR; + dq.setToDecNumber({buffer.data(), buffer.length()}, localStatus); + if (U_FAILURE(localStatus)) { + // throw new SkeletonSyntaxException("Invalid rounding increment", segment, e); + status = U_NUMBER_SKELETON_SYNTAX_ERROR; + return; + } + double increment = dq.toDouble(); + + // We also need to figure out how many digits. Do a brute force string operation. + int decimalOffset = 0; + while (decimalOffset < segment.length() && segment.charAt(decimalOffset) != '.') { + decimalOffset++; + } + if (decimalOffset == segment.length()) { + outPrecision = Precision::increment(increment); + } else { + int32_t fractionLength = segment.length() - decimalOffset - 1; + outPrecision = Precision::increment(increment).withMinFraction(fractionLength); + } +} namespace { @@ -84,7 +120,7 @@ digits_t roundingutils::doubleFractionLength(double input, int8_t* singleDigit) Precision Precision::unlimited() { - return Precision(RND_NONE, {}, kDefaultMode); + return Precision(RND_NONE, {}); } FractionPrecision Precision::integer() { @@ -229,7 +265,7 @@ FractionPrecision Precision::constructFraction(int32_t minFrac, int32_t maxFrac) settings.fMaxSig = -1; PrecisionUnion union_; union_.fracSig = settings; - return {RND_FRACTION, union_, kDefaultMode}; + return {RND_FRACTION, union_}; } Precision Precision::constructSignificant(int32_t minSig, int32_t maxSig) { @@ -240,7 +276,7 @@ Precision Precision::constructSignificant(int32_t minSig, int32_t maxSig) { settings.fMaxSig = static_cast(maxSig); PrecisionUnion union_; union_.fracSig = settings; - return {RND_SIGNIFICANT, union_, kDefaultMode}; + return {RND_SIGNIFICANT, union_}; } Precision @@ -250,7 +286,7 @@ Precision::constructFractionSignificant(const FractionPrecision &base, int32_t m settings.fMaxSig = static_cast(maxSig); PrecisionUnion union_; union_.fracSig = settings; - return {RND_FRACTION_SIGNIFICANT, union_, kDefaultMode}; + return {RND_FRACTION_SIGNIFICANT, union_}; } IncrementPrecision Precision::constructIncrement(double increment, int32_t minFrac) { @@ -270,18 +306,18 @@ IncrementPrecision Precision::constructIncrement(double increment, int32_t minFr // NOTE: In C++, we must return the correct value type with the correct union. // It would be invalid to return a RND_FRACTION here because the methods on the // IncrementPrecision type assume that the union is backed by increment data. - return {RND_INCREMENT_ONE, union_, kDefaultMode}; + return {RND_INCREMENT_ONE, union_}; } else if (singleDigit == 5) { - return {RND_INCREMENT_FIVE, union_, kDefaultMode}; + return {RND_INCREMENT_FIVE, union_}; } else { - return {RND_INCREMENT, union_, kDefaultMode}; + return {RND_INCREMENT, union_}; } } CurrencyPrecision Precision::constructCurrency(UCurrencyUsage usage) { PrecisionUnion union_; union_.currencyUsage = usage; - return {RND_CURRENCY, union_, kDefaultMode}; + return {RND_CURRENCY, union_}; } @@ -341,6 +377,9 @@ RoundingImpl::chooseMultiplierAndApply(impl::DecimalQuantity &input, const impl: /** This is the method that contains the actual rounding logic. */ void RoundingImpl::apply(impl::DecimalQuantity &value, UErrorCode& status) const { + if (U_FAILURE(status)) { + return; + } if (fPassThrough) { return; } diff --git a/deps/icu-small/source/i18n/number_roundingutils.h b/deps/icu-small/source/i18n/number_roundingutils.h index 3e37f3195408fe..e85cbae9fdd2ea 100644 --- a/deps/icu-small/source/i18n/number_roundingutils.h +++ b/deps/icu-small/source/i18n/number_roundingutils.h @@ -8,6 +8,7 @@ #define __NUMBER_ROUNDINGUTILS_H__ #include "number_types.h" +#include "string_segment.h" U_NAMESPACE_BEGIN namespace number { @@ -44,6 +45,9 @@ enum Section { inline bool getRoundingDirection(bool isEven, bool isNegative, Section section, RoundingMode roundingMode, UErrorCode &status) { + if (U_FAILURE(status)) { + return false; + } switch (roundingMode) { case RoundingMode::UNUM_ROUND_UP: // round away from zero @@ -187,8 +191,22 @@ class RoundingImpl { Precision fPrecision; UNumberFormatRoundingMode fRoundingMode; bool fPassThrough = true; // default value + + // Permits access to fPrecision. + friend class units::UnitsRouter; + + // Permits access to fPrecision. + friend class UnitConversionHandler; }; +/** + * Parses Precision-related skeleton strings without knowledge of MacroProps + * - see blueprint_helpers::parseIncrementOption(). + * + * Referencing MacroProps means needing to pull in the .o files that have the + * destructors for the SymbolsWrapper, Usage, and Scale classes. + */ +void parseIncrementOption(const StringSegment &segment, Precision &outPrecision, UErrorCode &status); } // namespace impl } // namespace number diff --git a/deps/icu-small/source/i18n/number_skeletons.cpp b/deps/icu-small/source/i18n/number_skeletons.cpp index 4ba2647986c755..e6d94d27b2ba5b 100644 --- a/deps/icu-small/source/i18n/number_skeletons.cpp +++ b/deps/icu-small/source/i18n/number_skeletons.cpp @@ -10,6 +10,7 @@ #define UNISTR_FROM_STRING_EXPLICIT #include "number_decnum.h" +#include "number_roundingutils.h" #include "number_skeletons.h" #include "umutex.h" #include "ucln_in.h" @@ -80,6 +81,8 @@ void U_CALLCONV initNumberSkeletons(UErrorCode& status) { b.add(u"unit-width-short", STEM_UNIT_WIDTH_SHORT, status); b.add(u"unit-width-full-name", STEM_UNIT_WIDTH_FULL_NAME, status); b.add(u"unit-width-iso-code", STEM_UNIT_WIDTH_ISO_CODE, status); + b.add(u"unit-width-formal", STEM_UNIT_WIDTH_FORMAL, status); + b.add(u"unit-width-variant", STEM_UNIT_WIDTH_VARIANT, status); b.add(u"unit-width-hidden", STEM_UNIT_WIDTH_HIDDEN, status); b.add(u"sign-auto", STEM_SIGN_AUTO, status); b.add(u"sign-always", STEM_SIGN_ALWAYS, status); @@ -97,6 +100,7 @@ void U_CALLCONV initNumberSkeletons(UErrorCode& status) { b.add(u"measure-unit", STEM_MEASURE_UNIT, status); b.add(u"per-measure-unit", STEM_PER_MEASURE_UNIT, status); b.add(u"unit", STEM_UNIT, status); + b.add(u"usage", STEM_UNIT_USAGE, status); b.add(u"currency", STEM_CURRENCY, status); b.add(u"integer-width", STEM_INTEGER_WIDTH, status); b.add(u"numbering-system", STEM_NUMBERING_SYSTEM, status); @@ -149,21 +153,6 @@ UPRV_BLOCK_MACRO_BEGIN { \ } UPRV_BLOCK_MACRO_END -#define SKELETON_UCHAR_TO_CHAR(dest, src, start, end, status) (void)(dest); \ -UPRV_BLOCK_MACRO_BEGIN { \ - UErrorCode conversionStatus = U_ZERO_ERROR; \ - (dest).appendInvariantChars({FALSE, (src).getBuffer() + (start), (end) - (start)}, conversionStatus); \ - if (conversionStatus == U_INVARIANT_CONVERSION_ERROR) { \ - /* Don't propagate the invariant conversion error; it is a skeleton syntax error */ \ - (status) = U_NUMBER_SKELETON_SYNTAX_ERROR; \ - return; \ - } else if (U_FAILURE(conversionStatus)) { \ - (status) = conversionStatus; \ - return; \ - } \ -} UPRV_BLOCK_MACRO_END - - } // anonymous namespace @@ -187,14 +176,11 @@ Notation stem_to_object::notation(skeleton::StemEnum stem) { MeasureUnit stem_to_object::unit(skeleton::StemEnum stem) { switch (stem) { case STEM_BASE_UNIT: - // Slicing is okay - return NoUnit::base(); // NOLINT + return MeasureUnit(); case STEM_PERCENT: - // Slicing is okay - return NoUnit::percent(); // NOLINT + return MeasureUnit::getPercent(); case STEM_PERMILLE: - // Slicing is okay - return NoUnit::permille(); // NOLINT + return MeasureUnit::getPermille(); default: UPRV_UNREACHABLE; } @@ -265,6 +251,10 @@ UNumberUnitWidth stem_to_object::unitWidth(skeleton::StemEnum stem) { return UNUM_UNIT_WIDTH_FULL_NAME; case STEM_UNIT_WIDTH_ISO_CODE: return UNUM_UNIT_WIDTH_ISO_CODE; + case STEM_UNIT_WIDTH_FORMAL: + return UNUM_UNIT_WIDTH_FORMAL; + case STEM_UNIT_WIDTH_VARIANT: + return UNUM_UNIT_WIDTH_VARIANT; case STEM_UNIT_WIDTH_HIDDEN: return UNUM_UNIT_WIDTH_HIDDEN; default: @@ -372,6 +362,12 @@ void enum_to_stem_string::unitWidth(UNumberUnitWidth value, UnicodeString& sb) { case UNUM_UNIT_WIDTH_ISO_CODE: sb.append(u"unit-width-iso-code", -1); break; + case UNUM_UNIT_WIDTH_FORMAL: + sb.append(u"unit-width-formal", -1); + break; + case UNUM_UNIT_WIDTH_VARIANT: + sb.append(u"unit-width-variant", -1); + break; case UNUM_UNIT_WIDTH_HIDDEN: sb.append(u"unit-width-hidden", -1); break; @@ -470,6 +466,7 @@ UnicodeString skeleton::generate(const MacroProps& macros, UErrorCode& status) { MacroProps skeleton::parseSkeleton( const UnicodeString& skeletonString, int32_t& errOffset, UErrorCode& status) { U_ASSERT(U_SUCCESS(status)); + U_ASSERT(kSerializedStemTrie != nullptr); // Add a trailing whitespace to the end of the skeleton string to make code cleaner. UnicodeString tempSkeletonString(skeletonString); @@ -550,6 +547,7 @@ MacroProps skeleton::parseSkeleton( case STATE_MEASURE_UNIT: case STATE_PER_MEASURE_UNIT: case STATE_IDENTIFIER_UNIT: + case STATE_UNIT_USAGE: case STATE_CURRENCY_UNIT: case STATE_INTEGER_WIDTH: case STATE_NUMBERING_SYSTEM: @@ -575,6 +573,8 @@ MacroProps skeleton::parseSkeleton( ParseState skeleton::parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, SeenMacroProps& seen, MacroProps& macros, UErrorCode& status) { + U_ASSERT(U_SUCCESS(status)); + // First check for "blueprint" stems, which start with a "signal char" switch (segment.charAt(0)) { case u'.': @@ -683,6 +683,8 @@ skeleton::parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, Se case STEM_UNIT_WIDTH_SHORT: case STEM_UNIT_WIDTH_FULL_NAME: case STEM_UNIT_WIDTH_ISO_CODE: + case STEM_UNIT_WIDTH_FORMAL: + case STEM_UNIT_WIDTH_VARIANT: case STEM_UNIT_WIDTH_HIDDEN: CHECK_NULL(seen, unitWidth, status); macros.unitWidth = stem_to_object::unitWidth(stem); @@ -705,7 +707,7 @@ skeleton::parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, Se macros.decimal = stem_to_object::decimalSeparatorDisplay(stem); return STATE_NULL; - // Stems requiring an option: + // Stems requiring an option: case STEM_PRECISION_INCREMENT: CHECK_NULL(seen, precision, status); @@ -724,6 +726,10 @@ skeleton::parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, Se CHECK_NULL(seen, perUnit, status); return STATE_IDENTIFIER_UNIT; + case STEM_UNIT_USAGE: + CHECK_NULL(seen, usage, status); + return STATE_UNIT_USAGE; + case STEM_CURRENCY: CHECK_NULL(seen, unit, status); return STATE_CURRENCY_UNIT; @@ -747,6 +753,7 @@ skeleton::parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, Se ParseState skeleton::parseOption(ParseState stem, const StringSegment& segment, MacroProps& macros, UErrorCode& status) { + U_ASSERT(U_SUCCESS(status)); ///// Required options: ///// @@ -763,6 +770,9 @@ ParseState skeleton::parseOption(ParseState stem, const StringSegment& segment, case STATE_IDENTIFIER_UNIT: blueprint_helpers::parseIdentifierUnitOption(segment, macros, status); return STATE_NULL; + case STATE_UNIT_USAGE: + blueprint_helpers::parseUnitUsageOption(segment, macros, status); + return STATE_NULL; case STATE_INCREMENT_PRECISION: blueprint_helpers::parseIncrementOption(segment, macros, status); return STATE_NULL; @@ -833,7 +843,7 @@ void GeneratorHelpers::generateSkeleton(const MacroProps& macros, UnicodeString& sb.append(u' '); } if (U_FAILURE(status)) { return; } - if (GeneratorHelpers::perUnit(macros, sb, status)) { + if (GeneratorHelpers::usage(macros, sb, status)) { sb.append(u' '); } if (U_FAILURE(status)) { return; } @@ -968,6 +978,7 @@ blueprint_helpers::generateCurrencyOption(const CurrencyUnit& currency, UnicodeS void blueprint_helpers::parseMeasureUnitOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status) { + U_ASSERT(U_SUCCESS(status)); const UnicodeString stemString = segment.toTempUnicodeString(); // NOTE: The category (type) of the unit is guaranteed to be a valid subtag (alphanumeric) @@ -983,14 +994,13 @@ void blueprint_helpers::parseMeasureUnitOption(const StringSegment& segment, Mac } // Need to do char <-> UChar conversion... - U_ASSERT(U_SUCCESS(status)); CharString type; SKELETON_UCHAR_TO_CHAR(type, stemString, 0, firstHyphen, status); CharString subType; SKELETON_UCHAR_TO_CHAR(subType, stemString, firstHyphen + 1, stemString.length(), status); - // Note: the largest type as of this writing (March 2018) is "volume", which has 24 units. - static constexpr int32_t CAPACITY = 30; + // Note: the largest type as of this writing (Aug 2020) is "volume", which has 33 units. + static constexpr int32_t CAPACITY = 40; MeasureUnit units[CAPACITY]; UErrorCode localStatus = U_ZERO_ERROR; int32_t numUnits = MeasureUnit::getAvailable(type.data(), units, CAPACITY, localStatus); @@ -1011,14 +1021,6 @@ void blueprint_helpers::parseMeasureUnitOption(const StringSegment& segment, Mac status = U_NUMBER_SKELETON_SYNTAX_ERROR; } -void blueprint_helpers::generateMeasureUnitOption(const MeasureUnit& measureUnit, UnicodeString& sb, - UErrorCode&) { - // Need to do char <-> UChar conversion... - sb.append(UnicodeString(measureUnit.getType(), -1, US_INV)); - sb.append(u'-'); - sb.append(UnicodeString(measureUnit.getSubtype(), -1, US_INV)); -} - void blueprint_helpers::parseMeasurePerUnitOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status) { // A little bit of a hack: save the current unit (numerator), call the main measure unit @@ -1045,6 +1047,20 @@ void blueprint_helpers::parseIdentifierUnitOption(const StringSegment& segment, return; } + // Mixed units can only be represented by full MeasureUnit instances, so we + // don't split the denominator into macros.perUnit. + if (fullUnit.complexity == UMEASURE_UNIT_MIXED) { + macros.unit = std::move(fullUnit).build(status); + return; + } + + // When we have a built-in unit (e.g. meter-per-second), we don't split it up + MeasureUnit testBuiltin = fullUnit.copy(status).build(status); + if (uprv_strcmp(testBuiltin.getType(), "") != 0) { + macros.unit = std::move(testBuiltin); + return; + } + // TODO(ICU-20941): Clean this up. for (int32_t i = 0; i < fullUnit.units.length(); i++) { SingleUnitImpl* subUnit = fullUnit.units[i]; @@ -1057,6 +1073,17 @@ void blueprint_helpers::parseIdentifierUnitOption(const StringSegment& segment, } } +void blueprint_helpers::parseUnitUsageOption(const StringSegment &segment, MacroProps ¯os, + UErrorCode &status) { + // Need to do char <-> UChar conversion... + U_ASSERT(U_SUCCESS(status)); + CharString buffer; + SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status); + macros.usage.set(buffer.toStringPiece()); + // We do not do any validation of the usage string: it depends on the + // unitPreferenceData in the units resources. +} + void blueprint_helpers::parseFractionStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status) { U_ASSERT(segment.charAt(0) == u'.'); @@ -1301,35 +1328,9 @@ bool blueprint_helpers::parseFracSigOption(const StringSegment& segment, MacroPr return true; } -void blueprint_helpers::parseIncrementOption(const StringSegment& segment, MacroProps& macros, - UErrorCode& status) { - // Need to do char <-> UChar conversion... - U_ASSERT(U_SUCCESS(status)); - CharString buffer; - SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status); - - // Utilize DecimalQuantity/decNumber to parse this for us. - DecimalQuantity dq; - UErrorCode localStatus = U_ZERO_ERROR; - dq.setToDecNumber({buffer.data(), buffer.length()}, localStatus); - if (U_FAILURE(localStatus)) { - // throw new SkeletonSyntaxException("Invalid rounding increment", segment, e); - status = U_NUMBER_SKELETON_SYNTAX_ERROR; - return; - } - double increment = dq.toDouble(); - - // We also need to figure out how many digits. Do a brute force string operation. - int decimalOffset = 0; - while (decimalOffset < segment.length() && segment.charAt(decimalOffset) != '.') { - decimalOffset++; - } - if (decimalOffset == segment.length()) { - macros.precision = Precision::increment(increment); - } else { - int32_t fractionLength = segment.length() - decimalOffset - 1; - macros.precision = Precision::increment(increment).withMinFraction(fractionLength); - } +void blueprint_helpers::parseIncrementOption(const StringSegment &segment, MacroProps ¯os, + UErrorCode &status) { + number::impl::parseIncrementOption(segment, macros.precision, status); } void blueprint_helpers::generateIncrementOption(double increment, int32_t trailingZeros, UnicodeString& sb, @@ -1507,42 +1508,37 @@ bool GeneratorHelpers::unit(const MacroProps& macros, UnicodeString& sb, UErrorC } blueprint_helpers::generateCurrencyOption(currency, sb, status); return true; - } else if (utils::unitIsNoUnit(macros.unit)) { - if (utils::unitIsPercent(macros.unit)) { - sb.append(u"percent", -1); - return true; - } else if (utils::unitIsPermille(macros.unit)) { - sb.append(u"permille", -1); - return true; - } else { - // Default value is not shown in normalized form + } else if (utils::unitIsBaseUnit(macros.unit)) { + // Default value is not shown in normalized form + return false; + } else if (utils::unitIsPercent(macros.unit)) { + sb.append(u"percent", -1); + return true; + } else if (utils::unitIsPermille(macros.unit)) { + sb.append(u"permille", -1); + return true; + } else { + MeasureUnit unit = macros.unit; + if (utils::unitIsCurrency(macros.perUnit)) { + status = U_UNSUPPORTED_ERROR; return false; } - } else { - sb.append(u"measure-unit/", -1); - blueprint_helpers::generateMeasureUnitOption(macros.unit, sb, status); + if (!utils::unitIsBaseUnit(macros.perUnit)) { + unit = unit.product(macros.perUnit.reciprocal(status), status); + } + sb.append(u"unit/", -1); + sb.append(unit.getIdentifier()); return true; } } -bool GeneratorHelpers::perUnit(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) { - // Per-units are currently expected to be only MeasureUnits. - if (utils::unitIsNoUnit(macros.perUnit)) { - if (utils::unitIsPercent(macros.perUnit) || utils::unitIsPermille(macros.perUnit)) { - status = U_UNSUPPORTED_ERROR; - return false; - } else { - // Default value: ok to ignore - return false; - } - } else if (utils::unitIsCurrency(macros.perUnit)) { - status = U_UNSUPPORTED_ERROR; - return false; - } else { - sb.append(u"per-measure-unit/", -1); - blueprint_helpers::generateMeasureUnitOption(macros.perUnit, sb, status); +bool GeneratorHelpers::usage(const MacroProps& macros, UnicodeString& sb, UErrorCode& /* status */) { + if (macros.usage.isSet()) { + sb.append(u"usage/", -1); + sb.append(UnicodeString(macros.usage.fUsage, -1, US_INV)); return true; } + return false; } bool GeneratorHelpers::precision(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) { diff --git a/deps/icu-small/source/i18n/number_skeletons.h b/deps/icu-small/source/i18n/number_skeletons.h index d9b2c0ee0b19ab..201267e635cd6a 100644 --- a/deps/icu-small/source/i18n/number_skeletons.h +++ b/deps/icu-small/source/i18n/number_skeletons.h @@ -22,10 +22,12 @@ struct SeenMacroProps; // namespace for enums and entrypoint functions namespace skeleton { -/////////////////////////////////////////////////////////////////////////////////////// -// NOTE: For an example of how to add a new stem to the number skeleton parser, see: // -// http://bugs.icu-project.org/trac/changeset/41193 // -/////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////// +// NOTE: For examples of how to add a new stem to the number skeleton parser, see: // +// https://github.com/unicode-org/icu/commit/a2a7982216b2348070dc71093775ac7195793d73 // +// and // +// https://github.com/unicode-org/icu/commit/6fe86f3934a8a5701034f648a8f7c5087e84aa28 // +//////////////////////////////////////////////////////////////////////////////////////// /** * While parsing a skeleton, this enum records what type of option we expect to find next. @@ -47,6 +49,7 @@ enum ParseState { STATE_MEASURE_UNIT, STATE_PER_MEASURE_UNIT, STATE_IDENTIFIER_UNIT, + STATE_UNIT_USAGE, STATE_CURRENCY_UNIT, STATE_INTEGER_WIDTH, STATE_NUMBERING_SYSTEM, @@ -95,6 +98,8 @@ enum StemEnum { STEM_UNIT_WIDTH_SHORT, STEM_UNIT_WIDTH_FULL_NAME, STEM_UNIT_WIDTH_ISO_CODE, + STEM_UNIT_WIDTH_FORMAL, + STEM_UNIT_WIDTH_VARIANT, STEM_UNIT_WIDTH_HIDDEN, STEM_SIGN_AUTO, STEM_SIGN_ALWAYS, @@ -112,6 +117,7 @@ enum StemEnum { STEM_MEASURE_UNIT, STEM_PER_MEASURE_UNIT, STEM_UNIT, + STEM_UNIT_USAGE, STEM_CURRENCY, STEM_INTEGER_WIDTH, STEM_NUMBERING_SYSTEM, @@ -234,14 +240,20 @@ void parseCurrencyOption(const StringSegment& segment, MacroProps& macros, UErro void generateCurrencyOption(const CurrencyUnit& currency, UnicodeString& sb, UErrorCode& status); +// "measure-unit/" is deprecated in favour of "unit/". void parseMeasureUnitOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status); -void generateMeasureUnitOption(const MeasureUnit& measureUnit, UnicodeString& sb, UErrorCode& status); - +// "per-measure-unit/" is deprecated in favour of "unit/". void parseMeasurePerUnitOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status); +/** + * Parses unit identifiers like "meter-per-second" and "foot-and-inch", as + * specified via a "unit/" concise skeleton. + */ void parseIdentifierUnitOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status); +void parseUnitUsageOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status); + void parseFractionStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status); void generateFractionStem(int32_t minFrac, int32_t maxFrac, UnicodeString& sb, UErrorCode& status); @@ -302,7 +314,7 @@ class GeneratorHelpers { static bool unit(const MacroProps& macros, UnicodeString& sb, UErrorCode& status); - static bool perUnit(const MacroProps& macros, UnicodeString& sb, UErrorCode& status); + static bool usage(const MacroProps& macros, UnicodeString& sb, UErrorCode& status); static bool precision(const MacroProps& macros, UnicodeString& sb, UErrorCode& status); @@ -332,6 +344,7 @@ struct SeenMacroProps { bool notation = false; bool unit = false; bool perUnit = false; + bool usage = false; bool precision = false; bool roundingMode = false; bool grouper = false; @@ -344,6 +357,24 @@ struct SeenMacroProps { bool scale = false; }; +namespace { + +#define SKELETON_UCHAR_TO_CHAR(dest, src, start, end, status) (void)(dest); \ +UPRV_BLOCK_MACRO_BEGIN { \ + UErrorCode conversionStatus = U_ZERO_ERROR; \ + (dest).appendInvariantChars({false, (src).getBuffer() + (start), (end) - (start)}, conversionStatus); \ + if (conversionStatus == U_INVARIANT_CONVERSION_ERROR) { \ + /* Don't propagate the invariant conversion error; it is a skeleton syntax error */ \ + (status) = U_NUMBER_SKELETON_SYNTAX_ERROR; \ + return; \ + } else if (U_FAILURE(conversionStatus)) { \ + (status) = conversionStatus; \ + return; \ + } \ +} UPRV_BLOCK_MACRO_END + +} // namespace + } // namespace impl } // namespace number U_NAMESPACE_END diff --git a/deps/icu-small/source/i18n/number_symbolswrapper.cpp b/deps/icu-small/source/i18n/number_symbolswrapper.cpp new file mode 100644 index 00000000000000..ac3043d1ca11c2 --- /dev/null +++ b/deps/icu-small/source/i18n/number_symbolswrapper.cpp @@ -0,0 +1,131 @@ +// © 2020 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "number_microprops.h" +#include "unicode/numberformatter.h" + +using namespace icu; +using namespace icu::number; +using namespace icu::number::impl; + +SymbolsWrapper::SymbolsWrapper(const SymbolsWrapper &other) { + doCopyFrom(other); +} + +SymbolsWrapper::SymbolsWrapper(SymbolsWrapper &&src) U_NOEXCEPT { + doMoveFrom(std::move(src)); +} + +SymbolsWrapper &SymbolsWrapper::operator=(const SymbolsWrapper &other) { + if (this == &other) { + return *this; + } + doCleanup(); + doCopyFrom(other); + return *this; +} + +SymbolsWrapper &SymbolsWrapper::operator=(SymbolsWrapper &&src) U_NOEXCEPT { + if (this == &src) { + return *this; + } + doCleanup(); + doMoveFrom(std::move(src)); + return *this; +} + +SymbolsWrapper::~SymbolsWrapper() { + doCleanup(); +} + +void SymbolsWrapper::setTo(const DecimalFormatSymbols &dfs) { + doCleanup(); + fType = SYMPTR_DFS; + fPtr.dfs = new DecimalFormatSymbols(dfs); +} + +void SymbolsWrapper::setTo(const NumberingSystem *ns) { + doCleanup(); + fType = SYMPTR_NS; + fPtr.ns = ns; +} + +void SymbolsWrapper::doCopyFrom(const SymbolsWrapper &other) { + fType = other.fType; + switch (fType) { + case SYMPTR_NONE: + // No action necessary + break; + case SYMPTR_DFS: + // Memory allocation failures are exposed in copyErrorTo() + if (other.fPtr.dfs != nullptr) { + fPtr.dfs = new DecimalFormatSymbols(*other.fPtr.dfs); + } else { + fPtr.dfs = nullptr; + } + break; + case SYMPTR_NS: + // Memory allocation failures are exposed in copyErrorTo() + if (other.fPtr.ns != nullptr) { + fPtr.ns = new NumberingSystem(*other.fPtr.ns); + } else { + fPtr.ns = nullptr; + } + break; + } +} + +void SymbolsWrapper::doMoveFrom(SymbolsWrapper &&src) { + fType = src.fType; + switch (fType) { + case SYMPTR_NONE: + // No action necessary + break; + case SYMPTR_DFS: + fPtr.dfs = src.fPtr.dfs; + src.fPtr.dfs = nullptr; + break; + case SYMPTR_NS: + fPtr.ns = src.fPtr.ns; + src.fPtr.ns = nullptr; + break; + } +} + +void SymbolsWrapper::doCleanup() { + switch (fType) { + case SYMPTR_NONE: + // No action necessary + break; + case SYMPTR_DFS: + delete fPtr.dfs; + break; + case SYMPTR_NS: + delete fPtr.ns; + break; + } +} + +bool SymbolsWrapper::isDecimalFormatSymbols() const { + return fType == SYMPTR_DFS; +} + +bool SymbolsWrapper::isNumberingSystem() const { + return fType == SYMPTR_NS; +} + +const DecimalFormatSymbols *SymbolsWrapper::getDecimalFormatSymbols() const { + U_ASSERT(fType == SYMPTR_DFS); + return fPtr.dfs; +} + +const NumberingSystem *SymbolsWrapper::getNumberingSystem() const { + U_ASSERT(fType == SYMPTR_NS); + return fPtr.ns; +} + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/i18n/number_types.h b/deps/icu-small/source/i18n/number_types.h index 5c2b8cf8b5d19c..8078851ba3fdb3 100644 --- a/deps/icu-small/source/i18n/number_types.h +++ b/deps/icu-small/source/i18n/number_types.h @@ -246,31 +246,31 @@ class U_I18N_API ModifierStore { * itself. The {@link #processQuantity} method performs the final step in the number processing pipeline: it uses the * quantity to generate a finalized {@link MicroProps}, which can be used to render the number to output. * - *

    * In other words, this interface is used for the parts of number processing that are quantity-dependent. * - *

    * In order to allow for multiple different objects to all mutate the same MicroProps, a "chain" of MicroPropsGenerators * are linked together, and each one is responsible for manipulating a certain quantity-dependent part of the * MicroProps. At the tail of the linked list is a base instance of {@link MicroProps} with properties that are not * quantity-dependent. Each element in the linked list calls {@link #processQuantity} on its "parent", then does its * work, and then returns the result. * + * This chain of MicroPropsGenerators is typically constructed by NumberFormatterImpl::macrosToMicroGenerator() when + * constructing a NumberFormatter. + * * Exported as U_I18N_API because it is a base class for other exported types * */ class U_I18N_API MicroPropsGenerator { public: - virtual ~MicroPropsGenerator(); + virtual ~MicroPropsGenerator() = default; /** - * Considers the given {@link DecimalQuantity}, optionally mutates it, and returns a {@link MicroProps}. + * Considers the given {@link DecimalQuantity}, optionally mutates it, and + * populates a {@link MicroProps} instance. * - * @param quantity - * The quantity for consideration and optional mutation. - * @param micros - * The MicroProps instance to populate. - * @return A MicroProps instance resolved for the quantity. + * @param quantity The quantity for consideration and optional mutation. + * @param micros The MicroProps instance to populate. It will be modified as + * needed for the given quantity. */ virtual void processQuantity(DecimalQuantity& quantity, MicroProps& micros, UErrorCode& status) const = 0; diff --git a/deps/icu-small/source/i18n/number_usageprefs.cpp b/deps/icu-small/source/i18n/number_usageprefs.cpp new file mode 100644 index 00000000000000..0d9cb06c50a2ab --- /dev/null +++ b/deps/icu-small/source/i18n/number_usageprefs.cpp @@ -0,0 +1,208 @@ +// © 2020 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "number_usageprefs.h" +#include "cstring.h" +#include "number_decimalquantity.h" +#include "number_microprops.h" +#include "number_roundingutils.h" +#include "number_skeletons.h" +#include "unicode/char16ptr.h" +#include "unicode/currunit.h" +#include "unicode/fmtable.h" +#include "unicode/measure.h" +#include "unicode/numberformatter.h" +#include "unicode/platform.h" +#include "unicode/unum.h" +#include "unicode/urename.h" +#include "units_data.h" + +using namespace icu; +using namespace icu::number; +using namespace icu::number::impl; +using icu::StringSegment; +using icu::units::ConversionRates; + +// Copy constructor +Usage::Usage(const Usage &other) : Usage() { + this->operator=(other); +} + +// Copy assignment operator +Usage &Usage::operator=(const Usage &other) { + fLength = 0; + fError = other.fError; + if (fUsage != nullptr) { + uprv_free(fUsage); + fUsage = nullptr; + } + if (other.fUsage == nullptr) { + return *this; + } + if (U_FAILURE(other.fError)) { + // We don't bother trying to allocating memory if we're in any case busy + // copying an errored Usage. + return *this; + } + fUsage = (char *)uprv_malloc(other.fLength + 1); + if (fUsage == nullptr) { + fError = U_MEMORY_ALLOCATION_ERROR; + return *this; + } + fLength = other.fLength; + uprv_strncpy(fUsage, other.fUsage, fLength + 1); + return *this; +} + +// Move constructor +Usage::Usage(Usage &&src) U_NOEXCEPT : fUsage(src.fUsage), fLength(src.fLength), fError(src.fError) { + // Take ownership away from src if necessary + src.fUsage = nullptr; +} + +// Move assignment operator +Usage &Usage::operator=(Usage &&src) U_NOEXCEPT { + if (this == &src) { + return *this; + } + if (fUsage != nullptr) { + uprv_free(fUsage); + } + fUsage = src.fUsage; + fLength = src.fLength; + fError = src.fError; + // Take ownership away from src if necessary + src.fUsage = nullptr; + return *this; +} + +Usage::~Usage() { + if (fUsage != nullptr) { + uprv_free(fUsage); + fUsage = nullptr; + } +} + +void Usage::set(StringPiece value) { + if (fUsage != nullptr) { + uprv_free(fUsage); + fUsage = nullptr; + } + fLength = value.length(); + fUsage = (char *)uprv_malloc(fLength + 1); + if (fUsage == nullptr) { + fLength = 0; + fError = U_MEMORY_ALLOCATION_ERROR; + return; + } + uprv_strncpy(fUsage, value.data(), fLength); + fUsage[fLength] = 0; +} + +// Populates micros.mixedMeasures and modifies quantity, based on the values in +// measures. +void mixedMeasuresToMicros(const MaybeStackVector &measures, DecimalQuantity *quantity, + MicroProps *micros, UErrorCode status) { + micros->mixedMeasuresCount = measures.length() - 1; + if (micros->mixedMeasuresCount > 0) { +#ifdef U_DEBUG + U_ASSERT(micros->outputUnit.getComplexity(status) == UMEASURE_UNIT_MIXED); + U_ASSERT(U_SUCCESS(status)); + // Check that we received measurements with the expected MeasureUnits: + MeasureUnitImpl temp; + const MeasureUnitImpl& impl = MeasureUnitImpl::forMeasureUnit(micros->outputUnit, temp, status); + U_ASSERT(U_SUCCESS(status)); + U_ASSERT(measures.length() == impl.units.length()); + for (int32_t i = 0; i < measures.length(); i++) { + U_ASSERT(measures[i]->getUnit() == impl.units[i]->build(status)); + } + (void)impl; +#endif + // Mixed units: except for the last value, we pass all values to the + // LongNameHandler via micros->mixedMeasures. + if (micros->mixedMeasures.getCapacity() < micros->mixedMeasuresCount) { + if (micros->mixedMeasures.resize(micros->mixedMeasuresCount) == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + } + for (int32_t i = 0; i < micros->mixedMeasuresCount; i++) { + micros->mixedMeasures[i] = measures[i]->getNumber().getInt64(); + } + } else { + micros->mixedMeasuresCount = 0; + } + // The last value (potentially the only value) gets passed on via quantity. + quantity->setToDouble(measures[measures.length() - 1]->getNumber().getDouble()); +} + +UsagePrefsHandler::UsagePrefsHandler(const Locale &locale, + const MeasureUnit &inputUnit, + const StringPiece usage, + const MicroPropsGenerator *parent, + UErrorCode &status) + : fUnitsRouter(inputUnit, StringPiece(locale.getCountry()), usage, status), + fParent(parent) { +} + +void UsagePrefsHandler::processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const { + fParent->processQuantity(quantity, micros, status); + if (U_FAILURE(status)) { + return; + } + + quantity.roundToInfinity(); // Enables toDouble + const units::RouteResult routed = fUnitsRouter.route(quantity.toDouble(), µs.rounder, status); + if (U_FAILURE(status)) { + return; + } + const MaybeStackVector& routedMeasures = routed.measures; + micros.outputUnit = routed.outputUnit.copy(status).build(status); + if (U_FAILURE(status)) { + return; + } + + mixedMeasuresToMicros(routedMeasures, &quantity, µs, status); +} + +UnitConversionHandler::UnitConversionHandler(const MeasureUnit &inputUnit, const MeasureUnit &outputUnit, + const MicroPropsGenerator *parent, UErrorCode &status) + : fOutputUnit(outputUnit), fParent(parent) { + MeasureUnitImpl tempInput, tempOutput; + const MeasureUnitImpl &inputUnitImpl = MeasureUnitImpl::forMeasureUnit(inputUnit, tempInput, status); + const MeasureUnitImpl &outputUnitImpl = + MeasureUnitImpl::forMeasureUnit(outputUnit, tempOutput, status); + + // TODO: this should become an initOnce thing? Review with other + // ConversionRates usages. + ConversionRates conversionRates(status); + if (U_FAILURE(status)) { + return; + } + fUnitConverter.adoptInsteadAndCheckErrorCode( + new ComplexUnitsConverter(inputUnitImpl, outputUnitImpl, conversionRates, status), status); +} + +void UnitConversionHandler::processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const { + fParent->processQuantity(quantity, micros, status); + if (U_FAILURE(status)) { + return; + } + quantity.roundToInfinity(); // Enables toDouble + MaybeStackVector measures = + fUnitConverter->convert(quantity.toDouble(), µs.rounder, status); + micros.outputUnit = fOutputUnit; + if (U_FAILURE(status)) { + return; + } + + mixedMeasuresToMicros(measures, &quantity, µs, status); +} + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/i18n/number_usageprefs.h b/deps/icu-small/source/i18n/number_usageprefs.h new file mode 100644 index 00000000000000..9e8bd936bd7248 --- /dev/null +++ b/deps/icu-small/source/i18n/number_usageprefs.h @@ -0,0 +1,125 @@ +// © 2020 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBER_USAGEPREFS_H__ +#define __NUMBER_USAGEPREFS_H__ + +#include "cmemory.h" +#include "number_types.h" +#include "unicode/listformatter.h" +#include "unicode/localpointer.h" +#include "unicode/locid.h" +#include "unicode/measunit.h" +#include "unicode/stringpiece.h" +#include "unicode/uobject.h" +#include "units_converter.h" +#include "units_router.h" + +U_NAMESPACE_BEGIN + +using ::icu::units::ComplexUnitsConverter; +using ::icu::units::UnitsRouter; + +namespace number { +namespace impl { + +/** + * A MicroPropsGenerator which uses UnitsRouter to produce output converted to a + * MeasureUnit appropriate for a particular localized usage: see + * NumberFormatterSettings::usage(). + */ +class U_I18N_API UsagePrefsHandler : public MicroPropsGenerator, public UMemory { + public: + UsagePrefsHandler(const Locale &locale, const MeasureUnit &inputUnit, const StringPiece usage, + const MicroPropsGenerator *parent, UErrorCode &status); + + /** + * Obtains the appropriate output value, MeasureUnit and + * rounding/precision behaviour from the UnitsRouter. + * + * The output unit is passed on to the LongNameHandler via + * micros.outputUnit. + */ + void processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const U_OVERRIDE; + + /** + * Returns the list of possible output units, i.e. the full set of + * preferences, for the localized, usage-specific unit preferences. + * + * The returned pointer should be valid for the lifetime of the + * UsagePrefsHandler instance. + */ + const MaybeStackVector *getOutputUnits() const { + return fUnitsRouter.getOutputUnits(); + } + + private: + UnitsRouter fUnitsRouter; + const MicroPropsGenerator *fParent; +}; + +} // namespace impl +} // namespace number + +// Export explicit template instantiations of LocalPointerBase and LocalPointer. +// This is required when building DLLs for Windows. (See datefmt.h, +// collationiterator.h, erarules.h and others for similar examples.) +// +// Note: These need to be outside of the number::impl namespace, or Clang will +// generate a compile error. +#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN +#if defined(_MSC_VER) +// Ignore warning 4661 as LocalPointerBase does not use operator== or operator!= +#pragma warning(push) +#pragma warning(disable: 4661) +#endif +template class U_I18N_API LocalPointerBase; +template class U_I18N_API LocalPointer; +#if defined(_MSC_VER) +#pragma warning(pop) +#endif +#endif + +namespace number { +namespace impl { + +/** + * A MicroPropsGenerator which converts a measurement from one MeasureUnit to + * another. In particular, the output MeasureUnit may be a mixed unit. (The + * input unit may not be a mixed unit.) + */ +class U_I18N_API UnitConversionHandler : public MicroPropsGenerator, public UMemory { + public: + /** + * Constructor. + * + * @param inputUnit Specifies the input MeasureUnit. Mixed units are not + * supported as input (because input is just a single decimal quantity). + * @param outputUnit Specifies the output MeasureUnit. + * @param parent The parent MicroPropsGenerator. + * @param status Receives status. + */ + UnitConversionHandler(const MeasureUnit &inputUnit, const MeasureUnit &outputUnit, + const MicroPropsGenerator *parent, UErrorCode &status); + + /** + * Obtains the appropriate output values from the Unit Converter. + */ + void processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const U_OVERRIDE; + private: + MeasureUnit fOutputUnit; + LocalPointer fUnitConverter; + const MicroPropsGenerator *fParent; +}; + +} // namespace impl +} // namespace number +U_NAMESPACE_END + +#endif // __NUMBER_USAGEPREFS_H__ +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/i18n/number_utils.cpp b/deps/icu-small/source/i18n/number_utils.cpp index 91d7f335cd82d3..bef7ea6c61f30b 100644 --- a/deps/icu-small/source/i18n/number_utils.cpp +++ b/deps/icu-small/source/i18n/number_utils.cpp @@ -258,7 +258,10 @@ void DecNum::toString(ByteSink& output, UErrorCode& status) const { } // "string must be at least dn->digits+14 characters long" int32_t minCapacity = fData.getAlias()->digits + 14; - MaybeStackArray buffer(minCapacity); + MaybeStackArray buffer(minCapacity, status); + if (U_FAILURE(status)) { + return; + } uprv_decNumberToString(fData, buffer.getAlias()); output.Append(buffer.getAlias(), static_cast(uprv_strlen(buffer.getAlias()))); } diff --git a/deps/icu-small/source/i18n/number_utils.h b/deps/icu-small/source/i18n/number_utils.h index 93195f080b2787..bc369c940f7962 100644 --- a/deps/icu-small/source/i18n/number_utils.h +++ b/deps/icu-small/source/i18n/number_utils.h @@ -49,8 +49,8 @@ inline bool unitIsCurrency(const MeasureUnit& unit) { return uprv_strcmp("currency", unit.getType()) == 0; } -inline bool unitIsNoUnit(const MeasureUnit& unit) { - return uprv_strcmp("none", unit.getType()) == 0; +inline bool unitIsBaseUnit(const MeasureUnit& unit) { + return unit == MeasureUnit(); } inline bool unitIsPercent(const MeasureUnit& unit) { diff --git a/deps/icu-small/source/i18n/number_utypes.h b/deps/icu-small/source/i18n/number_utypes.h index 7a1b7a4e80ac31..d97eadc5cdb96e 100644 --- a/deps/icu-small/source/i18n/number_utypes.h +++ b/deps/icu-small/source/i18n/number_utypes.h @@ -28,9 +28,6 @@ const DecimalQuantity* validateUFormattedNumberToDecimalQuantity( * This struct is held internally by the C++ version FormattedNumber since the member types are not * declared in the public header file. * - * The DecimalQuantity is not currently being used by FormattedNumber, but at some point it could be used - * to add a toDecNumber() or similar method. - * * Exported as U_I18N_API for tests */ class U_I18N_API UFormattedNumberData : public FormattedValueStringBuilderImpl { @@ -38,7 +35,13 @@ class U_I18N_API UFormattedNumberData : public FormattedValueStringBuilderImpl { UFormattedNumberData() : FormattedValueStringBuilderImpl(kUndefinedField) {} virtual ~UFormattedNumberData(); + // The formatted quantity. DecimalQuantity quantity; + + // The output unit for the formatted quantity. + // TODO(units,hugovdm): populate this correctly for the general case - it's + // currently only implemented for the .usage() use case. + MeasureUnit outputUnit; }; diff --git a/deps/icu-small/source/i18n/numparse_affixes.cpp b/deps/icu-small/source/i18n/numparse_affixes.cpp index 187830fb6fc0df..cef1685d03cd85 100644 --- a/deps/icu-small/source/i18n/numparse_affixes.cpp +++ b/deps/icu-small/source/i18n/numparse_affixes.cpp @@ -127,8 +127,8 @@ void AffixPatternMatcherBuilder::addMatcher(NumberParseMatcher& matcher) { fMatchers[fMatchersLen++] = &matcher; } -AffixPatternMatcher AffixPatternMatcherBuilder::build() { - return AffixPatternMatcher(fMatchers, fMatchersLen, fPattern); +AffixPatternMatcher AffixPatternMatcherBuilder::build(UErrorCode& status) { + return AffixPatternMatcher(fMatchers, fMatchersLen, fPattern, status); } AffixTokenMatcherWarehouse::AffixTokenMatcherWarehouse(const AffixTokenMatcherSetupData* setupData) @@ -209,12 +209,13 @@ AffixPatternMatcher AffixPatternMatcher::fromAffixPattern(const UnicodeString& a AffixPatternMatcherBuilder builder(affixPattern, tokenWarehouse, ignorables); AffixUtils::iterateWithConsumer(affixPattern, builder, status); - return builder.build(); + return builder.build(status); } AffixPatternMatcher::AffixPatternMatcher(MatcherArray& matchers, int32_t matchersLen, - const UnicodeString& pattern) - : ArraySeriesMatcher(matchers, matchersLen), fPattern(pattern) {} + const UnicodeString& pattern, UErrorCode& status) + : ArraySeriesMatcher(matchers, matchersLen), fPattern(pattern, status) { +} UnicodeString AffixPatternMatcher::getPattern() const { return fPattern.toAliasedUnicodeString(); diff --git a/deps/icu-small/source/i18n/numparse_affixes.h b/deps/icu-small/source/i18n/numparse_affixes.h index 2ac69df109519e..511c73c745380d 100644 --- a/deps/icu-small/source/i18n/numparse_affixes.h +++ b/deps/icu-small/source/i18n/numparse_affixes.h @@ -128,7 +128,7 @@ class AffixPatternMatcherBuilder : public TokenConsumer, public MutableMatcherCo void consumeToken(::icu::number::impl::AffixPatternType type, UChar32 cp, UErrorCode& status) override; /** NOTE: You can build only once! */ - AffixPatternMatcher build(); + AffixPatternMatcher build(UErrorCode& status); private: ArraySeriesMatcher::MatcherArray fMatchers; @@ -160,7 +160,8 @@ class U_I18N_API AffixPatternMatcher : public ArraySeriesMatcher { private: CompactUnicodeString<4> fPattern; - AffixPatternMatcher(MatcherArray& matchers, int32_t matchersLen, const UnicodeString& pattern); + AffixPatternMatcher(MatcherArray& matchers, int32_t matchersLen, const UnicodeString& pattern, + UErrorCode& status); friend class AffixPatternMatcherBuilder; }; diff --git a/deps/icu-small/source/i18n/numparse_types.h b/deps/icu-small/source/i18n/numparse_types.h index b4007c2ff5b52c..623f0e80f1668a 100644 --- a/deps/icu-small/source/i18n/numparse_types.h +++ b/deps/icu-small/source/i18n/numparse_types.h @@ -64,14 +64,15 @@ class CompactUnicodeString { fBuffer[0] = 0; } - CompactUnicodeString(const UnicodeString& text) - : fBuffer(text.length() + 1) { + CompactUnicodeString(const UnicodeString& text, UErrorCode& status) + : fBuffer(text.length() + 1, status) { + if (U_FAILURE(status)) { return; } uprv_memcpy(fBuffer.getAlias(), text.getBuffer(), sizeof(UChar) * text.length()); fBuffer[text.length()] = 0; } inline UnicodeString toAliasedUnicodeString() const { - return UnicodeString(TRUE, fBuffer.getAlias(), -1); + return UnicodeString(true, fBuffer.getAlias(), -1); } bool operator==(const CompactUnicodeString& other) const { diff --git a/deps/icu-small/source/i18n/numrange_capi.cpp b/deps/icu-small/source/i18n/numrange_capi.cpp new file mode 100644 index 00000000000000..a440a53fe6b173 --- /dev/null +++ b/deps/icu-small/source/i18n/numrange_capi.cpp @@ -0,0 +1,193 @@ +// © 2018 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +// Allow implicit conversion from char16_t* to UnicodeString for this file: +// Helpful in toString methods and elsewhere. +#define UNISTR_FROM_STRING_EXPLICIT + +#include "fphdlimp.h" +#include "number_utypes.h" +#include "numparse_types.h" +#include "formattedval_impl.h" +#include "numrange_impl.h" +#include "number_decnum.h" +#include "unicode/numberrangeformatter.h" +#include "unicode/unumberrangeformatter.h" + +using namespace icu; +using namespace icu::number; +using namespace icu::number::impl; + + +U_NAMESPACE_BEGIN +namespace number { +namespace impl { + +/** + * Implementation class for UNumberRangeFormatter. Wraps a LocalizedRangeNumberFormatter. + */ +struct UNumberRangeFormatterData : public UMemory, + // Magic number as ASCII == "NRF" (NumberRangeFormatter) + public IcuCApiHelper { + LocalizedNumberRangeFormatter fFormatter; +}; + +struct UFormattedNumberRangeImpl; + +// Magic number as ASCII == "FDN" (FormatteDNumber) +typedef IcuCApiHelper UFormattedNumberRangeApiHelper; + +struct UFormattedNumberRangeImpl : public UFormattedValueImpl, public UFormattedNumberRangeApiHelper { + UFormattedNumberRangeImpl(); + ~UFormattedNumberRangeImpl(); + + FormattedNumberRange fImpl; + UFormattedNumberRangeData fData; +}; + +UFormattedNumberRangeImpl::UFormattedNumberRangeImpl() + : fImpl(&fData) { + fFormattedValue = &fImpl; +} + +UFormattedNumberRangeImpl::~UFormattedNumberRangeImpl() { + // Disown the data from fImpl so it doesn't get deleted twice + fImpl.fData = nullptr; +} + +} // namespace impl +} // namespace number +U_NAMESPACE_END + + +UPRV_FORMATTED_VALUE_CAPI_NO_IMPLTYPE_AUTO_IMPL( + UFormattedNumberRange, + UFormattedNumberRangeImpl, + UFormattedNumberRangeApiHelper, + unumrf) + + +const UFormattedNumberRangeData* number::impl::validateUFormattedNumberRange( + const UFormattedNumberRange* uresult, UErrorCode& status) { + auto* result = UFormattedNumberRangeApiHelper::validate(uresult, status); + if (U_FAILURE(status)) { + return nullptr; + } + return &result->fData; +} + + +U_CAPI UNumberRangeFormatter* U_EXPORT2 +unumrf_openForSkeletonWithCollapseAndIdentityFallback( + const UChar* skeleton, + int32_t skeletonLen, + UNumberRangeCollapse collapse, + UNumberRangeIdentityFallback identityFallback, + const char* locale, + UParseError* perror, + UErrorCode* ec) { + auto* impl = new UNumberRangeFormatterData(); + if (impl == nullptr) { + *ec = U_MEMORY_ALLOCATION_ERROR; + return nullptr; + } + // Readonly-alias constructor (first argument is whether we are NUL-terminated) + UnicodeString skeletonString(skeletonLen == -1, skeleton, skeletonLen); + impl->fFormatter = NumberRangeFormatter::withLocale(locale) + .numberFormatterBoth(NumberFormatter::forSkeleton(skeletonString, *perror, *ec)) + .collapse(collapse) + .identityFallback(identityFallback); + return impl->exportForC(); +} + +U_CAPI void U_EXPORT2 +unumrf_formatDoubleRange( + const UNumberRangeFormatter* uformatter, + double first, + double second, + UFormattedNumberRange* uresult, + UErrorCode* ec) { + const UNumberRangeFormatterData* formatter = UNumberRangeFormatterData::validate(uformatter, *ec); + auto* result = UFormattedNumberRangeApiHelper::validate(uresult, *ec); + if (U_FAILURE(*ec)) { return; } + + result->fData.getStringRef().clear(); + result->fData.quantity1.setToDouble(first); + result->fData.quantity2.setToDouble(second); + formatter->fFormatter.formatImpl(result->fData, first == second, *ec); +} + +U_CAPI void U_EXPORT2 +unumrf_formatDecimalRange( + const UNumberRangeFormatter* uformatter, + const char* first, int32_t firstLen, + const char* second, int32_t secondLen, + UFormattedNumberRange* uresult, + UErrorCode* ec) { + const UNumberRangeFormatterData* formatter = UNumberRangeFormatterData::validate(uformatter, *ec); + auto* result = UFormattedNumberRangeApiHelper::validate(uresult, *ec); + if (U_FAILURE(*ec)) { return; } + + result->fData.getStringRef().clear(); + result->fData.quantity1.setToDecNumber({first, firstLen}, *ec); + result->fData.quantity2.setToDecNumber({second, secondLen}, *ec); + formatter->fFormatter.formatImpl(result->fData, first == second, *ec); +} + +U_CAPI UNumberRangeIdentityResult U_EXPORT2 +unumrf_resultGetIdentityResult( + const UFormattedNumberRange* uresult, + UErrorCode* ec) { + auto* result = UFormattedNumberRangeApiHelper::validate(uresult, *ec); + if (U_FAILURE(*ec)) { + return UNUM_IDENTITY_RESULT_COUNT; + } + return result->fData.identityResult; +} + +U_CAPI int32_t U_EXPORT2 +unumrf_resultGetFirstDecimalNumber( + const UFormattedNumberRange* uresult, + char* dest, + int32_t destCapacity, + UErrorCode* ec) { + const auto* result = UFormattedNumberRangeApiHelper::validate(uresult, *ec); + if (U_FAILURE(*ec)) { + return 0; + } + DecNum decnum; + return result->fData.quantity1.toDecNum(decnum, *ec) + .toCharString(*ec) + .extract(dest, destCapacity, *ec); +} + +U_CAPI int32_t U_EXPORT2 +unumrf_resultGetSecondDecimalNumber( + const UFormattedNumberRange* uresult, + char* dest, + int32_t destCapacity, + UErrorCode* ec) { + const auto* result = UFormattedNumberRangeApiHelper::validate(uresult, *ec); + if (U_FAILURE(*ec)) { + return 0; + } + DecNum decnum; + return result->fData.quantity2 + .toDecNum(decnum, *ec) + .toCharString(*ec) + .extract(dest, destCapacity, *ec); +} + +U_CAPI void U_EXPORT2 +unumrf_close(UNumberRangeFormatter* f) { + UErrorCode localStatus = U_ZERO_ERROR; + const UNumberRangeFormatterData* impl = UNumberRangeFormatterData::validate(f, localStatus); + delete impl; +} + + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/i18n/numrange_fluent.cpp b/deps/icu-small/source/i18n/numrange_fluent.cpp index 33179026f8d2b5..d9286d1d713d2c 100644 --- a/deps/icu-small/source/i18n/numrange_fluent.cpp +++ b/deps/icu-small/source/i18n/numrange_fluent.cpp @@ -12,6 +12,7 @@ #include "numrange_impl.h" #include "util.h" #include "number_utypes.h" +#include "number_decnum.h" using namespace icu; using namespace icu::number; @@ -375,28 +376,4 @@ LocalizedNumberRangeFormatter::getFormatter(UErrorCode& status) const { } -UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumberRange) - -#define UPRV_NOARG - -UnicodeString FormattedNumberRange::getFirstDecimal(UErrorCode& status) const { - UPRV_FORMATTED_VALUE_METHOD_GUARD(ICU_Utility::makeBogusString()) - return fData->quantity1.toScientificString(); -} - -UnicodeString FormattedNumberRange::getSecondDecimal(UErrorCode& status) const { - UPRV_FORMATTED_VALUE_METHOD_GUARD(ICU_Utility::makeBogusString()) - return fData->quantity2.toScientificString(); -} - -UNumberRangeIdentityResult FormattedNumberRange::getIdentityResult(UErrorCode& status) const { - UPRV_FORMATTED_VALUE_METHOD_GUARD(UNUM_IDENTITY_RESULT_NOT_EQUAL) - return fData->identityResult; -} - - -UFormattedNumberRangeData::~UFormattedNumberRangeData() = default; - - - #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/i18n/numrange_impl.cpp b/deps/icu-small/source/i18n/numrange_impl.cpp index 9fb3dee861f1f6..3aae5c23548349 100644 --- a/deps/icu-small/source/i18n/numrange_impl.cpp +++ b/deps/icu-small/source/i18n/numrange_impl.cpp @@ -12,6 +12,7 @@ #include "unicode/numberrangeformatter.h" #include "numrange_impl.h" #include "patternprops.h" +#include "pluralranges.h" #include "uresimp.h" #include "util.h" @@ -106,92 +107,9 @@ void getNumberRangeData(const char* localeName, const char* nsName, NumberRangeD sink.fillInDefaults(status); } -class PluralRangesDataSink : public ResourceSink { - public: - PluralRangesDataSink(StandardPluralRanges& output) : fOutput(output) {} - - void put(const char* /*key*/, ResourceValue& value, UBool /*noFallback*/, UErrorCode& status) U_OVERRIDE { - ResourceArray entriesArray = value.getArray(status); - if (U_FAILURE(status)) { return; } - fOutput.setCapacity(entriesArray.getSize()); - for (int i = 0; entriesArray.getValue(i, value); i++) { - ResourceArray pluralFormsArray = value.getArray(status); - if (U_FAILURE(status)) { return; } - pluralFormsArray.getValue(0, value); - StandardPlural::Form first = StandardPlural::fromString(value.getUnicodeString(status), status); - if (U_FAILURE(status)) { return; } - pluralFormsArray.getValue(1, value); - StandardPlural::Form second = StandardPlural::fromString(value.getUnicodeString(status), status); - if (U_FAILURE(status)) { return; } - pluralFormsArray.getValue(2, value); - StandardPlural::Form result = StandardPlural::fromString(value.getUnicodeString(status), status); - if (U_FAILURE(status)) { return; } - fOutput.addPluralRange(first, second, result); - } - } - - private: - StandardPluralRanges& fOutput; -}; - -void getPluralRangesData(const Locale& locale, StandardPluralRanges& output, UErrorCode& status) { - if (U_FAILURE(status)) { return; } - LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "pluralRanges", &status)); - if (U_FAILURE(status)) { return; } - - CharString dataPath; - dataPath.append("locales/", -1, status); - dataPath.append(locale.getLanguage(), -1, status); - if (U_FAILURE(status)) { return; } - int32_t setLen; - // Not all languages are covered: fail gracefully - UErrorCode internalStatus = U_ZERO_ERROR; - const UChar* set = ures_getStringByKeyWithFallback(rb.getAlias(), dataPath.data(), &setLen, &internalStatus); - if (U_FAILURE(internalStatus)) { return; } - - dataPath.clear(); - dataPath.append("rules/", -1, status); - dataPath.appendInvariantChars(set, setLen, status); - if (U_FAILURE(status)) { return; } - PluralRangesDataSink sink(output); - ures_getAllItemsWithFallback(rb.getAlias(), dataPath.data(), sink, status); - if (U_FAILURE(status)) { return; } -} - } // namespace -void StandardPluralRanges::initialize(const Locale& locale, UErrorCode& status) { - getPluralRangesData(locale, *this, status); -} - -void StandardPluralRanges::addPluralRange( - StandardPlural::Form first, - StandardPlural::Form second, - StandardPlural::Form result) { - U_ASSERT(fTriplesLen < fTriples.getCapacity()); - fTriples[fTriplesLen] = {first, second, result}; - fTriplesLen++; -} - -void StandardPluralRanges::setCapacity(int32_t length) { - if (length > fTriples.getCapacity()) { - fTriples.resize(length, 0); - } -} - -StandardPlural::Form -StandardPluralRanges::resolve(StandardPlural::Form first, StandardPlural::Form second) const { - for (int32_t i=0; i PluralRangeTriples; - PluralRangeTriples fTriples; - int32_t fTriplesLen = 0; -}; - - class NumberRangeFormatterImpl : public UMemory { public: NumberRangeFormatterImpl(const RangeMacroProps& macros, UErrorCode& status); @@ -105,6 +76,11 @@ class NumberRangeFormatterImpl : public UMemory { }; +/** Helper function used in upluralrules.cpp */ +const UFormattedNumberRangeData* validateUFormattedNumberRange( + const UFormattedNumberRange* uresult, UErrorCode& status); + + } // namespace impl } // namespace number U_NAMESPACE_END diff --git a/deps/icu-small/source/i18n/olsontz.cpp b/deps/icu-small/source/i18n/olsontz.cpp index dd01180f8cc078..cb142f7b9e080f 100644 --- a/deps/icu-small/source/i18n/olsontz.cpp +++ b/deps/icu-small/source/i18n/olsontz.cpp @@ -197,58 +197,60 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top, } // Process final rule and data, if any - const UChar *ruleIdUStr = ures_getStringByKey(res, kFINALRULE, &len, &ec); - ures_getByKey(res, kFINALRAW, r.getAlias(), &ec); - int32_t ruleRaw = ures_getInt(r.getAlias(), &ec); - ures_getByKey(res, kFINALYEAR, r.getAlias(), &ec); - int32_t ruleYear = ures_getInt(r.getAlias(), &ec); if (U_SUCCESS(ec)) { - UnicodeString ruleID(TRUE, ruleIdUStr, len); - UResourceBundle *rule = TimeZone::loadRule(top, ruleID, NULL, ec); - const int32_t *ruleData = ures_getIntVector(rule, &len, &ec); - if (U_SUCCESS(ec) && len == 11) { - UnicodeString emptyStr; - finalZone = new SimpleTimeZone( - ruleRaw * U_MILLIS_PER_SECOND, - emptyStr, - (int8_t)ruleData[0], (int8_t)ruleData[1], (int8_t)ruleData[2], - ruleData[3] * U_MILLIS_PER_SECOND, - (SimpleTimeZone::TimeMode) ruleData[4], - (int8_t)ruleData[5], (int8_t)ruleData[6], (int8_t)ruleData[7], - ruleData[8] * U_MILLIS_PER_SECOND, - (SimpleTimeZone::TimeMode) ruleData[9], - ruleData[10] * U_MILLIS_PER_SECOND, ec); - if (finalZone == NULL) { - ec = U_MEMORY_ALLOCATION_ERROR; - } else { - finalStartYear = ruleYear; + const UChar *ruleIdUStr = ures_getStringByKey(res, kFINALRULE, &len, &ec); + ures_getByKey(res, kFINALRAW, r.getAlias(), &ec); + int32_t ruleRaw = ures_getInt(r.getAlias(), &ec); + ures_getByKey(res, kFINALYEAR, r.getAlias(), &ec); + int32_t ruleYear = ures_getInt(r.getAlias(), &ec); + if (U_SUCCESS(ec)) { + UnicodeString ruleID(TRUE, ruleIdUStr, len); + UResourceBundle *rule = TimeZone::loadRule(top, ruleID, NULL, ec); + const int32_t *ruleData = ures_getIntVector(rule, &len, &ec); + if (U_SUCCESS(ec) && len == 11) { + UnicodeString emptyStr; + finalZone = new SimpleTimeZone( + ruleRaw * U_MILLIS_PER_SECOND, + emptyStr, + (int8_t)ruleData[0], (int8_t)ruleData[1], (int8_t)ruleData[2], + ruleData[3] * U_MILLIS_PER_SECOND, + (SimpleTimeZone::TimeMode) ruleData[4], + (int8_t)ruleData[5], (int8_t)ruleData[6], (int8_t)ruleData[7], + ruleData[8] * U_MILLIS_PER_SECOND, + (SimpleTimeZone::TimeMode) ruleData[9], + ruleData[10] * U_MILLIS_PER_SECOND, ec); + if (finalZone == NULL) { + ec = U_MEMORY_ALLOCATION_ERROR; + } else { + finalStartYear = ruleYear; - // Note: Setting finalStartYear to the finalZone is problematic. When a date is around - // year boundary, SimpleTimeZone may return false result when DST is observed at the - // beginning of year. We could apply safe margin (day or two), but when one of recurrent - // rules falls around year boundary, it could return false result. Without setting the - // start year, finalZone works fine around the year boundary of the start year. + // Note: Setting finalStartYear to the finalZone is problematic. When a date is around + // year boundary, SimpleTimeZone may return false result when DST is observed at the + // beginning of year. We could apply safe margin (day or two), but when one of recurrent + // rules falls around year boundary, it could return false result. Without setting the + // start year, finalZone works fine around the year boundary of the start year. - // finalZone->setStartYear(finalStartYear); + // finalZone->setStartYear(finalStartYear); - // Compute the millis for Jan 1, 0:00 GMT of the finalYear + // Compute the millis for Jan 1, 0:00 GMT of the finalYear - // Note: finalStartMillis is used for detecting either if - // historic transition data or finalZone to be used. In an - // extreme edge case - for example, two transitions fall into - // small windows of time around the year boundary, this may - // result incorrect offset computation. But I think it will - // never happen practically. Yoshito - Feb 20, 2010 - finalStartMillis = Grego::fieldsToDay(finalStartYear, 0, 1) * U_MILLIS_PER_DAY; + // Note: finalStartMillis is used for detecting either if + // historic transition data or finalZone to be used. In an + // extreme edge case - for example, two transitions fall into + // small windows of time around the year boundary, this may + // result incorrect offset computation. But I think it will + // never happen practically. Yoshito - Feb 20, 2010 + finalStartMillis = Grego::fieldsToDay(finalStartYear, 0, 1) * U_MILLIS_PER_DAY; + } + } else { + ec = U_INVALID_FORMAT_ERROR; } - } else { - ec = U_INVALID_FORMAT_ERROR; + ures_close(rule); + } else if (ec == U_MISSING_RESOURCE_ERROR) { + // No final zone + ec = U_ZERO_ERROR; } - ures_close(rule); - } else if (ec == U_MISSING_RESOURCE_ERROR) { - // No final zone - ec = U_ZERO_ERROR; } // initialize canonical ID diff --git a/deps/icu-small/source/i18n/olsontz.h b/deps/icu-small/source/i18n/olsontz.h index 79601546984a23..643a695369ef48 100644 --- a/deps/icu-small/source/i18n/olsontz.h +++ b/deps/icu-small/source/i18n/olsontz.h @@ -208,7 +208,7 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone { /** * TimeZone API. For a historical zone, whether DST is used or * not varies over time. In order to approximate expected - * behavior, this method returns TRUE if DST is observed at any + * behavior, this method returns true if DST is observed at any * point in the current year. */ virtual UBool useDaylightTime() const; @@ -234,7 +234,7 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone { * @param base The base time. * @param inclusive Whether the base time is inclusive or not. * @param result Receives the first transition after the base time. - * @return TRUE if the transition is found. + * @return true if the transition is found. */ virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; @@ -244,7 +244,7 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone { * @param base The base time. * @param inclusive Whether the base time is inclusive or not. * @param result Receives the most recent transition before the base time. - * @return TRUE if the transition is found. + * @return true if the transition is found. */ virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; diff --git a/deps/icu-small/source/i18n/persncal.cpp b/deps/icu-small/source/i18n/persncal.cpp index 4d366d41f0dffe..ba306653af28e0 100644 --- a/deps/icu-small/source/i18n/persncal.cpp +++ b/deps/icu-small/source/i18n/persncal.cpp @@ -79,7 +79,7 @@ PersianCalendar* PersianCalendar::clone() const { } PersianCalendar::PersianCalendar(const Locale& aLocale, UErrorCode& success) - : Calendar(TimeZone::createDefault(), aLocale, success) + : Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success) { setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly. } diff --git a/deps/icu-small/source/i18n/persncal.h b/deps/icu-small/source/i18n/persncal.h index a9d940db78e6c7..f330ea8a0319b2 100644 --- a/deps/icu-small/source/i18n/persncal.h +++ b/deps/icu-small/source/i18n/persncal.h @@ -295,7 +295,7 @@ class PersianCalendar : public Calendar { virtual UBool inDaylightTime(UErrorCode& status) const; /** - * Returns TRUE because the Persian Calendar does have a default century + * Returns true because the Persian Calendar does have a default century * @internal */ virtual UBool haveDefaultCentury() const; diff --git a/deps/icu-small/source/i18n/pluralranges.cpp b/deps/icu-small/source/i18n/pluralranges.cpp new file mode 100644 index 00000000000000..da10e2117d04ad --- /dev/null +++ b/deps/icu-small/source/i18n/pluralranges.cpp @@ -0,0 +1,144 @@ +// © 2018 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +// Allow implicit conversion from char16_t* to UnicodeString for this file: +// Helpful in toString methods and elsewhere. +#define UNISTR_FROM_STRING_EXPLICIT + +#include "unicode/numberrangeformatter.h" +#include "pluralranges.h" +#include "uresimp.h" +#include "charstr.h" +#include "uassert.h" +#include "util.h" +#include "numrange_impl.h" + +U_NAMESPACE_BEGIN + + +namespace { + +class PluralRangesDataSink : public ResourceSink { + public: + PluralRangesDataSink(StandardPluralRanges& output) : fOutput(output) {} + + void put(const char* /*key*/, ResourceValue& value, UBool /*noFallback*/, UErrorCode& status) U_OVERRIDE { + ResourceArray entriesArray = value.getArray(status); + if (U_FAILURE(status)) { return; } + fOutput.setCapacity(entriesArray.getSize(), status); + if (U_FAILURE(status)) { return; } + for (int i = 0; entriesArray.getValue(i, value); i++) { + ResourceArray pluralFormsArray = value.getArray(status); + if (U_FAILURE(status)) { return; } + if (pluralFormsArray.getSize() != 3) { + status = U_RESOURCE_TYPE_MISMATCH; + return; + } + pluralFormsArray.getValue(0, value); + StandardPlural::Form first = StandardPlural::fromString(value.getUnicodeString(status), status); + if (U_FAILURE(status)) { return; } + pluralFormsArray.getValue(1, value); + StandardPlural::Form second = StandardPlural::fromString(value.getUnicodeString(status), status); + if (U_FAILURE(status)) { return; } + pluralFormsArray.getValue(2, value); + StandardPlural::Form result = StandardPlural::fromString(value.getUnicodeString(status), status); + if (U_FAILURE(status)) { return; } + fOutput.addPluralRange(first, second, result); + } + } + + private: + StandardPluralRanges& fOutput; +}; + +void getPluralRangesData(const Locale& locale, StandardPluralRanges& output, UErrorCode& status) { + LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "pluralRanges", &status)); + if (U_FAILURE(status)) { return; } + + CharString dataPath; + dataPath.append("locales/", -1, status); + dataPath.append(locale.getLanguage(), -1, status); + if (U_FAILURE(status)) { return; } + int32_t setLen; + // Not all languages are covered: fail gracefully + UErrorCode internalStatus = U_ZERO_ERROR; + const UChar* set = ures_getStringByKeyWithFallback(rb.getAlias(), dataPath.data(), &setLen, &internalStatus); + if (U_FAILURE(internalStatus)) { return; } + + dataPath.clear(); + dataPath.append("rules/", -1, status); + dataPath.appendInvariantChars(set, setLen, status); + if (U_FAILURE(status)) { return; } + PluralRangesDataSink sink(output); + ures_getAllItemsWithFallback(rb.getAlias(), dataPath.data(), sink, status); +} + +} // namespace + + +StandardPluralRanges +StandardPluralRanges::forLocale(const Locale& locale, UErrorCode& status) { + StandardPluralRanges result; + getPluralRangesData(locale, result, status); + return result; +} + +StandardPluralRanges +StandardPluralRanges::copy(UErrorCode& status) const { + StandardPluralRanges result; + if (fTriplesLen > result.fTriples.getCapacity()) { + if (result.fTriples.resize(fTriplesLen) == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return result; + } + } + uprv_memcpy(result.fTriples.getAlias(), + fTriples.getAlias(), + fTriplesLen * sizeof(fTriples[0])); + result.fTriplesLen = fTriplesLen; + return result; +} + +LocalPointer +StandardPluralRanges::toPointer(UErrorCode& status) && noexcept { + return LocalPointer(new StandardPluralRanges(std::move(*this)), status); +} + +void StandardPluralRanges::addPluralRange( + StandardPlural::Form first, + StandardPlural::Form second, + StandardPlural::Form result) { + U_ASSERT(fTriplesLen < fTriples.getCapacity()); + fTriples[fTriplesLen] = {first, second, result}; + fTriplesLen++; +} + +void StandardPluralRanges::setCapacity(int32_t length, UErrorCode& status) { + if (U_FAILURE(status)) { return; } + if (length > fTriples.getCapacity()) { + if (fTriples.resize(length, 0) == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + } + } +} + +StandardPlural::Form +StandardPluralRanges::resolve(StandardPlural::Form first, StandardPlural::Form second) const { + for (int32_t i=0; i toPointer(UErrorCode& status) && noexcept; + + /** Select rule based on the first and second forms */ + StandardPlural::Form resolve(StandardPlural::Form first, StandardPlural::Form second) const; + + /** Used for data loading. */ + void addPluralRange( + StandardPlural::Form first, + StandardPlural::Form second, + StandardPlural::Form result); + + /** Used for data loading. */ + void setCapacity(int32_t length, UErrorCode& status); + + private: + struct StandardPluralRangeTriple { + StandardPlural::Form first; + StandardPlural::Form second; + StandardPlural::Form result; + }; + + // TODO: An array is simple here, but it results in linear lookup time. + // Certain locales have 20-30 entries in this list. + // Consider changing to a smarter data structure. + typedef MaybeStackArray PluralRangeTriples; + PluralRangeTriples fTriples; + int32_t fTriplesLen = 0; +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ +#endif //__PLURALRANGES_H__ diff --git a/deps/icu-small/source/i18n/plurfmt.cpp b/deps/icu-small/source/i18n/plurfmt.cpp index b99437630e67b5..aac35c5b094ff9 100644 --- a/deps/icu-small/source/i18n/plurfmt.cpp +++ b/deps/icu-small/source/i18n/plurfmt.cpp @@ -549,9 +549,15 @@ void PluralFormat::parseType(const UnicodeString& source, const NFRule *rbnfLeni UnicodeString currArg = pattern.tempSubString(partStart->getLimit(), partLimit->getIndex() - partStart->getLimit()); if (rbnfLenientScanner != NULL) { - // If lenient parsing is turned ON, we've got some time consuming parsing ahead of us. - int32_t length = -1; - currMatchIndex = rbnfLenientScanner->findTextLenient(source, currArg, startingAt, &length); + // Check if non-lenient rule finds the text before call lenient parsing + int32_t tempIndex = source.indexOf(currArg, startingAt); + if (tempIndex >= 0) { + currMatchIndex = tempIndex; + } else { + // If lenient parsing is turned ON, we've got some time consuming parsing ahead of us. + int32_t length = -1; + currMatchIndex = rbnfLenientScanner->findTextLenient(source, currArg, startingAt, &length); + } } else { currMatchIndex = source.indexOf(currArg, startingAt); diff --git a/deps/icu-small/source/i18n/plurrule.cpp b/deps/icu-small/source/i18n/plurrule.cpp index 54e3b2cd86c960..884db7c4f59311 100644 --- a/deps/icu-small/source/i18n/plurrule.cpp +++ b/deps/icu-small/source/i18n/plurrule.cpp @@ -19,6 +19,7 @@ #include "unicode/ures.h" #include "unicode/numfmt.h" #include "unicode/decimfmt.h" +#include "unicode/numberrangeformatter.h" #include "charstr.h" #include "cmemory.h" #include "cstring.h" @@ -36,6 +37,8 @@ #include "unifiedcache.h" #include "number_decimalquantity.h" #include "util.h" +#include "pluralranges.h" +#include "numrange_impl.h" #if !UCONFIG_NO_FORMATTING @@ -56,6 +59,7 @@ static const UChar PK_VAR_N[]={LOW_N,0}; static const UChar PK_VAR_I[]={LOW_I,0}; static const UChar PK_VAR_F[]={LOW_F,0}; static const UChar PK_VAR_T[]={LOW_T,0}; +static const UChar PK_VAR_E[]={LOW_E,0}; static const UChar PK_VAR_V[]={LOW_V,0}; static const UChar PK_WITHIN[]={LOW_W,LOW_I,LOW_T,LOW_H,LOW_I,LOW_N,0}; static const UChar PK_DECIMAL[]={LOW_D,LOW_E,LOW_C,LOW_I,LOW_M,LOW_A,LOW_L,0}; @@ -67,6 +71,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(PluralKeywordEnumeration) PluralRules::PluralRules(UErrorCode& /*status*/) : UObject(), mRules(nullptr), + mStandardPluralRanges(nullptr), mInternalStatus(U_ZERO_ERROR) { } @@ -74,6 +79,7 @@ PluralRules::PluralRules(UErrorCode& /*status*/) PluralRules::PluralRules(const PluralRules& other) : UObject(other), mRules(nullptr), + mStandardPluralRanges(nullptr), mInternalStatus(U_ZERO_ERROR) { *this=other; @@ -81,6 +87,7 @@ PluralRules::PluralRules(const PluralRules& other) PluralRules::~PluralRules() { delete mRules; + delete mStandardPluralRanges; } SharedPluralRules::~SharedPluralRules() { @@ -89,14 +96,20 @@ SharedPluralRules::~SharedPluralRules() { PluralRules* PluralRules::clone() const { - PluralRules* newObj = new PluralRules(*this); // Since clone doesn't have a 'status' parameter, the best we can do is return nullptr if // the newly created object was not fully constructed properly (an error occurred). - if (newObj != nullptr && U_FAILURE(newObj->mInternalStatus)) { - delete newObj; - newObj = nullptr; + UErrorCode localStatus = U_ZERO_ERROR; + return clone(localStatus); +} + +PluralRules* +PluralRules::clone(UErrorCode& status) const { + LocalPointer newObj(new PluralRules(*this), status); + if (U_SUCCESS(status) && U_FAILURE(newObj->mInternalStatus)) { + status = newObj->mInternalStatus; + newObj.adoptInstead(nullptr); } - return newObj; + return newObj.orphan(); } PluralRules& @@ -104,6 +117,8 @@ PluralRules::operator=(const PluralRules& other) { if (this != &other) { delete mRules; mRules = nullptr; + delete mStandardPluralRanges; + mStandardPluralRanges = nullptr; mInternalStatus = other.mInternalStatus; if (U_FAILURE(mInternalStatus)) { // bail out early if the object we were copying from was already 'invalid'. @@ -119,6 +134,11 @@ PluralRules::operator=(const PluralRules& other) { mInternalStatus = mRules->fInternalStatus; } } + if (other.mStandardPluralRanges != nullptr) { + mStandardPluralRanges = other.mStandardPluralRanges->copy(mInternalStatus) + .toPointer(mInternalStatus) + .orphan(); + } } return *this; } @@ -211,11 +231,8 @@ PluralRules::forLocale(const Locale& locale, UPluralType type, UErrorCode& statu if (U_FAILURE(status)) { return nullptr; } - PluralRules *result = (*shared)->clone(); + PluralRules *result = (*shared)->clone(status); shared->removeRef(); - if (result == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - } return result; } @@ -252,6 +269,10 @@ PluralRules::internalForLocale(const Locale& locale, UPluralType type, UErrorCod // Original impl used default rules. // Ask the question to ICU Core. + newObj->mStandardPluralRanges = StandardPluralRanges::forLocale(locale, status) + .toPointer(status) + .orphan(); + return newObj.orphan(); } @@ -272,6 +293,10 @@ PluralRules::select(const number::FormattedNumber& number, UErrorCode& status) c if (U_FAILURE(status)) { return ICU_Utility::makeBogusString(); } + if (U_FAILURE(mInternalStatus)) { + status = mInternalStatus; + return ICU_Utility::makeBogusString(); + } return select(dq); } @@ -285,6 +310,33 @@ PluralRules::select(const IFixedDecimal &number) const { } } +UnicodeString +PluralRules::select(const number::FormattedNumberRange& range, UErrorCode& status) const { + return select(range.getData(status), status); +} + +UnicodeString +PluralRules::select(const number::impl::UFormattedNumberRangeData* impl, UErrorCode& status) const { + if (U_FAILURE(status)) { + return ICU_Utility::makeBogusString(); + } + if (U_FAILURE(mInternalStatus)) { + status = mInternalStatus; + return ICU_Utility::makeBogusString(); + } + if (mStandardPluralRanges == nullptr) { + // Happens if PluralRules was constructed via createRules() + status = U_UNSUPPORTED_ERROR; + return ICU_Utility::makeBogusString(); + } + auto form1 = StandardPlural::fromString(select(impl->quantity1), status); + auto form2 = StandardPlural::fromString(select(impl->quantity2), status); + if (U_FAILURE(status)) { + return ICU_Utility::makeBogusString(); + } + auto result = mStandardPluralRanges->resolve(form1, form2); + return UnicodeString(StandardPlural::getKeyword(result), -1, US_INV); +} StringEnumeration* @@ -326,9 +378,23 @@ static double scaleForInt(double d) { return scale; } +/** + * Helper method for the overrides of getSamples() for double and FixedDecimal + * return value types. Provide only one of an allocated array of doubles or + * FixedDecimals, and a nullptr for the other. + */ static int32_t -getSamplesFromString(const UnicodeString &samples, double *dest, - int32_t destCapacity, UErrorCode& status) { +getSamplesFromString(const UnicodeString &samples, double *destDbl, + FixedDecimal* destFd, int32_t destCapacity, + UErrorCode& status) { + + if ((destDbl == nullptr && destFd == nullptr) + || (destDbl != nullptr && destFd != nullptr)) { + status = U_INTERNAL_PROGRAM_ERROR; + return 0; + } + + bool isDouble = destDbl != nullptr; int32_t sampleCount = 0; int32_t sampleStartIdx = 0; int32_t sampleEndIdx = 0; @@ -346,9 +412,13 @@ getSamplesFromString(const UnicodeString &samples, double *dest, int32_t tildeIndex = sampleRange.indexOf(TILDE); if (tildeIndex < 0) { FixedDecimal fixed(sampleRange, status); - double sampleValue = fixed.source; - if (fixed.visibleDecimalDigitCount == 0 || sampleValue != floor(sampleValue)) { - dest[sampleCount++] = sampleValue; + if (isDouble) { + double sampleValue = fixed.source; + if (fixed.visibleDecimalDigitCount == 0 || sampleValue != floor(sampleValue)) { + destDbl[sampleCount++] = sampleValue; + } + } else { + destFd[sampleCount++] = fixed; } } else { @@ -375,14 +445,21 @@ getSamplesFromString(const UnicodeString &samples, double *dest, rangeLo *= scale; rangeHi *= scale; for (double n=rangeLo; n<=rangeHi; n+=1) { - // Hack Alert: don't return any decimal samples with integer values that - // originated from a format with trailing decimals. - // This API is returning doubles, which can't distinguish having displayed - // zeros to the right of the decimal. - // This results in test failures with values mapping back to a different keyword. double sampleValue = n/scale; - if (!(sampleValue == floor(sampleValue) && fixedLo.visibleDecimalDigitCount > 0)) { - dest[sampleCount++] = sampleValue; + if (isDouble) { + // Hack Alert: don't return any decimal samples with integer values that + // originated from a format with trailing decimals. + // This API is returning doubles, which can't distinguish having displayed + // zeros to the right of the decimal. + // This results in test failures with values mapping back to a different keyword. + if (!(sampleValue == floor(sampleValue) && fixedLo.visibleDecimalDigitCount > 0)) { + destDbl[sampleCount++] = sampleValue; + } + } else { + int32_t v = (int32_t) fixedLo.getPluralOperand(PluralOperand::PLURAL_OPERAND_V); + int32_t e = (int32_t) fixedLo.getPluralOperand(PluralOperand::PLURAL_OPERAND_E); + FixedDecimal newSample = FixedDecimal::createWithExponent(sampleValue, v, e); + destFd[sampleCount++] = newSample; } if (sampleCount >= destCapacity) { break; @@ -394,24 +471,52 @@ getSamplesFromString(const UnicodeString &samples, double *dest, return sampleCount; } - int32_t PluralRules::getSamples(const UnicodeString &keyword, double *dest, int32_t destCapacity, UErrorCode& status) { - if (destCapacity == 0 || U_FAILURE(status)) { + if (U_FAILURE(status)) { return 0; } if (U_FAILURE(mInternalStatus)) { status = mInternalStatus; return 0; } + if (dest != nullptr ? destCapacity < 0 : destCapacity != 0) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return 0; + } RuleChain *rc = rulesForKeyword(keyword); if (rc == nullptr) { return 0; } - int32_t numSamples = getSamplesFromString(rc->fIntegerSamples, dest, destCapacity, status); + int32_t numSamples = getSamplesFromString(rc->fIntegerSamples, dest, nullptr, destCapacity, status); if (numSamples == 0) { - numSamples = getSamplesFromString(rc->fDecimalSamples, dest, destCapacity, status); + numSamples = getSamplesFromString(rc->fDecimalSamples, dest, nullptr, destCapacity, status); + } + return numSamples; +} + +int32_t +PluralRules::getSamples(const UnicodeString &keyword, FixedDecimal *dest, + int32_t destCapacity, UErrorCode& status) { + if (U_FAILURE(status)) { + return 0; + } + if (U_FAILURE(mInternalStatus)) { + status = mInternalStatus; + return 0; + } + if (dest != nullptr ? destCapacity < 0 : destCapacity != 0) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return 0; + } + RuleChain *rc = rulesForKeyword(keyword); + if (rc == nullptr) { + return 0; + } + int32_t numSamples = getSamplesFromString(rc->fIntegerSamples, nullptr, dest, destCapacity, status); + if (numSamples == 0) { + numSamples = getSamplesFromString(rc->fDecimalSamples, nullptr, dest, destCapacity, status); } return numSamples; } @@ -600,6 +705,7 @@ PluralRuleParser::parse(const UnicodeString& ruleData, PluralRules *prules, UErr case tVariableI: case tVariableF: case tVariableT: + case tVariableE: case tVariableV: U_ASSERT(curAndConstraint != nullptr); curAndConstraint->digitsType = type; @@ -984,6 +1090,8 @@ static UnicodeString tokenString(tokenType tok) { s.append(LOW_V); break; case tVariableT: s.append(LOW_T); break; + case tVariableE: + s.append(LOW_E); break; default: s.append(TILDE); } @@ -1160,6 +1268,7 @@ PluralRuleParser::checkSyntax(UErrorCode &status) case tVariableI: case tVariableF: case tVariableT: + case tVariableE: case tVariableV: if (type != tIs && type != tMod && type != tIn && type != tNot && type != tWithin && type != tEqual && type != tNotEqual) { @@ -1176,6 +1285,7 @@ PluralRuleParser::checkSyntax(UErrorCode &status) type == tVariableI || type == tVariableF || type == tVariableT || + type == tVariableE || type == tVariableV || type == tAt)) { status = U_UNEXPECTED_TOKEN; @@ -1207,6 +1317,7 @@ PluralRuleParser::checkSyntax(UErrorCode &status) type != tVariableI && type != tVariableF && type != tVariableT && + type != tVariableE && type != tVariableV) { status = U_UNEXPECTED_TOKEN; } @@ -1384,6 +1495,8 @@ PluralRuleParser::getKeyType(const UnicodeString &token, tokenType keyType) keyType = tVariableF; } else if (0 == token.compare(PK_VAR_T, 1)) { keyType = tVariableT; + } else if (0 == token.compare(PK_VAR_E, 1)) { + keyType = tVariableE; } else if (0 == token.compare(PK_VAR_V, 1)) { keyType = tVariableV; } else if (0 == token.compare(PK_IS, 2)) { @@ -1481,13 +1594,15 @@ PluralOperand tokenTypeToPluralOperand(tokenType tt) { return PLURAL_OPERAND_V; case tVariableT: return PLURAL_OPERAND_T; + case tVariableE: + return PLURAL_OPERAND_E; default: UPRV_UNREACHABLE; // unexpected. } } -FixedDecimal::FixedDecimal(double n, int32_t v, int64_t f) { - init(n, v, f); +FixedDecimal::FixedDecimal(double n, int32_t v, int64_t f, int32_t e) { + init(n, v, f, e); // check values. TODO make into unit test. // // long visiblePower = (int) Math.pow(10, v); @@ -1503,6 +1618,10 @@ FixedDecimal::FixedDecimal(double n, int32_t v, int64_t f) { // } } +FixedDecimal::FixedDecimal(double n, int32_t v, int64_t f) { + init(n, v, f); +} + FixedDecimal::FixedDecimal(double n, int32_t v) { // Ugly, but for samples we don't care. init(n, v, getFractionalDigits(n, v)); @@ -1522,20 +1641,36 @@ FixedDecimal::FixedDecimal() { FixedDecimal::FixedDecimal(const UnicodeString &num, UErrorCode &status) { CharString cs; - cs.appendInvariantChars(num, status); + int32_t parsedExponent = 0; + + int32_t exponentIdx = num.indexOf(u'e'); + if (exponentIdx < 0) { + exponentIdx = num.indexOf(u'E'); + } + if (exponentIdx >= 0) { + cs.appendInvariantChars(num.tempSubString(0, exponentIdx), status); + int32_t expSubstrStart = exponentIdx + 1; + parsedExponent = ICU_Utility::parseAsciiInteger(num, expSubstrStart); + } + else { + cs.appendInvariantChars(num, status); + } + DecimalQuantity dl; dl.setToDecNumber(cs.toStringPiece(), status); if (U_FAILURE(status)) { init(0, 0, 0); return; } + int32_t decimalPoint = num.indexOf(DOT); double n = dl.toDouble(); if (decimalPoint == -1) { - init(n, 0, 0); + init(n, 0, 0, parsedExponent); } else { - int32_t v = num.length() - decimalPoint - 1; - init(n, v, getFractionalDigits(n, v)); + int32_t fractionNumLength = exponentIdx < 0 ? num.length() : cs.length(); + int32_t v = fractionNumLength - decimalPoint - 1; + init(n, v, getFractionalDigits(n, v), parsedExponent); } } @@ -1546,6 +1681,7 @@ FixedDecimal::FixedDecimal(const FixedDecimal &other) { decimalDigits = other.decimalDigits; decimalDigitsWithoutTrailingZeros = other.decimalDigitsWithoutTrailingZeros; intValue = other.intValue; + exponent = other.exponent; _hasIntegerValue = other._hasIntegerValue; isNegative = other.isNegative; _isNaN = other._isNaN; @@ -1554,6 +1690,10 @@ FixedDecimal::FixedDecimal(const FixedDecimal &other) { FixedDecimal::~FixedDecimal() = default; +FixedDecimal FixedDecimal::createWithExponent(double n, int32_t v, int32_t e) { + return FixedDecimal(n, v, getFractionalDigits(n, v), e); +} + void FixedDecimal::init(double n) { int32_t numFractionDigits = decimals(n); @@ -1562,10 +1702,17 @@ void FixedDecimal::init(double n) { void FixedDecimal::init(double n, int32_t v, int64_t f) { + int32_t exponent = 0; + init(n, v, f, exponent); +} + + +void FixedDecimal::init(double n, int32_t v, int64_t f, int32_t e) { isNegative = n < 0.0; source = fabs(n); _isNaN = uprv_isNaN(source); _isInfinite = uprv_isInfinite(source); + exponent = e; if (_isNaN || _isInfinite) { v = 0; f = 0; @@ -1661,7 +1808,9 @@ int64_t FixedDecimal::getFractionalDigits(double n, int32_t v) { case 3: return (int64_t)(fract*1000.0 + 0.5); default: double scaled = floor(fract * pow(10.0, (double)v) + 0.5); - if (scaled > U_INT64_MAX) { + if (scaled >= static_cast(U_INT64_MAX)) { + // Note: a double cannot accurately represent U_INT64_MAX. Casting it to double + // will round up to the next representable value, which is U_INT64_MAX + 1. return U_INT64_MAX; } else { return (int64_t)scaled; @@ -1693,7 +1842,7 @@ double FixedDecimal::getPluralOperand(PluralOperand operand) const { case PLURAL_OPERAND_F: return static_cast(decimalDigits); case PLURAL_OPERAND_T: return static_cast(decimalDigitsWithoutTrailingZeros); case PLURAL_OPERAND_V: return visibleDecimalDigitCount; - case PLURAL_OPERAND_E: return 0; + case PLURAL_OPERAND_E: return exponent; default: UPRV_UNREACHABLE; // unexpected. } @@ -1719,6 +1868,23 @@ int32_t FixedDecimal::getVisibleFractionDigitCount() const { return visibleDecimalDigitCount; } +bool FixedDecimal::operator==(const FixedDecimal &other) const { + return source == other.source && visibleDecimalDigitCount == other.visibleDecimalDigitCount + && decimalDigits == other.decimalDigits && exponent == other.exponent; +} + +UnicodeString FixedDecimal::toString() const { + char pattern[15]; + char buffer[20]; + if (exponent == 0) { + snprintf(pattern, sizeof(pattern), "%%.%df", visibleDecimalDigitCount); + snprintf(buffer, sizeof(buffer), pattern, source); + } else { + snprintf(pattern, sizeof(pattern), "%%.%dfe%%d", visibleDecimalDigitCount); + snprintf(buffer, sizeof(buffer), pattern, source, exponent); + } + return UnicodeString(buffer, -1, US_INV); +} PluralAvailableLocalesEnumeration::PluralAvailableLocalesEnumeration(UErrorCode &status) { diff --git a/deps/icu-small/source/i18n/plurrule_impl.h b/deps/icu-small/source/i18n/plurrule_impl.h index a18cb0847a840e..8849e67e571da6 100644 --- a/deps/icu-small/source/i18n/plurrule_impl.h +++ b/deps/icu-small/source/i18n/plurrule_impl.h @@ -30,6 +30,12 @@ #include "hash.h" #include "uassert.h" +/** + * A FixedDecimal version of UPLRULES_NO_UNIQUE_VALUE used in PluralRulesTest + * for parsing of samples. + */ +#define UPLRULES_NO_UNIQUE_VALUE_DECIMAL (FixedDecimal((double)-0.00123456777)) + class PluralRulesTest; U_NAMESPACE_BEGIN @@ -138,6 +144,7 @@ enum tokenType { tVariableF, tVariableV, tVariableT, + tVariableE, tDecimal, tInteger, tEOF @@ -273,7 +280,9 @@ class U_I18N_API FixedDecimal: public IFixedDecimal, public UObject { * @param n the number, e.g. 12.345 * @param v The number of visible fraction digits, e.g. 3 * @param f The fraction digits, e.g. 345 + * @param e The exponent, e.g. 7 in 1.2e7 (for compact/scientific) */ + FixedDecimal(double n, int32_t v, int64_t f, int32_t e); FixedDecimal(double n, int32_t v, int64_t f); FixedDecimal(double n, int32_t); explicit FixedDecimal(double n); @@ -282,6 +291,8 @@ class U_I18N_API FixedDecimal: public IFixedDecimal, public UObject { FixedDecimal(const UnicodeString &s, UErrorCode &ec); FixedDecimal(const FixedDecimal &other); + static FixedDecimal createWithExponent(double n, int32_t v, int32_t e); + double getPluralOperand(PluralOperand operand) const U_OVERRIDE; bool isNaN() const U_OVERRIDE; bool isInfinite() const U_OVERRIDE; @@ -291,19 +302,25 @@ class U_I18N_API FixedDecimal: public IFixedDecimal, public UObject { int32_t getVisibleFractionDigitCount() const; + void init(double n, int32_t v, int64_t f, int32_t e); void init(double n, int32_t v, int64_t f); void init(double n); UBool quickInit(double n); // Try a fast-path only initialization, - // return TRUE if successful. + // return true if successful. void adjustForMinFractionDigits(int32_t min); static int64_t getFractionalDigits(double n, int32_t v); static int32_t decimals(double n); + bool operator==(const FixedDecimal &other) const; + + UnicodeString toString() const; + double source; int32_t visibleDecimalDigitCount; int64_t decimalDigits; int64_t decimalDigitsWithoutTrailingZeros; int64_t intValue; + int32_t exponent; UBool _hasIntegerValue; UBool isNegative; UBool _isNaN; @@ -320,8 +337,8 @@ class AndConstraint : public UMemory { int32_t opNum = -1; // for mod expressions, the right operand of the mod. int32_t value = -1; // valid for 'is' rules only. UVector32 *rangeList = nullptr; // for 'in', 'within' rules. Null otherwise. - UBool negated = FALSE; // TRUE for negated rules. - UBool integerOnly = FALSE; // TRUE for 'within' rules. + UBool negated = false; // true for negated rules. + UBool integerOnly = false; // true for 'within' rules. tokenType digitsType = none; // n | i | v | f constraint. AndConstraint *next = nullptr; // Internal error status, used for errors that occur during the copy constructor. @@ -357,8 +374,8 @@ class RuleChain : public UMemory { OrConstraint *ruleHeader = nullptr; UnicodeString fDecimalSamples; // Samples strings from rule source UnicodeString fIntegerSamples; // without @decimal or @integer, otherwise unprocessed. - UBool fDecimalSamplesUnbounded = FALSE; - UBool fIntegerSamplesUnbounded = FALSE; + UBool fDecimalSamplesUnbounded = false; + UBool fIntegerSamplesUnbounded = false; // Internal error status, used for errors that occur during the copy constructor. UErrorCode fInternalStatus = U_ZERO_ERROR; diff --git a/deps/icu-small/source/i18n/quant.h b/deps/icu-small/source/i18n/quant.h index d5aa8e5eeeedee..df6924cc127ba6 100644 --- a/deps/icu-small/source/i18n/quant.h +++ b/deps/icu-small/source/i18n/quant.h @@ -62,11 +62,11 @@ class Quantifier : public UnicodeFunctor, public UnicodeMatcher { * considered for matching will be text.charAt(limit-1) in the * forward direction or text.charAt(limit+1) in the backward * direction. - * @param incremental if TRUE, then assume further characters may + * @param incremental if true, then assume further characters may * be inserted at limit and check for partial matching. Otherwise * assume the text as given is complete. * @return a match degree value indicating a full match, a partial - * match, or a mismatch. If incremental is FALSE then + * match, or a mismatch. If incremental is false then * U_PARTIAL_MATCH should never be returned. */ virtual UMatchDegree matches(const Replaceable& text, @@ -81,7 +81,7 @@ class Quantifier : public UnicodeFunctor, public UnicodeMatcher { * @return A reference to 'result'. */ virtual UnicodeString& toPattern(UnicodeString& result, - UBool escapeUnprintable = FALSE) const; + UBool escapeUnprintable = false) const; /** * Implement UnicodeMatcher diff --git a/deps/icu-small/source/i18n/quantityformatter.h b/deps/icu-small/source/i18n/quantityformatter.h index 88c3f3844e924d..30bef08634a3f4 100644 --- a/deps/icu-small/source/i18n/quantityformatter.h +++ b/deps/icu-small/source/i18n/quantityformatter.h @@ -74,18 +74,18 @@ class U_I18N_API QuantityFormatter : public UMemory { * @param variant "zero", "one", "two", "few", "many", "other" * @param rawPattern the pattern for the variant e.g "{0} meters" * @param status any error returned here. - * @return TRUE on success; FALSE if status was set to a non zero error. + * @return true on success; false if status was set to a non zero error. */ UBool addIfAbsent(const char *variant, const UnicodeString &rawPattern, UErrorCode &status); /** - * returns TRUE if this object has at least the "other" variant. + * returns true if this object has at least the "other" variant. */ UBool isValid() const; /** * Gets the pattern formatter that would be used for a particular variant. - * If isValid() returns TRUE, this method is guaranteed to return a + * If isValid() returns true, this method is guaranteed to return a * non-NULL value. */ const SimpleFormatter *getByVariant(const char *variant) const; @@ -112,7 +112,7 @@ class U_I18N_API QuantityFormatter : public UMemory { /** * Selects the standard plural form for the number/formatter/rules. - * TODO(13591): Remove this method. + * Used in MeasureFormat for backwards compatibility with NumberFormat. */ static StandardPlural::Form selectPlural( const Formattable &number, diff --git a/deps/icu-small/source/i18n/rbt.h b/deps/icu-small/source/i18n/rbt.h index b450dc23f4975c..6c34824181fec3 100644 --- a/deps/icu-small/source/i18n/rbt.h +++ b/deps/icu-small/source/i18n/rbt.h @@ -161,7 +161,7 @@ class RuleBasedTransliterator : public Transliterator { * to construct a new transliterator. * @param result the string to receive the rules. Previous * contents will be deleted. - * @param escapeUnprintable if TRUE then convert unprintable + * @param escapeUnprintable if true then convert unprintable * character to their hex escape representations, \uxxxx or * \Uxxxxxxxx. Unprintable characters are those other than * U+000A, U+0020..U+007E. diff --git a/deps/icu-small/source/i18n/rbt_pars.cpp b/deps/icu-small/source/i18n/rbt_pars.cpp index 3eb58a2a904a46..802d65d0ac9bbe 100644 --- a/deps/icu-small/source/i18n/rbt_pars.cpp +++ b/deps/icu-small/source/i18n/rbt_pars.cpp @@ -1557,7 +1557,7 @@ UChar TransliteratorParser::getSegmentStandin(int32_t seg, UErrorCode& status) { return 0; } c = variableNext++; - // Set a placeholder in the master variables vector that will be + // Set a placeholder in the primary variables vector that will be // filled in later by setSegmentObject(). We know that we will get // called first because setSegmentObject() will call us. variablesVector.addElement((void*) NULL, status); diff --git a/deps/icu-small/source/i18n/rbt_pars.h b/deps/icu-small/source/i18n/rbt_pars.h index d51f2e852bb5b4..3e6517cfeb9078 100644 --- a/deps/icu-small/source/i18n/rbt_pars.h +++ b/deps/icu-small/source/i18n/rbt_pars.h @@ -210,7 +210,7 @@ class TransliteratorParser : public UMemory { /** * Assert that the given character is NOT within the variable range. - * If it is, return FALSE. This is neccesary to ensure that the + * If it is, return false. This is neccesary to ensure that the * variable range does not overlap characters used in a rule. * @param ch the given character. * @return True, if the given character is NOT within the variable range. diff --git a/deps/icu-small/source/i18n/rbt_rule.h b/deps/icu-small/source/i18n/rbt_rule.h index eb8556df0cda5d..76feeee3913e6a 100644 --- a/deps/icu-small/source/i18n/rbt_rule.h +++ b/deps/icu-small/source/i18n/rbt_rule.h @@ -172,9 +172,9 @@ class TransliterationRule : public UMemory { * segments, or null if there are none. The array itself is adopted, * but the pointers within it are not. * @param segsCount number of elements in segs[]. - * @param anchorStart TRUE if the the rule is anchored on the left to + * @param anchorStart true if the the rule is anchored on the left to * the context start. - * @param anchorEnd TRUE if the rule is anchored on the right to the + * @param anchorEnd true if the rule is anchored on the right to the * context limit. * @param data the rule data. * @param status Output parameter filled in with success or failure status. @@ -267,11 +267,11 @@ class TransliterationRule : public UMemory { * * @param text the text * @param pos the position indices - * @param incremental if TRUE, test for partial matches that may + * @param incremental if true, test for partial matches that may * be completed by additional text inserted at pos.limit. * @return one of U_MISMATCH, * U_PARTIAL_MATCH, or U_MATCH. If - * incremental is FALSE then U_PARTIAL_MATCH will not be returned. + * incremental is false then U_PARTIAL_MATCH will not be returned. */ UMatchDegree matchAndReplace(Replaceable& text, UTransPosition& pos, diff --git a/deps/icu-small/source/i18n/rbt_set.h b/deps/icu-small/source/i18n/rbt_set.h index 9b2b8b38dba5ca..b1163a0193f862 100644 --- a/deps/icu-small/source/i18n/rbt_set.h +++ b/deps/icu-small/source/i18n/rbt_set.h @@ -123,14 +123,14 @@ class TransliterationRuleSet : public UMemory { /** * Transliterate the given text with the given UTransPosition - * indices. Return TRUE if the transliteration should continue - * or FALSE if it should halt (because of a U_PARTIAL_MATCH match). - * Note that FALSE is only ever returned if isIncremental is TRUE. + * indices. Return true if the transliteration should continue + * or false if it should halt (because of a U_PARTIAL_MATCH match). + * Note that false is only ever returned if isIncremental is true. * @param text the text to be transliterated * @param index the position indices, which will be updated - * @param isIncremental if TRUE, assume new text may be inserted - * at index.limit, and return FALSE if thre is a partial match. - * @return TRUE unless a U_PARTIAL_MATCH has been obtained, + * @param isIncremental if true, assume new text may be inserted + * at index.limit, and return false if thre is a partial match. + * @return true unless a U_PARTIAL_MATCH has been obtained, * indicating that transliteration should stop until more text * arrives. */ diff --git a/deps/icu-small/source/i18n/regexcmp.h b/deps/icu-small/source/i18n/regexcmp.h index 85b7586793b9ff..5804ff302674a1 100644 --- a/deps/icu-small/source/i18n/regexcmp.h +++ b/deps/icu-small/source/i18n/regexcmp.h @@ -104,7 +104,7 @@ class U_I18N_API RegexCompile : public UMemory { int32_t LoopOp); UBool compileInlineInterval(); // Generate inline code for a {min,max} quantifier void literalChar(UChar32 c); // Compile a literal char - void fixLiterals(UBool split=FALSE); // Generate code for pending literal characters. + void fixLiterals(UBool split=false); // Generate code for pending literal characters. void insertOp(int32_t where); // Open up a slot for a new op in the // generated code at the specified location. void appendOp(int32_t op); // Append a new op to the compiled pattern. diff --git a/deps/icu-small/source/i18n/regextxt.h b/deps/icu-small/source/i18n/regextxt.h index 9cfabbe4153416..0f64b8437e7c32 100644 --- a/deps/icu-small/source/i18n/regextxt.h +++ b/deps/icu-small/source/i18n/regextxt.h @@ -29,7 +29,7 @@ U_NAMESPACE_BEGIN #endif #ifdef REGEX_DISABLE_CHUNK_MODE -# define UTEXT_FULL_TEXT_IN_CHUNK(ut,len) (FALSE) +# define UTEXT_FULL_TEXT_IN_CHUNK(ut,len) (false) #else # define UTEXT_FULL_TEXT_IN_CHUNK(ut,len) ((0==((ut)->chunkNativeStart))&&((len)==((ut)->chunkNativeLimit))&&((len)==((ut)->nativeIndexingLimit))) #endif diff --git a/deps/icu-small/source/i18n/region.cpp b/deps/icu-small/source/i18n/region.cpp index 198bea8f643a5b..8364bd1c1b2280 100644 --- a/deps/icu-small/source/i18n/region.cpp +++ b/deps/icu-small/source/i18n/region.cpp @@ -217,7 +217,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) { if ( aliasToRegion != NULL && aliasFromRegion == NULL ) { // This is just an alias from some string to a region uhash_put(newRegionAliases.getAlias(),(void *)aliasFromStr.orphan(), (void *)aliasToRegion,&status); } else { - if ( aliasFromRegion == NULL ) { // Deprecated region code not in the master codes list - so need to create a deprecated region for it. + if ( aliasFromRegion == NULL ) { // Deprecated region code not in the primary codes list - so need to create a deprecated region for it. LocalPointer newRgn(new Region, status); if ( U_SUCCESS(status) ) { aliasFromRegion = newRgn.orphan(); diff --git a/deps/icu-small/source/i18n/reldatefmt.cpp b/deps/icu-small/source/i18n/reldatefmt.cpp index f10c5ba4884b84..5d43606169c8a8 100644 --- a/deps/icu-small/source/i18n/reldatefmt.cpp +++ b/deps/icu-small/source/i18n/reldatefmt.cpp @@ -1326,7 +1326,7 @@ ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt, return res.extract(result, resultCapacity, *status); } -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ureldatefmt_formatNumericToResult( const URelativeDateTimeFormatter* reldatefmt, double offset, @@ -1369,7 +1369,7 @@ ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt, return res.extract(result, resultCapacity, *status); } -U_DRAFT void U_EXPORT2 +U_CAPI void U_EXPORT2 ureldatefmt_formatToResult( const URelativeDateTimeFormatter* reldatefmt, double offset, diff --git a/deps/icu-small/source/i18n/rematch.cpp b/deps/icu-small/source/i18n/rematch.cpp index 123aa8602ba474..653ef4d6c1f8d1 100644 --- a/deps/icu-small/source/i18n/rematch.cpp +++ b/deps/icu-small/source/i18n/rematch.cpp @@ -2072,7 +2072,7 @@ int32_t RegexMatcher::split(UText *input, UErrorCode &status) { // - // Check arguements for validity + // Check arguments for validity // if (U_FAILURE(status)) { return 0; diff --git a/deps/icu-small/source/i18n/rulebasedcollator.cpp b/deps/icu-small/source/i18n/rulebasedcollator.cpp index 60acf17815a5ee..917482d65bb4d6 100644 --- a/deps/icu-small/source/i18n/rulebasedcollator.cpp +++ b/deps/icu-small/source/i18n/rulebasedcollator.cpp @@ -1600,10 +1600,7 @@ RuleBasedCollator::internalGetShortDefinitionString(const char *locale, appendSubtag(result, 'Z', subtag, length, errorCode); if(U_FAILURE(errorCode)) { return 0; } - if(result.length() <= capacity) { - uprv_memcpy(buffer, result.data(), result.length()); - } - return u_terminateChars(buffer, capacity, result.length(), &errorCode); + return result.extract(buffer, capacity, errorCode); } UBool diff --git a/deps/icu-small/source/i18n/smpdtfmt.cpp b/deps/icu-small/source/i18n/smpdtfmt.cpp index d704642b0536a4..4717899cf38d7d 100644 --- a/deps/icu-small/source/i18n/smpdtfmt.cpp +++ b/deps/icu-small/source/i18n/smpdtfmt.cpp @@ -54,6 +54,7 @@ #include "unicode/udisplaycontext.h" #include "unicode/brkiter.h" #include "unicode/rbnf.h" +#include "unicode/dtptngen.h" #include "uresimp.h" #include "olsontz.h" #include "patternprops.h" @@ -650,6 +651,12 @@ SimpleDateFormat::operator==(const Format& other) const } //---------------------------------------------------------------------- +static const UChar* timeSkeletons[4] = { + u"jmmsszzzz", // kFull + u"jmmssz", // kLong + u"jmmss", // kMedium + u"jmm", // kShort +}; void SimpleDateFormat::construct(EStyle timeStyle, EStyle dateStyle, @@ -714,35 +721,75 @@ void SimpleDateFormat::construct(EStyle timeStyle, fDateOverride.setToBogus(); fTimeOverride.setToBogus(); + UnicodeString timePattern; + if (timeStyle >= kFull && timeStyle <= kShort) { + const char* baseLocID = locale.getBaseName(); + if (baseLocID[0]!=0 && uprv_strcmp(baseLocID,"und")!=0) { + UErrorCode useStatus = U_ZERO_ERROR; + Locale baseLoc(baseLocID); + Locale validLoc(getLocale(ULOC_VALID_LOCALE, useStatus)); + if (U_SUCCESS(useStatus) && validLoc!=baseLoc) { + bool useDTPG = false; + const char* baseReg = baseLoc.getCountry(); // empty string if no region + if ((baseReg[0]!=0 && uprv_strncmp(baseReg,validLoc.getCountry(),ULOC_COUNTRY_CAPACITY)!=0) + || uprv_strncmp(baseLoc.getLanguage(),validLoc.getLanguage(),ULOC_LANG_CAPACITY)!=0) { + // use DTPG if + // * baseLoc has a region and validLoc does not have the same one (or has none), OR + // * validLoc has a different language code than baseLoc + useDTPG = true; + } + if (useDTPG) { + // The standard time formats may have the wrong time cycle, because: + // the valid locale differs in important ways (region, language) from + // the base locale. + // We could *also* check whether they do actually have a mismatch with + // the time cycle preferences for the region, but that is a lot more + // work for little or no additional benefit, since just going ahead + // and always synthesizing the time format as per the following should + // create a locale-appropriate pattern with cycle that matches the + // region preferences anyway. + LocalPointer dtpg(DateTimePatternGenerator::createInstanceNoStdPat(locale, useStatus)); + if (U_SUCCESS(useStatus)) { + UnicodeString timeSkeleton(TRUE, timeSkeletons[timeStyle], -1); + timePattern = dtpg->getBestPattern(timeSkeleton, useStatus); + } + } + } + } + } + // if the pattern should include both date and time information, use the date/time // pattern string as a guide to tell use how to glue together the appropriate date // and time pattern strings. if ((timeStyle != kNone) && (dateStyle != kNone)) { - currentBundle.adoptInstead( - ures_getByIndex(dateTimePatterns.getAlias(), (int32_t)timeStyle, NULL, &status)); - if (U_FAILURE(status)) { - status = U_INVALID_FORMAT_ERROR; - return; - } - switch (ures_getType(currentBundle.getAlias())) { - case URES_STRING: { - resStr = ures_getString(currentBundle.getAlias(), &resStrLen, &status); - break; - } - case URES_ARRAY: { - resStr = ures_getStringByIndex(currentBundle.getAlias(), 0, &resStrLen, &status); - ovrStr = ures_getStringByIndex(currentBundle.getAlias(), 1, &ovrStrLen, &status); - fTimeOverride.setTo(TRUE, ovrStr, ovrStrLen); - break; - } - default: { + UnicodeString tempus1(timePattern); + if (tempus1.length() == 0) { + currentBundle.adoptInstead( + ures_getByIndex(dateTimePatterns.getAlias(), (int32_t)timeStyle, NULL, &status)); + if (U_FAILURE(status)) { status = U_INVALID_FORMAT_ERROR; return; } - } + switch (ures_getType(currentBundle.getAlias())) { + case URES_STRING: { + resStr = ures_getString(currentBundle.getAlias(), &resStrLen, &status); + break; + } + case URES_ARRAY: { + resStr = ures_getStringByIndex(currentBundle.getAlias(), 0, &resStrLen, &status); + ovrStr = ures_getStringByIndex(currentBundle.getAlias(), 1, &ovrStrLen, &status); + fTimeOverride.setTo(TRUE, ovrStr, ovrStrLen); + break; + } + default: { + status = U_INVALID_FORMAT_ERROR; + return; + } + } - UnicodeString tempus1(TRUE, resStr, resStrLen); + tempus1.setTo(TRUE, resStr, resStrLen); + } currentBundle.adoptInstead( ures_getByIndex(dateTimePatterns.getAlias(), (int32_t)dateStyle, NULL, &status)); @@ -784,29 +831,32 @@ void SimpleDateFormat::construct(EStyle timeStyle, // pattern string from the resources // setTo() - see DateFormatSymbols::assignArray comments else if (timeStyle != kNone) { - currentBundle.adoptInstead( - ures_getByIndex(dateTimePatterns.getAlias(), (int32_t)timeStyle, NULL, &status)); - if (U_FAILURE(status)) { - status = U_INVALID_FORMAT_ERROR; - return; - } - switch (ures_getType(currentBundle.getAlias())) { - case URES_STRING: { - resStr = ures_getString(currentBundle.getAlias(), &resStrLen, &status); - break; - } - case URES_ARRAY: { - resStr = ures_getStringByIndex(currentBundle.getAlias(), 0, &resStrLen, &status); - ovrStr = ures_getStringByIndex(currentBundle.getAlias(), 1, &ovrStrLen, &status); - fDateOverride.setTo(TRUE, ovrStr, ovrStrLen); - break; - } - default: { + fPattern.setTo(timePattern); + if (fPattern.length() == 0) { + currentBundle.adoptInstead( + ures_getByIndex(dateTimePatterns.getAlias(), (int32_t)timeStyle, NULL, &status)); + if (U_FAILURE(status)) { status = U_INVALID_FORMAT_ERROR; return; } + switch (ures_getType(currentBundle.getAlias())) { + case URES_STRING: { + resStr = ures_getString(currentBundle.getAlias(), &resStrLen, &status); + break; + } + case URES_ARRAY: { + resStr = ures_getStringByIndex(currentBundle.getAlias(), 0, &resStrLen, &status); + ovrStr = ures_getStringByIndex(currentBundle.getAlias(), 1, &ovrStrLen, &status); + fDateOverride.setTo(TRUE, ovrStr, ovrStrLen); + break; + } + default: { + status = U_INVALID_FORMAT_ERROR; + return; + } + } + fPattern.setTo(TRUE, resStr, resStrLen); } - fPattern.setTo(TRUE, resStr, resStrLen); } else if (dateStyle != kNone) { currentBundle.adoptInstead( @@ -848,7 +898,8 @@ Calendar* SimpleDateFormat::initializeCalendar(TimeZone* adoptZone, const Locale& locale, UErrorCode& status) { if(!U_FAILURE(status)) { - fCalendar = Calendar::createInstance(adoptZone?adoptZone:TimeZone::createDefault(), locale, status); + fCalendar = Calendar::createInstance( + adoptZone ? adoptZone : TimeZone::forLocaleOrDefault(locale), locale, status); } return fCalendar; } diff --git a/deps/icu-small/source/i18n/strmatch.h b/deps/icu-small/source/i18n/strmatch.h index 09d04ede13e61a..84b1d47398fd60 100644 --- a/deps/icu-small/source/i18n/strmatch.h +++ b/deps/icu-small/source/i18n/strmatch.h @@ -109,11 +109,11 @@ class StringMatcher : public UnicodeFunctor, public UnicodeMatcher, public Unico * considered for matching will be text.charAt(limit-1) in the * forward direction or text.charAt(limit+1) in the backward * direction. - * @param incremental if TRUE, then assume further characters may + * @param incremental if true, then assume further characters may * be inserted at limit and check for partial matching. Otherwise * assume the text as given is complete. * @return a match degree value indicating a full match, a partial - * match, or a mismatch. If incremental is FALSE then + * match, or a mismatch. If incremental is false then * U_PARTIAL_MATCH should never be returned. */ virtual UMatchDegree matches(const Replaceable& text, @@ -128,16 +128,16 @@ class StringMatcher : public UnicodeFunctor, public UnicodeMatcher, public Unico * @return A reference to 'result'. */ virtual UnicodeString& toPattern(UnicodeString& result, - UBool escapeUnprintable = FALSE) const; + UBool escapeUnprintable = false) const; /** * Implement UnicodeMatcher - * Returns TRUE if this matcher will match a character c, where c + * Returns true if this matcher will match a character c, where c * & 0xFF == v, at offset, in the forward direction (with limit > * offset). This is used by RuleBasedTransliterator for * indexing. * @param v the given value - * @return TRUE if this matcher will match a character c, + * @return true if this matcher will match a character c, * where c & 0xFF == v */ virtual UBool matchesIndexValue(uint8_t v) const; @@ -181,7 +181,7 @@ class StringMatcher : public UnicodeFunctor, public UnicodeMatcher, public Unico * replacer that is equal to this one. * @param result the string to receive the pattern. Previous * contents will be deleted. - * @param escapeUnprintable if TRUE then convert unprintable + * @param escapeUnprintable if true then convert unprintable * character to their hex escape representations, \\uxxxx or * \\Uxxxxxxxx. Unprintable characters are defined by * Utility.isUnprintable(). diff --git a/deps/icu-small/source/i18n/taiwncal.h b/deps/icu-small/source/i18n/taiwncal.h index daadc124f40a18..bf384fa714f05b 100644 --- a/deps/icu-small/source/i18n/taiwncal.h +++ b/deps/icu-small/source/i18n/taiwncal.h @@ -156,7 +156,7 @@ class TaiwanCalendar : public GregorianCalendar { virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; /** - * Returns TRUE because the Taiwan Calendar does have a default century + * Returns true because the Taiwan Calendar does have a default century * @internal */ virtual UBool haveDefaultCentury() const; diff --git a/deps/icu-small/source/i18n/timezone.cpp b/deps/icu-small/source/i18n/timezone.cpp index b90b78614aa00f..1461b80494e109 100644 --- a/deps/icu-small/source/i18n/timezone.cpp +++ b/deps/icu-small/source/i18n/timezone.cpp @@ -579,6 +579,24 @@ TimeZone::createDefault() // ------------------------------------- +TimeZone* U_EXPORT2 +TimeZone::forLocaleOrDefault(const Locale& locale) +{ + char buffer[ULOC_KEYWORDS_CAPACITY] = ""; + UErrorCode localStatus = U_ZERO_ERROR; + int32_t count = locale.getKeywordValue("timezone", buffer, sizeof(buffer), localStatus); + if (U_FAILURE(localStatus) || localStatus == U_STRING_NOT_TERMINATED_WARNING) { + // the "timezone" keyword exceeds ULOC_KEYWORDS_CAPACITY; ignore and use default. + count = 0; + } + if (count > 0) { + return TimeZone::createTimeZone(UnicodeString(buffer, count, US_INV)); + } + return TimeZone::createDefault(); +} + +// ------------------------------------- + void U_EXPORT2 TimeZone::adoptDefault(TimeZone* zone) { diff --git a/deps/icu-small/source/i18n/transreg.h b/deps/icu-small/source/i18n/transreg.h index 041244e1b02d77..04ed3fb501059c 100644 --- a/deps/icu-small/source/i18n/transreg.h +++ b/deps/icu-small/source/i18n/transreg.h @@ -69,7 +69,7 @@ class TransliteratorAlias : public UMemory { * it when the registry mutex is NOT held, to prevent deadlock. * It may only be called once. * - * Note: Only call create() if isRuleBased() returns FALSE. + * Note: Only call create() if isRuleBased() returns false. * * This method must be called *outside* of the TransliteratorRegistry * mutex. @@ -77,17 +77,17 @@ class TransliteratorAlias : public UMemory { Transliterator* create(UParseError&, UErrorCode&); /** - * Return TRUE if this alias is rule-based. If so, the caller + * Return true if this alias is rule-based. If so, the caller * must call parse() on it, then call TransliteratorRegistry::reget(). */ UBool isRuleBased() const; /** - * If isRuleBased() returns TRUE, then the caller must call this + * If isRuleBased() returns true, then the caller must call this * method, followed by TransliteratorRegistry::reget(). The latter * method must be called inside the TransliteratorRegistry mutex. * - * Note: Only call parse() if isRuleBased() returns TRUE. + * Note: Only call parse() if isRuleBased() returns true. * * This method must be called *outside* of the TransliteratorRegistry * mutex, because it can instantiate Transliterators embedded in diff --git a/deps/icu-small/source/i18n/tridpars.h b/deps/icu-small/source/i18n/tridpars.h index 3d657ed17c9784..cd56146023162f 100644 --- a/deps/icu-small/source/i18n/tridpars.h +++ b/deps/icu-small/source/i18n/tridpars.h @@ -222,7 +222,7 @@ class TransliteratorIDParser /* not : public UObject because all methods are sta * @param source the given source. * @param target the given target. * @param variant the given variant - * @param isSourcePresent If TRUE then the source is present. + * @param isSourcePresent If true then the source is present. * If the source is not present, ANY will be * given as the source, and isSourcePresent will be null * @return an array of 4 strings: source, target, variant, and diff --git a/deps/icu-small/source/i18n/tznames_impl.h b/deps/icu-small/source/i18n/tznames_impl.h index 1286eeb80dc503..417c0511f81f8a 100644 --- a/deps/icu-small/source/i18n/tznames_impl.h +++ b/deps/icu-small/source/i18n/tznames_impl.h @@ -92,9 +92,9 @@ struct CharacterNode { UBool fHasValuesVector; UBool fPadding; - // No value: fValues == NULL and fHasValuesVector == FALSE - // One value: fValues == value and fHasValuesVector == FALSE - // >=2 values: fValues == UVector of values and fHasValuesVector == TRUE + // No value: fValues == NULL and fHasValuesVector == false + // One value: fValues == value and fHasValuesVector == false + // >=2 values: fValues == UVector of values and fHasValuesVector == true }; inline UBool CharacterNode::hasValues() const { diff --git a/deps/icu-small/source/i18n/ucal.cpp b/deps/icu-small/source/i18n/ucal.cpp index 8ea7fbf4f56939..275ef7ea87e273 100644 --- a/deps/icu-small/source/i18n/ucal.cpp +++ b/deps/icu-small/source/i18n/ucal.cpp @@ -91,7 +91,7 @@ ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec) { } } -U_DRAFT int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucal_getHostTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec) { int32_t len = 0; if (ec != NULL && U_SUCCESS(*ec)) { diff --git a/deps/icu-small/source/i18n/ucol_imp.h b/deps/icu-small/source/i18n/ucol_imp.h index a251fc461d3ac2..f463957fd4f2d8 100644 --- a/deps/icu-small/source/i18n/ucol_imp.h +++ b/deps/icu-small/source/i18n/ucol_imp.h @@ -41,10 +41,10 @@ * rules must be equivalent. * @param source first collator * @param target second collator - * @return TRUE or FALSE + * @return true or false * @internal ICU 3.0 */ -U_INTERNAL UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucol_equals(const UCollator *source, const UCollator *target); /** diff --git a/deps/icu-small/source/i18n/ucol_sit.cpp b/deps/icu-small/source/i18n/ucol_sit.cpp index 9fa7cd5fd73851..d6bbf97b310bd3 100644 --- a/deps/icu-small/source/i18n/ucol_sit.cpp +++ b/deps/icu-small/source/i18n/ucol_sit.cpp @@ -372,10 +372,7 @@ int32_t ucol_sit_dumpSpecs(CollatorSpec *s, char *destination, int32_t capacity, } len += s->entries[i].length(); } else { - len += s->entries[i].length(); - if(len < capacity) { - uprv_strncat(destination,s->entries[i].data(), s->entries[i].length()); - } + len += s->entries[i].extract(destination + len, capacity - len, *status); } } } diff --git a/deps/icu-small/source/i18n/ucsdet.cpp b/deps/icu-small/source/i18n/ucsdet.cpp index 46f69cf90cba6b..63f204d0e10421 100644 --- a/deps/icu-small/source/i18n/ucsdet.cpp +++ b/deps/icu-small/source/i18n/ucsdet.cpp @@ -193,7 +193,7 @@ ucsdet_getAllDetectableCharsets(const UCharsetDetector * /*ucsd*/, UErrorCode *s return CharsetDetector::getAllDetectableCharsets(*status); } -U_DRAFT UEnumeration * U_EXPORT2 +U_CAPI UEnumeration * U_EXPORT2 ucsdet_getDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status) { return ((CharsetDetector *)ucsd)->getDetectableCharsets(*status); diff --git a/deps/icu-small/source/i18n/udat.cpp b/deps/icu-small/source/i18n/udat.cpp index da8befc9e3c65b..016805aab66fdd 100644 --- a/deps/icu-small/source/i18n/udat.cpp +++ b/deps/icu-small/source/i18n/udat.cpp @@ -82,19 +82,24 @@ static UCalendarDateFields gDateFieldMapping[] = { UCAL_ZONE_OFFSET, // UDAT_TIMEZONE_ISO_FIELD = 32 (also UCAL_DST_OFFSET) UCAL_ZONE_OFFSET, // UDAT_TIMEZONE_ISO_LOCAL_FIELD = 33 (also UCAL_DST_OFFSET) UCAL_EXTENDED_YEAR, // UDAT_RELATED_YEAR_FIELD = 34 (not an exact match) - UCAL_FIELD_COUNT, // UDAT_FIELD_COUNT = 35 + UCAL_FIELD_COUNT, // UDAT_AM_PM_MIDNIGHT_NOON_FIELD=35 (no match) + UCAL_FIELD_COUNT, // UDAT_FLEXIBLE_DAY_PERIOD_FIELD=36 (no match) + UCAL_FIELD_COUNT, // UDAT_TIME_SEPARATOR_FIELD = 37 (no match) + // UDAT_FIELD_COUNT = 38 as of ICU 67 // UCAL_IS_LEAP_MONTH is not the target of a mapping }; U_CAPI UCalendarDateFields U_EXPORT2 udat_toCalendarDateField(UDateFormatField field) { - return gDateFieldMapping[field]; + static_assert(UDAT_FIELD_COUNT == UPRV_LENGTHOF(gDateFieldMapping), + "UDateFormatField and gDateFieldMapping should have the same number of entries and be kept in sync."); + return (field >= UDAT_ERA_FIELD && field < UPRV_LENGTHOF(gDateFieldMapping))? gDateFieldMapping[field]: UCAL_FIELD_COUNT; } /* For now- one opener. */ static UDateFormatOpener gOpener = NULL; -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_registerOpener(UDateFormatOpener opener, UErrorCode *status) { if(U_FAILURE(*status)) return; @@ -107,7 +112,7 @@ udat_registerOpener(UDateFormatOpener opener, UErrorCode *status) umtx_unlock(NULL); } -U_INTERNAL UDateFormatOpener U_EXPORT2 +U_CAPI UDateFormatOpener U_EXPORT2 udat_unregisterOpener(UDateFormatOpener opener, UErrorCode *status) { if(U_FAILURE(*status)) return NULL; @@ -419,7 +424,7 @@ udat_setLenient( UDateFormat* fmt, ((DateFormat*)fmt)->setLenient(isLenient); } -U_DRAFT UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute attr, UErrorCode* status) @@ -429,7 +434,7 @@ udat_getBooleanAttribute(const UDateFormat* fmt, //return FALSE; } -U_DRAFT void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBool newValue, @@ -452,7 +457,7 @@ udat_setCalendar(UDateFormat* fmt, ((DateFormat*)fmt)->setCalendar(*((Calendar*)calendarToSet)); } -U_DRAFT const UNumberFormat* U_EXPORT2 +U_CAPI const UNumberFormat* U_EXPORT2 udat_getNumberFormatForField(const UDateFormat* fmt, UChar field) { UErrorCode status = U_ZERO_ERROR; @@ -467,7 +472,7 @@ udat_getNumberFormat(const UDateFormat* fmt) return (const UNumberFormat*) ((DateFormat*)fmt)->getNumberFormat(); } -U_DRAFT void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_adoptNumberFormatForFields( UDateFormat* fmt, const UChar* fields, UNumberFormat* numberFormatToSet, @@ -489,7 +494,7 @@ udat_setNumberFormat(UDateFormat* fmt, ((DateFormat*)fmt)->setNumberFormat(*((NumberFormat*)numberFormatToSet)); } -U_DRAFT void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_adoptNumberFormat( UDateFormat* fmt, UNumberFormat* numberFormatToAdopt) { diff --git a/deps/icu-small/source/i18n/udateintervalformat.cpp b/deps/icu-small/source/i18n/udateintervalformat.cpp index 388960384b563f..355744346a39d7 100644 --- a/deps/icu-small/source/i18n/udateintervalformat.cpp +++ b/deps/icu-small/source/i18n/udateintervalformat.cpp @@ -18,6 +18,7 @@ #include "unicode/timezone.h" #include "unicode/locid.h" #include "unicode/unistr.h" +#include "unicode/udisplaycontext.h" #include "formattedval_impl.h" U_NAMESPACE_USE @@ -116,7 +117,7 @@ udtitvfmt_format(const UDateIntervalFormat* formatter, } -U_DRAFT void U_EXPORT2 +U_CAPI void U_EXPORT2 udtitvfmt_formatToResult( const UDateIntervalFormat* formatter, UDate fromDate, @@ -134,7 +135,7 @@ udtitvfmt_formatToResult( } } -U_DRAFT void U_EXPORT2 +U_CAPI void U_EXPORT2 udtitvfmt_formatCalendarToResult( const UDateIntervalFormat* formatter, UCalendar* fromCalendar, @@ -151,5 +152,25 @@ udtitvfmt_formatCalendarToResult( } } +U_CAPI void U_EXPORT2 +udtitvfmt_setContext(UDateIntervalFormat* formatter, + UDisplayContext value, + UErrorCode* status) { + if (U_FAILURE(*status)) { + return; + } + reinterpret_cast(formatter)->setContext( value, *status ); +} + +U_CAPI UDisplayContext U_EXPORT2 +udtitvfmt_getContext(const UDateIntervalFormat* formatter, + UDisplayContextType type, + UErrorCode* status) { + if (U_FAILURE(*status)) { + return (UDisplayContext)0; + } + return reinterpret_cast(formatter)->getContext( type, *status ); +} + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/i18n/uitercollationiterator.h b/deps/icu-small/source/i18n/uitercollationiterator.h index 62b6f8341933bb..3a7b1a0ec23b47 100644 --- a/deps/icu-small/source/i18n/uitercollationiterator.h +++ b/deps/icu-small/source/i18n/uitercollationiterator.h @@ -96,7 +96,7 @@ class U_I18N_API FCDUIterCollationIterator : public UIterCollationIterator { /** * Extends the FCD text segment forward or normalizes around pos. - * @return TRUE if success + * @return true if success */ UBool nextSegment(UErrorCode &errorCode); @@ -107,7 +107,7 @@ class U_I18N_API FCDUIterCollationIterator : public UIterCollationIterator { /** * Extends the FCD text segment backward or normalizes around pos. - * @return TRUE if success + * @return true if success */ UBool previousSegment(UErrorCode &errorCode); diff --git a/deps/icu-small/source/i18n/ulocdata.cpp b/deps/icu-small/source/i18n/ulocdata.cpp index f651fee6fc4efa..3046167b328db8 100644 --- a/deps/icu-small/source/i18n/ulocdata.cpp +++ b/deps/icu-small/source/i18n/ulocdata.cpp @@ -172,7 +172,7 @@ ulocdata_getDelimiter(ULocaleData *uld, ULocaleDataDelimiterType type, return 0; } - delimiter = ures_getStringByKey(delimiterBundle, delimiterKeys[type], &len, &localStatus); + delimiter = ures_getStringByKeyWithFallback(delimiterBundle, delimiterKeys[type], &len, &localStatus); ures_close(delimiterBundle); if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) { diff --git a/deps/icu-small/source/i18n/unicode/alphaindex.h b/deps/icu-small/source/i18n/unicode/alphaindex.h index fe43995fe81155..d72abce9acd3ec 100644 --- a/deps/icu-small/source/i18n/unicode/alphaindex.h +++ b/deps/icu-small/source/i18n/unicode/alphaindex.h @@ -549,14 +549,14 @@ class U_I18N_API AlphabeticIndex: public UObject { /** - * Advance the iteration over the Buckets of this index. Return FALSE if + * Advance the iteration over the Buckets of this index. Return false if * there are no more Buckets. * * @param status Error code, will be set with the reason if the operation fails. * U_ENUM_OUT_OF_SYNC_ERROR will be reported if the index is modified while * an enumeration of its contents are in process. * - * @return TRUE if success, FALSE if at end of iteration + * @return true if success, false if at end of iteration * @stable ICU 4.8 */ virtual UBool nextBucket(UErrorCode &status); @@ -609,7 +609,7 @@ class U_I18N_API AlphabeticIndex: public UObject { * @param status Error code, will be set with the reason if the operation fails. * U_ENUM_OUT_OF_SYNC_ERROR will be reported if the index is modified while * an enumeration of its contents are in process. - * @return TRUE if successful, FALSE when the iteration advances past the last item. + * @return true if successful, false when the iteration advances past the last item. * @stable ICU 4.8 */ virtual UBool nextRecord(UErrorCode &status); diff --git a/deps/icu-small/source/i18n/unicode/basictz.h b/deps/icu-small/source/i18n/unicode/basictz.h index cc8059709f49b0..7199fb341deec8 100644 --- a/deps/icu-small/source/i18n/unicode/basictz.h +++ b/deps/icu-small/source/i18n/unicode/basictz.h @@ -56,7 +56,7 @@ class U_I18N_API BasicTimeZone: public TimeZone { * @param base The base time. * @param inclusive Whether the base time is inclusive or not. * @param result Receives the first transition after the base time. - * @return TRUE if the transition is found. + * @return true if the transition is found. * @stable ICU 3.8 */ virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const = 0; @@ -66,7 +66,7 @@ class U_I18N_API BasicTimeZone: public TimeZone { * @param base The base time. * @param inclusive Whether the base time is inclusive or not. * @param result Receives the most recent transition before the base time. - * @return TRUE if the transition is found. + * @return true if the transition is found. * @stable ICU 3.8 */ virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const = 0; diff --git a/deps/icu-small/source/i18n/unicode/calendar.h b/deps/icu-small/source/i18n/unicode/calendar.h index 2a8c2935ca8e24..cc84bb274dee04 100644 --- a/deps/icu-small/source/i18n/unicode/calendar.h +++ b/deps/icu-small/source/i18n/unicode/calendar.h @@ -464,10 +464,10 @@ class U_I18N_API Calendar : public UObject { UBool operator!=(const Calendar& that) const {return !operator==(that);} /** - * Returns TRUE if the given Calendar object is equivalent to this + * Returns true if the given Calendar object is equivalent to this * one. An equivalent Calendar will behave exactly as this one * does, but it may be set to a different time. By contrast, for - * the operator==() method to return TRUE, the other Calendar must + * the operator==() method to return true, the other Calendar must * be set to the same time. * * @param other the Calendar to be compared with this Calendar @@ -1359,7 +1359,7 @@ class U_I18N_API Calendar : public UObject { * localeID.append(calType); * char langTag[100]; * UErrorCode errorCode = U_ZERO_ERROR; - * int32_t length = uloc_toLanguageTag(localeID.c_str(), langTag, (int32_t)sizeof(langTag), TRUE, &errorCode); + * int32_t length = uloc_toLanguageTag(localeID.c_str(), langTag, (int32_t)sizeof(langTag), true, &errorCode); * if (U_FAILURE(errorCode)) { * // deal with errors & overflow * } @@ -1410,21 +1410,21 @@ class U_I18N_API Calendar : public UObject { virtual int32_t getWeekendTransition(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const; /** - * Returns TRUE if the given UDate is in the weekend in + * Returns true if the given UDate is in the weekend in * this calendar system. * @param date The UDate in question. * @param status The error code for the operation. - * @return TRUE if the given UDate is in the weekend in - * this calendar system, FALSE otherwise. + * @return true if the given UDate is in the weekend in + * this calendar system, false otherwise. * @stable ICU 4.4 */ virtual UBool isWeekend(UDate date, UErrorCode &status) const; /** - * Returns TRUE if this Calendar's current date-time is in the weekend in + * Returns true if this Calendar's current date-time is in the weekend in * this calendar system. - * @return TRUE if this Calendar's current date-time is in the weekend in - * this calendar system, FALSE otherwise. + * @return true if this Calendar's current date-time is in the weekend in + * this calendar system, false otherwise. * @stable ICU 4.4 */ virtual UBool isWeekend(void) const; @@ -2372,7 +2372,7 @@ class U_I18N_API Calendar : public UObject { * * @param key the registry key returned by a previous call to registerFactory * @param status the in/out status code, no special meanings are assigned - * @return TRUE if the factory for the key was successfully unregistered + * @return true if the factory for the key was successfully unregistered * @internal */ static UBool unregister(URegistryKey key, UErrorCode& status); @@ -2398,7 +2398,7 @@ class U_I18N_API Calendar : public UObject { #endif /* !UCONFIG_NO_SERVICE */ /** - * @return TRUE if this calendar has a default century (i.e. 03 -> 2003) + * @return true if this calendar has a default century (i.e. 03 -> 2003) * @internal */ virtual UBool haveDefaultCentury() const = 0; @@ -2458,7 +2458,7 @@ class U_I18N_API Calendar : public UObject { * @param base The base time, inclusive * @param transitionTime Receives the result time * @param status The error status - * @return TRUE if a transition is found. + * @return true if a transition is found. */ UBool getImmediatePreviousZoneTransition(UDate base, UDate *transitionTime, UErrorCode& status) const; @@ -2531,7 +2531,7 @@ Calendar::internalSet(UCalendarDateFields field, int32_t value) { fFields[field] = value; fStamp[field] = kInternallySet; - fIsSet[field] = TRUE; // Remove later + fIsSet[field] = true; // Remove later } diff --git a/deps/icu-small/source/i18n/unicode/choicfmt.h b/deps/icu-small/source/i18n/unicode/choicfmt.h index 3b2f48cb1f853c..cb01fca253355d 100644 --- a/deps/icu-small/source/i18n/unicode/choicfmt.h +++ b/deps/icu-small/source/i18n/unicode/choicfmt.h @@ -106,7 +106,7 @@ class MessageFormat; * arrays of numbers, closure flags and strings, * they are interpreted just like * the sequence of (number separator string) in an equivalent pattern string. - * closure[i]==TRUE corresponds to a less_than separator sign. + * closure[i]==true corresponds to a less_than separator sign. * The equivalent pattern string will be constructed automatically.

    * *

    During formatting, a number is mapped to the first range @@ -126,7 +126,7 @@ class MessageFormat; *

    Here is an example of two arrays that map the number * 1..7 to the English day of the week abbreviations * Sun..Sat. No closures array is given; this is the same as - * specifying all closures to be FALSE.

    + * specifying all closures to be false.

    * *
        {1,2,3,4,5,6,7},
      *     {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"}
    @@ -138,7 +138,7 @@ class MessageFormat; * like the turned bracket in European notation: [-Inf, 1) == [-Inf, 1[ )

    * *
        {0, 1, 1},
    - *     {FALSE, FALSE, TRUE},
    + *     {false, false, true},
      *     {"no files", "one file", "many files"}
    * *

    Here is an example that shows formatting and parsing:

    @@ -189,7 +189,7 @@ class U_I18N_API ChoiceFormat: public NumberFormat { /** * Constructs a new ChoiceFormat with the given limits and message strings. - * All closure flags default to FALSE, + * All closure flags default to false, * equivalent to less_than_or_equal separators. * * Copies the limits and formats instead of adopting them. @@ -210,9 +210,9 @@ class U_I18N_API ChoiceFormat: public NumberFormat { * * @param limits Array of limit values * @param closures Array of booleans specifying whether each - * element of 'limits' is open or closed. If FALSE, then the + * element of 'limits' is open or closed. If false, then the * corresponding limit number is a member of its range. - * If TRUE, then the limit number belongs to the previous range it. + * If true, then the limit number belongs to the previous range it. * @param formats Array of formats * @param count Size of 'limits', 'closures', and 'formats' arrays * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. @@ -568,13 +568,13 @@ class U_I18N_API ChoiceFormat: public NumberFormat { * The intervals may be closed, half open, or open. This affects * formatting but does not affect parsing. Interval i is affected * by fClosures[i] and fClosures[i+1]. If fClosures[i] - * is FALSE, then the value fChoiceLimits[i] is in interval i. + * is false, then the value fChoiceLimits[i] is in interval i. * That is, intervals i and i are: * * i-1: ... x < fChoiceLimits[i] * i: fChoiceLimits[i] <= x ... * - * If fClosures[i] is TRUE, then the value fChoiceLimits[i] is + * If fClosures[i] is true, then the value fChoiceLimits[i] is * in interval i-1. That is, intervals i-1 and i are: * * i-1: ... x <= fChoiceLimits[i] diff --git a/deps/icu-small/source/i18n/unicode/coleitr.h b/deps/icu-small/source/i18n/unicode/coleitr.h index 809d435e509b49..2696b588278cde 100644 --- a/deps/icu-small/source/i18n/unicode/coleitr.h +++ b/deps/icu-small/source/i18n/unicode/coleitr.h @@ -253,7 +253,7 @@ class U_I18N_API CollationElementIterator U_FINAL : public UObject { /** * Checks if a comparison order is ignorable. * @param order the collation order. - * @return TRUE if a character is ignorable, FALSE otherwise. + * @return true if a character is ignorable, false otherwise. * @stable ICU 2.0 */ static inline UBool isIgnorable(int32_t order); diff --git a/deps/icu-small/source/i18n/unicode/coll.h b/deps/icu-small/source/i18n/unicode/coll.h index f5564c73944bcb..c750711fc158cf 100644 --- a/deps/icu-small/source/i18n/unicode/coll.h +++ b/deps/icu-small/source/i18n/unicode/coll.h @@ -236,21 +236,21 @@ class U_I18N_API Collator : public UObject { // Collator public methods -------------------------------------------- /** - * Returns TRUE if "other" is the same as "this". + * Returns true if "other" is the same as "this". * - * The base class implementation returns TRUE if "other" has the same type/class as "this": + * The base class implementation returns true if "other" has the same type/class as "this": * `typeid(*this) == typeid(other)`. * * Subclass implementations should do something like the following: * - * if (this == &other) { return TRUE; } - * if (!Collator::operator==(other)) { return FALSE; } // not the same class + * if (this == &other) { return true; } + * if (!Collator::operator==(other)) { return false; } // not the same class * * const MyCollator &o = (const MyCollator&)other; * (compare this vs. o's subclass fields) * * @param other Collator object to be compared - * @return TRUE if other is the same as this. + * @return true if other is the same as this. * @stable ICU 2.0 */ virtual UBool operator==(const Collator& other) const; @@ -259,7 +259,7 @@ class U_I18N_API Collator : public UObject { * Returns true if "other" is not the same as "this". * Calls ! operator==(const Collator&) const which works for all subclasses. * @param other Collator object to be compared - * @return TRUE if other is not the same as this. + * @return true if other is not the same as this. * @stable ICU 2.0 */ virtual UBool operator!=(const Collator& other) const; @@ -304,7 +304,7 @@ class U_I18N_API Collator : public UObject { * Starting with ICU 54, collation attributes can be specified via locale keywords as well, * in the old locale extension syntax ("el@colCaseFirst=upper") * or in language tag syntax ("el-u-kf-upper"). - * See User Guide: Collation API. + * See User Guide: Collation API. * * The UErrorCode& err parameter is used to return status information to the user. * To check whether the construction succeeded or not, you should check @@ -788,7 +788,7 @@ class U_I18N_API Collator : public UObject { * applications who wish to cache collators, or otherwise reuse * collators when possible. The functional equivalent may change * over time. For more information, please see the + * href="https://unicode-org.github.io/icu/userguide/locale#locales-and-services"> * Locales and Services section of the ICU User Guide. * @param keyword a particular keyword as enumerated by * ucol_getKeywords. @@ -841,7 +841,7 @@ class U_I18N_API Collator : public UObject { * Collator::createInstance to avoid undefined behavior. * @param key the registry key returned by a previous call to registerInstance * @param status the in/out status code, no special meanings are assigned - * @return TRUE if the collator for the key was successfully unregistered + * @return true if the collator for the key was successfully unregistered * @stable ICU 2.6 */ static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status); @@ -1139,7 +1139,7 @@ class U_I18N_API Collator : public UObject { * This string will be normalized. * The structure and the syntax of the string is defined in the "Naming collators" * section of the users guide: - * http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme + * https://unicode-org.github.io/icu/userguide/collation/concepts#collator-naming-scheme * This function supports preflighting. * * This is internal, and intended to be used with delegate converters. diff --git a/deps/icu-small/source/i18n/unicode/curramt.h b/deps/icu-small/source/i18n/unicode/curramt.h index 65e6619db30c16..9c8496381d7aa3 100644 --- a/deps/icu-small/source/i18n/unicode/curramt.h +++ b/deps/icu-small/source/i18n/unicode/curramt.h @@ -41,7 +41,7 @@ class U_I18N_API CurrencyAmount: public Measure { /** * Construct an object with the given numeric amount and the given * ISO currency code. - * @param amount a numeric object; amount.isNumeric() must be TRUE + * @param amount a numeric object; amount.isNumeric() must be true * @param isoCode the 3-letter ISO 4217 currency code; must not be * NULL and must have length 3 * @param ec input-output error code. If the amount or the isoCode diff --git a/deps/icu-small/source/i18n/unicode/dcfmtsym.h b/deps/icu-small/source/i18n/unicode/dcfmtsym.h index 582e7533a4aceb..b2c39a0236e4aa 100644 --- a/deps/icu-small/source/i18n/unicode/dcfmtsym.h +++ b/deps/icu-small/source/i18n/unicode/dcfmtsym.h @@ -378,7 +378,7 @@ class U_I18N_API DecimalFormatSymbols : public UObject { * back to the locale. */ void initialize(const Locale& locale, UErrorCode& success, - UBool useLastResortData = FALSE, const NumberingSystem* ns = nullptr); + UBool useLastResortData = false, const NumberingSystem* ns = nullptr); /** * Initialize the symbols with default values. @@ -543,12 +543,12 @@ inline const UnicodeString& DecimalFormatSymbols::getConstDigitSymbol(int32_t di // ------------------------------------- inline void -DecimalFormatSymbols::setSymbol(ENumberFormatSymbol symbol, const UnicodeString &value, const UBool propogateDigits = TRUE) { +DecimalFormatSymbols::setSymbol(ENumberFormatSymbol symbol, const UnicodeString &value, const UBool propagateDigits = true) { if (symbol == kCurrencySymbol) { - fIsCustomCurrencySymbol = TRUE; + fIsCustomCurrencySymbol = true; } else if (symbol == kIntlCurrencySymbol) { - fIsCustomIntlCurrencySymbol = TRUE; + fIsCustomIntlCurrencySymbol = true; } if(symbolIn order to enable significant digits formatting, use a pattern * containing the '@' pattern character. Alternatively, - * call setSignificantDigitsUsed(TRUE). + * call setSignificantDigitsUsed(true). * *
  • In order to disable significant digits formatting, use a * pattern that does not contain the '@' pattern - * character. Alternatively, call setSignificantDigitsUsed(FALSE). + * character. Alternatively, call setSignificantDigitsUsed(false). * *
  • The number of significant digits has no effect on parsing. * @@ -817,8 +817,8 @@ class U_I18N_API DecimalFormat : public NumberFormat { /** * Sets whether lenient parsing should be enabled (it is off by default). * - * @param enable \c TRUE if lenient parsing should be used, - * \c FALSE otherwise. + * @param enable \c true if lenient parsing should be used, + * \c false otherwise. * @stable ICU 4.8 */ void setLenient(UBool enable) U_OVERRIDE; @@ -1507,7 +1507,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { /** * Return whether or not scientific notation is used. - * @return TRUE if this object formats and parses scientific notation + * @return true if this object formats and parses scientific notation * @see #setScientificNotation * @see #getMinimumExponentDigits * @see #setMinimumExponentDigits @@ -1523,7 +1523,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * maximum number of integer digits is set to more than 8, the effective * maximum will be 1. This allows this call to generate a 'default' scientific * number format without additional changes. - * @param useScientific TRUE if this object formats and parses scientific + * @param useScientific true if this object formats and parses scientific * notation * @see #isScientificNotation * @see #getMinimumExponentDigits @@ -1562,7 +1562,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { /** * Return whether the exponent sign is always shown. - * @return TRUE if the exponent is always prefixed with either the + * @return true if the exponent is always prefixed with either the * localized minus sign or the localized plus sign, false if only negative * exponents are prefixed with the localized minus sign. * @see #setScientificNotation @@ -1577,7 +1577,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { /** * Set whether the exponent sign is always shown. This has no effect * unless scientific notation is in use. - * @param expSignAlways TRUE if the exponent is always prefixed with either + * @param expSignAlways true if the exponent is always prefixed with either * the localized minus sign or the localized plus sign, false if only * negative exponents are prefixed with the localized minus sign. * @see #setScientificNotation @@ -1674,8 +1674,15 @@ class U_I18N_API DecimalFormat : public NumberFormat { int32_t getMinimumGroupingDigits() const; /** - * Sets the minimum grouping digits. Setting to a value less than or - * equal to 1 turns off minimum grouping digits. + * Sets the minimum grouping digits. Setting the value to + * - 1: Turns off minimum grouping digits. + * - 0 or -1: The behavior is undefined. + * - UNUM_MINIMUM_GROUPING_DIGITS_AUTO: Display grouping using the default + * strategy for all locales. + * - UNUM_MINIMUM_GROUPING_DIGITS_MIN2: Display grouping using locale + * defaults, except do not show grouping on values smaller than 10000 + * (such that there is a minimum of two digits before the first + * separator). * * For more control over grouping strategies, use NumberFormatter. * @@ -1689,7 +1696,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * Allows you to get the behavior of the decimal separator with integers. * (The decimal separator will always appear with decimals.) * - * @return TRUE if the decimal separator always appear with decimals. + * @return true if the decimal separator always appear with decimals. * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345 * @stable ICU 2.0 */ @@ -1699,7 +1706,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * Allows you to set the behavior of the decimal separator with integers. * (The decimal separator will always appear with decimals.) * - * @param newValue set TRUE if the decimal separator will always appear with decimals. + * @param newValue set true if the decimal separator will always appear with decimals. * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345 * @stable ICU 2.0 */ @@ -1708,7 +1715,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { /** * Allows you to get the parse behavior of the pattern decimal mark. * - * @return TRUE if input must contain a match to decimal mark in pattern + * @return true if input must contain a match to decimal mark in pattern * @stable ICU 54 */ UBool isDecimalPatternMatchRequired(void) const; @@ -1716,10 +1723,10 @@ class U_I18N_API DecimalFormat : public NumberFormat { /** * Allows you to set the parse behavior of the pattern decimal mark. * - * if TRUE, the input must have a decimal mark if one was specified in the pattern. When - * FALSE the decimal mark may be omitted from the input. + * if true, the input must have a decimal mark if one was specified in the pattern. When + * false the decimal mark may be omitted from the input. * - * @param newValue set TRUE if input must contain a match to decimal mark in pattern + * @param newValue set true if input must contain a match to decimal mark in pattern * @stable ICU 54 */ virtual void setDecimalPatternMatchRequired(UBool newValue); @@ -1962,7 +1969,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * to one. If the maximum significant digits count is less than * min, then it is set to min. * This function also enables the use of significant digits - * by this formatter - areSignificantDigitsUsed() will return TRUE. + * by this formatter - areSignificantDigitsUsed() will return true. * @see #areSignificantDigitsUsed * @param min the fewest significant digits to be shown * @stable ICU 3.0 @@ -1975,7 +1982,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * to one. If the minimum significant digits count is greater * than max, then it is set to max. * This function also enables the use of significant digits - * by this formatter - areSignificantDigitsUsed() will return TRUE. + * by this formatter - areSignificantDigitsUsed() will return true. * @see #areSignificantDigitsUsed * @param max the most significant digits to be shown * @stable ICU 3.0 diff --git a/deps/icu-small/source/i18n/unicode/dtfmtsym.h b/deps/icu-small/source/i18n/unicode/dtfmtsym.h index f9ec88272b2b5c..f368eaef551434 100644 --- a/deps/icu-small/source/i18n/unicode/dtfmtsym.h +++ b/deps/icu-small/source/i18n/unicode/dtfmtsym.h @@ -919,7 +919,8 @@ class U_I18N_API DateFormatSymbols U_FINAL : public UObject { * failure code upon return. * @param useLastResortData determine if use last resort data */ - void initializeData(const Locale& locale, const char *type, UErrorCode& status, UBool useLastResortData = FALSE); + void initializeData(const Locale& locale, const char *type, + UErrorCode& status, UBool useLastResortData = false); /** * Copy or alias an array in another object, as appropriate. @@ -983,12 +984,12 @@ class U_I18N_API DateFormatSymbols U_FINAL : public UObject { static UDateFormatField U_EXPORT2 getPatternCharIndex(char16_t c); /** - * Returns TRUE if f (with its pattern character repeated count times) is a numeric field. + * Returns true if f (with its pattern character repeated count times) is a numeric field. */ static UBool U_EXPORT2 isNumericField(UDateFormatField f, int32_t count); /** - * Returns TRUE if c (repeated count times) is the pattern character for a numeric field. + * Returns true if c (repeated count times) is the pattern character for a numeric field. */ static UBool U_EXPORT2 isNumericPatternChar(char16_t c, int32_t count); public: diff --git a/deps/icu-small/source/i18n/unicode/dtitvfmt.h b/deps/icu-small/source/i18n/unicode/dtitvfmt.h index 4e4d712b4f5b5c..3d20d8e9c44990 100644 --- a/deps/icu-small/source/i18n/unicode/dtitvfmt.h +++ b/deps/icu-small/source/i18n/unicode/dtitvfmt.h @@ -31,6 +31,7 @@ #include "unicode/dtitvinf.h" #include "unicode/dtptngen.h" #include "unicode/formattedvalue.h" +#include "unicode/udisplaycontext.h" U_NAMESPACE_BEGIN @@ -651,6 +652,34 @@ class U_I18N_API DateIntervalFormat : public Format { */ virtual void setTimeZone(const TimeZone& zone); +#ifndef U_FORCE_HIDE_DRAFT_API + /** + * Set a particular UDisplayContext value in the formatter, such as + * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. This causes the formatted + * result to be capitalized appropriately for the context in which + * it is intended to be used, considering both the locale and the + * type of field at the beginning of the formatted result. + * @param value The UDisplayContext value to set. + * @param status Input/output status. If at entry this indicates a failure + * status, the function will do nothing; otherwise this will be + * updated with any new status from the function. + * @draft ICU 68 + */ + virtual void setContext(UDisplayContext value, UErrorCode& status); + + /** + * Get the formatter's UDisplayContext value for the specified UDisplayContextType, + * such as UDISPCTX_TYPE_CAPITALIZATION. + * @param type The UDisplayContextType whose value to return + * @param status Input/output status. If at entry this indicates a failure + * status, the function will do nothing; otherwise this will be + * updated with any new status from the function. + * @return The UDisplayContextValue for the specified type. + * @draft ICU 68 + */ + virtual UDisplayContext getContext(UDisplayContextType type, UErrorCode& status) const; +#endif // U_FORCE_HIDE_DRAFT_API + /** * Return the class ID for this class. This is useful only for comparing to * a return value from getDynamicClassID(). For example: @@ -796,7 +825,7 @@ class U_I18N_API DateIntervalFormat : public Format { * to be formatted into date interval string * @param toCalendar calendar set to the to date in date interval * to be formatted into date interval string - * @param fromToOnSameDay TRUE iff from and to dates are on the same day + * @param fromToOnSameDay true iff from and to dates are on the same day * (any difference is in ampm/hours or below) * @param appendTo Output parameter to receive result. * Result is appended to existing contents. @@ -867,6 +896,19 @@ class U_I18N_API DateIntervalFormat : public Format { + /** + * Converts special hour metacharacters (such as 'j') in the skeleton into locale-appropriate + * pattern characters. + * + * + * @param skeleton The skeleton to convert + * @return A copy of the skeleton, which "j" and any other special hour metacharacters converted to the regular ones. + * + */ + UnicodeString normalizeHourMetacharacters(const UnicodeString& skeleton) const; + + + /** * get separated date and time skeleton from a combined skeleton. * @@ -919,8 +961,8 @@ class U_I18N_API DateIntervalFormat : public Format { * @param dateSkeleton normalized date skeleton * @param timeSkeleton normalized time skeleton * @return whether the resource is found for the skeleton. - * TRUE if interval pattern found for the skeleton, - * FALSE otherwise. + * true if interval pattern found for the skeleton, + * false otherwise. */ UBool setSeparateDateTimePtn(const UnicodeString& dateSkeleton, const UnicodeString& timeSkeleton); @@ -948,8 +990,8 @@ class U_I18N_API DateIntervalFormat : public Format { * @param extendedBestSkeleton extended best match skeleton * @return whether the interval pattern is found * through extending skeleton or not. - * TRUE if interval pattern is found by - * extending skeleton, FALSE otherwise. + * true if interval pattern is found by + * extending skeleton, false otherwise. */ UBool setIntervalPattern(UCalendarDateFields field, const UnicodeString* skeleton, @@ -984,6 +1026,7 @@ class U_I18N_API DateIntervalFormat : public Format { * @param differenceInfo the difference between 2 skeletons * 1 means only field width differs * 2 means v/z exchange + * @param suppressDayPeriodField if true, remove the day period field from the pattern, if there is one * @param adjustedIntervalPattern adjusted interval pattern */ static void U_EXPORT2 adjustFieldWidth( @@ -991,6 +1034,7 @@ class U_I18N_API DateIntervalFormat : public Format { const UnicodeString& bestMatchSkeleton, const UnicodeString& bestMatchIntervalPattern, int8_t differenceInfo, + UBool suppressDayPeriodField, UnicodeString& adjustedIntervalPattern); /** @@ -1137,6 +1181,11 @@ class U_I18N_API DateIntervalFormat : public Format { UnicodeString* fDatePattern; UnicodeString* fTimePattern; UnicodeString* fDateTimeFormat; + + /** + * Other formatting information + */ + UDisplayContext fCapitalizationContext; }; inline UBool diff --git a/deps/icu-small/source/i18n/unicode/dtitvinf.h b/deps/icu-small/source/i18n/unicode/dtitvinf.h index 50e19abb4ce2cb..8452614bfb8d87 100644 --- a/deps/icu-small/source/i18n/unicode/dtitvinf.h +++ b/deps/icu-small/source/i18n/unicode/dtitvinf.h @@ -307,8 +307,8 @@ class U_I18N_API DateIntervalInfo U_FINAL : public UObject { /** Get default order -- whether the first date in pattern is later date or not. - * return default date ordering in interval pattern. TRUE if the first date - * in pattern is later date, FALSE otherwise. + * return default date ordering in interval pattern. true if the first date + * in pattern is later date, false otherwise. * @stable ICU 4.0 */ UBool getDefaultOrder() const; diff --git a/deps/icu-small/source/i18n/unicode/dtptngen.h b/deps/icu-small/source/i18n/unicode/dtptngen.h index f79c6d45dc6b29..357a25d9a8e197 100644 --- a/deps/icu-small/source/i18n/unicode/dtptngen.h +++ b/deps/icu-small/source/i18n/unicode/dtptngen.h @@ -76,6 +76,13 @@ class U_I18N_API DateTimePatternGenerator : public UObject { #ifndef U_HIDE_INTERNAL_API + /** + * For ICU use only. Skips loading the standard date/time patterns (which is done via DateFormat). + * + * @internal + */ + static DateTimePatternGenerator* U_EXPORT2 createInstanceNoStdPat(const Locale& uLocale, UErrorCode& status); + /** * For ICU use only * @@ -526,7 +533,7 @@ class U_I18N_API DateTimePatternGenerator : public UObject { /** * Constructor. */ - DateTimePatternGenerator(const Locale& locale, UErrorCode & status); + DateTimePatternGenerator(const Locale& locale, UErrorCode & status, UBool skipStdPatterns = false); /** * Copy constructor. @@ -573,7 +580,7 @@ class U_I18N_API DateTimePatternGenerator : public UObject { // with #13183, no longer need flags for b, B }; - void initData(const Locale &locale, UErrorCode &status); + void initData(const Locale &locale, UErrorCode &status, UBool skipStdPatterns = false); void addCanonicalItems(UErrorCode &status); void addICUPatterns(const Locale& locale, UErrorCode& status); void hackTimes(const UnicodeString& hackPattern, UErrorCode& status); diff --git a/deps/icu-small/source/i18n/unicode/fieldpos.h b/deps/icu-small/source/i18n/unicode/fieldpos.h index c9849d67a37d29..6c28d2d3159b66 100644 --- a/deps/icu-small/source/i18n/unicode/fieldpos.h +++ b/deps/icu-small/source/i18n/unicode/fieldpos.h @@ -161,7 +161,7 @@ class U_I18N_API FieldPosition : public UObject { /** * Equality operator. * @param that the object to be compared with. - * @return TRUE if the two field positions are equal, FALSE otherwise. + * @return true if the two field positions are equal, false otherwise. * @stable ICU 2.0 */ UBool operator==(const FieldPosition& that) const; @@ -169,7 +169,7 @@ class U_I18N_API FieldPosition : public UObject { /** * Equality operator. * @param that the object to be compared with. - * @return TRUE if the two field positions are not equal, FALSE otherwise. + * @return true if the two field positions are not equal, false otherwise. * @stable ICU 2.0 */ UBool operator!=(const FieldPosition& that) const; diff --git a/deps/icu-small/source/i18n/unicode/fmtable.h b/deps/icu-small/source/i18n/unicode/fmtable.h index 7bec4f6906e7ee..3a090393ac4bec 100644 --- a/deps/icu-small/source/i18n/unicode/fmtable.h +++ b/deps/icu-small/source/i18n/unicode/fmtable.h @@ -179,7 +179,7 @@ class U_I18N_API Formattable : public UObject { /** * Equality comparison. * @param other the object to be compared with. - * @return TRUE if other are equal to this, FALSE otherwise. + * @return true if other are equal to this, false otherwise. * @stable ICU 2.0 */ UBool operator==(const Formattable &other) const; @@ -187,7 +187,7 @@ class U_I18N_API Formattable : public UObject { /** * Equality operator. * @param other the object to be compared with. - * @return TRUE if other are unequal to this, FALSE otherwise. + * @return true if other are unequal to this, false otherwise. * @stable ICU 2.0 */ UBool operator!=(const Formattable& other) const @@ -277,9 +277,9 @@ class U_I18N_API Formattable : public UObject { Type getType(void) const; /** - * Returns TRUE if the data type of this Formattable object + * Returns true if the data type of this Formattable object * is kDouble, kLong, or kInt64 - * @return TRUE if this is a pure numeric object + * @return true if this is a pure numeric object * @stable ICU 3.0 */ UBool isNumeric() const; diff --git a/deps/icu-small/source/i18n/unicode/formattedvalue.h b/deps/icu-small/source/i18n/unicode/formattedvalue.h index 4469b6328e7cb9..f4e588d01cbddf 100644 --- a/deps/icu-small/source/i18n/unicode/formattedvalue.h +++ b/deps/icu-small/source/i18n/unicode/formattedvalue.h @@ -116,7 +116,7 @@ class U_I18N_API ConstrainedFieldPosition : public UMemory { * Gets the field category for the current position. * * The return value is well-defined only after - * FormattedValue#nextPosition returns TRUE. + * FormattedValue#nextPosition returns true. * * @return The field category saved in the instance. * @stable ICU 64 @@ -129,7 +129,7 @@ class U_I18N_API ConstrainedFieldPosition : public UMemory { * Gets the field for the current position. * * The return value is well-defined only after - * FormattedValue#nextPosition returns TRUE. + * FormattedValue#nextPosition returns true. * * @return The field saved in the instance. * @stable ICU 64 @@ -141,7 +141,7 @@ class U_I18N_API ConstrainedFieldPosition : public UMemory { /** * Gets the INCLUSIVE start index for the current position. * - * The return value is well-defined only after FormattedValue#nextPosition returns TRUE. + * The return value is well-defined only after FormattedValue#nextPosition returns true. * * @return The start index saved in the instance. * @stable ICU 64 @@ -153,7 +153,7 @@ class U_I18N_API ConstrainedFieldPosition : public UMemory { /** * Gets the EXCLUSIVE end index stored for the current position. * - * The return value is well-defined only after FormattedValue#nextPosition returns TRUE. + * The return value is well-defined only after FormattedValue#nextPosition returns true. * * @return The end index saved in the instance. * @stable ICU 64 @@ -301,8 +301,8 @@ class U_I18N_API FormattedValue /* not : public UObject because this is an inter * see ConstrainedFieldPosition#constrainCategory * and ConstrainedFieldPosition#constrainField. * @param status Set if an error occurs. - * @return TRUE if a new occurrence of the field was found; - * FALSE otherwise or if an error was set. + * @return true if a new occurrence of the field was found; + * false otherwise or if an error was set. * * @stable ICU 64 */ diff --git a/deps/icu-small/source/i18n/unicode/fpositer.h b/deps/icu-small/source/i18n/unicode/fpositer.h index ba2a838315c7cb..35aa5da20f2cfa 100644 --- a/deps/icu-small/source/i18n/unicode/fpositer.h +++ b/deps/icu-small/source/i18n/unicode/fpositer.h @@ -96,7 +96,7 @@ class U_I18N_API FieldPositionIterator : public UObject { /** * If the current position is valid, updates the FieldPosition values, advances the iterator, - * and returns TRUE, otherwise returns FALSE. + * and returns true, otherwise returns false. * @stable ICU 4.4 */ UBool next(FieldPosition& fp); diff --git a/deps/icu-small/source/i18n/unicode/gregocal.h b/deps/icu-small/source/i18n/unicode/gregocal.h index 236bd003c160a6..139258d822a30c 100644 --- a/deps/icu-small/source/i18n/unicode/gregocal.h +++ b/deps/icu-small/source/i18n/unicode/gregocal.h @@ -344,7 +344,7 @@ class U_I18N_API GregorianCalendar: public Calendar { UBool isLeapYear(int32_t year) const; /** - * Returns TRUE if the given Calendar object is equivalent to this + * Returns true if the given Calendar object is equivalent to this * one. Calendar override. * * @param other the Calendar to be compared with this Calendar @@ -756,7 +756,7 @@ class U_I18N_API GregorianCalendar: public Calendar { public: // internal implementation /** - * @return TRUE if this calendar has the notion of a default century + * @return true if this calendar has the notion of a default century * @internal */ virtual UBool haveDefaultCentury() const; diff --git a/deps/icu-small/source/i18n/unicode/measfmt.h b/deps/icu-small/source/i18n/unicode/measfmt.h index 8f73de87fa55d6..f95f39f0d5e6a2 100644 --- a/deps/icu-small/source/i18n/unicode/measfmt.h +++ b/deps/icu-small/source/i18n/unicode/measfmt.h @@ -309,7 +309,7 @@ class U_I18N_API MeasureFormat : public Format { /** * ICU use only. * Allows subclass to change locale. Note that this method also changes - * the NumberFormat object. Returns TRUE if locale changed; FALSE if no + * the NumberFormat object. Returns true if locale changed; false if no * change was made. * @internal. */ diff --git a/deps/icu-small/source/i18n/unicode/measunit.h b/deps/icu-small/source/i18n/unicode/measunit.h index 8b65497e12eb63..b9f732ae99011d 100644 --- a/deps/icu-small/source/i18n/unicode/measunit.h +++ b/deps/icu-small/source/i18n/unicode/measunit.h @@ -434,7 +434,7 @@ class U_I18N_API MeasureUnit: public UObject { * For example, if the receiver is "kilowatt" and the argument is "hour-per-day", then the * unit "kilowatt-hour-per-day" is returned. * - * NOTE: Only works on SINGLE and COMPOUND units. If either unit (receivee and argument) is a + * NOTE: Only works on SINGLE and COMPOUND units. If either unit (receiver and argument) is a * MIXED unit, an error will occur. For more information, see UMeasureUnitComplexity. * * @param other The MeasureUnit to multiply with the target. @@ -445,9 +445,9 @@ class U_I18N_API MeasureUnit: public UObject { MeasureUnit product(const MeasureUnit& other, UErrorCode& status) const; #endif // U_HIDE_DRAFT_API -#ifndef U_HIDE_INTERNAL_API +#ifndef U_HIDE_DRAFT_API /** - * Gets the list of SINGLE units contained within a MIXED of COMPOUND unit. + * Gets the list of SINGLE units contained within a MIXED or COMPOUND unit. * * Examples: * - Given "meter-kilogram-per-second", three units will be returned: "meter", @@ -457,15 +457,12 @@ class U_I18N_API MeasureUnit: public UObject { * * If this is a SINGLE unit, an array of length 1 will be returned. * - * TODO(ICU-21021): Finalize this API and propose it as draft. - * - * @param outCount The number of elements in the return array. * @param status Set if an error occurs. - * @return An array of single units, owned by the caller. - * @internal ICU 67 Technical Preview + * @return A pair with the list of units as a LocalArray and the number of units in the list. + * @draft ICU 68 */ - LocalArray splitToSingleUnits(int32_t& outCount, UErrorCode& status) const; -#endif // U_HIDE_INTERNAL_API + inline std::pair, int32_t> splitToSingleUnits(UErrorCode& status) const; +#endif // U_HIDE_DRAFT_API /** * getAvailable gets all of the available units. @@ -540,33 +537,10 @@ class U_I18N_API MeasureUnit: public UObject { #ifndef U_HIDE_INTERNAL_API /** * ICU use only. - * Returns associated array index for this measure unit. Only valid for - * non-currency measure units. - * @internal - */ - int32_t getIndex() const; - - /** - * ICU use only. - * Returns maximum value from getIndex plus 1. - * @internal - */ - static int32_t getIndexCount(); - - /** - * ICU use only. - * @return the unit.getIndex() of the unit which has this unit.getType() and unit.getSubtype(), - * or a negative value if there is no such unit + * Returns associated array index for this measure unit. * @internal */ - static int32_t internalGetIndexForTypeAndSubtype(const char *type, const char *subtype); - - /** - * ICU use only. - * @internal - */ - static MeasureUnit resolveUnitPerUnit( - const MeasureUnit &unit, const MeasureUnit &perUnit, bool* isResolved); + int32_t getOffset() const; #endif /* U_HIDE_INTERNAL_API */ // All code between the "Start generated createXXX methods" comment and @@ -913,22 +887,6 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit getMole(); - /** - * Returns by pointer, unit of concentr: permillion. - * Caller owns returned value and must free it. - * Also see {@link #getPartPerMillion()}. - * @param status ICU error code. - * @stable ICU 57 - */ - static MeasureUnit *createPartPerMillion(UErrorCode &status); - - /** - * Returns by value, unit of concentr: permillion. - * Also see {@link #createPartPerMillion()}. - * @stable ICU 64 - */ - static MeasureUnit getPartPerMillion(); - /** * Returns by pointer, unit of concentr: percent. * Caller owns returned value and must free it. @@ -961,6 +919,22 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit getPermille(); + /** + * Returns by pointer, unit of concentr: permillion. + * Caller owns returned value and must free it. + * Also see {@link #getPartPerMillion()}. + * @param status ICU error code. + * @stable ICU 57 + */ + static MeasureUnit *createPartPerMillion(UErrorCode &status); + + /** + * Returns by value, unit of concentr: permillion. + * Also see {@link #createPartPerMillion()}. + * @stable ICU 64 + */ + static MeasureUnit getPartPerMillion(); + /** * Returns by pointer, unit of concentr: permyriad. * Caller owns returned value and must free it. @@ -1265,23 +1239,21 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit getDayPerson(); -#ifndef U_HIDE_DRAFT_API /** * Returns by pointer, unit of duration: decade. * Caller owns returned value and must free it. * Also see {@link #getDecade()}. * @param status ICU error code. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit *createDecade(UErrorCode &status); /** * Returns by value, unit of duration: decade. * Also see {@link #createDecade()}. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit getDecade(); -#endif /* U_HIDE_DRAFT_API */ /** * Returns by pointer, unit of duration: hour. @@ -1667,23 +1639,21 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit getKilowattHour(); -#ifndef U_HIDE_DRAFT_API /** * Returns by pointer, unit of energy: therm-us. * Caller owns returned value and must free it. * Also see {@link #getThermUs()}. * @param status ICU error code. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit *createThermUs(UErrorCode &status); /** * Returns by value, unit of energy: therm-us. * Also see {@link #createThermUs()}. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit getThermUs(); -#endif /* U_HIDE_DRAFT_API */ /** * Returns by pointer, unit of force: newton. @@ -1782,130 +1752,134 @@ class U_I18N_API MeasureUnit: public UObject { static MeasureUnit getMegahertz(); #ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of graphics: dot. + * Caller owns returned value and must free it. + * Also see {@link #getDot()}. + * @param status ICU error code. + * @draft ICU 68 + */ + static MeasureUnit *createDot(UErrorCode &status); + + /** + * Returns by value, unit of graphics: dot. + * Also see {@link #createDot()}. + * @draft ICU 68 + */ + static MeasureUnit getDot(); +#endif /* U_HIDE_DRAFT_API */ + /** * Returns by pointer, unit of graphics: dot-per-centimeter. * Caller owns returned value and must free it. * Also see {@link #getDotPerCentimeter()}. * @param status ICU error code. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit *createDotPerCentimeter(UErrorCode &status); /** * Returns by value, unit of graphics: dot-per-centimeter. * Also see {@link #createDotPerCentimeter()}. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit getDotPerCentimeter(); -#endif /* U_HIDE_DRAFT_API */ -#ifndef U_HIDE_DRAFT_API /** * Returns by pointer, unit of graphics: dot-per-inch. * Caller owns returned value and must free it. * Also see {@link #getDotPerInch()}. * @param status ICU error code. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit *createDotPerInch(UErrorCode &status); /** * Returns by value, unit of graphics: dot-per-inch. * Also see {@link #createDotPerInch()}. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit getDotPerInch(); -#endif /* U_HIDE_DRAFT_API */ -#ifndef U_HIDE_DRAFT_API /** * Returns by pointer, unit of graphics: em. * Caller owns returned value and must free it. * Also see {@link #getEm()}. * @param status ICU error code. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit *createEm(UErrorCode &status); /** * Returns by value, unit of graphics: em. * Also see {@link #createEm()}. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit getEm(); -#endif /* U_HIDE_DRAFT_API */ -#ifndef U_HIDE_DRAFT_API /** * Returns by pointer, unit of graphics: megapixel. * Caller owns returned value and must free it. * Also see {@link #getMegapixel()}. * @param status ICU error code. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit *createMegapixel(UErrorCode &status); /** * Returns by value, unit of graphics: megapixel. * Also see {@link #createMegapixel()}. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit getMegapixel(); -#endif /* U_HIDE_DRAFT_API */ -#ifndef U_HIDE_DRAFT_API /** * Returns by pointer, unit of graphics: pixel. * Caller owns returned value and must free it. * Also see {@link #getPixel()}. * @param status ICU error code. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit *createPixel(UErrorCode &status); /** * Returns by value, unit of graphics: pixel. * Also see {@link #createPixel()}. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit getPixel(); -#endif /* U_HIDE_DRAFT_API */ -#ifndef U_HIDE_DRAFT_API /** * Returns by pointer, unit of graphics: pixel-per-centimeter. * Caller owns returned value and must free it. * Also see {@link #getPixelPerCentimeter()}. * @param status ICU error code. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit *createPixelPerCentimeter(UErrorCode &status); /** * Returns by value, unit of graphics: pixel-per-centimeter. * Also see {@link #createPixelPerCentimeter()}. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit getPixelPerCentimeter(); -#endif /* U_HIDE_DRAFT_API */ -#ifndef U_HIDE_DRAFT_API /** * Returns by pointer, unit of graphics: pixel-per-inch. * Caller owns returned value and must free it. * Also see {@link #getPixelPerInch()}. * @param status ICU error code. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit *createPixelPerInch(UErrorCode &status); /** * Returns by value, unit of graphics: pixel-per-inch. * Also see {@link #createPixelPerInch()}. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit getPixelPerInch(); -#endif /* U_HIDE_DRAFT_API */ /** * Returns by pointer, unit of length: astronomical-unit. @@ -1955,6 +1929,24 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit getDecimeter(); +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of length: earth-radius. + * Caller owns returned value and must free it. + * Also see {@link #getEarthRadius()}. + * @param status ICU error code. + * @draft ICU 68 + */ + static MeasureUnit *createEarthRadius(UErrorCode &status); + + /** + * Returns by value, unit of length: earth-radius. + * Also see {@link #createEarthRadius()}. + * @draft ICU 68 + */ + static MeasureUnit getEarthRadius(); +#endif /* U_HIDE_DRAFT_API */ + /** * Returns by pointer, unit of length: fathom. * Caller owns returned value and must free it. @@ -2243,6 +2235,42 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit getYard(); +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of light: candela. + * Caller owns returned value and must free it. + * Also see {@link #getCandela()}. + * @param status ICU error code. + * @draft ICU 68 + */ + static MeasureUnit *createCandela(UErrorCode &status); + + /** + * Returns by value, unit of light: candela. + * Also see {@link #createCandela()}. + * @draft ICU 68 + */ + static MeasureUnit getCandela(); +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of light: lumen. + * Caller owns returned value and must free it. + * Also see {@link #getLumen()}. + * @param status ICU error code. + * @draft ICU 68 + */ + static MeasureUnit *createLumen(UErrorCode &status); + + /** + * Returns by value, unit of light: lumen. + * Also see {@link #createLumen()}. + * @draft ICU 68 + */ + static MeasureUnit getLumen(); +#endif /* U_HIDE_DRAFT_API */ + /** * Returns by pointer, unit of light: lux. * Caller owns returned value and must free it. @@ -2323,6 +2351,24 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit getEarthMass(); +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of mass: grain. + * Caller owns returned value and must free it. + * Also see {@link #getGrain()}. + * @param status ICU error code. + * @draft ICU 68 + */ + static MeasureUnit *createGrain(UErrorCode &status); + + /** + * Returns by value, unit of mass: grain. + * Also see {@link #createGrain()}. + * @draft ICU 68 + */ + static MeasureUnit getGrain(); +#endif /* U_HIDE_DRAFT_API */ + /** * Returns by pointer, unit of mass: gram. * Caller owns returned value and must free it. @@ -2611,23 +2657,21 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit getAtmosphere(); -#ifndef U_HIDE_DRAFT_API /** * Returns by pointer, unit of pressure: bar. * Caller owns returned value and must free it. * Also see {@link #getBar()}. * @param status ICU error code. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit *createBar(UErrorCode &status); /** * Returns by value, unit of pressure: bar. * Also see {@link #createBar()}. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit getBar(); -#endif /* U_HIDE_DRAFT_API */ /** * Returns by pointer, unit of pressure: hectopascal. @@ -2725,23 +2769,21 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit getMillimeterOfMercury(); -#ifndef U_HIDE_DRAFT_API /** * Returns by pointer, unit of pressure: pascal. * Caller owns returned value and must free it. * Also see {@link #getPascal()}. * @param status ICU error code. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit *createPascal(UErrorCode &status); /** * Returns by value, unit of pressure: pascal. * Also see {@link #createPascal()}. - * @draft ICU 65 + * @stable ICU 65 */ static MeasureUnit getPascal(); -#endif /* U_HIDE_DRAFT_API */ /** * Returns by pointer, unit of pressure: pound-force-per-square-inch. @@ -3143,6 +3185,78 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit getDeciliter(); +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of volume: dessert-spoon. + * Caller owns returned value and must free it. + * Also see {@link #getDessertSpoon()}. + * @param status ICU error code. + * @draft ICU 68 + */ + static MeasureUnit *createDessertSpoon(UErrorCode &status); + + /** + * Returns by value, unit of volume: dessert-spoon. + * Also see {@link #createDessertSpoon()}. + * @draft ICU 68 + */ + static MeasureUnit getDessertSpoon(); +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of volume: dessert-spoon-imperial. + * Caller owns returned value and must free it. + * Also see {@link #getDessertSpoonImperial()}. + * @param status ICU error code. + * @draft ICU 68 + */ + static MeasureUnit *createDessertSpoonImperial(UErrorCode &status); + + /** + * Returns by value, unit of volume: dessert-spoon-imperial. + * Also see {@link #createDessertSpoonImperial()}. + * @draft ICU 68 + */ + static MeasureUnit getDessertSpoonImperial(); +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of volume: dram. + * Caller owns returned value and must free it. + * Also see {@link #getDram()}. + * @param status ICU error code. + * @draft ICU 68 + */ + static MeasureUnit *createDram(UErrorCode &status); + + /** + * Returns by value, unit of volume: dram. + * Also see {@link #createDram()}. + * @draft ICU 68 + */ + static MeasureUnit getDram(); +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of volume: drop. + * Caller owns returned value and must free it. + * Also see {@link #getDrop()}. + * @param status ICU error code. + * @draft ICU 68 + */ + static MeasureUnit *createDrop(UErrorCode &status); + + /** + * Returns by value, unit of volume: drop. + * Also see {@link #createDrop()}. + * @draft ICU 68 + */ + static MeasureUnit getDrop(); +#endif /* U_HIDE_DRAFT_API */ + /** * Returns by pointer, unit of volume: fluid-ounce. * Caller owns returned value and must free it. @@ -3223,6 +3337,24 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit getHectoliter(); +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of volume: jigger. + * Caller owns returned value and must free it. + * Also see {@link #getJigger()}. + * @param status ICU error code. + * @draft ICU 68 + */ + static MeasureUnit *createJigger(UErrorCode &status); + + /** + * Returns by value, unit of volume: jigger. + * Also see {@link #createJigger()}. + * @draft ICU 68 + */ + static MeasureUnit getJigger(); +#endif /* U_HIDE_DRAFT_API */ + /** * Returns by pointer, unit of volume: liter. * Caller owns returned value and must free it. @@ -3271,6 +3403,24 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit getMilliliter(); +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of volume: pinch. + * Caller owns returned value and must free it. + * Also see {@link #getPinch()}. + * @param status ICU error code. + * @draft ICU 68 + */ + static MeasureUnit *createPinch(UErrorCode &status); + + /** + * Returns by value, unit of volume: pinch. + * Also see {@link #createPinch()}. + * @draft ICU 68 + */ + static MeasureUnit getPinch(); +#endif /* U_HIDE_DRAFT_API */ + /** * Returns by pointer, unit of volume: pint. * Caller owns returned value and must free it. @@ -3319,6 +3469,24 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit getQuart(); +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of volume: quart-imperial. + * Caller owns returned value and must free it. + * Also see {@link #getQuartImperial()}. + * @param status ICU error code. + * @draft ICU 68 + */ + static MeasureUnit *createQuartImperial(UErrorCode &status); + + /** + * Returns by value, unit of volume: quart-imperial. + * Also see {@link #createQuartImperial()}. + * @draft ICU 68 + */ + static MeasureUnit getQuartImperial(); +#endif /* U_HIDE_DRAFT_API */ + /** * Returns by pointer, unit of volume: tablespoon. * Caller owns returned value and must free it. @@ -3351,7 +3519,6 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit getTeaspoon(); - // End generated createXXX methods protected: @@ -3369,12 +3536,6 @@ class U_I18N_API MeasureUnit: public UObject { */ void initCurrency(StringPiece isoCurrency); - /** - * For ICU use only. - * @internal - */ - void initNoUnit(const char *subtype); - #endif /* U_HIDE_INTERNAL_API */ private: @@ -3393,7 +3554,6 @@ class U_I18N_API MeasureUnit: public UObject { MeasureUnit(int32_t typeId, int32_t subTypeId); MeasureUnit(MeasureUnitImpl&& impl); void setTo(int32_t typeId, int32_t subTypeId); - int32_t getOffset() const; static MeasureUnit *create(int typeId, int subTypeId, UErrorCode &status); /** @@ -3405,9 +3565,21 @@ class U_I18N_API MeasureUnit: public UObject { */ static bool findBySubType(StringPiece subType, MeasureUnit* output); + /** Internal version of public API */ + LocalArray splitToSingleUnitsImpl(int32_t& outCount, UErrorCode& status) const; + friend struct MeasureUnitImpl; }; +#ifndef U_HIDE_DRAFT_API // @draft ICU 68 +inline std::pair, int32_t> +MeasureUnit::splitToSingleUnits(UErrorCode& status) const { + int32_t length; + auto array = splitToSingleUnitsImpl(length, status); + return std::make_pair(std::move(array), length); +} +#endif // U_HIDE_DRAFT_API + U_NAMESPACE_END #endif // !UNCONFIG_NO_FORMATTING diff --git a/deps/icu-small/source/i18n/unicode/measure.h b/deps/icu-small/source/i18n/unicode/measure.h index a15173d739d94f..0ed02626b13b8f 100644 --- a/deps/icu-small/source/i18n/unicode/measure.h +++ b/deps/icu-small/source/i18n/unicode/measure.h @@ -48,7 +48,7 @@ class U_I18N_API Measure: public UObject { * Construct an object with the given numeric amount and the given * unit. After this call, the caller must not delete the given * unit object. - * @param number a numeric object; amount.isNumeric() must be TRUE + * @param number a numeric object; amount.isNumeric() must be true * @param adoptedUnit the unit object, which must not be NULL * @param ec input-output error code. If the amount or the unit * is invalid, then this will be set to a failing value. diff --git a/deps/icu-small/source/i18n/unicode/msgfmt.h b/deps/icu-small/source/i18n/unicode/msgfmt.h index 99b0eaeec1dcd8..2d9bc8f2e2b0f8 100644 --- a/deps/icu-small/source/i18n/unicode/msgfmt.h +++ b/deps/icu-small/source/i18n/unicode/msgfmt.h @@ -255,7 +255,7 @@ class NumberFormat; * or preformatted values, but not pattern strings or custom format objects.

    * *

    For more details, see the - * ICU User Guide.

    + * ICU User Guide.

    * *

    Usage Information

    * @@ -920,7 +920,7 @@ class U_I18N_API MessageFormat : public Format { int32_t argTypeCapacity; /** - * TRUE if there are different argTypes for the same argument. + * true if there are different argTypes for the same argument. * This only matters when the MessageFormat is used in the plain C (umsg_xxx) API * where the pattern argTypes determine how the va_arg list is read. */ diff --git a/deps/icu-small/source/i18n/unicode/nounit.h b/deps/icu-small/source/i18n/unicode/nounit.h index 61b5c16ee3955b..cee45e352df473 100644 --- a/deps/icu-small/source/i18n/unicode/nounit.h +++ b/deps/icu-small/source/i18n/unicode/nounit.h @@ -29,80 +29,53 @@ U_NAMESPACE_BEGIN /** * Dimensionless unit for percent and permille. + * Prior to ICU 68, this namespace was a class with the same name. * @see NumberFormatter - * @draft ICU 60 + * @draft ICU 68 */ -class U_I18N_API NoUnit: public MeasureUnit { -public: +namespace NoUnit { /** * Returns an instance for the base unit (dimensionless and no scaling). * - * @return a NoUnit instance - * @draft ICU 60 + * Prior to ICU 68, this function returned a NoUnit by value. + * + * Since ICU 68, this function returns the same value as the default MeasureUnit constructor. + * + * @return a MeasureUnit instance + * @draft ICU 68 */ - static NoUnit U_EXPORT2 base(); + static inline MeasureUnit U_EXPORT2 base() { + return MeasureUnit(); + } /** * Returns an instance for percent, or 1/100 of a base unit. * - * @return a NoUnit instance - * @draft ICU 60 + * Prior to ICU 68, this function returned a NoUnit by value. + * + * Since ICU 68, this function returns the same value as MeasureUnit::getPercent(). + * + * @return a MeasureUnit instance + * @draft ICU 68 */ - static NoUnit U_EXPORT2 percent(); + static inline MeasureUnit U_EXPORT2 percent() { + return MeasureUnit::getPercent(); + } /** * Returns an instance for permille, or 1/1000 of a base unit. * - * @return a NoUnit instance - * @draft ICU 60 - */ - static NoUnit U_EXPORT2 permille(); - - /** - * Copy operator. - * @draft ICU 60 - */ - NoUnit(const NoUnit& other); - - /** - * Destructor. - * @draft ICU 60 - */ - virtual ~NoUnit(); - - /** - * Return a polymorphic clone of this object. The result will - * have the same class as returned by getDynamicClassID(). - * @draft ICU 60 - */ - virtual NoUnit* clone() const; - - /** - * Returns a unique class ID for this object POLYMORPHICALLY. - * This method implements a simple form of RTTI used by ICU. - * @return The class ID for this object. All objects of a given - * class have the same class ID. Objects of other classes have - * different class IDs. - * @draft ICU 60 - */ - virtual UClassID getDynamicClassID() const; - - /** - * Returns the class ID for this class. This is used to compare to - * the return value of getDynamicClassID(). - * @return The class ID for all objects of this class. - * @draft ICU 60 - */ - static UClassID U_EXPORT2 getStaticClassID(); - -private: - /** - * Constructor - * @internal (private) + * Prior to ICU 68, this function returned a NoUnit by value. + * + * Since ICU 68, this function returns the same value as MeasureUnit::getPermille(). + * + * @return a MeasureUnit instance + * @draft ICU 68 */ - NoUnit(const char* subtype); - -}; + static inline MeasureUnit U_EXPORT2 permille() { + return MeasureUnit::getPermille(); + } +} U_NAMESPACE_END diff --git a/deps/icu-small/source/i18n/unicode/numberformatter.h b/deps/icu-small/source/i18n/unicode/numberformatter.h index 615cf49f7b7539..06329b8e7aa024 100644 --- a/deps/icu-small/source/i18n/unicode/numberformatter.h +++ b/deps/icu-small/source/i18n/unicode/numberformatter.h @@ -99,6 +99,13 @@ class MultiplierParseHandler; } } +namespace units { + +// Forward declarations: +class UnitsRouter; + +} // namespace units + namespace number { // icu::number // Forward declarations: @@ -157,6 +164,7 @@ struct RangeMacroProps; struct UFormattedNumberImpl; class MutablePatternModifier; class ImmutablePatternModifier; +struct DecimalFormatWarehouse; /** * Used for NumberRangeFormatter and implemented in numrange_fluent.cpp. @@ -371,9 +379,9 @@ class U_I18N_API Notation : public UMemory { UBool copyErrorTo(UErrorCode &status) const { if (fType == NTN_ERROR) { status = fUnion.errorCode; - return TRUE; + return true; } - return FALSE; + return false; } // To allow MacroProps to initialize empty instances: @@ -705,12 +713,8 @@ class U_I18N_API Precision : public UMemory { typedef PrecisionUnion::FractionSignificantSettings FractionSignificantSettings; typedef PrecisionUnion::IncrementSettings IncrementSettings; - /** The Precision encapsulates the RoundingMode when used within the implementation. */ - UNumberFormatRoundingMode fRoundingMode; - - Precision(const PrecisionType& type, const PrecisionUnion& union_, - UNumberFormatRoundingMode roundingMode) - : fType(type), fUnion(union_), fRoundingMode(roundingMode) {} + Precision(const PrecisionType& type, const PrecisionUnion& union_) + : fType(type), fUnion(union_) {} Precision(UErrorCode errorCode) : fType(RND_ERROR) { fUnion.errorCode = errorCode; @@ -725,9 +729,9 @@ class U_I18N_API Precision : public UMemory { UBool copyErrorTo(UErrorCode &status) const { if (fType == RND_ERROR) { status = fUnion.errorCode; - return TRUE; + return true; } - return FALSE; + return false; } // On the parent type so that this method can be called internally on Precision instances. @@ -744,8 +748,6 @@ class U_I18N_API Precision : public UMemory { static CurrencyPrecision constructCurrency(UCurrencyUsage usage); - static Precision constructPassThrough(); - // To allow MacroProps/MicroProps to initialize bogus instances: friend struct impl::MacroProps; friend struct impl::MicroProps; @@ -766,6 +768,9 @@ class U_I18N_API Precision : public UMemory { // To allow access to the skeleton generation code: friend class impl::GeneratorHelpers; + + // To allow access to isBogus and the default (bogus) constructor: + friend class units::UnitsRouter; }; /** @@ -969,9 +974,9 @@ class U_I18N_API IntegerWidth : public UMemory { UBool copyErrorTo(UErrorCode &status) const { if (fHasError) { status = fUnion.errorCode; - return TRUE; + return true; } - return FALSE; + return false; } void apply(impl::DecimalQuantity &quantity, UErrorCode &status) const; @@ -1095,11 +1100,11 @@ class U_I18N_API Scale : public UMemory { } UBool copyErrorTo(UErrorCode &status) const { - if (fError != U_ZERO_ERROR) { + if (U_FAILURE(fError)) { status = fError; - return TRUE; + return true; } - return FALSE; + return false; } void applyTo(impl::DecimalQuantity& quantity) const; @@ -1126,6 +1131,71 @@ class U_I18N_API Scale : public UMemory { namespace impl { +// Do not enclose entire Usage with #ifndef U_HIDE_INTERNAL_API, needed for a protected field +/** + * Manages NumberFormatterSettings::usage()'s char* instance on the heap. + * @internal + */ +class U_I18N_API Usage : public UMemory { + +#ifndef U_HIDE_INTERNAL_API + + public: + /** @internal */ + Usage(const Usage& other); + + /** @internal */ + Usage& operator=(const Usage& other); + + /** @internal */ + Usage(Usage &&src) U_NOEXCEPT; + + /** @internal */ + Usage& operator=(Usage&& src) U_NOEXCEPT; + + /** @internal */ + ~Usage(); + + /** @internal */ + int16_t length() const { return fLength; } + + /** @internal + * Makes a copy of value. Set to "" to unset. + */ + void set(StringPiece value); + + /** @internal */ + bool isSet() const { return fLength > 0; } + +#endif // U_HIDE_INTERNAL_API + + private: + char *fUsage; + int16_t fLength; + UErrorCode fError; + + Usage() : fUsage(nullptr), fLength(0), fError(U_ZERO_ERROR) {} + + /** @internal */ + UBool copyErrorTo(UErrorCode &status) const { + if (U_FAILURE(fError)) { + status = fError; + return true; + } + return false; + } + + // Allow NumberFormatterImpl to access fUsage. + friend class impl::NumberFormatterImpl; + + // Allow skeleton generation code to access private members. + friend class impl::GeneratorHelpers; + + // Allow MacroProps/MicroProps to initialize empty instances and to call + // copyErrorTo(). + friend struct impl::MacroProps; +}; + // Do not enclose entire SymbolsWrapper with #ifndef U_HIDE_INTERNAL_API, needed for a protected field /** @internal */ class U_I18N_API SymbolsWrapper : public UMemory { @@ -1192,12 +1262,12 @@ class U_I18N_API SymbolsWrapper : public UMemory { UBool copyErrorTo(UErrorCode &status) const { if (fType == SYMPTR_DFS && fPtr.dfs == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; - return TRUE; + return true; } else if (fType == SYMPTR_NS && fPtr.ns == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; - return TRUE; + return true; } - return FALSE; + return false; } private: @@ -1239,13 +1309,13 @@ class U_I18N_API Grouper : public UMemory { fGrouping2(grouping2), fMinGrouping(minGrouping), fStrategy(strategy) {} -#endif // U_HIDE_INTERNAL_API /** @internal */ int16_t getPrimary() const; /** @internal */ int16_t getSecondary() const; +#endif // U_HIDE_INTERNAL_API private: /** @@ -1309,10 +1379,10 @@ class U_I18N_API Padder : public UMemory { /** @internal */ static Padder codePoints(UChar32 cp, int32_t targetWidth, UNumberFormatPadPosition position); -#endif // U_HIDE_INTERNAL_API /** @internal */ static Padder forProperties(const DecimalFormatProperties& properties); +#endif // U_HIDE_INTERNAL_API private: UChar32 fWidth; // -3 = error; -2 = bogus; -1 = no padding @@ -1341,9 +1411,9 @@ class U_I18N_API Padder : public UMemory { UBool copyErrorTo(UErrorCode &status) const { if (fWidth == -3) { status = fUnion.errorCode; - return TRUE; + return true; } - return FALSE; + return false; } bool isValid() const { @@ -1372,10 +1442,10 @@ struct U_I18N_API MacroProps : public UMemory { Notation notation; /** @internal */ - MeasureUnit unit; // = NoUnit::base(); + MeasureUnit unit; // = MeasureUnit(); (the base dimensionless unit) /** @internal */ - MeasureUnit perUnit; // = NoUnit::base(); + MeasureUnit perUnit; // = MeasureUnit(); (the base dimensionless unit) /** @internal */ Precision precision; // = Precision(); (bogus) @@ -1409,6 +1479,9 @@ struct U_I18N_API MacroProps : public UMemory { /** @internal */ Scale scale; // = Scale(); (benign value) + /** @internal */ + Usage usage; // = Usage(); (no usage) + /** @internal */ const AffixPatternProvider* affixProvider = nullptr; // no ownership @@ -1430,7 +1503,7 @@ struct U_I18N_API MacroProps : public UMemory { bool copyErrorTo(UErrorCode &status) const { return notation.copyErrorTo(status) || precision.copyErrorTo(status) || padder.copyErrorTo(status) || integerWidth.copyErrorTo(status) || - symbols.copyErrorTo(status) || scale.copyErrorTo(status); + symbols.copyErrorTo(status) || scale.copyErrorTo(status) || usage.copyErrorTo(status); } }; @@ -1507,10 +1580,15 @@ class U_I18N_API NumberFormatterSettings { * All units will be properly localized with locale data, and all units are compatible with notation styles, * rounding precisions, and other number formatter settings. * + * \note If the usage() is set, the output unit **will be changed** to + * produce localised units, according to usage, locale and unit. See + * FormattedNumber::getOutputUnit(). + * * Pass this method any instance of {@link MeasureUnit}. For units of measure: * *
          * NumberFormatter::with().unit(MeasureUnit::getMeter())
    +     * NumberFormatter::with().unit(MeasureUnit::forIdentifier("foot-per-second", status))
          * 
    * * Currency: @@ -1693,7 +1771,7 @@ class U_I18N_API NumberFormatterSettings { * * The default is HALF_EVEN. For more information on rounding mode, see the ICU userguide here: * - * http://userguide.icu-project.org/formatparse/numbers/rounding-modes + * https://unicode-org.github.io/icu/userguide/format_parse/numbers/rounding-modes * * @param roundingMode The rounding mode to use. * @return The fluent chain. @@ -2038,6 +2116,61 @@ class U_I18N_API NumberFormatterSettings { */ Derived scale(const Scale &scale) &&; +#ifndef U_HIDE_DRAFT_API + /** + * Specifies the usage for which numbers will be formatted ("person-height", + * "road", "rainfall", etc.) + * + * When a `usage` is specified, the output unit will change depending on the + * `Locale` and the unit quantity. For example, formatting length + * measurements specified in meters: + * + * `NumberFormatter::with().usage("person").unit(MeasureUnit::getMeter()).locale("en-US")` + * * When formatting 0.25, the output will be "10 inches". + * * When formatting 1.50, the output will be "4 feet and 11 inches". + * + * The input unit specified via unit() determines the type of measurement + * being formatted (e.g. "length" when the unit is "foot"). The usage + * requested will be looked for only within this category of measurement + * units. + * + * The output unit can be found via FormattedNumber::getOutputUnit(). + * + * If the usage has multiple parts (e.g. "land-agriculture-grain") and does + * not match a known usage preference, the last part will be dropped + * repeatedly until a match is found (e.g. trying "land-agriculture", then + * "land"). If a match is still not found, usage will fall back to + * "default". + * + * Setting usage to an empty string clears the usage (disables usage-based + * localized formatting). + * + * Setting a usage string but not a correct input unit will result in an + * U_ILLEGAL_ARGUMENT_ERROR. + * + * When using usage, specifying rounding or precision is unnecessary. + * Specifying a precision in some manner will override the default + * formatting. + * + * @param usage A `usage` parameter from the units resource. See the + * unitPreferenceData in *source/data/misc/units.txt*, generated from + * `unitPreferenceData` in [CLDR's + * supplemental/units.xml](https://github.com/unicode-org/cldr/blob/master/common/supplemental/units.xml). + * @return The fluent chain. + * @draft ICU 68 + */ + Derived usage(StringPiece usage) const &; + + /** + * Overload of usage() for use on an rvalue reference. + * + * @param usage The unit `usage`. + * @return The fluent chain. + * @draft ICU 68 + */ + Derived usage(StringPiece usage) &&; +#endif // U_HIDE_DRAFT_API + #ifndef U_HIDE_INTERNAL_API /** @@ -2120,13 +2253,13 @@ class U_I18N_API NumberFormatterSettings { /** * Sets the UErrorCode if an error occurred in the fluent chain. * Preserves older error codes in the outErrorCode. - * @return TRUE if U_FAILURE(outErrorCode) + * @return true if U_FAILURE(outErrorCode) * @stable ICU 60 */ UBool copyErrorTo(UErrorCode &outErrorCode) const { if (U_FAILURE(outErrorCode)) { // Do not overwrite the older error code - return TRUE; + return true; } fMacros.copyErrorTo(outErrorCode); return U_FAILURE(outErrorCode); @@ -2385,6 +2518,10 @@ class U_I18N_API LocalizedNumberFormatter const impl::NumberFormatterImpl* fCompiled {nullptr}; char fUnsafeCallCount[8] {}; // internally cast to u_atomic_int32_t + // Owned pointer to a DecimalFormatWarehouse, used when copying a LocalizedNumberFormatter + // from a DecimalFormat. + const impl::DecimalFormatWarehouse* fWarehouse {nullptr}; + explicit LocalizedNumberFormatter(const NumberFormatterSettings& other); explicit LocalizedNumberFormatter(NumberFormatterSettings&& src) U_NOEXCEPT; @@ -2393,10 +2530,12 @@ class U_I18N_API LocalizedNumberFormatter LocalizedNumberFormatter(impl::MacroProps &¯os, const Locale &locale); - void clear(); + void resetCompiled(); void lnfMoveHelper(LocalizedNumberFormatter&& src); + void lnfCopyHelper(const LocalizedNumberFormatter& src, UErrorCode& status); + /** * @return true if the compiled formatter is available. */ @@ -2485,7 +2624,6 @@ class U_I18N_API FormattedNumber : public UMemory, public FormattedValue { /** @copydoc FormattedValue::nextPosition() */ UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE; -#ifndef U_HIDE_DRAFT_API /** * Export the formatted number as a "numeric string" conforming to the * syntax defined in the Decimal Arithmetic Specification, available at @@ -2502,10 +2640,24 @@ class U_I18N_API FormattedNumber : public UMemory, public FormattedValue { * for example, std::string. * @param status Set if an error occurs. * @return A StringClass containing the numeric string. - * @draft ICU 65 + * @stable ICU 65 */ template inline StringClass toDecimalNumber(UErrorCode& status) const; + +#ifndef U_HIDE_DRAFT_API + /** + * Gets the resolved output unit. + * + * The output unit is dependent upon the localized preferences for the usage + * specified via NumberFormatterSettings::usage(), and may be a unit with + * UMEASURE_UNIT_MIXED unit complexity (MeasureUnit::getComplexity()), such + * as "foot-and-inch" or "hour-and-minute-and-second". + * + * @return `MeasureUnit`. + * @draft ICU 68 + */ + MeasureUnit getOutputUnit(UErrorCode& status) const; #endif // U_HIDE_DRAFT_API #ifndef U_HIDE_INTERNAL_API @@ -2541,7 +2693,6 @@ class U_I18N_API FormattedNumber : public UMemory, public FormattedValue { explicit FormattedNumber(UErrorCode errorCode) : fData(nullptr), fErrorCode(errorCode) {} - // TODO(ICU-20775): Propose this as API. void toDecimalNumber(ByteSink& sink, UErrorCode& status) const; // To give LocalizedNumberFormatter format methods access to this class's constructor: @@ -2639,4 +2790,3 @@ U_NAMESPACE_END #endif /* U_SHOW_CPLUSPLUS_API */ #endif // __NUMBERFORMATTER_H__ - diff --git a/deps/icu-small/source/i18n/unicode/numberrangeformatter.h b/deps/icu-small/source/i18n/unicode/numberrangeformatter.h index 59f14d8be53189..67339bb6e68da8 100644 --- a/deps/icu-small/source/i18n/unicode/numberrangeformatter.h +++ b/deps/icu-small/source/i18n/unicode/numberrangeformatter.h @@ -16,6 +16,7 @@ #include "unicode/formattedvalue.h" #include "unicode/fpositer.h" #include "unicode/numberformatter.h" +#include "unicode/unumberrangeformatter.h" /** * \file @@ -31,7 +32,7 @@ * .numberFormatterFirst(NumberFormatter::with().adoptUnit(MeasureUnit::createMeter())) * .numberFormatterSecond(NumberFormatter::with().adoptUnit(MeasureUnit::createKilometer())) * .locale("en-GB") - * .formatRange(750, 1.2, status) + * .formatFormattableRange(750, 1.2, status) * .toString(status); * // => "750 m - 1.2 km" * @@ -44,130 +45,11 @@ */ -/** - * Defines how to merge fields that are identical across the range sign. - * - * @stable ICU 63 - */ -typedef enum UNumberRangeCollapse { - /** - * Use locale data and heuristics to determine how much of the string to collapse. Could end up collapsing none, - * some, or all repeated pieces in a locale-sensitive way. - * - * The heuristics used for this option are subject to change over time. - * - * @stable ICU 63 - */ - UNUM_RANGE_COLLAPSE_AUTO, - - /** - * Do not collapse any part of the number. Example: "3.2 thousand kilograms – 5.3 thousand kilograms" - * - * @stable ICU 63 - */ - UNUM_RANGE_COLLAPSE_NONE, - - /** - * Collapse the unit part of the number, but not the notation, if present. Example: "3.2 thousand – 5.3 thousand - * kilograms" - * - * @stable ICU 63 - */ - UNUM_RANGE_COLLAPSE_UNIT, - - /** - * Collapse any field that is equal across the range sign. May introduce ambiguity on the magnitude of the - * number. Example: "3.2 – 5.3 thousand kilograms" - * - * @stable ICU 63 - */ - UNUM_RANGE_COLLAPSE_ALL -} UNumberRangeCollapse; - -/** - * Defines the behavior when the two numbers in the range are identical after rounding. To programmatically detect - * when the identity fallback is used, compare the lower and upper BigDecimals via FormattedNumber. - * - * @stable ICU 63 - * @see NumberRangeFormatter - */ -typedef enum UNumberRangeIdentityFallback { - /** - * Show the number as a single value rather than a range. Example: "$5" - * - * @stable ICU 63 - */ - UNUM_IDENTITY_FALLBACK_SINGLE_VALUE, - - /** - * Show the number using a locale-sensitive approximation pattern. If the numbers were the same before rounding, - * show the single value. Example: "~$5" or "$5" - * - * @stable ICU 63 - */ - UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE, - - /** - * Show the number using a locale-sensitive approximation pattern. Use the range pattern always, even if the - * inputs are the same. Example: "~$5" - * - * @stable ICU 63 - */ - UNUM_IDENTITY_FALLBACK_APPROXIMATELY, - - /** - * Show the number as the range of two equal values. Use the range pattern always, even if the inputs are the - * same. Example (with RangeCollapse.NONE): "$5 – $5" - * - * @stable ICU 63 - */ - UNUM_IDENTITY_FALLBACK_RANGE -} UNumberRangeIdentityFallback; - -/** - * Used in the result class FormattedNumberRange to indicate to the user whether the numbers formatted in the range - * were equal or not, and whether or not the identity fallback was applied. - * - * @stable ICU 63 - * @see NumberRangeFormatter - */ -typedef enum UNumberRangeIdentityResult { - /** - * Used to indicate that the two numbers in the range were equal, even before any rounding rules were applied. - * - * @stable ICU 63 - * @see NumberRangeFormatter - */ - UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING, - - /** - * Used to indicate that the two numbers in the range were equal, but only after rounding rules were applied. - * - * @stable ICU 63 - * @see NumberRangeFormatter - */ - UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING, - - /** - * Used to indicate that the two numbers in the range were not equal, even after rounding rules were applied. - * - * @stable ICU 63 - * @see NumberRangeFormatter - */ - UNUM_IDENTITY_RESULT_NOT_EQUAL, - -#ifndef U_HIDE_INTERNAL_API - /** - * The number of entries in this enum. - * @internal - */ - UNUM_IDENTITY_RESULT_COUNT -#endif - -} UNumberRangeIdentityResult; - U_NAMESPACE_BEGIN +// Forward declarations: +class PluralRules; + namespace number { // icu::number // Forward declarations: @@ -182,6 +64,7 @@ struct RangeMacroProps; class DecimalQuantity; class UFormattedNumberRangeData; class NumberRangeFormatterImpl; +struct UFormattedNumberRangeImpl; } // namespace impl @@ -418,8 +301,8 @@ class U_I18N_API NumberRangeFormatterSettings { /** * Sets the behavior when the two sides of the range are the same. This could happen if the same two numbers are - * passed to the formatRange function, or if different numbers are passed to the function but they become the same - * after rounding rules are applied. Possible values: + * passed to the formatFormattableRange function, or if different numbers are passed to the function but they + * become the same after rounding rules are applied. Possible values: *

    *

      *
    • SINGLE_VALUE: "5 miles"
    • @@ -474,13 +357,13 @@ class U_I18N_API NumberRangeFormatterSettings { /** * Sets the UErrorCode if an error occurred in the fluent chain. * Preserves older error codes in the outErrorCode. - * @return TRUE if U_FAILURE(outErrorCode) + * @return true if U_FAILURE(outErrorCode) * @stable ICU 63 */ UBool copyErrorTo(UErrorCode &outErrorCode) const { if (U_FAILURE(outErrorCode)) { // Do not overwrite the older error code - return TRUE; + return true; } fMacros.copyErrorTo(outErrorCode); return U_FAILURE(outErrorCode); @@ -725,7 +608,7 @@ class U_I18N_API FormattedNumberRange : public UMemory, public FormattedValue { /** @copydoc FormattedValue::nextPosition() */ UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE; -#ifndef U_HIDE_DRAFT_API +#ifndef U_HIDE_DEPRECATED_API /** * Export the first formatted number as a decimal number. This endpoint * is useful for obtaining the exact number being printed after scaling @@ -735,8 +618,12 @@ class U_I18N_API FormattedNumberRange : public UMemory, public FormattedValue { * as defined in the Decimal Arithmetic Specification, available at * http://speleotrove.com/decimal * + * TODO(ICU-21275): This function will be removed in ICU 69. + * Use getDecimalNumbers() instead. + * + * @param status Set if an error occurs. * @return A decimal representation of the first formatted number. - * @draft ICU 63 + * @deprecated ICU 68 Use getDecimalNumbers instead. * @see NumberRangeFormatter * @see #getSecondDecimal */ @@ -751,12 +638,41 @@ class U_I18N_API FormattedNumberRange : public UMemory, public FormattedValue { * as defined in the Decimal Arithmetic Specification, available at * http://speleotrove.com/decimal * + * TODO(ICU-21275): This function will be removed in ICU 69. + * Use getDecimalNumbers() instead. + * + * @param status Set if an error occurs. * @return A decimal representation of the second formatted number. - * @draft ICU 63 + * @deprecated ICU 68 Use getDecimalNumbers instead. * @see NumberRangeFormatter * @see #getFirstDecimal */ UnicodeString getSecondDecimal(UErrorCode& status) const; +#endif // U_HIDE_DEPRECATED_API + + +#ifndef U_HIDE_DRAFT_API + /** + * Extracts the formatted range as a pair of decimal numbers. This endpoint + * is useful for obtaining the exact number being printed after scaling + * and rounding have been applied by the number range formatting pipeline. + * + * The syntax of the unformatted numbers is a "numeric string" + * as defined in the Decimal Arithmetic Specification, available at + * http://speleotrove.com/decimal + * + * Example C++17 call site: + * + * auto [ first, second ] = range.getDecimalNumbers(status); + * + * @tparam StringClass A string class compatible with StringByteSink; + * for example, std::string. + * @param status Set if an error occurs. + * @return A pair of StringClasses containing the numeric strings. + * @draft ICU 68 + */ + template + inline std::pair getDecimalNumbers(UErrorCode& status) const; #endif // U_HIDE_DRAFT_API /** @@ -818,10 +734,33 @@ class U_I18N_API FormattedNumberRange : public UMemory, public FormattedValue { void getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, UErrorCode& status) const; + void getDecimalNumbers(ByteSink& sink1, ByteSink& sink2, UErrorCode& status) const; + + const impl::UFormattedNumberRangeData* getData(UErrorCode& status) const; + + // To allow PluralRules to access the underlying data + friend class ::icu::PluralRules; + // To give LocalizedNumberRangeFormatter format methods access to this class's constructor: friend class LocalizedNumberRangeFormatter; + + // To give C API access to internals + friend struct impl::UFormattedNumberRangeImpl; }; +#ifndef U_HIDE_DRAFT_API +// Note: This is draft ICU 68 +template +std::pair FormattedNumberRange::getDecimalNumbers(UErrorCode& status) const { + StringClass str1; + StringClass str2; + StringByteSink sink1(&str1); + StringByteSink sink2(&str2); + getDecimalNumbers(sink1, sink2, status); + return std::make_pair(str1, str2); +} +#endif // U_HIDE_DRAFT_API + /** * See the main description in numberrangeformatter.h for documentation and examples. * diff --git a/deps/icu-small/source/i18n/unicode/numfmt.h b/deps/icu-small/source/i18n/unicode/numfmt.h index a882b6d2e5667d..058ccb38c7f1a4 100644 --- a/deps/icu-small/source/i18n/unicode/numfmt.h +++ b/deps/icu-small/source/i18n/unicode/numfmt.h @@ -179,7 +179,7 @@ class U_I18N_API NumberFormat : public Format { * *

      * For more detail on rounding modes, see: - * http://userguide.icu-project.org/formatparse/numbers/rounding-modes + * https://unicode-org.github.io/icu/userguide/format_parse/numbers/rounding-modes * * @stable ICU 2.4 */ @@ -704,8 +704,8 @@ class U_I18N_API NumberFormat : public Format { /** * Sets whether lenient parsing should be enabled (it is off by default). * - * @param enable \c TRUE if lenient parsing should be used, - * \c FALSE otherwise. + * @param enable \c true if lenient parsing should be used, + * \c false otherwise. * @stable ICU 4.8 */ virtual void setLenient(UBool enable); @@ -713,8 +713,8 @@ class U_I18N_API NumberFormat : public Format { /** * Returns whether lenient parsing is enabled (it is off by default). * - * @return \c TRUE if lenient parsing is enabled, - * \c FALSE otherwise. + * @return \c true if lenient parsing is enabled, + * \c false otherwise. * @see #setLenient * @stable ICU 4.8 */ @@ -870,7 +870,7 @@ class U_I18N_API NumberFormat : public Format { * NumberFormat::createInstance to avoid undefined behavior. * @param key the registry key returned by a previous call to registerFactory * @param status the in/out status code, no special meanings are assigned - * @return TRUE if the factory for the key was successfully unregistered + * @return true if the factory for the key was successfully unregistered * @stable ICU 2.6 */ static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status); @@ -1112,7 +1112,7 @@ class U_I18N_API NumberFormat : public Format { #ifndef U_HIDE_INTERNAL_API /** * Creates the specified number format style of the desired locale. - * If mustBeDecimalFormat is TRUE, then the returned pointer is + * If mustBeDecimalFormat is true, then the returned pointer is * either a DecimalFormat or it is NULL. * @internal */ @@ -1151,7 +1151,7 @@ class U_I18N_API NumberFormat : public Format { private: UBool fParseIntegerOnly; - UBool fLenient; // TRUE => lenient parse is enabled + UBool fLenient; // true => lenient parse is enabled // ISO currency code char16_t fCurrency[4]; @@ -1228,7 +1228,7 @@ class U_I18N_API SimpleNumberFormatFactory : public NumberFormatFactory { /** * @stable ICU 2.6 */ - SimpleNumberFormatFactory(const Locale& locale, UBool visible = TRUE); + SimpleNumberFormatFactory(const Locale& locale, UBool visible = true); /** * @stable ICU 3.0 diff --git a/deps/icu-small/source/i18n/unicode/numsys.h b/deps/icu-small/source/i18n/unicode/numsys.h index 88c172bd422a51..efdf0c0f669a35 100644 --- a/deps/icu-small/source/i18n/unicode/numsys.h +++ b/deps/icu-small/source/i18n/unicode/numsys.h @@ -102,7 +102,7 @@ class U_I18N_API NumberingSystem : public UObject { /** * Create a numbering system using the specified radix, type, and description. * @param radix The radix (base) for this numbering system. - * @param isAlgorithmic TRUE if the numbering system is algorithmic rather than numeric. + * @param isAlgorithmic true if the numbering system is algorithmic rather than numeric. * @param description The string representing the set of digits used in a numeric system, or the name of the RBNF * ruleset to be used in an algorithmic system. * @param status ICU status @@ -171,10 +171,10 @@ class U_I18N_API NumberingSystem : public UObject { /** - * Returns TRUE if the given numbering system is algorithmic + * Returns true if the given numbering system is algorithmic * - * @return TRUE if the numbering system is algorithmic. - * Otherwise, return FALSE. + * @return true if the numbering system is algorithmic. + * Otherwise, return false. * @stable ICU 4.2 */ UBool isAlgorithmic() const; diff --git a/deps/icu-small/source/i18n/unicode/plurfmt.h b/deps/icu-small/source/i18n/unicode/plurfmt.h index 7373476dca8fc2..fde2abcfae5ac2 100644 --- a/deps/icu-small/source/i18n/unicode/plurfmt.h +++ b/deps/icu-small/source/i18n/unicode/plurfmt.h @@ -587,7 +587,7 @@ class U_I18N_API PluralFormat : public Format { */ static int32_t findSubMessage( const MessagePattern& pattern, int32_t partIndex, - const PluralSelector& selector, void *context, double number, UErrorCode& ec); /**< @internal */ + const PluralSelector& selector, void *context, double number, UErrorCode& ec); void parseType(const UnicodeString& source, const NFRule *rbnfLenientScanner, Formattable& result, FieldPosition& pos) const; diff --git a/deps/icu-small/source/i18n/unicode/plurrule.h b/deps/icu-small/source/i18n/unicode/plurrule.h index 408efbcc4a84f8..19956cd32c6180 100644 --- a/deps/icu-small/source/i18n/unicode/plurrule.h +++ b/deps/icu-small/source/i18n/unicode/plurrule.h @@ -46,14 +46,20 @@ U_NAMESPACE_BEGIN class Hashtable; class IFixedDecimal; +class FixedDecimal; class RuleChain; class PluralRuleParser; class PluralKeywordEnumeration; class AndConstraint; class SharedPluralRules; +class StandardPluralRanges; namespace number { class FormattedNumber; +class FormattedNumberRange; +namespace impl { +class UFormattedNumberRangeData; +} } /** @@ -367,11 +373,35 @@ class U_I18N_API PluralRules : public UObject { */ UnicodeString select(const number::FormattedNumber& number, UErrorCode& status) const; +#ifndef U_HIDE_DRAFT_API + /** + * Given a formatted number range, returns the overall plural form of the + * range. For example, "3-5" returns "other" in English. + * + * To get a FormattedNumberRange, see NumberRangeFormatter. + * + * This method only works if PluralRules was created with a locale. If it was created + * from PluralRules::createRules(), this method sets status code U_UNSUPPORTED_ERROR. + * + * @param range The number range onto which the rules will be applied. + * @param status Set if an error occurs while selecting plural keyword. + * This could happen if the FormattedNumberRange is invalid, + * or if plural ranges data is unavailable. + * @return The keyword of the selected rule. + * @draft ICU 68 + */ + UnicodeString select(const number::FormattedNumberRange& range, UErrorCode& status) const; +#endif // U_HIDE_DRAFT_API + #ifndef U_HIDE_INTERNAL_API /** - * @internal - */ + * @internal + */ UnicodeString select(const IFixedDecimal &number) const; + /** + * @internal + */ + UnicodeString select(const number::impl::UFormattedNumberRangeData* urange, UErrorCode& status) const; #endif /* U_HIDE_INTERNAL_API */ /** @@ -446,13 +476,39 @@ class U_I18N_API PluralRules : public UObject { double *dest, int32_t destCapacity, UErrorCode& status); +#ifndef U_HIDE_INTERNAL_API + /** + * Internal-only function that returns FixedDecimals instead of doubles. + * + * Returns sample values for which select() would return the keyword. If + * the keyword is unknown, returns no values, but this is not an error. + * + * The number of returned values is typically small. + * + * @param keyword The keyword. + * @param dest Array into which to put the returned values. May + * be NULL if destCapacity is 0. + * @param destCapacity The capacity of the array, must be at least 0. + * @param status The error code. + * @return The count of values written. + * If more than destCapacity samples are available, then + * only destCapacity are written, and destCapacity is returned as the count, + * rather than setting a U_BUFFER_OVERFLOW_ERROR. + * (The actual number of keyword values could be unlimited.) + * @internal + */ + int32_t getSamples(const UnicodeString &keyword, + FixedDecimal *dest, int32_t destCapacity, + UErrorCode& status); +#endif /* U_HIDE_INTERNAL_API */ + /** - * Returns TRUE if the given keyword is defined in this + * Returns true if the given keyword is defined in this * PluralRules object. * * @param keyword the input keyword. - * @return TRUE if the input keyword is defined. - * Otherwise, return FALSE. + * @return true if the input keyword is defined. + * Otherwise, return false. * @stable ICU 4.0 */ UBool isKeyword(const UnicodeString& keyword) const; @@ -513,12 +569,14 @@ class U_I18N_API PluralRules : public UObject { private: RuleChain *mRules; + StandardPluralRanges *mStandardPluralRanges; PluralRules(); // default constructor not implemented void parseDescription(const UnicodeString& ruleData, UErrorCode &status); int32_t getNumberValue(const UnicodeString& token) const; UnicodeString getRuleFromResource(const Locale& locale, UPluralType type, UErrorCode& status); RuleChain *rulesForKeyword(const UnicodeString &keyword) const; + PluralRules *clone(UErrorCode& status) const; /** * An internal status variable used to indicate that the object is in an 'invalid' state. diff --git a/deps/icu-small/source/i18n/unicode/rbnf.h b/deps/icu-small/source/i18n/unicode/rbnf.h index 1144bd2fb8b1ba..13bb7385b19921 100644 --- a/deps/icu-small/source/i18n/unicode/rbnf.h +++ b/deps/icu-small/source/i18n/unicode/rbnf.h @@ -297,7 +297,7 @@ enum URBNFRuleSetTag { * * * x.0: - * The rule is a master rule. If the full stop in + * The rule is a default rule. If the full stop in * the middle of the rule name is replaced with the decimal point * that is used in the language or DecimalFormatSymbols, then that rule will * have precedence when formatting and parsing this rule. For example, some @@ -332,9 +332,9 @@ enum URBNFRuleSetTag { * algorithms: If the rule set is a regular rule set, do the following: * *

        - *
      • If the rule set includes a master rule (and the number was passed in as a double), - * use the master rule.  (If the number being formatted was passed in as a long, - * the master rule is ignored.)
      • + *
      • If the rule set includes a default rule (and the number was passed in as a double), + * use the default rule.  (If the number being formatted was passed in as a long, + * the default rule is ignored.)
      • *
      • If the number is negative, use the negative-number rule.
      • *
      • If the number has a fractional part and is greater than 1, use the improper fraction * rule.
      • @@ -393,7 +393,7 @@ enum URBNFRuleSetTag { * * * - * in fraction or master rule + * in fraction or default rule * Isolate the number's fractional part and format it. * * @@ -425,7 +425,7 @@ enum URBNFRuleSetTag { * * * - * in fraction or master rule + * in fraction or default rule * Isolate the number's integral part and format it. * * @@ -456,7 +456,7 @@ enum URBNFRuleSetTag { * * * - * in master rule + * in default rule * Omit the optional text if the number is an integer (same as specifying both an x.x * rule and an x.0 rule) * diff --git a/deps/icu-small/source/i18n/unicode/rbtz.h b/deps/icu-small/source/i18n/unicode/rbtz.h index 95fd7ab85dd13a..f7b45fb8ed540d 100644 --- a/deps/icu-small/source/i18n/unicode/rbtz.h +++ b/deps/icu-small/source/i18n/unicode/rbtz.h @@ -258,7 +258,7 @@ class U_I18N_API RuleBasedTimeZone : public BasicTimeZone { * @param base The base time. * @param inclusive Whether the base time is inclusive or not. * @param result Receives the first transition after the base time. - * @return TRUE if the transition is found. + * @return true if the transition is found. * @stable ICU 3.8 */ virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; @@ -268,7 +268,7 @@ class U_I18N_API RuleBasedTimeZone : public BasicTimeZone { * @param base The base time. * @param inclusive Whether the base time is inclusive or not. * @param result Receives the most recent transition before the base time. - * @return TRUE if the transition is found. + * @return true if the transition is found. * @stable ICU 3.8 */ virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; diff --git a/deps/icu-small/source/i18n/unicode/regex.h b/deps/icu-small/source/i18n/unicode/regex.h index 2f8d31d97f012f..8ee74c39038163 100644 --- a/deps/icu-small/source/i18n/unicode/regex.h +++ b/deps/icu-small/source/i18n/unicode/regex.h @@ -116,7 +116,7 @@ class U_I18N_API RegexPattern U_FINAL : public UObject { * were constructed from identical source patterns using the same #URegexpFlag * settings. * @param that a RegexPattern object to compare with "this". - * @return TRUE if the objects are equivalent. + * @return true if the objects are equivalent. * @stable ICU 2.4 */ UBool operator==(const RegexPattern& that) const; @@ -126,7 +126,7 @@ class U_I18N_API RegexPattern U_FINAL : public UObject { * were constructed from identical source patterns using the same #URegexpFlag * settings. * @param that a RegexPattern object to compare with "this". - * @return TRUE if the objects are different. + * @return true if the objects are different. * @stable ICU 2.4 */ inline UBool operator!=(const RegexPattern& that) const {return ! operator ==(that);} @@ -764,7 +764,7 @@ class U_I18N_API RegexMatcher U_FINAL : public UObject { /** * Attempts to match the entire input region against the pattern. * @param status A reference to a UErrorCode to receive any errors. - * @return TRUE if there is a match + * @return true if there is a match * @stable ICU 2.4 */ virtual UBool matches(UErrorCode &status); @@ -777,7 +777,7 @@ class U_I18N_API RegexMatcher U_FINAL : public UObject { * A successful match must extend to the end of the input. * @param startIndex The input string (native) index at which to begin matching. * @param status A reference to a UErrorCode to receive any errors. - * @return TRUE if there is a match + * @return true if there is a match * @stable ICU 2.8 */ virtual UBool matches(int64_t startIndex, UErrorCode &status); @@ -793,7 +793,7 @@ class U_I18N_API RegexMatcher U_FINAL : public UObject { * end(), and group() functions. * * @param status A reference to a UErrorCode to receive any errors. - * @return TRUE if there is a match at the start of the input string. + * @return true if there is a match at the start of the input string. * @stable ICU 2.4 */ virtual UBool lookingAt(UErrorCode &status); @@ -809,7 +809,7 @@ class U_I18N_API RegexMatcher U_FINAL : public UObject { * * @param startIndex The input string (native) index at which to begin matching. * @param status A reference to a UErrorCode to receive any errors. - * @return TRUE if there is a match. + * @return true if there is a match. * @stable ICU 2.8 */ virtual UBool lookingAt(int64_t startIndex, UErrorCode &status); @@ -824,7 +824,7 @@ class U_I18N_API RegexMatcher U_FINAL : public UObject { * Note that if the input string is changed by the application, * use find(startPos, status) instead of find(), because the saved starting * position may not be valid with the altered input string. - * @return TRUE if a match is found. + * @return true if a match is found. * @stable ICU 2.4 */ virtual UBool find(); @@ -841,7 +841,7 @@ class U_I18N_API RegexMatcher U_FINAL : public UObject { * use find(startPos, status) instead of find(), because the saved starting * position may not be valid with the altered input string. * @param status A reference to a UErrorCode to receive any errors. - * @return TRUE if a match is found. + * @return true if a match is found. * @stable ICU 55 */ virtual UBool find(UErrorCode &status); @@ -852,7 +852,7 @@ class U_I18N_API RegexMatcher U_FINAL : public UObject { * * @param start The (native) index in the input string to begin the search. * @param status A reference to a UErrorCode to receive any errors. - * @return TRUE if a match is found. + * @return true if a match is found. * @stable ICU 2.4 */ virtual UBool find(int64_t start, UErrorCode &status); @@ -1271,7 +1271,7 @@ class U_I18N_API RegexMatcher U_FINAL : public UObject { * See useTransparentBounds for a description of transparent and opaque bounds. * By default, a matcher uses opaque region boundaries. * - * @return TRUE if this matcher is using opaque bounds, false if it is not. + * @return true if this matcher is using opaque bounds, false if it is not. * @stable ICU 4.0 */ virtual UBool hasTransparentBounds() const; @@ -1290,7 +1290,7 @@ class U_I18N_API RegexMatcher U_FINAL : public UObject { * * By default, a matcher uses opaque bounds. * - * @param b TRUE for transparent bounds; FALSE for opaque bounds + * @param b true for transparent bounds; false for opaque bounds * @return This Matcher; * @stable ICU 4.0 **/ @@ -1301,7 +1301,7 @@ class U_I18N_API RegexMatcher U_FINAL : public UObject { * Return true if this matcher is using anchoring bounds. * By default, matchers use anchoring region bounds. * - * @return TRUE if this matcher is using anchoring bounds. + * @return true if this matcher is using anchoring bounds. * @stable ICU 4.0 */ virtual UBool hasAnchoringBounds() const; @@ -1315,7 +1315,7 @@ class U_I18N_API RegexMatcher U_FINAL : public UObject { * * Anchoring Bounds are the default for regions. * - * @param b TRUE if to enable anchoring bounds; FALSE to disable them. + * @param b true if to enable anchoring bounds; false to disable them. * @return This Matcher * @stable ICU 4.0 */ @@ -1323,26 +1323,26 @@ class U_I18N_API RegexMatcher U_FINAL : public UObject { /** - * Return TRUE if the most recent matching operation attempted to access + * Return true if the most recent matching operation attempted to access * additional input beyond the available input text. * In this case, additional input text could change the results of the match. * * hitEnd() is defined for both successful and unsuccessful matches. - * In either case hitEnd() will return TRUE if if the end of the text was + * In either case hitEnd() will return true if if the end of the text was * reached at any point during the matching process. * - * @return TRUE if the most recent match hit the end of input + * @return true if the most recent match hit the end of input * @stable ICU 4.0 */ virtual UBool hitEnd() const; /** - * Return TRUE the most recent match succeeded and additional input could cause + * Return true the most recent match succeeded and additional input could cause * it to fail. If this method returns false and a match was found, then more input * might change the match but the match won't be lost. If a match was not found, * then requireEnd has no meaning. * - * @return TRUE if more input could cause the most recent match to no longer match. + * @return true if more input could cause the most recent match to no longer match. * @stable ICU 4.0 */ virtual UBool requireEnd() const; @@ -1781,7 +1781,7 @@ class U_I18N_API RegexMatcher U_FINAL : public UObject { inline REStackFrame *StateSave(REStackFrame *fp, int64_t savePatIdx, UErrorCode &status); void IncrementTime(UErrorCode &status); - // Call user find callback function, if set. Return TRUE if operation should be interrupted. + // Call user find callback function, if set. Return true if operation should be interrupted. inline UBool findProgressInterrupt(int64_t matchIndex, UErrorCode &status); int64_t appendGroup(int32_t groupNum, UText *dest, UErrorCode &status) const; diff --git a/deps/icu-small/source/i18n/unicode/reldatefmt.h b/deps/icu-small/source/i18n/unicode/reldatefmt.h index a991bc7986b32d..f3feeead87b6bc 100644 --- a/deps/icu-small/source/i18n/unicode/reldatefmt.h +++ b/deps/icu-small/source/i18n/unicode/reldatefmt.h @@ -175,19 +175,17 @@ typedef enum UDateAbsoluteUnit { */ UDAT_ABSOLUTE_QUARTER, -#ifndef U_HIDE_DRAFT_API /** * Hour - * @draft ICU 65 + * @stable ICU 65 */ UDAT_ABSOLUTE_HOUR, /** * Minute - * @draft ICU 65 + * @stable ICU 65 */ UDAT_ABSOLUTE_MINUTE, -#endif // U_HIDE_DRAFT_API #ifndef U_HIDE_DEPRECATED_API /** diff --git a/deps/icu-small/source/i18n/unicode/search.h b/deps/icu-small/source/i18n/unicode/search.h index 986205c62f1ec5..3074839b5fbafc 100644 --- a/deps/icu-small/source/i18n/unicode/search.h +++ b/deps/icu-small/source/i18n/unicode/search.h @@ -267,9 +267,9 @@ class U_I18N_API SearchIterator : public UObject { /** * Equality operator. * @param that SearchIterator instance to be compared. - * @return TRUE if both BreakIterators are of the same class, have the + * @return true if both BreakIterators are of the same class, have the * same behavior, terates over the same text and have the same - * attributes. FALSE otherwise. + * attributes. false otherwise. * @stable ICU 2.0 */ virtual UBool operator==(const SearchIterator &that) const; @@ -277,7 +277,7 @@ class U_I18N_API SearchIterator : public UObject { /** * Not-equal operator. * @param that SearchIterator instance to be compared. - * @return FALSE if operator== returns TRUE, and vice versa. + * @return false if operator== returns true, and vice versa. * @stable ICU 2.0 */ UBool operator!=(const SearchIterator &that) const; diff --git a/deps/icu-small/source/i18n/unicode/simpletz.h b/deps/icu-small/source/i18n/unicode/simpletz.h index d7d4123187e071..8e5a877dabaddb 100644 --- a/deps/icu-small/source/i18n/unicode/simpletz.h +++ b/deps/icu-small/source/i18n/unicode/simpletz.h @@ -714,7 +714,7 @@ class U_I18N_API SimpleTimeZone: public BasicTimeZone { * @param base The base time. * @param inclusive Whether the base time is inclusive or not. * @param result Receives the first transition after the base time. - * @return TRUE if the transition is found. + * @return true if the transition is found. * @stable ICU 3.8 */ virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; @@ -724,7 +724,7 @@ class U_I18N_API SimpleTimeZone: public BasicTimeZone { * @param base The base time. * @param inclusive Whether the base time is inclusive or not. * @param result Receives the most recent transition before the base time. - * @return TRUE if the transition is found. + * @return true if the transition is found. * @stable ICU 3.8 */ virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; diff --git a/deps/icu-small/source/i18n/unicode/smpdtfmt.h b/deps/icu-small/source/i18n/unicode/smpdtfmt.h index b4b0e5fb390801..3296c6b3ab75b6 100644 --- a/deps/icu-small/source/i18n/unicode/smpdtfmt.h +++ b/deps/icu-small/source/i18n/unicode/smpdtfmt.h @@ -81,7 +81,7 @@ class LocalizedNumberFormatter; * the date and time formatting algorithm and pattern letters defined by * UTS#35 * Unicode Locale Data Markup Language (LDML) and further documented for ICU in the - * ICU + * ICU * User Guide. The following pattern letters are currently available (note that the actual * values depend on CLDR and may change from the examples shown here):

        * @@ -1183,11 +1183,11 @@ class U_I18N_API SimpleDateFormat: public DateFormat { /** * This is for ICU internal use only. Please do not use. * Check whether the 'field' is smaller than all the fields covered in - * pattern, return TRUE if it is. The sequence of calendar field, + * pattern, return true if it is. The sequence of calendar field, * from large to small is: ERA, YEAR, MONTH, DATE, AM_PM, HOUR, MINUTE,... * @param field the calendar field need to check against - * @return TRUE if the 'field' is smaller than all the fields - * covered in pattern. FALSE otherwise. + * @return true if the 'field' is smaller than all the fields + * covered in pattern. false otherwise. * @internal ICU 4.0 */ UBool isFieldUnitIgnored(UCalendarDateFields field) const; @@ -1196,12 +1196,12 @@ class U_I18N_API SimpleDateFormat: public DateFormat { /** * This is for ICU internal use only. Please do not use. * Check whether the 'field' is smaller than all the fields covered in - * pattern, return TRUE if it is. The sequence of calendar field, + * pattern, return true if it is. The sequence of calendar field, * from large to small is: ERA, YEAR, MONTH, DATE, AM_PM, HOUR, MINUTE,... * @param pattern the pattern to check against * @param field the calendar field need to check against - * @return TRUE if the 'field' is smaller than all the fields - * covered in pattern. FALSE otherwise. + * @return true if the 'field' is smaller than all the fields + * covered in pattern. false otherwise. * @internal ICU 4.0 */ static UBool isFieldUnitIgnored(const UnicodeString& pattern, @@ -1305,12 +1305,12 @@ class U_I18N_API SimpleDateFormat: public DateFormat { static UBool isNumeric(char16_t formatChar, int32_t count); /** - * Returns TRUE if the patternOffset is at the start of a numeric field. + * Returns true if the patternOffset is at the start of a numeric field. */ static UBool isAtNumericField(const UnicodeString &pattern, int32_t patternOffset); /** - * Returns TRUE if the patternOffset is right after a non-numeric field. + * Returns true if the patternOffset is right after a non-numeric field. */ static UBool isAfterNonNumericField(const UnicodeString &pattern, int32_t patternOffset); @@ -1390,11 +1390,11 @@ class U_I18N_API SimpleDateFormat: public DateFormat { * @param text the text being parsed * @param textOffset the starting offset into the text. On output * will be set to the offset of the character after the match - * @param whitespaceLenient TRUE if whitespace parse is lenient, FALSE otherwise. - * @param partialMatchLenient TRUE if partial match parse is lenient, FALSE otherwise. - * @param oldLeniency TRUE if old leniency control is lenient, FALSE otherwise. + * @param whitespaceLenient true if whitespace parse is lenient, false otherwise. + * @param partialMatchLenient true if partial match parse is lenient, false otherwise. + * @param oldLeniency true if old leniency control is lenient, false otherwise. * - * @return TRUE if the literal text could be matched, FALSE otherwise. + * @return true if the literal text could be matched, false otherwise. */ static UBool matchLiterals(const UnicodeString &pattern, int32_t &patternOffset, const UnicodeString &text, int32_t &textOffset, diff --git a/deps/icu-small/source/i18n/unicode/sortkey.h b/deps/icu-small/source/i18n/unicode/sortkey.h index d2d3ca9fd57dd8..14902668a2d4f2 100644 --- a/deps/icu-small/source/i18n/unicode/sortkey.h +++ b/deps/icu-small/source/i18n/unicode/sortkey.h @@ -150,7 +150,7 @@ class U_I18N_API CollationKey : public UObject { /** * Compare if two collation keys are not the same. * @param source the collation key to compare to. - * @return Returns TRUE if two collation keys are different, FALSE otherwise. + * @return Returns true if two collation keys are different, false otherwise. * @stable ICU 2.0 */ UBool operator!=(const CollationKey& source) const; @@ -159,7 +159,7 @@ class U_I18N_API CollationKey : public UObject { /** * Test to see if the key is in an invalid state. The key will be in an * invalid state if it couldn't allocate memory for some operation. - * @return Returns TRUE if the key is in an invalid, FALSE otherwise. + * @return Returns true if the key is in an invalid, false otherwise. * @stable ICU 2.0 */ UBool isBogus(void) const; diff --git a/deps/icu-small/source/i18n/unicode/stsearch.h b/deps/icu-small/source/i18n/unicode/stsearch.h index f3963711432986..3cfd68d64771b9 100644 --- a/deps/icu-small/source/i18n/unicode/stsearch.h +++ b/deps/icu-small/source/i18n/unicode/stsearch.h @@ -292,7 +292,7 @@ class U_I18N_API StringSearch U_FINAL : public SearchIterator /** * Equality operator. * @param that instance to be compared. - * @return TRUE if both instances have the same attributes, + * @return true if both instances have the same attributes, * breakiterators, collators and iterate over the same text * while looking for the same pattern. * @stable ICU 2.0 diff --git a/deps/icu-small/source/i18n/unicode/tblcoll.h b/deps/icu-small/source/i18n/unicode/tblcoll.h index f5dc135bc49fc1..a004dd6644c394 100644 --- a/deps/icu-small/source/i18n/unicode/tblcoll.h +++ b/deps/icu-small/source/i18n/unicode/tblcoll.h @@ -99,14 +99,14 @@ class UVector64; * table-based collation. *

        * For more information about the collation service see - * the User Guide. + * the User Guide. *

        * Collation service provides correct sorting orders for most locales supported in ICU. * If specific data for a locale is not available, the orders eventually falls back * to the CLDR root sort order. *

        * Sort ordering may be customized by providing your own set of rules. For more on - * this subject see the + * this subject see the * Collation Customization section of the User Guide. *

        * Note, RuleBasedCollator is not to be subclassed. @@ -495,7 +495,7 @@ class U_I18N_API RuleBasedCollator : public Collator { * just the tailoring. * * getRules(void) should normally be used instead. - * See http://userguide.icu-project.org/collation/customization#TOC-Building-on-Existing-Locales + * See https://unicode-org.github.io/icu/userguide/collation/customization#building-on-existing-locales * @param delta one of UCOL_TAILORING_ONLY, UCOL_FULL_RULES. * @param buffer UnicodeString to store the result rules * @stable ICU 2.2 @@ -702,7 +702,7 @@ class U_I18N_API RuleBasedCollator : public Collator { * This string will be normalized. * The structure and the syntax of the string is defined in the "Naming collators" * section of the users guide: - * http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme + * https://unicode-org.github.io/icu/userguide/collation/concepts#collator-naming-scheme * This function supports preflighting. * * This is internal, and intended to be used with delegate converters. @@ -752,7 +752,7 @@ class U_I18N_API RuleBasedCollator : public Collator { * Implements ucol_getContractionsAndExpansions(). * Gets this collator's sets of contraction strings and/or * characters and strings that map to multiple collation elements (expansions). - * If addPrefixes is TRUE, then contractions that are expressed as + * If addPrefixes is true, then contractions that are expressed as * prefix/pre-context rules are included. * @param contractions if not NULL, the set to hold the contractions * @param expansions if not NULL, the set to hold the expansions @@ -857,7 +857,7 @@ class U_I18N_API RuleBasedCollator : public Collator { * Tests whether a character is "unsafe" for use as a collation starting point. * * @param c code point or code unit - * @return TRUE if c is unsafe + * @return true if c is unsafe * @see CollationElementIterator#setOffset(int) */ UBool isUnsafe(UChar32 c) const; diff --git a/deps/icu-small/source/i18n/unicode/timezone.h b/deps/icu-small/source/i18n/unicode/timezone.h index 4d321186be495d..73cae44d533365 100644 --- a/deps/icu-small/source/i18n/unicode/timezone.h +++ b/deps/icu-small/source/i18n/unicode/timezone.h @@ -317,6 +317,19 @@ class U_I18N_API TimeZone : public UObject { */ static TimeZone* U_EXPORT2 createDefault(void); +#ifndef U_HIDE_INTERNAL_API + /** + * If the locale contains the timezone keyword, creates a copy of that TimeZone. + * Otherwise, create the default timezone. + * + * @param locale a locale which may contains 'timezone' keyword/value. + * @return A TimeZone. Clients are responsible for deleting the time zone + * object returned. + * @internal + */ + static TimeZone* U_EXPORT2 forLocaleOrDefault(const Locale& locale); +#endif /* U_HIDE_INTERNAL_API */ + /** * Sets the default time zone (i.e., what's returned by createDefault()) to be the * specified time zone. If NULL is specified for the time zone, the default time @@ -392,7 +405,7 @@ class U_I18N_API TimeZone : public UObject { * *

        This implementation utilizes * Zone-Tzid mapping data. The mapping data is updated time to time. To get the latest changes, - * please read the ICU user guide section + * please read the ICU user guide section * Updating the Time Zone Data. * * @param id A system time zone ID. @@ -420,7 +433,7 @@ class U_I18N_API TimeZone : public UObject { * *

        This implementation utilizes * Zone-Tzid mapping data. The mapping data is updated time to time. To get the latest changes, - * please read the ICU user guide section + * please read the ICU user guide section * Updating the Time Zone Data. * * @param winid A Windows time zone ID. @@ -696,8 +709,8 @@ class U_I18N_API TimeZone : public UObject { * there are time zones that used daylight savings time in the * past, but no longer used currently. For example, Asia/Tokyo has * never used daylight savings time since 1951. Most clients would - * expect that this method to return FALSE for such case. - * The default implementation of this method returns TRUE + * expect that this method to return false for such case. + * The default implementation of this method returns true * when the time zone uses daylight savings time in the current * (Gregorian) calendar year. *

        In Java 7, observesDaylightTime() was added in @@ -914,7 +927,7 @@ class U_I18N_API TimeZone : public UObject { * @param hour Receives parsed hour field * @param minute Receives parsed minute field * @param second Receives parsed second field - * @return Returns TRUE when the given custom id is valid. + * @return Returns true when the given custom id is valid. */ static UBool parseCustomID(const UnicodeString& id, int32_t& sign, int32_t& hour, int32_t& minute, int32_t& second); @@ -937,7 +950,7 @@ class U_I18N_API TimeZone : public UObject { * @param hour offset hours * @param min offset minutes * @param sec offset seconds - * @param negative sign of the offset, TRUE for negative offset. + * @param negative sign of the offset, true for negative offset. * @param id Receves the format result (normalized custom ID) * @return The reference to id */ diff --git a/deps/icu-small/source/i18n/unicode/tmutamt.h b/deps/icu-small/source/i18n/unicode/tmutamt.h index 5ce5922cea8346..bb9144e2d072dc 100644 --- a/deps/icu-small/source/i18n/unicode/tmutamt.h +++ b/deps/icu-small/source/i18n/unicode/tmutamt.h @@ -39,7 +39,7 @@ class U_I18N_API TimeUnitAmount: public Measure { /** * Construct TimeUnitAmount object with the given number and the * given time unit. - * @param number a numeric object; number.isNumeric() must be TRUE + * @param number a numeric object; number.isNumeric() must be true * @param timeUnitField the time unit field of a time unit * @param status the input-output error code. * If the number is not numeric or the timeUnitField diff --git a/deps/icu-small/source/i18n/unicode/translit.h b/deps/icu-small/source/i18n/unicode/translit.h index fe2568d50aa020..2aa02c39f13446 100644 --- a/deps/icu-small/source/i18n/unicode/translit.h +++ b/deps/icu-small/source/i18n/unicode/translit.h @@ -882,7 +882,7 @@ class U_I18N_API Transliterator : public UObject { * another transliterator. * @param text the text to be transliterated * @param index the position indices - * @param incremental if TRUE, then assume more characters may be inserted + * @param incremental if true, then assume more characters may be inserted * at index.limit, and postpone processing to accomodate future incoming * characters * @stable ICU 2.4 @@ -897,14 +897,14 @@ class U_I18N_API Transliterator : public UObject { * Top-level transliteration method, handling filtering, incremental and * non-incremental transliteration, and rollback. All transliteration * public API methods eventually call this method with a rollback argument - * of TRUE. Other entities may call this method but rollback should be - * FALSE. + * of true. Other entities may call this method but rollback should be + * false. * *

        If this transliterator has a filter, break up the input text into runs * of unfiltered characters. Pass each run to * subclass.handleTransliterate(). * - *

        In incremental mode, if rollback is TRUE, perform a special + *

        In incremental mode, if rollback is true, perform a special * incremental procedure in which several passes are made over the input * text, adding one character at a time, and committing successful * transliterations as they occur. Unsuccessful transliterations are rolled @@ -912,12 +912,12 @@ class U_I18N_API Transliterator : public UObject { * * @param text the text to be transliterated * @param index the position indices - * @param incremental if TRUE, then assume more characters may be inserted + * @param incremental if true, then assume more characters may be inserted * at index.limit, and postpone processing to accomodate future incoming * characters - * @param rollback if TRUE and if incremental is TRUE, then perform special + * @param rollback if true and if incremental is true, then perform special * incremental processing, as described above, and undo partial - * transliterations where necessary. If incremental is FALSE then this + * transliterations where necessary. If incremental is false then this * parameter is ignored. */ virtual void filteredTransliterate(Replaceable& text, @@ -1119,7 +1119,7 @@ class U_I18N_API Transliterator : public UObject { * to recreate this transliterator. * @param result the string to receive the rules. Previous * contents will be deleted. - * @param escapeUnprintable if TRUE then convert unprintable + * @param escapeUnprintable if true then convert unprintable * character to their hex escape representations, \\uxxxx or * \\Uxxxxxxxx. Unprintable characters are those other than * U+000A, U+0020..U+007E. diff --git a/deps/icu-small/source/i18n/unicode/tzfmt.h b/deps/icu-small/source/i18n/unicode/tzfmt.h index 6d3863b1e5add8..4411865984b54e 100644 --- a/deps/icu-small/source/i18n/unicode/tzfmt.h +++ b/deps/icu-small/source/i18n/unicode/tzfmt.h @@ -295,7 +295,7 @@ class U_I18N_API TimeZoneFormat : public Format { * Return true if the given Format objects are semantically equal. * Objects of different subclasses are considered unequal. * @param other The object to be compared with. - * @return Return TRUE if the given Format objects are semantically equal. + * @return Return true if the given Format objects are semantically equal. * Objects of different subclasses are considered unequal. * @stable ICU 50 */ @@ -814,7 +814,7 @@ class U_I18N_API TimeZoneFormat : public Format { * @param str the string * @param codeArray receives the result * @param capacity the capacity of codeArray - * @return TRUE when the specified code array is fully filled with code points + * @return true when the specified code array is fully filled with code points * (no under/overflow). */ static UBool toCodePoints(const UnicodeString& str, UChar32* codeArray, int32_t capacity); @@ -849,8 +849,8 @@ class U_I18N_API TimeZoneFormat : public Format { * @param text the text contains ISO 8601 style time zone string (e.g. "-08:00", "Z") * at the position. * @param pos the position, non-negative error index will be set on failure. - * @param extendedOnly TRUE if parsing the text as ISO 8601 extended offset format (e.g. "-08:00"), - * or FALSE to evaluate the text as basic format. + * @param extendedOnly true if parsing the text as ISO 8601 extended offset format (e.g. "-08:00"), + * or false to evaluate the text as basic format. * @param hasDigitOffset receiving if the parsed zone string contains offset digits. * @return the offset from GMT(UTC) in milliseconds for the given ISO 8601 style * time zone string. diff --git a/deps/icu-small/source/i18n/unicode/tznames.h b/deps/icu-small/source/i18n/unicode/tznames.h index 860494221df4f8..2e20eff6089302 100644 --- a/deps/icu-small/source/i18n/unicode/tznames.h +++ b/deps/icu-small/source/i18n/unicode/tznames.h @@ -139,7 +139,7 @@ class U_I18N_API TimeZoneNames : public UObject { /** * Return true if the given TimeZoneNames objects are semantically equal. * @param other the object to be compared with. - * @return Return TRUE if the given Format objects are semantically equal. + * @return Return true if the given Format objects are semantically equal. * @stable ICU 50 */ virtual UBool operator==(const TimeZoneNames& other) const = 0; @@ -148,7 +148,7 @@ class U_I18N_API TimeZoneNames : public UObject { * Return true if the given TimeZoneNames objects are not semantically * equal. * @param other the object to be compared with. - * @return Return TRUE if the given Format objects are not semantically equal. + * @return Return true if the given Format objects are not semantically equal. * @stable ICU 50 */ UBool operator!=(const TimeZoneNames& other) const { return !operator==(other); } @@ -373,7 +373,7 @@ class U_I18N_API TimeZoneNames : public UObject { * Gets the zone ID of a match at the specified index. * @param idx The index * @param tzID Receives the zone ID. - * @return TRUE if the zone ID was set to tzID. + * @return true if the zone ID was set to tzID. * @internal */ UBool getTimeZoneIDAt(int32_t idx, UnicodeString& tzID) const; @@ -382,7 +382,7 @@ class U_I18N_API TimeZoneNames : public UObject { * Gets the metazone ID of a match at the specified index. * @param idx The index * @param mzID Receives the metazone ID - * @return TRUE if the meta zone ID was set to mzID. + * @return true if the meta zone ID was set to mzID. * @internal */ UBool getMetaZoneIDAt(int32_t idx, UnicodeString& mzID) const; diff --git a/deps/icu-small/source/i18n/unicode/ucal.h b/deps/icu-small/source/i18n/unicode/ucal.h index eee2ae9e226474..d491f5d610f95a 100644 --- a/deps/icu-small/source/i18n/unicode/ucal.h +++ b/deps/icu-small/source/i18n/unicode/ucal.h @@ -13,7 +13,10 @@ #include "unicode/utypes.h" #include "unicode/uenum.h" #include "unicode/uloc.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API #if !UCONFIG_NO_FORMATTING @@ -32,7 +35,7 @@ * *

        * Types of UCalendar interpret a UDate - * according to the rules of a specific calendar system. The U_STABLE + * according to the rules of a specific calendar system. The C API * provides the enum UCalendarType with UCAL_TRADITIONAL and * UCAL_GREGORIAN. *

        @@ -584,7 +587,7 @@ typedef enum USystemTimeZoneType USystemTimeZoneType; * *ec will indicate the error. * @stable ICU 4.8 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 ucal_openTimeZoneIDEnumeration(USystemTimeZoneType zoneType, const char* region, const int32_t* rawOffset, UErrorCode* ec); @@ -599,7 +602,7 @@ ucal_openTimeZoneIDEnumeration(USystemTimeZoneType zoneType, const char* region, * * @stable ICU 2.6 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 ucal_openTimeZones(UErrorCode* ec); /** @@ -618,7 +621,7 @@ ucal_openTimeZones(UErrorCode* ec); * * @stable ICU 2.6 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 ucal_openCountryTimeZones(const char* country, UErrorCode* ec); /** @@ -644,7 +647,7 @@ ucal_openCountryTimeZones(const char* country, UErrorCode* ec); * * @stable ICU 2.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec); /** @@ -656,11 +659,9 @@ ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec); * * @stable ICU 2.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec); -#ifndef U_HIDE_DRAFT_API - /** * Return the current host time zone. The host time zone is detected from * the current host system configuration by querying the host operating @@ -688,13 +689,11 @@ ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec); * * @see #UCAL_UNKNOWN_ZONE_ID * - * @draft ICU 65 + * @stable ICU 65 */ -U_DRAFT int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucal_getHostTimeZone(UChar *result, int32_t resultCapacity, UErrorCode *ec); -#endif // U_HIDE_DRAFT_API - /** * Return the amount of time in milliseconds that the clock is * advanced during daylight savings time for the given time zone, or @@ -711,7 +710,7 @@ ucal_getHostTimeZone(UChar *result, int32_t resultCapacity, UErrorCode *ec); * * @stable ICU 2.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec); /** @@ -720,7 +719,7 @@ ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec); * @return The current date and time. * @stable ICU 2.0 */ -U_STABLE UDate U_EXPORT2 +U_CAPI UDate U_EXPORT2 ucal_getNow(void); /** @@ -746,7 +745,7 @@ ucal_getNow(void); * @see #UCAL_UNKNOWN_ZONE_ID * @stable ICU 2.0 */ -U_STABLE UCalendar* U_EXPORT2 +U_CAPI UCalendar* U_EXPORT2 ucal_open(const UChar* zoneID, int32_t len, const char* locale, @@ -759,7 +758,7 @@ ucal_open(const UChar* zoneID, * @param cal The UCalendar to close. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucal_close(UCalendar *cal); #if U_SHOW_CPLUSPLUS_API @@ -789,7 +788,7 @@ U_NAMESPACE_END * @return A pointer to a UCalendar identical to cal. * @stable ICU 4.0 */ -U_STABLE UCalendar* U_EXPORT2 +U_CAPI UCalendar* U_EXPORT2 ucal_clone(const UCalendar* cal, UErrorCode* status); @@ -802,7 +801,7 @@ ucal_clone(const UCalendar* cal, * @param status A pointer to an UErrorCode to receive any errors. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucal_setTimeZone(UCalendar* cal, const UChar* zoneID, int32_t len, @@ -818,7 +817,7 @@ ucal_setTimeZone(UCalendar* cal, * @return The total buffer size needed; if greater than resultLength, the output was truncated. * @stable ICU 51 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucal_getTimeZoneID(const UCalendar *cal, UChar *result, int32_t resultLength, @@ -855,7 +854,7 @@ typedef enum UCalendarDisplayNameType UCalendarDisplayNameType; * @return The total buffer size needed; if greater than resultLength, the output was truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucal_getTimeZoneDisplayName(const UCalendar* cal, UCalendarDisplayNameType type, const char* locale, @@ -868,10 +867,10 @@ ucal_getTimeZoneDisplayName(const UCalendar* cal, * Daylight savings time is not used in all parts of the world. * @param cal The UCalendar to query. * @param status A pointer to an UErrorCode to receive any errors - * @return TRUE if cal is currently in daylight savings time, FALSE otherwise + * @return true if cal is currently in daylight savings time, false otherwise * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucal_inDaylightTime(const UCalendar* cal, UErrorCode* status ); @@ -895,7 +894,7 @@ ucal_inDaylightTime(const UCalendar* cal, * @see ucal_getGregorianChange * @stable ICU 3.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode); /** @@ -918,7 +917,7 @@ ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode); * @see ucal_setGregorianChange * @stable ICU 3.6 */ -U_STABLE UDate U_EXPORT2 +U_CAPI UDate U_EXPORT2 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode); /** @@ -999,7 +998,7 @@ typedef enum UCalendarWallTimeOption UCalendarWallTimeOption; * @see ucal_setAttribute * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucal_getAttribute(const UCalendar* cal, UCalendarAttribute attr); @@ -1014,7 +1013,7 @@ ucal_getAttribute(const UCalendar* cal, * @see ucal_getAttribute * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucal_setAttribute(UCalendar* cal, UCalendarAttribute attr, int32_t newValue); @@ -1028,7 +1027,7 @@ ucal_setAttribute(UCalendar* cal, * @see ucal_countAvailable * @stable ICU 2.0 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 ucal_getAvailable(int32_t localeIndex); /** @@ -1039,7 +1038,7 @@ ucal_getAvailable(int32_t localeIndex); * @see ucal_getAvailable * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucal_countAvailable(void); /** @@ -1053,7 +1052,7 @@ ucal_countAvailable(void); * @see ucal_setDateTime * @stable ICU 2.0 */ -U_STABLE UDate U_EXPORT2 +U_CAPI UDate U_EXPORT2 ucal_getMillis(const UCalendar* cal, UErrorCode* status); @@ -1068,7 +1067,7 @@ ucal_getMillis(const UCalendar* cal, * @see ucal_setDateTime * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucal_setMillis(UCalendar* cal, UDate dateTime, UErrorCode* status ); @@ -1087,7 +1086,7 @@ ucal_setMillis(UCalendar* cal, * @see ucal_setDateTime * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucal_setDate(UCalendar* cal, int32_t year, int32_t month, @@ -1111,7 +1110,7 @@ ucal_setDate(UCalendar* cal, * @see ucal_setDate * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucal_setDateTime(UCalendar* cal, int32_t year, int32_t month, @@ -1122,15 +1121,15 @@ ucal_setDateTime(UCalendar* cal, UErrorCode* status); /** - * Returns TRUE if two UCalendars are equivalent. Equivalent + * Returns true if two UCalendars are equivalent. Equivalent * UCalendars will behave identically, but they may be set to * different times. * @param cal1 The first of the UCalendars to compare. * @param cal2 The second of the UCalendars to compare. - * @return TRUE if cal1 and cal2 are equivalent, FALSE otherwise. + * @return true if cal1 and cal2 are equivalent, false otherwise. * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucal_equivalentTo(const UCalendar* cal1, const UCalendar* cal2); @@ -1152,7 +1151,7 @@ ucal_equivalentTo(const UCalendar* cal1, * @see ucal_roll * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucal_add(UCalendar* cal, UCalendarDateFields field, int32_t amount, @@ -1182,7 +1181,7 @@ ucal_add(UCalendar* cal, * @see ucal_add * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucal_roll(UCalendar* cal, UCalendarDateFields field, int32_t amount, @@ -1204,7 +1203,7 @@ ucal_roll(UCalendar* cal, * @see ucal_clear * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucal_get(const UCalendar* cal, UCalendarDateFields field, UErrorCode* status ); @@ -1224,7 +1223,7 @@ ucal_get(const UCalendar* cal, * @see ucal_clear * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucal_set(UCalendar* cal, UCalendarDateFields field, int32_t value); @@ -1237,14 +1236,14 @@ ucal_set(UCalendar* cal, * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. - * @return TRUE if field is set, FALSE otherwise. + * @return true if field is set, false otherwise. * @see ucal_get * @see ucal_set * @see ucal_clearField * @see ucal_clear * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucal_isSet(const UCalendar* cal, UCalendarDateFields field); @@ -1262,7 +1261,7 @@ ucal_isSet(const UCalendar* cal, * @see ucal_clear * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucal_clearField(UCalendar* cal, UCalendarDateFields field); @@ -1276,7 +1275,7 @@ ucal_clearField(UCalendar* cal, * @see ucal_clearField * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucal_clear(UCalendar* calendar); /** @@ -1315,7 +1314,7 @@ typedef enum UCalendarLimitType UCalendarLimitType; * @return The requested value. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucal_getLimit(const UCalendar* cal, UCalendarDateFields field, UCalendarLimitType type, @@ -1328,7 +1327,7 @@ ucal_getLimit(const UCalendar* cal, * @return the locale name * @stable ICU 2.8 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status); /** @@ -1337,7 +1336,7 @@ ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* * @return the version string, such as "2007f" * @stable ICU 3.8 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ucal_getTZDataVersion(UErrorCode* status); /** @@ -1358,7 +1357,7 @@ ucal_getTZDataVersion(UErrorCode* status); * null. * @stable ICU 4.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len, UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status); /** @@ -1368,7 +1367,7 @@ ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len, * @return The resource keyword value string. * @stable ICU 4.2 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ucal_getType(const UCalendar *cal, UErrorCode* status); /** @@ -1387,7 +1386,7 @@ ucal_getType(const UCalendar *cal, UErrorCode* status); * @return a string enumeration over keyword values for the given key and the locale. * @stable ICU 4.2 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 ucal_getKeywordValuesForLocale(const char* key, const char* locale, UBool commonlyUsed, @@ -1442,7 +1441,7 @@ typedef enum UCalendarWeekdayType UCalendarWeekdayType; * @return The UCalendarWeekdayType for the day of the week. * @stable ICU 4.4 */ -U_STABLE UCalendarWeekdayType U_EXPORT2 +U_CAPI UCalendarWeekdayType U_EXPORT2 ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status); /** @@ -1460,20 +1459,20 @@ ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErro * @return The milliseconds after midnight at which the weekend begins or ends. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status); /** - * Returns TRUE if the given UDate is in the weekend in + * Returns true if the given UDate is in the weekend in * this calendar system. * @param cal The UCalendar to query. * @param date The UDate in question. * @param status The error code for the operation. - * @return TRUE if the given UDate is in the weekend in - * this calendar system, FALSE otherwise. + * @return true if the given UDate is in the weekend in + * this calendar system, false otherwise. * @stable ICU 4.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status); /** @@ -1500,7 +1499,7 @@ ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status); * @return The date difference for the specified field. * @stable ICU 4.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucal_getFieldDifference(UCalendar* cal, UDate target, UCalendarDateFields field, @@ -1544,17 +1543,17 @@ typedef enum UTimeZoneTransitionType UTimeZoneTransitionType; /**< @stable ICU 5 * the calendar's current date, in the time zone to which the calendar * is currently set. If there is no known time zone transition of the * requested type relative to the calendar's date, the function returns -* FALSE. +* false. * @param cal The UCalendar to query. * @param type The type of transition desired. * @param transition A pointer to a UDate to be set to the transition time. -* If the function returns FALSE, the value set is unspecified. +* If the function returns false, the value set is unspecified. * @param status A pointer to a UErrorCode to receive any errors. -* @return TRUE if a valid transition time is set in *transition, FALSE +* @return true if a valid transition time is set in *transition, false * otherwise. * @stable ICU 50 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucal_getTimeZoneTransitionDate(const UCalendar* cal, UTimeZoneTransitionType type, UDate* transition, UErrorCode* status); @@ -1569,7 +1568,7 @@ ucal_getTimeZoneTransitionDate(const UCalendar* cal, UTimeZoneTransitionType typ * *

        This implementation utilizes * Zone-Tzid mapping data. The mapping data is updated time to time. To get the latest changes, -* please read the ICU user guide section +* please read the ICU user guide section * Updating the Time Zone Data. * * @param id A system time zone ID. @@ -1582,7 +1581,7 @@ ucal_getTimeZoneTransitionDate(const UCalendar* cal, UTimeZoneTransitionType typ * * @stable ICU 52 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucal_getWindowsTimeZoneID(const UChar* id, int32_t len, UChar* winid, int32_t winidCapacity, UErrorCode* status); @@ -1600,7 +1599,7 @@ ucal_getWindowsTimeZoneID(const UChar* id, int32_t len, * *

        This implementation utilizes * Zone-Tzid mapping data. The mapping data is updated time to time. To get the latest changes, -* please read the ICU user guide section +* please read the ICU user guide section * Updating the Time Zone Data. * * @param winid A Windows time zone ID. @@ -1614,7 +1613,7 @@ ucal_getWindowsTimeZoneID(const UChar* id, int32_t len, * * @stable ICU 52 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucal_getTimeZoneIDForWindowsID(const UChar* winid, int32_t len, const char* region, UChar* id, int32_t idCapacity, UErrorCode* status); diff --git a/deps/icu-small/source/i18n/unicode/ucol.h b/deps/icu-small/source/i18n/unicode/ucol.h index 34b5d2476aaaa5..83774bc8ec6769 100644 --- a/deps/icu-small/source/i18n/unicode/ucol.h +++ b/deps/icu-small/source/i18n/unicode/ucol.h @@ -15,12 +15,15 @@ #if !UCONFIG_NO_COLLATION #include "unicode/unorm.h" -#include "unicode/localpointer.h" #include "unicode/parseerr.h" #include "unicode/uloc.h" #include "unicode/uset.h" #include "unicode/uscript.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + /** * \file * \brief C API: Collator @@ -32,14 +35,14 @@ * searching and sorting routines for natural language text. *

        * For more information about the collation service see - * the User Guide. + * the User Guide. *

        * Collation service provides correct sorting orders for most locales supported in ICU. * If specific data for a locale is not available, the orders eventually falls back * to the CLDR root sort order. *

        * Sort ordering may be customized by providing your own set of rules. For more on - * this subject see the + * this subject see the * Collation Customization section of the User Guide. *

        * @see UCollationResult @@ -367,7 +370,7 @@ typedef enum { * Retrieves the "UCA rules" concatenated with the tailoring rules. * The "UCA rules" are an approximation of the root collator's sort order. * They are almost never used or useful at runtime and can be removed from the data. - * See http://userguide.icu-project.org/collation/customization#TOC-Building-on-Existing-Locales + * See https://unicode-org.github.io/icu/userguide/collation/customization#building-on-existing-locales * @stable ICU 2.0 */ UCOL_FULL_RULES @@ -381,7 +384,7 @@ typedef enum { * Starting with ICU 54, collation attributes can be specified via locale keywords as well, * in the old locale extension syntax ("el@colCaseFirst=upper") * or in language tag syntax ("el-u-kf-upper"). - * See User Guide: Collation API. + * See User Guide: Collation API. * * The UCollator pointer is used in all the calls to the Collation * service. After finished, collator must be disposed of by calling @@ -398,7 +401,7 @@ typedef enum { * @see ucol_close * @stable ICU 2.0 */ -U_STABLE UCollator* U_EXPORT2 +U_CAPI UCollator* U_EXPORT2 ucol_open(const char *loc, UErrorCode *status); /** @@ -426,7 +429,7 @@ ucol_open(const char *loc, UErrorCode *status); * @see ucol_close * @stable ICU 2.0 */ -U_STABLE UCollator* U_EXPORT2 +U_CAPI UCollator* U_EXPORT2 ucol_openRules( const UChar *rules, int32_t rulesLength, UColAttributeValue normalizationMode, @@ -439,7 +442,7 @@ ucol_openRules( const UChar *rules, * Open a collator defined by a short form string. * The structure and the syntax of the string is defined in the "Naming collators" * section of the users guide: - * http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme + * https://unicode-org.github.io/icu/userguide/collation/concepts#collator-naming-scheme * Attributes are overriden by the subsequent attributes. So, for "S2_S3", final * strength will be 3. 3066bis locale overrides individual locale parts. * The call to this function is equivalent to a call to ucol_open, followed by a @@ -449,12 +452,12 @@ ucol_openRules( const UChar *rules, * state for a locale. * @param parseError if not NULL, structure that will get filled with error's pre * and post context in case of error. - * @param forceDefaults if FALSE, the settings that are the same as the collator + * @param forceDefaults if false, the settings that are the same as the collator * default settings will not be applied (for example, setting * French secondary on a French collator would not be executed). - * If TRUE, all the settings will be applied regardless of the + * If true, all the settings will be applied regardless of the * collator default value. If the definition - * strings are to be cached, should be set to FALSE. + * strings are to be cached, should be set to false. * @param status Error code. Apart from regular error conditions connected to * instantiating collators (like out of memory or similar), this * API will return an error if an invalid attribute or attribute/value @@ -506,7 +509,7 @@ ucol_getContractions( const UCollator *coll, * * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucol_getContractionsAndExpansions( const UCollator *coll, USet *contractions, USet *expansions, UBool addPrefixes, UErrorCode *status); @@ -521,7 +524,7 @@ ucol_getContractionsAndExpansions( const UCollator *coll, * @see ucol_safeClone * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucol_close(UCollator *coll); #if U_SHOW_CPLUSPLUS_API @@ -558,7 +561,7 @@ U_NAMESPACE_END * @see ucol_equal * @stable ICU 2.0 */ -U_STABLE UCollationResult U_EXPORT2 +U_CAPI UCollationResult U_EXPORT2 ucol_strcoll( const UCollator *coll, const UChar *source, int32_t sourceLength, @@ -583,7 +586,7 @@ ucol_strcoll( const UCollator *coll, * @see ucol_equal * @stable ICU 50 */ -U_STABLE UCollationResult U_EXPORT2 +U_CAPI UCollationResult U_EXPORT2 ucol_strcollUTF8( const UCollator *coll, const char *source, @@ -600,13 +603,13 @@ ucol_strcollUTF8( * @param sourceLength The length of source, or -1 if null-terminated. * @param target The target string. * @param targetLength The length of target, or -1 if null-terminated. - * @return TRUE if source is greater than target, FALSE otherwise. + * @return true if source is greater than target, false otherwise. * @see ucol_strcoll * @see ucol_greaterOrEqual * @see ucol_equal * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucol_greater(const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength); @@ -619,13 +622,13 @@ ucol_greater(const UCollator *coll, * @param sourceLength The length of source, or -1 if null-terminated. * @param target The target string. * @param targetLength The length of target, or -1 if null-terminated. - * @return TRUE if source is greater than or equal to target, FALSE otherwise. + * @return true if source is greater than or equal to target, false otherwise. * @see ucol_strcoll * @see ucol_greater * @see ucol_equal * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucol_greaterOrEqual(const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength); @@ -638,13 +641,13 @@ ucol_greaterOrEqual(const UCollator *coll, * @param sourceLength The length of source, or -1 if null-terminated. * @param target The target string. * @param targetLength The length of target, or -1 if null-terminated. - * @return TRUE if source is equal to target, FALSE otherwise + * @return true if source is equal to target, false otherwise * @see ucol_strcoll * @see ucol_greater * @see ucol_greaterOrEqual * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucol_equal(const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength); @@ -661,7 +664,7 @@ ucol_equal(const UCollator *coll, * @see ucol_strcoll * @stable ICU 2.6 */ -U_STABLE UCollationResult U_EXPORT2 +U_CAPI UCollationResult U_EXPORT2 ucol_strcollIter( const UCollator *coll, UCharIterator *sIter, UCharIterator *tIter, @@ -676,7 +679,7 @@ ucol_strcollIter( const UCollator *coll, * @see ucol_setStrength * @stable ICU 2.0 */ -U_STABLE UCollationStrength U_EXPORT2 +U_CAPI UCollationStrength U_EXPORT2 ucol_getStrength(const UCollator *coll); /** @@ -688,7 +691,7 @@ ucol_getStrength(const UCollator *coll); * @see ucol_getStrength * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucol_setStrength(UCollator *coll, UCollationStrength strength); @@ -708,7 +711,7 @@ ucol_setStrength(UCollator *coll, * @see UColReorderCode * @stable ICU 4.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_getReorderCodes(const UCollator* coll, int32_t* dest, int32_t destCapacity, @@ -753,7 +756,7 @@ ucol_getReorderCodes(const UCollator* coll, * @see UColReorderCode * @stable ICU 4.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucol_setReorderCodes(UCollator* coll, const int32_t* reorderCodes, int32_t reorderCodesLength, @@ -778,7 +781,7 @@ ucol_setReorderCodes(UCollator* coll, * @see UColReorderCode * @stable ICU 4.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_getEquivalentReorderCodes(int32_t reorderCode, int32_t* dest, int32_t destCapacity, @@ -796,7 +799,7 @@ ucol_getEquivalentReorderCodes(int32_t reorderCode, * the output was truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_getDisplayName( const char *objLoc, const char *dispLoc, UChar *result, @@ -812,7 +815,7 @@ ucol_getDisplayName( const char *objLoc, * @see ucol_countAvailable * @stable ICU 2.0 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 ucol_getAvailable(int32_t localeIndex); /** @@ -823,7 +826,7 @@ ucol_getAvailable(int32_t localeIndex); * @see ucol_getAvailable * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_countAvailable(void); #if !UCONFIG_NO_SERVICE @@ -835,7 +838,7 @@ ucol_countAvailable(void); * responsible for closing the result. * @stable ICU 3.0 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 ucol_openAvailableLocales(UErrorCode *status); #endif @@ -848,7 +851,7 @@ ucol_openAvailableLocales(UErrorCode *status); * responsible for closing the result. * @stable ICU 3.0 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 ucol_getKeywords(UErrorCode *status); /** @@ -862,7 +865,7 @@ ucol_getKeywords(UErrorCode *status); * upon error. The caller is responsible for closing the result. * @stable ICU 3.0 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 ucol_getKeywordValues(const char *keyword, UErrorCode *status); /** @@ -881,7 +884,7 @@ ucol_getKeywordValues(const char *keyword, UErrorCode *status); * @return a string enumeration over keyword values for the given key and the locale. * @stable ICU 4.2 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 ucol_getKeywordValuesForLocale(const char* key, const char* locale, UBool commonlyUsed, @@ -901,7 +904,7 @@ ucol_getKeywordValuesForLocale(const char* key, * applications who wish to cache collators, or otherwise reuse * collators when possible. The functional equivalent may change * over time. For more information, please see the + * href="https://unicode-org.github.io/icu/userguide/locale#locales-and-services"> * Locales and Services section of the ICU User Guide. * @param result fillin for the functionally equivalent result locale * @param resultCapacity capacity of the fillin buffer @@ -918,7 +921,7 @@ ucol_getKeywordValuesForLocale(const char* key, * an error code will be returned. * @stable ICU 3.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity, const char* keyword, const char* locale, UBool* isAvailable, UErrorCode* status); @@ -931,7 +934,7 @@ ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity, * @return The collation tailoring rules. * @stable ICU 2.0 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ucol_getRules( const UCollator *coll, int32_t *length); @@ -942,7 +945,7 @@ ucol_getRules( const UCollator *coll, * This string will be normalized. * The structure and the syntax of the string is defined in the "Naming collators" * section of the users guide: - * http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme + * https://unicode-org.github.io/icu/userguide/collation/concepts#collator-naming-scheme * This API supports preflighting. * @param coll a collator * @param locale a locale that will appear as a collators locale in the resulting @@ -1014,7 +1017,7 @@ ucol_normalizeShortDefinitionString(const char *source, * @see ucol_keyHashCode * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_getSortKey(const UCollator *coll, const UChar *source, int32_t sourceLength, @@ -1042,7 +1045,7 @@ ucol_getSortKey(const UCollator *coll, * the sort key. * @stable ICU 2.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_nextSortKeyPart(const UCollator *coll, UCharIterator *iter, uint32_t state[2], @@ -1109,7 +1112,7 @@ typedef enum { * @see ucol_keyHashCode * @stable ICU 2.1 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_getBound(const uint8_t *source, int32_t sourceLength, UColBoundMode boundType, @@ -1126,7 +1129,7 @@ ucol_getBound(const uint8_t *source, * @param info the version # information, the result will be filled in * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucol_getVersion(const UCollator* coll, UVersionInfo info); /** @@ -1136,7 +1139,7 @@ ucol_getVersion(const UCollator* coll, UVersionInfo info); * @param info the version # information, the result will be filled in * @stable ICU 2.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info); /** @@ -1155,7 +1158,7 @@ ucol_getUCAVersion(const UCollator* coll, UVersionInfo info); * Using strings with U+FFFE may yield shorter sort keys. * * For details about Sort Key Features see - * http://userguide.icu-project.org/collation/api#TOC-Sort-Key-Features + * https://unicode-org.github.io/icu/userguide/collation/api#sort-key-features * * It is possible to merge multiple sort keys by consecutively merging * another one with the intermediate result. @@ -1186,7 +1189,7 @@ ucol_getUCAVersion(const UCollator* coll, UVersionInfo info); * in which cases the contents of dest is undefined * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length, const uint8_t *src2, int32_t src2Length, uint8_t *dest, int32_t destCapacity); @@ -1202,7 +1205,7 @@ ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length, * @see ucol_getAttribute * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status); /** @@ -1216,7 +1219,7 @@ ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, * @see ucol_setAttribute * @stable ICU 2.0 */ -U_STABLE UColAttributeValue U_EXPORT2 +U_CAPI UColAttributeValue U_EXPORT2 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status); /** @@ -1235,7 +1238,7 @@ ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status) * @see ucol_getMaxVariable * @stable ICU 53 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucol_setMaxVariable(UCollator *coll, UColReorderCode group, UErrorCode *pErrorCode); /** @@ -1245,7 +1248,7 @@ ucol_setMaxVariable(UCollator *coll, UColReorderCode group, UErrorCode *pErrorCo * @see ucol_setMaxVariable * @stable ICU 53 */ -U_STABLE UColReorderCode U_EXPORT2 +U_CAPI UColReorderCode U_EXPORT2 ucol_getMaxVariable(const UCollator *coll); #ifndef U_HIDE_DEPRECATED_API @@ -1286,7 +1289,7 @@ ucol_setVariableTop(UCollator *coll, * @see ucol_restoreVariableTop * @stable ICU 2.0 */ -U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status); +U_CAPI uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status); #ifndef U_HIDE_DEPRECATED_API /** @@ -1330,7 +1333,7 @@ ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *stat * @see ucol_close * @stable ICU 2.0 */ -U_STABLE UCollator* U_EXPORT2 +U_CAPI UCollator* U_EXPORT2 ucol_safeClone(const UCollator *coll, void *stackBuffer, int32_t *pBufferSize, @@ -1351,7 +1354,7 @@ ucol_safeClone(const UCollator *coll, * to store rules, will store up to available space. * * ucol_getRules() should normally be used instead. - * See http://userguide.icu-project.org/collation/customization#TOC-Building-on-Existing-Locales + * See https://unicode-org.github.io/icu/userguide/collation/customization#building-on-existing-locales * @param coll collator to get the rules from * @param delta one of UCOL_TAILORING_ONLY, UCOL_FULL_RULES. * @param buffer buffer to store the result in. If NULL, you'll get no rules. @@ -1360,7 +1363,7 @@ ucol_safeClone(const UCollator *coll, * @stable ICU 2.0 * @see UCOL_FULL_RULES */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen); #ifndef U_HIDE_DEPRECATED_API @@ -1396,7 +1399,7 @@ ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *statu * NULL. * @stable ICU 2.8 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status); /** @@ -1409,7 +1412,7 @@ ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode * @see uset_close * @stable ICU 2.4 */ -U_STABLE USet * U_EXPORT2 +U_CAPI USet * U_EXPORT2 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status); #ifndef U_HIDE_INTERNAL_API @@ -1424,7 +1427,7 @@ ucol_getTailoredSet(const UCollator *coll, UErrorCode *status); * @return number of elements in the set * @internal ICU 3.0 */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_getUnsafeSet( const UCollator *coll, USet *unsafe, UErrorCode *status); @@ -1436,12 +1439,12 @@ ucol_getUnsafeSet( const UCollator *coll, * state for a locale. * @param parseError if not NULL, structure that will get filled with error's pre * and post context in case of error. - * @param forceDefaults if FALSE, the settings that are the same as the collator + * @param forceDefaults if false, the settings that are the same as the collator * default settings will not be applied (for example, setting * French secondary on a French collator would not be executed). - * If TRUE, all the settings will be applied regardless of the + * If true, all the settings will be applied regardless of the * collator default value. If the definition - * strings are to be cached, should be set to FALSE. + * strings are to be cached, should be set to false. * @param status Error code. Apart from regular error conditions connected to * instantiating collators (like out of memory or similar), this * API will return an error if an invalid attribute or attribute/value @@ -1449,7 +1452,7 @@ ucol_getUnsafeSet( const UCollator *coll, * @see ucol_openFromShortString * @internal ICU 3.2.1 */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 ucol_prepareShortStringOpen( const char *definition, UBool forceDefaults, UParseError *parseError, @@ -1467,7 +1470,7 @@ ucol_prepareShortStringOpen( const char *definition, * @see ucol_openBinary * @stable ICU 3.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_cloneBinary(const UCollator *coll, uint8_t *buffer, int32_t capacity, UErrorCode *status); @@ -1489,7 +1492,7 @@ ucol_cloneBinary(const UCollator *coll, * @see ucol_cloneBinary * @stable ICU 3.2 */ -U_STABLE UCollator* U_EXPORT2 +U_CAPI UCollator* U_EXPORT2 ucol_openBinary(const uint8_t *bin, int32_t length, const UCollator *base, UErrorCode *status); diff --git a/deps/icu-small/source/i18n/unicode/ucoleitr.h b/deps/icu-small/source/i18n/unicode/ucoleitr.h index 96c67f2018a6c3..e8bcd368d4f0a4 100644 --- a/deps/icu-small/source/i18n/unicode/ucoleitr.h +++ b/deps/icu-small/source/i18n/unicode/ucoleitr.h @@ -23,7 +23,7 @@ #if !UCONFIG_NO_COLLATION /** - * This indicates an error has occured during processing or if no more CEs is + * This indicates an error has occurred during processing or if no more CEs is * to be returned. * @stable ICU 2.0 */ @@ -66,14 +66,14 @@ typedef struct UCollationElements UCollationElements; * . UCollationElements *c; * . UCollatorOld *coll; * . UErrorCode success = U_ZERO_ERROR; - * . s=(UChar*)malloc(sizeof(UChar) * (strlen("This is a test")+1) ); - * . u_uastrcpy(s, "This is a test"); + * . str=(UChar*)malloc(sizeof(UChar) * (strlen("This is a test")+1) ); + * . u_uastrcpy(str, "This is a test"); * . coll = ucol_open(NULL, &success); * . c = ucol_openElements(coll, str, u_strlen(str), &status); * . order = ucol_next(c, &success); * . ucol_reset(c); * . order = ucol_prev(c, &success); - * . free(s); + * . free(str); * . ucol_close(coll); * . ucol_closeElements(c); * . } @@ -102,6 +102,10 @@ typedef struct UCollationElements UCollationElements; /** * Open the collation elements for a string. * + * The UCollationElements retains a pointer to the supplied text. + * The caller must not modify or delete the text while the UCollationElements + * object is used to iterate over this text. + * * @param coll The collator containing the desired collation rules. * @param text The text to iterate over. * @param textLength The number of characters in text, or -1 if null-terminated @@ -109,13 +113,12 @@ typedef struct UCollationElements UCollationElements; * @return a struct containing collation element information * @stable ICU 2.0 */ -U_STABLE UCollationElements* U_EXPORT2 +U_CAPI UCollationElements* U_EXPORT2 ucol_openElements(const UCollator *coll, const UChar *text, int32_t textLength, UErrorCode *status); - /** * get a hash code for a key... Not very useful! * @param key the given key. @@ -123,7 +126,7 @@ ucol_openElements(const UCollator *coll, * @return the hash code. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_keyHashCode(const uint8_t* key, int32_t length); /** @@ -132,7 +135,7 @@ ucol_keyHashCode(const uint8_t* key, int32_t length); * @param elems The UCollationElements to close. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucol_closeElements(UCollationElements *elems); /** @@ -144,7 +147,7 @@ ucol_closeElements(UCollationElements *elems); * @see ucol_previous * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucol_reset(UCollationElements *elems); /** @@ -153,10 +156,10 @@ ucol_reset(UCollationElements *elems); * @param elems The UCollationElements containing the text. * @param status A pointer to a UErrorCode to receive any errors. * @return The next collation elements ordering, otherwise returns UCOL_NULLORDER - * if an error has occured or if the end of string has been reached + * if an error has occurred or if the end of string has been reached * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_next(UCollationElements *elems, UErrorCode *status); /** @@ -168,11 +171,11 @@ ucol_next(UCollationElements *elems, UErrorCode *status); * a U_BUFFER_OVERFLOW_ERROR is returned if the internal stack * buffer has been exhausted. * @return The previous collation elements ordering, otherwise returns - * UCOL_NULLORDER if an error has occured or if the start of string has + * UCOL_NULLORDER if an error has occurred or if the start of string has * been reached. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_previous(UCollationElements *elems, UErrorCode *status); /** @@ -186,7 +189,7 @@ ucol_previous(UCollationElements *elems, UErrorCode *status); * expansion sequence * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_getMaxExpansion(const UCollationElements *elems, int32_t order); /** @@ -194,6 +197,11 @@ ucol_getMaxExpansion(const UCollationElements *elems, int32_t order); * Property settings for collation will remain the same. * In order to reset the iterator to the current collation property settings, * the API reset() has to be called. + * + * The UCollationElements retains a pointer to the supplied text. + * The caller must not modify or delete the text while the UCollationElements + * object is used to iterate over this text. + * * @param elems The UCollationElements to set. * @param text The source text containing the collation elements. * @param textLength The length of text, or -1 if null-terminated. @@ -201,7 +209,7 @@ ucol_getMaxExpansion(const UCollationElements *elems, int32_t order); * @see ucol_getText * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucol_setText( UCollationElements *elems, const UChar *text, int32_t textLength, @@ -216,7 +224,7 @@ ucol_setText( UCollationElements *elems, * @see ucol_setOffset * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_getOffset(const UCollationElements *elems); /** @@ -231,9 +239,9 @@ ucol_getOffset(const UCollationElements *elems); * @see ucol_getOffset * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucol_setOffset(UCollationElements *elems, - int32_t offset, + int32_t offset, UErrorCode *status); /** @@ -242,7 +250,7 @@ ucol_setOffset(UCollationElements *elems, * @return the primary order of a collation order. * @stable ICU 2.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_primaryOrder (int32_t order); /** @@ -251,7 +259,7 @@ ucol_primaryOrder (int32_t order); * @return the secondary order of a collation order. * @stable ICU 2.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_secondaryOrder (int32_t order); /** @@ -260,7 +268,7 @@ ucol_secondaryOrder (int32_t order); * @return the tertiary order of a collation order. * @stable ICU 2.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucol_tertiaryOrder (int32_t order); #endif /* #if !UCONFIG_NO_COLLATION */ diff --git a/deps/icu-small/source/i18n/unicode/ucsdet.h b/deps/icu-small/source/i18n/unicode/ucsdet.h index 7a8564f9eabe37..50281ad1fb54cb 100644 --- a/deps/icu-small/source/i18n/unicode/ucsdet.h +++ b/deps/icu-small/source/i18n/unicode/ucsdet.h @@ -25,9 +25,12 @@ #if !UCONFIG_NO_CONVERSION -#include "unicode/localpointer.h" #include "unicode/uenum.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + /** * \file * \brief C API: Charset Detection API @@ -75,7 +78,7 @@ typedef struct UCharsetMatch UCharsetMatch; * @return the newly opened charset detector. * @stable ICU 3.6 */ -U_STABLE UCharsetDetector * U_EXPORT2 +U_CAPI UCharsetDetector * U_EXPORT2 ucsdet_open(UErrorCode *status); /** @@ -87,7 +90,7 @@ ucsdet_open(UErrorCode *status); * @param ucsd The charset detector to be closed. * @stable ICU 3.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucsdet_close(UCharsetDetector *ucsd); #if U_SHOW_CPLUSPLUS_API @@ -124,7 +127,7 @@ U_NAMESPACE_END * * @stable ICU 3.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucsdet_setText(UCharsetDetector *ucsd, const char *textIn, int32_t len, UErrorCode *status); @@ -146,7 +149,7 @@ ucsdet_setText(UCharsetDetector *ucsd, const char *textIn, int32_t len, UErrorCo * * @stable ICU 3.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucsdet_setDeclaredEncoding(UCharsetDetector *ucsd, const char *encoding, int32_t length, UErrorCode *status); @@ -175,7 +178,7 @@ ucsdet_setDeclaredEncoding(UCharsetDetector *ucsd, const char *encoding, int32_t * * @stable ICU 3.6 */ -U_STABLE const UCharsetMatch * U_EXPORT2 +U_CAPI const UCharsetMatch * U_EXPORT2 ucsdet_detect(UCharsetDetector *ucsd, UErrorCode *status); @@ -209,7 +212,7 @@ ucsdet_detect(UCharsetDetector *ucsd, UErrorCode *status); * the detector is closed or modified. * @stable ICU 3.6 */ -U_STABLE const UCharsetMatch ** U_EXPORT2 +U_CAPI const UCharsetMatch ** U_EXPORT2 ucsdet_detectAll(UCharsetDetector *ucsd, int32_t *matchesFound, UErrorCode *status); @@ -229,7 +232,7 @@ ucsdet_detectAll(UCharsetDetector *ucsd, int32_t *matchesFound, UErrorCode *stat * * @stable ICU 3.6 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ucsdet_getName(const UCharsetMatch *ucsm, UErrorCode *status); /** @@ -255,7 +258,7 @@ ucsdet_getName(const UCharsetMatch *ucsm, UErrorCode *status); * * @stable ICU 3.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucsdet_getConfidence(const UCharsetMatch *ucsm, UErrorCode *status); /** @@ -287,7 +290,7 @@ ucsdet_getConfidence(const UCharsetMatch *ucsm, UErrorCode *status); * * @stable ICU 3.6 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ucsdet_getLanguage(const UCharsetMatch *ucsm, UErrorCode *status); @@ -313,7 +316,7 @@ ucsdet_getLanguage(const UCharsetMatch *ucsm, UErrorCode *status); * * @stable ICU 3.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucsdet_getUChars(const UCharsetMatch *ucsm, UChar *buf, int32_t cap, UErrorCode *status); @@ -347,7 +350,7 @@ ucsdet_getUChars(const UCharsetMatch *ucsm, * @return an iterator providing access to the detectable charset names. * @stable ICU 3.6 */ -U_STABLE UEnumeration * U_EXPORT2 +U_CAPI UEnumeration * U_EXPORT2 ucsdet_getAllDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status); /** @@ -357,11 +360,11 @@ ucsdet_getAllDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *statu * heuristics. * * @param ucsd The charset detector to check. - * @return TRUE if filtering is enabled. + * @return true if filtering is enabled. * @stable ICU 3.6 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucsdet_isInputFilterEnabled(const UCharsetDetector *ucsd); @@ -376,7 +379,7 @@ ucsdet_isInputFilterEnabled(const UCharsetDetector *ucsd); * * @stable ICU 3.6 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucsdet_enableInputFilter(UCharsetDetector *ucsd, UBool filter); #ifndef U_HIDE_INTERNAL_API @@ -393,7 +396,7 @@ ucsdet_enableInputFilter(UCharsetDetector *ucsd, UBool filter); * the specified charset detector. * @internal */ -U_INTERNAL UEnumeration * U_EXPORT2 +U_CAPI UEnumeration * U_EXPORT2 ucsdet_getDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status); /** @@ -403,13 +406,13 @@ ucsdet_getDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status); * * @param ucsd a Charset detector. * @param encoding encoding the name of charset encoding. - * @param enabled TRUE to enable, or FALSE to disable the + * @param enabled true to enable, or false to disable the * charset encoding. * @param status receives the return status. When the name of charset encoding * is not supported, U_ILLEGAL_ARGUMENT_ERROR is set. * @internal */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 ucsdet_setDetectableCharset(UCharsetDetector *ucsd, const char *encoding, UBool enabled, UErrorCode *status); #endif /* U_HIDE_INTERNAL_API */ diff --git a/deps/icu-small/source/i18n/unicode/udat.h b/deps/icu-small/source/i18n/unicode/udat.h index cf7a165e70ab4f..ec25eba8085223 100644 --- a/deps/icu-small/source/i18n/unicode/udat.h +++ b/deps/icu-small/source/i18n/unicode/udat.h @@ -14,11 +14,15 @@ #if !UCONFIG_NO_FORMATTING -#include "unicode/localpointer.h" #include "unicode/ucal.h" #include "unicode/unum.h" #include "unicode/udisplaycontext.h" #include "unicode/ufieldpositer.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + /** * \file * \brief C API: DateFormat @@ -142,7 +146,7 @@ * the date and time formatting algorithm and pattern letters defined by * UTS#35 * Unicode Locale Data Markup Language (LDML) and further documented for ICU in the - * ICU + * ICU * User Guide.

        */ @@ -832,10 +836,24 @@ typedef enum UDateFormatField { /** * Maps from a UDateFormatField to the corresponding UCalendarDateFields. - * Note: since the mapping is many-to-one, there is no inverse mapping. + * + * Note 1: Since the mapping is many-to-one, there is no inverse mapping. + * + * Note 2: There is no UErrorCode parameter, so in case of error (UDateFormatField is + * unknown or has no corresponding UCalendarDateFields value), the function returns the + * current value of UCAL_FIELD_COUNT. However, that value may change from release to + * release and is consequently deprecated. For a future-proof runtime way of checking + * for errors: + * a) First save the value returned by the function when it is passed an invalid value + * such as "(UDateFormatField)-1". + * b) Then, to test for errors when passing some other UDateFormatField value, check + * whether the function returns that saved value. + * * @param field the UDateFormatField. - * @return the UCalendarDateField. This will be UCAL_FIELD_COUNT in case - * of error (e.g., the input field is UDAT_FIELD_COUNT). + * @return the UCalendarDateField. In case of error (UDateFormatField is unknown or has + * no corresponding UCalendarDateFields value) this will be the current value of + * UCAL_FIELD_COUNT, but that value may change from release to release. + * See Note 2 above. * @stable ICU 4.4 */ U_CAPI UCalendarDateFields U_EXPORT2 @@ -1217,7 +1235,7 @@ udat_parseCalendar(const UDateFormat* format, * With lenient parsing, the parser may use heuristics to interpret inputs that do not * precisely match the pattern. With strict parsing, inputs must match the pattern. * @param fmt The formatter to query -* @return TRUE if fmt is set to perform lenient parsing, FALSE otherwise. +* @return true if fmt is set to perform lenient parsing, false otherwise. * @see udat_setLenient * @stable ICU 2.0 */ @@ -1229,7 +1247,7 @@ udat_isLenient(const UDateFormat* fmt); * With lenient parsing, the parser may use heuristics to interpret inputs that do not * precisely match the pattern. With strict parsing, inputs must match the pattern. * @param fmt The formatter to set -* @param isLenient TRUE if fmt should perform lenient parsing, FALSE otherwise. +* @param isLenient true if fmt should perform lenient parsing, false otherwise. * @see dat_isLenient * @stable ICU 2.0 */ @@ -1389,7 +1407,7 @@ udat_set2DigitYearStart( UDateFormat *fmt, * Extract the pattern from a UDateFormat. * The pattern will follow the pattern syntax rules. * @param fmt The formatter to query. -* @param localized TRUE if the pattern should be localized, FALSE otherwise. +* @param localized true if the pattern should be localized, false otherwise. * @param result A pointer to a buffer to receive the pattern. * @param resultLength The maximum size of result. * @param status A pointer to an UErrorCode to receive any errors @@ -1408,7 +1426,7 @@ udat_toPattern( const UDateFormat *fmt, * Set the pattern used by an UDateFormat. * The pattern should follow the pattern syntax rules. * @param format The formatter to set. -* @param localized TRUE if the pattern is localized, FALSE otherwise. +* @param localized true if the pattern is localized, false otherwise. * @param pattern The new pattern * @param patternLength The length of pattern, or -1 if null-terminated. * @see udat_toPattern @@ -1636,7 +1654,7 @@ udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* st * @see udat_applyPatternRelative * @internal ICU 4.2 technology preview */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udat_toPatternRelativeDate(const UDateFormat *fmt, UChar *result, int32_t resultLength, @@ -1653,7 +1671,7 @@ udat_toPatternRelativeDate(const UDateFormat *fmt, * @see udat_applyPatternRelative * @internal ICU 4.2 technology preview */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udat_toPatternRelativeTime(const UDateFormat *fmt, UChar *result, int32_t resultLength, @@ -1671,7 +1689,7 @@ udat_toPatternRelativeTime(const UDateFormat *fmt, * @see udat_toPatternRelativeDate, udat_toPatternRelativeTime * @internal ICU 4.2 technology preview */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_applyPatternRelative(UDateFormat *format, const UChar *datePattern, int32_t datePatternLength, @@ -1696,14 +1714,14 @@ typedef UDateFormat* (U_EXPORT2 *UDateFormatOpener) (UDateFormatStyle timeStyle * Register a provider factory * @internal ICU 49 */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_registerOpener(UDateFormatOpener opener, UErrorCode *status); /** * Un-Register a provider factory * @internal ICU 49 */ -U_INTERNAL UDateFormatOpener U_EXPORT2 +U_CAPI UDateFormatOpener U_EXPORT2 udat_unregisterOpener(UDateFormatOpener opener, UErrorCode *status); #endif /* U_HIDE_INTERNAL_API */ diff --git a/deps/icu-small/source/i18n/unicode/udateintervalformat.h b/deps/icu-small/source/i18n/unicode/udateintervalformat.h index 6235ab710622ce..a840ed595b45cb 100644 --- a/deps/icu-small/source/i18n/unicode/udateintervalformat.h +++ b/deps/icu-small/source/i18n/unicode/udateintervalformat.h @@ -16,8 +16,12 @@ #include "unicode/ucal.h" #include "unicode/umisc.h" -#include "unicode/localpointer.h" #include "unicode/uformattedvalue.h" +#include "unicode/udisplaycontext.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** * \file @@ -114,7 +118,7 @@ typedef struct UFormattedDateInterval UFormattedDateInterval; * or NULL if an error occurred. * @stable ICU 4.8 */ -U_STABLE UDateIntervalFormat* U_EXPORT2 +U_CAPI UDateIntervalFormat* U_EXPORT2 udtitvfmt_open(const char* locale, const UChar* skeleton, int32_t skeletonLength, @@ -128,7 +132,7 @@ udtitvfmt_open(const char* locale, * The UDateIntervalFormat object to close. * @stable ICU 4.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 udtitvfmt_close(UDateIntervalFormat *formatter); /** @@ -238,7 +242,7 @@ U_NAMESPACE_END * output was truncated. * @stable ICU 4.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udtitvfmt_format(const UDateIntervalFormat* formatter, UDate fromDate, UDate toDate, @@ -265,7 +269,7 @@ udtitvfmt_format(const UDateIntervalFormat* formatter, * A pointer to a UErrorCode to receive any errors. * @draft ICU 67 */ -U_DRAFT void U_EXPORT2 +U_CAPI void U_EXPORT2 udtitvfmt_formatToResult( const UDateIntervalFormat* formatter, UDate fromDate, @@ -290,7 +294,7 @@ udtitvfmt_formatToResult( * @draft ICU 67 */ -U_DRAFT void U_EXPORT2 +U_CAPI void U_EXPORT2 udtitvfmt_formatCalendarToResult( const UDateIntervalFormat* formatter, UCalendar* fromCalendar, @@ -299,6 +303,34 @@ udtitvfmt_formatCalendarToResult( UErrorCode* status); #endif /* U_HIDE_DRAFT_API */ +#ifndef U_HIDE_DRAFT_API +/** + * Set a particular UDisplayContext value in the formatter, such as + * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. This causes the formatted + * result to be capitalized appropriately for the context in which + * it is intended to be used, considering both the locale and the + * type of field at the beginning of the formatted result. + * @param formatter The formatter for which to set a UDisplayContext value. + * @param value The UDisplayContext value to set. + * @param status A pointer to an UErrorCode to receive any errors + * @draft ICU 68 + */ +U_CAPI void U_EXPORT2 +udtitvfmt_setContext(UDateIntervalFormat* formatter, UDisplayContext value, UErrorCode* status); + +/** + * Get the formatter's UDisplayContext value for the specified UDisplayContextType, + * such as UDISPCTX_TYPE_CAPITALIZATION. + * @param formatter The formatter to query. + * @param type The UDisplayContextType whose value to return + * @param status A pointer to an UErrorCode to receive any errors + * @return The UDisplayContextValue for the specified type. + * @draft ICU 68 + */ +U_CAPI UDisplayContext U_EXPORT2 +udtitvfmt_getContext(const UDateIntervalFormat* formatter, UDisplayContextType type, UErrorCode* status); + +#endif /* U_HIDE_DRAFT_API */ #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/i18n/unicode/udatpg.h b/deps/icu-small/source/i18n/unicode/udatpg.h index 4ec4a2d05116cb..9fe267a3f488f4 100644 --- a/deps/icu-small/source/i18n/unicode/udatpg.h +++ b/deps/icu-small/source/i18n/unicode/udatpg.h @@ -22,7 +22,10 @@ #include "unicode/utypes.h" #include "unicode/udat.h" #include "unicode/uenum.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** * \file @@ -161,7 +164,7 @@ typedef enum UDateTimePatternConflict { * @return a pointer to UDateTimePatternGenerator. * @stable ICU 3.8 */ -U_STABLE UDateTimePatternGenerator * U_EXPORT2 +U_CAPI UDateTimePatternGenerator * U_EXPORT2 udatpg_open(const char *locale, UErrorCode *pErrorCode); /** @@ -171,7 +174,7 @@ udatpg_open(const char *locale, UErrorCode *pErrorCode); * @return a pointer to UDateTimePatternGenerator. * @stable ICU 3.8 */ -U_STABLE UDateTimePatternGenerator * U_EXPORT2 +U_CAPI UDateTimePatternGenerator * U_EXPORT2 udatpg_openEmpty(UErrorCode *pErrorCode); /** @@ -179,7 +182,7 @@ udatpg_openEmpty(UErrorCode *pErrorCode); * @param dtpg a pointer to UDateTimePatternGenerator. * @stable ICU 3.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 udatpg_close(UDateTimePatternGenerator *dtpg); #if U_SHOW_CPLUSPLUS_API @@ -209,7 +212,7 @@ U_NAMESPACE_END * @return a pointer to a new UDateTimePatternGenerator. * @stable ICU 3.8 */ -U_STABLE UDateTimePatternGenerator * U_EXPORT2 +U_CAPI UDateTimePatternGenerator * U_EXPORT2 udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode); /** @@ -235,7 +238,7 @@ udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode); * @return the length of bestPattern. * @stable ICU 3.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udatpg_getBestPattern(UDateTimePatternGenerator *dtpg, const UChar *skeleton, int32_t length, UChar *bestPattern, int32_t capacity, @@ -271,7 +274,7 @@ udatpg_getBestPattern(UDateTimePatternGenerator *dtpg, * @return the length of bestPattern. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg, const UChar *skeleton, int32_t length, UDateTimePatternMatchOptions options, @@ -299,7 +302,7 @@ udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg, * @return the length of skeleton. * @stable ICU 3.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udatpg_getSkeleton(UDateTimePatternGenerator *unusedDtpg, const UChar *pattern, int32_t length, UChar *skeleton, int32_t capacity, @@ -329,7 +332,7 @@ udatpg_getSkeleton(UDateTimePatternGenerator *unusedDtpg, * @return the length of baseSkeleton. * @stable ICU 3.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udatpg_getBaseSkeleton(UDateTimePatternGenerator *unusedDtpg, const UChar *pattern, int32_t length, UChar *baseSkeleton, int32_t capacity, @@ -359,7 +362,7 @@ udatpg_getBaseSkeleton(UDateTimePatternGenerator *unusedDtpg, * UDATPG_BASE_CONFLICT or UDATPG_CONFLICT. * @stable ICU 3.8 */ -U_STABLE UDateTimePatternConflict U_EXPORT2 +U_CAPI UDateTimePatternConflict U_EXPORT2 udatpg_addPattern(UDateTimePatternGenerator *dtpg, const UChar *pattern, int32_t patternLength, UBool override, @@ -386,7 +389,7 @@ udatpg_addPattern(UDateTimePatternGenerator *dtpg, * @param length the length of value. * @stable ICU 3.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg, UDateTimePatternField field, const UChar *value, int32_t length); @@ -401,7 +404,7 @@ udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg, * @return appendItemFormat for field. * @stable ICU 3.8 */ -U_STABLE const UChar * U_EXPORT2 +U_CAPI const UChar * U_EXPORT2 udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg, UDateTimePatternField field, int32_t *pLength); @@ -419,7 +422,7 @@ udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg, * @param length the length of value. * @stable ICU 3.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg, UDateTimePatternField field, const UChar *value, int32_t length); @@ -436,7 +439,7 @@ udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg, * @see udatpg_getFieldDisplayName * @stable ICU 3.8 */ -U_STABLE const UChar * U_EXPORT2 +U_CAPI const UChar * U_EXPORT2 udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg, UDateTimePatternField field, int32_t *pLength); @@ -466,7 +469,7 @@ udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg, * truncated result. * @stable ICU 61 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg, UDateTimePatternField field, UDateTimePGDisplayWidth width, @@ -496,7 +499,7 @@ udatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg, * @param length the length of dtFormat. * @stable ICU 3.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg, const UChar *dtFormat, int32_t length); @@ -507,7 +510,7 @@ udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg, * @return dateTimeFormat. * @stable ICU 3.8 */ -U_STABLE const UChar * U_EXPORT2 +U_CAPI const UChar * U_EXPORT2 udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg, int32_t *pLength); @@ -524,7 +527,7 @@ udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg, * @param length the length of decimal. * @stable ICU 3.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 udatpg_setDecimal(UDateTimePatternGenerator *dtpg, const UChar *decimal, int32_t length); @@ -536,7 +539,7 @@ udatpg_setDecimal(UDateTimePatternGenerator *dtpg, * @return corresponding to the decimal point. * @stable ICU 3.8 */ -U_STABLE const UChar * U_EXPORT2 +U_CAPI const UChar * U_EXPORT2 udatpg_getDecimal(const UDateTimePatternGenerator *dtpg, int32_t *pLength); @@ -565,7 +568,7 @@ udatpg_getDecimal(const UDateTimePatternGenerator *dtpg, * @return the length of dest. * @stable ICU 3.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg, const UChar *pattern, int32_t patternLength, const UChar *skeleton, int32_t skeletonLength, @@ -602,7 +605,7 @@ udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg, * @return the length of dest. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg, const UChar *pattern, int32_t patternLength, const UChar *skeleton, int32_t skeletonLength, @@ -621,7 +624,7 @@ udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg, * The caller must close the object. * @stable ICU 3.8 */ -U_STABLE UEnumeration * U_EXPORT2 +U_CAPI UEnumeration * U_EXPORT2 udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode); /** @@ -634,7 +637,7 @@ udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCo * The caller must close the object. * @stable ICU 3.8 */ -U_STABLE UEnumeration * U_EXPORT2 +U_CAPI UEnumeration * U_EXPORT2 udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode); /** @@ -647,7 +650,7 @@ udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErr * @return pattern corresponding to a given skeleton. * @stable ICU 3.8 */ -U_STABLE const UChar * U_EXPORT2 +U_CAPI const UChar * U_EXPORT2 udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg, const UChar *skeleton, int32_t skeletonLength, int32_t *pLength); @@ -668,7 +671,7 @@ udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg, * @return the default hour cycle. * @draft ICU 67 */ -U_DRAFT UDateFormatHourCycle U_EXPORT2 +U_CAPI UDateFormatHourCycle U_EXPORT2 udatpg_getDefaultHourCycle(const UDateTimePatternGenerator *dtpg, UErrorCode* pErrorCode); #endif /* U_HIDE_DRAFT_API */ diff --git a/deps/icu-small/source/i18n/unicode/ufieldpositer.h b/deps/icu-small/source/i18n/unicode/ufieldpositer.h index 3ae73b6d843974..83df184f0a5958 100644 --- a/deps/icu-small/source/i18n/unicode/ufieldpositer.h +++ b/deps/icu-small/source/i18n/unicode/ufieldpositer.h @@ -14,7 +14,9 @@ #if !UCONFIG_NO_FORMATTING +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** * \file @@ -52,7 +54,7 @@ typedef struct UFieldPositionIterator UFieldPositionIterator; /**< C typedef fo * or NULL if an error occurred. * @stable ICU 55 */ -U_STABLE UFieldPositionIterator* U_EXPORT2 +U_CAPI UFieldPositionIterator* U_EXPORT2 ufieldpositer_open(UErrorCode* status); /** @@ -61,7 +63,7 @@ ufieldpositer_open(UErrorCode* status); * A pointer to the UFieldPositionIterator object to close. * @stable ICU 55 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ufieldpositer_close(UFieldPositionIterator *fpositer); @@ -112,7 +114,7 @@ U_NAMESPACE_END * * @stable ICU 55 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ufieldpositer_next(UFieldPositionIterator *fpositer, int32_t *beginIndex, int32_t *endIndex); diff --git a/deps/icu-small/source/i18n/unicode/uformattable.h b/deps/icu-small/source/i18n/unicode/uformattable.h index 9ba2a36901aa83..6b8bee1f3dfe7c 100644 --- a/deps/icu-small/source/i18n/unicode/uformattable.h +++ b/deps/icu-small/source/i18n/unicode/uformattable.h @@ -34,7 +34,9 @@ #if !UCONFIG_NO_FORMATTING +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** * Enum designating the type of a UFormattable instance. @@ -79,7 +81,7 @@ typedef void *UFormattable; * @see ufmt_close * @see icu::Formattable::Formattable() */ -U_STABLE UFormattable* U_EXPORT2 +U_CAPI UFormattable* U_EXPORT2 ufmt_open(UErrorCode* status); /** @@ -88,7 +90,7 @@ ufmt_open(UErrorCode* status); * @stable ICU 52 * @see ufmt_open */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ufmt_close(UFormattable* fmt); #if U_SHOW_CPLUSPLUS_API @@ -120,7 +122,7 @@ U_NAMESPACE_END * @see icu::Formattable::getType() const * @stable ICU 52 */ -U_STABLE UFormattableType U_EXPORT2 +U_CAPI UFormattableType U_EXPORT2 ufmt_getType(const UFormattable* fmt, UErrorCode *status); /** @@ -131,7 +133,7 @@ ufmt_getType(const UFormattable* fmt, UErrorCode *status); * @see icu::Formattable::isNumeric() const * @stable ICU 52 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ufmt_isNumeric(const UFormattable* fmt); /** @@ -144,7 +146,7 @@ ufmt_isNumeric(const UFormattable* fmt); * @stable ICU 52 * @see icu::Formattable::getDate(UErrorCode&) const */ -U_STABLE UDate U_EXPORT2 +U_CAPI UDate U_EXPORT2 ufmt_getDate(const UFormattable* fmt, UErrorCode *status); /** @@ -162,7 +164,7 @@ ufmt_getDate(const UFormattable* fmt, UErrorCode *status); * @stable ICU 52 * @see icu::Formattable::getDouble(UErrorCode&) const */ -U_STABLE double U_EXPORT2 +U_CAPI double U_EXPORT2 ufmt_getDouble(UFormattable* fmt, UErrorCode *status); /** @@ -183,7 +185,7 @@ ufmt_getDouble(UFormattable* fmt, UErrorCode *status); * @stable ICU 52 * @see icu::Formattable::getLong(UErrorCode&) const */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ufmt_getLong(UFormattable* fmt, UErrorCode *status); @@ -204,7 +206,7 @@ ufmt_getLong(UFormattable* fmt, UErrorCode *status); * @stable ICU 52 * @see icu::Formattable::getInt64(UErrorCode&) const */ -U_STABLE int64_t U_EXPORT2 +U_CAPI int64_t U_EXPORT2 ufmt_getInt64(UFormattable* fmt, UErrorCode *status); /** @@ -217,7 +219,7 @@ ufmt_getInt64(UFormattable* fmt, UErrorCode *status); * @stable ICU 52 * @see icu::Formattable::getObject() const */ -U_STABLE const void *U_EXPORT2 +U_CAPI const void *U_EXPORT2 ufmt_getObject(const UFormattable* fmt, UErrorCode *status); /** @@ -232,7 +234,7 @@ ufmt_getObject(const UFormattable* fmt, UErrorCode *status); * @stable ICU 52 * @see icu::Formattable::getString(UnicodeString&)const */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ufmt_getUChars(UFormattable* fmt, int32_t *len, UErrorCode *status); /** @@ -243,7 +245,7 @@ ufmt_getUChars(UFormattable* fmt, int32_t *len, UErrorCode *status); * @stable ICU 52 * @see ufmt_getArrayItemByIndex */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ufmt_getArrayLength(const UFormattable* fmt, UErrorCode *status); /** @@ -255,7 +257,7 @@ ufmt_getArrayLength(const UFormattable* fmt, UErrorCode *status); * @stable ICU 52 * @see icu::Formattable::getArray(int32_t&, UErrorCode&) const */ -U_STABLE UFormattable * U_EXPORT2 +U_CAPI UFormattable * U_EXPORT2 ufmt_getArrayItemByIndex(UFormattable* fmt, int32_t n, UErrorCode *status); /** @@ -280,7 +282,7 @@ ufmt_getArrayItemByIndex(UFormattable* fmt, int32_t n, UErrorCode *status); * @stable ICU 52 * @see icu::Formattable::getDecimalNumber(UErrorCode&) */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ufmt_getDecNumChars(UFormattable *fmt, int32_t *len, UErrorCode *status); #endif diff --git a/deps/icu-small/source/i18n/unicode/uformattedvalue.h b/deps/icu-small/source/i18n/unicode/uformattedvalue.h index 71a6592e9dd062..3017372d8b3c58 100644 --- a/deps/icu-small/source/i18n/unicode/uformattedvalue.h +++ b/deps/icu-small/source/i18n/unicode/uformattedvalue.h @@ -120,7 +120,7 @@ typedef struct UConstrainedFieldPosition UConstrainedFieldPosition; * @return The new object, or NULL if an error occurs. * @stable ICU 64 */ -U_STABLE UConstrainedFieldPosition* U_EXPORT2 +U_CAPI UConstrainedFieldPosition* U_EXPORT2 ucfpos_open(UErrorCode* ec); @@ -133,7 +133,7 @@ ucfpos_open(UErrorCode* ec); * @param ec Set if an error occurs. * @stable ICU 64 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucfpos_reset( UConstrainedFieldPosition* ucfpos, UErrorCode* ec); @@ -145,7 +145,7 @@ ucfpos_reset( * @param ucfpos The instance of UConstrainedFieldPosition. * @stable ICU 64 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucfpos_close(UConstrainedFieldPosition* ucfpos); @@ -174,7 +174,7 @@ ucfpos_close(UConstrainedFieldPosition* ucfpos); * @param ec Set if an error occurs. * @stable ICU 64 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucfpos_constrainCategory( UConstrainedFieldPosition* ucfpos, int32_t category, @@ -207,7 +207,7 @@ ucfpos_constrainCategory( * @param ec Set if an error occurs. * @stable ICU 64 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucfpos_constrainField( UConstrainedFieldPosition* ucfpos, int32_t category, @@ -220,14 +220,14 @@ ucfpos_constrainField( * * If a category or field constraint was set, this function returns the constrained * category. Otherwise, the return value is well-defined only after - * ufmtval_nextPosition returns TRUE. + * ufmtval_nextPosition returns true. * * @param ucfpos The instance of UConstrainedFieldPosition. * @param ec Set if an error occurs. * @return The field category saved in the instance. * @stable ICU 64 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucfpos_getCategory( const UConstrainedFieldPosition* ucfpos, UErrorCode* ec); @@ -238,14 +238,14 @@ ucfpos_getCategory( * * If a field constraint was set, this function returns the constrained * field. Otherwise, the return value is well-defined only after - * ufmtval_nextPosition returns TRUE. + * ufmtval_nextPosition returns true. * * @param ucfpos The instance of UConstrainedFieldPosition. * @param ec Set if an error occurs. * @return The field saved in the instance. * @stable ICU 64 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucfpos_getField( const UConstrainedFieldPosition* ucfpos, UErrorCode* ec); @@ -254,7 +254,7 @@ ucfpos_getField( /** * Gets the INCLUSIVE start and EXCLUSIVE end index stored for the current position. * - * The output values are well-defined only after ufmtval_nextPosition returns TRUE. + * The output values are well-defined only after ufmtval_nextPosition returns true. * * @param ucfpos The instance of UConstrainedFieldPosition. * @param pStart Set to the start index saved in the instance. Ignored if nullptr. @@ -262,7 +262,7 @@ ucfpos_getField( * @param ec Set if an error occurs. * @stable ICU 64 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucfpos_getIndexes( const UConstrainedFieldPosition* ucfpos, int32_t* pStart, @@ -282,7 +282,7 @@ ucfpos_getIndexes( * @return The current iteration context from ucfpos_setInt64IterationContext. * @stable ICU 64 */ -U_STABLE int64_t U_EXPORT2 +U_CAPI int64_t U_EXPORT2 ucfpos_getInt64IterationContext( const UConstrainedFieldPosition* ucfpos, UErrorCode* ec); @@ -298,7 +298,7 @@ ucfpos_getInt64IterationContext( * @param ec Set if an error occurs. * @stable ICU 64 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucfpos_setInt64IterationContext( UConstrainedFieldPosition* ucfpos, int64_t context, @@ -317,7 +317,7 @@ ucfpos_setInt64IterationContext( * @param ec Set if an error occurs. * @stable ICU 64 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucfpos_matchesField( const UConstrainedFieldPosition* ucfpos, int32_t category, @@ -341,7 +341,7 @@ ucfpos_matchesField( * @param ec Set if an error occurs. * @stable ICU 64 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucfpos_setState( UConstrainedFieldPosition* ucfpos, int32_t category, @@ -374,7 +374,7 @@ typedef struct UFormattedValue UFormattedValue; * @return A NUL-terminated char16 string owned by the UFormattedValue. * @stable ICU 64 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ufmtval_getString( const UFormattedValue* ufmtval, int32_t* pLength, @@ -401,10 +401,10 @@ ufmtval_getString( * see ucfpos_constrainCategory * and ucfpos_constrainField. * @param ec Set if an error occurs. - * @return TRUE if another position was found; FALSE otherwise. + * @return true if another position was found; false otherwise. * @stable ICU 64 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ufmtval_nextPosition( const UFormattedValue* ufmtval, UConstrainedFieldPosition* ucfpos, diff --git a/deps/icu-small/source/i18n/unicode/ugender.h b/deps/icu-small/source/i18n/unicode/ugender.h index 903f3dd5deebbe..7093686b8fdab5 100644 --- a/deps/icu-small/source/i18n/unicode/ugender.h +++ b/deps/icu-small/source/i18n/unicode/ugender.h @@ -14,7 +14,9 @@ #if !UCONFIG_NO_FORMATTING +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** * \file @@ -63,7 +65,7 @@ typedef struct UGenderInfo UGenderInfo; * @return A UGenderInfo for the specified locale, or NULL if an error occurred. * @stable ICU 50 */ -U_STABLE const UGenderInfo* U_EXPORT2 +U_CAPI const UGenderInfo* U_EXPORT2 ugender_getInstance(const char *locale, UErrorCode *status); @@ -76,7 +78,7 @@ ugender_getInstance(const char *locale, UErrorCode *status); * @return The gender of the list. * @stable ICU 50 */ -U_STABLE UGender U_EXPORT2 +U_CAPI UGender U_EXPORT2 ugender_getListGender(const UGenderInfo* genderInfo, const UGender *genders, int32_t size, UErrorCode *status); #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/i18n/unicode/ulistformatter.h b/deps/icu-small/source/i18n/unicode/ulistformatter.h index 66cf50190bb0eb..3dfa9f2d56171f 100644 --- a/deps/icu-small/source/i18n/unicode/ulistformatter.h +++ b/deps/icu-small/source/i18n/unicode/ulistformatter.h @@ -14,9 +14,12 @@ #if !UCONFIG_NO_FORMATTING -#include "unicode/localpointer.h" #include "unicode/uformattedvalue.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + /** * \file * \brief C API: Format a list in a locale-appropriate way. @@ -161,7 +164,7 @@ ulistfmt_open(const char* locale, * or NULL if an error occurred. * @draft ICU 67 */ -U_DRAFT UListFormatter* U_EXPORT2 +U_CAPI UListFormatter* U_EXPORT2 ulistfmt_openForType(const char* locale, UListFormatterType type, UListFormatterWidth width, UErrorCode* status); #endif /* U_HIDE_DRAFT_API */ diff --git a/deps/icu-small/source/i18n/unicode/ulocdata.h b/deps/icu-small/source/i18n/unicode/ulocdata.h index de8d8539c6749a..3977743e3238ec 100644 --- a/deps/icu-small/source/i18n/unicode/ulocdata.h +++ b/deps/icu-small/source/i18n/unicode/ulocdata.h @@ -22,7 +22,10 @@ #include "unicode/ures.h" #include "unicode/uloc.h" #include "unicode/uset.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** * \file @@ -87,7 +90,7 @@ typedef enum ULocaleDataDelimiterType { * @param status Pointer to error status code. * @stable ICU 3.4 */ -U_STABLE ULocaleData* U_EXPORT2 +U_CAPI ULocaleData* U_EXPORT2 ulocdata_open(const char *localeID, UErrorCode *status); /** @@ -96,7 +99,7 @@ ulocdata_open(const char *localeID, UErrorCode *status); * @param uld The locale data object to close * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ulocdata_close(ULocaleData *uld); #if U_SHOW_CPLUSPLUS_API @@ -129,7 +132,7 @@ U_NAMESPACE_END * @param setting Value of the "no substitute" attribute. * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ulocdata_setNoSubstitute(ULocaleData *uld, UBool setting); /** @@ -143,7 +146,7 @@ ulocdata_setNoSubstitute(ULocaleData *uld, UBool setting); * @return UBool Value of the "no substitute" attribute. * @stable ICU 3.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ulocdata_getNoSubstitute(ULocaleData *uld); /** @@ -173,7 +176,7 @@ ulocdata_getNoSubstitute(ULocaleData *uld); * In case of error, NULL is returned. * @stable ICU 3.4 */ -U_STABLE USet* U_EXPORT2 +U_CAPI USet* U_EXPORT2 ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn, uint32_t options, ULocaleDataExemplarSetType extype, UErrorCode *status); @@ -190,7 +193,7 @@ ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn, * the output was truncated. * @stable ICU 3.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ulocdata_getDelimiter(ULocaleData *uld, ULocaleDataDelimiterType type, UChar *result, int32_t resultLength, UErrorCode *status); /** @@ -220,7 +223,7 @@ typedef enum UMeasurementSystem { * @return UMeasurementSystem the measurement system used in the locale. * @stable ICU 2.8 */ -U_STABLE UMeasurementSystem U_EXPORT2 +U_CAPI UMeasurementSystem U_EXPORT2 ulocdata_getMeasurementSystem(const char *localeID, UErrorCode *status); /** @@ -239,7 +242,7 @@ ulocdata_getMeasurementSystem(const char *localeID, UErrorCode *status); * which must not indicate a failure before the function call. * @stable ICU 2.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ulocdata_getPaperSize(const char *localeID, int32_t *height, int32_t *width, UErrorCode *status); /** @@ -248,7 +251,7 @@ ulocdata_getPaperSize(const char *localeID, int32_t *height, int32_t *width, UEr * @param status error code - could be U_MISSING_RESOURCE_ERROR if the version was not found. * @stable ICU 4.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ulocdata_getCLDRVersion(UVersionInfo versionArray, UErrorCode *status); /** @@ -266,7 +269,7 @@ ulocdata_getCLDRVersion(UVersionInfo versionArray, UErrorCode *status); * * @stable ICU 4.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ulocdata_getLocaleDisplayPattern(ULocaleData *uld, UChar *pattern, int32_t patternCapacity, @@ -288,7 +291,7 @@ ulocdata_getLocaleDisplayPattern(ULocaleData *uld, * * @stable ICU 4.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ulocdata_getLocaleSeparator(ULocaleData *uld, UChar *separator, int32_t separatorCapacity, diff --git a/deps/icu-small/source/i18n/unicode/umsg.h b/deps/icu-small/source/i18n/unicode/umsg.h index 68188206129148..c087031c6d4e35 100644 --- a/deps/icu-small/source/i18n/unicode/umsg.h +++ b/deps/icu-small/source/i18n/unicode/umsg.h @@ -24,11 +24,14 @@ #if !UCONFIG_NO_FORMATTING -#include "unicode/localpointer.h" #include "unicode/uloc.h" #include "unicode/parseerr.h" #include +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + /** * \file * \brief C API: MessageFormat @@ -175,7 +178,7 @@ * @see u_parseMessage * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_formatMessage(const char *locale, const UChar *pattern, int32_t patternLength, @@ -202,7 +205,7 @@ u_formatMessage(const char *locale, * @see u_parseMessage * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_vformatMessage( const char *locale, const UChar *pattern, int32_t patternLength, @@ -227,7 +230,7 @@ u_vformatMessage( const char *locale, * @see u_formatMessage * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_parseMessage( const char *locale, const UChar *pattern, int32_t patternLength, @@ -252,7 +255,7 @@ u_parseMessage( const char *locale, * @see u_formatMessage * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_vparseMessage(const char *locale, const UChar *pattern, int32_t patternLength, @@ -281,7 +284,7 @@ u_vparseMessage(const char *locale, * @see u_parseMessage * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_formatMessageWithError( const char *locale, const UChar *pattern, int32_t patternLength, @@ -310,7 +313,7 @@ u_formatMessageWithError( const char *locale, * output was truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_vformatMessageWithError( const char *locale, const UChar *pattern, int32_t patternLength, @@ -338,7 +341,7 @@ u_vformatMessageWithError( const char *locale, * @see u_formatMessage * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_parseMessageWithError(const char *locale, const UChar *pattern, int32_t patternLength, @@ -366,7 +369,7 @@ u_parseMessageWithError(const char *locale, * @see u_formatMessage * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_vparseMessageWithError(const char *locale, const UChar *pattern, int32_t patternLength, @@ -396,7 +399,7 @@ typedef void* UMessageFormat; * messages, or 0 if an error occurred. * @stable ICU 2.0 */ -U_STABLE UMessageFormat* U_EXPORT2 +U_CAPI UMessageFormat* U_EXPORT2 umsg_open( const UChar *pattern, int32_t patternLength, const char *locale, @@ -409,7 +412,7 @@ umsg_open( const UChar *pattern, * @param format The formatter to close. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 umsg_close(UMessageFormat* format); #if U_SHOW_CPLUSPLUS_API @@ -439,7 +442,7 @@ U_NAMESPACE_END * @return A pointer to a UDateFormat identical to fmt. * @stable ICU 2.0 */ -U_STABLE UMessageFormat U_EXPORT2 +U_CAPI UMessageFormat U_EXPORT2 umsg_clone(const UMessageFormat *fmt, UErrorCode *status); @@ -450,7 +453,7 @@ umsg_clone(const UMessageFormat *fmt, * @param locale The locale the formatter should use. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 umsg_setLocale(UMessageFormat *fmt, const char* locale); @@ -461,7 +464,7 @@ umsg_setLocale(UMessageFormat *fmt, * @return the locale. * @stable ICU 2.0 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 umsg_getLocale(const UMessageFormat *fmt); /** @@ -476,7 +479,7 @@ umsg_getLocale(const UMessageFormat *fmt); * set to a failure result. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 umsg_applyPattern( UMessageFormat *fmt, const UChar* pattern, int32_t patternLength, @@ -494,7 +497,7 @@ umsg_applyPattern( UMessageFormat *fmt, * @return the pattern of the format * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 umsg_toPattern(const UMessageFormat *fmt, UChar* result, int32_t resultLength, @@ -515,7 +518,7 @@ umsg_toPattern(const UMessageFormat *fmt, * the output was truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 umsg_format( const UMessageFormat *fmt, UChar *result, int32_t resultLength, @@ -537,7 +540,7 @@ umsg_format( const UMessageFormat *fmt, * the output was truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 umsg_vformat( const UMessageFormat *fmt, UChar *result, int32_t resultLength, @@ -558,7 +561,7 @@ umsg_vformat( const UMessageFormat *fmt, * specified in pattern. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 umsg_parse( const UMessageFormat *fmt, const UChar *source, int32_t sourceLength, @@ -581,7 +584,7 @@ umsg_parse( const UMessageFormat *fmt, * @see u_formatMessage * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 umsg_vparse(const UMessageFormat *fmt, const UChar *source, int32_t sourceLength, @@ -613,7 +616,7 @@ umsg_vparse(const UMessageFormat *fmt, * not * @stable ICU 3.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 umsg_autoQuoteApostrophe(const UChar* pattern, int32_t patternLength, UChar* dest, diff --git a/deps/icu-small/source/i18n/unicode/unirepl.h b/deps/icu-small/source/i18n/unicode/unirepl.h index 61ee37f07054fb..891a1d527fd84a 100644 --- a/deps/icu-small/source/i18n/unicode/unirepl.h +++ b/deps/icu-small/source/i18n/unicode/unirepl.h @@ -77,7 +77,7 @@ class U_I18N_API UnicodeReplacer /* not : public UObject because this is an inte * replacer that is equal to this one. * @param result the string to receive the pattern. Previous * contents will be deleted. - * @param escapeUnprintable if TRUE then convert unprintable + * @param escapeUnprintable if true then convert unprintable * character to their hex escape representations, \\uxxxx or * \\Uxxxxxxxx. Unprintable characters are defined by * Utility.isUnprintable(). diff --git a/deps/icu-small/source/i18n/unicode/unum.h b/deps/icu-small/source/i18n/unicode/unum.h index b5f21ea5859071..ce1685f129060a 100644 --- a/deps/icu-small/source/i18n/unicode/unum.h +++ b/deps/icu-small/source/i18n/unicode/unum.h @@ -18,7 +18,6 @@ #if !UCONFIG_NO_FORMATTING -#include "unicode/localpointer.h" #include "unicode/uloc.h" #include "unicode/ucurr.h" #include "unicode/umisc.h" @@ -27,6 +26,10 @@ #include "unicode/udisplaycontext.h" #include "unicode/ufieldpositer.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + /** * \file * \brief C API: Compatibility APIs for number formatting. @@ -272,7 +275,7 @@ typedef enum UNumberFormatStyle { * *

        * For more detail on rounding modes, see: - * http://userguide.icu-project.org/formatparse/numbers/rounding-modes + * https://unicode-org.github.io/icu/userguide/format_parse/numbers/rounding-modes * * @stable ICU 2.0 */ @@ -392,6 +395,30 @@ typedef enum UNumberFormatFields { } UNumberFormatFields; +#ifndef U_HIDE_DRAFT_API +/** + * Selectors with special numeric values to use locale default minimum grouping + * digits for the DecimalFormat/UNumberFormat setMinimumGroupingDigits method. + * Do not use these constants with the [U]NumberFormatter API. + * + * @draft ICU 68 + */ +typedef enum UNumberFormatMinimumGroupingDigits { + /** + * Display grouping using the default strategy for all locales. + * @draft ICU 68 + */ + UNUM_MINIMUM_GROUPING_DIGITS_AUTO = -2, + /** + * Display grouping using locale defaults, except do not show grouping on + * values smaller than 10000 (such that there is a minimum of two digits + * before the first separator). + * @draft ICU 68 + */ + UNUM_MINIMUM_GROUPING_DIGITS_MIN2 = -3, +} UNumberFormatMinimumGroupingDigits; +#endif // U_HIDE_DRAFT_API + /** * Create and return a new UNumberFormat for formatting and parsing * numbers. A UNumberFormat may be used to format numbers by calling @@ -429,7 +456,7 @@ typedef enum UNumberFormatFields { * @see DecimalFormat * @stable ICU 2.0 */ -U_STABLE UNumberFormat* U_EXPORT2 +U_CAPI UNumberFormat* U_EXPORT2 unum_open( UNumberFormatStyle style, const UChar* pattern, int32_t patternLength, @@ -444,7 +471,7 @@ unum_open( UNumberFormatStyle style, * @param fmt The formatter to close. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 unum_close(UNumberFormat* fmt); #if U_SHOW_CPLUSPLUS_API @@ -474,7 +501,7 @@ U_NAMESPACE_END * @return A pointer to a UNumberFormat identical to fmt. * @stable ICU 2.0 */ -U_STABLE UNumberFormat* U_EXPORT2 +U_CAPI UNumberFormat* U_EXPORT2 unum_clone(const UNumberFormat *fmt, UErrorCode *status); @@ -502,7 +529,7 @@ unum_clone(const UNumberFormat *fmt, * @see UFieldPosition * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unum_format( const UNumberFormat* fmt, int32_t number, UChar* result, @@ -534,7 +561,7 @@ unum_format( const UNumberFormat* fmt, * @see UFieldPosition * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unum_formatInt64(const UNumberFormat *fmt, int64_t number, UChar* result, @@ -566,7 +593,7 @@ unum_formatInt64(const UNumberFormat *fmt, * @see UFieldPosition * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unum_formatDouble( const UNumberFormat* fmt, double number, UChar* result, @@ -616,7 +643,7 @@ unum_formatDouble( const UNumberFormat* fmt, * @see UNumberFormatFields * @stable ICU 59 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unum_formatDoubleForFields(const UNumberFormat* format, double number, UChar* result, @@ -653,7 +680,7 @@ unum_formatDoubleForFields(const UNumberFormat* format, * @see UFieldPosition * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unum_formatDecimal( const UNumberFormat* fmt, const char * number, int32_t length, @@ -686,7 +713,7 @@ unum_formatDecimal( const UNumberFormat* fmt, * @see UFieldPosition * @stable ICU 3.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unum_formatDoubleCurrency(const UNumberFormat* fmt, double number, UChar* currency, @@ -715,7 +742,7 @@ unum_formatDoubleCurrency(const UNumberFormat* fmt, * @see unum_parseToUFormattable * @stable ICU 52 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unum_formatUFormattable(const UNumberFormat* fmt, const UFormattable *number, UChar *result, @@ -742,7 +769,7 @@ unum_formatUFormattable(const UNumberFormat* fmt, * @see unum_formatDouble * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unum_parse( const UNumberFormat* fmt, const UChar* text, int32_t textLength, @@ -768,7 +795,7 @@ unum_parse( const UNumberFormat* fmt, * @see unum_formatDouble * @stable ICU 2.8 */ -U_STABLE int64_t U_EXPORT2 +U_CAPI int64_t U_EXPORT2 unum_parseInt64(const UNumberFormat* fmt, const UChar* text, int32_t textLength, @@ -794,7 +821,7 @@ unum_parseInt64(const UNumberFormat* fmt, * @see unum_formatDouble * @stable ICU 2.0 */ -U_STABLE double U_EXPORT2 +U_CAPI double U_EXPORT2 unum_parseDouble( const UNumberFormat* fmt, const UChar* text, int32_t textLength, @@ -829,7 +856,7 @@ unum_parseDouble( const UNumberFormat* fmt, * @see unum_formatDouble * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unum_parseDecimal(const UNumberFormat* fmt, const UChar* text, int32_t textLength, @@ -857,7 +884,7 @@ unum_parseDecimal(const UNumberFormat* fmt, * @see unum_formatDoubleCurrency * @stable ICU 3.0 */ -U_STABLE double U_EXPORT2 +U_CAPI double U_EXPORT2 unum_parseDoubleCurrency(const UNumberFormat* fmt, const UChar* text, int32_t textLength, @@ -885,7 +912,7 @@ unum_parseDoubleCurrency(const UNumberFormat* fmt, * @see ufmt_close * @stable ICU 52 */ -U_STABLE UFormattable* U_EXPORT2 +U_CAPI UFormattable* U_EXPORT2 unum_parseToUFormattable(const UNumberFormat* fmt, UFormattable *result, const UChar* text, @@ -898,7 +925,7 @@ unum_parseToUFormattable(const UNumberFormat* fmt, * on a DecimalFormat, other formats return U_UNSUPPORTED_ERROR * in the status. * @param format The formatter to set. - * @param localized TRUE if the pattern is localized, FALSE otherwise. + * @param localized true if the pattern is localized, false otherwise. * @param pattern The new pattern * @param patternLength The length of pattern, or -1 if null-terminated. * @param parseError A pointer to UParseError to receive information @@ -909,7 +936,7 @@ unum_parseToUFormattable(const UNumberFormat* fmt, * @see DecimalFormat * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 unum_applyPattern( UNumberFormat *format, UBool localized, const UChar *pattern, @@ -928,7 +955,7 @@ unum_applyPattern( UNumberFormat *format, * @see unum_countAvailable * @stable ICU 2.0 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 unum_getAvailable(int32_t localeIndex); /** @@ -940,7 +967,7 @@ unum_getAvailable(int32_t localeIndex); * @see unum_getAvailable * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unum_countAvailable(void); #if UCONFIG_HAVE_PARSEALLINPUT @@ -1121,7 +1148,7 @@ typedef enum UNumberFormatAttribute { * @see unum_setTextAttribute * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unum_getAttribute(const UNumberFormat* fmt, UNumberFormatAttribute attr); @@ -1144,7 +1171,7 @@ unum_getAttribute(const UNumberFormat* fmt, * @see unum_setTextAttribute * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 unum_setAttribute( UNumberFormat* fmt, UNumberFormatAttribute attr, int32_t newValue); @@ -1164,7 +1191,7 @@ unum_setAttribute( UNumberFormat* fmt, * @see unum_setTextAttribute * @stable ICU 2.0 */ -U_STABLE double U_EXPORT2 +U_CAPI double U_EXPORT2 unum_getDoubleAttribute(const UNumberFormat* fmt, UNumberFormatAttribute attr); @@ -1182,7 +1209,7 @@ unum_getDoubleAttribute(const UNumberFormat* fmt, * @see unum_setTextAttribute * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 unum_setDoubleAttribute( UNumberFormat* fmt, UNumberFormatAttribute attr, double newValue); @@ -1239,7 +1266,7 @@ typedef enum UNumberFormatTextAttribute { * @see unum_setAttribute * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unum_getTextAttribute( const UNumberFormat* fmt, UNumberFormatTextAttribute tag, UChar* result, @@ -1262,7 +1289,7 @@ unum_getTextAttribute( const UNumberFormat* fmt, * @see unum_setAttribute * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 unum_setTextAttribute( UNumberFormat* fmt, UNumberFormatTextAttribute tag, const UChar* newValue, @@ -1273,8 +1300,8 @@ unum_setTextAttribute( UNumberFormat* fmt, * Extract the pattern from a UNumberFormat. The pattern will follow * the DecimalFormat pattern syntax. * @param fmt The formatter to query. - * @param isPatternLocalized TRUE if the pattern should be localized, - * FALSE otherwise. This is ignored if the formatter is a rule-based + * @param isPatternLocalized true if the pattern should be localized, + * false otherwise. This is ignored if the formatter is a rule-based * formatter. * @param result A pointer to a buffer to receive the pattern. * @param resultLength The maximum size of result. @@ -1285,7 +1312,7 @@ unum_setTextAttribute( UNumberFormat* fmt, * @see DecimalFormat * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unum_toPattern( const UNumberFormat* fmt, UBool isPatternLocalized, UChar* result, @@ -1404,7 +1431,7 @@ typedef enum UNumberFormatSymbol { * @see unum_setSymbol * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unum_getSymbol(const UNumberFormat *fmt, UNumberFormatSymbol symbol, UChar *buffer, @@ -1424,7 +1451,7 @@ unum_getSymbol(const UNumberFormat *fmt, * @see unum_getSymbol * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 unum_setSymbol(UNumberFormat *fmt, UNumberFormatSymbol symbol, const UChar *value, @@ -1441,7 +1468,7 @@ unum_setSymbol(UNumberFormat *fmt, * @return the locale name * @stable ICU 2.8 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 unum_getLocaleByType(const UNumberFormat *fmt, ULocDataLocaleType type, UErrorCode* status); @@ -1454,7 +1481,7 @@ unum_getLocaleByType(const UNumberFormat *fmt, * @param status A pointer to an UErrorCode to receive any errors * @stable ICU 53 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 unum_setContext(UNumberFormat* fmt, UDisplayContext value, UErrorCode* status); /** @@ -1466,7 +1493,7 @@ unum_setContext(UNumberFormat* fmt, UDisplayContext value, UErrorCode* status); * @return The UDisplayContextValue for the specified type. * @stable ICU 53 */ -U_STABLE UDisplayContext U_EXPORT2 +U_CAPI UDisplayContext U_EXPORT2 unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode* status); #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/deps/icu-small/source/i18n/unicode/unumberformatter.h b/deps/icu-small/source/i18n/unicode/unumberformatter.h index af98ba0027238a..754987aea0923b 100644 --- a/deps/icu-small/source/i18n/unicode/unumberformatter.h +++ b/deps/icu-small/source/i18n/unicode/unumberformatter.h @@ -1,11 +1,12 @@ // © 2018 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html +#ifndef __UNUMBERFORMATTER_H__ +#define __UNUMBERFORMATTER_H__ + #include "unicode/utypes.h" #if !UCONFIG_NO_FORMATTING -#ifndef __UNUMBERFORMATTER_H__ -#define __UNUMBERFORMATTER_H__ #include "unicode/parseerr.h" #include "unicode/ufieldpositer.h" @@ -147,6 +148,30 @@ typedef enum UNumberUnitWidth { */ UNUM_UNIT_WIDTH_ISO_CODE, +#ifndef U_HIDE_DRAFT_API + /** + * Use the formal variant of the currency symbol; for example, "NT$" for the New Taiwan + * dollar in zh-TW. + * + *

        + * Behavior of this option with non-currency units is not defined at this time. + * + * @draft ICU 68 + */ + UNUM_UNIT_WIDTH_FORMAL, + + /** + * Use the alternate variant of the currency symbol; for example, "TL" for the Turkish + * lira (TRY). + * + *

        + * Behavior of this option with non-currency units is not defined at this time. + * + * @draft ICU 68 + */ + UNUM_UNIT_WIDTH_VARIANT, +#endif // U_HIDE_DRAFT_API + /** * Format the number according to the specified unit, but do not display the unit. For currencies, apply * monetary symbols and formats as with SHORT, but omit the currency symbol. For measure units, the behavior is @@ -432,7 +457,7 @@ typedef struct UFormattedNumber UFormattedNumber; * @param ec Set if an error occurs. * @stable ICU 62 */ -U_STABLE UNumberFormatter* U_EXPORT2 +U_CAPI UNumberFormatter* U_EXPORT2 unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale, UErrorCode* ec); @@ -449,7 +474,7 @@ unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const * @param ec Set if an error occurs. * @stable ICU 64 */ -U_STABLE UNumberFormatter* U_EXPORT2 +U_CAPI UNumberFormatter* U_EXPORT2 unumf_openForSkeletonAndLocaleWithError( const UChar* skeleton, int32_t skeletonLen, const char* locale, UParseError* perror, UErrorCode* ec); @@ -462,7 +487,7 @@ unumf_openForSkeletonAndLocaleWithError( * @param ec Set if an error occurs. * @stable ICU 62 */ -U_STABLE UFormattedNumber* U_EXPORT2 +U_CAPI UFormattedNumber* U_EXPORT2 unumf_openResult(UErrorCode* ec); @@ -481,7 +506,7 @@ unumf_openResult(UErrorCode* ec); * @param ec Set if an error occurs. * @stable ICU 62 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNumber* uresult, UErrorCode* ec); @@ -501,7 +526,7 @@ unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNum * @param ec Set if an error occurs. * @stable ICU 62 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedNumber* uresult, UErrorCode* ec); @@ -525,7 +550,7 @@ unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedN * @param ec Set if an error occurs. * @stable ICU 62 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32_t valueLen, UFormattedNumber* uresult, UErrorCode* ec); @@ -543,7 +568,7 @@ unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32 * @return A UFormattedValue owned by the input object. * @stable ICU 64 */ -U_STABLE const UFormattedValue* U_EXPORT2 +U_CAPI const UFormattedValue* U_EXPORT2 unumf_resultAsValue(const UFormattedNumber* uresult, UErrorCode* ec); @@ -566,7 +591,7 @@ unumf_resultAsValue(const UFormattedNumber* uresult, UErrorCode* ec); * @return The required length. * @stable ICU 62 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t bufferCapacity, UErrorCode* ec); @@ -600,11 +625,11 @@ unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t buf * "beginIndex" field is set to the beginning of the first occurrence of the field after the * input "endIndex", and "endIndex" is set to the end of that occurrence of the field * (exclusive index). If a field position is not found, the FieldPosition is not changed and - * the method returns FALSE. + * the method returns false. * @param ec Set if an error occurs. * @stable ICU 62 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* ufpos, UErrorCode* ec); @@ -629,16 +654,37 @@ unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* u * @param ec Set if an error occurs. * @stable ICU 62 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPositionIterator* ufpositer, UErrorCode* ec); -// TODO(ICU-20775): Propose this as API. -// NOTE: This is not currently implemented. -// U_DRAFT int32_t U_EXPORT2 -// unumf_resultToDecimalNumber(const UFormattedNumber* uresult, char* buffer, int32_t bufferCapacity, -// UErrorCode* ec); +#ifndef U_HIDE_DRAFT_API +/** + * Extracts the formatted number as a "numeric string" conforming to the + * syntax defined in the Decimal Arithmetic Specification, available at + * http://speleotrove.com/decimal + * + * This endpoint is useful for obtaining the exact number being printed + * after scaling and rounding have been applied by the number formatter. + * + * @param uresult The input object containing the formatted number. + * @param dest the 8-bit char buffer into which the decimal number is placed + * @param destCapacity The size, in chars, of the destination buffer. May be zero + * for precomputing the required size. + * @param ec receives any error status. + * If U_BUFFER_OVERFLOW_ERROR: Returns number of chars for + * preflighting. + * @return Number of chars in the data. Does not include a trailing NUL. + * @draft ICU 68 + */ +U_CAPI int32_t U_EXPORT2 +unumf_resultToDecimalNumber( + const UFormattedNumber* uresult, + char* dest, + int32_t destCapacity, + UErrorCode* ec); +#endif // U_HIDE_DRAFT_API /** @@ -647,7 +693,7 @@ unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPosition * @param uformatter An object created by unumf_openForSkeletonAndLocale(). * @stable ICU 62 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 unumf_close(UNumberFormatter* uformatter); @@ -657,7 +703,7 @@ unumf_close(UNumberFormatter* uformatter); * @param uresult An object created by unumf_openResult(). * @stable ICU 62 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 unumf_closeResult(UFormattedNumber* uresult); @@ -701,5 +747,5 @@ U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedNumberPointer, UFormattedNumber, unum U_NAMESPACE_END #endif // U_SHOW_CPLUSPLUS_API -#endif //__UNUMBERFORMATTER_H__ #endif /* #if !UCONFIG_NO_FORMATTING */ +#endif //__UNUMBERFORMATTER_H__ diff --git a/deps/icu-small/source/i18n/unicode/unumberrangeformatter.h b/deps/icu-small/source/i18n/unicode/unumberrangeformatter.h new file mode 100644 index 00000000000000..738bfb9f70acfd --- /dev/null +++ b/deps/icu-small/source/i18n/unicode/unumberrangeformatter.h @@ -0,0 +1,477 @@ +// © 2020 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#ifndef __UNUMBERRANGEFORMATTER_H__ +#define __UNUMBERRANGEFORMATTER_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/parseerr.h" +#include "unicode/ufieldpositer.h" +#include "unicode/umisc.h" +#include "unicode/uformattedvalue.h" +#include "unicode/uformattable.h" + + +/** + * \file + * \brief C-compatible API for localized number range formatting. + * + * This is the C-compatible version of the NumberRangeFormatter API. C++ users + * should include unicode/numberrangeformatter.h and use the proper C++ APIs. + * + * First create a UNumberRangeFormatter, which is immutable, and then format to + * a UFormattedNumberRange. + * + * Example code: + *

        + * // Setup:
        + * UErrorCode ec = U_ZERO_ERROR;
        + * UNumberRangeFormatter* uformatter = unumrf_openForSkeletonCollapseIdentityFallbackAndLocaleWithError(
        + *     u"currency/USD precision-integer",
        + *     -1,
        + *     UNUM_RANGE_COLLAPSE_AUTO,
        + *     UNUM_IDENTITY_FALLBACK_APPROXIMATELY,
        + *     "en-US",
        + *     NULL,
        + *     &ec);
        + * UFormattedNumberRange* uresult = unumrf_openResult(&ec);
        + * if (U_FAILURE(ec)) { return; }
        + *
        + * // Format a double range:
        + * unumrf_formatDoubleRange(uformatter, 3.0, 5.0, uresult, &ec);
        + * if (U_FAILURE(ec)) { return; }
        + *
        + * // Get the result string:
        + * int32_t len;
        + * const UChar* str = ufmtval_getString(unumrf_resultAsValue(uresult, &ec), &len, &ec);
        + * if (U_FAILURE(ec)) { return; }
        + * // str should equal "$3 – $5"
        + *
        + * // Cleanup:
        + * unumf_close(uformatter);
        + * unumf_closeResult(uresult);
        + * 
        + * + * If you are a C++ user linking against the C libraries, you can use the LocalPointer versions of these + * APIs. The following example uses LocalPointer with the decimal number and field position APIs: + * + *
        + * // Setup:
        + * LocalUNumberRangeFormatterPointer uformatter(
        + *     unumrf_openForSkeletonCollapseIdentityFallbackAndLocaleWithError(...));
        + * LocalUFormattedNumberRangePointer uresult(unumrf_openResult(&ec));
        + * if (U_FAILURE(ec)) { return; }
        + *
        + * // Format a double number range:
        + * unumrf_formatDoubleRange(uformatter.getAlias(), 3.0, 5.0, uresult.getAlias(), &ec);
        + * if (U_FAILURE(ec)) { return; }
        + *
        + * // No need to do any cleanup since we are using LocalPointer.
        + * 
        + * + * You can also get field positions. For more information, see uformattedvalue.h. + */ + +/** + * Defines how to merge fields that are identical across the range sign. + * + * @stable ICU 63 + */ +typedef enum UNumberRangeCollapse { + /** + * Use locale data and heuristics to determine how much of the string to collapse. Could end up collapsing none, + * some, or all repeated pieces in a locale-sensitive way. + * + * The heuristics used for this option are subject to change over time. + * + * @stable ICU 63 + */ + UNUM_RANGE_COLLAPSE_AUTO, + + /** + * Do not collapse any part of the number. Example: "3.2 thousand kilograms – 5.3 thousand kilograms" + * + * @stable ICU 63 + */ + UNUM_RANGE_COLLAPSE_NONE, + + /** + * Collapse the unit part of the number, but not the notation, if present. Example: "3.2 thousand – 5.3 thousand + * kilograms" + * + * @stable ICU 63 + */ + UNUM_RANGE_COLLAPSE_UNIT, + + /** + * Collapse any field that is equal across the range sign. May introduce ambiguity on the magnitude of the + * number. Example: "3.2 – 5.3 thousand kilograms" + * + * @stable ICU 63 + */ + UNUM_RANGE_COLLAPSE_ALL +} UNumberRangeCollapse; + +/** + * Defines the behavior when the two numbers in the range are identical after rounding. To programmatically detect + * when the identity fallback is used, compare the lower and upper BigDecimals via FormattedNumber. + * + * @stable ICU 63 + * @see NumberRangeFormatter + */ +typedef enum UNumberRangeIdentityFallback { + /** + * Show the number as a single value rather than a range. Example: "$5" + * + * @stable ICU 63 + */ + UNUM_IDENTITY_FALLBACK_SINGLE_VALUE, + + /** + * Show the number using a locale-sensitive approximation pattern. If the numbers were the same before rounding, + * show the single value. Example: "~$5" or "$5" + * + * @stable ICU 63 + */ + UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE, + + /** + * Show the number using a locale-sensitive approximation pattern. Use the range pattern always, even if the + * inputs are the same. Example: "~$5" + * + * @stable ICU 63 + */ + UNUM_IDENTITY_FALLBACK_APPROXIMATELY, + + /** + * Show the number as the range of two equal values. Use the range pattern always, even if the inputs are the + * same. Example (with RangeCollapse.NONE): "$5 – $5" + * + * @stable ICU 63 + */ + UNUM_IDENTITY_FALLBACK_RANGE +} UNumberRangeIdentityFallback; + +/** + * Used in the result class FormattedNumberRange to indicate to the user whether the numbers formatted in the range + * were equal or not, and whether or not the identity fallback was applied. + * + * @stable ICU 63 + * @see NumberRangeFormatter + */ +typedef enum UNumberRangeIdentityResult { + /** + * Used to indicate that the two numbers in the range were equal, even before any rounding rules were applied. + * + * @stable ICU 63 + * @see NumberRangeFormatter + */ + UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING, + + /** + * Used to indicate that the two numbers in the range were equal, but only after rounding rules were applied. + * + * @stable ICU 63 + * @see NumberRangeFormatter + */ + UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING, + + /** + * Used to indicate that the two numbers in the range were not equal, even after rounding rules were applied. + * + * @stable ICU 63 + * @see NumberRangeFormatter + */ + UNUM_IDENTITY_RESULT_NOT_EQUAL, + +#ifndef U_HIDE_INTERNAL_API + /** + * The number of entries in this enum. + * @internal + */ + UNUM_IDENTITY_RESULT_COUNT +#endif + +} UNumberRangeIdentityResult; + + +#ifndef U_HIDE_DRAFT_API + +struct UNumberRangeFormatter; +/** + * C-compatible version of icu::number::LocalizedNumberRangeFormatter. + * + * NOTE: This is a C-compatible API; C++ users should build against numberrangeformatter.h instead. + * + * @draft ICU 68 + */ +typedef struct UNumberRangeFormatter UNumberRangeFormatter; + + +struct UFormattedNumberRange; +/** + * C-compatible version of icu::number::FormattedNumberRange. + * + * NOTE: This is a C-compatible API; C++ users should build against numberrangeformatter.h instead. + * + * @draft ICU 68 + */ +typedef struct UFormattedNumberRange UFormattedNumberRange; + + +/** + * Creates a new UNumberFormatter for the given skeleton string, collapse option, identity fallback + * option, and locale. This is currently the only method for creating a new UNumberRangeFormatter. + * + * Objects of type UNumberRangeFormatter returned by this method are threadsafe. + * + * For more details on skeleton strings, see the documentation in numberrangeformatter.h. For more + * details on the usage of this API, see the documentation at the top of unumberrangeformatter.h. + * + * NOTE: This is a C-compatible API; C++ users should build against numberrangeformatter.h instead. + * + * @param skeleton The skeleton string, like u"percent precision-integer" + * @param skeletonLen The number of UChars in the skeleton string, or -1 if it is NUL-terminated. + * @param collapse Option for how to merge affixes (if unsure, use UNUM_RANGE_COLLAPSE_AUTO) + * @param identityFallback Option for resolving when both sides of the range are equal. + * @param locale The NUL-terminated locale ID. + * @param perror A parse error struct populated if an error occurs when parsing. Can be NULL. + * If no error occurs, perror->offset will be set to -1. + * @param ec Set if an error occurs. + * @draft ICU 68 + */ +U_CAPI UNumberRangeFormatter* U_EXPORT2 +unumrf_openForSkeletonWithCollapseAndIdentityFallback( + const UChar* skeleton, + int32_t skeletonLen, + UNumberRangeCollapse collapse, + UNumberRangeIdentityFallback identityFallback, + const char* locale, + UParseError* perror, + UErrorCode* ec); + + +/** + * Creates an object to hold the result of a UNumberRangeFormatter + * operation. The object can be used repeatedly; it is cleared whenever + * passed to a format function. + * + * @param ec Set if an error occurs. + * @draft ICU 68 + */ +U_CAPI UFormattedNumberRange* U_EXPORT2 +unumrf_openResult(UErrorCode* ec); + + +/** + * Uses a UNumberRangeFormatter to format a range of doubles. + * + * The UNumberRangeFormatter can be shared between threads. Each thread should have its own local + * UFormattedNumberRange, however, for storing the result of the formatting operation. + * + * NOTE: This is a C-compatible API; C++ users should build against numberrangeformatter.h instead. + * + * @param uformatter A formatter object; see unumberrangeformatter.h. + * @param first The first (usually smaller) number in the range. + * @param second The second (usually larger) number in the range. + * @param uresult The object that will be mutated to store the result; see unumrf_openResult. + * @param ec Set if an error occurs. + * @draft ICU 68 + */ +U_CAPI void U_EXPORT2 +unumrf_formatDoubleRange( + const UNumberRangeFormatter* uformatter, + double first, + double second, + UFormattedNumberRange* uresult, + UErrorCode* ec); + + +/** + * Uses a UNumberRangeFormatter to format a range of decimal numbers. + * + * With a decimal number string, you can specify an input with arbitrary precision. + * + * The UNumberRangeFormatter can be shared between threads. Each thread should have its own local + * UFormattedNumberRange, however, for storing the result of the formatting operation. + * + * NOTE: This is a C-compatible API; C++ users should build against numberrangeformatter.h instead. + * + * @param uformatter A formatter object; see unumberrangeformatter.h. + * @param first The first (usually smaller) number in the range. + * @param firstLen The length of the first decimal number string. + * @param second The second (usually larger) number in the range. + * @param secondLen The length of the second decimal number string. + * @param uresult The object that will be mutated to store the result; see unumrf_openResult. + * @param ec Set if an error occurs. + * @draft ICU 68 + */ +U_CAPI void U_EXPORT2 +unumrf_formatDecimalRange( + const UNumberRangeFormatter* uformatter, + const char* first, + int32_t firstLen, + const char* second, + int32_t secondLen, + UFormattedNumberRange* uresult, + UErrorCode* ec); + + +/** + * Returns a representation of a UFormattedNumberRange as a UFormattedValue, + * which can be subsequently passed to any API requiring that type. + * + * The returned object is owned by the UFormattedNumberRange and is valid + * only as long as the UFormattedNumber is present and unchanged in memory. + * + * You can think of this method as a cast between types. + * + * @param uresult The object containing the formatted number range. + * @param ec Set if an error occurs. + * @return A UFormattedValue owned by the input object. + * @draft ICU 68 + */ +U_CAPI const UFormattedValue* U_EXPORT2 +unumrf_resultAsValue(const UFormattedNumberRange* uresult, UErrorCode* ec); + + +/** + * Extracts the identity result from a UFormattedNumberRange. + * + * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead. + * + * @param uresult The object containing the formatted number range. + * @param ec Set if an error occurs. + * @return The identity result; see UNumberRangeIdentityResult. + * @draft ICU 68 + */ +U_CAPI UNumberRangeIdentityResult U_EXPORT2 +unumrf_resultGetIdentityResult( + const UFormattedNumberRange* uresult, + UErrorCode* ec); + + +#ifndef U_HIDE_DRAFT_API +/** + * Extracts the first formatted number as a decimal number. This endpoint + * is useful for obtaining the exact number being printed after scaling + * and rounding have been applied by the number range formatting pipeline. + * + * The syntax of the unformatted number is a "numeric string" + * as defined in the Decimal Arithmetic Specification, available at + * http://speleotrove.com/decimal + * + * @param uresult The input object containing the formatted number range. + * @param dest the 8-bit char buffer into which the decimal number is placed + * @param destCapacity The size, in chars, of the destination buffer. May be zero + * for precomputing the required size. + * @param ec receives any error status. + * If U_BUFFER_OVERFLOW_ERROR: Returns number of chars for + * preflighting. + * @return Number of chars in the data. Does not include a trailing NUL. + * @draft ICU 68 + */ +U_CAPI int32_t U_EXPORT2 +unumrf_resultGetFirstDecimalNumber( + const UFormattedNumberRange* uresult, + char* dest, + int32_t destCapacity, + UErrorCode* ec); + + +/** + * Extracts the second formatted number as a decimal number. This endpoint + * is useful for obtaining the exact number being printed after scaling + * and rounding have been applied by the number range formatting pipeline. + * + * The syntax of the unformatted number is a "numeric string" + * as defined in the Decimal Arithmetic Specification, available at + * http://speleotrove.com/decimal + * + * @param uresult The input object containing the formatted number range. + * @param dest the 8-bit char buffer into which the decimal number is placed + * @param destCapacity The size, in chars, of the destination buffer. May be zero + * for precomputing the required size. + * @param ec receives any error status. + * If U_BUFFER_OVERFLOW_ERROR: Returns number of chars for + * preflighting. + * @return Number of chars in the data. Does not include a trailing NUL. + * @draft ICU 68 + */ +U_CAPI int32_t U_EXPORT2 +unumrf_resultGetSecondDecimalNumber( + const UFormattedNumberRange* uresult, + char* dest, + int32_t destCapacity, + UErrorCode* ec); +#endif // U_HIDE_DRAFT_API + + +/** + * Releases the UNumberFormatter created by unumf_openForSkeletonAndLocale(). + * + * @param uformatter An object created by unumf_openForSkeletonAndLocale(). + * @draft ICU 68 + */ +U_CAPI void U_EXPORT2 +unumrf_close(UNumberRangeFormatter* uformatter); + + +/** + * Releases the UFormattedNumber created by unumf_openResult(). + * + * @param uresult An object created by unumf_openResult(). + * @draft ICU 68 + */ +U_CAPI void U_EXPORT2 +unumrf_closeResult(UFormattedNumberRange* uresult); + + +#if U_SHOW_CPLUSPLUS_API +U_NAMESPACE_BEGIN + +/** + * \class LocalUNumberRangeFormatterPointer + * "Smart pointer" class; closes a UNumberFormatter via unumf_close(). + * For most methods see the LocalPointerBase base class. + * + * Usage: + *
        + * LocalUNumberRangeFormatterPointer uformatter(
        + *     unumrf_openForSkeletonCollapseIdentityFallbackAndLocaleWithError(...));
        + * // no need to explicitly call unumrf_close()
        + * 
        + * + * @see LocalPointerBase + * @see LocalPointer + * @draft ICU 68 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberRangeFormatterPointer, UNumberRangeFormatter, unumrf_close); + +/** + * \class LocalUFormattedNumberPointer + * "Smart pointer" class; closes a UFormattedNumber via unumf_closeResult(). + * For most methods see the LocalPointerBase base class. + * + * Usage: + *
        + * LocalUFormattedNumberRangePointer uresult(unumrf_openResult(...));
        + * // no need to explicitly call unumrf_closeResult()
        + * 
        + * + * @see LocalPointerBase + * @see LocalPointer + * @draft ICU 68 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedNumberRangePointer, UFormattedNumberRange, unumrf_closeResult); + +U_NAMESPACE_END +#endif // U_SHOW_CPLUSPLUS_API + +#endif // U_HIDE_DRAFT_API + +#endif /* #if !UCONFIG_NO_FORMATTING */ +#endif //__UNUMBERRANGEFORMATTER_H__ diff --git a/deps/icu-small/source/i18n/unicode/unumsys.h b/deps/icu-small/source/i18n/unicode/unumsys.h index 84ceddf84f73f9..c767cf3d79a09c 100644 --- a/deps/icu-small/source/i18n/unicode/unumsys.h +++ b/deps/icu-small/source/i18n/unicode/unumsys.h @@ -15,7 +15,10 @@ #if !UCONFIG_NO_FORMATTING #include "unicode/uenum.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** * \file @@ -54,7 +57,7 @@ typedef struct UNumberingSystem UNumberingSystem; /**< C typedef for struct UNu * occurred. * @stable ICU 52 */ -U_STABLE UNumberingSystem * U_EXPORT2 +U_CAPI UNumberingSystem * U_EXPORT2 unumsys_open(const char *locale, UErrorCode *status); /** @@ -75,7 +78,7 @@ unumsys_open(const char *locale, UErrorCode *status); * occurred. * @stable ICU 52 */ -U_STABLE UNumberingSystem * U_EXPORT2 +U_CAPI UNumberingSystem * U_EXPORT2 unumsys_openByName(const char *name, UErrorCode *status); /** @@ -83,7 +86,7 @@ unumsys_openByName(const char *name, UErrorCode *status); * @param unumsys The UNumberingSystem object to close. * @stable ICU 52 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 unumsys_close(UNumberingSystem *unumsys); #if U_SHOW_CPLUSPLUS_API @@ -111,7 +114,7 @@ U_NAMESPACE_END * or NULL if an error occurred. * @stable ICU 52 */ -U_STABLE UEnumeration * U_EXPORT2 +U_CAPI UEnumeration * U_EXPORT2 unumsys_openAvailableNames(UErrorCode *status); /** @@ -123,18 +126,18 @@ unumsys_openAvailableNames(UErrorCode *status); * is only valid for the lifetime of the UNumberingSystem object. * @stable ICU 52 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 unumsys_getName(const UNumberingSystem *unumsys); /** * Returns whether the given UNumberingSystem object is for an algorithmic (not purely * positional) system. * @param unumsys The UNumberingSystem whose algorithmic status is desired. - * @return TRUE if the specified UNumberingSystem object is for an algorithmic + * @return true if the specified UNumberingSystem object is for an algorithmic * system. * @stable ICU 52 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 unumsys_isAlgorithmic(const UNumberingSystem *unumsys); /** @@ -145,7 +148,7 @@ unumsys_isAlgorithmic(const UNumberingSystem *unumsys); * @return The radix of the specified UNumberingSystem object. * @stable ICU 52 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unumsys_getRadix(const UNumberingSystem *unumsys); /** @@ -164,7 +167,7 @@ unumsys_getRadix(const UNumberingSystem *unumsys); * output was truncated. * @stable ICU 52 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unumsys_getDescription(const UNumberingSystem *unumsys, UChar *result, int32_t resultLength, UErrorCode *status); diff --git a/deps/icu-small/source/i18n/unicode/upluralrules.h b/deps/icu-small/source/i18n/unicode/upluralrules.h index 9c09dfab8bb9f6..71a45ddf85b5cd 100644 --- a/deps/icu-small/source/i18n/unicode/upluralrules.h +++ b/deps/icu-small/source/i18n/unicode/upluralrules.h @@ -14,14 +14,19 @@ #if !UCONFIG_NO_FORMATTING -#include "unicode/localpointer.h" #include "unicode/uenum.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + #ifndef U_HIDE_INTERNAL_API #include "unicode/unum.h" #endif /* U_HIDE_INTERNAL_API */ // Forward-declaration struct UFormattedNumber; +struct UFormattedNumberRange; /** * \file @@ -163,7 +168,7 @@ uplrules_select(const UPluralRules *uplrules, * @param uplrules The UPluralRules object specifying the rules. * @param number The formatted number for which the rule has to be determined. * @param keyword The destination buffer for the keyword of the rule that - * applies to number. + * applies to the number. * @param capacity The capacity of the keyword buffer. * @param status A pointer to a UErrorCode to receive any errors. * @return The length of the keyword. @@ -175,6 +180,29 @@ uplrules_selectFormatted(const UPluralRules *uplrules, UChar *keyword, int32_t capacity, UErrorCode *status); +#ifndef U_HIDE_DRAFT_API +/** + * Given a formatted number range, returns the overall plural form of the + * range. For example, "3-5" returns "other" in English. + * + * To get a UFormattedNumberRange, see UNumberRangeFormatter. + * + * @param uplrules The UPluralRules object specifying the rules. + * @param urange The number range onto which the rules will be applied. + * @param keyword The destination buffer for the keyword of the rule that + * applies to the number range. + * @param capacity The capacity of the keyword buffer. + * @param status A pointer to a UErrorCode to receive any errors. + * @return The length of the keyword. + * @draft ICU 68 + */ +U_CAPI int32_t U_EXPORT2 +uplrules_selectForRange(const UPluralRules *uplrules, + const struct UFormattedNumberRange* urange, + UChar *keyword, int32_t capacity, + UErrorCode *status); +#endif // U_HIDE_DRAFT_API + #ifndef U_HIDE_INTERNAL_API /** * Given a number, returns the keyword of the first rule that applies to the @@ -194,7 +222,7 @@ uplrules_selectFormatted(const UPluralRules *uplrules, * @return The length of keyword. * @internal ICU 59 technology preview, may be removed in the future */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uplrules_selectWithFormat(const UPluralRules *uplrules, double number, const UNumberFormat *fmt, @@ -213,7 +241,7 @@ uplrules_selectWithFormat(const UPluralRules *uplrules, * upon error. The caller is responsible for closing the result. * @stable ICU 59 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 uplrules_getKeywords(const UPluralRules *uplrules, UErrorCode *status); diff --git a/deps/icu-small/source/i18n/unicode/uregex.h b/deps/icu-small/source/i18n/unicode/uregex.h index cb5e51ef01e856..70956882471ab4 100644 --- a/deps/icu-small/source/i18n/unicode/uregex.h +++ b/deps/icu-small/source/i18n/unicode/uregex.h @@ -30,9 +30,12 @@ #if !UCONFIG_NO_REGULAR_EXPRESSIONS -#include "unicode/localpointer.h" #include "unicode/parseerr.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + struct URegularExpression; /** * Structure representing a compiled regular expression, plus the results @@ -131,7 +134,7 @@ typedef enum URegexpFlag{ * @stable ICU 3.0 * */ -U_STABLE URegularExpression * U_EXPORT2 +U_CAPI URegularExpression * U_EXPORT2 uregex_open( const UChar *pattern, int32_t patternLength, uint32_t flags, @@ -161,7 +164,7 @@ uregex_open( const UChar *pattern, * * @stable ICU 4.6 */ -U_STABLE URegularExpression * U_EXPORT2 +U_CAPI URegularExpression * U_EXPORT2 uregex_openUText(UText *pattern, uint32_t flags, UParseError *pe, @@ -191,7 +194,7 @@ uregex_openUText(UText *pattern, * * @stable ICU 3.0 */ -U_STABLE URegularExpression * U_EXPORT2 +U_CAPI URegularExpression * U_EXPORT2 uregex_openC( const char *pattern, uint32_t flags, UParseError *pe, @@ -207,7 +210,7 @@ uregex_openC( const char *pattern, * @param regexp The regular expression to be closed. * @stable ICU 3.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_close(URegularExpression *regexp); #if U_SHOW_CPLUSPLUS_API @@ -247,7 +250,7 @@ U_NAMESPACE_END * @return the cloned copy of the compiled regular expression. * @stable ICU 3.0 */ -U_STABLE URegularExpression * U_EXPORT2 +U_CAPI URegularExpression * U_EXPORT2 uregex_clone(const URegularExpression *regexp, UErrorCode *status); /** @@ -267,7 +270,7 @@ uregex_clone(const URegularExpression *regexp, UErrorCode *status); * will remain valid until the regular expression is closed. * @stable ICU 3.0 */ -U_STABLE const UChar * U_EXPORT2 +U_CAPI const UChar * U_EXPORT2 uregex_pattern(const URegularExpression *regexp, int32_t *patLength, UErrorCode *status); @@ -283,7 +286,7 @@ uregex_pattern(const URegularExpression *regexp, * * @stable ICU 4.6 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 uregex_patternUText(const URegularExpression *regexp, UErrorCode *status); @@ -295,7 +298,7 @@ uregex_patternUText(const URegularExpression *regexp, * @see URegexpFlag * @stable ICU 3.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_flags(const URegularExpression *regexp, UErrorCode *status); @@ -320,7 +323,7 @@ uregex_flags(const URegularExpression *regexp, * @param status Receives errors detected by this function. * @stable ICU 3.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_setText(URegularExpression *regexp, const UChar *text, int32_t textLength, @@ -343,7 +346,7 @@ uregex_setText(URegularExpression *regexp, * * @stable ICU 4.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_setUText(URegularExpression *regexp, UText *text, UErrorCode *status); @@ -368,7 +371,7 @@ uregex_setUText(URegularExpression *regexp, * this regular expression. * @stable ICU 3.0 */ -U_STABLE const UChar * U_EXPORT2 +U_CAPI const UChar * U_EXPORT2 uregex_getText(URegularExpression *regexp, int32_t *textLength, UErrorCode *status); @@ -389,7 +392,7 @@ uregex_getText(URegularExpression *regexp, * * @stable ICU 4.6 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 uregex_getUText(URegularExpression *regexp, UText *dest, UErrorCode *status); @@ -419,7 +422,7 @@ uregex_getUText(URegularExpression *regexp, * * @stable ICU 4.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_refreshUText(URegularExpression *regexp, UText *text, UErrorCode *status); @@ -441,10 +444,10 @@ uregex_refreshUText(URegularExpression *regexp, * @param startIndex The input string (native) index at which to begin matching, or -1 * to match the input Region. * @param status Receives errors detected by this function. - * @return TRUE if there is a match + * @return true if there is a match * @stable ICU 3.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uregex_matches(URegularExpression *regexp, int32_t startIndex, UErrorCode *status); @@ -467,10 +470,10 @@ uregex_matches(URegularExpression *regexp, * @param startIndex The input string (native) index at which to begin matching, or -1 * to match the input Region. * @param status Receives errors detected by this function. - * @return TRUE if there is a match + * @return true if there is a match * @stable ICU 4.6 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uregex_matches64(URegularExpression *regexp, int64_t startIndex, UErrorCode *status); @@ -495,10 +498,10 @@ uregex_matches64(URegularExpression *regexp, * @param startIndex The input string (native) index at which to begin matching, or * -1 to match the Input Region * @param status A reference to a UErrorCode to receive any errors. - * @return TRUE if there is a match. + * @return true if there is a match. * @stable ICU 3.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uregex_lookingAt(URegularExpression *regexp, int32_t startIndex, UErrorCode *status); @@ -524,10 +527,10 @@ uregex_lookingAt(URegularExpression *regexp, * @param startIndex The input string (native) index at which to begin matching, or * -1 to match the Input Region * @param status A reference to a UErrorCode to receive any errors. - * @return TRUE if there is a match. + * @return true if there is a match. * @stable ICU 4.6 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uregex_lookingAt64(URegularExpression *regexp, int64_t startIndex, UErrorCode *status); @@ -548,10 +551,10 @@ uregex_lookingAt64(URegularExpression *regexp, * @param startIndex The position (native) in the input string to begin the search, or * -1 to search within the Input Region. * @param status A reference to a UErrorCode to receive any errors. - * @return TRUE if a match is found. + * @return true if a match is found. * @stable ICU 3.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uregex_find(URegularExpression *regexp, int32_t startIndex, UErrorCode *status); @@ -573,10 +576,10 @@ uregex_find(URegularExpression *regexp, * @param startIndex The position (native) in the input string to begin the search, or * -1 to search within the Input Region. * @param status A reference to a UErrorCode to receive any errors. - * @return TRUE if a match is found. + * @return true if a match is found. * @stable ICU 4.6 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uregex_find64(URegularExpression *regexp, int64_t startIndex, UErrorCode *status); @@ -590,11 +593,11 @@ uregex_find64(URegularExpression *regexp, * * @param regexp The compiled regular expression. * @param status A reference to a UErrorCode to receive any errors. - * @return TRUE if a match is found. + * @return true if a match is found. * @see uregex_reset * @stable ICU 3.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uregex_findNext(URegularExpression *regexp, UErrorCode *status); @@ -605,7 +608,7 @@ uregex_findNext(URegularExpression *regexp, * @return the number of capture groups * @stable ICU 3.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_groupCount(URegularExpression *regexp, UErrorCode *status); @@ -625,7 +628,7 @@ uregex_groupCount(URegularExpression *regexp, * * @stable ICU 55 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_groupNumberFromName(URegularExpression *regexp, const UChar *groupName, int32_t nameLength, @@ -649,7 +652,7 @@ uregex_groupNumberFromName(URegularExpression *regexp, * * @stable ICU 55 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_groupNumberFromCName(URegularExpression *regexp, const char *groupName, int32_t nameLength, @@ -671,7 +674,7 @@ uregex_groupNumberFromCName(URegularExpression *regexp, * or -1 if no applicable match. * @stable ICU 3.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_group(URegularExpression *regexp, int32_t groupNum, UChar *dest, @@ -700,7 +703,7 @@ uregex_group(URegularExpression *regexp, * * @stable ICU 4.6 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 uregex_groupUText(URegularExpression *regexp, int32_t groupNum, UText *dest, @@ -721,7 +724,7 @@ uregex_groupUText(URegularExpression *regexp, * by the specified group. * @stable ICU 3.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_start(URegularExpression *regexp, int32_t groupNum, UErrorCode *status); @@ -741,7 +744,7 @@ uregex_start(URegularExpression *regexp, * by the specified group. * @stable ICU 4.6 */ -U_STABLE int64_t U_EXPORT2 +U_CAPI int64_t U_EXPORT2 uregex_start64(URegularExpression *regexp, int32_t groupNum, UErrorCode *status); @@ -759,7 +762,7 @@ uregex_start64(URegularExpression *regexp, * @return the (native) index of the position following the last matched character. * @stable ICU 3.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_end(URegularExpression *regexp, int32_t groupNum, UErrorCode *status); @@ -778,7 +781,7 @@ uregex_end(URegularExpression *regexp, * @return the (native) index of the position following the last matched character. * @stable ICU 4.6 */ -U_STABLE int64_t U_EXPORT2 +U_CAPI int64_t U_EXPORT2 uregex_end64(URegularExpression *regexp, int32_t groupNum, UErrorCode *status); @@ -796,7 +799,7 @@ uregex_end64(URegularExpression *regexp, * @param status A reference to a UErrorCode to receive any errors. * @stable ICU 3.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_reset(URegularExpression *regexp, int32_t index, UErrorCode *status); @@ -815,7 +818,7 @@ uregex_reset(URegularExpression *regexp, * @param status A reference to a UErrorCode to receive any errors. * @stable ICU 4.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_reset64(URegularExpression *regexp, int64_t index, UErrorCode *status); @@ -840,7 +843,7 @@ uregex_reset64(URegularExpression *regexp, * @param status A pointer to a UErrorCode to receive any errors. * @stable ICU 4.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_setRegion(URegularExpression *regexp, int32_t regionStart, int32_t regionLimit, @@ -867,7 +870,7 @@ uregex_setRegion(URegularExpression *regexp, * @param status A pointer to a UErrorCode to receive any errors. * @stable ICU 4.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_setRegion64(URegularExpression *regexp, int64_t regionStart, int64_t regionLimit, @@ -887,7 +890,7 @@ uregex_setRegion64(URegularExpression *regexp, * @param status A pointer to a UErrorCode to receive any errors. * @stable ICU 4.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_setRegionAndStart(URegularExpression *regexp, int64_t regionStart, int64_t regionLimit, @@ -903,7 +906,7 @@ uregex_setRegionAndStart(URegularExpression *regexp, * @return The starting (native) index of this matcher's region. * @stable ICU 4.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_regionStart(const URegularExpression *regexp, UErrorCode *status); @@ -917,7 +920,7 @@ uregex_regionStart(const URegularExpression *regexp, * @return The starting (native) index of this matcher's region. * @stable ICU 4.6 */ -U_STABLE int64_t U_EXPORT2 +U_CAPI int64_t U_EXPORT2 uregex_regionStart64(const URegularExpression *regexp, UErrorCode *status); @@ -931,7 +934,7 @@ uregex_regionStart64(const URegularExpression *regexp, * @return The ending point (native) of this matcher's region. * @stable ICU 4.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_regionEnd(const URegularExpression *regexp, UErrorCode *status); @@ -946,7 +949,7 @@ uregex_regionEnd(const URegularExpression *regexp, * @return The ending point (native) of this matcher's region. * @stable ICU 4.6 */ -U_STABLE int64_t U_EXPORT2 +U_CAPI int64_t U_EXPORT2 uregex_regionEnd64(const URegularExpression *regexp, UErrorCode *status); @@ -957,18 +960,18 @@ uregex_regionEnd64(const URegularExpression *regexp, * * @param regexp The compiled regular expression. * @param status A pointer to a UErrorCode to receive any errors. - * @return TRUE if this matcher is using opaque bounds, false if it is not. + * @return true if this matcher is using opaque bounds, false if it is not. * @stable ICU 4.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uregex_hasTransparentBounds(const URegularExpression *regexp, UErrorCode *status); /** * Sets the transparency of region bounds for this URegularExpression. - * Invoking this function with an argument of TRUE will set matches to use transparent bounds. - * If the boolean argument is FALSE, then opaque bounds will be used. + * Invoking this function with an argument of true will set matches to use transparent bounds. + * If the boolean argument is false, then opaque bounds will be used. * * Using transparent bounds, the boundaries of the matching region are transparent * to lookahead, lookbehind, and boundary matching constructs. Those constructs can @@ -980,11 +983,11 @@ uregex_hasTransparentBounds(const URegularExpression *regexp, * By default, opaque bounds are used. * * @param regexp The compiled regular expression. - * @param b TRUE for transparent bounds; FALSE for opaque bounds + * @param b true for transparent bounds; false for opaque bounds * @param status A pointer to a UErrorCode to receive any errors. * @stable ICU 4.0 **/ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_useTransparentBounds(URegularExpression *regexp, UBool b, UErrorCode *status); @@ -996,10 +999,10 @@ uregex_useTransparentBounds(URegularExpression *regexp, * * @param regexp The compiled regular expression. * @param status A pointer to a UErrorCode to receive any errors. - * @return TRUE if this matcher is using anchoring bounds. + * @return true if this matcher is using anchoring bounds. * @stable ICU 4.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uregex_hasAnchoringBounds(const URegularExpression *regexp, UErrorCode *status); @@ -1013,41 +1016,41 @@ uregex_hasAnchoringBounds(const URegularExpression *regexp, * Anchoring Bounds are the default for regions. * * @param regexp The compiled regular expression. - * @param b TRUE if to enable anchoring bounds; FALSE to disable them. + * @param b true if to enable anchoring bounds; false to disable them. * @param status A pointer to a UErrorCode to receive any errors. * @stable ICU 4.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_useAnchoringBounds(URegularExpression *regexp, UBool b, UErrorCode *status); /** - * Return TRUE if the most recent matching operation touched the + * Return true if the most recent matching operation touched the * end of the text being processed. In this case, additional input text could * change the results of that match. * * @param regexp The compiled regular expression. * @param status A pointer to a UErrorCode to receive any errors. - * @return TRUE if the most recent match hit the end of input + * @return true if the most recent match hit the end of input * @stable ICU 4.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uregex_hitEnd(const URegularExpression *regexp, UErrorCode *status); /** - * Return TRUE the most recent match succeeded and additional input could cause + * Return true the most recent match succeeded and additional input could cause * it to fail. If this function returns false and a match was found, then more input * might change the match but the match won't be lost. If a match was not found, * then requireEnd has no meaning. * * @param regexp The compiled regular expression. * @param status A pointer to a UErrorCode to receive any errors. - * @return TRUE if more input could cause the most recent match to no longer match. + * @return true if more input could cause the most recent match to no longer match. * @stable ICU 4.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uregex_requireEnd(const URegularExpression *regexp, UErrorCode *status); @@ -1079,7 +1082,7 @@ uregex_requireEnd(const URegularExpression *regexp, * is still the full length of the untruncated string. * @stable ICU 3.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_replaceAll(URegularExpression *regexp, const UChar *replacementText, int32_t replacementLength, @@ -1108,7 +1111,7 @@ uregex_replaceAll(URegularExpression *regexp, * * @stable ICU 4.6 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 uregex_replaceAllUText(URegularExpression *regexp, UText *replacement, UText *dest, @@ -1138,7 +1141,7 @@ uregex_replaceAllUText(URegularExpression *regexp, * is still the full length of the untruncated string. * @stable ICU 3.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_replaceFirst(URegularExpression *regexp, const UChar *replacementText, int32_t replacementLength, @@ -1167,7 +1170,7 @@ uregex_replaceFirst(URegularExpression *regexp, * * @stable ICU 4.6 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 uregex_replaceFirstUText(URegularExpression *regexp, UText *replacement, UText *dest, @@ -1219,7 +1222,7 @@ uregex_replaceFirstUText(URegularExpression *regexp, * @stable ICU 3.0 * */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_appendReplacement(URegularExpression *regexp, const UChar *replacementText, int32_t replacementLength, @@ -1249,7 +1252,7 @@ uregex_appendReplacement(URegularExpression *regexp, * * @stable ICU 4.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_appendReplacementUText(URegularExpression *regexp, UText *replacementText, UText *dest, @@ -1279,7 +1282,7 @@ uregex_appendReplacementUText(URegularExpression *regexp, * * @stable ICU 3.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_appendTail(URegularExpression *regexp, UChar **destBuf, int32_t *destCapacity, @@ -1303,7 +1306,7 @@ uregex_appendTail(URegularExpression *regexp, * * @stable ICU 4.6 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 uregex_appendTailUText(URegularExpression *regexp, UText *dest, UErrorCode *status); @@ -1359,7 +1362,7 @@ uregex_appendTailUText(URegularExpression *regexp, * @return The number of fields into which the input string was split. * @stable ICU 3.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_split( URegularExpression *regexp, UChar *destBuf, int32_t destCapacity, @@ -1394,7 +1397,7 @@ uregex_split( URegularExpression *regexp, * * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_splitUText(URegularExpression *regexp, UText *destFields[], int32_t destFieldsCapacity, @@ -1422,7 +1425,7 @@ uregex_splitUText(URegularExpression *regexp, * @param status A reference to a UErrorCode to receive any errors. * @stable ICU 4.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_setTimeLimit(URegularExpression *regexp, int32_t limit, UErrorCode *status); @@ -1436,7 +1439,7 @@ uregex_setTimeLimit(URegularExpression *regexp, * @return the maximum allowed time for a match, in units of processing steps. * @stable ICU 4.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_getTimeLimit(const URegularExpression *regexp, UErrorCode *status); @@ -1460,7 +1463,7 @@ uregex_getTimeLimit(const URegularExpression *regexp, * * @stable ICU 4.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_setStackLimit(URegularExpression *regexp, int32_t limit, UErrorCode *status); @@ -1472,7 +1475,7 @@ uregex_setStackLimit(URegularExpression *regexp, * stack size is unlimited. * @stable ICU 4.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregex_getStackLimit(const URegularExpression *regexp, UErrorCode *status); @@ -1480,7 +1483,7 @@ uregex_getStackLimit(const URegularExpression *regexp, /** * Function pointer for a regular expression matching callback function. * When set, a callback function will be called periodically during matching - * operations. If the call back function returns FALSE, the matching + * operations. If the call back function returns false, the matching * operation will be terminated early. * * Note: the callback function must not call other functions on this @@ -1491,8 +1494,8 @@ uregex_getStackLimit(const URegularExpression *regexp, * uregex_setMatchCallback() is called. * @param steps the accumulated processing time, in match steps, * for this matching operation. - * @return TRUE to continue the matching operation. - * FALSE to terminate the matching operation. + * @return true to continue the matching operation. + * false to terminate the matching operation. * @stable ICU 4.0 */ U_CDECL_BEGIN @@ -1515,7 +1518,7 @@ U_CDECL_END * @param status A reference to a UErrorCode to receive any errors. * @stable ICU 4.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_setMatchCallback(URegularExpression *regexp, URegexMatchCallback *callback, const void *context, @@ -1533,7 +1536,7 @@ uregex_setMatchCallback(URegularExpression *regexp, * @param status A reference to a UErrorCode to receive any errors. * @stable ICU 4.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_getMatchCallback(const URegularExpression *regexp, URegexMatchCallback **callback, const void **context, @@ -1554,7 +1557,7 @@ uregex_getMatchCallback(const URegularExpression *regexp, * to be attempted, giving the application the opportunity to terminate a long-running * find operation. * - * If the call back function returns FALSE, the find operation will be terminated early. + * If the call back function returns false, the find operation will be terminated early. * * Note: the callback function must not call other functions on this * URegularExpression @@ -1565,8 +1568,8 @@ uregex_getMatchCallback(const URegularExpression *regexp, * @param matchIndex the next index at which a match attempt will be attempted for this * find operation. If this callback interrupts the search, this is the * index at which a find/findNext operation may be re-initiated. - * @return TRUE to continue the matching operation. - * FALSE to terminate the matching operation. + * @return true to continue the matching operation. + * false to terminate the matching operation. * @stable ICU 4.6 */ U_CDECL_BEGIN @@ -1587,7 +1590,7 @@ U_CDECL_END * @param status A reference to a UErrorCode to receive any errors. * @stable ICU 4.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_setFindProgressCallback(URegularExpression *regexp, URegexFindProgressCallback *callback, const void *context, @@ -1604,7 +1607,7 @@ uregex_setFindProgressCallback(URegularExpression *regexp, * @param status A reference to a UErrorCode to receive any errors. * @stable ICU 4.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uregex_getFindProgressCallback(const URegularExpression *regexp, URegexFindProgressCallback **callback, const void **context, diff --git a/deps/icu-small/source/i18n/unicode/uregion.h b/deps/icu-small/source/i18n/unicode/uregion.h index 9d0c1e99de3864..4e4e6aac9f8fcc 100644 --- a/deps/icu-small/source/i18n/unicode/uregion.h +++ b/deps/icu-small/source/i18n/unicode/uregion.h @@ -133,7 +133,7 @@ typedef struct URegion URegion; /**< @stable ICU 52 */ * (U_ILLEGAL_ARGUMENT_ERROR). * @stable ICU 52 */ -U_STABLE const URegion* U_EXPORT2 +U_CAPI const URegion* U_EXPORT2 uregion_getRegionFromCode(const char *regionCode, UErrorCode *status); /** @@ -141,7 +141,7 @@ uregion_getRegionFromCode(const char *regionCode, UErrorCode *status); * code is not recognized, the appropriate error code will be set (U_ILLEGAL_ARGUMENT_ERROR). * @stable ICU 52 */ -U_STABLE const URegion* U_EXPORT2 +U_CAPI const URegion* U_EXPORT2 uregion_getRegionFromNumericCode (int32_t code, UErrorCode *status); /** @@ -149,14 +149,14 @@ uregion_getRegionFromNumericCode (int32_t code, UErrorCode *status); * The enumeration must be closed with with uenum_close(). * @stable ICU 52 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 uregion_getAvailable(URegionType type, UErrorCode *status); /** * Returns true if the specified uregion is equal to the specified otherRegion. * @stable ICU 52 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uregion_areEqual(const URegion* uregion, const URegion* otherRegion); /** @@ -165,7 +165,7 @@ uregion_areEqual(const URegion* uregion, const URegion* otherRegion); * this method with region "IT" (Italy) returns the URegion for "039" (Southern Europe). * @stable ICU 52 */ -U_STABLE const URegion* U_EXPORT2 +U_CAPI const URegion* U_EXPORT2 uregion_getContainingRegion(const URegion* uregion); /** @@ -177,7 +177,7 @@ uregion_getContainingRegion(const URegion* uregion); * URegion "150" (Europe). * @stable ICU 52 */ -U_STABLE const URegion* U_EXPORT2 +U_CAPI const URegion* U_EXPORT2 uregion_getContainingRegionOfType(const URegion* uregion, URegionType type); /** @@ -190,7 +190,7 @@ uregion_getContainingRegionOfType(const URegion* uregion, URegionType type); * and "155" (Western Europe). The enumeration must be closed with with uenum_close(). * @stable ICU 52 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 uregion_getContainedRegions(const URegion* uregion, UErrorCode *status); /** @@ -202,7 +202,7 @@ uregion_getContainedRegions(const URegion* uregion, UErrorCode *status); * etc. The enumeration must be closed with with uenum_close(). * @stable ICU 52 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 uregion_getContainedRegionsOfType(const URegion* uregion, URegionType type, UErrorCode *status); /** @@ -210,7 +210,7 @@ uregion_getContainedRegionsOfType(const URegion* uregion, URegionType type, UErr * hierarchy. * @stable ICU 52 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uregion_contains(const URegion* uregion, const URegion* otherRegion); /** @@ -221,14 +221,14 @@ uregion_contains(const URegion* uregion, const URegion* otherRegion); * "AZ" (Azerbaijan), etc... The enumeration must be closed with with uenum_close(). * @stable ICU 52 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 uregion_getPreferredValues(const URegion* uregion, UErrorCode *status); /** * Returns the specified uregion's canonical code. * @stable ICU 52 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uregion_getRegionCode(const URegion* uregion); /** @@ -236,14 +236,14 @@ uregion_getRegionCode(const URegion* uregion); * for the specified uregion. * @stable ICU 52 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uregion_getNumericCode(const URegion* uregion); /** * Returns the URegionType of the specified uregion. * @stable ICU 52 */ -U_STABLE URegionType U_EXPORT2 +U_CAPI URegionType U_EXPORT2 uregion_getType(const URegion* uregion); diff --git a/deps/icu-small/source/i18n/unicode/ureldatefmt.h b/deps/icu-small/source/i18n/unicode/ureldatefmt.h index d12f0988a88ed1..b66139461b53ad 100644 --- a/deps/icu-small/source/i18n/unicode/ureldatefmt.h +++ b/deps/icu-small/source/i18n/unicode/ureldatefmt.h @@ -16,9 +16,12 @@ #include "unicode/unum.h" #include "unicode/udisplaycontext.h" -#include "unicode/localpointer.h" #include "unicode/uformattedvalue.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + /** * \file * \brief C API: URelativeDateTimeFormatter, relative date formatting of unit + numeric offset. @@ -234,7 +237,7 @@ typedef struct URelativeDateTimeFormatter URelativeDateTimeFormatter; /**< C ty * or NULL if an error occurred. * @stable ICU 57 */ -U_STABLE URelativeDateTimeFormatter* U_EXPORT2 +U_CAPI URelativeDateTimeFormatter* U_EXPORT2 ureldatefmt_open( const char* locale, UNumberFormat* nfToAdopt, UDateRelativeDateTimeFormatterStyle width, @@ -247,7 +250,7 @@ ureldatefmt_open( const char* locale, * The URelativeDateTimeFormatter object to close. * @stable ICU 57 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ureldatefmt_close(URelativeDateTimeFormatter *reldatefmt); struct UFormattedRelativeDateTime; @@ -266,7 +269,7 @@ typedef struct UFormattedRelativeDateTime UFormattedRelativeDateTime; * @return A pointer needing ownership. * @stable ICU 64 */ -U_STABLE UFormattedRelativeDateTime* U_EXPORT2 +U_CAPI UFormattedRelativeDateTime* U_EXPORT2 ureldatefmt_openResult(UErrorCode* ec); /** @@ -283,7 +286,7 @@ ureldatefmt_openResult(UErrorCode* ec); * @return A UFormattedValue owned by the input object. * @stable ICU 64 */ -U_STABLE const UFormattedValue* U_EXPORT2 +U_CAPI const UFormattedValue* U_EXPORT2 ureldatefmt_resultAsValue(const UFormattedRelativeDateTime* ufrdt, UErrorCode* ec); /** @@ -292,7 +295,7 @@ ureldatefmt_resultAsValue(const UFormattedRelativeDateTime* ufrdt, UErrorCode* e * @param ufrdt The object to release. * @stable ICU 64 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ureldatefmt_closeResult(UFormattedRelativeDateTime* ufrdt); @@ -354,7 +357,7 @@ U_NAMESPACE_END * than resultCapacity, in which case an error is returned. * @stable ICU 57 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt, double offset, URelativeDateTimeUnit unit, @@ -385,7 +388,7 @@ ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt, * undefined. * @stable ICU 64 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ureldatefmt_formatNumericToResult( const URelativeDateTimeFormatter* reldatefmt, double offset, @@ -421,7 +424,7 @@ ureldatefmt_formatNumericToResult( * than resultCapacity, in which case an error is returned. * @stable ICU 57 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt, double offset, URelativeDateTimeUnit unit, @@ -455,7 +458,7 @@ ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt, * undefined. * @stable ICU 64 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ureldatefmt_formatToResult( const URelativeDateTimeFormatter* reldatefmt, double offset, @@ -492,7 +495,7 @@ ureldatefmt_formatToResult( * in which case an error is returned. * @stable ICU 57 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ureldatefmt_combineDateAndTime( const URelativeDateTimeFormatter* reldatefmt, const UChar * relativeDateString, int32_t relativeDateStringLen, diff --git a/deps/icu-small/source/i18n/unicode/usearch.h b/deps/icu-small/source/i18n/unicode/usearch.h index d9d84b4f6a9715..26c22b7353953d 100644 --- a/deps/icu-small/source/i18n/unicode/usearch.h +++ b/deps/icu-small/source/i18n/unicode/usearch.h @@ -15,18 +15,21 @@ #if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION -#include "unicode/localpointer.h" #include "unicode/ucol.h" #include "unicode/ucoleitr.h" #include "unicode/ubrk.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + /** * \file * \brief C API: StringSearch * * C APIs for an engine that provides language-sensitive text searching based - * on the comparison rules defined in a UCollator data struct, - * see ucol.h. This ensures that language eccentricity can be + * on the comparison rules defined in a UCollator data struct, + * see ucol.h. This ensures that language eccentricity can be * handled, e.g. for the German collator, characters ß and SS will be matched * if case is chosen to be ignored. * See the @@ -54,18 +57,18 @@ * Option 2. will be the default. *

        * This search has APIs similar to that of other text iteration mechanisms - * such as the break iterators in ubrk.h. Using these + * such as the break iterators in ubrk.h. Using these * APIs, it is easy to scan through text looking for all occurrences of * a given pattern. This search iterator allows changing of direction by - * calling a reset followed by a next or previous. - * Though a direction change can occur without calling reset first, + * calling a reset followed by a next or previous. + * Though a direction change can occur without calling reset first, * this operation comes with some speed penalty. * Generally, match results in the forward direction will match the result * matches in the backwards direction in the reverse order *

        - * usearch.h provides APIs to specify the starting position - * within the text string to be searched, e.g. usearch_setOffset, - * usearch_preceding and usearch_following. Since the + * usearch.h provides APIs to specify the starting position + * within the text string to be searched, e.g. usearch_setOffset, + * usearch_preceding and usearch_following. Since the * starting position will be set as it is specified, please take note that * there are some dangerous positions which the search may render incorrect * results: @@ -101,7 +104,7 @@ * Though collator attributes will be taken into consideration while * performing matches, there are no APIs here for setting and getting the * attributes. These attributes can be set by getting the collator - * from usearch_getCollator and using the APIs in ucol.h. + * from usearch_getCollator and using the APIs in ucol.h. * Lastly to update String Search to the new collator attributes, * usearch_reset() has to be called. *

        @@ -277,9 +280,13 @@ typedef enum { /* open and close ------------------------------------------------------ */ /** -* Creating a search iterator data struct using the argument locale language +* Creates a String Search iterator data struct using the argument locale language * rule set. A collator will be created in the process, which will be owned by -* this search and will be deleted in usearch_close. +* this String Search and will be deleted in usearch_close. +* +* The UStringSearch retains a pointer to both the pattern and text strings. +* The caller must not modify or delete them while using the UStringSearch. +* * @param pattern for matching * @param patternlength length of the pattern, -1 for null-termination * @param text text string @@ -288,9 +295,9 @@ typedef enum { * @param breakiter A BreakIterator that will be used to restrict the points * at which matches are detected. If a match is found, but * the match's start or end index is not a boundary as -* determined by the BreakIterator, the match will +* determined by the BreakIterator, the match will * be rejected and another will be searched for. -* If this parameter is NULL, no break detection is +* If this parameter is NULL, no break detection is * attempted. * @param status for errors if it occurs. If pattern or text is NULL, or if * patternlength or textlength is 0 then an @@ -298,7 +305,7 @@ typedef enum { * @return search iterator data structure, or NULL if there is an error. * @stable ICU 2.4 */ -U_STABLE UStringSearch * U_EXPORT2 usearch_open(const UChar *pattern, +U_CAPI UStringSearch * U_EXPORT2 usearch_open(const UChar *pattern, int32_t patternlength, const UChar *text, int32_t textlength, @@ -307,11 +314,16 @@ U_STABLE UStringSearch * U_EXPORT2 usearch_open(const UChar *pattern, UErrorCode *status); /** -* Creating a search iterator data struct using the argument collator language +* Creates a String Search iterator data struct using the argument collator language * rule set. Note, user retains the ownership of this collator, thus the * responsibility of deletion lies with the user. -* NOTE: string search cannot be instantiated from a collator that has -* collate digits as numbers (CODAN) turned on. + +* NOTE: String Search cannot be instantiated from a collator that has +* collate digits as numbers (CODAN) turned on (UCOL_NUMERIC_COLLATION). +* +* The UStringSearch retains a pointer to both the pattern and text strings. +* The caller must not modify or delete them while using the UStringSearch. +* * @param pattern for matching * @param patternlength length of the pattern, -1 for null-termination * @param text text string @@ -320,9 +332,9 @@ U_STABLE UStringSearch * U_EXPORT2 usearch_open(const UChar *pattern, * @param breakiter A BreakIterator that will be used to restrict the points * at which matches are detected. If a match is found, but * the match's start or end index is not a boundary as -* determined by the BreakIterator, the match will +* determined by the BreakIterator, the match will * be rejected and another will be searched for. -* If this parameter is NULL, no break detection is +* If this parameter is NULL, no break detection is * attempted. * @param status for errors if it occurs. If collator, pattern or text is NULL, * or if patternlength or textlength is 0 then an @@ -330,8 +342,8 @@ U_STABLE UStringSearch * U_EXPORT2 usearch_open(const UChar *pattern, * @return search iterator data structure, or NULL if there is an error. * @stable ICU 2.4 */ -U_STABLE UStringSearch * U_EXPORT2 usearch_openFromCollator( - const UChar *pattern, +U_CAPI UStringSearch * U_EXPORT2 usearch_openFromCollator( + const UChar *pattern, int32_t patternlength, const UChar *text, int32_t textlength, @@ -340,12 +352,12 @@ U_STABLE UStringSearch * U_EXPORT2 usearch_openFromCollator( UErrorCode *status); /** -* Destroying and cleaning up the search iterator data struct. -* If a collator is created in usearch_open, it will be destroyed here. -* @param searchiter data struct to clean up -* @stable ICU 2.4 -*/ -U_STABLE void U_EXPORT2 usearch_close(UStringSearch *searchiter); + * Destroys and cleans up the String Search iterator data struct. + * If a collator was created in usearch_open, then it will be destroyed here. + * @param searchiter The UStringSearch to clean up + * @stable ICU 2.4 + */ +U_CAPI void U_EXPORT2 usearch_close(UStringSearch *searchiter); #if U_SHOW_CPLUSPLUS_API @@ -383,24 +395,24 @@ U_NAMESPACE_END * @param status error status if any. * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 usearch_setOffset(UStringSearch *strsrch, - int32_t position, +U_CAPI void U_EXPORT2 usearch_setOffset(UStringSearch *strsrch, + int32_t position, UErrorCode *status); /** * Return the current index in the string text being searched. * If the iteration has gone past the end of the text (or past the beginning -* for a backwards search), USEARCH_DONE is returned. +* for a backwards search), USEARCH_DONE is returned. * @param strsrch search iterator data struct * @see #USEARCH_DONE * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 usearch_getOffset(const UStringSearch *strsrch); +U_CAPI int32_t U_EXPORT2 usearch_getOffset(const UStringSearch *strsrch); /** * Sets the text searching attributes located in the enum USearchAttribute * with values from the enum USearchAttributeValue. -* USEARCH_DEFAULT can be used for all attributes for resetting. +* USEARCH_DEFAULT can be used for all attributes for resetting. * @param strsrch search iterator data struct * @param attribute text attribute to be set * @param value text attribute value @@ -408,7 +420,7 @@ U_STABLE int32_t U_EXPORT2 usearch_getOffset(const UStringSearch *strsrch); * @see #usearch_getAttribute * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 usearch_setAttribute(UStringSearch *strsrch, +U_CAPI void U_EXPORT2 usearch_setAttribute(UStringSearch *strsrch, USearchAttribute attribute, USearchAttributeValue value, UErrorCode *status); @@ -421,19 +433,19 @@ U_STABLE void U_EXPORT2 usearch_setAttribute(UStringSearch *strsrch, * @see #usearch_setAttribute * @stable ICU 2.4 */ -U_STABLE USearchAttributeValue U_EXPORT2 usearch_getAttribute( +U_CAPI USearchAttributeValue U_EXPORT2 usearch_getAttribute( const UStringSearch *strsrch, USearchAttribute attribute); /** * Returns the index to the match in the text string that was searched. * This call returns a valid result only after a successful call to -* usearch_first, usearch_next, usearch_previous, -* or usearch_last. +* usearch_first, usearch_next, usearch_previous, +* or usearch_last. * Just after construction, or after a searching method returns -* USEARCH_DONE, this method will return USEARCH_DONE. +* USEARCH_DONE, this method will return USEARCH_DONE. *

        -* Use usearch_getMatchedLength to get the matched string length. +* Use usearch_getMatchedLength to get the matched string length. * @param strsrch search iterator data struct * @return index to a substring within the text string that is being * searched. @@ -444,16 +456,16 @@ U_STABLE USearchAttributeValue U_EXPORT2 usearch_getAttribute( * @see #USEARCH_DONE * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 usearch_getMatchedStart( +U_CAPI int32_t U_EXPORT2 usearch_getMatchedStart( const UStringSearch *strsrch); /** * Returns the length of text in the string which matches the search pattern. * This call returns a valid result only after a successful call to -* usearch_first, usearch_next, usearch_previous, -* or usearch_last. +* usearch_first, usearch_next, usearch_previous, +* or usearch_last. * Just after construction, or after a searching method returns -* USEARCH_DONE, this method will return 0. +* USEARCH_DONE, this method will return 0. * @param strsrch search iterator data struct * @return The length of the match in the string text, or 0 if there is no * match currently. @@ -464,22 +476,22 @@ U_STABLE int32_t U_EXPORT2 usearch_getMatchedStart( * @see #USEARCH_DONE * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 usearch_getMatchedLength( +U_CAPI int32_t U_EXPORT2 usearch_getMatchedLength( const UStringSearch *strsrch); /** * Returns the text that was matched by the most recent call to -* usearch_first, usearch_next, usearch_previous, -* or usearch_last. +* usearch_first, usearch_next, usearch_previous, +* or usearch_last. * If the iterator is not pointing at a valid match (e.g. just after -* construction or after USEARCH_DONE has been returned, returns +* construction or after USEARCH_DONE has been returned, returns * an empty string. If result is not large enough to store the matched text, * result will be filled with the partial text and an U_BUFFER_OVERFLOW_ERROR * will be returned in status. result will be null-terminated whenever * possible. If the buffer fits the matched text exactly, a null-termination * is not possible, then a U_STRING_NOT_TERMINATED_ERROR set in status. * Pre-flighting can be either done with length = 0 or the API -* usearch_getMatchedLength. +* usearch_getMatchedLength. * @param strsrch search iterator data struct * @param result UChar buffer to store the matched string * @param resultCapacity length of the result buffer @@ -492,7 +504,7 @@ U_STABLE int32_t U_EXPORT2 usearch_getMatchedLength( * @see #USEARCH_DONE * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 usearch_getMatchedText(const UStringSearch *strsrch, +U_CAPI int32_t U_EXPORT2 usearch_getMatchedText(const UStringSearch *strsrch, UChar *result, int32_t resultCapacity, UErrorCode *status); @@ -506,30 +518,30 @@ U_STABLE int32_t U_EXPORT2 usearch_getMatchedText(const UStringSearch *strsrch, * @param breakiter A BreakIterator that will be used to restrict the points * at which matches are detected. If a match is found, but * the match's start or end index is not a boundary as -* determined by the BreakIterator, the match will +* determined by the BreakIterator, the match will * be rejected and another will be searched for. -* If this parameter is NULL, no break detection is +* If this parameter is NULL, no break detection is * attempted. * @param status for errors if it occurs * @see #usearch_getBreakIterator * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 usearch_setBreakIterator(UStringSearch *strsrch, +U_CAPI void U_EXPORT2 usearch_setBreakIterator(UStringSearch *strsrch, UBreakIterator *breakiter, UErrorCode *status); /** * Returns the BreakIterator that is used to restrict the points at which * matches are detected. This will be the same object that was passed to the -* constructor or to usearch_setBreakIterator. Note that -* NULL +* constructor or to usearch_setBreakIterator. Note that +* NULL * is a legal value; it means that break detection should not be attempted. * @param strsrch search iterator data struct * @return break iterator used * @see #usearch_setBreakIterator * @stable ICU 2.4 */ -U_STABLE const UBreakIterator * U_EXPORT2 usearch_getBreakIterator( +U_CAPI const UBreakIterator * U_EXPORT2 usearch_getBreakIterator( const UStringSearch *strsrch); #endif @@ -538,6 +550,10 @@ U_STABLE const UBreakIterator * U_EXPORT2 usearch_getBreakIterator( * Set the string text to be searched. Text iteration will hence begin at the * start of the text string. This method is useful if you want to re-use an * iterator to search for the same pattern within a different body of text. +* +* The UStringSearch retains a pointer to the text string. The caller must not +* modify or delete the string while using the UStringSearch. +* * @param strsrch search iterator data struct * @param text new string to look for match * @param textlength length of the new string, -1 for null-termination @@ -547,7 +563,7 @@ U_STABLE const UBreakIterator * U_EXPORT2 usearch_getBreakIterator( * @see #usearch_getText * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 usearch_setText( UStringSearch *strsrch, +U_CAPI void U_EXPORT2 usearch_setText( UStringSearch *strsrch, const UChar *text, int32_t textlength, UErrorCode *status); @@ -560,20 +576,20 @@ U_STABLE void U_EXPORT2 usearch_setText( UStringSearch *strsrch, * @see #usearch_setText * @stable ICU 2.4 */ -U_STABLE const UChar * U_EXPORT2 usearch_getText(const UStringSearch *strsrch, +U_CAPI const UChar * U_EXPORT2 usearch_getText(const UStringSearch *strsrch, int32_t *length); /** * Gets the collator used for the language rules. *

        -* Deleting the returned UCollator before calling -* usearch_close would cause the string search to fail. -* usearch_close will delete the collator if this search owns it. +* Deleting the returned UCollator before calling +* usearch_close would cause the string search to fail. +* usearch_close will delete the collator if this search owns it. * @param strsrch search iterator data struct * @return collator * @stable ICU 2.4 */ -U_STABLE UCollator * U_EXPORT2 usearch_getCollator( +U_CAPI UCollator * U_EXPORT2 usearch_getCollator( const UStringSearch *strsrch); /** @@ -586,7 +602,7 @@ U_STABLE UCollator * U_EXPORT2 usearch_getCollator( * @param status for errors if it occurs * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 usearch_setCollator( UStringSearch *strsrch, +U_CAPI void U_EXPORT2 usearch_setCollator( UStringSearch *strsrch, const UCollator *collator, UErrorCode *status); @@ -594,6 +610,10 @@ U_STABLE void U_EXPORT2 usearch_setCollator( UStringSearch *strsrch, * Sets the pattern used for matching. * Internal data like the Boyer Moore table will be recalculated, but the * iterator's position is unchanged. +* +* The UStringSearch retains a pointer to the pattern string. The caller must not +* modify or delete the string while using the UStringSearch. +* * @param strsrch search iterator data struct * @param pattern string * @param patternlength pattern length, -1 for null-terminated string @@ -602,7 +622,7 @@ U_STABLE void U_EXPORT2 usearch_setCollator( UStringSearch *strsrch, * done to strsrch. * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 usearch_setPattern( UStringSearch *strsrch, +U_CAPI void U_EXPORT2 usearch_setPattern( UStringSearch *strsrch, const UChar *pattern, int32_t patternlength, UErrorCode *status); @@ -615,7 +635,7 @@ U_STABLE void U_EXPORT2 usearch_setPattern( UStringSearch *strsrch, * @return pattern string * @stable ICU 2.4 */ -U_STABLE const UChar * U_EXPORT2 usearch_getPattern( +U_CAPI const UChar * U_EXPORT2 usearch_getPattern( const UStringSearch *strsrch, int32_t *length); @@ -625,28 +645,28 @@ U_STABLE const UChar * U_EXPORT2 usearch_getPattern( * Returns the first index at which the string text matches the search * pattern. * The iterator is adjusted so that its current index (as returned by -* usearch_getOffset) is the match position if one was found. -* If a match is not found, USEARCH_DONE will be returned and -* the iterator will be adjusted to the index USEARCH_DONE. +* usearch_getOffset) is the match position if one was found. +* If a match is not found, USEARCH_DONE will be returned and +* the iterator will be adjusted to the index USEARCH_DONE. * @param strsrch search iterator data struct * @param status for errors if it occurs * @return The character index of the first match, or -* USEARCH_DONE if there are no matches. +* USEARCH_DONE if there are no matches. * @see #usearch_getOffset * @see #USEARCH_DONE * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 usearch_first(UStringSearch *strsrch, +U_CAPI int32_t U_EXPORT2 usearch_first(UStringSearch *strsrch, UErrorCode *status); /** -* Returns the first index equal or greater than position at which +* Returns the first index equal or greater than position at which * the string text * matches the search pattern. The iterator is adjusted so that its current -* index (as returned by usearch_getOffset) is the match position if +* index (as returned by usearch_getOffset) is the match position if * one was found. -* If a match is not found, USEARCH_DONE will be returned and -* the iterator will be adjusted to the index USEARCH_DONE +* If a match is not found, USEARCH_DONE will be returned and +* the iterator will be adjusted to the index USEARCH_DONE *

        * Search positions that may render incorrect results are highlighted in the * header comments. If position is less than or greater than the text range @@ -654,60 +674,60 @@ U_STABLE int32_t U_EXPORT2 usearch_first(UStringSearch *strsrch, * @param strsrch search iterator data struct * @param position to start the search at * @param status for errors if it occurs -* @return The character index of the first match following pos, -* or USEARCH_DONE if there are no matches. +* @return The character index of the first match following pos, +* or USEARCH_DONE if there are no matches. * @see #usearch_getOffset * @see #USEARCH_DONE * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 usearch_following(UStringSearch *strsrch, +U_CAPI int32_t U_EXPORT2 usearch_following(UStringSearch *strsrch, int32_t position, UErrorCode *status); /** * Returns the last index in the target text at which it matches the search * pattern. The iterator is adjusted so that its current -* index (as returned by usearch_getOffset) is the match position if +* index (as returned by usearch_getOffset) is the match position if * one was found. -* If a match is not found, USEARCH_DONE will be returned and -* the iterator will be adjusted to the index USEARCH_DONE. +* If a match is not found, USEARCH_DONE will be returned and +* the iterator will be adjusted to the index USEARCH_DONE. * @param strsrch search iterator data struct * @param status for errors if it occurs -* @return The index of the first match, or USEARCH_DONE if there +* @return The index of the first match, or USEARCH_DONE if there * are no matches. * @see #usearch_getOffset * @see #USEARCH_DONE * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 usearch_last(UStringSearch *strsrch, +U_CAPI int32_t U_EXPORT2 usearch_last(UStringSearch *strsrch, UErrorCode *status); /** -* Returns the first index less than position at which the string text +* Returns the first index less than position at which the string text * matches the search pattern. The iterator is adjusted so that its current -* index (as returned by usearch_getOffset) is the match position if +* index (as returned by usearch_getOffset) is the match position if * one was found. -* If a match is not found, USEARCH_DONE will be returned and -* the iterator will be adjusted to the index USEARCH_DONE +* If a match is not found, USEARCH_DONE will be returned and +* the iterator will be adjusted to the index USEARCH_DONE *

        * Search positions that may render incorrect results are highlighted in the * header comments. If position is less than or greater than the text range * for searching, an U_INDEX_OUTOFBOUNDS_ERROR will be returned. *

        -* When USEARCH_OVERLAP option is off, the last index of the -* result match is always less than position. -* When USERARCH_OVERLAP is on, the result match may span across -* position. +* When USEARCH_OVERLAP option is off, the last index of the +* result match is always less than position. +* When USERARCH_OVERLAP is on, the result match may span across +* position. * @param strsrch search iterator data struct * @param position index position the search is to begin at * @param status for errors if it occurs -* @return The character index of the first match preceding pos, -* or USEARCH_DONE if there are no matches. +* @return The character index of the first match preceding pos, +* or USEARCH_DONE if there are no matches. * @see #usearch_getOffset * @see #USEARCH_DONE * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 usearch_preceding(UStringSearch *strsrch, +U_CAPI int32_t U_EXPORT2 usearch_preceding(UStringSearch *strsrch, int32_t position, UErrorCode *status); @@ -715,40 +735,40 @@ U_STABLE int32_t U_EXPORT2 usearch_preceding(UStringSearch *strsrch, * Returns the index of the next point at which the string text matches the * search pattern, starting from the current position. * The iterator is adjusted so that its current -* index (as returned by usearch_getOffset) is the match position if +* index (as returned by usearch_getOffset) is the match position if * one was found. -* If a match is not found, USEARCH_DONE will be returned and -* the iterator will be adjusted to the index USEARCH_DONE +* If a match is not found, USEARCH_DONE will be returned and +* the iterator will be adjusted to the index USEARCH_DONE * @param strsrch search iterator data struct * @param status for errors if it occurs * @return The index of the next match after the current position, or -* USEARCH_DONE if there are no more matches. +* USEARCH_DONE if there are no more matches. * @see #usearch_first * @see #usearch_getOffset * @see #USEARCH_DONE * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 usearch_next(UStringSearch *strsrch, +U_CAPI int32_t U_EXPORT2 usearch_next(UStringSearch *strsrch, UErrorCode *status); /** * Returns the index of the previous point at which the string text matches * the search pattern, starting at the current position. * The iterator is adjusted so that its current -* index (as returned by usearch_getOffset) is the match position if +* index (as returned by usearch_getOffset) is the match position if * one was found. -* If a match is not found, USEARCH_DONE will be returned and -* the iterator will be adjusted to the index USEARCH_DONE +* If a match is not found, USEARCH_DONE will be returned and +* the iterator will be adjusted to the index USEARCH_DONE * @param strsrch search iterator data struct * @param status for errors if it occurs * @return The index of the previous match before the current position, -* or USEARCH_DONE if there are no more matches. +* or USEARCH_DONE if there are no more matches. * @see #usearch_last * @see #usearch_getOffset * @see #USEARCH_DONE * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 usearch_previous(UStringSearch *strsrch, +U_CAPI int32_t U_EXPORT2 usearch_previous(UStringSearch *strsrch, UErrorCode *status); /** @@ -761,7 +781,7 @@ U_STABLE int32_t U_EXPORT2 usearch_previous(UStringSearch *strsrch, * @see #usearch_first * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 usearch_reset(UStringSearch *strsrch); +U_CAPI void U_EXPORT2 usearch_reset(UStringSearch *strsrch); #ifndef U_HIDE_INTERNAL_API /** @@ -814,11 +834,11 @@ U_STABLE void U_EXPORT2 usearch_reset(UStringSearch *strsrch); * A value of -1 will be returned if no match was found. * * @param status Report any errors. Note that no match found is not an error. - * @return TRUE if a match was found, FALSE otherwise. + * @return true if a match was found, false otherwise. * * @internal */ -U_INTERNAL UBool U_EXPORT2 usearch_search(UStringSearch *strsrch, +U_CAPI UBool U_EXPORT2 usearch_search(UStringSearch *strsrch, int32_t startIdx, int32_t *matchStart, int32_t *matchLimit, @@ -874,11 +894,11 @@ U_INTERNAL UBool U_EXPORT2 usearch_search(UStringSearch *strsrch, * A value of -1 will be returned if no match was found. * * @param status Report any errors. Note that no match found is not an error. - * @return TRUE if a match was found, FALSE otherwise. + * @return true if a match was found, false otherwise. * * @internal */ -U_INTERNAL UBool U_EXPORT2 usearch_searchBackwards(UStringSearch *strsrch, +U_CAPI UBool U_EXPORT2 usearch_searchBackwards(UStringSearch *strsrch, int32_t startIdx, int32_t *matchStart, int32_t *matchLimit, diff --git a/deps/icu-small/source/i18n/unicode/uspoof.h b/deps/icu-small/source/i18n/unicode/uspoof.h index 63a13387b063be..7680c687ce4daf 100644 --- a/deps/icu-small/source/i18n/unicode/uspoof.h +++ b/deps/icu-small/source/i18n/unicode/uspoof.h @@ -22,12 +22,12 @@ #include "unicode/utypes.h" #include "unicode/uset.h" #include "unicode/parseerr.h" -#include "unicode/localpointer.h" #if !UCONFIG_NO_NORMALIZATION #if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" #include "unicode/unistr.h" #include "unicode/uniset.h" #endif @@ -154,10 +154,10 @@ * UChar* skel = (UChar*) malloc(++len * sizeof(UChar)); * status = U_ZERO_ERROR; * uspoof_getSkeleton(sc, 0, str, -1, skel, len, &status); - * UBool result = FALSE; + * UBool result = false; * for (size_t i=0; i @@ -701,8 +703,9 @@ uspoof_clone(const USpoofChecker *sc, UErrorCode *status); * } * * - * To disable specific checks and enable all others, the "blacklisted" checks should be ANDed away from - * ALL_CHECKS. For example, if you are not planning to use the {@link uspoof_areConfusable} functionality, + * To disable specific checks and enable all others, + * start with ALL_CHECKS and "AND away" the not-desired checks. + * For example, if you are not planning to use the {@link uspoof_areConfusable} functionality, * it is good practice to disable the CONFUSABLE check: * *

        @@ -724,7 +727,7 @@ uspoof_clone(const USpoofChecker *sc, UErrorCode *status);
          * @stable ICU 4.2
          *
          */
        -U_STABLE void U_EXPORT2
        +U_CAPI void U_EXPORT2
         uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status);
         
         /**
        @@ -738,7 +741,7 @@ uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status);
          * @stable ICU 4.2
          *
          */
        -U_STABLE int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status);
         
         /**
        @@ -752,7 +755,7 @@ uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status);
          * @see URestrictionLevel
          * @stable ICU 51
          */
        -U_STABLE void U_EXPORT2
        +U_CAPI void U_EXPORT2
         uspoof_setRestrictionLevel(USpoofChecker *sc, URestrictionLevel restrictionLevel);
         
         
        @@ -763,7 +766,7 @@ uspoof_setRestrictionLevel(USpoofChecker *sc, URestrictionLevel restrictionLevel
           * @see URestrictionLevel
           * @stable ICU 51
           */
        -U_STABLE URestrictionLevel U_EXPORT2
        +U_CAPI URestrictionLevel U_EXPORT2
         uspoof_getRestrictionLevel(const USpoofChecker *sc);
         
         /**
        @@ -808,7 +811,7 @@ uspoof_getRestrictionLevel(const USpoofChecker *sc);
          * @param status       The error code, set if this function encounters a problem.
          * @stable ICU 4.2
          */
        -U_STABLE void U_EXPORT2
        +U_CAPI void U_EXPORT2
         uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode *status);
         
         /**
        @@ -832,7 +835,7 @@ uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode
          *
          * @stable ICU 4.2
          */
        -U_STABLE const char * U_EXPORT2
        +U_CAPI const char * U_EXPORT2
         uspoof_getAllowedLocales(USpoofChecker *sc, UErrorCode *status);
         
         
        @@ -854,7 +857,7 @@ uspoof_getAllowedLocales(USpoofChecker *sc, UErrorCode *status);
          * @param status   The error code, set if this function encounters a problem.
          * @stable ICU 4.2
          */
        -U_STABLE void U_EXPORT2
        +U_CAPI void U_EXPORT2
         uspoof_setAllowedChars(USpoofChecker *sc, const USet *chars, UErrorCode *status);
         
         
        @@ -878,7 +881,7 @@ uspoof_setAllowedChars(USpoofChecker *sc, const USet *chars, UErrorCode *status)
          *                 the USPOOF_CHAR_LIMIT test.
          * @stable ICU 4.2
          */
        -U_STABLE const USet * U_EXPORT2
        +U_CAPI const USet * U_EXPORT2
         uspoof_getAllowedChars(const USpoofChecker *sc, UErrorCode *status);
         
         
        @@ -914,7 +917,7 @@ uspoof_getAllowedChars(const USpoofChecker *sc, UErrorCode *status);
          * @see uspoof_check2
          * @stable ICU 4.2
          */
        -U_STABLE int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         uspoof_check(const USpoofChecker *sc,
                                  const UChar *id, int32_t length,
                                  int32_t *position,
        @@ -953,7 +956,7 @@ uspoof_check(const USpoofChecker *sc,
          * @see uspoof_check2UTF8
          * @stable ICU 4.2
          */
        -U_STABLE int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         uspoof_checkUTF8(const USpoofChecker *sc,
                          const char *id, int32_t length,
                          int32_t *position,
        @@ -988,7 +991,7 @@ uspoof_checkUTF8(const USpoofChecker *sc,
          * @see uspoof_check2UnicodeString
          * @stable ICU 58
          */
        -U_STABLE int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         uspoof_check2(const USpoofChecker *sc,
             const UChar* id, int32_t length,
             USpoofCheckResult* checkResult,
        @@ -1025,7 +1028,7 @@ uspoof_check2(const USpoofChecker *sc,
          * @see uspoof_check2UnicodeString
          * @stable ICU 58
          */
        -U_STABLE int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         uspoof_check2UTF8(const USpoofChecker *sc,
             const char *id, int32_t length,
             USpoofCheckResult* checkResult,
        @@ -1049,7 +1052,7 @@ uspoof_check2UTF8(const USpoofChecker *sc,
          * @see uspoof_check2UnicodeString
          * @stable ICU 58
          */
        -U_STABLE USpoofCheckResult* U_EXPORT2
        +U_CAPI USpoofCheckResult* U_EXPORT2
         uspoof_openCheckResult(UErrorCode *status);
         
         /**
        @@ -1059,7 +1062,7 @@ uspoof_openCheckResult(UErrorCode *status);
          * @param checkResult  The instance of USpoofCheckResult to close
          * @stable ICU 58
          */
        -U_STABLE void U_EXPORT2
        +U_CAPI void U_EXPORT2
         uspoof_closeCheckResult(USpoofCheckResult *checkResult);
         
         /**
        @@ -1076,7 +1079,7 @@ uspoof_closeCheckResult(USpoofCheckResult *checkResult);
          * @see uspoof_setChecks
          * @stable ICU 58
          */
        -U_STABLE int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         uspoof_getCheckResultChecks(const USpoofCheckResult *checkResult, UErrorCode *status);
         
         /**
        @@ -1089,7 +1092,7 @@ uspoof_getCheckResultChecks(const USpoofCheckResult *checkResult, UErrorCode *st
          * @see uspoof_setRestrictionLevel
          * @stable ICU 58
          */
        -U_STABLE URestrictionLevel U_EXPORT2
        +U_CAPI URestrictionLevel U_EXPORT2
         uspoof_getCheckResultRestrictionLevel(const USpoofCheckResult *checkResult, UErrorCode *status);
         
         /**
        @@ -1103,7 +1106,7 @@ uspoof_getCheckResultRestrictionLevel(const USpoofCheckResult *checkResult, UErr
          * @param status       The error code, set if an error occurred.
          * @stable ICU 58
          */
        -U_STABLE const USet* U_EXPORT2
        +U_CAPI const USet* U_EXPORT2
         uspoof_getCheckResultNumerics(const USpoofCheckResult *checkResult, UErrorCode *status);
         
         
        @@ -1150,7 +1153,7 @@ uspoof_getCheckResultNumerics(const USpoofCheckResult *checkResult, UErrorCode *
          *
          * @stable ICU 4.2
          */
        -U_STABLE int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         uspoof_areConfusable(const USpoofChecker *sc,
                              const UChar *id1, int32_t length1,
                              const UChar *id2, int32_t length2,
        @@ -1183,7 +1186,7 @@ uspoof_areConfusable(const USpoofChecker *sc,
          *
          * @see uspoof_areConfusable
          */
        -U_STABLE int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         uspoof_areConfusableUTF8(const USpoofChecker *sc,
                                  const char *id1, int32_t length1,
                                  const char *id2, int32_t length2,
        @@ -1223,7 +1226,7 @@ uspoof_areConfusableUTF8(const USpoofChecker *sc,
          * @stable ICU 4.2
          * @see uspoof_areConfusable
          */
        -U_STABLE int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         uspoof_getSkeleton(const USpoofChecker *sc,
                            uint32_t type,
                            const UChar *id,  int32_t length,
        @@ -1263,7 +1266,7 @@ uspoof_getSkeleton(const USpoofChecker *sc,
          *
          * @stable ICU 4.2
          */
        -U_STABLE int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         uspoof_getSkeletonUTF8(const USpoofChecker *sc,
                                uint32_t type,
                                const char *id,  int32_t length,
        @@ -1282,7 +1285,7 @@ uspoof_getSkeletonUTF8(const USpoofChecker *sc,
           *
           * @stable ICU 51
           */
        -U_STABLE const USet * U_EXPORT2
        +U_CAPI const USet * U_EXPORT2
         uspoof_getInclusionSet(UErrorCode *status);
         
         /**
        @@ -1297,7 +1300,7 @@ uspoof_getInclusionSet(UErrorCode *status);
           *
           * @stable ICU 51
           */
        -U_STABLE const USet * U_EXPORT2
        +U_CAPI const USet * U_EXPORT2
         uspoof_getRecommendedSet(UErrorCode *status);
         
         /**
        @@ -1322,7 +1325,7 @@ uspoof_getRecommendedSet(UErrorCode *status);
          * @see utrie2_openFromSerialized()
          * @stable ICU 4.2
          */
        -U_STABLE int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         uspoof_serialize(USpoofChecker *sc,
                          void *data, int32_t capacity,
                          UErrorCode *status);
        @@ -1388,7 +1391,7 @@ U_NAMESPACE_END
          * @param status   The error code, set if this function encounters a problem.
          * @stable ICU 4.2
          */
        -U_STABLE void U_EXPORT2
        +U_CAPI void U_EXPORT2
         uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const icu::UnicodeSet *chars, UErrorCode *status);
         
         
        @@ -1412,7 +1415,7 @@ uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const icu::UnicodeSet *chars, UEr
          *                 the USPOOF_CHAR_LIMIT test.
          * @stable ICU 4.2
          */
        -U_STABLE const icu::UnicodeSet * U_EXPORT2
        +U_CAPI const icu::UnicodeSet * U_EXPORT2
         uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
         
         /**
        @@ -1443,7 +1446,7 @@ uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
          * @see uspoof_check2UnicodeString
          * @stable ICU 4.2
          */
        -U_STABLE int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         uspoof_checkUnicodeString(const USpoofChecker *sc,
                                   const icu::UnicodeString &id,
                                   int32_t *position,
        @@ -1474,7 +1477,7 @@ uspoof_checkUnicodeString(const USpoofChecker *sc,
          * @see uspoof_check2UTF8
          * @stable ICU 58
          */
        -U_STABLE int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         uspoof_check2UnicodeString(const USpoofChecker *sc,
             const icu::UnicodeString &id,
             USpoofCheckResult* checkResult,
        @@ -1501,7 +1504,7 @@ uspoof_check2UnicodeString(const USpoofChecker *sc,
          *
          * @see uspoof_areConfusable
          */
        -U_STABLE int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         uspoof_areConfusableUnicodeString(const USpoofChecker *sc,
                                           const icu::UnicodeString &s1,
                                           const icu::UnicodeString &s2,
        @@ -1549,7 +1552,7 @@ uspoof_getSkeletonUnicodeString(const USpoofChecker *sc,
           *
           * @stable ICU 51
           */
        -U_STABLE const icu::UnicodeSet * U_EXPORT2
        +U_CAPI const icu::UnicodeSet * U_EXPORT2
         uspoof_getInclusionUnicodeSet(UErrorCode *status);
         
         /**
        @@ -1564,7 +1567,7 @@ uspoof_getInclusionUnicodeSet(UErrorCode *status);
           *
           * @stable ICU 51
           */
        -U_STABLE const icu::UnicodeSet * U_EXPORT2
        +U_CAPI const icu::UnicodeSet * U_EXPORT2
         uspoof_getRecommendedUnicodeSet(UErrorCode *status);
         
         #endif /* U_SHOW_CPLUSPLUS_API */
        diff --git a/deps/icu-small/source/i18n/unicode/utmscale.h b/deps/icu-small/source/i18n/unicode/utmscale.h
        index 2392c6414e4f8b..b7dca15367dcfe 100644
        --- a/deps/icu-small/source/i18n/unicode/utmscale.h
        +++ b/deps/icu-small/source/i18n/unicode/utmscale.h
        @@ -449,7 +449,7 @@ typedef enum UTimeScaleValue {
          *
          * @stable ICU 3.2
          */
        -U_STABLE int64_t U_EXPORT2
        +U_CAPI int64_t U_EXPORT2
             utmscale_getTimeScaleValue(UDateTimeScale timeScale, UTimeScaleValue value, UErrorCode *status);
         
         /* Conversion to 'universal time scale' */
        @@ -465,7 +465,7 @@ U_STABLE int64_t U_EXPORT2
          *
          * @stable ICU 3.2
          */
        -U_STABLE int64_t U_EXPORT2
        +U_CAPI int64_t U_EXPORT2
             utmscale_fromInt64(int64_t otherTime, UDateTimeScale timeScale, UErrorCode *status);
         
         /* Conversion from 'universal time scale' */
        @@ -481,7 +481,7 @@ U_STABLE int64_t U_EXPORT2
          *
          * @stable ICU 3.2
          */
        -U_STABLE int64_t U_EXPORT2
        +U_CAPI int64_t U_EXPORT2
             utmscale_toInt64(int64_t universalTime, UDateTimeScale timeScale, UErrorCode *status);
         
         #endif /* #if !UCONFIG_NO_FORMATTING */
        diff --git a/deps/icu-small/source/i18n/unicode/utrans.h b/deps/icu-small/source/i18n/unicode/utrans.h
        index 56640eda967cbe..e959378285cfb8 100644
        --- a/deps/icu-small/source/i18n/unicode/utrans.h
        +++ b/deps/icu-small/source/i18n/unicode/utrans.h
        @@ -17,12 +17,15 @@
         
         #if !UCONFIG_NO_TRANSLITERATION
         
        -#include "unicode/localpointer.h"
         #include "unicode/urep.h"
         #include "unicode/parseerr.h"
         #include "unicode/uenum.h"
         #include "unicode/uset.h"
         
        +#if U_SHOW_CPLUSPLUS_API
        +#include "unicode/localpointer.h"
        +#endif   // U_SHOW_CPLUSPLUS_API
        +
         /********************************************************************
          * General Notes
          ********************************************************************
        @@ -188,7 +191,7 @@ typedef struct UTransPosition {
          *         utrans_xxx() functions, or NULL if the open call fails.
          * @stable ICU 2.8
          */
        -U_STABLE UTransliterator* U_EXPORT2
        +U_CAPI UTransliterator* U_EXPORT2
         utrans_openU(const UChar *id,
                      int32_t idLength,
                      UTransDirection dir,
        @@ -212,7 +215,7 @@ utrans_openU(const UChar *id,
          * inverse of trans, or NULL if the open call fails.
          * @stable ICU 2.0
          */
        -U_STABLE UTransliterator* U_EXPORT2
        +U_CAPI UTransliterator* U_EXPORT2
         utrans_openInverse(const UTransliterator* trans,
                            UErrorCode* status);
         
        @@ -226,7 +229,7 @@ utrans_openInverse(const UTransliterator* trans,
          * utrans_xxx() functions, or NULL if the clone call fails.
          * @stable ICU 2.0
          */
        -U_STABLE UTransliterator* U_EXPORT2
        +U_CAPI UTransliterator* U_EXPORT2
         utrans_clone(const UTransliterator* trans,
                      UErrorCode* status);
         
        @@ -236,7 +239,7 @@ utrans_clone(const UTransliterator* trans,
          * @param trans the transliterator to be closed.
          * @stable ICU 2.0
          */
        -U_STABLE void U_EXPORT2
        +U_CAPI void U_EXPORT2
         utrans_close(UTransliterator* trans);
         
         #if U_SHOW_CPLUSPLUS_API
        @@ -272,7 +275,7 @@ U_NAMESPACE_END
          *
          * @stable ICU 2.8
          */
        -U_STABLE const UChar * U_EXPORT2
        +U_CAPI const UChar * U_EXPORT2
         utrans_getUnicodeID(const UTransliterator *trans,
                             int32_t *resultLength);
         
        @@ -290,7 +293,7 @@ utrans_getUnicodeID(const UTransliterator *trans,
          * @param status a pointer to the UErrorCode
          * @stable ICU 2.0
          */
        -U_STABLE void U_EXPORT2
        +U_CAPI void U_EXPORT2
         utrans_register(UTransliterator* adoptedTrans,
                         UErrorCode* status);
         
        @@ -303,7 +306,7 @@ utrans_register(UTransliterator* adoptedTrans,
          * @param idLength the length of id, or -1 if id is zero-terminated
          * @stable ICU 2.8
          */
        -U_STABLE void U_EXPORT2
        +U_CAPI void U_EXPORT2
         utrans_unregisterID(const UChar* id, int32_t idLength);
         
         /**
        @@ -324,7 +327,7 @@ utrans_unregisterID(const UChar* id, int32_t idLength);
          * @see UnicodeSet
          * @stable ICU 2.0
          */
        -U_STABLE void U_EXPORT2
        +U_CAPI void U_EXPORT2
         utrans_setFilter(UTransliterator* trans,
                          const UChar* filterPattern,
                          int32_t filterPatternLen,
        @@ -337,7 +340,7 @@ utrans_setFilter(UTransliterator* trans,
          * @return the number of system transliterators.
          * @stable ICU 2.0
          */
        -U_STABLE int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         utrans_countAvailableIDs(void);
         
         /**
        @@ -349,7 +352,7 @@ utrans_countAvailableIDs(void);
          *
          * @stable ICU 2.8
          */
        -U_STABLE UEnumeration * U_EXPORT2
        +U_CAPI UEnumeration * U_EXPORT2
         utrans_openIDs(UErrorCode *pErrorCode);
         
         /********************************************************************
        @@ -379,7 +382,7 @@ utrans_openIDs(UErrorCode *pErrorCode);
          * @param status a pointer to the UErrorCode
          * @stable ICU 2.0
          */
        -U_STABLE void U_EXPORT2
        +U_CAPI void U_EXPORT2
         utrans_trans(const UTransliterator* trans,
                      UReplaceable* rep,
                      const UReplaceableCallbacks* repFunc,
        @@ -430,7 +433,7 @@ utrans_trans(const UTransliterator* trans,
          * @param status a pointer to the UErrorCode
          * @stable ICU 2.0
          */
        -U_STABLE void U_EXPORT2
        +U_CAPI void U_EXPORT2
         utrans_transIncremental(const UTransliterator* trans,
                                 UReplaceable* rep,
                                 const UReplaceableCallbacks* repFunc,
        @@ -467,7 +470,7 @@ utrans_transIncremental(const UTransliterator* trans,
          * @param status a pointer to the UErrorCode
          * @stable ICU 2.0
          */
        -U_STABLE void U_EXPORT2
        +U_CAPI void U_EXPORT2
         utrans_transUChars(const UTransliterator* trans,
                            UChar* text,
                            int32_t* textLength,
        @@ -502,7 +505,7 @@ utrans_transUChars(const UTransliterator* trans,
          * @see utrans_transIncremental
          * @stable ICU 2.0
          */
        -U_STABLE void U_EXPORT2
        +U_CAPI void U_EXPORT2
         utrans_transIncrementalUChars(const UTransliterator* trans,
                                       UChar* text,
                                       int32_t* textLength,
        @@ -515,7 +518,7 @@ utrans_transIncrementalUChars(const UTransliterator* trans,
          * transliterator.
          *
          * @param trans     The transliterator
        - * @param escapeUnprintable if TRUE then convert unprintable characters to their
        + * @param escapeUnprintable if true then convert unprintable characters to their
          *                  hex escape representations, \\uxxxx or \\Uxxxxxxxx.
          *                  Unprintable characters are those other than
          *                  U+000A, U+0020..U+007E.
        @@ -527,7 +530,7 @@ utrans_transIncrementalUChars(const UTransliterator* trans,
          *                  in which case an error is returned).
          * @stable ICU 53
          */
        -U_STABLE int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         utrans_toRules(     const UTransliterator* trans,
                             UBool escapeUnprintable,
                             UChar* result, int32_t resultLength,
        @@ -537,9 +540,9 @@ utrans_toRules(     const UTransliterator* trans,
          * Returns the set of all characters that may be modified in the input text by
          * this UTransliterator, optionally ignoring the transliterator's current filter.
          * @param trans     The transliterator.
        - * @param ignoreFilter If FALSE, the returned set incorporates the
        + * @param ignoreFilter If false, the returned set incorporates the
          *                  UTransliterator's current filter; if the filter is changed,
        - *                  the return value of this function will change. If TRUE, the
        + *                  the return value of this function will change. If true, the
          *                  returned set ignores the effect of the UTransliterator's
          *                  current filter.
          * @param fillIn    Pointer to a USet object to receive the modifiable characters
        @@ -552,7 +555,7 @@ utrans_toRules(     const UTransliterator* trans,
          *                  error, NULL is returned.
          * @stable ICU 53
          */
        -U_STABLE USet* U_EXPORT2
        +U_CAPI USet* U_EXPORT2
         utrans_getSourceSet(const UTransliterator* trans,
                             UBool ignoreFilter,
                             USet* fillIn,
        diff --git a/deps/icu-small/source/i18n/unicode/vtzone.h b/deps/icu-small/source/i18n/unicode/vtzone.h
        index 43a5652d6a20f0..89a79c07b3215f 100644
        --- a/deps/icu-small/source/i18n/unicode/vtzone.h
        +++ b/deps/icu-small/source/i18n/unicode/vtzone.h
        @@ -119,7 +119,7 @@ class U_I18N_API VTimeZone : public BasicTimeZone {
              * created from VTIMEZONE data, the initial value is set by the TZURL property value
              * in the data.  Otherwise, the initial value is not set.
              * @param url Receives the RFC2445 TZURL property value.
        -     * @return TRUE if TZURL attribute is available and value is set.
        +     * @return true if TZURL attribute is available and value is set.
              * @stable ICU 3.8
              */
             UBool getTZURL(UnicodeString& url) const;
        @@ -136,7 +136,7 @@ class U_I18N_API VTimeZone : public BasicTimeZone {
              * was created from VTIMEZONE data, the initial value is set by the LAST-MODIFIED property
              * value in the data.  Otherwise, the initial value is not set.
              * @param lastModified Receives the last modified date.
        -     * @return TRUE if lastModified attribute is available and value is set.
        +     * @return true if lastModified attribute is available and value is set.
              * @stable ICU 3.8
              */
             UBool getLastModified(UDate& lastModified) const;
        @@ -322,7 +322,7 @@ class U_I18N_API VTimeZone : public BasicTimeZone {
              * @param base      The base time.
              * @param inclusive Whether the base time is inclusive or not.
              * @param result    Receives the first transition after the base time.
        -     * @return  TRUE if the transition is found.
        +     * @return  true if the transition is found.
              * @stable ICU 3.8
              */
             virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const;
        @@ -332,7 +332,7 @@ class U_I18N_API VTimeZone : public BasicTimeZone {
              * @param base      The base time.
              * @param inclusive Whether the base time is inclusive or not.
              * @param result    Receives the most recent transition before the base time.
        -     * @return  TRUE if the transition is found.
        +     * @return  true if the transition is found.
              * @stable ICU 3.8
              */
             virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const;
        diff --git a/deps/icu-small/source/i18n/units_complexconverter.cpp b/deps/icu-small/source/i18n/units_complexconverter.cpp
        new file mode 100644
        index 00000000000000..27f835e6dd4a29
        --- /dev/null
        +++ b/deps/icu-small/source/i18n/units_complexconverter.cpp
        @@ -0,0 +1,253 @@
        +// © 2020 and later: Unicode, Inc. and others.
        +// License & terms of use: http://www.unicode.org/copyright.html
        +
        +#include "unicode/utypes.h"
        +
        +#if !UCONFIG_NO_FORMATTING
        +
        +#include 
        +
        +#include "cmemory.h"
        +#include "number_decimalquantity.h"
        +#include "number_roundingutils.h"
        +#include "uarrsort.h"
        +#include "uassert.h"
        +#include "unicode/fmtable.h"
        +#include "unicode/localpointer.h"
        +#include "unicode/measunit.h"
        +#include "unicode/measure.h"
        +#include "units_complexconverter.h"
        +#include "units_converter.h"
        +
        +U_NAMESPACE_BEGIN
        +namespace units {
        +
        +ComplexUnitsConverter::ComplexUnitsConverter(const MeasureUnitImpl &inputUnit,
        +                                             const MeasureUnitImpl &outputUnits,
        +                                             const ConversionRates &ratesInfo, UErrorCode &status)
        +    : units_(outputUnits.extractIndividualUnits(status)) {
        +    if (U_FAILURE(status)) {
        +        return;
        +    }
        +
        +    U_ASSERT(units_.length() != 0);
        +
        +    // Save the desired order of output units before we sort units_
        +    for (int32_t i = 0; i < units_.length(); i++) {
        +        outputUnits_.emplaceBackAndCheckErrorCode(status, units_[i]->copy(status).build(status));
        +    }
        +
        +    // NOTE:
        +    //  This comparator is used to sort the units in a descending order. Therefore, we return -1 if
        +    //  the left is bigger than right and so on.
        +    auto descendingCompareUnits = [](const void *context, const void *left, const void *right) {
        +        UErrorCode status = U_ZERO_ERROR;
        +
        +        const auto *leftPointer = static_cast(left);
        +        const auto *rightPointer = static_cast(right);
        +
        +        UnitConverter fromLeftToRight(**leftPointer,                                  //
        +                                      **rightPointer,                                 //
        +                                      *static_cast(context), //
        +                                      status);
        +
        +        double rightFromOneLeft = fromLeftToRight.convert(1.0);
        +        if (std::abs(rightFromOneLeft - 1.0) < 0.0000000001) { // Equals To
        +            return 0;
        +        } else if (rightFromOneLeft > 1.0) { // Greater Than
        +            return -1;
        +        }
        +
        +        return 1; // Less Than
        +    };
        +
        +    uprv_sortArray(units_.getAlias(),                                                                  //
        +                   units_.length(),                                                                    //
        +                   sizeof units_[0], /* NOTE: we have already asserted that the units_ is not empty.*/ //
        +                   descendingCompareUnits,                                                             //
        +                   &ratesInfo,                                                                         //
        +                   false,                                                                              //
        +                   &status                                                                             //
        +    );
        +
        +    // In case the `outputUnits` are `UMEASURE_UNIT_MIXED` such as `foot+inch`. In this case we need more
        +    // converters to convert from the `inputUnit` to the first unit in the `outputUnits`. Then, a
        +    // converter from the first unit in the `outputUnits` to the second unit and so on.
        +    //      For Example:
        +    //          - inputUnit is `meter`
        +    //          - outputUnits is `foot+inch`
        +    //              - Therefore, we need to have two converters:
        +    //                      1. a converter from `meter` to `foot`
        +    //                      2. a converter from `foot` to `inch`
        +    //          - Therefore, if the input is `2 meter`:
        +    //              1. convert `meter` to `foot` --> 2 meter to 6.56168 feet
        +    //              2. convert the residual of 6.56168 feet (0.56168) to inches, which will be (6.74016
        +    //              inches)
        +    //              3. then, the final result will be (6 feet and 6.74016 inches)
        +    for (int i = 0, n = units_.length(); i < n; i++) {
        +        if (i == 0) { // first element
        +            unitConverters_.emplaceBackAndCheckErrorCode(status, inputUnit, *units_[i], ratesInfo,
        +                                                         status);
        +        } else {
        +            unitConverters_.emplaceBackAndCheckErrorCode(status, *units_[i - 1], *units_[i], ratesInfo,
        +                                                         status);
        +        }
        +
        +        if (U_FAILURE(status)) {
        +            return;
        +        }
        +    }
        +}
        +
        +UBool ComplexUnitsConverter::greaterThanOrEqual(double quantity, double limit) const {
        +    U_ASSERT(unitConverters_.length() > 0);
        +
        +    // First converter converts to the biggest quantity.
        +    double newQuantity = unitConverters_[0]->convert(quantity);
        +    return newQuantity >= limit;
        +}
        +
        +MaybeStackVector ComplexUnitsConverter::convert(double quantity,
        +                                                         icu::number::impl::RoundingImpl *rounder,
        +                                                         UErrorCode &status) const {
        +    // TODO(hugovdm): return an error for "foot-and-foot"?
        +    MaybeStackVector result;
        +    int sign = 1;
        +    if (quantity < 0) {
        +        quantity *= -1;
        +        sign = -1;
        +    }
        +
        +    // For N converters:
        +    // - the first converter converts from the input unit to the largest unit,
        +    // - N-1 converters convert to bigger units for which we want integers,
        +    // - the Nth converter (index N-1) converts to the smallest unit, for which
        +    //   we keep a double.
        +    MaybeStackArray intValues(unitConverters_.length() - 1, status);
        +    if (U_FAILURE(status)) {
        +        return result;
        +    }
        +    uprv_memset(intValues.getAlias(), 0, (unitConverters_.length() - 1) * sizeof(int64_t));
        +
        +    for (int i = 0, n = unitConverters_.length(); i < n; ++i) {
        +        quantity = (*unitConverters_[i]).convert(quantity);
        +        if (i < n - 1) {
        +            // The double type has 15 decimal digits of precision. For choosing
        +            // whether to use the current unit or the next smaller unit, we
        +            // therefore nudge up the number with which the thresholding
        +            // decision is made. However after the thresholding, we use the
        +            // original values to ensure unbiased accuracy (to the extent of
        +            // double's capabilities).
        +            int64_t roundedQuantity = floor(quantity * (1 + DBL_EPSILON));
        +            intValues[i] = roundedQuantity;
        +
        +            // Keep the residual of the quantity.
        +            //   For example: `3.6 feet`, keep only `0.6 feet`
        +            //
        +            // When the calculation is near enough +/- DBL_EPSILON, we round to
        +            // zero. (We also ensure no negative values here.)
        +            if ((quantity - roundedQuantity) / quantity < DBL_EPSILON) {
        +                quantity = 0;
        +            } else {
        +                quantity -= roundedQuantity;
        +            }
        +        } else { // LAST ELEMENT
        +            if (rounder == nullptr) {
        +                // Nothing to do for the last element.
        +                break;
        +            }
        +
        +            // Round the last value
        +            // TODO(ICU-21288): get smarter about precision for mixed units.
        +            number::impl::DecimalQuantity quant;
        +            quant.setToDouble(quantity);
        +            rounder->apply(quant, status);
        +            if (U_FAILURE(status)) {
        +                return result;
        +            }
        +            quantity = quant.toDouble();
        +            if (i == 0) {
        +                // Last element is also the first element, so we're done
        +                break;
        +            }
        +
        +            // Check if there's a carry, and bubble it back up the resulting intValues.
        +            int64_t carry = floor(unitConverters_[i]->convertInverse(quantity) * (1 + DBL_EPSILON));
        +            if (carry <= 0) {
        +                break;
        +            }
        +            quantity -= unitConverters_[i]->convert(carry);
        +            intValues[i - 1] += carry;
        +
        +            // We don't use the first converter: that one is for the input unit
        +            for (int32_t j = i - 1; j > 0; j--) {
        +                carry = floor(unitConverters_[j]->convertInverse(intValues[j]) * (1 + DBL_EPSILON));
        +                if (carry <= 0) {
        +                    break;
        +                }
        +                intValues[j] -= round(unitConverters_[j]->convert(carry));
        +                intValues[j - 1] += carry;
        +            }
        +        }
        +    }
        +
        +    // Package values into Measure instances in result:
        +    for (int i = 0, n = unitConverters_.length(); i < n; ++i) {
        +        if (i < n - 1) {
        +            Formattable formattableQuantity(intValues[i] * sign);
        +            // Measure takes ownership of the MeasureUnit*
        +            MeasureUnit *type = new MeasureUnit(units_[i]->copy(status).build(status));
        +            if (result.emplaceBackAndCheckErrorCode(status, formattableQuantity, type, status) ==
        +                nullptr) {
        +                // Ownership wasn't taken
        +                U_ASSERT(U_FAILURE(status));
        +                delete type;
        +            }
        +            if (U_FAILURE(status)) {
        +                return result;
        +            }
        +        } else { // LAST ELEMENT
        +            // Add the last element, not an integer:
        +            Formattable formattableQuantity(quantity * sign);
        +            // Measure takes ownership of the MeasureUnit*
        +            MeasureUnit *type = new MeasureUnit(units_[i]->copy(status).build(status));
        +            if (result.emplaceBackAndCheckErrorCode(status, formattableQuantity, type, status) ==
        +                nullptr) {
        +                // Ownership wasn't taken
        +                U_ASSERT(U_FAILURE(status));
        +                delete type;
        +            }
        +            if (U_FAILURE(status)) {
        +                return result;
        +            }
        +            U_ASSERT(result.length() == i + 1);
        +            U_ASSERT(result[i] != nullptr);
        +        }
        +    }
        +
        +    MaybeStackVector orderedResult;
        +    int32_t unitsCount = outputUnits_.length();
        +    U_ASSERT(unitsCount == units_.length());
        +    Measure **arr = result.getAlias();
        +    // O(N^2) is fine: mixed units' unitsCount is usually 2 or 3.
        +    for (int32_t i = 0; i < unitsCount; i++) {
        +        for (int32_t j = i; j < unitsCount; j++) {
        +            // Find the next expected unit, and swap it into place.
        +            U_ASSERT(result[j] != nullptr);
        +            if (result[j]->getUnit() == *outputUnits_[i]) {
        +                if (j != i) {
        +                    Measure *tmp = arr[j];
        +                    arr[j] = arr[i];
        +                    arr[i] = tmp;
        +                }
        +            }
        +        }
        +    }
        +
        +    return result;
        +}
        +
        +} // namespace units
        +U_NAMESPACE_END
        +
        +#endif /* #if !UCONFIG_NO_FORMATTING */
        diff --git a/deps/icu-small/source/i18n/units_complexconverter.h b/deps/icu-small/source/i18n/units_complexconverter.h
        new file mode 100644
        index 00000000000000..83c5b94342f373
        --- /dev/null
        +++ b/deps/icu-small/source/i18n/units_complexconverter.h
        @@ -0,0 +1,93 @@
        +// © 2020 and later: Unicode, Inc. and others.
        +// License & terms of use: http://www.unicode.org/copyright.html
        +
        +#include "unicode/utypes.h"
        +
        +#if !UCONFIG_NO_FORMATTING
        +#ifndef __UNITS_COMPLEXCONVERTER_H__
        +#define __UNITS_COMPLEXCONVERTER_H__
        +
        +#include "cmemory.h"
        +#include "measunit_impl.h"
        +#include "number_roundingutils.h"
        +#include "unicode/errorcode.h"
        +#include "unicode/measure.h"
        +#include "units_converter.h"
        +#include "units_data.h"
        +
        +U_NAMESPACE_BEGIN
        +
        +// Export explicit template instantiations of MaybeStackArray, MemoryPool and
        +// MaybeStackVector. This is required when building DLLs for Windows. (See
        +// datefmt.h, collationiterator.h, erarules.h and others for similar examples.)
        +//
        +// Note: These need to be outside of the units namespace, or Clang will generate
        +// a compile error.
        +#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
        +template class U_I18N_API MaybeStackArray;
        +template class U_I18N_API MemoryPool;
        +template class U_I18N_API MaybeStackVector;
        +template class U_I18N_API MaybeStackArray;
        +template class U_I18N_API MemoryPool;
        +template class U_I18N_API MaybeStackVector;
        +template class U_I18N_API MaybeStackArray;
        +template class U_I18N_API MemoryPool;
        +template class U_I18N_API MaybeStackVector;
        +#endif
        +
        +namespace units {
        +
        +/**
        + *  Converts from single or compound unit to single, compound or mixed units.
        + * For example, from `meter` to `foot+inch`.
        + *
        + *  DESIGN:
        + *    This class uses `UnitConverter` in order to perform the single converter (i.e. converters from a
        + *    single unit to another single unit). Therefore, `ComplexUnitsConverter` class contains multiple
        + *    instances of the `UnitConverter` to perform the conversion.
        + */
        +class U_I18N_API ComplexUnitsConverter : public UMemory {
        +  public:
        +    /**
        +     * Constructor of `ComplexUnitsConverter`.
        +     * NOTE:
        +     *   - inputUnit and outputUnits must be under the same category
        +     *      - e.g. meter to feet and inches --> all of them are length units.
        +     *
        +     * @param inputUnit represents the source unit. (should be single or compound unit).
        +     * @param outputUnits represents the output unit. could be any type. (single, compound or mixed).
        +     * @param status
        +     */
        +    ComplexUnitsConverter(const MeasureUnitImpl &inputUnit, const MeasureUnitImpl &outputUnits,
        +                          const ConversionRates &ratesInfo, UErrorCode &status);
        +
        +    // Returns true if the specified `quantity` of the `inputUnit`, expressed in terms of the biggest
        +    // unit in the MeasureUnit `outputUnit`, is greater than or equal to `limit`.
        +    //    For example, if the input unit is `meter` and the target unit is `foot+inch`. Therefore, this
        +    //    function will convert the `quantity` from `meter` to `foot`, then, it will compare the value in
        +    //    `foot` with the `limit`.
        +    UBool greaterThanOrEqual(double quantity, double limit) const;
        +
        +    // Returns outputMeasures which is an array with the corresponding values.
        +    //    - E.g. converting meters to feet and inches.
        +    //                  1 meter --> 3 feet, 3.3701 inches
        +    //         NOTE:
        +    //           the smallest element is the only element that could have fractional values. And all
        +    //           other elements are floored to the nearest integer
        +    MaybeStackVector
        +    convert(double quantity, icu::number::impl::RoundingImpl *rounder, UErrorCode &status) const;
        +
        +  private:
        +    MaybeStackVector unitConverters_;
        +    // Individual units of mixed units, sorted big to small
        +    MaybeStackVector units_;
        +    // Individual units of mixed units, sorted in desired output order
        +    MaybeStackVector outputUnits_;
        +};
        +
        +} // namespace units
        +U_NAMESPACE_END
        +
        +#endif //__UNITS_COMPLEXCONVERTER_H__
        +
        +#endif /* #if !UCONFIG_NO_FORMATTING */
        diff --git a/deps/icu-small/source/i18n/units_converter.cpp b/deps/icu-small/source/i18n/units_converter.cpp
        new file mode 100644
        index 00000000000000..a777d026b98756
        --- /dev/null
        +++ b/deps/icu-small/source/i18n/units_converter.cpp
        @@ -0,0 +1,546 @@
        +// © 2020 and later: Unicode, Inc. and others.
        +// License & terms of use: http://www.unicode.org/copyright.html
        +
        +#include "unicode/utypes.h"
        +
        +#if !UCONFIG_NO_FORMATTING
        +
        +#include "charstr.h"
        +#include "cmemory.h"
        +#include "double-conversion-string-to-double.h"
        +#include "measunit_impl.h"
        +#include "uassert.h"
        +#include "unicode/errorcode.h"
        +#include "unicode/localpointer.h"
        +#include "unicode/stringpiece.h"
        +#include "units_converter.h"
        +#include 
        +#include 
        +#include 
        +#include 
        +
        +U_NAMESPACE_BEGIN
        +namespace units {
        +
        +void U_I18N_API Factor::multiplyBy(const Factor &rhs) {
        +    factorNum *= rhs.factorNum;
        +    factorDen *= rhs.factorDen;
        +    for (int i = 0; i < CONSTANTS_COUNT; i++) {
        +        constants[i] += rhs.constants[i];
        +    }
        +
        +    // NOTE
        +    //  We need the offset when the source and the target are simple units. e.g. the source is
        +    //  celsius and the target is Fahrenheit. Therefore, we just keep the value using `std::max`.
        +    offset = std::max(rhs.offset, offset);
        +}
        +
        +void U_I18N_API Factor::divideBy(const Factor &rhs) {
        +    factorNum *= rhs.factorDen;
        +    factorDen *= rhs.factorNum;
        +    for (int i = 0; i < CONSTANTS_COUNT; i++) {
        +        constants[i] -= rhs.constants[i];
        +    }
        +
        +    // NOTE
        +    //  We need the offset when the source and the target are simple units. e.g. the source is
        +    //  celsius and the target is Fahrenheit. Therefore, we just keep the value using `std::max`.
        +    offset = std::max(rhs.offset, offset);
        +}
        +
        +void U_I18N_API Factor::power(int32_t power) {
        +    // multiply all the constant by the power.
        +    for (int i = 0; i < CONSTANTS_COUNT; i++) {
        +        constants[i] *= power;
        +    }
        +
        +    bool shouldFlip = power < 0; // This means that after applying the absolute power, we should flip
        +                                 // the Numerator and Denominator.
        +
        +    factorNum = std::pow(factorNum, std::abs(power));
        +    factorDen = std::pow(factorDen, std::abs(power));
        +
        +    if (shouldFlip) {
        +        // Flip Numerator and Denominator.
        +        std::swap(factorNum, factorDen);
        +    }
        +}
        +
        +void U_I18N_API Factor::flip() {
        +    std::swap(factorNum, factorDen);
        +
        +    for (int i = 0; i < CONSTANTS_COUNT; i++) {
        +        constants[i] *= -1;
        +    }
        +}
        +
        +void U_I18N_API Factor::applySiPrefix(UMeasureSIPrefix siPrefix) {
        +    if (siPrefix == UMeasureSIPrefix::UMEASURE_SI_PREFIX_ONE) return; // No need to do anything
        +
        +    double siApplied = std::pow(10.0, std::abs(siPrefix));
        +
        +    if (siPrefix < 0) {
        +        factorDen *= siApplied;
        +        return;
        +    }
        +
        +    factorNum *= siApplied;
        +}
        +
        +void U_I18N_API Factor::substituteConstants() {
        +    for (int i = 0; i < CONSTANTS_COUNT; i++) {
        +        if (this->constants[i] == 0) {
        +            continue;
        +        }
        +
        +        auto absPower = std::abs(this->constants[i]);
        +        Signum powerSig = this->constants[i] < 0 ? Signum::NEGATIVE : Signum::POSITIVE;
        +        double absConstantValue = std::pow(constantsValues[i], absPower);
        +
        +        if (powerSig == Signum::NEGATIVE) {
        +            this->factorDen *= absConstantValue;
        +        } else {
        +            this->factorNum *= absConstantValue;
        +        }
        +
        +        this->constants[i] = 0;
        +    }
        +}
        +
        +namespace {
        +
        +/* Helpers */
        +
        +using icu::double_conversion::StringToDoubleConverter;
        +
        +// TODO: Make this a shared-utility function.
        +// Returns `double` from a scientific number(i.e. "1", "2.01" or "3.09E+4")
        +double strToDouble(StringPiece strNum, UErrorCode &status) {
        +    // We are processing well-formed input, so we don't need any special options to
        +    // StringToDoubleConverter.
        +    StringToDoubleConverter converter(0, 0, 0, "", "");
        +    int32_t count;
        +    double result = converter.StringToDouble(strNum.data(), strNum.length(), &count);
        +    if (count != strNum.length()) {
        +        status = U_INVALID_FORMAT_ERROR;
        +    }
        +
        +    return result;
        +}
        +
        +// Returns `double` from a scientific number that could has a division sign (i.e. "1", "2.01", "3.09E+4"
        +// or "2E+2/3")
        +double strHasDivideSignToDouble(StringPiece strWithDivide, UErrorCode &status) {
        +    int divisionSignInd = -1;
        +    for (int i = 0, n = strWithDivide.length(); i < n; ++i) {
        +        if (strWithDivide.data()[i] == '/') {
        +            divisionSignInd = i;
        +            break;
        +        }
        +    }
        +
        +    if (divisionSignInd >= 0) {
        +        return strToDouble(strWithDivide.substr(0, divisionSignInd), status) /
        +               strToDouble(strWithDivide.substr(divisionSignInd + 1), status);
        +    }
        +
        +    return strToDouble(strWithDivide, status);
        +}
        +
        +/*
        +  Adds single factor to a `Factor` object. Single factor means "23^2", "23.3333", "ft2m^3" ...etc.
        +  However, complex factor are not included, such as "ft2m^3*200/3"
        +*/
        +void addFactorElement(Factor &factor, StringPiece elementStr, Signum signum, UErrorCode &status) {
        +    StringPiece baseStr;
        +    StringPiece powerStr;
        +    int32_t power =
        +        1; // In case the power is not written, then, the power is equal 1 ==> `ft2m^1` == `ft2m`
        +
        +    // Search for the power part
        +    int32_t powerInd = -1;
        +    for (int32_t i = 0, n = elementStr.length(); i < n; ++i) {
        +        if (elementStr.data()[i] == '^') {
        +            powerInd = i;
        +            break;
        +        }
        +    }
        +
        +    if (powerInd > -1) {
        +        // There is power
        +        baseStr = elementStr.substr(0, powerInd);
        +        powerStr = elementStr.substr(powerInd + 1);
        +
        +        power = static_cast(strToDouble(powerStr, status));
        +    } else {
        +        baseStr = elementStr;
        +    }
        +
        +    addSingleFactorConstant(baseStr, power, signum, factor, status);
        +}
        +
        +/*
        + * Extracts `Factor` from a complete string factor. e.g. "ft2m^3*1007/cup2m3*3"
        + */
        +Factor extractFactorConversions(StringPiece stringFactor, UErrorCode &status) {
        +    Factor result;
        +    Signum signum = Signum::POSITIVE;
        +    auto factorData = stringFactor.data();
        +    for (int32_t i = 0, start = 0, n = stringFactor.length(); i < n; i++) {
        +        if (factorData[i] == '*' || factorData[i] == '/') {
        +            StringPiece factorElement = stringFactor.substr(start, i - start);
        +            addFactorElement(result, factorElement, signum, status);
        +
        +            start = i + 1; // Set `start` to point to the start of the new element.
        +        } else if (i == n - 1) {
        +            // Last element
        +            addFactorElement(result, stringFactor.substr(start, i + 1), signum, status);
        +        }
        +
        +        if (factorData[i] == '/') {
        +            signum = Signum::NEGATIVE; // Change the signum because we reached the Denominator.
        +        }
        +    }
        +
        +    return result;
        +}
        +
        +// Load factor for a single source
        +Factor loadSingleFactor(StringPiece source, const ConversionRates &ratesInfo, UErrorCode &status) {
        +    const auto conversionUnit = ratesInfo.extractConversionInfo(source, status);
        +    if (U_FAILURE(status)) return Factor();
        +    if (conversionUnit == nullptr) {
        +        status = U_INTERNAL_PROGRAM_ERROR;
        +        return Factor();
        +    }
        +
        +    Factor result = extractFactorConversions(conversionUnit->factor.toStringPiece(), status);
        +    result.offset = strHasDivideSignToDouble(conversionUnit->offset.toStringPiece(), status);
        +
        +    return result;
        +}
        +
        +// Load Factor of a compound source unit.
        +Factor loadCompoundFactor(const MeasureUnitImpl &source, const ConversionRates &ratesInfo,
        +                          UErrorCode &status) {
        +
        +    Factor result;
        +    for (int32_t i = 0, n = source.units.length(); i < n; i++) {
        +        SingleUnitImpl singleUnit = *source.units[i];
        +
        +        Factor singleFactor = loadSingleFactor(singleUnit.getSimpleUnitID(), ratesInfo, status);
        +        if (U_FAILURE(status)) return result;
        +
        +        // Apply SiPrefix before the power, because the power may be will flip the factor.
        +        singleFactor.applySiPrefix(singleUnit.siPrefix);
        +
        +        // Apply the power of the `dimensionality`
        +        singleFactor.power(singleUnit.dimensionality);
        +
        +        result.multiplyBy(singleFactor);
        +    }
        +
        +    return result;
        +}
        +
        +/**
        + * Checks if the source unit and the target unit are simple. For example celsius or fahrenheit. But not
        + * square-celsius or square-fahrenheit.
        + *
        + * NOTE:
        + *  Empty unit means simple unit.
        + */
        +UBool checkSimpleUnit(const MeasureUnitImpl &unit, UErrorCode &status) {
        +    if (U_FAILURE(status)) return false;
        +
        +    if (unit.complexity != UMEASURE_UNIT_SINGLE) {
        +        return false;
        +    }
        +    if (unit.units.length() == 0) {
        +        // Empty units means simple unit.
        +        return true;
        +    }
        +
        +    auto singleUnit = *(unit.units[0]);
        +
        +    if (singleUnit.dimensionality != 1 || singleUnit.siPrefix != UMEASURE_SI_PREFIX_ONE) {
        +        return false;
        +    }
        +
        +    return true;
        +}
        +
        +/**
        + *  Extract conversion rate from `source` to `target`
        + */
        +void loadConversionRate(ConversionRate &conversionRate, const MeasureUnitImpl &source,
        +                        const MeasureUnitImpl &target, Convertibility unitsState,
        +                        const ConversionRates &ratesInfo, UErrorCode &status) {
        +    // Represents the conversion factor from the source to the target.
        +    Factor finalFactor;
        +
        +    // Represents the conversion factor from the source to the base unit that specified in the conversion
        +    // data which is considered as the root of the source and the target.
        +    Factor sourceToBase = loadCompoundFactor(source, ratesInfo, status);
        +    Factor targetToBase = loadCompoundFactor(target, ratesInfo, status);
        +
        +    // Merger Factors
        +    finalFactor.multiplyBy(sourceToBase);
        +    if (unitsState == Convertibility::CONVERTIBLE) {
        +        finalFactor.divideBy(targetToBase);
        +    } else if (unitsState == Convertibility::RECIPROCAL) {
        +        finalFactor.multiplyBy(targetToBase);
        +    } else {
        +        status = UErrorCode::U_ARGUMENT_TYPE_MISMATCH;
        +        return;
        +    }
        +
        +    finalFactor.substituteConstants();
        +
        +    conversionRate.factorNum = finalFactor.factorNum;
        +    conversionRate.factorDen = finalFactor.factorDen;
        +
        +    // In case of simple units (such as: celsius or fahrenheit), offsets are considered.
        +    if (checkSimpleUnit(source, status) && checkSimpleUnit(target, status)) {
        +        conversionRate.sourceOffset =
        +            sourceToBase.offset * sourceToBase.factorDen / sourceToBase.factorNum;
        +        conversionRate.targetOffset =
        +            targetToBase.offset * targetToBase.factorDen / targetToBase.factorNum;
        +    }
        +
        +    conversionRate.reciprocal = unitsState == Convertibility::RECIPROCAL;
        +}
        +
        +struct UnitIndexAndDimension : UMemory {
        +    int32_t index = 0;
        +    int32_t dimensionality = 0;
        +
        +    UnitIndexAndDimension(const SingleUnitImpl &singleUnit, int32_t multiplier) {
        +        index = singleUnit.index;
        +        dimensionality = singleUnit.dimensionality * multiplier;
        +    }
        +};
        +
        +void mergeSingleUnitWithDimension(MaybeStackVector &unitIndicesWithDimension,
        +                                  const SingleUnitImpl &shouldBeMerged, int32_t multiplier) {
        +    for (int32_t i = 0; i < unitIndicesWithDimension.length(); i++) {
        +        auto &unitWithIndex = *unitIndicesWithDimension[i];
        +        if (unitWithIndex.index == shouldBeMerged.index) {
        +            unitWithIndex.dimensionality += shouldBeMerged.dimensionality * multiplier;
        +            return;
        +        }
        +    }
        +
        +    unitIndicesWithDimension.emplaceBack(shouldBeMerged, multiplier);
        +}
        +
        +void mergeUnitsAndDimensions(MaybeStackVector &unitIndicesWithDimension,
        +                             const MeasureUnitImpl &shouldBeMerged, int32_t multiplier) {
        +    for (int32_t unit_i = 0; unit_i < shouldBeMerged.units.length(); unit_i++) {
        +        auto singleUnit = *shouldBeMerged.units[unit_i];
        +        mergeSingleUnitWithDimension(unitIndicesWithDimension, singleUnit, multiplier);
        +    }
        +}
        +
        +UBool checkAllDimensionsAreZeros(const MaybeStackVector &dimensionVector) {
        +    for (int32_t i = 0; i < dimensionVector.length(); i++) {
        +        if (dimensionVector[i]->dimensionality != 0) {
        +            return false;
        +        }
        +    }
        +
        +    return true;
        +}
        +
        +} // namespace
        +
        +// Conceptually, this modifies factor: factor *= baseStr^(signum*power).
        +//
        +// baseStr must be a known constant or a value that strToDouble() is able to
        +// parse.
        +void U_I18N_API addSingleFactorConstant(StringPiece baseStr, int32_t power, Signum signum,
        +                                        Factor &factor, UErrorCode &status) {
        +    if (baseStr == "ft_to_m") {
        +        factor.constants[CONSTANT_FT2M] += power * signum;
        +    } else if (baseStr == "ft2_to_m2") {
        +        factor.constants[CONSTANT_FT2M] += 2 * power * signum;
        +    } else if (baseStr == "ft3_to_m3") {
        +        factor.constants[CONSTANT_FT2M] += 3 * power * signum;
        +    } else if (baseStr == "in3_to_m3") {
        +        factor.constants[CONSTANT_FT2M] += 3 * power * signum;
        +        factor.factorDen *= 12 * 12 * 12;
        +    } else if (baseStr == "gal_to_m3") {
        +        factor.factorNum *= 231;
        +        factor.constants[CONSTANT_FT2M] += 3 * power * signum;
        +        factor.factorDen *= 12 * 12 * 12;
        +    } else if (baseStr == "gal_imp_to_m3") {
        +        factor.constants[CONSTANT_GAL_IMP2M3] += power * signum;
        +    } else if (baseStr == "G") {
        +        factor.constants[CONSTANT_G] += power * signum;
        +    } else if (baseStr == "gravity") {
        +        factor.constants[CONSTANT_GRAVITY] += power * signum;
        +    } else if (baseStr == "lb_to_kg") {
        +        factor.constants[CONSTANT_LB2KG] += power * signum;
        +    } else if (baseStr == "PI") {
        +        factor.constants[CONSTANT_PI] += power * signum;
        +    } else {
        +        if (signum == Signum::NEGATIVE) {
        +            factor.factorDen *= std::pow(strToDouble(baseStr, status), power);
        +        } else {
        +            factor.factorNum *= std::pow(strToDouble(baseStr, status), power);
        +        }
        +    }
        +}
        +
        +/**
        + * Extracts the compound base unit of a compound unit (`source`). For example, if the source unit is
        + * `square-mile-per-hour`, the compound base unit will be `square-meter-per-second`
        + */
        +MeasureUnitImpl U_I18N_API extractCompoundBaseUnit(const MeasureUnitImpl &source,
        +                                                   const ConversionRates &conversionRates,
        +                                                   UErrorCode &status) {
        +
        +    MeasureUnitImpl result;
        +    if (U_FAILURE(status)) return result;
        +
        +    const auto &singleUnits = source.units;
        +    for (int i = 0, count = singleUnits.length(); i < count; ++i) {
        +        const auto &singleUnit = *singleUnits[i];
        +        // Extract `ConversionRateInfo` using the absolute unit. For example: in case of `square-meter`,
        +        // we will use `meter`
        +        const auto rateInfo =
        +            conversionRates.extractConversionInfo(singleUnit.getSimpleUnitID(), status);
        +        if (U_FAILURE(status)) {
        +            return result;
        +        }
        +        if (rateInfo == nullptr) {
        +            status = U_INTERNAL_PROGRAM_ERROR;
        +            return result;
        +        }
        +
        +        // Multiply the power of the singleUnit by the power of the baseUnit. For example, square-hectare
        +        // must be pow4-meter. (NOTE: hectare --> square-meter)
        +        auto baseUnits =
        +            MeasureUnitImpl::forIdentifier(rateInfo->baseUnit.toStringPiece(), status).units;
        +        for (int32_t i = 0, baseUnitsCount = baseUnits.length(); i < baseUnitsCount; i++) {
        +            baseUnits[i]->dimensionality *= singleUnit.dimensionality;
        +            // TODO: Deal with SI-prefix
        +            result.append(*baseUnits[i], status);
        +
        +            if (U_FAILURE(status)) {
        +                return result;
        +            }
        +        }
        +    }
        +
        +    return result;
        +}
        +
        +/**
        + * Determine the convertibility between `source` and `target`.
        + * For example:
        + *    `meter` and `foot` are `CONVERTIBLE`.
        + *    `meter-per-second` and `second-per-meter` are `RECIPROCAL`.
        + *    `meter` and `pound` are `UNCONVERTIBLE`.
        + *
        + * NOTE:
        + *    Only works with SINGLE and COMPOUND units. If one of the units is a
        + *    MIXED unit, an error will occur. For more information, see UMeasureUnitComplexity.
        + */
        +Convertibility U_I18N_API extractConvertibility(const MeasureUnitImpl &source,
        +                                                const MeasureUnitImpl &target,
        +                                                const ConversionRates &conversionRates,
        +                                                UErrorCode &status) {
        +
        +    if (source.complexity == UMeasureUnitComplexity::UMEASURE_UNIT_MIXED ||
        +        target.complexity == UMeasureUnitComplexity::UMEASURE_UNIT_MIXED) {
        +        status = U_INTERNAL_PROGRAM_ERROR;
        +        return UNCONVERTIBLE;
        +    }
        +
        +    MeasureUnitImpl sourceBaseUnit = extractCompoundBaseUnit(source, conversionRates, status);
        +    MeasureUnitImpl targetBaseUnit = extractCompoundBaseUnit(target, conversionRates, status);
        +    if (U_FAILURE(status)) return UNCONVERTIBLE;
        +
        +    MaybeStackVector convertible;
        +    MaybeStackVector reciprocal;
        +
        +    mergeUnitsAndDimensions(convertible, sourceBaseUnit, 1);
        +    mergeUnitsAndDimensions(reciprocal, sourceBaseUnit, 1);
        +
        +    mergeUnitsAndDimensions(convertible, targetBaseUnit, -1);
        +    mergeUnitsAndDimensions(reciprocal, targetBaseUnit, 1);
        +
        +    if (checkAllDimensionsAreZeros(convertible)) {
        +        return CONVERTIBLE;
        +    }
        +
        +    if (checkAllDimensionsAreZeros(reciprocal)) {
        +        return RECIPROCAL;
        +    }
        +
        +    return UNCONVERTIBLE;
        +}
        +
        +UnitConverter::UnitConverter(const MeasureUnitImpl &source, const MeasureUnitImpl &target,
        +                             const ConversionRates &ratesInfo, UErrorCode &status)
        +    : conversionRate_(source.copy(status), target.copy(status)) {
        +    if (source.complexity == UMeasureUnitComplexity::UMEASURE_UNIT_MIXED ||
        +        target.complexity == UMeasureUnitComplexity::UMEASURE_UNIT_MIXED) {
        +        status = U_INTERNAL_PROGRAM_ERROR;
        +        return;
        +    }
        +
        +    Convertibility unitsState = extractConvertibility(source, target, ratesInfo, status);
        +    if (U_FAILURE(status)) return;
        +    if (unitsState == Convertibility::UNCONVERTIBLE) {
        +        status = U_INTERNAL_PROGRAM_ERROR;
        +        return;
        +    }
        +
        +    loadConversionRate(conversionRate_, conversionRate_.source, conversionRate_.target, unitsState,
        +                       ratesInfo, status);
        +}
        +
        +double UnitConverter::convert(double inputValue) const {
        +    double result =
        +        inputValue + conversionRate_.sourceOffset; // Reset the input to the target zero index.
        +    // Convert the quantity to from the source scale to the target scale.
        +    result *= conversionRate_.factorNum / conversionRate_.factorDen;
        +
        +    result -= conversionRate_.targetOffset; // Set the result to its index.
        +
        +    if (conversionRate_.reciprocal) {
        +        if (result == 0) {
        +            // TODO: demonstrate the resulting behaviour in tests... and figure
        +            // out desired behaviour. (Theoretical result should be infinity,
        +            // not 0.)
        +            return 0.0;
        +        }
        +        result = 1.0 / result;
        +    }
        +
        +    return result;
        +}
        +
        +double UnitConverter::convertInverse(double inputValue) const {
        +    double result = inputValue;
        +    if (conversionRate_.reciprocal) {
        +        if (result == 0) {
        +            // TODO: demonstrate the resulting behaviour in tests... and figure
        +            // out desired behaviour. (Theoretical result should be infinity,
        +            // not 0.)
        +            return 0.0;
        +        }
        +        result = 1.0 / result;
        +    }
        +    result += conversionRate_.targetOffset;
        +    result *= conversionRate_.factorDen / conversionRate_.factorNum;
        +    result -= conversionRate_.sourceOffset;
        +    return result;
        +}
        +
        +} // namespace units
        +U_NAMESPACE_END
        +
        +#endif /* #if !UCONFIG_NO_FORMATTING */
        diff --git a/deps/icu-small/source/i18n/units_converter.h b/deps/icu-small/source/i18n/units_converter.h
        new file mode 100644
        index 00000000000000..7650131b1f6975
        --- /dev/null
        +++ b/deps/icu-small/source/i18n/units_converter.h
        @@ -0,0 +1,173 @@
        +// © 2020 and later: Unicode, Inc. and others.
        +// License & terms of use: http://www.unicode.org/copyright.html
        +
        +#include "unicode/utypes.h"
        +
        +#if !UCONFIG_NO_FORMATTING
        +#ifndef __UNITS_CONVERTER_H__
        +#define __UNITS_CONVERTER_H__
        +
        +#include "cmemory.h"
        +#include "measunit_impl.h"
        +#include "unicode/errorcode.h"
        +#include "unicode/stringpiece.h"
        +#include "unicode/uobject.h"
        +#include "units_converter.h"
        +#include "units_data.h"
        +
        +U_NAMESPACE_BEGIN
        +namespace units {
        +
        +/* Internal Structure */
        +
        +enum Constants {
        +    CONSTANT_FT2M,    // ft2m stands for foot to meter.
        +    CONSTANT_PI,      // PI
        +    CONSTANT_GRAVITY, // Gravity
        +    CONSTANT_G,
        +    CONSTANT_GAL_IMP2M3, // Gallon imp to m3
        +    CONSTANT_LB2KG,      // Pound to Kilogram
        +
        +    // Must be the last element.
        +    CONSTANTS_COUNT
        +};
        +
        +// These values are a hard-coded subset of unitConstants in the units
        +// resources file. A unit test checks that all constants in the resource
        +// file are at least recognised by the code. Derived constants' values or
        +// hard-coded derivations are not checked.
        +static const double constantsValues[CONSTANTS_COUNT] = {
        +    0.3048,                    // CONSTANT_FT2M
        +    411557987.0 / 131002976.0, // CONSTANT_PI
        +    9.80665,                   // CONSTANT_GRAVITY
        +    6.67408E-11,               // CONSTANT_G
        +    0.00454609,                // CONSTANT_GAL_IMP2M3
        +    0.45359237,                // CONSTANT_LB2KG
        +};
        +
        +typedef enum Signum {
        +    NEGATIVE = -1,
        +    POSITIVE = 1,
        +} Signum;
        +
        +/* Represents a conversion factor */
        +struct U_I18N_API Factor {
        +    double factorNum = 1;
        +    double factorDen = 1;
        +    double offset = 0;
        +    bool reciprocal = false;
        +    int32_t constants[CONSTANTS_COUNT] = {};
        +
        +    void multiplyBy(const Factor &rhs);
        +    void divideBy(const Factor &rhs);
        +
        +    // Apply the power to the factor.
        +    void power(int32_t power);
        +
        +    // Flip the `Factor`, for example, factor= 2/3, flippedFactor = 3/2
        +    void flip();
        +
        +    // Apply SI prefix to the `Factor`
        +    void applySiPrefix(UMeasureSIPrefix siPrefix);
        +    void substituteConstants();
        +};
        +
        +/*
        + * Adds a single factor element to the `Factor`. e.g "ft3m", "2.333" or "cup2m3". But not "cup2m3^3".
        + */
        +void U_I18N_API addSingleFactorConstant(StringPiece baseStr, int32_t power, Signum sigNum,
        +                                        Factor &factor, UErrorCode &status);
        +
        +/**
        + * Represents the conversion rate between `source` and `target`.
        + */
        +struct U_I18N_API ConversionRate : public UMemory {
        +    const MeasureUnitImpl source;
        +    const MeasureUnitImpl target;
        +    double factorNum = 1;
        +    double factorDen = 1;
        +    double sourceOffset = 0;
        +    double targetOffset = 0;
        +    bool reciprocal = false;
        +
        +    ConversionRate(MeasureUnitImpl &&source, MeasureUnitImpl &&target)
        +        : source(std::move(source)), target(std::move(target)) {}
        +};
        +
        +enum Convertibility {
        +    RECIPROCAL,
        +    CONVERTIBLE,
        +    UNCONVERTIBLE,
        +};
        +
        +MeasureUnitImpl U_I18N_API extractCompoundBaseUnit(const MeasureUnitImpl &source,
        +                                                   const ConversionRates &conversionRates,
        +                                                   UErrorCode &status);
        +
        +/**
        + * Check if the convertibility between `source` and `target`.
        + * For example:
        + *    `meter` and `foot` are `CONVERTIBLE`.
        + *    `meter-per-second` and `second-per-meter` are `RECIPROCAL`.
        + *    `meter` and `pound` are `UNCONVERTIBLE`.
        + *
        + * NOTE:
        + *    Only works with SINGLE and COMPOUND units. If one of the units is a
        + *    MIXED unit, an error will occur. For more information, see UMeasureUnitComplexity.
        + */
        +Convertibility U_I18N_API extractConvertibility(const MeasureUnitImpl &source,
        +                                                const MeasureUnitImpl &target,
        +                                                const ConversionRates &conversionRates,
        +                                                UErrorCode &status);
        +
        +/**
        + * Converts from a source `MeasureUnit` to a target `MeasureUnit`.
        + *
        + * NOTE:
        + *    Only works with SINGLE and COMPOUND units. If one of the units is a
        + *    MIXED unit, an error will occur. For more information, see UMeasureUnitComplexity.
        + */
        +class U_I18N_API UnitConverter : public UMemory {
        +  public:
        +    /**
        +     * Constructor of `UnitConverter`.
        +     * NOTE:
        +     *   - source and target must be under the same category
        +     *      - e.g. meter to mile --> both of them are length units.
        +     *
        +     * @param source represents the source unit.
        +     * @param target represents the target unit.
        +     * @param ratesInfo Contains all the needed conversion rates.
        +     * @param status
        +     */
        +    UnitConverter(const MeasureUnitImpl &source, const MeasureUnitImpl &target,
        +                  const ConversionRates &ratesInfo, UErrorCode &status);
        +
        +    /**
        +     * Convert a measurement expressed in the source unit to a measurement
        +     * expressed in the target unit.
        +     *
        +     * @param inputValue the value to be converted.
        +     * @return the converted value.
        +     */
        +    double convert(double inputValue) const;
        +
        +    /**
        +     * The inverse of convert(): convert a measurement expressed in the target
        +     * unit to a measurement expressed in the source unit.
        +     *
        +     * @param inputValue the value to be converted.
        +     * @return the converted value.
        +     */
        +    double convertInverse(double inputValue) const;
        +
        +  private:
        +    ConversionRate conversionRate_;
        +};
        +
        +} // namespace units
        +U_NAMESPACE_END
        +
        +#endif //__UNITS_CONVERTER_H__
        +
        +#endif /* #if !UCONFIG_NO_FORMATTING */
        diff --git a/deps/icu-small/source/i18n/units_data.cpp b/deps/icu-small/source/i18n/units_data.cpp
        new file mode 100644
        index 00000000000000..42bd6248b0b26d
        --- /dev/null
        +++ b/deps/icu-small/source/i18n/units_data.cpp
        @@ -0,0 +1,428 @@
        +// © 2020 and later: Unicode, Inc. and others.
        +// License & terms of use: http://www.unicode.org/copyright.html
        +
        +#include "unicode/utypes.h"
        +
        +#if !UCONFIG_NO_FORMATTING
        +
        +#include "cstring.h"
        +#include "number_decimalquantity.h"
        +#include "resource.h"
        +#include "uassert.h"
        +#include "unicode/unistr.h"
        +#include "unicode/ures.h"
        +#include "units_data.h"
        +#include "uresimp.h"
        +#include "util.h"
        +#include 
        +
        +U_NAMESPACE_BEGIN
        +namespace units {
        +
        +namespace {
        +
        +using icu::number::impl::DecimalQuantity;
        +
        +void trimSpaces(CharString& factor, UErrorCode& status){
        +   CharString trimmed;
        +   for (int i = 0 ; i < factor.length(); i++) {
        +       if (factor[i] == ' ') continue;
        +
        +       trimmed.append(factor[i], status);
        +   }
        +
        +   factor = std::move(trimmed);
        +}
        +
        +/**
        + * A ResourceSink that collects conversion rate information.
        + *
        + * This class is for use by ures_getAllItemsWithFallback.
        + */
        +class ConversionRateDataSink : public ResourceSink {
        +  public:
        +    /**
        +     * Constructor.
        +     * @param out The vector to which ConversionRateInfo instances are to be
        +     * added. This vector must outlive the use of the ResourceSink.
        +     */
        +    explicit ConversionRateDataSink(MaybeStackVector *out) : outVector(out) {}
        +
        +    /**
        +     * Method for use by `ures_getAllItemsWithFallback`. Adds the unit
        +     * conversion rates that are found in `value` to the output vector.
        +     *
        +     * @param source This string must be "convertUnits": the resource that this
        +     * class supports reading.
        +     * @param value The "convertUnits" resource, containing unit conversion rate
        +     * information.
        +     * @param noFallback Ignored.
        +     * @param status The standard ICU error code output parameter.
        +     */
        +    void put(const char *source, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) {
        +        if (U_FAILURE(status)) { return; }
        +        if (uprv_strcmp(source, "convertUnits") != 0) {
        +            // This is very strict, however it is the cheapest way to be sure
        +            // that with `value`, we're looking at the convertUnits table.
        +            status = U_ILLEGAL_ARGUMENT_ERROR;
        +            return;
        +        }
        +        ResourceTable conversionRateTable = value.getTable(status);
        +        const char *srcUnit;
        +        // We're reusing `value`, which seems to be a common pattern:
        +        for (int32_t unit = 0; conversionRateTable.getKeyAndValue(unit, srcUnit, value); unit++) {
        +            ResourceTable unitTable = value.getTable(status);
        +            const char *key;
        +            UnicodeString baseUnit = ICU_Utility::makeBogusString();
        +            UnicodeString factor = ICU_Utility::makeBogusString();
        +            UnicodeString offset = ICU_Utility::makeBogusString();
        +            for (int32_t i = 0; unitTable.getKeyAndValue(i, key, value); i++) {
        +                if (uprv_strcmp(key, "target") == 0) {
        +                    baseUnit = value.getUnicodeString(status);
        +                } else if (uprv_strcmp(key, "factor") == 0) {
        +                    factor = value.getUnicodeString(status);
        +                } else if (uprv_strcmp(key, "offset") == 0) {
        +                    offset = value.getUnicodeString(status);
        +                }
        +            }
        +            if (U_FAILURE(status)) { return; }
        +            if (baseUnit.isBogus() || factor.isBogus()) {
        +                // We could not find a usable conversion rate: bad resource.
        +                status = U_MISSING_RESOURCE_ERROR;
        +                return;
        +            }
        +
        +            // We don't have this ConversionRateInfo yet: add it.
        +            ConversionRateInfo *cr = outVector->emplaceBack();
        +            if (!cr) {
        +                status = U_MEMORY_ALLOCATION_ERROR;
        +                return;
        +            } else {
        +                cr->sourceUnit.append(srcUnit, status);
        +                cr->baseUnit.appendInvariantChars(baseUnit, status);
        +                cr->factor.appendInvariantChars(factor, status);
        +                trimSpaces(cr->factor, status);
        +                if (!offset.isBogus()) cr->offset.appendInvariantChars(offset, status);
        +            }
        +        }
        +        return;
        +    }
        +
        +  private:
        +    MaybeStackVector *outVector;
        +};
        +
        +bool operator<(const UnitPreferenceMetadata &a, const UnitPreferenceMetadata &b) {
        +    return a.compareTo(b) < 0;
        +}
        +
        +/**
        + * A ResourceSink that collects unit preferences information.
        + *
        + * This class is for use by ures_getAllItemsWithFallback.
        + */
        +class UnitPreferencesSink : public ResourceSink {
        +  public:
        +    /**
        +     * Constructor.
        +     * @param outPrefs The vector to which UnitPreference instances are to be
        +     * added. This vector must outlive the use of the ResourceSink.
        +     * @param outMetadata  The vector to which UnitPreferenceMetadata instances
        +     * are to be added. This vector must outlive the use of the ResourceSink.
        +     */
        +    explicit UnitPreferencesSink(MaybeStackVector *outPrefs,
        +                                 MaybeStackVector *outMetadata)
        +        : preferences(outPrefs), metadata(outMetadata) {}
        +
        +    /**
        +     * Method for use by `ures_getAllItemsWithFallback`. Adds the unit
        +     * preferences info that are found in `value` to the output vector.
        +     *
        +     * @param source This string must be "unitPreferenceData": the resource that
        +     * this class supports reading.
        +     * @param value The "unitPreferenceData" resource, containing unit
        +     * preferences data.
        +     * @param noFallback Ignored.
        +     * @param status The standard ICU error code output parameter. Note: if an
        +     * error is returned, outPrefs and outMetadata may be inconsistent.
        +     */
        +    void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) {
        +        if (U_FAILURE(status)) { return; }
        +        if (uprv_strcmp(key, "unitPreferenceData") != 0) {
        +            // This is very strict, however it is the cheapest way to be sure
        +            // that with `value`, we're looking at the convertUnits table.
        +            status = U_ILLEGAL_ARGUMENT_ERROR;
        +            return;
        +        }
        +        // The unitPreferenceData structure (see data/misc/units.txt) contains a
        +        // hierarchy of category/usage/region, within which are a set of
        +        // preferences. Hence three for-loops and another loop for the
        +        // preferences themselves:
        +        ResourceTable unitPreferenceDataTable = value.getTable(status);
        +        const char *category;
        +        for (int32_t i = 0; unitPreferenceDataTable.getKeyAndValue(i, category, value); i++) {
        +            ResourceTable categoryTable = value.getTable(status);
        +            const char *usage;
        +            for (int32_t j = 0; categoryTable.getKeyAndValue(j, usage, value); j++) {
        +                ResourceTable regionTable = value.getTable(status);
        +                const char *region;
        +                for (int32_t k = 0; regionTable.getKeyAndValue(k, region, value); k++) {
        +                    // `value` now contains the set of preferences for
        +                    // category/usage/region.
        +                    ResourceArray unitPrefs = value.getArray(status);
        +                    if (U_FAILURE(status)) { return; }
        +                    int32_t prefLen = unitPrefs.getSize();
        +
        +                    // Update metadata for this set of preferences.
        +                    UnitPreferenceMetadata *meta = metadata->emplaceBack(
        +                        category, usage, region, preferences->length(), prefLen, status);
        +                    if (!meta) {
        +                        status = U_MEMORY_ALLOCATION_ERROR;
        +                        return;
        +                    }
        +                    if (U_FAILURE(status)) { return; }
        +                    if (metadata->length() > 1) {
        +                        // Verify that unit preferences are sorted and
        +                        // without duplicates.
        +                        if (!(*(*metadata)[metadata->length() - 2] <
        +                              *(*metadata)[metadata->length() - 1])) {
        +                            status = U_INVALID_FORMAT_ERROR;
        +                            return;
        +                        }
        +                    }
        +
        +                    // Collect the individual preferences.
        +                    for (int32_t i = 0; unitPrefs.getValue(i, value); i++) {
        +                        UnitPreference *up = preferences->emplaceBack();
        +                        if (!up) {
        +                            status = U_MEMORY_ALLOCATION_ERROR;
        +                            return;
        +                        }
        +                        ResourceTable unitPref = value.getTable(status);
        +                        if (U_FAILURE(status)) { return; }
        +                        for (int32_t i = 0; unitPref.getKeyAndValue(i, key, value); ++i) {
        +                            if (uprv_strcmp(key, "unit") == 0) {
        +                                int32_t length;
        +                                const UChar *u = value.getString(length, status);
        +                                up->unit.appendInvariantChars(u, length, status);
        +                            } else if (uprv_strcmp(key, "geq") == 0) {
        +                                int32_t length;
        +                                const UChar *g = value.getString(length, status);
        +                                CharString geq;
        +                                geq.appendInvariantChars(g, length, status);
        +                                DecimalQuantity dq;
        +                                dq.setToDecNumber(geq.data(), status);
        +                                up->geq = dq.toDouble();
        +                            } else if (uprv_strcmp(key, "skeleton") == 0) {
        +                                up->skeleton = value.getUnicodeString(status);
        +                            }
        +                        }
        +                    }
        +                }
        +            }
        +        }
        +    }
        +
        +  private:
        +    MaybeStackVector *preferences;
        +    MaybeStackVector *metadata;
        +};
        +
        +int32_t binarySearch(const MaybeStackVector *metadata,
        +                     const UnitPreferenceMetadata &desired, bool *foundCategory, bool *foundUsage,
        +                     bool *foundRegion, UErrorCode &status) {
        +    if (U_FAILURE(status)) { return -1; }
        +    int32_t start = 0;
        +    int32_t end = metadata->length();
        +    *foundCategory = false;
        +    *foundUsage = false;
        +    *foundRegion = false;
        +    while (start < end) {
        +        int32_t mid = (start + end) / 2;
        +        int32_t cmp = (*metadata)[mid]->compareTo(desired, foundCategory, foundUsage, foundRegion);
        +        if (cmp < 0) {
        +            start = mid + 1;
        +        } else if (cmp > 0) {
        +            end = mid;
        +        } else {
        +            return mid;
        +        }
        +    }
        +    return -1;
        +}
        +
        +/**
        + * Finds the UnitPreferenceMetadata instance that matches the given category,
        + * usage and region: if missing, region falls back to "001", and usage
        + * repeatedly drops tailing components, eventually trying "default"
        + * ("land-agriculture-grain" -> "land-agriculture" -> "land" -> "default").
        + *
        + * @param metadata The full list of UnitPreferenceMetadata instances.
        + * @param category The category to search for. See getUnitCategory().
        + * @param usage The usage for which formatting preferences is needed. If the
        + * given usage is not known, automatic fallback occurs, see function description
        + * above.
        + * @param region The region for which preferences are needed. If there are no
        + * region-specific preferences, this function automatically falls back to the
        + * "001" region (global).
        + * @param status The standard ICU error code output parameter.
        + *   * If an invalid category is given, status will be U_ILLEGAL_ARGUMENT_ERROR.
        + *   * If fallback to "default" or "001" didn't resolve, status will be
        + *     U_MISSING_RESOURCE.
        + * @return The index into the metadata vector which represents the appropriate
        + * preferences. If appropriate preferences are not found, -1 is returned.
        + */
        +int32_t getPreferenceMetadataIndex(const MaybeStackVector *metadata,
        +                                   StringPiece category, StringPiece usage, StringPiece region,
        +                                   UErrorCode &status) {
        +    if (U_FAILURE(status)) { return -1; }
        +    bool foundCategory, foundUsage, foundRegion;
        +    UnitPreferenceMetadata desired(category, usage, region, -1, -1, status);
        +    int32_t idx = binarySearch(metadata, desired, &foundCategory, &foundUsage, &foundRegion, status);
        +    if (U_FAILURE(status)) { return -1; }
        +    if (idx >= 0) { return idx; }
        +    if (!foundCategory) {
        +        status = U_ILLEGAL_ARGUMENT_ERROR;
        +        return -1;
        +    }
        +    U_ASSERT(foundCategory);
        +    while (!foundUsage) {
        +        int32_t lastDashIdx = desired.usage.lastIndexOf('-');
        +        if (lastDashIdx > 0) {
        +            desired.usage.truncate(lastDashIdx);
        +        } else if (uprv_strcmp(desired.usage.data(), "default") != 0) {
        +            desired.usage.truncate(0).append("default", status);
        +        } else {
        +            // "default" is not supposed to be missing for any valid category.
        +            status = U_MISSING_RESOURCE_ERROR;
        +            return -1;
        +        }
        +        idx = binarySearch(metadata, desired, &foundCategory, &foundUsage, &foundRegion, status);
        +        if (U_FAILURE(status)) { return -1; }
        +    }
        +    U_ASSERT(foundCategory);
        +    U_ASSERT(foundUsage);
        +    if (!foundRegion) {
        +        if (uprv_strcmp(desired.region.data(), "001") != 0) {
        +            desired.region.truncate(0).append("001", status);
        +            idx = binarySearch(metadata, desired, &foundCategory, &foundUsage, &foundRegion, status);
        +        }
        +        if (!foundRegion) {
        +            // "001" is not supposed to be missing for any valid usage.
        +            status = U_MISSING_RESOURCE_ERROR;
        +            return -1;
        +        }
        +    }
        +    U_ASSERT(foundCategory);
        +    U_ASSERT(foundUsage);
        +    U_ASSERT(foundRegion);
        +    U_ASSERT(idx >= 0);
        +    return idx;
        +}
        +
        +} // namespace
        +
        +UnitPreferenceMetadata::UnitPreferenceMetadata(StringPiece category, StringPiece usage,
        +                                               StringPiece region, int32_t prefsOffset,
        +                                               int32_t prefsCount, UErrorCode &status) {
        +    this->category.append(category, status);
        +    this->usage.append(usage, status);
        +    this->region.append(region, status);
        +    this->prefsOffset = prefsOffset;
        +    this->prefsCount = prefsCount;
        +}
        +
        +int32_t UnitPreferenceMetadata::compareTo(const UnitPreferenceMetadata &other) const {
        +    int32_t cmp = uprv_strcmp(category.data(), other.category.data());
        +    if (cmp == 0) {
        +        cmp = uprv_strcmp(usage.data(), other.usage.data());
        +    }
        +    if (cmp == 0) {
        +        cmp = uprv_strcmp(region.data(), other.region.data());
        +    }
        +    return cmp;
        +}
        +
        +int32_t UnitPreferenceMetadata::compareTo(const UnitPreferenceMetadata &other, bool *foundCategory,
        +                                          bool *foundUsage, bool *foundRegion) const {
        +    int32_t cmp = uprv_strcmp(category.data(), other.category.data());
        +    if (cmp == 0) {
        +        *foundCategory = true;
        +        cmp = uprv_strcmp(usage.data(), other.usage.data());
        +    }
        +    if (cmp == 0) {
        +        *foundUsage = true;
        +        cmp = uprv_strcmp(region.data(), other.region.data());
        +    }
        +    if (cmp == 0) {
        +        *foundRegion = true;
        +    }
        +    return cmp;
        +}
        +
        +CharString U_I18N_API getUnitCategory(const char *baseUnitIdentifier, UErrorCode &status) {
        +    CharString result;
        +    LocalUResourceBundlePointer unitsBundle(ures_openDirect(NULL, "units", &status));
        +    LocalUResourceBundlePointer unitQuantities(
        +        ures_getByKey(unitsBundle.getAlias(), "unitQuantities", NULL, &status));
        +    int32_t categoryLength;
        +    if (U_FAILURE(status)) { return result; }
        +    const UChar *uCategory =
        +        ures_getStringByKey(unitQuantities.getAlias(), baseUnitIdentifier, &categoryLength, &status);
        +    if (U_FAILURE(status)) {
        +        // TODO(CLDR-13787,hugovdm): special-casing the consumption-inverse
        +        // case. Once CLDR-13787 is clarified, this should be generalised (or
        +        // possibly removed):
        +        if (uprv_strcmp(baseUnitIdentifier, "meter-per-cubic-meter") == 0) {
        +            status = U_ZERO_ERROR;
        +            result.append("consumption-inverse", status);
        +            return result;
        +        }
        +    }
        +    result.appendInvariantChars(uCategory, categoryLength, status);
        +    return result;
        +}
        +
        +// TODO: this may be unnecessary. Fold into ConversionRates class? Or move to anonymous namespace?
        +void U_I18N_API getAllConversionRates(MaybeStackVector &result, UErrorCode &status) {
        +    LocalUResourceBundlePointer unitsBundle(ures_openDirect(NULL, "units", &status));
        +    ConversionRateDataSink sink(&result);
        +    ures_getAllItemsWithFallback(unitsBundle.getAlias(), "convertUnits", sink, status);
        +}
        +
        +const ConversionRateInfo *ConversionRates::extractConversionInfo(StringPiece source,
        +                                                                 UErrorCode &status) const {
        +    for (size_t i = 0, n = conversionInfo_.length(); i < n; ++i) {
        +        if (conversionInfo_[i]->sourceUnit.toStringPiece() == source) return conversionInfo_[i];
        +    }
        +
        +    status = U_INTERNAL_PROGRAM_ERROR;
        +    return nullptr;
        +}
        +
        +U_I18N_API UnitPreferences::UnitPreferences(UErrorCode &status) {
        +    LocalUResourceBundlePointer unitsBundle(ures_openDirect(NULL, "units", &status));
        +    UnitPreferencesSink sink(&unitPrefs_, &metadata_);
        +    ures_getAllItemsWithFallback(unitsBundle.getAlias(), "unitPreferenceData", sink, status);
        +}
        +
        +// TODO: make outPreferences const?
        +//
        +// TODO: consider replacing `UnitPreference **&outPreferences` with slice class
        +// of some kind.
        +void U_I18N_API UnitPreferences::getPreferencesFor(StringPiece category, StringPiece usage,
        +                                                   StringPiece region,
        +                                                   const UnitPreference *const *&outPreferences,
        +                                                   int32_t &preferenceCount, UErrorCode &status) const {
        +    int32_t idx = getPreferenceMetadataIndex(&metadata_, category, usage, region, status);
        +    if (U_FAILURE(status)) { return; }
        +    U_ASSERT(idx >= 0); // Failures should have been taken care of by `status`.
        +    const UnitPreferenceMetadata *m = metadata_[idx];
        +    outPreferences = unitPrefs_.getAlias() + m->prefsOffset;
        +    preferenceCount = m->prefsCount;
        +}
        +
        +} // namespace units
        +U_NAMESPACE_END
        +
        +#endif /* #if !UCONFIG_NO_FORMATTING */
        diff --git a/deps/icu-small/source/i18n/units_data.h b/deps/icu-small/source/i18n/units_data.h
        new file mode 100644
        index 00000000000000..b6fe8e88de3c2e
        --- /dev/null
        +++ b/deps/icu-small/source/i18n/units_data.h
        @@ -0,0 +1,229 @@
        +// © 2020 and later: Unicode, Inc. and others.
        +// License & terms of use: http://www.unicode.org/copyright.html
        +
        +#include "unicode/utypes.h"
        +
        +#if !UCONFIG_NO_FORMATTING
        +#ifndef __UNITS_DATA_H__
        +#define __UNITS_DATA_H__
        +
        +#include 
        +
        +#include "charstr.h"
        +#include "cmemory.h"
        +#include "unicode/stringpiece.h"
        +#include "unicode/uobject.h"
        +
        +U_NAMESPACE_BEGIN
        +namespace units {
        +
        +/**
        + * Looks up the unit category of a base unit identifier.
        + *
        + * Only supports base units, other units must be resolved to base units before
        + * passing to this function.
        + *
        + * Categories are found in `unitQuantities` in the `units` resource (see
        + * `units.txt`).
        + *
        + * TODO(hugovdm): if we give units_data.cpp access to the functionality of
        + * `extractCompoundBaseUnit` which is currently in units_converter.cpp, we could
        + * support all units for which there is a category. Does it make sense to move
        + * that function to units_data.cpp?
        + */
        +CharString U_I18N_API getUnitCategory(const char *baseUnitIdentifier, UErrorCode &status);
        +
        +/**
        + * Encapsulates "convertUnits" information from units resources, specifying how
        + * to convert from one unit to another.
        + *
        + * Information in this class is still in the form of strings: symbolic constants
        + * need to be interpreted. Rationale: symbols can cancel out for higher
        + * precision conversion - going from feet to inches should cancel out the
        + * `ft_to_m` constant.
        + */
        +class U_I18N_API ConversionRateInfo : public UMemory {
        +  public:
        +    ConversionRateInfo() {}
        +    ConversionRateInfo(StringPiece sourceUnit, StringPiece baseUnit, StringPiece factor,
        +                       StringPiece offset, UErrorCode &status)
        +        : sourceUnit(), baseUnit(), factor(), offset() {
        +        this->sourceUnit.append(sourceUnit, status);
        +        this->baseUnit.append(baseUnit, status);
        +        this->factor.append(factor, status);
        +        this->offset.append(offset, status);
        +    }
        +    CharString sourceUnit;
        +    CharString baseUnit;
        +    CharString factor;
        +    CharString offset;
        +};
        +
        +} // namespace units
        +
        +// Export explicit template instantiations of MaybeStackArray, MemoryPool and
        +// MaybeStackVector. This is required when building DLLs for Windows. (See
        +// datefmt.h, collationiterator.h, erarules.h and others for similar examples.)
        +//
        +// Note: These need to be outside of the units namespace, or Clang will generate
        +// a compile error.
        +#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
        +template class U_I18N_API MaybeStackArray;
        +template class U_I18N_API MemoryPool;
        +template class U_I18N_API MaybeStackVector;
        +#endif
        +
        +namespace units {
        +
        +/**
        + * Returns ConversionRateInfo for all supported conversions.
        + *
        + * @param result Receives the set of conversion rates.
        + * @param status Receives status.
        + */
        +void U_I18N_API getAllConversionRates(MaybeStackVector &result, UErrorCode &status);
        +
        +/**
        + * Contains all the supported conversion rates.
        + */
        +class U_I18N_API ConversionRates {
        +  public:
        +    /**
        +     * Constructor
        +     *
        +     * @param status Receives status.
        +     */
        +    ConversionRates(UErrorCode &status) { getAllConversionRates(conversionInfo_, status); }
        +
        +    /**
        +     * Returns a pointer to the conversion rate info that match the `source`.
        +     *
        +     * @param source Contains the source.
        +     * @param status Receives status.
        +     */
        +    const ConversionRateInfo *extractConversionInfo(StringPiece source, UErrorCode &status) const;
        +
        +  private:
        +    MaybeStackVector conversionInfo_;
        +};
        +
        +// Encapsulates unitPreferenceData information from units resources, specifying
        +// a sequence of output unit preferences.
        +struct U_I18N_API UnitPreference : public UMemory {
        +    // Set geq to 1.0 by default
        +    UnitPreference() : geq(1.0) {}
        +    CharString unit;
        +    double geq;
        +    UnicodeString skeleton;
        +};
        +
        +/**
        + * Metadata about the preferences in UnitPreferences::unitPrefs_.
        + *
        + * This class owns all of its data.
        + *
        + * UnitPreferenceMetadata lives in the anonymous namespace, because it should
        + * only be useful to internal code and unit testing code.
        + */
        +class U_I18N_API UnitPreferenceMetadata : public UMemory {
        +  public:
        +    UnitPreferenceMetadata() {}
        +    // Constructor, makes copies of the parameters passed to it.
        +    UnitPreferenceMetadata(StringPiece category, StringPiece usage, StringPiece region,
        +                           int32_t prefsOffset, int32_t prefsCount, UErrorCode &status);
        +
        +    // Unit category (e.g. "length", "mass", "electric-capacitance").
        +    CharString category;
        +    // Usage (e.g. "road", "vehicle-fuel", "blood-glucose"). Every category
        +    // should have an entry for "default" usage. TODO(hugovdm): add a test for
        +    // this.
        +    CharString usage;
        +    // Region code (e.g. "US", "CZ", "001"). Every usage should have an entry
        +    // for the "001" region ("world"). TODO(hugovdm): add a test for this.
        +    CharString region;
        +    // Offset into the UnitPreferences::unitPrefs_ list where the relevant
        +    // preferences are found.
        +    int32_t prefsOffset;
        +    // The number of preferences that form this set.
        +    int32_t prefsCount;
        +
        +    int32_t compareTo(const UnitPreferenceMetadata &other) const;
        +    int32_t compareTo(const UnitPreferenceMetadata &other, bool *foundCategory, bool *foundUsage,
        +                      bool *foundRegion) const;
        +};
        +
        +} // namespace units
        +
        +// Export explicit template instantiations of MaybeStackArray, MemoryPool and
        +// MaybeStackVector. This is required when building DLLs for Windows. (See
        +// datefmt.h, collationiterator.h, erarules.h and others for similar examples.)
        +//
        +// Note: These need to be outside of the units namespace, or Clang will generate
        +// a compile error.
        +#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
        +template class U_I18N_API MaybeStackArray;
        +template class U_I18N_API MemoryPool;
        +template class U_I18N_API MaybeStackVector;
        +template class U_I18N_API MaybeStackArray;
        +template class U_I18N_API MemoryPool;
        +template class U_I18N_API MaybeStackVector;
        +#endif
        +
        +namespace units {
        +
        +/**
        + * Unit Preferences information for various locales and usages.
        + */
        +class U_I18N_API UnitPreferences {
        +  public:
        +    /**
        +     * Constructor, loads all the preference data.
        +     *
        +     * @param status Receives status.
        +     */
        +    UnitPreferences(UErrorCode &status);
        +
        +    /**
        +     * Returns the set of unit preferences in the particular category that best
        +     * matches the specified usage and region.
        +     *
        +     * If region can't be found, falls back to global (001). If usage can't be
        +     * found, falls back to "default".
        +     *
        +     * @param category The category within which to look up usage and region.
        +     * (TODO(hugovdm): improve docs on how to find the category, once the lookup
        +     * function is added.)
        +     * @param usage The usage parameter. (TODO(hugovdm): improve this
        +     * documentation. Add reference to some list of usages we support.) If the
        +     * given usage is not found, the method automatically falls back to
        +     * "default".
        +     * @param region The region whose preferences are desired. If there are no
        +     * specific preferences for the requested region, the method automatically
        +     * falls back to region "001" ("world").
        +     * @param outPreferences A pointer into an array of preferences: essentially
        +     * an array slice in combination with preferenceCount.
        +     * @param preferenceCount The number of unit preferences that belong to the
        +     * result set.
        +     * @param status Receives status.
        +     *
        +     * TODO(hugovdm): maybe replace `UnitPreference **&outPreferences` with a slice class?
        +     */
        +    void getPreferencesFor(StringPiece category, StringPiece usage, StringPiece region,
        +                           const UnitPreference *const *&outPreferences, int32_t &preferenceCount,
        +                           UErrorCode &status) const;
        +
        +  protected:
        +    // Metadata about the sets of preferences, this is the index for looking up
        +    // preferences in the unitPrefs_ list.
        +    MaybeStackVector metadata_;
        +    // All the preferences as a flat list: which usage and region preferences
        +    // are associated with is stored in `metadata_`.
        +    MaybeStackVector unitPrefs_;
        +};
        +
        +} // namespace units
        +U_NAMESPACE_END
        +
        +#endif //__UNITS_DATA_H__
        +
        +#endif /* #if !UCONFIG_NO_FORMATTING */
        diff --git a/deps/icu-small/source/i18n/units_router.cpp b/deps/icu-small/source/i18n/units_router.cpp
        new file mode 100644
        index 00000000000000..3158718fd22fba
        --- /dev/null
        +++ b/deps/icu-small/source/i18n/units_router.cpp
        @@ -0,0 +1,132 @@
        +// © 2020 and later: Unicode, Inc. and others.
        +// License & terms of use: http://www.unicode.org/copyright.html
        +
        +#include "unicode/utypes.h"
        +
        +#if !UCONFIG_NO_FORMATTING
        +
        +#include "charstr.h"
        +#include "cmemory.h"
        +#include "cstring.h"
        +#include "measunit_impl.h"
        +#include "number_decimalquantity.h"
        +#include "number_roundingutils.h"
        +#include "resource.h"
        +#include "unicode/measure.h"
        +#include "units_data.h"
        +#include "units_router.h"
        +#include 
        +
        +U_NAMESPACE_BEGIN
        +namespace units {
        +
        +using number::Precision;
        +using number::impl::parseIncrementOption;
        +
        +Precision UnitsRouter::parseSkeletonToPrecision(icu::UnicodeString precisionSkeleton,
        +                                                UErrorCode &status) {
        +    if (U_FAILURE(status)) {
        +        // As a member of UsagePrefsHandler, which is a friend of Precision, we
        +        // get access to the default constructor.
        +        return {};
        +    }
        +    constexpr int32_t kSkelPrefixLen = 20;
        +    if (!precisionSkeleton.startsWith(UNICODE_STRING_SIMPLE("precision-increment/"))) {
        +        status = U_INVALID_FORMAT_ERROR;
        +        return {};
        +    }
        +    U_ASSERT(precisionSkeleton[kSkelPrefixLen - 1] == u'/');
        +    StringSegment segment(precisionSkeleton, false);
        +    segment.adjustOffset(kSkelPrefixLen);
        +    Precision result;
        +    parseIncrementOption(segment, result, status);
        +    return result;
        +}
        +
        +UnitsRouter::UnitsRouter(MeasureUnit inputUnit, StringPiece region, StringPiece usage,
        +                         UErrorCode &status) {
        +    // TODO: do we want to pass in ConversionRates and UnitPreferences instead
        +    // of loading in each UnitsRouter instance? (Or make global?)
        +    ConversionRates conversionRates(status);
        +    UnitPreferences prefs(status);
        +
        +    MeasureUnitImpl inputUnitImpl = MeasureUnitImpl::forMeasureUnitMaybeCopy(inputUnit, status);
        +    MeasureUnit baseUnit =
        +        (extractCompoundBaseUnit(inputUnitImpl, conversionRates, status)).build(status);
        +    CharString category = getUnitCategory(baseUnit.getIdentifier(), status);
        +
        +    const UnitPreference *const *unitPreferences;
        +    int32_t preferencesCount;
        +    prefs.getPreferencesFor(category.data(), usage, region, unitPreferences, preferencesCount, status);
        +
        +    for (int i = 0; i < preferencesCount; ++i) {
        +        const auto &preference = *unitPreferences[i];
        +
        +        MeasureUnitImpl complexTargetUnitImpl =
        +            MeasureUnitImpl::forIdentifier(preference.unit.data(), status);
        +        if (U_FAILURE(status)) {
        +            return;
        +        }
        +
        +        UnicodeString precision = preference.skeleton;
        +
        +        // For now, we only have "precision-increment" in Units Preferences skeleton.
        +        // Therefore, we check if the skeleton starts with "precision-increment" and force the program to
        +        // fail otherwise.
        +        // NOTE:
        +        //  It is allowed to have an empty precision.
        +        if (!precision.isEmpty() && !precision.startsWith(u"precision-increment", 19)) {
        +            status = U_INTERNAL_PROGRAM_ERROR;
        +            return;
        +        }
        +
        +        outputUnits_.emplaceBackAndCheckErrorCode(status,
        +                                                  complexTargetUnitImpl.copy(status).build(status));
        +        converterPreferences_.emplaceBackAndCheckErrorCode(status, inputUnitImpl, complexTargetUnitImpl,
        +                                                           preference.geq, std::move(precision),
        +                                                           conversionRates, status);
        +
        +        if (U_FAILURE(status)) {
        +            return;
        +        }
        +    }
        +}
        +
        +RouteResult UnitsRouter::route(double quantity, icu::number::impl::RoundingImpl *rounder, UErrorCode &status) const {
        +    // Find the matching preference
        +    const ConverterPreference *converterPreference = nullptr;
        +    for (int32_t i = 0, n = converterPreferences_.length(); i < n; i++) {
        +        converterPreference = converterPreferences_[i];
        +        if (converterPreference->converter.greaterThanOrEqual(std::abs(quantity) * (1 + DBL_EPSILON),
        +                                                              converterPreference->limit)) {
        +            break;
        +        }
        +    }
        +    U_ASSERT(converterPreference != nullptr);
        +
        +    // Set up the rounder for this preference's precision
        +    if (rounder != nullptr && rounder->fPrecision.isBogus()) {
        +        if (converterPreference->precision.length() > 0) {
        +            rounder->fPrecision = parseSkeletonToPrecision(converterPreference->precision, status);
        +        } else {
        +            // We use the same rounding mode as COMPACT notation: known to be a
        +            // human-friendly rounding mode: integers, but add a decimal digit
        +            // as needed to ensure we have at least 2 significant digits.
        +            rounder->fPrecision = Precision::integer().withMinDigits(2);
        +        }
        +    }
        +
        +    return RouteResult(converterPreference->converter.convert(quantity, rounder, status),
        +                       converterPreference->targetUnit.copy(status));
        +}
        +
        +const MaybeStackVector *UnitsRouter::getOutputUnits() const {
        +    // TODO: consider pulling this from converterPreferences_ and dropping
        +    // outputUnits_?
        +    return &outputUnits_;
        +}
        +
        +} // namespace units
        +U_NAMESPACE_END
        +
        +#endif /* #if !UCONFIG_NO_FORMATTING */
        diff --git a/deps/icu-small/source/i18n/units_router.h b/deps/icu-small/source/i18n/units_router.h
        new file mode 100644
        index 00000000000000..bd7a93d2d8c531
        --- /dev/null
        +++ b/deps/icu-small/source/i18n/units_router.h
        @@ -0,0 +1,162 @@
        +// © 2020 and later: Unicode, Inc. and others.
        +// License & terms of use: http://www.unicode.org/copyright.html
        +
        +#include "unicode/utypes.h"
        +
        +#if !UCONFIG_NO_FORMATTING
        +#ifndef __UNITS_ROUTER_H__
        +#define __UNITS_ROUTER_H__
        +
        +#include 
        +
        +#include "cmemory.h"
        +#include "measunit_impl.h"
        +#include "unicode/measunit.h"
        +#include "unicode/stringpiece.h"
        +#include "unicode/uobject.h"
        +#include "units_complexconverter.h"
        +#include "units_data.h"
        +
        +U_NAMESPACE_BEGIN
        +
        +// Forward declarations
        +class Measure;
        +namespace number {
        +class Precision;
        +}
        +
        +namespace units {
        +
        +struct RouteResult : UMemory {
        +    // A list of measures: a single measure for single units, multiple measures
        +    // for mixed units.
        +    //
        +    // TODO(icu-units/icu#21): figure out the right mixed unit API.
        +    MaybeStackVector measures;
        +
        +    // The output unit for this RouteResult. This may be a MIXED unit - for
        +    // example: "yard-and-foot-and-inch", for which `measures` will have three
        +    // elements.
        +    MeasureUnitImpl outputUnit;
        +
        +    RouteResult(MaybeStackVector measures, MeasureUnitImpl outputUnit)
        +        : measures(std::move(measures)), outputUnit(std::move(outputUnit)) {}
        +};
        +
        +/**
        + * Contains the complex unit converter and the limit which representing the smallest value that the
        + * converter should accept. For example, if the converter is converting to `foot+inch` and the limit
        + * equals 3.0, thus means the converter should not convert to a value less than `3.0 feet`.
        + *
        + * NOTE:
        + *    if the limit doest not has a value `i.e. (std::numeric_limits::lowest())`, this mean there
        + *    is no limit for the converter.
        + */
        +struct ConverterPreference : UMemory {
        +    ComplexUnitsConverter converter;
        +    double limit;
        +    UnicodeString precision;
        +
        +    // The output unit for this ConverterPreference. This may be a MIXED unit -
        +    // for example: "yard-and-foot-and-inch".
        +    MeasureUnitImpl targetUnit;
        +
        +    // In case there is no limit, the limit will be -inf.
        +    ConverterPreference(const MeasureUnitImpl &source, const MeasureUnitImpl &complexTarget,
        +                        UnicodeString precision, const ConversionRates &ratesInfo, UErrorCode &status)
        +        : ConverterPreference(source, complexTarget, std::numeric_limits::lowest(), precision,
        +                              ratesInfo, status) {}
        +
        +    ConverterPreference(const MeasureUnitImpl &source, const MeasureUnitImpl &complexTarget,
        +                        double limit, UnicodeString precision, const ConversionRates &ratesInfo,
        +                        UErrorCode &status)
        +        : converter(source, complexTarget, ratesInfo, status), limit(limit),
        +          precision(std::move(precision)), targetUnit(complexTarget.copy(status)) {}
        +};
        +
        +} // namespace units
        +
        +// Export explicit template instantiations of MaybeStackArray, MemoryPool and
        +// MaybeStackVector. This is required when building DLLs for Windows. (See
        +// datefmt.h, collationiterator.h, erarules.h and others for similar examples.)
        +//
        +// Note: These need to be outside of the units namespace, or Clang will generate
        +// a compile error.
        +#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
        +template class U_I18N_API MaybeStackArray;
        +template class U_I18N_API MemoryPool;
        +template class U_I18N_API MaybeStackVector;
        +#endif
        +
        +namespace units {
        +
        +/**
        + * `UnitsRouter` responsible for converting from a single unit (such as `meter` or `meter-per-second`) to
        + * one of the complex units based on the limits.
        + * For example:
        + *    if the input is `meter` and the output as following
        + *    {`foot+inch`, limit: 3.0}
        + *    {`inch`     , limit: no value (-inf)}
        + *    Thus means if the input in `meter` is greater than or equal to `3.0 feet`, the output will be in
        + *    `foot+inch`, otherwise, the output will be in `inch`.
        + *
        + * NOTE:
        + *    the output units and the their limits MUST BE in order, for example, if the output units, from the
        + *    previous example, are the following:
        + *        {`inch`     , limit: no value (-inf)}
        + *        {`foot+inch`, limit: 3.0}
        + *     IN THIS CASE THE OUTPUT WILL BE ALWAYS IN `inch`.
        + *
        + * NOTE:
        + *    the output units  and their limits will be extracted from the units preferences database by knowing
        + *    the followings:
        + *        - input unit
        + *        - locale
        + *        - usage
        + *
        + * DESIGN:
        + *    `UnitRouter` uses internally `ComplexUnitConverter` in order to convert the input units to the
        + *    desired complex units and to check the limit too.
        + */
        +class U_I18N_API UnitsRouter {
        +  public:
        +    UnitsRouter(MeasureUnit inputUnit, StringPiece locale, StringPiece usage, UErrorCode &status);
        +
        +    /**
        +     * Performs locale and usage sensitive unit conversion.
        +     * @param quantity The quantity to convert, expressed in terms of inputUnit.
        +     * @param rounder If not null, this RoundingImpl will be used to do rounding
        +     *     on the converted value. If the rounder lacks an fPrecision, the
        +     *     rounder will be modified to use the preferred precision for the usage
        +     *     and locale preference, alternatively with the default precision.
        +     * @param status Receives status.
        +     */
        +    RouteResult route(double quantity, icu::number::impl::RoundingImpl *rounder, UErrorCode &status) const;
        +
        +    /**
        +     * Returns the list of possible output units, i.e. the full set of
        +     * preferences, for the localized, usage-specific unit preferences.
        +     *
        +     * The returned pointer should be valid for the lifetime of the
        +     * UnitsRouter instance.
        +     */
        +    const MaybeStackVector *getOutputUnits() const;
        +
        +  private:
        +    // List of possible output units. TODO: converterPreferences_ now also has
        +    // this data available. Maybe drop outputUnits_ and have getOutputUnits
        +    // construct a the list from data in converterPreferences_ instead?
        +    MaybeStackVector outputUnits_;
        +
        +    MaybeStackVector converterPreferences_;
        +
        +    static number::Precision parseSkeletonToPrecision(icu::UnicodeString precisionSkeleton,
        +                                                      UErrorCode &status);
        +};
        +
        +} // namespace units
        +U_NAMESPACE_END
        +
        +#endif //__UNITS_ROUTER_H__
        +
        +#endif /* #if !UCONFIG_NO_FORMATTING */
        diff --git a/deps/icu-small/source/i18n/unum.cpp b/deps/icu-small/source/i18n/unum.cpp
        index ba3d519162ce54..de693fc7276244 100644
        --- a/deps/icu-small/source/i18n/unum.cpp
        +++ b/deps/icu-small/source/i18n/unum.cpp
        @@ -898,7 +898,7 @@ unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode*
             return ((const NumberFormat*)fmt)->getContext(type, *status);
         }
         
        -U_INTERNAL UFormattable * U_EXPORT2
        +U_CAPI UFormattable * U_EXPORT2
         unum_parseToUFormattable(const UNumberFormat* fmt,
                                  UFormattable *result,
                                  const UChar* text,
        @@ -922,7 +922,7 @@ unum_parseToUFormattable(const UNumberFormat* fmt,
           return result;
         }
         
        -U_INTERNAL int32_t U_EXPORT2
        +U_CAPI int32_t U_EXPORT2
         unum_formatUFormattable(const UNumberFormat* fmt,
                                 const UFormattable *number,
                                 UChar *result,
        diff --git a/deps/icu-small/source/i18n/upluralrules.cpp b/deps/icu-small/source/i18n/upluralrules.cpp
        index 5119257fd804f7..73e59a75c4d016 100644
        --- a/deps/icu-small/source/i18n/upluralrules.cpp
        +++ b/deps/icu-small/source/i18n/upluralrules.cpp
        @@ -20,6 +20,7 @@
         #include "unicode/unumberformatter.h"
         #include "number_decimalquantity.h"
         #include "number_utypes.h"
        +#include "numrange_impl.h"
         
         U_NAMESPACE_USE
         
        @@ -115,6 +116,25 @@ uplrules_selectFormatted(const UPluralRules *uplrules,
             return result.extract(keyword, capacity, *status);
         }
         
        +U_CAPI int32_t U_EXPORT2
        +uplrules_selectForRange(const UPluralRules *uplrules,
        +                const UFormattedNumberRange* urange,
        +                UChar *keyword, int32_t capacity,
        +                UErrorCode *status)
        +{
        +    if (U_FAILURE(*status)) {
        +        return 0;
        +    }
        +    if (keyword == NULL ? capacity != 0 : capacity < 0) {
        +        *status = U_ILLEGAL_ARGUMENT_ERROR;
        +        return 0;
        +    }
        +    const number::impl::UFormattedNumberRangeData* impl =
        +        number::impl::validateUFormattedNumberRange(urange, *status);
        +    UnicodeString result = ((PluralRules*)uplrules)->select(impl, *status);
        +    return result.extract(keyword, capacity, *status);
        +}
        +
         U_CAPI int32_t U_EXPORT2
         uplrules_selectWithFormat(const UPluralRules *uplrules,
                                   double number,
        diff --git a/deps/icu-small/source/i18n/uspoof_impl.h b/deps/icu-small/source/i18n/uspoof_impl.h
        index 8844a96446e2b5..b0bd8cefc82ddc 100644
        --- a/deps/icu-small/source/i18n/uspoof_impl.h
        +++ b/deps/icu-small/source/i18n/uspoof_impl.h
        @@ -222,7 +222,7 @@ class SpoofData: public UMemory {
             SpoofData(const void *serializedData, int32_t length, UErrorCode &status);
         
             //  Check raw Spoof Data Version compatibility.
        -    //  Return TRUE it looks good.
        +    //  Return true it looks good.
             UBool validateDataVersion(UErrorCode &status) const;
         
             ~SpoofData();                    // Destructor not normally used.
        diff --git a/deps/icu-small/source/i18n/usrchimp.h b/deps/icu-small/source/i18n/usrchimp.h
        index 5438417e7e60aa..e056337caecdef 100644
        --- a/deps/icu-small/source/i18n/usrchimp.h
        +++ b/deps/icu-small/source/i18n/usrchimp.h
        @@ -206,7 +206,7 @@ struct UStringSearch {
         * the text "\u00e6"
         * @param strsrch string search data
         * @param status error status if any
        -* @return TRUE if an exact match is found, FALSE otherwise
        +* @return true if an exact match is found, false otherwise
         */
         U_CFUNC
         UBool usearch_handleNextExact(UStringSearch *strsrch, UErrorCode *status);
        @@ -217,7 +217,7 @@ UBool usearch_handleNextExact(UStringSearch *strsrch, UErrorCode *status);
         * of beginning and ending accents if it overlaps that region.
         * @param strsrch string search data
         * @param status error status if any
        -* @return TRUE if a canonical match is found, FALSE otherwise
        +* @return true if a canonical match is found, false otherwise
         */
         U_CFUNC
         UBool usearch_handleNextCanonical(UStringSearch *strsrch, UErrorCode *status);
        @@ -227,7 +227,7 @@ UBool usearch_handleNextCanonical(UStringSearch *strsrch, UErrorCode *status);
         * Comments follows from handleNextExact
         * @param strsrch string search data
         * @param status error status if any
        -* @return True if a exact math is found, FALSE otherwise.
        +* @return True if a exact math is found, false otherwise.
         */
         U_CFUNC
         UBool usearch_handlePreviousExact(UStringSearch *strsrch, UErrorCode *status);
        @@ -238,7 +238,7 @@ UBool usearch_handlePreviousExact(UStringSearch *strsrch, UErrorCode *status);
         * of beginning and ending accents if it overlaps that region.
         * @param strsrch string search data
         * @param status error status if any
        -* @return TRUE if a canonical match is found, FALSE otherwise
        +* @return true if a canonical match is found, false otherwise
         */
         U_CFUNC
         UBool usearch_handlePreviousCanonical(UStringSearch *strsrch,
        diff --git a/deps/icu-small/source/i18n/utf16collationiterator.h b/deps/icu-small/source/i18n/utf16collationiterator.h
        index fd3a05e9efab0b..6305d81c30c66b 100644
        --- a/deps/icu-small/source/i18n/utf16collationiterator.h
        +++ b/deps/icu-small/source/i18n/utf16collationiterator.h
        @@ -125,7 +125,7 @@ class U_I18N_API FCDUTF16CollationIterator : public UTF16CollationIterator {
             /**
              * Extend the FCD text segment forward or normalize around pos.
              * To be called when checkDir > 0 && pos != limit.
        -     * @return TRUE if success, checkDir == 0 and pos != limit
        +     * @return true if success, checkDir == 0 and pos != limit
              */
             UBool nextSegment(UErrorCode &errorCode);
         
        @@ -139,7 +139,7 @@ class U_I18N_API FCDUTF16CollationIterator : public UTF16CollationIterator {
             /**
              * Extend the FCD text segment backward or normalize around pos.
              * To be called when checkDir < 0 && pos != start.
        -     * @return TRUE if success, checkDir == 0 and pos != start
        +     * @return true if success, checkDir == 0 and pos != start
              */
             UBool previousSegment(UErrorCode &errorCode);
         
        diff --git a/deps/icu-small/source/i18n/utf8collationiterator.h b/deps/icu-small/source/i18n/utf8collationiterator.h
        index 9a3ec45aeb41eb..9059e72dcf9e63 100644
        --- a/deps/icu-small/source/i18n/utf8collationiterator.h
        +++ b/deps/icu-small/source/i18n/utf8collationiterator.h
        @@ -54,7 +54,7 @@ class U_I18N_API UTF8CollationIterator : public CollationIterator {
              * together with a bogus code point. The caller will ignore that code point.
              *
              * Special values may be returned for surrogate code points, which are also illegal in UTF-8,
        -     * but the caller will treat them like U+FFFD because forbidSurrogateCodePoints() returns TRUE.
        +     * but the caller will treat them like U+FFFD because forbidSurrogateCodePoints() returns true.
              *
              * Valid lead surrogates are returned from inside a normalized text segment,
              * where handleGetTrailSurrogate() will return the matching trail surrogate.
        @@ -117,7 +117,7 @@ class U_I18N_API FCDUTF8CollationIterator : public UTF8CollationIterator {
         
             /**
              * Extends the FCD text segment forward or normalizes around pos.
        -     * @return TRUE if success
        +     * @return true if success
              */
             UBool nextSegment(UErrorCode &errorCode);
         
        @@ -128,7 +128,7 @@ class U_I18N_API FCDUTF8CollationIterator : public UTF8CollationIterator {
         
             /**
              * Extends the FCD text segment backward or normalizes around pos.
        -     * @return TRUE if success
        +     * @return true if success
              */
             UBool previousSegment(UErrorCode &errorCode);
         
        diff --git a/deps/icu-small/source/i18n/vzone.h b/deps/icu-small/source/i18n/vzone.h
        index 700687e0cb76ab..9c83c1b7e660cb 100644
        --- a/deps/icu-small/source/i18n/vzone.h
        +++ b/deps/icu-small/source/i18n/vzone.h
        @@ -91,7 +91,7 @@ vzone_equals(const VZone* zone1, const VZone* zone2);
          * @param zone, the vzone to use
          * @param url Receives the RFC2445 TZURL property value.
          * @param urlLength, length of the url
        - * @return TRUE if TZURL attribute is available and value is set.
        + * @return true if TZURL attribute is available and value is set.
          */
         U_CAPI UBool U_EXPORT2
         vzone_getTZURL(VZone* zone, UChar* & url, int32_t & urlLength);
        @@ -112,7 +112,7 @@ vzone_setTZURL(VZone* zone, UChar* url, int32_t urlLength);
          * is not set.
          * @param zone, the vzone to use
          * @param lastModified Receives the last modified date.
        - * @return TRUE if lastModified attribute is available and value is set.
        + * @return true if lastModified attribute is available and value is set.
          */
         U_CAPI UBool U_EXPORT2
         vzone_getLastModified(VZone* zone, UDate& lastModified);
        @@ -283,7 +283,7 @@ vzone_useDaylightTime(VZone* zone);
          * @return true if the given date is in daylight savings time,
          * false, otherwise.
          */
        -U_INTERNAL UBool U_EXPORT2
        +U_CAPI UBool U_EXPORT2
         vzone_inDaylightTime(VZone* zone, UDate date, UErrorCode& status);
         
         /**
        @@ -303,7 +303,7 @@ vzone_hasSameRules(VZone* zone, const VZone* other);
          * @param base      The base time.
          * @param inclusive Whether the base time is inclusive or not.
          * @param result    Receives the first transition after the base time.
        - * @return  TRUE if the transition is found.
        + * @return  true if the transition is found.
          */
         U_CAPI UBool U_EXPORT2
         vzone_getNextTransition(VZone* zone, UDate base, UBool inclusive, ZTrans* result);
        @@ -314,7 +314,7 @@ vzone_getNextTransition(VZone* zone, UDate base, UBool inclusive, ZTrans* result
          * @param base      The base time.
          * @param inclusive Whether the base time is inclusive or not.
          * @param result    Receives the most recent transition before the base time.
        - * @return  TRUE if the transition is found.
        + * @return  true if the transition is found.
          */
         U_CAPI UBool U_EXPORT2
         vzone_getPreviousTransition(VZone* zone, UDate base, UBool inclusive, ZTrans* result);
        diff --git a/deps/icu-small/source/i18n/zonemeta.h b/deps/icu-small/source/i18n/zonemeta.h
        index 9dbcc878a22dc8..58724ea3b7d2e4 100644
        --- a/deps/icu-small/source/i18n/zonemeta.h
        +++ b/deps/icu-small/source/i18n/zonemeta.h
        @@ -59,7 +59,7 @@ class U_I18N_API ZoneMeta {
              * is not associated with a country, return bogus string.
              * @param tzid Zone ID
              * @param country [output] Country code
        -     * @param isPrimary [output] TRUE if the zone is the primary zone for the country
        +     * @param isPrimary [output] true if the zone is the primary zone for the country
              * @return A reference to the result country
              */
             static UnicodeString& U_EXPORT2 getCanonicalCountry(const UnicodeString &tzid, UnicodeString &country, UBool *isPrimary = NULL);
        diff --git a/deps/icu-small/source/python/icutools/databuilder/filtration_schema.json b/deps/icu-small/source/python/icutools/databuilder/filtration_schema.json
        index 2b7ff9989992a1..3aed41a3341f65 100644
        --- a/deps/icu-small/source/python/icutools/databuilder/filtration_schema.json
        +++ b/deps/icu-small/source/python/icutools/databuilder/filtration_schema.json
        @@ -90,7 +90,7 @@
                         {
                             "properties": {
                                 "filterType": {
        -                            "$ref": "#/definitions/blacklistWhitelistFilterTypes"
        +                            "$ref": "#/definitions/includeExcludeFilterTypes"
                                 },
                                 "whitelist": { "$ref": "#/definitions/stringList" }
                             },
        @@ -100,13 +100,33 @@
                         {
                             "properties": {
                                 "filterType": {
        -                            "$ref": "#/definitions/blacklistWhitelistFilterTypes"
        +                            "$ref": "#/definitions/includeExcludeFilterTypes"
                                 },
                                 "blacklist": { "$ref": "#/definitions/stringList" }
                             },
                             "required": ["blacklist"],
                             "additionalProperties": false
                         },
        +                {
        +                    "properties": {
        +                        "filterType": {
        +                            "$ref": "#/definitions/includeExcludeFilterTypes"
        +                        },
        +                        "includelist": { "$ref": "#/definitions/stringList" }
        +                    },
        +                    "required": ["includelist"],
        +                    "additionalProperties": false
        +                },
        +                {
        +                    "properties": {
        +                        "filterType": {
        +                            "$ref": "#/definitions/includeExcludeFilterTypes"
        +                        },
        +                        "excludelist": { "$ref": "#/definitions/stringList" }
        +                    },
        +                    "required": ["excludelist"],
        +                    "additionalProperties": false
        +                },
                         {
                             "properties": {
                                 "filterType": {
        @@ -134,6 +154,23 @@
                             "required": ["filterType", "whitelist"],
                             "additionalProperties": false
                         },
        +                {
        +                    "properties": {
        +                        "filterType": {
        +                            "type": "string",
        +                            "enum": ["locale"]
        +                        },
        +                        "includeChildren": {
        +                            "type": "boolean"
        +                        },
        +                        "includeScripts": {
        +                            "type": "boolean"
        +                        },
        +                        "includelist": { "$ref": "#/definitions/stringList" }
        +                    },
        +                    "required": ["filterType", "includelist"],
        +                    "additionalProperties": false
        +                },
                         {
                             "properties": {
                                 "filterType": {
        @@ -150,7 +187,7 @@
                         }
                     ]
                 },
        -        "blacklistWhitelistFilterTypes": {
        +        "includeExcludeFilterTypes": {
                     "type": "string",
                     "enum": [
                         "language",
        diff --git a/deps/icu-small/source/python/icutools/databuilder/test/sample_data/brkitr/LOCALE_DEPS.json b/deps/icu-small/source/python/icutools/databuilder/test/sample_data/brkitr/LOCALE_DEPS.json
        index 89329e87eea539..674db09278fc37 100644
        --- a/deps/icu-small/source/python/icutools/databuilder/test/sample_data/brkitr/LOCALE_DEPS.json
        +++ b/deps/icu-small/source/python/icutools/databuilder/test/sample_data/brkitr/LOCALE_DEPS.json
        @@ -1,5 +1,5 @@
         // © 2019 and later: Unicode, Inc. and others.
        -// License & terms of use: http://www.unicode.org/copyright.html#License
        +// License & terms of use: http://www.unicode.org/copyright.html
         
         //////////////////////////////////////////////////////////////
         // This is a sample LOCALE_DEPS.json file for testing only. //
        diff --git a/deps/icu-small/source/python/icutools/databuilder/test/sample_data/locales/LOCALE_DEPS.json b/deps/icu-small/source/python/icutools/databuilder/test/sample_data/locales/LOCALE_DEPS.json
        index fd28a741ef67c2..1456ea0d9acff4 100644
        --- a/deps/icu-small/source/python/icutools/databuilder/test/sample_data/locales/LOCALE_DEPS.json
        +++ b/deps/icu-small/source/python/icutools/databuilder/test/sample_data/locales/LOCALE_DEPS.json
        @@ -1,5 +1,5 @@
         // © 2019 and later: Unicode, Inc. and others.
        -// License & terms of use: http://www.unicode.org/copyright.html#License
        +// License & terms of use: http://www.unicode.org/copyright.html
         
         //////////////////////////////////////////////////////////////
         // This is a sample LOCALE_DEPS.json file for testing only. //
        diff --git a/deps/icu-small/source/python/icutools/databuilder/test/sample_data/rbnf/LOCALE_DEPS.json b/deps/icu-small/source/python/icutools/databuilder/test/sample_data/rbnf/LOCALE_DEPS.json
        index f079619a3685ba..c6ec208add2b41 100644
        --- a/deps/icu-small/source/python/icutools/databuilder/test/sample_data/rbnf/LOCALE_DEPS.json
        +++ b/deps/icu-small/source/python/icutools/databuilder/test/sample_data/rbnf/LOCALE_DEPS.json
        @@ -1,5 +1,5 @@
         // © 2019 and later: Unicode, Inc. and others.
        -// License & terms of use: http://www.unicode.org/copyright.html#License
        +// License & terms of use: http://www.unicode.org/copyright.html
         
         //////////////////////////////////////////////////////////////
         // This is a sample LOCALE_DEPS.json file for testing only. //
        diff --git a/deps/icu-small/source/tools/genrb/errmsg.c b/deps/icu-small/source/tools/genrb/errmsg.c
        index 603f26a174c4e9..91dfd3265e1149 100644
        --- a/deps/icu-small/source/tools/genrb/errmsg.c
        +++ b/deps/icu-small/source/tools/genrb/errmsg.c
        @@ -21,6 +21,7 @@
         #include 
         #include "cstring.h"
         #include "errmsg.h"
        +#include "toolutil.h"
         
         U_CFUNC void error(uint32_t linenumber, const char *msg, ...)
         {
        diff --git a/deps/icu-small/source/tools/genrb/read.c b/deps/icu-small/source/tools/genrb/read.c
        index c20b4510a28ac4..141e285d25efb9 100644
        --- a/deps/icu-small/source/tools/genrb/read.c
        +++ b/deps/icu-small/source/tools/genrb/read.c
        @@ -20,6 +20,7 @@
         
         #include "read.h"
         #include "errmsg.h"
        +#include "toolutil.h"
         #include "unicode/ustring.h"
         #include "unicode/utf16.h"
         
        diff --git a/deps/icu-small/source/tools/genrb/reslist.cpp b/deps/icu-small/source/tools/genrb/reslist.cpp
        index 3186c781e934f3..4bc6adc128ecc3 100644
        --- a/deps/icu-small/source/tools/genrb/reslist.cpp
        +++ b/deps/icu-small/source/tools/genrb/reslist.cpp
        @@ -39,6 +39,7 @@
         #include "unicode/putil.h"
         #include "errmsg.h"
         #include "filterrb.h"
        +#include "toolutil.h"
         
         #include "uarrsort.h"
         #include "uelement.h"
        diff --git a/deps/icu-small/source/tools/genrb/reslist.h b/deps/icu-small/source/tools/genrb/reslist.h
        index 34b710c4232670..e7b10fa0961d18 100644
        --- a/deps/icu-small/source/tools/genrb/reslist.h
        +++ b/deps/icu-small/source/tools/genrb/reslist.h
        @@ -355,7 +355,7 @@ class StringResource : public StringBaseResource {
                       fNumCopies(0), fNumUnitsSaved(0), fNumCharsForLength(numCharsForLength) {
                 // v3 pool string encoded as string-v2 with low offset
                 fRes = URES_MAKE_RESOURCE(URES_STRING_V2, poolStringIndex);
        -        fWritten = TRUE;
        +        fWritten = true;
             }
             virtual ~StringResource();
         
        diff --git a/deps/icu-small/source/tools/genrb/rle.c b/deps/icu-small/source/tools/genrb/rle.c
        index 3d034f78ca3881..c5d29ba1d24b6b 100644
        --- a/deps/icu-small/source/tools/genrb/rle.c
        +++ b/deps/icu-small/source/tools/genrb/rle.c
        @@ -16,6 +16,7 @@
         *   01/11/02    Ram        Creation.
         *******************************************************************************
         */
        +#include 
         #include "rle.h"
         /**
          * The ESCAPE character is used during run-length encoding.  It signals
        @@ -297,7 +298,7 @@ int32_t
         rleStringToByteArray(uint16_t* src, int32_t srcLen, uint8_t* target, int32_t tgtLen, UErrorCode* status) {
         
             int32_t length = 0;
        -    UBool nextChar = TRUE;
        +    UBool nextChar = true;
             uint16_t c = 0;
             int32_t node = 0;
             int32_t runLength = 0;
        @@ -334,11 +335,11 @@ rleStringToByteArray(uint16_t* src, int32_t srcLen, uint8_t* target, int32_t tgt
                 if (nextChar) {
                     c = src[i++];
                     b = (uint8_t) (c >> 8);
        -            nextChar = FALSE;
        +            nextChar = false;
                 }
                 else {
                     b = (uint8_t) (c & 0xFF);
        -            nextChar = TRUE;
        +            nextChar = true;
                 }
         
                /* This part of the loop is a tiny state machine which handles
        diff --git a/deps/icu-small/source/tools/icupkg/icupkg.cpp b/deps/icu-small/source/tools/icupkg/icupkg.cpp
        index ea7be4a90923fd..39707946b0943c 100644
        --- a/deps/icu-small/source/tools/icupkg/icupkg.cpp
        +++ b/deps/icu-small/source/tools/icupkg/icupkg.cpp
        @@ -59,6 +59,7 @@ printUsage(const char *pname, UBool isHelp) {
                     "%csage: %s [-h|-?|--help ] [-tl|-tb|-te] [-c] [-C comment]\n"
                     "\t[-a list] [-r list] [-x list] [-l [-o outputListFileName]]\n"
                     "\t[-s path] [-d path] [-w] [-m mode]\n"
        +            "\t[--ignore-deps]\n"
                     "\t[--auto_toc_prefix] [--auto_toc_prefix_with_type] [--toc_prefix]\n"
                     "\tinfilename [outfilename]\n",
                     isHelp ? 'U' : 'u', pname);
        @@ -119,6 +120,10 @@ printUsage(const char *pname, UBool isHelp) {
                     "\t-m mode or --matchmode mode  set the matching mode for item names with\n"
                     "\t                             wildcards\n"
                     "\t        noslash: the '*' wildcard does not match the '/' tree separator\n");
        +        fprintf(where,
        +            "\n"
        +            "\t--ignore-deps     Do not fail if not all resource dependencies are met. Use this\n"
        +            "\t                  option if the missing resources come from another source.");
                 fprintf(where,
                     "\n"
                     "\tIn the .dat package, the Table of Contents (ToC) contains an entry\n"
        @@ -198,6 +203,8 @@ static UOption options[]={
         
             UOPTION_DEF("matchmode", 'm', UOPT_REQUIRES_ARG),
         
        +    UOPTION_DEF("ignore-deps", '\1', UOPT_NO_ARG),
        +
             UOPTION_DEF("add", 'a', UOPT_REQUIRES_ARG),
             UOPTION_DEF("remove", 'r', UOPT_REQUIRES_ARG),
             UOPTION_DEF("extract", 'x', UOPT_REQUIRES_ARG),
        @@ -225,6 +232,8 @@ enum {
         
             OPT_MATCHMODE,
         
        +    OPT_IGNORE_DEPS,
        +
             OPT_ADD_LIST,
             OPT_REMOVE_LIST,
             OPT_EXTRACT_LIST,
        @@ -501,7 +510,7 @@ main(int argc, char *argv[]) {
             }
         
             /* check dependencies between items */
        -    if(!pkg->checkDependencies()) {
        +    if(!options[OPT_IGNORE_DEPS].doesOccur && !pkg->checkDependencies()) {
                 /* some dependencies are not fulfilled */
                 return U_MISSING_RESOURCE_ERROR;
             }
        diff --git a/deps/icu-small/source/tools/pkgdata/pkgtypes.c b/deps/icu-small/source/tools/pkgdata/pkgtypes.c
        index 43ee3dfb5e2c33..26bd945df73d48 100644
        --- a/deps/icu-small/source/tools/pkgdata/pkgtypes.c
        +++ b/deps/icu-small/source/tools/pkgdata/pkgtypes.c
        @@ -17,6 +17,7 @@
         *  common types for pkgdata
         */
         
        +#include 
         #include 
         #include 
         #include "unicode/utypes.h"
        @@ -294,9 +295,9 @@ UBool  pkg_listContains(CharList *l, const char *str)
         {
           for(;l;l=l->next){
             if(!uprv_strcmp(l->str, str)) {
        -      return TRUE;
        +      return true;
             }
           }
         
        -  return FALSE;
        +  return false;
         }
        diff --git a/deps/icu-small/source/tools/toolutil/dbgutil.cpp b/deps/icu-small/source/tools/toolutil/dbgutil.cpp
        index 29bab927535e78..17fdfbb1444e29 100644
        --- a/deps/icu-small/source/tools/toolutil/dbgutil.cpp
        +++ b/deps/icu-small/source/tools/toolutil/dbgutil.cpp
        @@ -29,7 +29,7 @@ static const UnicodeString&  _fieldString(UDebugEnumType type, int32_t field, Un
             if(str == NULL) {
                 return fillin.remove();
             } else {
        -        return fillin = UnicodeString(str, ""); // optimize?
        +        return fillin = UnicodeString(str, -1, US_INV);
             }
         }
         
        diff --git a/deps/icu-small/source/tools/toolutil/filetools.h b/deps/icu-small/source/tools/toolutil/filetools.h
        index 6a25c3601c0178..40a606a7d49076 100644
        --- a/deps/icu-small/source/tools/toolutil/filetools.h
        +++ b/deps/icu-small/source/tools/toolutil/filetools.h
        @@ -26,7 +26,7 @@
         #include "unicode/utypes.h"
         
         U_CAPI UBool U_EXPORT2
        -isFileModTimeLater(const char *filePath, const char *checkAgainst, UBool isDir=FALSE);
        +isFileModTimeLater(const char *filePath, const char *checkAgainst, UBool isDir=false);
         
         U_CAPI void U_EXPORT2
         swapFileSepChar(char *filePath, const char oldFileSepChar, const char newFileSepChar);
        diff --git a/deps/icu-small/source/tools/toolutil/package.h b/deps/icu-small/source/tools/toolutil/package.h
        index 3263c84feb4c37..5f74eb73ef5c9a 100644
        --- a/deps/icu-small/source/tools/toolutil/package.h
        +++ b/deps/icu-small/source/tools/toolutil/package.h
        @@ -57,13 +57,13 @@ class U_TOOLUTIL_API Package {
              * Uses the prefix of the first entry of the package in readPackage(),
              * rather than the package basename.
              */
        -    void setAutoPrefix() { doAutoPrefix=TRUE; }
        +    void setAutoPrefix() { doAutoPrefix=true; }
             /**
              * Same as setAutoPrefix(), plus the prefix must end with the platform type letter.
              */
             void setAutoPrefixWithType() {
        -        doAutoPrefix=TRUE;
        -        prefixEndsWithType=TRUE;
        +        doAutoPrefix=true;
        +        prefixEndsWithType=true;
             }
             void setPrefix(const char *p);
         
        @@ -128,7 +128,7 @@ class U_TOOLUTIL_API Package {
             const Item *getItem(int32_t idx) const;
         
             /*
        -     * Check dependencies and return TRUE if all dependencies are fulfilled.
        +     * Check dependencies and return true if all dependencies are fulfilled.
              */
             UBool checkDependencies();
         
        diff --git a/deps/icu-small/source/tools/toolutil/pkg_genc.cpp b/deps/icu-small/source/tools/toolutil/pkg_genc.cpp
        index 31db2e2184b3be..f9400c5058c206 100644
        --- a/deps/icu-small/source/tools/toolutil/pkg_genc.cpp
        +++ b/deps/icu-small/source/tools/toolutil/pkg_genc.cpp
        @@ -738,8 +738,8 @@ getOutFilename(
                 exit(U_ILLEGAL_ARGUMENT_ERROR);
             }
         
        -    uprv_strcpy(outFilename, outFilenameBuilder.data());
        -    uprv_strcpy(entryName, entryNameBuilder.data());
        +    outFilenameBuilder.extract(outFilename, outFilenameCapacity, status);
        +    entryNameBuilder.extract(entryName, entryNameCapacity, status);
         }
         
         #ifdef CAN_GENERATE_OBJECTS
        diff --git a/deps/icu-small/source/tools/toolutil/pkg_genc.h b/deps/icu-small/source/tools/toolutil/pkg_genc.h
        index b231aa6170c287..72d96870355020 100644
        --- a/deps/icu-small/source/tools/toolutil/pkg_genc.h
        +++ b/deps/icu-small/source/tools/toolutil/pkg_genc.h
        @@ -68,13 +68,13 @@
         
         
         
        -U_INTERNAL void U_EXPORT2
        +U_CAPI void U_EXPORT2
         printAssemblyHeadersToStdErr(void);
         
        -U_INTERNAL UBool U_EXPORT2
        +U_CAPI UBool U_EXPORT2
         checkAssemblyHeaderName(const char* optAssembly);
         
        -U_INTERNAL void U_EXPORT2
        +U_CAPI void U_EXPORT2
         writeCCode(
             const char *filename,
             const char *destdir,
        @@ -83,7 +83,7 @@ writeCCode(
             char *outFilePath,
             size_t outFilePathCapacity);
         
        -U_INTERNAL void U_EXPORT2
        +U_CAPI void U_EXPORT2
         writeAssemblyCode(
             const char *filename,
             const char *destdir,
        @@ -92,7 +92,7 @@ writeAssemblyCode(
             char *outFilePath,
             size_t outFilePathCapacity);
         
        -U_INTERNAL void U_EXPORT2
        +U_CAPI void U_EXPORT2
         writeObjectCode(
             const char *filename,
             const char *destdir,
        diff --git a/deps/icu-small/source/tools/toolutil/pkgitems.cpp b/deps/icu-small/source/tools/toolutil/pkgitems.cpp
        index b0ea980d605dcb..16b18a3e27345f 100644
        --- a/deps/icu-small/source/tools/toolutil/pkgitems.cpp
        +++ b/deps/icu-small/source/tools/toolutil/pkgitems.cpp
        @@ -441,6 +441,7 @@ ures_enumDependencies(const char *itemName, const UDataInfo *pInfo,
         
         // get dependencies from conversion tables --------------------------------- ***
         
        +#if !UCONFIG_NO_CONVERSION
         /* code adapted from ucnv_swap() */
         static void
         ucnv_enumDependencies(const UDataSwapper *ds,
        @@ -631,5 +632,6 @@ Package::enumDependencies(Item *pItem, void *context, CheckDependency check) {
                 }
             }
         }
        +#endif /* UCONFIG_NO_CONVERSION */
         
         U_NAMESPACE_END
        diff --git a/deps/icu-small/source/tools/toolutil/toolutil.cpp b/deps/icu-small/source/tools/toolutil/toolutil.cpp
        index f0d6be5cf5ee2a..0ce9b02115dd32 100644
        --- a/deps/icu-small/source/tools/toolutil/toolutil.cpp
        +++ b/deps/icu-small/source/tools/toolutil/toolutil.cpp
        @@ -33,7 +33,7 @@
         #include "unicode/utypes.h"
         
         #ifndef U_TOOLUTIL_IMPLEMENTATION
        -#error U_TOOLUTIL_IMPLEMENTATION not set - must be set for all ICU source files in common/ - see http://userguide.icu-project.org/howtouseicu
        +#error U_TOOLUTIL_IMPLEMENTATION not set - must be set for all ICU source files in common/ - see https://unicode-org.github.io/icu/userguide/howtouseicu
         #endif
         
         #if U_PLATFORM_USES_ONLY_WIN32_API
        @@ -166,14 +166,11 @@ findBasename(const char *filename) {
             const char *basename=uprv_strrchr(filename, U_FILE_SEP_CHAR);
         
         #if U_FILE_ALT_SEP_CHAR!=U_FILE_SEP_CHAR
        -#if !(U_PLATFORM == U_PF_CYGWIN && U_PLATFORM_USES_ONLY_WIN32_API)
        -    if(basename==NULL)
        -#endif
        -    {
        -        /* Use lenient matching on Windows, which can accept either \ or /
        -           This is useful for environments like Win32+CygWin which have both.
        -        */
        -        basename=uprv_strrchr(filename, U_FILE_ALT_SEP_CHAR);
        +    //be lenient about pathname separators on Windows, like official implementation of C++17 std::filesystem in MSVC
        +    //would be convenient to merge this loop with the one above, but alas, there is no such solution in the standard library
        +    const char *alt_basename=uprv_strrchr(filename, U_FILE_ALT_SEP_CHAR);
        +    if(alt_basename>basename) {
        +        basename=alt_basename;
             }
         #endif
         
        diff --git a/deps/icu-small/source/tools/toolutil/toolutil.h b/deps/icu-small/source/tools/toolutil/toolutil.h
        index be07787a9fa950..1d0d26c97477c5 100644
        --- a/deps/icu-small/source/tools/toolutil/toolutil.h
        +++ b/deps/icu-small/source/tools/toolutil/toolutil.h
        @@ -23,6 +23,12 @@
         
         #include "unicode/utypes.h"
         
        +#ifndef TRUE
        +#   define TRUE  1
        +#endif
        +#ifndef FALSE
        +#   define FALSE 0
        +#endif
         
         #ifdef __cplusplus
         
        diff --git a/deps/icu-small/source/tools/toolutil/udbgutil.cpp b/deps/icu-small/source/tools/toolutil/udbgutil.cpp
        index 285f68a0ec66a1..993694546f4a72 100644
        --- a/deps/icu-small/source/tools/toolutil/udbgutil.cpp
        +++ b/deps/icu-small/source/tools/toolutil/udbgutil.cpp
        @@ -594,24 +594,11 @@ U_CAPI void udbg_writeIcuInfo(FILE *out) {
           fprintf(out, " \n");
         }
         
        -#define ICU_TRAC_URL "http://bugs.icu-project.org/trac/ticket/"
        -#define CLDR_TRAC_URL "http://unicode.org/cldr/trac/ticket/"
        -#define CLDR_TICKET_PREFIX "cldrbug:"
        +#define UNICODE_BUG_URL "https://unicode-org.atlassian.net/browse/"
        +#define OLD_CLDR_PREFIX "cldrbug:"
        +#define CLDR_BUG_PREFIX "CLDR-"
        +#define ICU_BUG_PREFIX "ICU-"
         
        -U_CAPI char *udbg_knownIssueURLFrom(const char *ticket, char *buf) {
        -  if( ticket==NULL ) {
        -    return NULL;
        -  }
        -
        -  if( !strncmp(ticket, CLDR_TICKET_PREFIX, strlen(CLDR_TICKET_PREFIX)) ) {
        -    strcpy( buf, CLDR_TRAC_URL );
        -    strcat( buf, ticket+strlen(CLDR_TICKET_PREFIX) );
        -  } else {
        -    strcpy( buf, ICU_TRAC_URL );
        -    strcat( buf, ticket );
        -  }
        -  return buf;
        -}
         
         
         #include 
        @@ -641,8 +628,27 @@ KnownIssues::~KnownIssues()
         {
         }
         
        -void KnownIssues::add(const char *ticket, const char *where, const UChar *msg, UBool *firstForTicket, UBool *firstForWhere)
        +/**
        + * Map cldr:1234 to CLDR-1234
        + * Map 1234 to ICU-1234
        + */
        +static std::string mapTicketId(const char *ticketStr) {
        +  std::string ticket(ticketStr);
        +  // TODO: Can remove this function once all logKnownIssue calls are switched over
        +  // to the ICU-1234 and CLDR-1234 format.
        +  if(ticket.rfind(OLD_CLDR_PREFIX) == 0) {
        +    // map cldrbug:1234 to CLDR-1234
        +    ticket.replace(0, uprv_strlen(OLD_CLDR_PREFIX), CLDR_BUG_PREFIX);
        +  } else if(::isdigit(ticket[0])) {
        +    // map 1234 to ICU-1234
        +    ticket.insert(0, ICU_BUG_PREFIX);
        +  }
        +  return ticket;
        +}
        +
        +void KnownIssues::add(const char *ticketStr, const char *where, const UChar *msg, UBool *firstForTicket, UBool *firstForWhere)
         {
        +  const std::string ticket = mapTicketId(ticketStr);
           if(fTable.find(ticket) == fTable.end()) {
             if(firstForTicket!=NULL) *firstForTicket = TRUE;
             fTable[ticket] = std::map < std::string, std::set < std::string > >();
        @@ -664,8 +670,9 @@ void KnownIssues::add(const char *ticket, const char *where, const UChar *msg, U
           fTable[ticket][where].insert(std::string(icu::CStr(ustr)()));
         }
         
        -void KnownIssues::add(const char *ticket, const char *where, const char *msg, UBool *firstForTicket, UBool *firstForWhere)
        +void KnownIssues::add(const char *ticketStr, const char *where, const char *msg, UBool *firstForTicket, UBool *firstForWhere)
         {
        +  const std::string ticket = mapTicketId(ticketStr);
           if(fTable.find(ticket) == fTable.end()) {
             if(firstForTicket!=NULL) *firstForTicket = TRUE;
             fTable[ticket] = std::map < std::string, std::set < std::string > >();
        @@ -697,8 +704,13 @@ UBool KnownIssues::print()
                   std::map <  std::string,  std::set <  std::string > > >::iterator i = fTable.begin();
                i != fTable.end();
                i++ ) {
        -    char URL[1024];
        -    std::cout << '#' << (*i).first << " <" << udbg_knownIssueURLFrom( (*i).first.c_str(), URL ) << ">" << std::endl;
        +    const std::string ticketid = (*i).first;
        +    std::cout << "[" << ticketid << "] ";
        +    if(ticketid.rfind(ICU_BUG_PREFIX) == 0 || ticketid.rfind(CLDR_BUG_PREFIX) == 0) {
        +      // If it's a unicode.org bug.
        +      std::cout << UNICODE_BUG_URL << ticketid;
        +    } // Else: some other kind of bug. Allow this, but without a URL.
        +    std::cout << std::endl;
         
             for( std::map< std::string, std::set < std::string > >::iterator ii = (*i).second.begin();
                  ii != (*i).second.end();
        diff --git a/deps/icu-small/source/tools/toolutil/udbgutil.h b/deps/icu-small/source/tools/toolutil/udbgutil.h
        index 2f186e6ed87f26..b9af132da5ba64 100644
        --- a/deps/icu-small/source/tools/toolutil/udbgutil.h
        +++ b/deps/icu-small/source/tools/toolutil/udbgutil.h
        @@ -113,14 +113,6 @@ U_CAPI void udbg_writeIcuInfo(FILE *f);
          */
         #define UDBG_KNOWNISSUE_LEN 255
         
        -/**
        - * Convert a "known issue" string into a URL
        - * @param ticket ticket string such as "10245" or "cldrbug:5013"
        - * @param buf output buffer - must be UDBG_KNOWNISSUE_LEN in size
        - * @return pointer to output buffer, or NULL on err
        - */
        -U_CAPI char *udbg_knownIssueURLFrom(const char *ticket, char *buf);
        -
         /**
          * Open (or reopen) a 'known issue' table.
          * @param ptr pointer to 'table'. Opaque.
        diff --git a/deps/icu-small/source/tools/toolutil/unewdata.cpp b/deps/icu-small/source/tools/toolutil/unewdata.cpp
        index 22d8540881f454..20f13be5b83ef1 100644
        --- a/deps/icu-small/source/tools/toolutil/unewdata.cpp
        +++ b/deps/icu-small/source/tools/toolutil/unewdata.cpp
        @@ -57,6 +57,16 @@ udata_create(const char *dir, const char *type, const char *name,
                 return NULL;
             }
         
        +    char dirSepChar = U_FILE_SEP_CHAR;
        +#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
        +    // We may need to append a different directory separator when building for Cygwin or MSYS2.
        +    if(dir && *dir) {
        +      if(!uprv_strchr(dir, U_FILE_SEP_CHAR) && uprv_strchr(dir, U_FILE_ALT_SEP_CHAR)) {
        +          dirSepChar = U_FILE_ALT_SEP_CHAR;
        +      }
        +    }
        +#endif
        +
             /* Check that the full path won't be too long */
             length = 0;					/* Start with nothing */
             if(dir != NULL  && *dir !=0)	/* Add directory length if one was given */
        @@ -64,7 +74,7 @@ udata_create(const char *dir, const char *type, const char *name,
         	length += static_cast(strlen(dir));
         
         	/* Add 1 if dir doesn't end with path sep */
        -        if (dir[strlen(dir) - 1]!= U_FILE_SEP_CHAR) {
        +        if (dir[strlen(dir) - 1]!= dirSepChar) {
                     length++;
                 }
         	}
        @@ -87,8 +97,8 @@ udata_create(const char *dir, const char *type, const char *name,
             if(dir!=NULL && *dir!=0) { /* if dir has a value, we prepend it to the filename */
                 char *p=filename+strlen(dir);
                 uprv_strcpy(filename, dir);
        -        if (*(p-1)!=U_FILE_SEP_CHAR) {
        -            *p++=U_FILE_SEP_CHAR;
        +        if (*(p-1)!=dirSepChar) {
        +            *p++=dirSepChar;
                     *p=0;
                 }
             } else { /* otherwise, we'll output to the current dir */
        diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS
        index 6dfd49d38bef4e..33647f09277cf2 100644
        --- a/deps/npm/AUTHORS
        +++ b/deps/npm/AUTHORS
        @@ -735,3 +735,6 @@ Vlad GURDIGA 
         Sébastien Puech 
         Jannis Hell 
         Hollow Man 
        +kai zhu 
        +Alex Woollam 
        +Daniel Fischer 
        diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md
        index 6ac63cfba3336d..a3a9984d24462f 100644
        --- a/deps/npm/CHANGELOG.md
        +++ b/deps/npm/CHANGELOG.md
        @@ -1,3 +1,38 @@
        +## 7.0.15 (2020-11-27)
        +
        +### DEPENDENCIES
        +
        +* [`00e6028ef`](https://github.com/npm/cli/commit/00e6028ef83bf76eaae10241fd7ba59e39768603)
        +  `@npmcli/arborist@1.0.13`
        +    * do not override user-defined shorthand values when saving `package.json`
        +
        +### BUG FIXES
        +
        +* [`9c3413fbc`](https://github.com/npm/cli/commit/9c3413fbcb37e79fc0b3d980e0b5810d7961277c)
        +  [#2034](https://github.com/npm/cli/issues/2034)
        +  [#2245](https://github.com/npm/cli/issues/2245)
        +  `npm link ` should not save `package.json`
        +  ([@ruyadorno](https://github.com/ruyadorno))
        +
        +### DOCUMENTATION
        +
        +* [`1875347f9`](https://github.com/npm/cli/commit/1875347f9f4f2b50c28fe8857c5533eeebf42da2)
        +  [#2196](https://github.com/npm/cli/issues/2196)
        +  remove doc on obsolete `unsafe-perm` flag
        +  ([@kaizhu256](https://github.com/kaizhu256))
        +* [`f51e50603`](https://github.com/npm/cli/commit/f51e5060340c783a8a00dadd98e5786960caf43f)
        +  [#2200](https://github.com/npm/cli/issues/2200)
        +  `config.md` cleanup
        +  ([@alexwoollam](https://github.com/alexwoollam))
        +* [`997cbdb40`](https://github.com/npm/cli/commit/997cbdb400bcd22e457e8a06b69a7be697cfd66d)
        +  [#2238](https://github.com/npm/cli/issues/2238)
        +  Fix broken link to `package.json` documentation
        +  ([@d-fischer](https://github.com/d-fischer))
        +* [`9da972dc4`](https://github.com/npm/cli/commit/9da972dc44c21cf0e337f1c3fca44eb9df3e40d5)
        +  [#2241](https://github.com/npm/cli/issues/2241)
        +  `npm star` docs cleanup
        +  ([@ruyadorno](https://github.com/ruyadorno))
        +
         ## 7.0.14 (2020-11-23)
         
         ### DEPENDENCIES
        diff --git a/deps/npm/docs/content/commands/npm-star.md b/deps/npm/docs/content/commands/npm-star.md
        index c68a057aa08d29..aab6e107747fd9 100644
        --- a/deps/npm/docs/content/commands/npm-star.md
        +++ b/deps/npm/docs/content/commands/npm-star.md
        @@ -8,7 +8,6 @@ description: Mark your favorite packages
         
         ```bash
         npm star [...]
        -npm unstar [...]
         ```
         
         ### Description
        @@ -16,12 +15,26 @@ npm unstar [...]
         "Starring" a package means that you have some interest in it.  It's
         a vaguely positive way to show that you care.
         
        +It's a boolean thing. Starring repeatedly has no additional effect.
        +
        +### More
        +
        +There's also these extra commands to help you manage your favorite packages:
        +
        +#### Unstar
        +
        +You can also "unstar" a package using [`npm unstar`](/commands/npm-unstar)
        +
         "Unstarring" is the same thing, but in reverse.
         
        -It's a boolean thing.  Starring repeatedly has no additional effect.
        +#### Listing stars
        +
        +You can see all your starred packages using [`npm stars`](/commands/npm-stars)
         
         ### See Also
         
        +* [npm unstar](/commands/npm-unstar)
        +* [npm stars](/commands/npm-stars)
         * [npm view](/commands/npm-view)
         * [npm whoami](/commands/npm-whoami)
         * [npm adduser](/commands/npm-adduser)
        diff --git a/deps/npm/docs/content/commands/npm-stars.md b/deps/npm/docs/content/commands/npm-stars.md
        index 706134398f3b12..dab11bc669d1a7 100644
        --- a/deps/npm/docs/content/commands/npm-stars.md
        +++ b/deps/npm/docs/content/commands/npm-stars.md
        @@ -20,6 +20,7 @@ you will most certainly enjoy this command.
         ### See Also
         
         * [npm star](/commands/npm-star)
        +* [npm unstar](/commands/npm-unstar)
         * [npm view](/commands/npm-view)
         * [npm whoami](/commands/npm-whoami)
         * [npm adduser](/commands/npm-adduser)
        diff --git a/deps/npm/docs/content/commands/npm-unstar.md b/deps/npm/docs/content/commands/npm-unstar.md
        new file mode 100644
        index 00000000000000..632b1b5e3360f0
        --- /dev/null
        +++ b/deps/npm/docs/content/commands/npm-unstar.md
        @@ -0,0 +1,36 @@
        +---
        +title: npm-unstar
        +section: 1
        +description: Remove an item from your favorite packages
        +---
        +
        +### Synopsis
        +
        +```bash
        +npm unstar [...]
        +```
        +
        +### Description
        +
        +"Unstarring" a package is the opposite of [`npm star`](/commands/npm-star),
        +it removes an item from your list of favorite packages.
        +
        +### More
        +
        +There's also these extra commands to help you manage your favorite packages:
        +
        +#### Star
        +
        +You can "star" a package using [`npm star`](/commands/npm-star)
        +
        +#### Listing stars
        +
        +You can see all your starred packages using [`npm stars`](/commands/npm-stars)
        +
        +### See Also
        +
        +* [npm star](/commands/npm-star)
        +* [npm stars](/commands/npm-stars)
        +* [npm view](/commands/npm-view)
        +* [npm whoami](/commands/npm-whoami)
        +* [npm adduser](/commands/npm-adduser)
        diff --git a/deps/npm/docs/content/using-npm/config.md b/deps/npm/docs/content/using-npm/config.md
        index 52aa07f1704853..71102d2e204ea0 100644
        --- a/deps/npm/docs/content/using-npm/config.md
        +++ b/deps/npm/docs/content/using-npm/config.md
        @@ -432,7 +432,7 @@ Format `package-lock.json` or `npm-shrinkwrap.json` as a human readable file.
         * Type: Boolean
         
         When "true" displays the message at the end of each `npm install`
        -aknowledging the number of dependencies looking for funding.
        +acknowledging the number of dependencies looking for funding.
         See [`npm fund`](/commands/npm-fund) for details.
         
         #### fetch-retries
        @@ -1096,7 +1096,7 @@ using legacy search endpoint.
         
         If true, success/failure metrics will be reported to the registry stored in
         `metrics-registry`.  These requests contain the number of successful and
        -failing runs of the npm CLI and the time period overwhich those counts were
        +failing runs of the npm CLI and the time period over which those counts were
         gathered. No identifying information is included in these requests.
         
         #### shell
        diff --git a/deps/npm/docs/content/using-npm/scripts.md b/deps/npm/docs/content/using-npm/scripts.md
        index c111aa3f3ab533..cf274e44de3ac7 100644
        --- a/deps/npm/docs/content/using-npm/scripts.md
        +++ b/deps/npm/docs/content/using-npm/scripts.md
        @@ -122,10 +122,8 @@ npm will default some script values based on package contents.
         
         ### User
         
        -If npm was invoked with root privileges, then it will change the uid
        -to the user account or uid specified by the `user` config, which
        -defaults to `nobody`.  Set the `unsafe-perm` flag to run scripts with
        -root privileges.
        +When npm is run as root, scripts are always run with the effective uid
        +and gid of the working directory owner.
         
         ### Environment
         
        diff --git a/deps/npm/docs/content/using-npm/workspaces.md b/deps/npm/docs/content/using-npm/workspaces.md
        index 0379bd1549062e..2024627c758679 100644
        --- a/deps/npm/docs/content/using-npm/workspaces.md
        +++ b/deps/npm/docs/content/using-npm/workspaces.md
        @@ -18,13 +18,13 @@ order to add references to packages that should be symlinked into the current
         
         We also refer to these packages being auto-symlinked during `npm install` as a
         single **workspace**, meaning it's a nested package within the current local
        -file system that is explicitly defined in the [`package.json`](/using-npm/package-json)
        +file system that is explicitly defined in the [`package.json`](/configuring-npm/package-json#workspaces)
         `workspaces` configuration.
         
         ### Installing workspaces
         
         Workspaces are usually defined via the `workspaces` property of the
        -[`package.json`](/using-npm/package-json) file, e.g:
        +[`package.json`](/configuring-npm/package-json#workspaces) file, e.g:
         
         ```json
         {
        diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html
        index 0891ac81e5a760..39519f29717da3 100644
        --- a/deps/npm/docs/output/commands/npm-ls.html
        +++ b/deps/npm/docs/output/commands/npm-ls.html
        @@ -156,7 +156,7 @@ 

        Description

        limit the results to only the paths to the packages named. Note that nested packages will also show the paths to the specified packages. For example, running npm ls promzard in npm’s source tree will show:

        -
            npm@7.0.14 /path/to/npm
        +
            npm@7.0.15 /path/to/npm
             └─┬ init-package-json@0.0.4
               └── promzard@0.1.5
         
        diff --git a/deps/npm/docs/output/commands/npm-star.html b/deps/npm/docs/output/commands/npm-star.html index b1f2f014f06ff8..1f92bc2697d437 100644 --- a/deps/npm/docs/output/commands/npm-star.html +++ b/deps/npm/docs/output/commands/npm-star.html @@ -141,20 +141,27 @@

        npm-star

        Table of contents

        -
        +

        Synopsis

        npm star [<pkg>...]
        -npm unstar [<pkg>...]
         

        Description

        “Starring” a package means that you have some interest in it. It’s a vaguely positive way to show that you care.

        +

        It’s a boolean thing. Starring repeatedly has no additional effect.

        +

        More

        +

        There’s also these extra commands to help you manage your favorite packages:

        +

        Unstar

        +

        You can also “unstar” a package using npm unstar

        “Unstarring” is the same thing, but in reverse.

        -

        It’s a boolean thing. Starring repeatedly has no additional effect.

        +

        Listing stars

        +

        You can see all your starred packages using npm stars

        See Also

          +
        • npm unstar
        • +
        • npm stars
        • npm view
        • npm whoami
        • npm adduser
        • diff --git a/deps/npm/docs/output/commands/npm-stars.html b/deps/npm/docs/output/commands/npm-stars.html index 4c105fcfe39b09..fb80fc0cdee12f 100644 --- a/deps/npm/docs/output/commands/npm-stars.html +++ b/deps/npm/docs/output/commands/npm-stars.html @@ -155,6 +155,7 @@

          Description

          See Also

          • npm star
          • +
          • npm unstar
          • npm view
          • npm whoami
          • npm adduser
          • diff --git a/deps/npm/docs/output/commands/npm-unstar.html b/deps/npm/docs/output/commands/npm-unstar.html new file mode 100644 index 00000000000000..77c7cd3495c4b1 --- /dev/null +++ b/deps/npm/docs/output/commands/npm-unstar.html @@ -0,0 +1,181 @@ + +npm-unstar + + + + + +
            +
            +

            npm-unstar

            +Remove an item from your favorite packages +
            + +
            +

            Table of contents

            + +
            + +

            Synopsis

            +
            npm unstar [<pkg>...]
            +
            +

            Description

            +

            “Unstarring” a package is the opposite of npm star, +it removes an item from your list of favorite packages.

            +

            More

            +

            There’s also these extra commands to help you manage your favorite packages:

            +

            Star

            +

            You can “star” a package using npm star

            +

            Listing stars

            +

            You can see all your starred packages using npm stars

            +

            See Also

            + +
            + + +
            + + + + \ No newline at end of file diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html index bae6ef6e803442..2e8ed9e7103e7b 100644 --- a/deps/npm/docs/output/commands/npm.html +++ b/deps/npm/docs/output/commands/npm.html @@ -148,7 +148,7 @@

            Table of contents

            npm <command> [args]
             

            Version

            -

            7.0.14

            +

            7.0.15

            Description

            npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency diff --git a/deps/npm/docs/output/using-npm/config.html b/deps/npm/docs/output/using-npm/config.html index 6298e2f7d61cb8..e3fbeaae8c89c7 100644 --- a/deps/npm/docs/output/using-npm/config.html +++ b/deps/npm/docs/output/using-npm/config.html @@ -500,7 +500,7 @@

            fund

          • Type: Boolean

          When “true” displays the message at the end of each npm install -aknowledging the number of dependencies looking for funding. +acknowledging the number of dependencies looking for funding. See npm fund for details.

          fetch-retries

            @@ -1069,7 +1069,7 @@

            send-metrics

          If true, success/failure metrics will be reported to the registry stored in metrics-registry. These requests contain the number of successful and -failing runs of the npm CLI and the time period overwhich those counts were +failing runs of the npm CLI and the time period over which those counts were gathered. No identifying information is included in these requests.

          shell

            diff --git a/deps/npm/docs/output/using-npm/scripts.html b/deps/npm/docs/output/using-npm/scripts.html index 8d0ad5090789ef..91814fb58fba5b 100644 --- a/deps/npm/docs/output/using-npm/scripts.html +++ b/deps/npm/docs/output/using-npm/scripts.html @@ -254,10 +254,8 @@

            Default Values

          User

          -

          If npm was invoked with root privileges, then it will change the uid -to the user account or uid specified by the user config, which -defaults to nobody. Set the unsafe-perm flag to run scripts with -root privileges.

          +

          When npm is run as root, scripts are always run with the effective uid +and gid of the working directory owner.

          Environment

          Package scripts run in an environment where many pieces of information are made available regarding the setup of npm and the current state of diff --git a/deps/npm/docs/output/using-npm/workspaces.html b/deps/npm/docs/output/using-npm/workspaces.html index 3da7e2371f9c25..ffec6467c4a515 100644 --- a/deps/npm/docs/output/using-npm/workspaces.html +++ b/deps/npm/docs/output/using-npm/workspaces.html @@ -155,11 +155,11 @@

          Table of contents

          node_modules folder.

          We also refer to these packages being auto-symlinked during npm install as a single workspace, meaning it’s a nested package within the current local -file system that is explicitly defined in the package.json +file system that is explicitly defined in the package.json workspaces configuration.

          Installing workspaces

          Workspaces are usually defined via the workspaces property of the -package.json file, e.g:

          +package.json file, e.g:

          {
             "name": "my-workspaces-powered-project",
             "workspaces": [
          diff --git a/deps/npm/lib/link.js b/deps/npm/lib/link.js
          index bee44d43a7ff62..3f0a518084a9d2 100644
          --- a/deps/npm/lib/link.js
          +++ b/deps/npm/lib/link.js
          @@ -112,14 +112,23 @@ const linkInstall = async args => {
               )
             }
           
          +  // npm link should not save=true by default unless you're
          +  // using any of --save-dev or other types
          +  const save =
          +    Boolean(npm.config.find('save') !== 'default' || npm.flatOptions.saveType)
          +
             // create a new arborist instance for the local prefix and
             // reify all the pending names as symlinks there
             const localArb = new Arborist({
               ...npm.flatOptions,
               path: npm.prefix,
          +    save,
             })
             await localArb.reify({
          +    ...npm.flatOptions,
          +    path: npm.prefix,
               add: names.map(l => `file:${resolve(globalTop, 'node_modules', l)}`),
          +    save,
             })
           
             await reifyFinish(localArb)
          diff --git a/deps/npm/lib/rebuild.js b/deps/npm/lib/rebuild.js
          index 076cfc699f85f5..f373d8cf55f297 100644
          --- a/deps/npm/lib/rebuild.js
          +++ b/deps/npm/lib/rebuild.js
          @@ -1,10 +1,13 @@
          +'use strict'
          +
          +const { resolve } = require('path')
           const Arborist = require('@npmcli/arborist')
          +const npa = require('npm-package-arg')
          +const semver = require('semver')
          +
           const npm = require('./npm.js')
           const usageUtil = require('./utils/usage.js')
          -const { resolve } = require('path')
           const output = require('./utils/output.js')
          -const npa = require('npm-package-arg')
          -const semver = require('semver')
           
           const cmd = (args, cb) => rebuild(args).then(() => cb()).catch(cb)
           
          diff --git a/deps/npm/lib/stars.js b/deps/npm/lib/stars.js
          index bd443d09a593cf..055543210feaa3 100644
          --- a/deps/npm/lib/stars.js
          +++ b/deps/npm/lib/stars.js
          @@ -1,20 +1,22 @@
           'use strict'
           
          -const npm = require('./npm.js')
          -const fetch = require('npm-registry-fetch')
           const log = require('npmlog')
          +const fetch = require('npm-registry-fetch')
          +
          +const npm = require('./npm.js')
           const output = require('./utils/output.js')
           const getIdentity = require('./utils/get-identity.js')
           const usageUtil = require('./utils/usage.js')
          -const usage = usageUtil('stars', 'npm stars []')
           const completion = require('./utils/completion/none.js')
           
          +const usage = usageUtil('stars', 'npm stars []')
          +
           const cmd = (args, cb) => stars(args).then(() => cb()).catch(cb)
           
           const stars = (args) => {
             return stars_(args).catch(er => {
               if (er.code === 'ENEEDAUTH')
          -      log.warn('star', 'auth is required to look up your username')
          +      log.warn('stars', 'auth is required to look up your username')
           
               throw er
             })
          @@ -25,6 +27,7 @@ const stars_ = async ([user = getIdentity(npm.flatOptions)]) => {
               ...npm.flatOptions,
               query: { key: `"${await user}"` },
             })
          +
             if (rows.length === 0)
               log.warn('stars', 'user has not starred any packages')
           
          diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1
          index a99c1d145329c3..cfd7ca7ac8f3a6 100644
          --- a/deps/npm/man/man1/npm-ls.1
          +++ b/deps/npm/man/man1/npm-ls.1
          @@ -22,7 +22,7 @@ For example, running \fBnpm ls promzard\fP in npm's source tree will show:
           .P
           .RS 2
           .nf
          -    npm@7\.0\.14 /path/to/npm
          +    npm@7\.0\.15 /path/to/npm
               └─┬ init\-package\-json@0\.0\.4
                 └── promzard@0\.1\.5
           .fi
          diff --git a/deps/npm/man/man1/npm-star.1 b/deps/npm/man/man1/npm-star.1
          index d47cc7505fcb0d..2a5d196a944b42 100644
          --- a/deps/npm/man/man1/npm-star.1
          +++ b/deps/npm/man/man1/npm-star.1
          @@ -6,7 +6,6 @@
           .RS 2
           .nf
           npm star [\.\.\.]
          -npm unstar [\.\.\.]
           .fi
           .RE
           .SS Description
          @@ -14,12 +13,25 @@ npm unstar [\.\.\.]
           "Starring" a package means that you have some interest in it\.  It's
           a vaguely positive way to show that you care\.
           .P
          +It's a boolean thing\. Starring repeatedly has no additional effect\.
          +.SS More
          +.P
          +There's also these extra commands to help you manage your favorite packages:
          +.SS Unstar
          +.P
          +You can also "unstar" a package using npm help \fBunstar\fP
          +.P
           "Unstarring" is the same thing, but in reverse\.
          +.SS Listing stars
           .P
          -It's a boolean thing\.  Starring repeatedly has no additional effect\.
          +You can see all your starred packages using npm help \fBstars\fP
           .SS See Also
           .RS 0
           .IP \(bu 2
          +npm help unstar
          +.IP \(bu 2
          +npm help stars
          +.IP \(bu 2
           npm help view
           .IP \(bu 2
           npm help whoami
          diff --git a/deps/npm/man/man1/npm-stars.1 b/deps/npm/man/man1/npm-stars.1
          index 39f539e52597a6..9c16add7c1c424 100644
          --- a/deps/npm/man/man1/npm-stars.1
          +++ b/deps/npm/man/man1/npm-stars.1
          @@ -20,6 +20,8 @@ you will most certainly enjoy this command\.
           .IP \(bu 2
           npm help star
           .IP \(bu 2
          +npm help unstar
          +.IP \(bu 2
           npm help view
           .IP \(bu 2
           npm help whoami
          diff --git a/deps/npm/man/man1/npm-unstar.1 b/deps/npm/man/man1/npm-unstar.1
          new file mode 100644
          index 00000000000000..1fb6177273e3c5
          --- /dev/null
          +++ b/deps/npm/man/man1/npm-unstar.1
          @@ -0,0 +1,37 @@
          +.TH "NPM\-UNSTAR" "1" "November 2020" "" ""
          +.SH "NAME"
          +\fBnpm-unstar\fR \- Remove an item from your favorite packages
          +.SS Synopsis
          +.P
          +.RS 2
          +.nf
          +npm unstar [\.\.\.]
          +.fi
          +.RE
          +.SS Description
          +.P
          +"Unstarring" a package is the opposite of npm help \fBstar\fP,
          +it removes an item from your list of favorite packages\.
          +.SS More
          +.P
          +There's also these extra commands to help you manage your favorite packages:
          +.SS Star
          +.P
          +You can "star" a package using npm help \fBstar\fP
          +.SS Listing stars
          +.P
          +You can see all your starred packages using npm help \fBstars\fP
          +.SS See Also
          +.RS 0
          +.IP \(bu 2
          +npm help star
          +.IP \(bu 2
          +npm help stars
          +.IP \(bu 2
          +npm help view
          +.IP \(bu 2
          +npm help whoami
          +.IP \(bu 2
          +npm help adduser
          +
          +.RE
          diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1
          index e55d61f2df28a9..c3d1eb8b47a23c 100644
          --- a/deps/npm/man/man1/npm.1
          +++ b/deps/npm/man/man1/npm.1
          @@ -10,7 +10,7 @@ npm  [args]
           .RE
           .SS Version
           .P
          -7\.0\.14
          +7\.0\.15
           .SS Description
           .P
           npm is the package manager for the Node JavaScript platform\.  It puts
          diff --git a/deps/npm/man/man7/config.7 b/deps/npm/man/man7/config.7
          index 1d40942e9f9111..5a77bec3d95cf2 100644
          --- a/deps/npm/man/man7/config.7
          +++ b/deps/npm/man/man7/config.7
          @@ -577,7 +577,7 @@ Type: Boolean
           .RE
           .P
           When "true" displays the message at the end of each \fBnpm install\fP
          -aknowledging the number of dependencies looking for funding\.
          +acknowledging the number of dependencies looking for funding\.
           See npm help \fBfund\fP for details\.
           .SS fetch\-retries
           .RS 0
          @@ -1473,7 +1473,7 @@ Type: Boolean
           .P
           If true, success/failure metrics will be reported to the registry stored in
           \fBmetrics\-registry\fP\|\.  These requests contain the number of successful and
          -failing runs of the npm CLI and the time period overwhich those counts were
          +failing runs of the npm CLI and the time period over which those counts were
           gathered\. No identifying information is included in these requests\.
           .SS shell
           .RS 0
          diff --git a/deps/npm/man/man7/scripts.7 b/deps/npm/man/man7/scripts.7
          index 2067fe45d92383..35a34b43a03b90 100644
          --- a/deps/npm/man/man7/scripts.7
          +++ b/deps/npm/man/man7/scripts.7
          @@ -177,10 +177,8 @@ default the \fBinstall\fP command to compile using node\-gyp\.
           .RE
           .SS User
           .P
          -If npm was invoked with root privileges, then it will change the uid
          -to the user account or uid specified by the \fBuser\fP config, which
          -defaults to \fBnobody\fP\|\.  Set the \fBunsafe\-perm\fP flag to run scripts with
          -root privileges\.
          +When npm is run as root, scripts are always run with the effective uid
          +and gid of the working directory owner\.
           .SS Environment
           .P
           Package scripts run in an environment where many pieces of information
          diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js
          index 92943554b474e5..6db1b7391c4d41 100644
          --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js
          +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js
          @@ -2,7 +2,7 @@
           
           const pacote = require('pacote')
           const rpj = require('read-package-json-fast')
          -const { orderDeps, updateDepSpec } = require('../dep-spec.js')
          +const { updateDepSpec } = require('../dep-spec.js')
           const AuditReport = require('../audit-report.js')
           const {subset} = require('semver')
           
          @@ -11,7 +11,6 @@ const {depth: dfwalk} = require('treeverse')
           const fs = require('fs')
           const {promisify} = require('util')
           const symlink = promisify(fs.symlink)
          -const writeFile = promisify(fs.writeFile)
           const mkdirp = require('mkdirp-infer-owner')
           const moveFile = require('@npmcli/move-file')
           const rimraf = promisify(require('rimraf'))
          @@ -22,6 +21,7 @@ const Diff = require('../diff.js')
           const retirePath = require('../retire-path.js')
           const promiseAllRejectLate = require('promise-all-reject-late')
           const optionalSet = require('../optional-set.js')
          +const updateRootPackageJson = require('../update-root-package-json.js')
           
           const _retiredPaths = Symbol('retiredPaths')
           const _retiredUnchanged = Symbol('retiredUnchanged')
          @@ -830,19 +830,10 @@ module.exports = cls => class Reifier extends cls {
               }
           
               // preserve indentation, if possible
          -    const pj = resolve(this.idealTree.path, 'package.json')
               const {
                 [Symbol.for('indent')]: indent,
          -      [Symbol.for('newline')]: newline,
               } = this.idealTree.package
          -    const pjData = orderDeps({
          -      ...this.idealTree.package,
          -      _id: undefined, // strip this off
          -    })
               const format = indent === undefined ? '  ' : indent
          -    const eol = newline === undefined ? '\n' : newline
          -    const json = (JSON.stringify(pjData, null, format) + '\n')
          -      .replace(/\n/g, eol)
           
               const saveOpt = {
                 format: (this[_formatPackageLock] && format) ? format
          @@ -851,7 +842,7 @@ module.exports = cls => class Reifier extends cls {
           
               return Promise.all([
                 this[_saveLockFile](saveOpt),
          -      writeFile(pj, json),
          +      updateRootPackageJson({ tree: this.idealTree }),
               ]).then(() => process.emit('timeEnd', 'reify:save'))
             }
           
          diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/update-root-package-json.js b/deps/npm/node_modules/@npmcli/arborist/lib/update-root-package-json.js
          new file mode 100644
          index 00000000000000..f5d62f7a5a713a
          --- /dev/null
          +++ b/deps/npm/node_modules/@npmcli/arborist/lib/update-root-package-json.js
          @@ -0,0 +1,48 @@
          +const fs = require('fs')
          +const promisify = require('util').promisify
          +const readFile = promisify(fs.readFile)
          +const writeFile = promisify(fs.writeFile)
          +const {resolve} = require('path')
          +
          +const parseJSON = require('json-parse-even-better-errors')
          +
          +const { orderDeps } = require('./dep-spec.js')
          +
          +const depTypes = new Set([
          +  'dependencies',
          +  'optionalDependencies',
          +  'devDependencies',
          +  'peerDependencies',
          +])
          +
          +async function updateRootPackageJson ({ tree }) {
          +  const filename = resolve(tree.path, 'package.json')
          +  const originalContent = await readFile(filename, 'utf8')
          +    .then(data => parseJSON(data))
          +    .catch(() => null)
          +
          +  const depsData = orderDeps({
          +    ...tree.package,
          +  })
          +
          +  // if there's no package.json, just use internal pkg info as source of truth
          +  const packageJsonContent = originalContent || depsData
          +
          +  // loop through all types of dependencies and update package json content
          +  for (const type of depTypes)
          +    packageJsonContent[type] = depsData[type]
          +
          +  // format content
          +  const {
          +    [Symbol.for('indent')]: indent,
          +    [Symbol.for('newline')]: newline,
          +  } = tree.package
          +  const format = indent === undefined ? '  ' : indent
          +  const eol = newline === undefined ? '\n' : newline
          +  const content = (JSON.stringify(packageJsonContent, null, format) + '\n')
          +    .replace(/\n/g, eol)
          +
          +  return writeFile(filename, content)
          +}
          +
          +module.exports = updateRootPackageJson
          diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json
          index e6e93fb67cec9a..a83ac1e43f7383 100644
          --- a/deps/npm/node_modules/@npmcli/arborist/package.json
          +++ b/deps/npm/node_modules/@npmcli/arborist/package.json
          @@ -1,6 +1,6 @@
           {
             "name": "@npmcli/arborist",
          -  "version": "1.0.12",
          +  "version": "1.0.13",
             "description": "Manage node_modules trees",
             "dependencies": {
               "@npmcli/installed-package-contents": "^1.0.5",
          diff --git a/deps/npm/package.json b/deps/npm/package.json
          index c67b3205a75a8f..540ca1f1ad14b7 100644
          --- a/deps/npm/package.json
          +++ b/deps/npm/package.json
          @@ -1,5 +1,5 @@
           {
          -  "version": "7.0.14",
          +  "version": "7.0.15",
             "name": "npm",
             "description": "a package manager for JavaScript",
             "keywords": [
          @@ -42,7 +42,7 @@
               "./package.json": "./package.json"
             },
             "dependencies": {
          -    "@npmcli/arborist": "^1.0.12",
          +    "@npmcli/arborist": "^1.0.13",
               "@npmcli/ci-detect": "^1.2.0",
               "@npmcli/config": "^1.2.1",
               "@npmcli/run-script": "^1.8.1",
          @@ -214,6 +214,7 @@
               "Remove the 'files' below once we're done porting old tests over"
             ],
             "tap": {
          +    "color": 1,
               "files": "test/{lib,bin}",
               "coverage-map": "test/coverage-map.js",
               "check-coverage": true,
          diff --git a/deps/npm/tap-snapshots/test-lib-stars.js-TAP.test.js b/deps/npm/tap-snapshots/test-lib-stars.js-TAP.test.js
          new file mode 100644
          index 00000000000000..ac628148fd7061
          --- /dev/null
          +++ b/deps/npm/tap-snapshots/test-lib-stars.js-TAP.test.js
          @@ -0,0 +1,15 @@
          +/* IMPORTANT
          + * This snapshot file is auto-generated, but designed for humans.
          + * It should be checked into source control and tracked carefully.
          + * Re-generate by setting TAP_SNAPSHOT=1 and running tests.
          + * Make sure to inspect the output below.  Do not ignore changes!
          + */
          +'use strict'
          +exports[`test/lib/stars.js TAP no args > should output a list of starred packages 1`] = `
          +
          +@npmcli/arborist
          +@npmcli/map-workspaces
          +libnpmfund
          +libnpmpublish
          +ipt
          +`
          diff --git a/deps/npm/test/lib/link.js b/deps/npm/test/lib/link.js
          index 9b7c5df642178f..a478259f7b409a 100644
          --- a/deps/npm/test/lib/link.js
          +++ b/deps/npm/test/lib/link.js
          @@ -23,6 +23,7 @@ const npm = {
               get () {
                 return false
               },
          +    find () {},
             },
           }
           const printLinks = async (opts) => {
          @@ -196,7 +197,7 @@ t.test('link global linked pkg to local nm when using args', (t) => {
           })
           
           t.test('link pkg already in global space', (t) => {
          -  t.plan(2)
          +  t.plan(3)
           
             const testdir = t.testdir({
               'global-prefix': {
          @@ -224,17 +225,26 @@ t.test('link pkg already in global space', (t) => {
             npm.globalDir = resolve(testdir, 'global-prefix', 'lib', 'node_modules')
             npm.prefix = resolve(testdir, 'my-project')
           
          +  npm.config.find = () => 'default'
          +
             const _cwd = process.cwd()
             process.chdir(npm.prefix)
           
             reifyOutput = async () => {
               reifyOutput = undefined
               process.chdir(_cwd)
          +    npm.config.find = () => null
           
               const links = await printLinks({
                 path: npm.prefix,
               })
           
          +    t.equal(
          +      require(resolve(testdir, 'my-project', 'package.json')).dependencies,
          +      undefined,
          +      'should not save to package.json upon linking'
          +    )
          +
               t.matchSnapshot(links, 'should create a local symlink to global pkg')
             }
           
          diff --git a/deps/npm/test/lib/npm.js b/deps/npm/test/lib/npm.js
          index 0e0adcf1db9376..6bfb5b4376d9a2 100644
          --- a/deps/npm/test/lib/npm.js
          +++ b/deps/npm/test/lib/npm.js
          @@ -8,11 +8,16 @@ const event = process.env.npm_lifecycle_event
           for (const env of Object.keys(process.env).filter(e => /^npm_/.test(e))) {
             if (env === 'npm_command') {
               // should only be running this in the 'test' or 'run-script' command!
          -    // if the lifecycle event is 'test', then it'll be 'test', otherwise
          -    // it should always be run-script.  Of course, it'll be missing if this
          -    // test is just run directly, which is also acceptable.
          -    const cmd = event === 'test' ? 'test' : 'run-script'
          -    t.match(process.env[env], cmd)
          +    // if the lifecycle event is 'test', then it'll be either 'test' or 'run',
          +    // otherwise it should always be run-script. Of course, it'll be missing
          +    // if this test is just run directly, which is also acceptable.
          +    if (event === 'test') {
          +      t.ok(
          +        ['test', 'run-script'].some(i => i === event),
          +        'should match "npm test" or "npm run test"'
          +      )
          +    } else
          +      t.match(process.env[env], 'run-script')
             }
             delete process.env[env]
           }
          diff --git a/deps/npm/test/lib/rebuild.js b/deps/npm/test/lib/rebuild.js
          new file mode 100644
          index 00000000000000..dbc37d57af5665
          --- /dev/null
          +++ b/deps/npm/test/lib/rebuild.js
          @@ -0,0 +1,222 @@
          +const fs = require('fs')
          +const { resolve } = require('path')
          +const t = require('tap')
          +const requireInject = require('require-inject')
          +
          +let result = ''
          +
          +const npm = {
          +  globalDir: '',
          +  flatOptions: {
          +    global: false,
          +  },
          +  prefix: '',
          +}
          +const mocks = {
          +  '../../lib/npm.js': npm,
          +  '../../lib/utils/output.js': (...msg) => {
          +    result += msg.join('\n')
          +  },
          +  '../../lib/utils/usage.js': () => 'usage instructions',
          +}
          +
          +const rebuild = requireInject('../../lib/rebuild.js', mocks)
          +
          +t.afterEach(cb => {
          +  npm.prefix = ''
          +  npm.flatOptions.global = false
          +  npm.globalDir = ''
          +  result = ''
          +  cb()
          +})
          +
          +t.test('no args', t => {
          +  const path = t.testdir({
          +    node_modules: {
          +      a: {
          +        'package.json': JSON.stringify({
          +          name: 'a',
          +          version: '1.0.0',
          +          bin: 'cwd',
          +          scripts: {
          +            preinstall: `node -e 'require("fs").writeFileSync("cwd", "")'`,
          +          },
          +        }),
          +      },
          +      b: {
          +        'package.json': JSON.stringify({
          +          name: 'b',
          +          version: '1.0.0',
          +          bin: 'cwd',
          +          scripts: {
          +            preinstall: `node -e 'require("fs").writeFileSync("cwd", "")'`,
          +          },
          +        }),
          +      },
          +    },
          +  })
          +
          +  const aBuildFile = resolve(path, 'node_modules/a/cwd')
          +  const bBuildFile = resolve(path, 'node_modules/b/cwd')
          +  const aBinFile = resolve(path, 'node_modules/.bin/a')
          +  const bBinFile = resolve(path, 'node_modules/.bin/b')
          +  t.throws(() => fs.statSync(aBuildFile))
          +  t.throws(() => fs.statSync(bBuildFile))
          +  t.throws(() => fs.statSync(aBinFile))
          +  t.throws(() => fs.statSync(bBinFile))
          +
          +  npm.prefix = path
          +
          +  rebuild([], err => {
          +    if (err)
          +      throw err
          +
          +    t.ok(() => fs.statSync(aBuildFile))
          +    t.ok(() => fs.statSync(bBuildFile))
          +    t.ok(() => fs.statSync(aBinFile))
          +    t.ok(() => fs.statSync(bBinFile))
          +
          +    t.equal(
          +      result,
          +      'rebuilt dependencies successfully',
          +      'should output success msg'
          +    )
          +
          +    t.end()
          +  })
          +})
          +
          +t.test('filter by pkg name', t => {
          +  const path = t.testdir({
          +    node_modules: {
          +      a: {
          +        'index.js': '',
          +        'package.json': JSON.stringify({
          +          name: 'a',
          +          version: '1.0.0',
          +          bin: 'index.js',
          +        }),
          +      },
          +      b: {
          +        'index.js': '',
          +        'package.json': JSON.stringify({
          +          name: 'b',
          +          version: '1.0.0',
          +          bin: 'index.js',
          +        }),
          +      },
          +    },
          +  })
          +
          +  npm.prefix = path
          +
          +  const aBinFile = resolve(path, 'node_modules/.bin/a')
          +  const bBinFile = resolve(path, 'node_modules/.bin/b')
          +  t.throws(() => fs.statSync(aBinFile))
          +  t.throws(() => fs.statSync(bBinFile))
          +
          +  rebuild(['b'], err => {
          +    if (err)
          +      throw err
          +
          +    t.throws(() => fs.statSync(aBinFile), 'should not link a bin')
          +    t.ok(() => fs.statSync(bBinFile), 'should link filtered pkg bin')
          +
          +    t.end()
          +  })
          +})
          +
          +t.test('filter by pkg@', t => {
          +  const path = t.testdir({
          +    node_modules: {
          +      a: {
          +        'index.js': '',
          +        'package.json': JSON.stringify({
          +          name: 'a',
          +          version: '1.0.0',
          +          bin: 'index.js',
          +        }),
          +        node_modules: {
          +          b: {
          +            'index.js': '',
          +            'package.json': JSON.stringify({
          +              name: 'b',
          +              version: '2.0.0',
          +              bin: 'index.js',
          +            }),
          +          },
          +        },
          +      },
          +      b: {
          +        'index.js': '',
          +        'package.json': JSON.stringify({
          +          name: 'b',
          +          version: '1.0.0',
          +          bin: 'index.js',
          +        }),
          +      },
          +    },
          +  })
          +
          +  npm.prefix = path
          +
          +  const bBinFile = resolve(path, 'node_modules/.bin/b')
          +  const nestedBinFile = resolve(path, 'node_modules/a/node_modules/.bin/b')
          +
          +  rebuild(['b@2'], err => {
          +    if (err)
          +      throw err
          +
          +    t.throws(() => fs.statSync(bBinFile), 'should not link b bin')
          +    t.ok(() => fs.statSync(nestedBinFile), 'should link filtered pkg bin')
          +
          +    t.end()
          +  })
          +})
          +
          +t.test('filter must be a semver version/range', t => {
          +  rebuild(['b:git+ssh://github.com/npm/arborist'], err => {
          +    t.match(
          +      err,
          +      /Error: `npm rebuild` only supports SemVer version\/range specifiers/,
          +      'should throw type error'
          +    )
          +
          +    t.end()
          +  })
          +})
          +
          +t.test('global prefix', t => {
          +  const globalPath = t.testdir({
          +    lib: {
          +      node_modules: {
          +        a: {
          +          'index.js': '',
          +          'package.json': JSON.stringify({
          +            name: 'a',
          +            version: '1.0.0',
          +            bin: 'index.js',
          +          }),
          +        },
          +      },
          +    },
          +  })
          +
          +  npm.flatOptions.global = true
          +  npm.globalDir = resolve(globalPath, 'lib', 'node_modules')
          +
          +  rebuild([], err => {
          +    if (err)
          +      throw err
          +
          +    t.ok(() => fs.statSync(resolve(globalPath, 'lib/node_modules/.bin/a')))
          +
          +    t.equal(
          +      result,
          +      'rebuilt dependencies successfully',
          +      'should output success msg'
          +    )
          +
          +    t.end()
          +  })
          +})
          diff --git a/deps/npm/test/lib/stars.js b/deps/npm/test/lib/stars.js
          new file mode 100644
          index 00000000000000..ff636a5e5496f7
          --- /dev/null
          +++ b/deps/npm/test/lib/stars.js
          @@ -0,0 +1,151 @@
          +const requireInject = require('require-inject')
          +const t = require('tap')
          +
          +let result = ''
          +
          +const noop = () => null
          +const npm = { config: { get () {} }, flatOptions: {} }
          +const npmFetch = { json: noop }
          +const npmlog = { warn: noop }
          +const mocks = {
          +  npmlog,
          +  'npm-registry-fetch': npmFetch,
          +  '../../lib/npm.js': npm,
          +  '../../lib/utils/output.js': (...msg) => {
          +    result = [result, ...msg].join('\n')
          +  },
          +  '../../lib/utils/get-identity.js': async () => 'foo',
          +  '../../lib/utils/usage.js': () => 'usage instructions',
          +}
          +
          +const stars = requireInject('../../lib/stars.js', mocks)
          +
          +t.afterEach(cb => {
          +  npm.config = { get () {} }
          +  npmlog.warn = noop
          +  result = ''
          +  cb()
          +})
          +
          +t.test('no args', t => {
          +  npmFetch.json = async (uri, opts) => {
          +    t.equal(uri, '/-/_view/starredByUser', 'should fetch from expected uri')
          +    t.equal(opts.query.key, '"foo"', 'should match logged in username')
          +
          +    return {
          +      rows: [
          +        { value: '@npmcli/arborist' },
          +        { value: '@npmcli/map-workspaces' },
          +        { value: 'libnpmfund' },
          +        { value: 'libnpmpublish' },
          +        { value: 'ipt' },
          +      ],
          +    }
          +  }
          +
          +  stars([], err => {
          +    if (err)
          +      throw err
          +
          +    t.matchSnapshot(
          +      result,
          +      'should output a list of starred packages'
          +    )
          +
          +    t.end()
          +  })
          +})
          +
          +t.test('npm star ', t => {
          +  t.plan(3)
          +  npmFetch.json = async (uri, opts) => {
          +    t.equal(uri, '/-/_view/starredByUser', 'should fetch from expected uri')
          +    t.equal(opts.query.key, '"ruyadorno"', 'should match username')
          +
          +    return {
          +      rows: [{ value: '@npmcli/arborist' }],
          +    }
          +  }
          +
          +  stars(['ruyadorno'], err => {
          +    if (err)
          +      throw err
          +
          +    t.match(
          +      result,
          +      '@npmcli/arborist',
          +      'should output expected list of starred packages'
          +    )
          +  })
          +})
          +
          +t.test('unauthorized request', t => {
          +  t.plan(4)
          +  npmFetch.json = async () => {
          +    throw Object.assign(
          +      new Error('Not logged in'),
          +      { code: 'ENEEDAUTH' }
          +    )
          +  }
          +
          +  npmlog.warn = (title, msg) => {
          +    t.equal(title, 'stars', 'should use expected title')
          +    t.equal(
          +      msg,
          +      'auth is required to look up your username',
          +      'should warn auth required msg'
          +    )
          +  }
          +
          +  stars([], err => {
          +    t.match(
          +      err,
          +      /Not logged in/,
          +      'should throw unauthorized request msg'
          +    )
          +
          +    t.equal(
          +      result,
          +      '',
          +      'should have empty output'
          +    )
          +  })
          +})
          +
          +t.test('unexpected error', t => {
          +  npmFetch.json = async () => {
          +    throw new Error('ERROR')
          +  }
          +
          +  npmlog.warn = (title, msg) => {
          +    throw new Error('Should not output extra warning msgs')
          +  }
          +
          +  stars([], err => {
          +    t.match(
          +      err,
          +      /ERROR/,
          +      'should throw unexpected error message'
          +    )
          +    t.end()
          +  })
          +})
          +
          +t.test('no pkg starred', t => {
          +  t.plan(2)
          +  npmFetch.json = async (uri, opts) => ({ rows: [] })
          +
          +  npmlog.warn = (title, msg) => {
          +    t.equal(title, 'stars', 'should use expected title')
          +    t.equal(
          +      msg,
          +      'user has not starred any packages',
          +      'should warn no starred packages msg'
          +    )
          +  }
          +
          +  stars([], err => {
          +    if (err)
          +      throw err
          +  })
          +})
          diff --git a/deps/v8/src/builtins/builtins-callsite.cc b/deps/v8/src/builtins/builtins-callsite.cc
          index 5b7807ed4a9e50..63e4d7a572e53b 100644
          --- a/deps/v8/src/builtins/builtins-callsite.cc
          +++ b/deps/v8/src/builtins/builtins-callsite.cc
          @@ -53,6 +53,22 @@ BUILTIN(CallSitePrototypeGetColumnNumber) {
             return PositiveNumberOrNull(it.Frame()->GetColumnNumber(), isolate);
           }
           
          +BUILTIN(CallSitePrototypeGetEnclosingColumnNumber) {
          +  HandleScope scope(isolate);
          +  CHECK_CALLSITE(recv, "getEnclosingColumnNumber");
          +  FrameArrayIterator it(isolate, GetFrameArray(isolate, recv),
          +                        GetFrameIndex(isolate, recv));
          +  return PositiveNumberOrNull(it.Frame()->GetEnclosingColumnNumber(), isolate);
          +}
          +
          +BUILTIN(CallSitePrototypeGetEnclosingLineNumber) {
          +  HandleScope scope(isolate);
          +  CHECK_CALLSITE(recv, "getEnclosingLineNumber");
          +  FrameArrayIterator it(isolate, GetFrameArray(isolate, recv),
          +                        GetFrameIndex(isolate, recv));
          +  return PositiveNumberOrNull(it.Frame()->GetEnclosingLineNumber(), isolate);
          +}
          +
           BUILTIN(CallSitePrototypeGetEvalOrigin) {
             HandleScope scope(isolate);
             CHECK_CALLSITE(recv, "getEvalOrigin");
          diff --git a/deps/v8/src/builtins/builtins-definitions.h b/deps/v8/src/builtins/builtins-definitions.h
          index a6e020ada3f419..9d17a866413c68 100644
          --- a/deps/v8/src/builtins/builtins-definitions.h
          +++ b/deps/v8/src/builtins/builtins-definitions.h
          @@ -365,6 +365,8 @@ namespace internal {
                                                                                          \
             /* CallSite */                                                               \
             CPP(CallSitePrototypeGetColumnNumber)                                        \
          +  CPP(CallSitePrototypeGetEnclosingColumnNumber)                               \
          +  CPP(CallSitePrototypeGetEnclosingLineNumber)                                 \
             CPP(CallSitePrototypeGetEvalOrigin)                                          \
             CPP(CallSitePrototypeGetFileName)                                            \
             CPP(CallSitePrototypeGetFunction)                                            \
          diff --git a/deps/v8/src/execution/messages.cc b/deps/v8/src/execution/messages.cc
          index 86e3d48882d601..ab6c6bc3926191 100644
          --- a/deps/v8/src/execution/messages.cc
          +++ b/deps/v8/src/execution/messages.cc
          @@ -514,6 +514,26 @@ int JSStackFrame::GetColumnNumber() {
             return kNone;
           }
           
          +int JSStackFrame::GetEnclosingLineNumber() {
          +  if (HasScript()) {
          +    Handle shared = handle(function_->shared(), isolate_);
          +    return Script::GetLineNumber(GetScript(),
          +                                 shared->function_token_position()) + 1;
          +  } else {
          +    return kNone;
          +  }
          +}
          +
          +int JSStackFrame::GetEnclosingColumnNumber() {
          +  if (HasScript()) {
          +    Handle shared = handle(function_->shared(), isolate_);
          +    return Script::GetColumnNumber(GetScript(),
          +                                   shared->function_token_position()) + 1;
          +  } else {
          +    return kNone;
          +  }
          +}
          +
           int JSStackFrame::GetPromiseIndex() const {
             return (is_promise_all_ || is_promise_any_) ? offset_ : kNone;
           }
          @@ -602,6 +622,12 @@ int WasmStackFrame::GetPosition() const {
           
           int WasmStackFrame::GetColumnNumber() { return GetModuleOffset(); }
           
          +int WasmStackFrame::GetEnclosingColumnNumber() {
          +  const int function_offset =
          +      GetWasmFunctionOffset(wasm_instance_->module(), wasm_func_index_);
          +  return function_offset;
          +}
          +
           int WasmStackFrame::GetModuleOffset() const {
             const int function_offset =
                 GetWasmFunctionOffset(wasm_instance_->module(), wasm_func_index_);
          @@ -672,6 +698,26 @@ int AsmJsWasmStackFrame::GetColumnNumber() {
             return Script::GetColumnNumber(script, GetPosition()) + 1;
           }
           
          +int AsmJsWasmStackFrame::GetEnclosingLineNumber() {
          +  DCHECK_LE(0, GetPosition());
          +  Handle
          +```
          +
          +This will create a global `JSON5` variable.
          +
          +## API
          +The JSON5 API is compatible with the [JSON API].
          +
          +[JSON API]:
          +https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON
          +
          +### JSON5.parse()
          +Parses a JSON5 string, constructing the JavaScript value or object described by
          +the string. An optional reviver function can be provided to perform a
          +transformation on the resulting object before it is returned.
          +
          +#### Syntax
          +    JSON5.parse(text[, reviver])
          +
          +#### Parameters
          +- `text`: The string to parse as JSON5.
          +- `reviver`: If a function, this prescribes how the value originally produced by
          +  parsing is transformed, before being returned.
          +
          +#### Return value
          +The object corresponding to the given JSON5 text.
          +
          +### JSON5.stringify()
          +Converts a JavaScript value to a JSON5 string, optionally replacing values if a
          +replacer function is specified, or optionally including only the specified
          +properties if a replacer array is specified.
          +
          +#### Syntax
          +    JSON5.stringify(value[, replacer[, space]])
          +    JSON5.stringify(value[, options])
          +
          +#### Parameters
          +- `value`: The value to convert to a JSON5 string.
          +- `replacer`: A function that alters the behavior of the stringification
          +  process, or an array of String and Number objects that serve as a whitelist
          +  for selecting/filtering the properties of the value object to be included in
          +  the JSON5 string. If this value is null or not provided, all properties of the
          +  object are included in the resulting JSON5 string.
          +- `space`: A String or Number object that's used to insert white space into the
          +  output JSON5 string for readability purposes. If this is a Number, it
          +  indicates the number of space characters to use as white space; this number is
          +  capped at 10 (if it is greater, the value is just 10). Values less than 1
          +  indicate that no space should be used. If this is a String, the string (or the
          +  first 10 characters of the string, if it's longer than that) is used as white
          +  space. If this parameter is not provided (or is null), no white space is used.
          +  If white space is used, trailing commas will be used in objects and arrays.
          +- `options`: An object with the following properties:
          +  - `replacer`: Same as the `replacer` parameter.
          +  - `space`: Same as the `space` parameter.
          +  - `quote`: A String representing the quote character to use when serializing
          +    strings.
          +
          +#### Return value
          +A JSON5 string representing the value.
          +
          +### Node.js `require()` JSON5 files
          +When using Node.js, you can `require()` JSON5 files by adding the following
          +statement.
          +
          +```js
          +require('json5/lib/register')
          +```
          +
          +Then you can load a JSON5 file with a Node.js `require()` statement. For
          +example:
          +
          +```js
          +const config = require('./config.json5')
          +```
          +
          +## CLI
          +Since JSON is more widely used than JSON5, this package includes a CLI for
          +converting JSON5 to JSON and for validating the syntax of JSON5 documents.
          +
          +### Installation
          +```sh
          +npm install --global json5
          +```
          +
          +### Usage
          +```sh
          +json5 [options] 
          +```
          +
          +If `` is not provided, then STDIN is used.
          +
          +#### Options:
          +- `-s`, `--space`: The number of spaces to indent or `t` for tabs
          +- `-o`, `--out-file [file]`: Output to the specified file, otherwise STDOUT
          +- `-v`, `--validate`: Validate JSON5 but do not output JSON
          +- `-V`, `--version`: Output the version number
          +- `-h`, `--help`: Output usage information
          +
          +## Contributing
          +### Development
          +```sh
          +git clone https://github.com/json5/json5
          +cd json5
          +npm install
          +```
          +
          +When contributing code, please write relevant tests and run `npm test` and `npm
          +run lint` before submitting pull requests. Please use an editor that supports
          +[EditorConfig](http://editorconfig.org/).
          +
          +### Issues
          +To report bugs or request features regarding the JSON5 data format, please
          +submit an issue to the [official specification
          +repository](https://github.com/json5/json5-spec).
          +
          +To report bugs or request features regarding the JavaScript implementation of
          +JSON5, please submit an issue to this repository.
          +
          +## License
          +MIT. See [LICENSE.md](./LICENSE.md) for details.
          +
          +## Credits
          +[Assem Kishore](https://github.com/aseemk) founded this project.
          +
          +[Michael Bolin](http://bolinfest.com/) independently arrived at and published
          +some of these same ideas with awesome explanations and detail. Recommended
          +reading: [Suggested Improvements to JSON](http://bolinfest.com/essays/json.html)
          +
          +[Douglas Crockford](http://www.crockford.com/) of course designed and built
          +JSON, but his state machine diagrams on the [JSON website](http://json.org/), as
          +cheesy as it may sound, gave us motivation and confidence that building a new
          +parser to implement these ideas was within reach! The original
          +implementation of JSON5 was also modeled directly off of Doug’s open-source
          +[json_parse.js] parser. We’re grateful for that clean and well-documented
          +code.
          +
          +[json_parse.js]:
          +https://github.com/douglascrockford/JSON-js/blob/03157639c7a7cddd2e9f032537f346f1a87c0f6d/json_parse.js
          +
          +[Max Nanasy](https://github.com/MaxNanasy) has been an early and prolific
          +supporter, contributing multiple patches and ideas.
          +
          +[Andrew Eisenberg](https://github.com/aeisenberg) contributed the original
          +`stringify` method.
          +
          +[Jordan Tucker](https://github.com/jordanbtucker) has aligned JSON5 more closely
          +with ES5, wrote the official JSON5 specification, completely rewrote the
          +codebase from the ground up, and is actively maintaining this project.
          diff --git a/tools/node_modules/@babel/core/node_modules/json5/dist/index.js b/tools/node_modules/@babel/core/node_modules/json5/dist/index.js
          new file mode 100644
          index 00000000000000..9f98eb39da13fe
          --- /dev/null
          +++ b/tools/node_modules/@babel/core/node_modules/json5/dist/index.js
          @@ -0,0 +1,1710 @@
          +(function (global, factory) {
          +	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
          +	typeof define === 'function' && define.amd ? define(factory) :
          +	(global.JSON5 = factory());
          +}(this, (function () { 'use strict';
          +
          +	function createCommonjsModule(fn, module) {
          +		return module = { exports: {} }, fn(module, module.exports), module.exports;
          +	}
          +
          +	var _global = createCommonjsModule(function (module) {
          +	// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
          +	var global = module.exports = typeof window != 'undefined' && window.Math == Math
          +	  ? window : typeof self != 'undefined' && self.Math == Math ? self
          +	  // eslint-disable-next-line no-new-func
          +	  : Function('return this')();
          +	if (typeof __g == 'number') { __g = global; } // eslint-disable-line no-undef
          +	});
          +
          +	var _core = createCommonjsModule(function (module) {
          +	var core = module.exports = { version: '2.6.5' };
          +	if (typeof __e == 'number') { __e = core; } // eslint-disable-line no-undef
          +	});
          +	var _core_1 = _core.version;
          +
          +	var _isObject = function (it) {
          +	  return typeof it === 'object' ? it !== null : typeof it === 'function';
          +	};
          +
          +	var _anObject = function (it) {
          +	  if (!_isObject(it)) { throw TypeError(it + ' is not an object!'); }
          +	  return it;
          +	};
          +
          +	var _fails = function (exec) {
          +	  try {
          +	    return !!exec();
          +	  } catch (e) {
          +	    return true;
          +	  }
          +	};
          +
          +	// Thank's IE8 for his funny defineProperty
          +	var _descriptors = !_fails(function () {
          +	  return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
          +	});
          +
          +	var document = _global.document;
          +	// typeof document.createElement is 'object' in old IE
          +	var is = _isObject(document) && _isObject(document.createElement);
          +	var _domCreate = function (it) {
          +	  return is ? document.createElement(it) : {};
          +	};
          +
          +	var _ie8DomDefine = !_descriptors && !_fails(function () {
          +	  return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
          +	});
          +
          +	// 7.1.1 ToPrimitive(input [, PreferredType])
          +
          +	// instead of the ES6 spec version, we didn't implement @@toPrimitive case
          +	// and the second argument - flag - preferred type is a string
          +	var _toPrimitive = function (it, S) {
          +	  if (!_isObject(it)) { return it; }
          +	  var fn, val;
          +	  if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
          +	  if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) { return val; }
          +	  if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
          +	  throw TypeError("Can't convert object to primitive value");
          +	};
          +
          +	var dP = Object.defineProperty;
          +
          +	var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
          +	  _anObject(O);
          +	  P = _toPrimitive(P, true);
          +	  _anObject(Attributes);
          +	  if (_ie8DomDefine) { try {
          +	    return dP(O, P, Attributes);
          +	  } catch (e) { /* empty */ } }
          +	  if ('get' in Attributes || 'set' in Attributes) { throw TypeError('Accessors not supported!'); }
          +	  if ('value' in Attributes) { O[P] = Attributes.value; }
          +	  return O;
          +	};
          +
          +	var _objectDp = {
          +		f: f
          +	};
          +
          +	var _propertyDesc = function (bitmap, value) {
          +	  return {
          +	    enumerable: !(bitmap & 1),
          +	    configurable: !(bitmap & 2),
          +	    writable: !(bitmap & 4),
          +	    value: value
          +	  };
          +	};
          +
          +	var _hide = _descriptors ? function (object, key, value) {
          +	  return _objectDp.f(object, key, _propertyDesc(1, value));
          +	} : function (object, key, value) {
          +	  object[key] = value;
          +	  return object;
          +	};
          +
          +	var hasOwnProperty = {}.hasOwnProperty;
          +	var _has = function (it, key) {
          +	  return hasOwnProperty.call(it, key);
          +	};
          +
          +	var id = 0;
          +	var px = Math.random();
          +	var _uid = function (key) {
          +	  return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
          +	};
          +
          +	var _library = false;
          +
          +	var _shared = createCommonjsModule(function (module) {
          +	var SHARED = '__core-js_shared__';
          +	var store = _global[SHARED] || (_global[SHARED] = {});
          +
          +	(module.exports = function (key, value) {
          +	  return store[key] || (store[key] = value !== undefined ? value : {});
          +	})('versions', []).push({
          +	  version: _core.version,
          +	  mode: _library ? 'pure' : 'global',
          +	  copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
          +	});
          +	});
          +
          +	var _functionToString = _shared('native-function-to-string', Function.toString);
          +
          +	var _redefine = createCommonjsModule(function (module) {
          +	var SRC = _uid('src');
          +
          +	var TO_STRING = 'toString';
          +	var TPL = ('' + _functionToString).split(TO_STRING);
          +
          +	_core.inspectSource = function (it) {
          +	  return _functionToString.call(it);
          +	};
          +
          +	(module.exports = function (O, key, val, safe) {
          +	  var isFunction = typeof val == 'function';
          +	  if (isFunction) { _has(val, 'name') || _hide(val, 'name', key); }
          +	  if (O[key] === val) { return; }
          +	  if (isFunction) { _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); }
          +	  if (O === _global) {
          +	    O[key] = val;
          +	  } else if (!safe) {
          +	    delete O[key];
          +	    _hide(O, key, val);
          +	  } else if (O[key]) {
          +	    O[key] = val;
          +	  } else {
          +	    _hide(O, key, val);
          +	  }
          +	// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
          +	})(Function.prototype, TO_STRING, function toString() {
          +	  return typeof this == 'function' && this[SRC] || _functionToString.call(this);
          +	});
          +	});
          +
          +	var _aFunction = function (it) {
          +	  if (typeof it != 'function') { throw TypeError(it + ' is not a function!'); }
          +	  return it;
          +	};
          +
          +	// optional / simple context binding
          +
          +	var _ctx = function (fn, that, length) {
          +	  _aFunction(fn);
          +	  if (that === undefined) { return fn; }
          +	  switch (length) {
          +	    case 1: return function (a) {
          +	      return fn.call(that, a);
          +	    };
          +	    case 2: return function (a, b) {
          +	      return fn.call(that, a, b);
          +	    };
          +	    case 3: return function (a, b, c) {
          +	      return fn.call(that, a, b, c);
          +	    };
          +	  }
          +	  return function (/* ...args */) {
          +	    return fn.apply(that, arguments);
          +	  };
          +	};
          +
          +	var PROTOTYPE = 'prototype';
          +
          +	var $export = function (type, name, source) {
          +	  var IS_FORCED = type & $export.F;
          +	  var IS_GLOBAL = type & $export.G;
          +	  var IS_STATIC = type & $export.S;
          +	  var IS_PROTO = type & $export.P;
          +	  var IS_BIND = type & $export.B;
          +	  var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
          +	  var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
          +	  var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
          +	  var key, own, out, exp;
          +	  if (IS_GLOBAL) { source = name; }
          +	  for (key in source) {
          +	    // contains in native
          +	    own = !IS_FORCED && target && target[key] !== undefined;
          +	    // export native or passed
          +	    out = (own ? target : source)[key];
          +	    // bind timers to global for call from export context
          +	    exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
          +	    // extend global
          +	    if (target) { _redefine(target, key, out, type & $export.U); }
          +	    // export
          +	    if (exports[key] != out) { _hide(exports, key, exp); }
          +	    if (IS_PROTO && expProto[key] != out) { expProto[key] = out; }
          +	  }
          +	};
          +	_global.core = _core;
          +	// type bitmap
          +	$export.F = 1;   // forced
          +	$export.G = 2;   // global
          +	$export.S = 4;   // static
          +	$export.P = 8;   // proto
          +	$export.B = 16;  // bind
          +	$export.W = 32;  // wrap
          +	$export.U = 64;  // safe
          +	$export.R = 128; // real proto method for `library`
          +	var _export = $export;
          +
          +	// 7.1.4 ToInteger
          +	var ceil = Math.ceil;
          +	var floor = Math.floor;
          +	var _toInteger = function (it) {
          +	  return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
          +	};
          +
          +	// 7.2.1 RequireObjectCoercible(argument)
          +	var _defined = function (it) {
          +	  if (it == undefined) { throw TypeError("Can't call method on  " + it); }
          +	  return it;
          +	};
          +
          +	// true  -> String#at
          +	// false -> String#codePointAt
          +	var _stringAt = function (TO_STRING) {
          +	  return function (that, pos) {
          +	    var s = String(_defined(that));
          +	    var i = _toInteger(pos);
          +	    var l = s.length;
          +	    var a, b;
          +	    if (i < 0 || i >= l) { return TO_STRING ? '' : undefined; }
          +	    a = s.charCodeAt(i);
          +	    return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
          +	      ? TO_STRING ? s.charAt(i) : a
          +	      : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
          +	  };
          +	};
          +
          +	var $at = _stringAt(false);
          +	_export(_export.P, 'String', {
          +	  // 21.1.3.3 String.prototype.codePointAt(pos)
          +	  codePointAt: function codePointAt(pos) {
          +	    return $at(this, pos);
          +	  }
          +	});
          +
          +	var codePointAt = _core.String.codePointAt;
          +
          +	var max = Math.max;
          +	var min = Math.min;
          +	var _toAbsoluteIndex = function (index, length) {
          +	  index = _toInteger(index);
          +	  return index < 0 ? max(index + length, 0) : min(index, length);
          +	};
          +
          +	var fromCharCode = String.fromCharCode;
          +	var $fromCodePoint = String.fromCodePoint;
          +
          +	// length should be 1, old FF problem
          +	_export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
          +	  // 21.1.2.2 String.fromCodePoint(...codePoints)
          +	  fromCodePoint: function fromCodePoint(x) {
          +	    var arguments$1 = arguments;
          +	 // eslint-disable-line no-unused-vars
          +	    var res = [];
          +	    var aLen = arguments.length;
          +	    var i = 0;
          +	    var code;
          +	    while (aLen > i) {
          +	      code = +arguments$1[i++];
          +	      if (_toAbsoluteIndex(code, 0x10ffff) !== code) { throw RangeError(code + ' is not a valid code point'); }
          +	      res.push(code < 0x10000
          +	        ? fromCharCode(code)
          +	        : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
          +	      );
          +	    } return res.join('');
          +	  }
          +	});
          +
          +	var fromCodePoint = _core.String.fromCodePoint;
          +
          +	// This is a generated file. Do not edit.
          +	var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
          +	var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
          +	var ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
          +
          +	var unicode = {
          +		Space_Separator: Space_Separator,
          +		ID_Start: ID_Start,
          +		ID_Continue: ID_Continue
          +	};
          +
          +	var util = {
          +	    isSpaceSeparator: function isSpaceSeparator (c) {
          +	        return typeof c === 'string' && unicode.Space_Separator.test(c)
          +	    },
          +
          +	    isIdStartChar: function isIdStartChar (c) {
          +	        return typeof c === 'string' && (
          +	            (c >= 'a' && c <= 'z') ||
          +	        (c >= 'A' && c <= 'Z') ||
          +	        (c === '$') || (c === '_') ||
          +	        unicode.ID_Start.test(c)
          +	        )
          +	    },
          +
          +	    isIdContinueChar: function isIdContinueChar (c) {
          +	        return typeof c === 'string' && (
          +	            (c >= 'a' && c <= 'z') ||
          +	        (c >= 'A' && c <= 'Z') ||
          +	        (c >= '0' && c <= '9') ||
          +	        (c === '$') || (c === '_') ||
          +	        (c === '\u200C') || (c === '\u200D') ||
          +	        unicode.ID_Continue.test(c)
          +	        )
          +	    },
          +
          +	    isDigit: function isDigit (c) {
          +	        return typeof c === 'string' && /[0-9]/.test(c)
          +	    },
          +
          +	    isHexDigit: function isHexDigit (c) {
          +	        return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
          +	    },
          +	};
          +
          +	var source;
          +	var parseState;
          +	var stack;
          +	var pos;
          +	var line;
          +	var column;
          +	var token;
          +	var key;
          +	var root;
          +
          +	var parse = function parse (text, reviver) {
          +	    source = String(text);
          +	    parseState = 'start';
          +	    stack = [];
          +	    pos = 0;
          +	    line = 1;
          +	    column = 0;
          +	    token = undefined;
          +	    key = undefined;
          +	    root = undefined;
          +
          +	    do {
          +	        token = lex();
          +
          +	        // This code is unreachable.
          +	        // if (!parseStates[parseState]) {
          +	        //     throw invalidParseState()
          +	        // }
          +
          +	        parseStates[parseState]();
          +	    } while (token.type !== 'eof')
          +
          +	    if (typeof reviver === 'function') {
          +	        return internalize({'': root}, '', reviver)
          +	    }
          +
          +	    return root
          +	};
          +
          +	function internalize (holder, name, reviver) {
          +	    var value = holder[name];
          +	    if (value != null && typeof value === 'object') {
          +	        for (var key in value) {
          +	            var replacement = internalize(value, key, reviver);
          +	            if (replacement === undefined) {
          +	                delete value[key];
          +	            } else {
          +	                value[key] = replacement;
          +	            }
          +	        }
          +	    }
          +
          +	    return reviver.call(holder, name, value)
          +	}
          +
          +	var lexState;
          +	var buffer;
          +	var doubleQuote;
          +	var sign;
          +	var c;
          +
          +	function lex () {
          +	    lexState = 'default';
          +	    buffer = '';
          +	    doubleQuote = false;
          +	    sign = 1;
          +
          +	    for (;;) {
          +	        c = peek();
          +
          +	        // This code is unreachable.
          +	        // if (!lexStates[lexState]) {
          +	        //     throw invalidLexState(lexState)
          +	        // }
          +
          +	        var token = lexStates[lexState]();
          +	        if (token) {
          +	            return token
          +	        }
          +	    }
          +	}
          +
          +	function peek () {
          +	    if (source[pos]) {
          +	        return String.fromCodePoint(source.codePointAt(pos))
          +	    }
          +	}
          +
          +	function read () {
          +	    var c = peek();
          +
          +	    if (c === '\n') {
          +	        line++;
          +	        column = 0;
          +	    } else if (c) {
          +	        column += c.length;
          +	    } else {
          +	        column++;
          +	    }
          +
          +	    if (c) {
          +	        pos += c.length;
          +	    }
          +
          +	    return c
          +	}
          +
          +	var lexStates = {
          +	    default: function default$1 () {
          +	        switch (c) {
          +	        case '\t':
          +	        case '\v':
          +	        case '\f':
          +	        case ' ':
          +	        case '\u00A0':
          +	        case '\uFEFF':
          +	        case '\n':
          +	        case '\r':
          +	        case '\u2028':
          +	        case '\u2029':
          +	            read();
          +	            return
          +
          +	        case '/':
          +	            read();
          +	            lexState = 'comment';
          +	            return
          +
          +	        case undefined:
          +	            read();
          +	            return newToken('eof')
          +	        }
          +
          +	        if (util.isSpaceSeparator(c)) {
          +	            read();
          +	            return
          +	        }
          +
          +	        // This code is unreachable.
          +	        // if (!lexStates[parseState]) {
          +	        //     throw invalidLexState(parseState)
          +	        // }
          +
          +	        return lexStates[parseState]()
          +	    },
          +
          +	    comment: function comment () {
          +	        switch (c) {
          +	        case '*':
          +	            read();
          +	            lexState = 'multiLineComment';
          +	            return
          +
          +	        case '/':
          +	            read();
          +	            lexState = 'singleLineComment';
          +	            return
          +	        }
          +
          +	        throw invalidChar(read())
          +	    },
          +
          +	    multiLineComment: function multiLineComment () {
          +	        switch (c) {
          +	        case '*':
          +	            read();
          +	            lexState = 'multiLineCommentAsterisk';
          +	            return
          +
          +	        case undefined:
          +	            throw invalidChar(read())
          +	        }
          +
          +	        read();
          +	    },
          +
          +	    multiLineCommentAsterisk: function multiLineCommentAsterisk () {
          +	        switch (c) {
          +	        case '*':
          +	            read();
          +	            return
          +
          +	        case '/':
          +	            read();
          +	            lexState = 'default';
          +	            return
          +
          +	        case undefined:
          +	            throw invalidChar(read())
          +	        }
          +
          +	        read();
          +	        lexState = 'multiLineComment';
          +	    },
          +
          +	    singleLineComment: function singleLineComment () {
          +	        switch (c) {
          +	        case '\n':
          +	        case '\r':
          +	        case '\u2028':
          +	        case '\u2029':
          +	            read();
          +	            lexState = 'default';
          +	            return
          +
          +	        case undefined:
          +	            read();
          +	            return newToken('eof')
          +	        }
          +
          +	        read();
          +	    },
          +
          +	    value: function value () {
          +	        switch (c) {
          +	        case '{':
          +	        case '[':
          +	            return newToken('punctuator', read())
          +
          +	        case 'n':
          +	            read();
          +	            literal('ull');
          +	            return newToken('null', null)
          +
          +	        case 't':
          +	            read();
          +	            literal('rue');
          +	            return newToken('boolean', true)
          +
          +	        case 'f':
          +	            read();
          +	            literal('alse');
          +	            return newToken('boolean', false)
          +
          +	        case '-':
          +	        case '+':
          +	            if (read() === '-') {
          +	                sign = -1;
          +	            }
          +
          +	            lexState = 'sign';
          +	            return
          +
          +	        case '.':
          +	            buffer = read();
          +	            lexState = 'decimalPointLeading';
          +	            return
          +
          +	        case '0':
          +	            buffer = read();
          +	            lexState = 'zero';
          +	            return
          +
          +	        case '1':
          +	        case '2':
          +	        case '3':
          +	        case '4':
          +	        case '5':
          +	        case '6':
          +	        case '7':
          +	        case '8':
          +	        case '9':
          +	            buffer = read();
          +	            lexState = 'decimalInteger';
          +	            return
          +
          +	        case 'I':
          +	            read();
          +	            literal('nfinity');
          +	            return newToken('numeric', Infinity)
          +
          +	        case 'N':
          +	            read();
          +	            literal('aN');
          +	            return newToken('numeric', NaN)
          +
          +	        case '"':
          +	        case "'":
          +	            doubleQuote = (read() === '"');
          +	            buffer = '';
          +	            lexState = 'string';
          +	            return
          +	        }
          +
          +	        throw invalidChar(read())
          +	    },
          +
          +	    identifierNameStartEscape: function identifierNameStartEscape () {
          +	        if (c !== 'u') {
          +	            throw invalidChar(read())
          +	        }
          +
          +	        read();
          +	        var u = unicodeEscape();
          +	        switch (u) {
          +	        case '$':
          +	        case '_':
          +	            break
          +
          +	        default:
          +	            if (!util.isIdStartChar(u)) {
          +	                throw invalidIdentifier()
          +	            }
          +
          +	            break
          +	        }
          +
          +	        buffer += u;
          +	        lexState = 'identifierName';
          +	    },
          +
          +	    identifierName: function identifierName () {
          +	        switch (c) {
          +	        case '$':
          +	        case '_':
          +	        case '\u200C':
          +	        case '\u200D':
          +	            buffer += read();
          +	            return
          +
          +	        case '\\':
          +	            read();
          +	            lexState = 'identifierNameEscape';
          +	            return
          +	        }
          +
          +	        if (util.isIdContinueChar(c)) {
          +	            buffer += read();
          +	            return
          +	        }
          +
          +	        return newToken('identifier', buffer)
          +	    },
          +
          +	    identifierNameEscape: function identifierNameEscape () {
          +	        if (c !== 'u') {
          +	            throw invalidChar(read())
          +	        }
          +
          +	        read();
          +	        var u = unicodeEscape();
          +	        switch (u) {
          +	        case '$':
          +	        case '_':
          +	        case '\u200C':
          +	        case '\u200D':
          +	            break
          +
          +	        default:
          +	            if (!util.isIdContinueChar(u)) {
          +	                throw invalidIdentifier()
          +	            }
          +
          +	            break
          +	        }
          +
          +	        buffer += u;
          +	        lexState = 'identifierName';
          +	    },
          +
          +	    sign: function sign$1 () {
          +	        switch (c) {
          +	        case '.':
          +	            buffer = read();
          +	            lexState = 'decimalPointLeading';
          +	            return
          +
          +	        case '0':
          +	            buffer = read();
          +	            lexState = 'zero';
          +	            return
          +
          +	        case '1':
          +	        case '2':
          +	        case '3':
          +	        case '4':
          +	        case '5':
          +	        case '6':
          +	        case '7':
          +	        case '8':
          +	        case '9':
          +	            buffer = read();
          +	            lexState = 'decimalInteger';
          +	            return
          +
          +	        case 'I':
          +	            read();
          +	            literal('nfinity');
          +	            return newToken('numeric', sign * Infinity)
          +
          +	        case 'N':
          +	            read();
          +	            literal('aN');
          +	            return newToken('numeric', NaN)
          +	        }
          +
          +	        throw invalidChar(read())
          +	    },
          +
          +	    zero: function zero () {
          +	        switch (c) {
          +	        case '.':
          +	            buffer += read();
          +	            lexState = 'decimalPoint';
          +	            return
          +
          +	        case 'e':
          +	        case 'E':
          +	            buffer += read();
          +	            lexState = 'decimalExponent';
          +	            return
          +
          +	        case 'x':
          +	        case 'X':
          +	            buffer += read();
          +	            lexState = 'hexadecimal';
          +	            return
          +	        }
          +
          +	        return newToken('numeric', sign * 0)
          +	    },
          +
          +	    decimalInteger: function decimalInteger () {
          +	        switch (c) {
          +	        case '.':
          +	            buffer += read();
          +	            lexState = 'decimalPoint';
          +	            return
          +
          +	        case 'e':
          +	        case 'E':
          +	            buffer += read();
          +	            lexState = 'decimalExponent';
          +	            return
          +	        }
          +
          +	        if (util.isDigit(c)) {
          +	            buffer += read();
          +	            return
          +	        }
          +
          +	        return newToken('numeric', sign * Number(buffer))
          +	    },
          +
          +	    decimalPointLeading: function decimalPointLeading () {
          +	        if (util.isDigit(c)) {
          +	            buffer += read();
          +	            lexState = 'decimalFraction';
          +	            return
          +	        }
          +
          +	        throw invalidChar(read())
          +	    },
          +
          +	    decimalPoint: function decimalPoint () {
          +	        switch (c) {
          +	        case 'e':
          +	        case 'E':
          +	            buffer += read();
          +	            lexState = 'decimalExponent';
          +	            return
          +	        }
          +
          +	        if (util.isDigit(c)) {
          +	            buffer += read();
          +	            lexState = 'decimalFraction';
          +	            return
          +	        }
          +
          +	        return newToken('numeric', sign * Number(buffer))
          +	    },
          +
          +	    decimalFraction: function decimalFraction () {
          +	        switch (c) {
          +	        case 'e':
          +	        case 'E':
          +	            buffer += read();
          +	            lexState = 'decimalExponent';
          +	            return
          +	        }
          +
          +	        if (util.isDigit(c)) {
          +	            buffer += read();
          +	            return
          +	        }
          +
          +	        return newToken('numeric', sign * Number(buffer))
          +	    },
          +
          +	    decimalExponent: function decimalExponent () {
          +	        switch (c) {
          +	        case '+':
          +	        case '-':
          +	            buffer += read();
          +	            lexState = 'decimalExponentSign';
          +	            return
          +	        }
          +
          +	        if (util.isDigit(c)) {
          +	            buffer += read();
          +	            lexState = 'decimalExponentInteger';
          +	            return
          +	        }
          +
          +	        throw invalidChar(read())
          +	    },
          +
          +	    decimalExponentSign: function decimalExponentSign () {
          +	        if (util.isDigit(c)) {
          +	            buffer += read();
          +	            lexState = 'decimalExponentInteger';
          +	            return
          +	        }
          +
          +	        throw invalidChar(read())
          +	    },
          +
          +	    decimalExponentInteger: function decimalExponentInteger () {
          +	        if (util.isDigit(c)) {
          +	            buffer += read();
          +	            return
          +	        }
          +
          +	        return newToken('numeric', sign * Number(buffer))
          +	    },
          +
          +	    hexadecimal: function hexadecimal () {
          +	        if (util.isHexDigit(c)) {
          +	            buffer += read();
          +	            lexState = 'hexadecimalInteger';
          +	            return
          +	        }
          +
          +	        throw invalidChar(read())
          +	    },
          +
          +	    hexadecimalInteger: function hexadecimalInteger () {
          +	        if (util.isHexDigit(c)) {
          +	            buffer += read();
          +	            return
          +	        }
          +
          +	        return newToken('numeric', sign * Number(buffer))
          +	    },
          +
          +	    string: function string () {
          +	        switch (c) {
          +	        case '\\':
          +	            read();
          +	            buffer += escape();
          +	            return
          +
          +	        case '"':
          +	            if (doubleQuote) {
          +	                read();
          +	                return newToken('string', buffer)
          +	            }
          +
          +	            buffer += read();
          +	            return
          +
          +	        case "'":
          +	            if (!doubleQuote) {
          +	                read();
          +	                return newToken('string', buffer)
          +	            }
          +
          +	            buffer += read();
          +	            return
          +
          +	        case '\n':
          +	        case '\r':
          +	            throw invalidChar(read())
          +
          +	        case '\u2028':
          +	        case '\u2029':
          +	            separatorChar(c);
          +	            break
          +
          +	        case undefined:
          +	            throw invalidChar(read())
          +	        }
          +
          +	        buffer += read();
          +	    },
          +
          +	    start: function start () {
          +	        switch (c) {
          +	        case '{':
          +	        case '[':
          +	            return newToken('punctuator', read())
          +
          +	        // This code is unreachable since the default lexState handles eof.
          +	        // case undefined:
          +	        //     return newToken('eof')
          +	        }
          +
          +	        lexState = 'value';
          +	    },
          +
          +	    beforePropertyName: function beforePropertyName () {
          +	        switch (c) {
          +	        case '$':
          +	        case '_':
          +	            buffer = read();
          +	            lexState = 'identifierName';
          +	            return
          +
          +	        case '\\':
          +	            read();
          +	            lexState = 'identifierNameStartEscape';
          +	            return
          +
          +	        case '}':
          +	            return newToken('punctuator', read())
          +
          +	        case '"':
          +	        case "'":
          +	            doubleQuote = (read() === '"');
          +	            lexState = 'string';
          +	            return
          +	        }
          +
          +	        if (util.isIdStartChar(c)) {
          +	            buffer += read();
          +	            lexState = 'identifierName';
          +	            return
          +	        }
          +
          +	        throw invalidChar(read())
          +	    },
          +
          +	    afterPropertyName: function afterPropertyName () {
          +	        if (c === ':') {
          +	            return newToken('punctuator', read())
          +	        }
          +
          +	        throw invalidChar(read())
          +	    },
          +
          +	    beforePropertyValue: function beforePropertyValue () {
          +	        lexState = 'value';
          +	    },
          +
          +	    afterPropertyValue: function afterPropertyValue () {
          +	        switch (c) {
          +	        case ',':
          +	        case '}':
          +	            return newToken('punctuator', read())
          +	        }
          +
          +	        throw invalidChar(read())
          +	    },
          +
          +	    beforeArrayValue: function beforeArrayValue () {
          +	        if (c === ']') {
          +	            return newToken('punctuator', read())
          +	        }
          +
          +	        lexState = 'value';
          +	    },
          +
          +	    afterArrayValue: function afterArrayValue () {
          +	        switch (c) {
          +	        case ',':
          +	        case ']':
          +	            return newToken('punctuator', read())
          +	        }
          +
          +	        throw invalidChar(read())
          +	    },
          +
          +	    end: function end () {
          +	        // This code is unreachable since it's handled by the default lexState.
          +	        // if (c === undefined) {
          +	        //     read()
          +	        //     return newToken('eof')
          +	        // }
          +
          +	        throw invalidChar(read())
          +	    },
          +	};
          +
          +	function newToken (type, value) {
          +	    return {
          +	        type: type,
          +	        value: value,
          +	        line: line,
          +	        column: column,
          +	    }
          +	}
          +
          +	function literal (s) {
          +	    for (var i = 0, list = s; i < list.length; i += 1) {
          +	        var c = list[i];
          +
          +	        var p = peek();
          +
          +	        if (p !== c) {
          +	            throw invalidChar(read())
          +	        }
          +
          +	        read();
          +	    }
          +	}
          +
          +	function escape () {
          +	    var c = peek();
          +	    switch (c) {
          +	    case 'b':
          +	        read();
          +	        return '\b'
          +
          +	    case 'f':
          +	        read();
          +	        return '\f'
          +
          +	    case 'n':
          +	        read();
          +	        return '\n'
          +
          +	    case 'r':
          +	        read();
          +	        return '\r'
          +
          +	    case 't':
          +	        read();
          +	        return '\t'
          +
          +	    case 'v':
          +	        read();
          +	        return '\v'
          +
          +	    case '0':
          +	        read();
          +	        if (util.isDigit(peek())) {
          +	            throw invalidChar(read())
          +	        }
          +
          +	        return '\0'
          +
          +	    case 'x':
          +	        read();
          +	        return hexEscape()
          +
          +	    case 'u':
          +	        read();
          +	        return unicodeEscape()
          +
          +	    case '\n':
          +	    case '\u2028':
          +	    case '\u2029':
          +	        read();
          +	        return ''
          +
          +	    case '\r':
          +	        read();
          +	        if (peek() === '\n') {
          +	            read();
          +	        }
          +
          +	        return ''
          +
          +	    case '1':
          +	    case '2':
          +	    case '3':
          +	    case '4':
          +	    case '5':
          +	    case '6':
          +	    case '7':
          +	    case '8':
          +	    case '9':
          +	        throw invalidChar(read())
          +
          +	    case undefined:
          +	        throw invalidChar(read())
          +	    }
          +
          +	    return read()
          +	}
          +
          +	function hexEscape () {
          +	    var buffer = '';
          +	    var c = peek();
          +
          +	    if (!util.isHexDigit(c)) {
          +	        throw invalidChar(read())
          +	    }
          +
          +	    buffer += read();
          +
          +	    c = peek();
          +	    if (!util.isHexDigit(c)) {
          +	        throw invalidChar(read())
          +	    }
          +
          +	    buffer += read();
          +
          +	    return String.fromCodePoint(parseInt(buffer, 16))
          +	}
          +
          +	function unicodeEscape () {
          +	    var buffer = '';
          +	    var count = 4;
          +
          +	    while (count-- > 0) {
          +	        var c = peek();
          +	        if (!util.isHexDigit(c)) {
          +	            throw invalidChar(read())
          +	        }
          +
          +	        buffer += read();
          +	    }
          +
          +	    return String.fromCodePoint(parseInt(buffer, 16))
          +	}
          +
          +	var parseStates = {
          +	    start: function start () {
          +	        if (token.type === 'eof') {
          +	            throw invalidEOF()
          +	        }
          +
          +	        push();
          +	    },
          +
          +	    beforePropertyName: function beforePropertyName () {
          +	        switch (token.type) {
          +	        case 'identifier':
          +	        case 'string':
          +	            key = token.value;
          +	            parseState = 'afterPropertyName';
          +	            return
          +
          +	        case 'punctuator':
          +	            // This code is unreachable since it's handled by the lexState.
          +	            // if (token.value !== '}') {
          +	            //     throw invalidToken()
          +	            // }
          +
          +	            pop();
          +	            return
          +
          +	        case 'eof':
          +	            throw invalidEOF()
          +	        }
          +
          +	        // This code is unreachable since it's handled by the lexState.
          +	        // throw invalidToken()
          +	    },
          +
          +	    afterPropertyName: function afterPropertyName () {
          +	        // This code is unreachable since it's handled by the lexState.
          +	        // if (token.type !== 'punctuator' || token.value !== ':') {
          +	        //     throw invalidToken()
          +	        // }
          +
          +	        if (token.type === 'eof') {
          +	            throw invalidEOF()
          +	        }
          +
          +	        parseState = 'beforePropertyValue';
          +	    },
          +
          +	    beforePropertyValue: function beforePropertyValue () {
          +	        if (token.type === 'eof') {
          +	            throw invalidEOF()
          +	        }
          +
          +	        push();
          +	    },
          +
          +	    beforeArrayValue: function beforeArrayValue () {
          +	        if (token.type === 'eof') {
          +	            throw invalidEOF()
          +	        }
          +
          +	        if (token.type === 'punctuator' && token.value === ']') {
          +	            pop();
          +	            return
          +	        }
          +
          +	        push();
          +	    },
          +
          +	    afterPropertyValue: function afterPropertyValue () {
          +	        // This code is unreachable since it's handled by the lexState.
          +	        // if (token.type !== 'punctuator') {
          +	        //     throw invalidToken()
          +	        // }
          +
          +	        if (token.type === 'eof') {
          +	            throw invalidEOF()
          +	        }
          +
          +	        switch (token.value) {
          +	        case ',':
          +	            parseState = 'beforePropertyName';
          +	            return
          +
          +	        case '}':
          +	            pop();
          +	        }
          +
          +	        // This code is unreachable since it's handled by the lexState.
          +	        // throw invalidToken()
          +	    },
          +
          +	    afterArrayValue: function afterArrayValue () {
          +	        // This code is unreachable since it's handled by the lexState.
          +	        // if (token.type !== 'punctuator') {
          +	        //     throw invalidToken()
          +	        // }
          +
          +	        if (token.type === 'eof') {
          +	            throw invalidEOF()
          +	        }
          +
          +	        switch (token.value) {
          +	        case ',':
          +	            parseState = 'beforeArrayValue';
          +	            return
          +
          +	        case ']':
          +	            pop();
          +	        }
          +
          +	        // This code is unreachable since it's handled by the lexState.
          +	        // throw invalidToken()
          +	    },
          +
          +	    end: function end () {
          +	        // This code is unreachable since it's handled by the lexState.
          +	        // if (token.type !== 'eof') {
          +	        //     throw invalidToken()
          +	        // }
          +	    },
          +	};
          +
          +	function push () {
          +	    var value;
          +
          +	    switch (token.type) {
          +	    case 'punctuator':
          +	        switch (token.value) {
          +	        case '{':
          +	            value = {};
          +	            break
          +
          +	        case '[':
          +	            value = [];
          +	            break
          +	        }
          +
          +	        break
          +
          +	    case 'null':
          +	    case 'boolean':
          +	    case 'numeric':
          +	    case 'string':
          +	        value = token.value;
          +	        break
          +
          +	    // This code is unreachable.
          +	    // default:
          +	    //     throw invalidToken()
          +	    }
          +
          +	    if (root === undefined) {
          +	        root = value;
          +	    } else {
          +	        var parent = stack[stack.length - 1];
          +	        if (Array.isArray(parent)) {
          +	            parent.push(value);
          +	        } else {
          +	            parent[key] = value;
          +	        }
          +	    }
          +
          +	    if (value !== null && typeof value === 'object') {
          +	        stack.push(value);
          +
          +	        if (Array.isArray(value)) {
          +	            parseState = 'beforeArrayValue';
          +	        } else {
          +	            parseState = 'beforePropertyName';
          +	        }
          +	    } else {
          +	        var current = stack[stack.length - 1];
          +	        if (current == null) {
          +	            parseState = 'end';
          +	        } else if (Array.isArray(current)) {
          +	            parseState = 'afterArrayValue';
          +	        } else {
          +	            parseState = 'afterPropertyValue';
          +	        }
          +	    }
          +	}
          +
          +	function pop () {
          +	    stack.pop();
          +
          +	    var current = stack[stack.length - 1];
          +	    if (current == null) {
          +	        parseState = 'end';
          +	    } else if (Array.isArray(current)) {
          +	        parseState = 'afterArrayValue';
          +	    } else {
          +	        parseState = 'afterPropertyValue';
          +	    }
          +	}
          +
          +	// This code is unreachable.
          +	// function invalidParseState () {
          +	//     return new Error(`JSON5: invalid parse state '${parseState}'`)
          +	// }
          +
          +	// This code is unreachable.
          +	// function invalidLexState (state) {
          +	//     return new Error(`JSON5: invalid lex state '${state}'`)
          +	// }
          +
          +	function invalidChar (c) {
          +	    if (c === undefined) {
          +	        return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
          +	    }
          +
          +	    return syntaxError(("JSON5: invalid character '" + (formatChar(c)) + "' at " + line + ":" + column))
          +	}
          +
          +	function invalidEOF () {
          +	    return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
          +	}
          +
          +	// This code is unreachable.
          +	// function invalidToken () {
          +	//     if (token.type === 'eof') {
          +	//         return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
          +	//     }
          +
          +	//     const c = String.fromCodePoint(token.value.codePointAt(0))
          +	//     return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
          +	// }
          +
          +	function invalidIdentifier () {
          +	    column -= 5;
          +	    return syntaxError(("JSON5: invalid identifier character at " + line + ":" + column))
          +	}
          +
          +	function separatorChar (c) {
          +	    console.warn(("JSON5: '" + (formatChar(c)) + "' in strings is not valid ECMAScript; consider escaping"));
          +	}
          +
          +	function formatChar (c) {
          +	    var replacements = {
          +	        "'": "\\'",
          +	        '"': '\\"',
          +	        '\\': '\\\\',
          +	        '\b': '\\b',
          +	        '\f': '\\f',
          +	        '\n': '\\n',
          +	        '\r': '\\r',
          +	        '\t': '\\t',
          +	        '\v': '\\v',
          +	        '\0': '\\0',
          +	        '\u2028': '\\u2028',
          +	        '\u2029': '\\u2029',
          +	    };
          +
          +	    if (replacements[c]) {
          +	        return replacements[c]
          +	    }
          +
          +	    if (c < ' ') {
          +	        var hexString = c.charCodeAt(0).toString(16);
          +	        return '\\x' + ('00' + hexString).substring(hexString.length)
          +	    }
          +
          +	    return c
          +	}
          +
          +	function syntaxError (message) {
          +	    var err = new SyntaxError(message);
          +	    err.lineNumber = line;
          +	    err.columnNumber = column;
          +	    return err
          +	}
          +
          +	var stringify = function stringify (value, replacer, space) {
          +	    var stack = [];
          +	    var indent = '';
          +	    var propertyList;
          +	    var replacerFunc;
          +	    var gap = '';
          +	    var quote;
          +
          +	    if (
          +	        replacer != null &&
          +	        typeof replacer === 'object' &&
          +	        !Array.isArray(replacer)
          +	    ) {
          +	        space = replacer.space;
          +	        quote = replacer.quote;
          +	        replacer = replacer.replacer;
          +	    }
          +
          +	    if (typeof replacer === 'function') {
          +	        replacerFunc = replacer;
          +	    } else if (Array.isArray(replacer)) {
          +	        propertyList = [];
          +	        for (var i = 0, list = replacer; i < list.length; i += 1) {
          +	            var v = list[i];
          +
          +	            var item = (void 0);
          +
          +	            if (typeof v === 'string') {
          +	                item = v;
          +	            } else if (
          +	                typeof v === 'number' ||
          +	                v instanceof String ||
          +	                v instanceof Number
          +	            ) {
          +	                item = String(v);
          +	            }
          +
          +	            if (item !== undefined && propertyList.indexOf(item) < 0) {
          +	                propertyList.push(item);
          +	            }
          +	        }
          +	    }
          +
          +	    if (space instanceof Number) {
          +	        space = Number(space);
          +	    } else if (space instanceof String) {
          +	        space = String(space);
          +	    }
          +
          +	    if (typeof space === 'number') {
          +	        if (space > 0) {
          +	            space = Math.min(10, Math.floor(space));
          +	            gap = '          '.substr(0, space);
          +	        }
          +	    } else if (typeof space === 'string') {
          +	        gap = space.substr(0, 10);
          +	    }
          +
          +	    return serializeProperty('', {'': value})
          +
          +	    function serializeProperty (key, holder) {
          +	        var value = holder[key];
          +	        if (value != null) {
          +	            if (typeof value.toJSON5 === 'function') {
          +	                value = value.toJSON5(key);
          +	            } else if (typeof value.toJSON === 'function') {
          +	                value = value.toJSON(key);
          +	            }
          +	        }
          +
          +	        if (replacerFunc) {
          +	            value = replacerFunc.call(holder, key, value);
          +	        }
          +
          +	        if (value instanceof Number) {
          +	            value = Number(value);
          +	        } else if (value instanceof String) {
          +	            value = String(value);
          +	        } else if (value instanceof Boolean) {
          +	            value = value.valueOf();
          +	        }
          +
          +	        switch (value) {
          +	        case null: return 'null'
          +	        case true: return 'true'
          +	        case false: return 'false'
          +	        }
          +
          +	        if (typeof value === 'string') {
          +	            return quoteString(value, false)
          +	        }
          +
          +	        if (typeof value === 'number') {
          +	            return String(value)
          +	        }
          +
          +	        if (typeof value === 'object') {
          +	            return Array.isArray(value) ? serializeArray(value) : serializeObject(value)
          +	        }
          +
          +	        return undefined
          +	    }
          +
          +	    function quoteString (value) {
          +	        var quotes = {
          +	            "'": 0.1,
          +	            '"': 0.2,
          +	        };
          +
          +	        var replacements = {
          +	            "'": "\\'",
          +	            '"': '\\"',
          +	            '\\': '\\\\',
          +	            '\b': '\\b',
          +	            '\f': '\\f',
          +	            '\n': '\\n',
          +	            '\r': '\\r',
          +	            '\t': '\\t',
          +	            '\v': '\\v',
          +	            '\0': '\\0',
          +	            '\u2028': '\\u2028',
          +	            '\u2029': '\\u2029',
          +	        };
          +
          +	        var product = '';
          +
          +	        for (var i = 0; i < value.length; i++) {
          +	            var c = value[i];
          +	            switch (c) {
          +	            case "'":
          +	            case '"':
          +	                quotes[c]++;
          +	                product += c;
          +	                continue
          +
          +	            case '\0':
          +	                if (util.isDigit(value[i + 1])) {
          +	                    product += '\\x00';
          +	                    continue
          +	                }
          +	            }
          +
          +	            if (replacements[c]) {
          +	                product += replacements[c];
          +	                continue
          +	            }
          +
          +	            if (c < ' ') {
          +	                var hexString = c.charCodeAt(0).toString(16);
          +	                product += '\\x' + ('00' + hexString).substring(hexString.length);
          +	                continue
          +	            }
          +
          +	            product += c;
          +	        }
          +
          +	        var quoteChar = quote || Object.keys(quotes).reduce(function (a, b) { return (quotes[a] < quotes[b]) ? a : b; });
          +
          +	        product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);
          +
          +	        return quoteChar + product + quoteChar
          +	    }
          +
          +	    function serializeObject (value) {
          +	        if (stack.indexOf(value) >= 0) {
          +	            throw TypeError('Converting circular structure to JSON5')
          +	        }
          +
          +	        stack.push(value);
          +
          +	        var stepback = indent;
          +	        indent = indent + gap;
          +
          +	        var keys = propertyList || Object.keys(value);
          +	        var partial = [];
          +	        for (var i = 0, list = keys; i < list.length; i += 1) {
          +	            var key = list[i];
          +
          +	            var propertyString = serializeProperty(key, value);
          +	            if (propertyString !== undefined) {
          +	                var member = serializeKey(key) + ':';
          +	                if (gap !== '') {
          +	                    member += ' ';
          +	                }
          +	                member += propertyString;
          +	                partial.push(member);
          +	            }
          +	        }
          +
          +	        var final;
          +	        if (partial.length === 0) {
          +	            final = '{}';
          +	        } else {
          +	            var properties;
          +	            if (gap === '') {
          +	                properties = partial.join(',');
          +	                final = '{' + properties + '}';
          +	            } else {
          +	                var separator = ',\n' + indent;
          +	                properties = partial.join(separator);
          +	                final = '{\n' + indent + properties + ',\n' + stepback + '}';
          +	            }
          +	        }
          +
          +	        stack.pop();
          +	        indent = stepback;
          +	        return final
          +	    }
          +
          +	    function serializeKey (key) {
          +	        if (key.length === 0) {
          +	            return quoteString(key, true)
          +	        }
          +
          +	        var firstChar = String.fromCodePoint(key.codePointAt(0));
          +	        if (!util.isIdStartChar(firstChar)) {
          +	            return quoteString(key, true)
          +	        }
          +
          +	        for (var i = firstChar.length; i < key.length; i++) {
          +	            if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
          +	                return quoteString(key, true)
          +	            }
          +	        }
          +
          +	        return key
          +	    }
          +
          +	    function serializeArray (value) {
          +	        if (stack.indexOf(value) >= 0) {
          +	            throw TypeError('Converting circular structure to JSON5')
          +	        }
          +
          +	        stack.push(value);
          +
          +	        var stepback = indent;
          +	        indent = indent + gap;
          +
          +	        var partial = [];
          +	        for (var i = 0; i < value.length; i++) {
          +	            var propertyString = serializeProperty(String(i), value);
          +	            partial.push((propertyString !== undefined) ? propertyString : 'null');
          +	        }
          +
          +	        var final;
          +	        if (partial.length === 0) {
          +	            final = '[]';
          +	        } else {
          +	            if (gap === '') {
          +	                var properties = partial.join(',');
          +	                final = '[' + properties + ']';
          +	            } else {
          +	                var separator = ',\n' + indent;
          +	                var properties$1 = partial.join(separator);
          +	                final = '[\n' + indent + properties$1 + ',\n' + stepback + ']';
          +	            }
          +	        }
          +
          +	        stack.pop();
          +	        indent = stepback;
          +	        return final
          +	    }
          +	};
          +
          +	var JSON5 = {
          +	    parse: parse,
          +	    stringify: stringify,
          +	};
          +
          +	var lib = JSON5;
          +
          +	var es5 = lib;
          +
          +	return es5;
          +
          +})));
          diff --git a/tools/node_modules/@babel/core/node_modules/json5/dist/index.min.js b/tools/node_modules/@babel/core/node_modules/json5/dist/index.min.js
          new file mode 100644
          index 00000000000000..da63a9da38f4dc
          --- /dev/null
          +++ b/tools/node_modules/@babel/core/node_modules/json5/dist/index.min.js
          @@ -0,0 +1 @@
          +!function(u,D){"object"==typeof exports&&"undefined"!=typeof module?module.exports=D():"function"==typeof define&&define.amd?define(D):u.JSON5=D()}(this,function(){"use strict";function u(u,D){return u(D={exports:{}},D.exports),D.exports}var D=u(function(u){var D=u.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=D)}),e=u(function(u){var D=u.exports={version:"2.6.5"};"number"==typeof __e&&(__e=D)}),t=(e.version,function(u){return"object"==typeof u?null!==u:"function"==typeof u}),r=function(u){if(!t(u))throw TypeError(u+" is not an object!");return u},F=function(u){try{return!!u()}catch(u){return!0}},n=!F(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),C=D.document,A=t(C)&&t(C.createElement),i=!n&&!F(function(){return 7!=Object.defineProperty((u="div",A?C.createElement(u):{}),"a",{get:function(){return 7}}).a;var u}),E=Object.defineProperty,o={f:n?Object.defineProperty:function(u,D,e){if(r(u),D=function(u,D){if(!t(u))return u;var e,r;if(D&&"function"==typeof(e=u.toString)&&!t(r=e.call(u)))return r;if("function"==typeof(e=u.valueOf)&&!t(r=e.call(u)))return r;if(!D&&"function"==typeof(e=u.toString)&&!t(r=e.call(u)))return r;throw TypeError("Can't convert object to primitive value")}(D,!0),r(e),i)try{return E(u,D,e)}catch(u){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(u[D]=e.value),u}},a=n?function(u,D,e){return o.f(u,D,function(u,D){return{enumerable:!(1&u),configurable:!(2&u),writable:!(4&u),value:D}}(1,e))}:function(u,D,e){return u[D]=e,u},c={}.hasOwnProperty,B=function(u,D){return c.call(u,D)},s=0,f=Math.random(),l=u(function(u){var t=D["__core-js_shared__"]||(D["__core-js_shared__"]={});(u.exports=function(u,D){return t[u]||(t[u]=void 0!==D?D:{})})("versions",[]).push({version:e.version,mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})})("native-function-to-string",Function.toString),d=u(function(u){var t,r="Symbol(".concat(void 0===(t="src")?"":t,")_",(++s+f).toString(36)),F=(""+l).split("toString");e.inspectSource=function(u){return l.call(u)},(u.exports=function(u,e,t,n){var C="function"==typeof t;C&&(B(t,"name")||a(t,"name",e)),u[e]!==t&&(C&&(B(t,r)||a(t,r,u[e]?""+u[e]:F.join(String(e)))),u===D?u[e]=t:n?u[e]?u[e]=t:a(u,e,t):(delete u[e],a(u,e,t)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[r]||l.call(this)})}),v=function(u,D,e){if(function(u){if("function"!=typeof u)throw TypeError(u+" is not a function!")}(u),void 0===D)return u;switch(e){case 1:return function(e){return u.call(D,e)};case 2:return function(e,t){return u.call(D,e,t)};case 3:return function(e,t,r){return u.call(D,e,t,r)}}return function(){return u.apply(D,arguments)}},p=function(u,t,r){var F,n,C,A,i=u&p.F,E=u&p.G,o=u&p.S,c=u&p.P,B=u&p.B,s=E?D:o?D[t]||(D[t]={}):(D[t]||{}).prototype,f=E?e:e[t]||(e[t]={}),l=f.prototype||(f.prototype={});for(F in E&&(r=t),r)C=((n=!i&&s&&void 0!==s[F])?s:r)[F],A=B&&n?v(C,D):c&&"function"==typeof C?v(Function.call,C):C,s&&d(s,F,C,u&p.U),f[F]!=C&&a(f,F,A),c&&l[F]!=C&&(l[F]=C)};D.core=e,p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,p.U=64,p.R=128;var h,m=p,g=Math.ceil,y=Math.floor,w=function(u){return isNaN(u=+u)?0:(u>0?y:g)(u)},S=(h=!1,function(u,D){var e,t,r=String(function(u){if(null==u)throw TypeError("Can't call method on  "+u);return u}(u)),F=w(D),n=r.length;return F<0||F>=n?h?"":void 0:(e=r.charCodeAt(F))<55296||e>56319||F+1===n||(t=r.charCodeAt(F+1))<56320||t>57343?h?r.charAt(F):e:h?r.slice(F,F+2):t-56320+(e-55296<<10)+65536});m(m.P,"String",{codePointAt:function(u){return S(this,u)}});e.String.codePointAt;var b=Math.max,x=Math.min,N=String.fromCharCode,P=String.fromCodePoint;m(m.S+m.F*(!!P&&1!=P.length),"String",{fromCodePoint:function(u){for(var D,e,t,r=arguments,F=[],n=arguments.length,C=0;n>C;){if(D=+r[C++],t=1114111,((e=w(e=D))<0?b(e+t,0):x(e,t))!==D)throw RangeError(D+" is not a valid code point");F.push(D<65536?N(D):N(55296+((D-=65536)>>10),D%1024+56320))}return F.join("")}});e.String.fromCodePoint;var _,I,O,j,V,J,M,k,L,T,z,H,$,R,G={Space_Separator:/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ID_Start:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ID_Continue:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},U={isSpaceSeparator:function(u){return"string"==typeof u&&G.Space_Separator.test(u)},isIdStartChar:function(u){return"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||"$"===u||"_"===u||G.ID_Start.test(u))},isIdContinueChar:function(u){return"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||u>="0"&&u<="9"||"$"===u||"_"===u||"‌"===u||"‍"===u||G.ID_Continue.test(u))},isDigit:function(u){return"string"==typeof u&&/[0-9]/.test(u)},isHexDigit:function(u){return"string"==typeof u&&/[0-9A-Fa-f]/.test(u)}};function Z(){for(T="default",z="",H=!1,$=1;;){R=q();var u=X[T]();if(u)return u}}function q(){if(_[j])return String.fromCodePoint(_.codePointAt(j))}function W(){var u=q();return"\n"===u?(V++,J=0):u?J+=u.length:J++,u&&(j+=u.length),u}var X={default:function(){switch(R){case"\t":case"\v":case"\f":case" ":case" ":case"\ufeff":case"\n":case"\r":case"\u2028":case"\u2029":return void W();case"/":return W(),void(T="comment");case void 0:return W(),K("eof")}if(!U.isSpaceSeparator(R))return X[I]();W()},comment:function(){switch(R){case"*":return W(),void(T="multiLineComment");case"/":return W(),void(T="singleLineComment")}throw tu(W())},multiLineComment:function(){switch(R){case"*":return W(),void(T="multiLineCommentAsterisk");case void 0:throw tu(W())}W()},multiLineCommentAsterisk:function(){switch(R){case"*":return void W();case"/":return W(),void(T="default");case void 0:throw tu(W())}W(),T="multiLineComment"},singleLineComment:function(){switch(R){case"\n":case"\r":case"\u2028":case"\u2029":return W(),void(T="default");case void 0:return W(),K("eof")}W()},value:function(){switch(R){case"{":case"[":return K("punctuator",W());case"n":return W(),Q("ull"),K("null",null);case"t":return W(),Q("rue"),K("boolean",!0);case"f":return W(),Q("alse"),K("boolean",!1);case"-":case"+":return"-"===W()&&($=-1),void(T="sign");case".":return z=W(),void(T="decimalPointLeading");case"0":return z=W(),void(T="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return z=W(),void(T="decimalInteger");case"I":return W(),Q("nfinity"),K("numeric",1/0);case"N":return W(),Q("aN"),K("numeric",NaN);case'"':case"'":return H='"'===W(),z="",void(T="string")}throw tu(W())},identifierNameStartEscape:function(){if("u"!==R)throw tu(W());W();var u=Y();switch(u){case"$":case"_":break;default:if(!U.isIdStartChar(u))throw Fu()}z+=u,T="identifierName"},identifierName:function(){switch(R){case"$":case"_":case"‌":case"‍":return void(z+=W());case"\\":return W(),void(T="identifierNameEscape")}if(!U.isIdContinueChar(R))return K("identifier",z);z+=W()},identifierNameEscape:function(){if("u"!==R)throw tu(W());W();var u=Y();switch(u){case"$":case"_":case"‌":case"‍":break;default:if(!U.isIdContinueChar(u))throw Fu()}z+=u,T="identifierName"},sign:function(){switch(R){case".":return z=W(),void(T="decimalPointLeading");case"0":return z=W(),void(T="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return z=W(),void(T="decimalInteger");case"I":return W(),Q("nfinity"),K("numeric",$*(1/0));case"N":return W(),Q("aN"),K("numeric",NaN)}throw tu(W())},zero:function(){switch(R){case".":return z+=W(),void(T="decimalPoint");case"e":case"E":return z+=W(),void(T="decimalExponent");case"x":case"X":return z+=W(),void(T="hexadecimal")}return K("numeric",0*$)},decimalInteger:function(){switch(R){case".":return z+=W(),void(T="decimalPoint");case"e":case"E":return z+=W(),void(T="decimalExponent")}if(!U.isDigit(R))return K("numeric",$*Number(z));z+=W()},decimalPointLeading:function(){if(U.isDigit(R))return z+=W(),void(T="decimalFraction");throw tu(W())},decimalPoint:function(){switch(R){case"e":case"E":return z+=W(),void(T="decimalExponent")}return U.isDigit(R)?(z+=W(),void(T="decimalFraction")):K("numeric",$*Number(z))},decimalFraction:function(){switch(R){case"e":case"E":return z+=W(),void(T="decimalExponent")}if(!U.isDigit(R))return K("numeric",$*Number(z));z+=W()},decimalExponent:function(){switch(R){case"+":case"-":return z+=W(),void(T="decimalExponentSign")}if(U.isDigit(R))return z+=W(),void(T="decimalExponentInteger");throw tu(W())},decimalExponentSign:function(){if(U.isDigit(R))return z+=W(),void(T="decimalExponentInteger");throw tu(W())},decimalExponentInteger:function(){if(!U.isDigit(R))return K("numeric",$*Number(z));z+=W()},hexadecimal:function(){if(U.isHexDigit(R))return z+=W(),void(T="hexadecimalInteger");throw tu(W())},hexadecimalInteger:function(){if(!U.isHexDigit(R))return K("numeric",$*Number(z));z+=W()},string:function(){switch(R){case"\\":return W(),void(z+=function(){switch(q()){case"b":return W(),"\b";case"f":return W(),"\f";case"n":return W(),"\n";case"r":return W(),"\r";case"t":return W(),"\t";case"v":return W(),"\v";case"0":if(W(),U.isDigit(q()))throw tu(W());return"\0";case"x":return W(),function(){var u="",D=q();if(!U.isHexDigit(D))throw tu(W());if(u+=W(),D=q(),!U.isHexDigit(D))throw tu(W());return u+=W(),String.fromCodePoint(parseInt(u,16))}();case"u":return W(),Y();case"\n":case"\u2028":case"\u2029":return W(),"";case"\r":return W(),"\n"===q()&&W(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case void 0:throw tu(W())}return W()}());case'"':return H?(W(),K("string",z)):void(z+=W());case"'":return H?void(z+=W()):(W(),K("string",z));case"\n":case"\r":throw tu(W());case"\u2028":case"\u2029":!function(u){console.warn("JSON5: '"+nu(u)+"' in strings is not valid ECMAScript; consider escaping")}(R);break;case void 0:throw tu(W())}z+=W()},start:function(){switch(R){case"{":case"[":return K("punctuator",W())}T="value"},beforePropertyName:function(){switch(R){case"$":case"_":return z=W(),void(T="identifierName");case"\\":return W(),void(T="identifierNameStartEscape");case"}":return K("punctuator",W());case'"':case"'":return H='"'===W(),void(T="string")}if(U.isIdStartChar(R))return z+=W(),void(T="identifierName");throw tu(W())},afterPropertyName:function(){if(":"===R)return K("punctuator",W());throw tu(W())},beforePropertyValue:function(){T="value"},afterPropertyValue:function(){switch(R){case",":case"}":return K("punctuator",W())}throw tu(W())},beforeArrayValue:function(){if("]"===R)return K("punctuator",W());T="value"},afterArrayValue:function(){switch(R){case",":case"]":return K("punctuator",W())}throw tu(W())},end:function(){throw tu(W())}};function K(u,D){return{type:u,value:D,line:V,column:J}}function Q(u){for(var D=0,e=u;D0;){var e=q();if(!U.isHexDigit(e))throw tu(W());u+=W()}return String.fromCodePoint(parseInt(u,16))}var uu={start:function(){if("eof"===M.type)throw ru();Du()},beforePropertyName:function(){switch(M.type){case"identifier":case"string":return k=M.value,void(I="afterPropertyName");case"punctuator":return void eu();case"eof":throw ru()}},afterPropertyName:function(){if("eof"===M.type)throw ru();I="beforePropertyValue"},beforePropertyValue:function(){if("eof"===M.type)throw ru();Du()},beforeArrayValue:function(){if("eof"===M.type)throw ru();"punctuator"!==M.type||"]"!==M.value?Du():eu()},afterPropertyValue:function(){if("eof"===M.type)throw ru();switch(M.value){case",":return void(I="beforePropertyName");case"}":eu()}},afterArrayValue:function(){if("eof"===M.type)throw ru();switch(M.value){case",":return void(I="beforeArrayValue");case"]":eu()}},end:function(){}};function Du(){var u;switch(M.type){case"punctuator":switch(M.value){case"{":u={};break;case"[":u=[]}break;case"null":case"boolean":case"numeric":case"string":u=M.value}if(void 0===L)L=u;else{var D=O[O.length-1];Array.isArray(D)?D.push(u):D[k]=u}if(null!==u&&"object"==typeof u)O.push(u),I=Array.isArray(u)?"beforeArrayValue":"beforePropertyName";else{var e=O[O.length-1];I=null==e?"end":Array.isArray(e)?"afterArrayValue":"afterPropertyValue"}}function eu(){O.pop();var u=O[O.length-1];I=null==u?"end":Array.isArray(u)?"afterArrayValue":"afterPropertyValue"}function tu(u){return Cu(void 0===u?"JSON5: invalid end of input at "+V+":"+J:"JSON5: invalid character '"+nu(u)+"' at "+V+":"+J)}function ru(){return Cu("JSON5: invalid end of input at "+V+":"+J)}function Fu(){return Cu("JSON5: invalid identifier character at "+V+":"+(J-=5))}function nu(u){var D={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(D[u])return D[u];if(u<" "){var e=u.charCodeAt(0).toString(16);return"\\x"+("00"+e).substring(e.length)}return u}function Cu(u){var D=new SyntaxError(u);return D.lineNumber=V,D.columnNumber=J,D}return{parse:function(u,D){_=String(u),I="start",O=[],j=0,V=1,J=0,M=void 0,k=void 0,L=void 0;do{M=Z(),uu[I]()}while("eof"!==M.type);return"function"==typeof D?function u(D,e,t){var r=D[e];if(null!=r&&"object"==typeof r)for(var F in r){var n=u(r,F,t);void 0===n?delete r[F]:r[F]=n}return t.call(D,e,r)}({"":L},"",D):L},stringify:function(u,D,e){var t,r,F,n=[],C="",A="";if(null==D||"object"!=typeof D||Array.isArray(D)||(e=D.space,F=D.quote,D=D.replacer),"function"==typeof D)r=D;else if(Array.isArray(D)){t=[];for(var i=0,E=D;i0&&(e=Math.min(10,Math.floor(e)),A="          ".substr(0,e)):"string"==typeof e&&(A=e.substr(0,10)),c("",{"":u});function c(u,D){var e=D[u];switch(null!=e&&("function"==typeof e.toJSON5?e=e.toJSON5(u):"function"==typeof e.toJSON&&(e=e.toJSON(u))),r&&(e=r.call(D,u,e)),e instanceof Number?e=Number(e):e instanceof String?e=String(e):e instanceof Boolean&&(e=e.valueOf()),e){case null:return"null";case!0:return"true";case!1:return"false"}return"string"==typeof e?B(e):"number"==typeof e?String(e):"object"==typeof e?Array.isArray(e)?function(u){if(n.indexOf(u)>=0)throw TypeError("Converting circular structure to JSON5");n.push(u);var D=C;C+=A;for(var e,t=[],r=0;r=0)throw TypeError("Converting circular structure to JSON5");n.push(u);var D=C;C+=A;for(var e,r,F=t||Object.keys(u),i=[],E=0,o=F;E"string"==typeof u&&unicode.Space_Separator.test(u),isIdStartChar:u=>"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||"$"===u||"_"===u||unicode.ID_Start.test(u)),isIdContinueChar:u=>"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||u>="0"&&u<="9"||"$"===u||"_"===u||"‌"===u||"‍"===u||unicode.ID_Continue.test(u)),isDigit:u=>"string"==typeof u&&/[0-9]/.test(u),isHexDigit:u=>"string"==typeof u&&/[0-9A-Fa-f]/.test(u)};let source,parseState,stack,pos,line,column,token,key,root;var parse=function(u,D){source=String(u),parseState="start",stack=[],pos=0,line=1,column=0,token=void 0,key=void 0,root=void 0;do{token=lex(),parseStates[parseState]()}while("eof"!==token.type);return"function"==typeof D?internalize({"":root},"",D):root};function internalize(u,D,e){const r=u[D];if(null!=r&&"object"==typeof r)for(const u in r){const D=internalize(r,u,e);void 0===D?delete r[u]:r[u]=D}return e.call(u,D,r)}let lexState,buffer,doubleQuote,sign,c;function lex(){for(lexState="default",buffer="",doubleQuote=!1,sign=1;;){c=peek();const u=lexStates[lexState]();if(u)return u}}function peek(){if(source[pos])return String.fromCodePoint(source.codePointAt(pos))}function read(){const u=peek();return"\n"===u?(line++,column=0):u?column+=u.length:column++,u&&(pos+=u.length),u}const lexStates={default(){switch(c){case"\t":case"\v":case"\f":case" ":case" ":case"\ufeff":case"\n":case"\r":case"\u2028":case"\u2029":return void read();case"/":return read(),void(lexState="comment");case void 0:return read(),newToken("eof")}if(!util.isSpaceSeparator(c))return lexStates[parseState]();read()},comment(){switch(c){case"*":return read(),void(lexState="multiLineComment");case"/":return read(),void(lexState="singleLineComment")}throw invalidChar(read())},multiLineComment(){switch(c){case"*":return read(),void(lexState="multiLineCommentAsterisk");case void 0:throw invalidChar(read())}read()},multiLineCommentAsterisk(){switch(c){case"*":return void read();case"/":return read(),void(lexState="default");case void 0:throw invalidChar(read())}read(),lexState="multiLineComment"},singleLineComment(){switch(c){case"\n":case"\r":case"\u2028":case"\u2029":return read(),void(lexState="default");case void 0:return read(),newToken("eof")}read()},value(){switch(c){case"{":case"[":return newToken("punctuator",read());case"n":return read(),literal("ull"),newToken("null",null);case"t":return read(),literal("rue"),newToken("boolean",!0);case"f":return read(),literal("alse"),newToken("boolean",!1);case"-":case"+":return"-"===read()&&(sign=-1),void(lexState="sign");case".":return buffer=read(),void(lexState="decimalPointLeading");case"0":return buffer=read(),void(lexState="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return buffer=read(),void(lexState="decimalInteger");case"I":return read(),literal("nfinity"),newToken("numeric",1/0);case"N":return read(),literal("aN"),newToken("numeric",NaN);case'"':case"'":return doubleQuote='"'===read(),buffer="",void(lexState="string")}throw invalidChar(read())},identifierNameStartEscape(){if("u"!==c)throw invalidChar(read());read();const u=unicodeEscape();switch(u){case"$":case"_":break;default:if(!util.isIdStartChar(u))throw invalidIdentifier()}buffer+=u,lexState="identifierName"},identifierName(){switch(c){case"$":case"_":case"‌":case"‍":return void(buffer+=read());case"\\":return read(),void(lexState="identifierNameEscape")}if(!util.isIdContinueChar(c))return newToken("identifier",buffer);buffer+=read()},identifierNameEscape(){if("u"!==c)throw invalidChar(read());read();const u=unicodeEscape();switch(u){case"$":case"_":case"‌":case"‍":break;default:if(!util.isIdContinueChar(u))throw invalidIdentifier()}buffer+=u,lexState="identifierName"},sign(){switch(c){case".":return buffer=read(),void(lexState="decimalPointLeading");case"0":return buffer=read(),void(lexState="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return buffer=read(),void(lexState="decimalInteger");case"I":return read(),literal("nfinity"),newToken("numeric",sign*(1/0));case"N":return read(),literal("aN"),newToken("numeric",NaN)}throw invalidChar(read())},zero(){switch(c){case".":return buffer+=read(),void(lexState="decimalPoint");case"e":case"E":return buffer+=read(),void(lexState="decimalExponent");case"x":case"X":return buffer+=read(),void(lexState="hexadecimal")}return newToken("numeric",0*sign)},decimalInteger(){switch(c){case".":return buffer+=read(),void(lexState="decimalPoint");case"e":case"E":return buffer+=read(),void(lexState="decimalExponent")}if(!util.isDigit(c))return newToken("numeric",sign*Number(buffer));buffer+=read()},decimalPointLeading(){if(util.isDigit(c))return buffer+=read(),void(lexState="decimalFraction");throw invalidChar(read())},decimalPoint(){switch(c){case"e":case"E":return buffer+=read(),void(lexState="decimalExponent")}return util.isDigit(c)?(buffer+=read(),void(lexState="decimalFraction")):newToken("numeric",sign*Number(buffer))},decimalFraction(){switch(c){case"e":case"E":return buffer+=read(),void(lexState="decimalExponent")}if(!util.isDigit(c))return newToken("numeric",sign*Number(buffer));buffer+=read()},decimalExponent(){switch(c){case"+":case"-":return buffer+=read(),void(lexState="decimalExponentSign")}if(util.isDigit(c))return buffer+=read(),void(lexState="decimalExponentInteger");throw invalidChar(read())},decimalExponentSign(){if(util.isDigit(c))return buffer+=read(),void(lexState="decimalExponentInteger");throw invalidChar(read())},decimalExponentInteger(){if(!util.isDigit(c))return newToken("numeric",sign*Number(buffer));buffer+=read()},hexadecimal(){if(util.isHexDigit(c))return buffer+=read(),void(lexState="hexadecimalInteger");throw invalidChar(read())},hexadecimalInteger(){if(!util.isHexDigit(c))return newToken("numeric",sign*Number(buffer));buffer+=read()},string(){switch(c){case"\\":return read(),void(buffer+=escape());case'"':return doubleQuote?(read(),newToken("string",buffer)):void(buffer+=read());case"'":return doubleQuote?void(buffer+=read()):(read(),newToken("string",buffer));case"\n":case"\r":throw invalidChar(read());case"\u2028":case"\u2029":separatorChar(c);break;case void 0:throw invalidChar(read())}buffer+=read()},start(){switch(c){case"{":case"[":return newToken("punctuator",read())}lexState="value"},beforePropertyName(){switch(c){case"$":case"_":return buffer=read(),void(lexState="identifierName");case"\\":return read(),void(lexState="identifierNameStartEscape");case"}":return newToken("punctuator",read());case'"':case"'":return doubleQuote='"'===read(),void(lexState="string")}if(util.isIdStartChar(c))return buffer+=read(),void(lexState="identifierName");throw invalidChar(read())},afterPropertyName(){if(":"===c)return newToken("punctuator",read());throw invalidChar(read())},beforePropertyValue(){lexState="value"},afterPropertyValue(){switch(c){case",":case"}":return newToken("punctuator",read())}throw invalidChar(read())},beforeArrayValue(){if("]"===c)return newToken("punctuator",read());lexState="value"},afterArrayValue(){switch(c){case",":case"]":return newToken("punctuator",read())}throw invalidChar(read())},end(){throw invalidChar(read())}};function newToken(u,D){return{type:u,value:D,line:line,column:column}}function literal(u){for(const D of u){if(peek()!==D)throw invalidChar(read());read()}}function escape(){switch(peek()){case"b":return read(),"\b";case"f":return read(),"\f";case"n":return read(),"\n";case"r":return read(),"\r";case"t":return read(),"\t";case"v":return read(),"\v";case"0":if(read(),util.isDigit(peek()))throw invalidChar(read());return"\0";case"x":return read(),hexEscape();case"u":return read(),unicodeEscape();case"\n":case"\u2028":case"\u2029":return read(),"";case"\r":return read(),"\n"===peek()&&read(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case void 0:throw invalidChar(read())}return read()}function hexEscape(){let u="",D=peek();if(!util.isHexDigit(D))throw invalidChar(read());if(u+=read(),D=peek(),!util.isHexDigit(D))throw invalidChar(read());return u+=read(),String.fromCodePoint(parseInt(u,16))}function unicodeEscape(){let u="",D=4;for(;D-- >0;){const D=peek();if(!util.isHexDigit(D))throw invalidChar(read());u+=read()}return String.fromCodePoint(parseInt(u,16))}const parseStates={start(){if("eof"===token.type)throw invalidEOF();push()},beforePropertyName(){switch(token.type){case"identifier":case"string":return key=token.value,void(parseState="afterPropertyName");case"punctuator":return void pop();case"eof":throw invalidEOF()}},afterPropertyName(){if("eof"===token.type)throw invalidEOF();parseState="beforePropertyValue"},beforePropertyValue(){if("eof"===token.type)throw invalidEOF();push()},beforeArrayValue(){if("eof"===token.type)throw invalidEOF();"punctuator"!==token.type||"]"!==token.value?push():pop()},afterPropertyValue(){if("eof"===token.type)throw invalidEOF();switch(token.value){case",":return void(parseState="beforePropertyName");case"}":pop()}},afterArrayValue(){if("eof"===token.type)throw invalidEOF();switch(token.value){case",":return void(parseState="beforeArrayValue");case"]":pop()}},end(){}};function push(){let u;switch(token.type){case"punctuator":switch(token.value){case"{":u={};break;case"[":u=[]}break;case"null":case"boolean":case"numeric":case"string":u=token.value}if(void 0===root)root=u;else{const D=stack[stack.length-1];Array.isArray(D)?D.push(u):D[key]=u}if(null!==u&&"object"==typeof u)stack.push(u),parseState=Array.isArray(u)?"beforeArrayValue":"beforePropertyName";else{const u=stack[stack.length-1];parseState=null==u?"end":Array.isArray(u)?"afterArrayValue":"afterPropertyValue"}}function pop(){stack.pop();const u=stack[stack.length-1];parseState=null==u?"end":Array.isArray(u)?"afterArrayValue":"afterPropertyValue"}function invalidChar(u){return syntaxError(void 0===u?`JSON5: invalid end of input at ${line}:${column}`:`JSON5: invalid character '${formatChar(u)}' at ${line}:${column}`)}function invalidEOF(){return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)}function invalidIdentifier(){return syntaxError(`JSON5: invalid identifier character at ${line}:${column-=5}`)}function separatorChar(u){console.warn(`JSON5: '${formatChar(u)}' in strings is not valid ECMAScript; consider escaping`)}function formatChar(u){const D={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(D[u])return D[u];if(u<" "){const D=u.charCodeAt(0).toString(16);return"\\x"+("00"+D).substring(D.length)}return u}function syntaxError(u){const D=new SyntaxError(u);return D.lineNumber=line,D.columnNumber=column,D}var stringify=function(u,D,e){const r=[];let t,F,C,a="",A="";if(null==D||"object"!=typeof D||Array.isArray(D)||(e=D.space,C=D.quote,D=D.replacer),"function"==typeof D)F=D;else if(Array.isArray(D)){t=[];for(const u of D){let D;"string"==typeof u?D=u:("number"==typeof u||u instanceof String||u instanceof Number)&&(D=String(u)),void 0!==D&&t.indexOf(D)<0&&t.push(D)}}return e instanceof Number?e=Number(e):e instanceof String&&(e=String(e)),"number"==typeof e?e>0&&(e=Math.min(10,Math.floor(e)),A="          ".substr(0,e)):"string"==typeof e&&(A=e.substr(0,10)),E("",{"":u});function E(u,D){let e=D[u];switch(null!=e&&("function"==typeof e.toJSON5?e=e.toJSON5(u):"function"==typeof e.toJSON&&(e=e.toJSON(u))),F&&(e=F.call(D,u,e)),e instanceof Number?e=Number(e):e instanceof String?e=String(e):e instanceof Boolean&&(e=e.valueOf()),e){case null:return"null";case!0:return"true";case!1:return"false"}return"string"==typeof e?n(e):"number"==typeof e?String(e):"object"==typeof e?Array.isArray(e)?function(u){if(r.indexOf(u)>=0)throw TypeError("Converting circular structure to JSON5");r.push(u);let D=a;a+=A;let e,t=[];for(let D=0;D=0)throw TypeError("Converting circular structure to JSON5");r.push(u);let D=a;a+=A;let e,F=t||Object.keys(u),C=[];for(const D of F){const e=E(D,u);if(void 0!==e){let u=i(D)+":";""!==A&&(u+=" "),u+=e,C.push(u)}}if(0===C.length)e="{}";else{let u;if(""===A)u=C.join(","),e="{"+u+"}";else{let r=",\n"+a;u=C.join(r),e="{\n"+a+u+",\n"+D+"}"}}return r.pop(),a=D,e}(e):void 0}function n(u){const D={"'":.1,'"':.2},e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let r="";for(let t=0;tD[u]= 'a' && c <= 'z') ||
          +        (c >= 'A' && c <= 'Z') ||
          +        (c === '$') || (c === '_') ||
          +        unicode.ID_Start.test(c)
          +        )
          +    },
          +
          +    isIdContinueChar (c) {
          +        return typeof c === 'string' && (
          +            (c >= 'a' && c <= 'z') ||
          +        (c >= 'A' && c <= 'Z') ||
          +        (c >= '0' && c <= '9') ||
          +        (c === '$') || (c === '_') ||
          +        (c === '\u200C') || (c === '\u200D') ||
          +        unicode.ID_Continue.test(c)
          +        )
          +    },
          +
          +    isDigit (c) {
          +        return typeof c === 'string' && /[0-9]/.test(c)
          +    },
          +
          +    isHexDigit (c) {
          +        return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
          +    },
          +};
          +
          +let source;
          +let parseState;
          +let stack;
          +let pos;
          +let line;
          +let column;
          +let token;
          +let key;
          +let root;
          +
          +var parse = function parse (text, reviver) {
          +    source = String(text);
          +    parseState = 'start';
          +    stack = [];
          +    pos = 0;
          +    line = 1;
          +    column = 0;
          +    token = undefined;
          +    key = undefined;
          +    root = undefined;
          +
          +    do {
          +        token = lex();
          +
          +        // This code is unreachable.
          +        // if (!parseStates[parseState]) {
          +        //     throw invalidParseState()
          +        // }
          +
          +        parseStates[parseState]();
          +    } while (token.type !== 'eof')
          +
          +    if (typeof reviver === 'function') {
          +        return internalize({'': root}, '', reviver)
          +    }
          +
          +    return root
          +};
          +
          +function internalize (holder, name, reviver) {
          +    const value = holder[name];
          +    if (value != null && typeof value === 'object') {
          +        for (const key in value) {
          +            const replacement = internalize(value, key, reviver);
          +            if (replacement === undefined) {
          +                delete value[key];
          +            } else {
          +                value[key] = replacement;
          +            }
          +        }
          +    }
          +
          +    return reviver.call(holder, name, value)
          +}
          +
          +let lexState;
          +let buffer;
          +let doubleQuote;
          +let sign;
          +let c;
          +
          +function lex () {
          +    lexState = 'default';
          +    buffer = '';
          +    doubleQuote = false;
          +    sign = 1;
          +
          +    for (;;) {
          +        c = peek();
          +
          +        // This code is unreachable.
          +        // if (!lexStates[lexState]) {
          +        //     throw invalidLexState(lexState)
          +        // }
          +
          +        const token = lexStates[lexState]();
          +        if (token) {
          +            return token
          +        }
          +    }
          +}
          +
          +function peek () {
          +    if (source[pos]) {
          +        return String.fromCodePoint(source.codePointAt(pos))
          +    }
          +}
          +
          +function read () {
          +    const c = peek();
          +
          +    if (c === '\n') {
          +        line++;
          +        column = 0;
          +    } else if (c) {
          +        column += c.length;
          +    } else {
          +        column++;
          +    }
          +
          +    if (c) {
          +        pos += c.length;
          +    }
          +
          +    return c
          +}
          +
          +const lexStates = {
          +    default () {
          +        switch (c) {
          +        case '\t':
          +        case '\v':
          +        case '\f':
          +        case ' ':
          +        case '\u00A0':
          +        case '\uFEFF':
          +        case '\n':
          +        case '\r':
          +        case '\u2028':
          +        case '\u2029':
          +            read();
          +            return
          +
          +        case '/':
          +            read();
          +            lexState = 'comment';
          +            return
          +
          +        case undefined:
          +            read();
          +            return newToken('eof')
          +        }
          +
          +        if (util.isSpaceSeparator(c)) {
          +            read();
          +            return
          +        }
          +
          +        // This code is unreachable.
          +        // if (!lexStates[parseState]) {
          +        //     throw invalidLexState(parseState)
          +        // }
          +
          +        return lexStates[parseState]()
          +    },
          +
          +    comment () {
          +        switch (c) {
          +        case '*':
          +            read();
          +            lexState = 'multiLineComment';
          +            return
          +
          +        case '/':
          +            read();
          +            lexState = 'singleLineComment';
          +            return
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    multiLineComment () {
          +        switch (c) {
          +        case '*':
          +            read();
          +            lexState = 'multiLineCommentAsterisk';
          +            return
          +
          +        case undefined:
          +            throw invalidChar(read())
          +        }
          +
          +        read();
          +    },
          +
          +    multiLineCommentAsterisk () {
          +        switch (c) {
          +        case '*':
          +            read();
          +            return
          +
          +        case '/':
          +            read();
          +            lexState = 'default';
          +            return
          +
          +        case undefined:
          +            throw invalidChar(read())
          +        }
          +
          +        read();
          +        lexState = 'multiLineComment';
          +    },
          +
          +    singleLineComment () {
          +        switch (c) {
          +        case '\n':
          +        case '\r':
          +        case '\u2028':
          +        case '\u2029':
          +            read();
          +            lexState = 'default';
          +            return
          +
          +        case undefined:
          +            read();
          +            return newToken('eof')
          +        }
          +
          +        read();
          +    },
          +
          +    value () {
          +        switch (c) {
          +        case '{':
          +        case '[':
          +            return newToken('punctuator', read())
          +
          +        case 'n':
          +            read();
          +            literal('ull');
          +            return newToken('null', null)
          +
          +        case 't':
          +            read();
          +            literal('rue');
          +            return newToken('boolean', true)
          +
          +        case 'f':
          +            read();
          +            literal('alse');
          +            return newToken('boolean', false)
          +
          +        case '-':
          +        case '+':
          +            if (read() === '-') {
          +                sign = -1;
          +            }
          +
          +            lexState = 'sign';
          +            return
          +
          +        case '.':
          +            buffer = read();
          +            lexState = 'decimalPointLeading';
          +            return
          +
          +        case '0':
          +            buffer = read();
          +            lexState = 'zero';
          +            return
          +
          +        case '1':
          +        case '2':
          +        case '3':
          +        case '4':
          +        case '5':
          +        case '6':
          +        case '7':
          +        case '8':
          +        case '9':
          +            buffer = read();
          +            lexState = 'decimalInteger';
          +            return
          +
          +        case 'I':
          +            read();
          +            literal('nfinity');
          +            return newToken('numeric', Infinity)
          +
          +        case 'N':
          +            read();
          +            literal('aN');
          +            return newToken('numeric', NaN)
          +
          +        case '"':
          +        case "'":
          +            doubleQuote = (read() === '"');
          +            buffer = '';
          +            lexState = 'string';
          +            return
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    identifierNameStartEscape () {
          +        if (c !== 'u') {
          +            throw invalidChar(read())
          +        }
          +
          +        read();
          +        const u = unicodeEscape();
          +        switch (u) {
          +        case '$':
          +        case '_':
          +            break
          +
          +        default:
          +            if (!util.isIdStartChar(u)) {
          +                throw invalidIdentifier()
          +            }
          +
          +            break
          +        }
          +
          +        buffer += u;
          +        lexState = 'identifierName';
          +    },
          +
          +    identifierName () {
          +        switch (c) {
          +        case '$':
          +        case '_':
          +        case '\u200C':
          +        case '\u200D':
          +            buffer += read();
          +            return
          +
          +        case '\\':
          +            read();
          +            lexState = 'identifierNameEscape';
          +            return
          +        }
          +
          +        if (util.isIdContinueChar(c)) {
          +            buffer += read();
          +            return
          +        }
          +
          +        return newToken('identifier', buffer)
          +    },
          +
          +    identifierNameEscape () {
          +        if (c !== 'u') {
          +            throw invalidChar(read())
          +        }
          +
          +        read();
          +        const u = unicodeEscape();
          +        switch (u) {
          +        case '$':
          +        case '_':
          +        case '\u200C':
          +        case '\u200D':
          +            break
          +
          +        default:
          +            if (!util.isIdContinueChar(u)) {
          +                throw invalidIdentifier()
          +            }
          +
          +            break
          +        }
          +
          +        buffer += u;
          +        lexState = 'identifierName';
          +    },
          +
          +    sign () {
          +        switch (c) {
          +        case '.':
          +            buffer = read();
          +            lexState = 'decimalPointLeading';
          +            return
          +
          +        case '0':
          +            buffer = read();
          +            lexState = 'zero';
          +            return
          +
          +        case '1':
          +        case '2':
          +        case '3':
          +        case '4':
          +        case '5':
          +        case '6':
          +        case '7':
          +        case '8':
          +        case '9':
          +            buffer = read();
          +            lexState = 'decimalInteger';
          +            return
          +
          +        case 'I':
          +            read();
          +            literal('nfinity');
          +            return newToken('numeric', sign * Infinity)
          +
          +        case 'N':
          +            read();
          +            literal('aN');
          +            return newToken('numeric', NaN)
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    zero () {
          +        switch (c) {
          +        case '.':
          +            buffer += read();
          +            lexState = 'decimalPoint';
          +            return
          +
          +        case 'e':
          +        case 'E':
          +            buffer += read();
          +            lexState = 'decimalExponent';
          +            return
          +
          +        case 'x':
          +        case 'X':
          +            buffer += read();
          +            lexState = 'hexadecimal';
          +            return
          +        }
          +
          +        return newToken('numeric', sign * 0)
          +    },
          +
          +    decimalInteger () {
          +        switch (c) {
          +        case '.':
          +            buffer += read();
          +            lexState = 'decimalPoint';
          +            return
          +
          +        case 'e':
          +        case 'E':
          +            buffer += read();
          +            lexState = 'decimalExponent';
          +            return
          +        }
          +
          +        if (util.isDigit(c)) {
          +            buffer += read();
          +            return
          +        }
          +
          +        return newToken('numeric', sign * Number(buffer))
          +    },
          +
          +    decimalPointLeading () {
          +        if (util.isDigit(c)) {
          +            buffer += read();
          +            lexState = 'decimalFraction';
          +            return
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    decimalPoint () {
          +        switch (c) {
          +        case 'e':
          +        case 'E':
          +            buffer += read();
          +            lexState = 'decimalExponent';
          +            return
          +        }
          +
          +        if (util.isDigit(c)) {
          +            buffer += read();
          +            lexState = 'decimalFraction';
          +            return
          +        }
          +
          +        return newToken('numeric', sign * Number(buffer))
          +    },
          +
          +    decimalFraction () {
          +        switch (c) {
          +        case 'e':
          +        case 'E':
          +            buffer += read();
          +            lexState = 'decimalExponent';
          +            return
          +        }
          +
          +        if (util.isDigit(c)) {
          +            buffer += read();
          +            return
          +        }
          +
          +        return newToken('numeric', sign * Number(buffer))
          +    },
          +
          +    decimalExponent () {
          +        switch (c) {
          +        case '+':
          +        case '-':
          +            buffer += read();
          +            lexState = 'decimalExponentSign';
          +            return
          +        }
          +
          +        if (util.isDigit(c)) {
          +            buffer += read();
          +            lexState = 'decimalExponentInteger';
          +            return
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    decimalExponentSign () {
          +        if (util.isDigit(c)) {
          +            buffer += read();
          +            lexState = 'decimalExponentInteger';
          +            return
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    decimalExponentInteger () {
          +        if (util.isDigit(c)) {
          +            buffer += read();
          +            return
          +        }
          +
          +        return newToken('numeric', sign * Number(buffer))
          +    },
          +
          +    hexadecimal () {
          +        if (util.isHexDigit(c)) {
          +            buffer += read();
          +            lexState = 'hexadecimalInteger';
          +            return
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    hexadecimalInteger () {
          +        if (util.isHexDigit(c)) {
          +            buffer += read();
          +            return
          +        }
          +
          +        return newToken('numeric', sign * Number(buffer))
          +    },
          +
          +    string () {
          +        switch (c) {
          +        case '\\':
          +            read();
          +            buffer += escape();
          +            return
          +
          +        case '"':
          +            if (doubleQuote) {
          +                read();
          +                return newToken('string', buffer)
          +            }
          +
          +            buffer += read();
          +            return
          +
          +        case "'":
          +            if (!doubleQuote) {
          +                read();
          +                return newToken('string', buffer)
          +            }
          +
          +            buffer += read();
          +            return
          +
          +        case '\n':
          +        case '\r':
          +            throw invalidChar(read())
          +
          +        case '\u2028':
          +        case '\u2029':
          +            separatorChar(c);
          +            break
          +
          +        case undefined:
          +            throw invalidChar(read())
          +        }
          +
          +        buffer += read();
          +    },
          +
          +    start () {
          +        switch (c) {
          +        case '{':
          +        case '[':
          +            return newToken('punctuator', read())
          +
          +        // This code is unreachable since the default lexState handles eof.
          +        // case undefined:
          +        //     return newToken('eof')
          +        }
          +
          +        lexState = 'value';
          +    },
          +
          +    beforePropertyName () {
          +        switch (c) {
          +        case '$':
          +        case '_':
          +            buffer = read();
          +            lexState = 'identifierName';
          +            return
          +
          +        case '\\':
          +            read();
          +            lexState = 'identifierNameStartEscape';
          +            return
          +
          +        case '}':
          +            return newToken('punctuator', read())
          +
          +        case '"':
          +        case "'":
          +            doubleQuote = (read() === '"');
          +            lexState = 'string';
          +            return
          +        }
          +
          +        if (util.isIdStartChar(c)) {
          +            buffer += read();
          +            lexState = 'identifierName';
          +            return
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    afterPropertyName () {
          +        if (c === ':') {
          +            return newToken('punctuator', read())
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    beforePropertyValue () {
          +        lexState = 'value';
          +    },
          +
          +    afterPropertyValue () {
          +        switch (c) {
          +        case ',':
          +        case '}':
          +            return newToken('punctuator', read())
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    beforeArrayValue () {
          +        if (c === ']') {
          +            return newToken('punctuator', read())
          +        }
          +
          +        lexState = 'value';
          +    },
          +
          +    afterArrayValue () {
          +        switch (c) {
          +        case ',':
          +        case ']':
          +            return newToken('punctuator', read())
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    end () {
          +        // This code is unreachable since it's handled by the default lexState.
          +        // if (c === undefined) {
          +        //     read()
          +        //     return newToken('eof')
          +        // }
          +
          +        throw invalidChar(read())
          +    },
          +};
          +
          +function newToken (type, value) {
          +    return {
          +        type,
          +        value,
          +        line,
          +        column,
          +    }
          +}
          +
          +function literal (s) {
          +    for (const c of s) {
          +        const p = peek();
          +
          +        if (p !== c) {
          +            throw invalidChar(read())
          +        }
          +
          +        read();
          +    }
          +}
          +
          +function escape () {
          +    const c = peek();
          +    switch (c) {
          +    case 'b':
          +        read();
          +        return '\b'
          +
          +    case 'f':
          +        read();
          +        return '\f'
          +
          +    case 'n':
          +        read();
          +        return '\n'
          +
          +    case 'r':
          +        read();
          +        return '\r'
          +
          +    case 't':
          +        read();
          +        return '\t'
          +
          +    case 'v':
          +        read();
          +        return '\v'
          +
          +    case '0':
          +        read();
          +        if (util.isDigit(peek())) {
          +            throw invalidChar(read())
          +        }
          +
          +        return '\0'
          +
          +    case 'x':
          +        read();
          +        return hexEscape()
          +
          +    case 'u':
          +        read();
          +        return unicodeEscape()
          +
          +    case '\n':
          +    case '\u2028':
          +    case '\u2029':
          +        read();
          +        return ''
          +
          +    case '\r':
          +        read();
          +        if (peek() === '\n') {
          +            read();
          +        }
          +
          +        return ''
          +
          +    case '1':
          +    case '2':
          +    case '3':
          +    case '4':
          +    case '5':
          +    case '6':
          +    case '7':
          +    case '8':
          +    case '9':
          +        throw invalidChar(read())
          +
          +    case undefined:
          +        throw invalidChar(read())
          +    }
          +
          +    return read()
          +}
          +
          +function hexEscape () {
          +    let buffer = '';
          +    let c = peek();
          +
          +    if (!util.isHexDigit(c)) {
          +        throw invalidChar(read())
          +    }
          +
          +    buffer += read();
          +
          +    c = peek();
          +    if (!util.isHexDigit(c)) {
          +        throw invalidChar(read())
          +    }
          +
          +    buffer += read();
          +
          +    return String.fromCodePoint(parseInt(buffer, 16))
          +}
          +
          +function unicodeEscape () {
          +    let buffer = '';
          +    let count = 4;
          +
          +    while (count-- > 0) {
          +        const c = peek();
          +        if (!util.isHexDigit(c)) {
          +            throw invalidChar(read())
          +        }
          +
          +        buffer += read();
          +    }
          +
          +    return String.fromCodePoint(parseInt(buffer, 16))
          +}
          +
          +const parseStates = {
          +    start () {
          +        if (token.type === 'eof') {
          +            throw invalidEOF()
          +        }
          +
          +        push();
          +    },
          +
          +    beforePropertyName () {
          +        switch (token.type) {
          +        case 'identifier':
          +        case 'string':
          +            key = token.value;
          +            parseState = 'afterPropertyName';
          +            return
          +
          +        case 'punctuator':
          +            // This code is unreachable since it's handled by the lexState.
          +            // if (token.value !== '}') {
          +            //     throw invalidToken()
          +            // }
          +
          +            pop();
          +            return
          +
          +        case 'eof':
          +            throw invalidEOF()
          +        }
          +
          +        // This code is unreachable since it's handled by the lexState.
          +        // throw invalidToken()
          +    },
          +
          +    afterPropertyName () {
          +        // This code is unreachable since it's handled by the lexState.
          +        // if (token.type !== 'punctuator' || token.value !== ':') {
          +        //     throw invalidToken()
          +        // }
          +
          +        if (token.type === 'eof') {
          +            throw invalidEOF()
          +        }
          +
          +        parseState = 'beforePropertyValue';
          +    },
          +
          +    beforePropertyValue () {
          +        if (token.type === 'eof') {
          +            throw invalidEOF()
          +        }
          +
          +        push();
          +    },
          +
          +    beforeArrayValue () {
          +        if (token.type === 'eof') {
          +            throw invalidEOF()
          +        }
          +
          +        if (token.type === 'punctuator' && token.value === ']') {
          +            pop();
          +            return
          +        }
          +
          +        push();
          +    },
          +
          +    afterPropertyValue () {
          +        // This code is unreachable since it's handled by the lexState.
          +        // if (token.type !== 'punctuator') {
          +        //     throw invalidToken()
          +        // }
          +
          +        if (token.type === 'eof') {
          +            throw invalidEOF()
          +        }
          +
          +        switch (token.value) {
          +        case ',':
          +            parseState = 'beforePropertyName';
          +            return
          +
          +        case '}':
          +            pop();
          +        }
          +
          +        // This code is unreachable since it's handled by the lexState.
          +        // throw invalidToken()
          +    },
          +
          +    afterArrayValue () {
          +        // This code is unreachable since it's handled by the lexState.
          +        // if (token.type !== 'punctuator') {
          +        //     throw invalidToken()
          +        // }
          +
          +        if (token.type === 'eof') {
          +            throw invalidEOF()
          +        }
          +
          +        switch (token.value) {
          +        case ',':
          +            parseState = 'beforeArrayValue';
          +            return
          +
          +        case ']':
          +            pop();
          +        }
          +
          +        // This code is unreachable since it's handled by the lexState.
          +        // throw invalidToken()
          +    },
          +
          +    end () {
          +        // This code is unreachable since it's handled by the lexState.
          +        // if (token.type !== 'eof') {
          +        //     throw invalidToken()
          +        // }
          +    },
          +};
          +
          +function push () {
          +    let value;
          +
          +    switch (token.type) {
          +    case 'punctuator':
          +        switch (token.value) {
          +        case '{':
          +            value = {};
          +            break
          +
          +        case '[':
          +            value = [];
          +            break
          +        }
          +
          +        break
          +
          +    case 'null':
          +    case 'boolean':
          +    case 'numeric':
          +    case 'string':
          +        value = token.value;
          +        break
          +
          +    // This code is unreachable.
          +    // default:
          +    //     throw invalidToken()
          +    }
          +
          +    if (root === undefined) {
          +        root = value;
          +    } else {
          +        const parent = stack[stack.length - 1];
          +        if (Array.isArray(parent)) {
          +            parent.push(value);
          +        } else {
          +            parent[key] = value;
          +        }
          +    }
          +
          +    if (value !== null && typeof value === 'object') {
          +        stack.push(value);
          +
          +        if (Array.isArray(value)) {
          +            parseState = 'beforeArrayValue';
          +        } else {
          +            parseState = 'beforePropertyName';
          +        }
          +    } else {
          +        const current = stack[stack.length - 1];
          +        if (current == null) {
          +            parseState = 'end';
          +        } else if (Array.isArray(current)) {
          +            parseState = 'afterArrayValue';
          +        } else {
          +            parseState = 'afterPropertyValue';
          +        }
          +    }
          +}
          +
          +function pop () {
          +    stack.pop();
          +
          +    const current = stack[stack.length - 1];
          +    if (current == null) {
          +        parseState = 'end';
          +    } else if (Array.isArray(current)) {
          +        parseState = 'afterArrayValue';
          +    } else {
          +        parseState = 'afterPropertyValue';
          +    }
          +}
          +
          +// This code is unreachable.
          +// function invalidParseState () {
          +//     return new Error(`JSON5: invalid parse state '${parseState}'`)
          +// }
          +
          +// This code is unreachable.
          +// function invalidLexState (state) {
          +//     return new Error(`JSON5: invalid lex state '${state}'`)
          +// }
          +
          +function invalidChar (c) {
          +    if (c === undefined) {
          +        return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
          +    }
          +
          +    return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
          +}
          +
          +function invalidEOF () {
          +    return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
          +}
          +
          +// This code is unreachable.
          +// function invalidToken () {
          +//     if (token.type === 'eof') {
          +//         return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
          +//     }
          +
          +//     const c = String.fromCodePoint(token.value.codePointAt(0))
          +//     return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
          +// }
          +
          +function invalidIdentifier () {
          +    column -= 5;
          +    return syntaxError(`JSON5: invalid identifier character at ${line}:${column}`)
          +}
          +
          +function separatorChar (c) {
          +    console.warn(`JSON5: '${formatChar(c)}' in strings is not valid ECMAScript; consider escaping`);
          +}
          +
          +function formatChar (c) {
          +    const replacements = {
          +        "'": "\\'",
          +        '"': '\\"',
          +        '\\': '\\\\',
          +        '\b': '\\b',
          +        '\f': '\\f',
          +        '\n': '\\n',
          +        '\r': '\\r',
          +        '\t': '\\t',
          +        '\v': '\\v',
          +        '\0': '\\0',
          +        '\u2028': '\\u2028',
          +        '\u2029': '\\u2029',
          +    };
          +
          +    if (replacements[c]) {
          +        return replacements[c]
          +    }
          +
          +    if (c < ' ') {
          +        const hexString = c.charCodeAt(0).toString(16);
          +        return '\\x' + ('00' + hexString).substring(hexString.length)
          +    }
          +
          +    return c
          +}
          +
          +function syntaxError (message) {
          +    const err = new SyntaxError(message);
          +    err.lineNumber = line;
          +    err.columnNumber = column;
          +    return err
          +}
          +
          +var stringify = function stringify (value, replacer, space) {
          +    const stack = [];
          +    let indent = '';
          +    let propertyList;
          +    let replacerFunc;
          +    let gap = '';
          +    let quote;
          +
          +    if (
          +        replacer != null &&
          +        typeof replacer === 'object' &&
          +        !Array.isArray(replacer)
          +    ) {
          +        space = replacer.space;
          +        quote = replacer.quote;
          +        replacer = replacer.replacer;
          +    }
          +
          +    if (typeof replacer === 'function') {
          +        replacerFunc = replacer;
          +    } else if (Array.isArray(replacer)) {
          +        propertyList = [];
          +        for (const v of replacer) {
          +            let item;
          +
          +            if (typeof v === 'string') {
          +                item = v;
          +            } else if (
          +                typeof v === 'number' ||
          +                v instanceof String ||
          +                v instanceof Number
          +            ) {
          +                item = String(v);
          +            }
          +
          +            if (item !== undefined && propertyList.indexOf(item) < 0) {
          +                propertyList.push(item);
          +            }
          +        }
          +    }
          +
          +    if (space instanceof Number) {
          +        space = Number(space);
          +    } else if (space instanceof String) {
          +        space = String(space);
          +    }
          +
          +    if (typeof space === 'number') {
          +        if (space > 0) {
          +            space = Math.min(10, Math.floor(space));
          +            gap = '          '.substr(0, space);
          +        }
          +    } else if (typeof space === 'string') {
          +        gap = space.substr(0, 10);
          +    }
          +
          +    return serializeProperty('', {'': value})
          +
          +    function serializeProperty (key, holder) {
          +        let value = holder[key];
          +        if (value != null) {
          +            if (typeof value.toJSON5 === 'function') {
          +                value = value.toJSON5(key);
          +            } else if (typeof value.toJSON === 'function') {
          +                value = value.toJSON(key);
          +            }
          +        }
          +
          +        if (replacerFunc) {
          +            value = replacerFunc.call(holder, key, value);
          +        }
          +
          +        if (value instanceof Number) {
          +            value = Number(value);
          +        } else if (value instanceof String) {
          +            value = String(value);
          +        } else if (value instanceof Boolean) {
          +            value = value.valueOf();
          +        }
          +
          +        switch (value) {
          +        case null: return 'null'
          +        case true: return 'true'
          +        case false: return 'false'
          +        }
          +
          +        if (typeof value === 'string') {
          +            return quoteString(value, false)
          +        }
          +
          +        if (typeof value === 'number') {
          +            return String(value)
          +        }
          +
          +        if (typeof value === 'object') {
          +            return Array.isArray(value) ? serializeArray(value) : serializeObject(value)
          +        }
          +
          +        return undefined
          +    }
          +
          +    function quoteString (value) {
          +        const quotes = {
          +            "'": 0.1,
          +            '"': 0.2,
          +        };
          +
          +        const replacements = {
          +            "'": "\\'",
          +            '"': '\\"',
          +            '\\': '\\\\',
          +            '\b': '\\b',
          +            '\f': '\\f',
          +            '\n': '\\n',
          +            '\r': '\\r',
          +            '\t': '\\t',
          +            '\v': '\\v',
          +            '\0': '\\0',
          +            '\u2028': '\\u2028',
          +            '\u2029': '\\u2029',
          +        };
          +
          +        let product = '';
          +
          +        for (let i = 0; i < value.length; i++) {
          +            const c = value[i];
          +            switch (c) {
          +            case "'":
          +            case '"':
          +                quotes[c]++;
          +                product += c;
          +                continue
          +
          +            case '\0':
          +                if (util.isDigit(value[i + 1])) {
          +                    product += '\\x00';
          +                    continue
          +                }
          +            }
          +
          +            if (replacements[c]) {
          +                product += replacements[c];
          +                continue
          +            }
          +
          +            if (c < ' ') {
          +                let hexString = c.charCodeAt(0).toString(16);
          +                product += '\\x' + ('00' + hexString).substring(hexString.length);
          +                continue
          +            }
          +
          +            product += c;
          +        }
          +
          +        const quoteChar = quote || Object.keys(quotes).reduce((a, b) => (quotes[a] < quotes[b]) ? a : b);
          +
          +        product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);
          +
          +        return quoteChar + product + quoteChar
          +    }
          +
          +    function serializeObject (value) {
          +        if (stack.indexOf(value) >= 0) {
          +            throw TypeError('Converting circular structure to JSON5')
          +        }
          +
          +        stack.push(value);
          +
          +        let stepback = indent;
          +        indent = indent + gap;
          +
          +        let keys = propertyList || Object.keys(value);
          +        let partial = [];
          +        for (const key of keys) {
          +            const propertyString = serializeProperty(key, value);
          +            if (propertyString !== undefined) {
          +                let member = serializeKey(key) + ':';
          +                if (gap !== '') {
          +                    member += ' ';
          +                }
          +                member += propertyString;
          +                partial.push(member);
          +            }
          +        }
          +
          +        let final;
          +        if (partial.length === 0) {
          +            final = '{}';
          +        } else {
          +            let properties;
          +            if (gap === '') {
          +                properties = partial.join(',');
          +                final = '{' + properties + '}';
          +            } else {
          +                let separator = ',\n' + indent;
          +                properties = partial.join(separator);
          +                final = '{\n' + indent + properties + ',\n' + stepback + '}';
          +            }
          +        }
          +
          +        stack.pop();
          +        indent = stepback;
          +        return final
          +    }
          +
          +    function serializeKey (key) {
          +        if (key.length === 0) {
          +            return quoteString(key, true)
          +        }
          +
          +        const firstChar = String.fromCodePoint(key.codePointAt(0));
          +        if (!util.isIdStartChar(firstChar)) {
          +            return quoteString(key, true)
          +        }
          +
          +        for (let i = firstChar.length; i < key.length; i++) {
          +            if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
          +                return quoteString(key, true)
          +            }
          +        }
          +
          +        return key
          +    }
          +
          +    function serializeArray (value) {
          +        if (stack.indexOf(value) >= 0) {
          +            throw TypeError('Converting circular structure to JSON5')
          +        }
          +
          +        stack.push(value);
          +
          +        let stepback = indent;
          +        indent = indent + gap;
          +
          +        let partial = [];
          +        for (let i = 0; i < value.length; i++) {
          +            const propertyString = serializeProperty(String(i), value);
          +            partial.push((propertyString !== undefined) ? propertyString : 'null');
          +        }
          +
          +        let final;
          +        if (partial.length === 0) {
          +            final = '[]';
          +        } else {
          +            if (gap === '') {
          +                let properties = partial.join(',');
          +                final = '[' + properties + ']';
          +            } else {
          +                let separator = ',\n' + indent;
          +                let properties = partial.join(separator);
          +                final = '[\n' + indent + properties + ',\n' + stepback + ']';
          +            }
          +        }
          +
          +        stack.pop();
          +        indent = stepback;
          +        return final
          +    }
          +};
          +
          +const JSON5 = {
          +    parse,
          +    stringify,
          +};
          +
          +var lib = JSON5;
          +
          +export default lib;
          diff --git a/tools/node_modules/@babel/core/node_modules/json5/lib/cli.js b/tools/node_modules/@babel/core/node_modules/json5/lib/cli.js
          new file mode 100644
          index 00000000000000..de852f15e47bc2
          --- /dev/null
          +++ b/tools/node_modules/@babel/core/node_modules/json5/lib/cli.js
          @@ -0,0 +1,112 @@
          +#!/usr/bin/env node
          +
          +const fs = require('fs')
          +const path = require('path')
          +const minimist = require('minimist')
          +const pkg = require('../package.json')
          +const JSON5 = require('./')
          +
          +const argv = minimist(process.argv.slice(2), {
          +    alias: {
          +        'convert': 'c',
          +        'space': 's',
          +        'validate': 'v',
          +        'out-file': 'o',
          +        'version': 'V',
          +        'help': 'h',
          +    },
          +    boolean: [
          +        'convert',
          +        'validate',
          +        'version',
          +        'help',
          +    ],
          +    string: [
          +        'space',
          +        'out-file',
          +    ],
          +})
          +
          +if (argv.version) {
          +    version()
          +} else if (argv.help) {
          +    usage()
          +} else {
          +    const inFilename = argv._[0]
          +
          +    let readStream
          +    if (inFilename) {
          +        readStream = fs.createReadStream(inFilename)
          +    } else {
          +        readStream = process.stdin
          +    }
          +
          +    let json5 = ''
          +    readStream.on('data', data => {
          +        json5 += data
          +    })
          +
          +    readStream.on('end', () => {
          +        let space
          +        if (argv.space === 't' || argv.space === 'tab') {
          +            space = '\t'
          +        } else {
          +            space = Number(argv.space)
          +        }
          +
          +        let value
          +        try {
          +            value = JSON5.parse(json5)
          +            if (!argv.validate) {
          +                const json = JSON.stringify(value, null, space)
          +
          +                let writeStream
          +
          +                // --convert is for backward compatibility with v0.5.1. If
          +                // specified with  and not --out-file, then a file with
          +                // the same name but with a .json extension will be written.
          +                if (argv.convert && inFilename && !argv.o) {
          +                    const parsedFilename = path.parse(inFilename)
          +                    const outFilename = path.format(
          +                        Object.assign(
          +                            parsedFilename,
          +                            {base: path.basename(parsedFilename.base, parsedFilename.ext) + '.json'}
          +                        )
          +                    )
          +
          +                    writeStream = fs.createWriteStream(outFilename)
          +                } else if (argv.o) {
          +                    writeStream = fs.createWriteStream(argv.o)
          +                } else {
          +                    writeStream = process.stdout
          +                }
          +
          +                writeStream.write(json)
          +            }
          +        } catch (err) {
          +            console.error(err.message)
          +            process.exit(1)
          +        }
          +    })
          +}
          +
          +function version () {
          +    console.log(pkg.version)
          +}
          +
          +function usage () {
          +    console.log(
          +        `
          +  Usage: json5 [options] 
          +
          +  If  is not provided, then STDIN is used.
          +
          +  Options:
          +
          +    -s, --space              The number of spaces to indent or 't' for tabs
          +    -o, --out-file [file]    Output to the specified file, otherwise STDOUT
          +    -v, --validate           Validate JSON5 but do not output JSON
          +    -V, --version            Output the version number
          +    -h, --help               Output usage information`
          +    )
          +}
          diff --git a/tools/node_modules/@babel/core/node_modules/json5/lib/index.js b/tools/node_modules/@babel/core/node_modules/json5/lib/index.js
          new file mode 100644
          index 00000000000000..36796388892da3
          --- /dev/null
          +++ b/tools/node_modules/@babel/core/node_modules/json5/lib/index.js
          @@ -0,0 +1,9 @@
          +const parse = require('./parse')
          +const stringify = require('./stringify')
          +
          +const JSON5 = {
          +    parse,
          +    stringify,
          +}
          +
          +module.exports = JSON5
          diff --git a/tools/node_modules/@babel/core/node_modules/json5/lib/parse.js b/tools/node_modules/@babel/core/node_modules/json5/lib/parse.js
          new file mode 100644
          index 00000000000000..c01646fc3a9981
          --- /dev/null
          +++ b/tools/node_modules/@babel/core/node_modules/json5/lib/parse.js
          @@ -0,0 +1,1087 @@
          +const util = require('./util')
          +
          +let source
          +let parseState
          +let stack
          +let pos
          +let line
          +let column
          +let token
          +let key
          +let root
          +
          +module.exports = function parse (text, reviver) {
          +    source = String(text)
          +    parseState = 'start'
          +    stack = []
          +    pos = 0
          +    line = 1
          +    column = 0
          +    token = undefined
          +    key = undefined
          +    root = undefined
          +
          +    do {
          +        token = lex()
          +
          +        // This code is unreachable.
          +        // if (!parseStates[parseState]) {
          +        //     throw invalidParseState()
          +        // }
          +
          +        parseStates[parseState]()
          +    } while (token.type !== 'eof')
          +
          +    if (typeof reviver === 'function') {
          +        return internalize({'': root}, '', reviver)
          +    }
          +
          +    return root
          +}
          +
          +function internalize (holder, name, reviver) {
          +    const value = holder[name]
          +    if (value != null && typeof value === 'object') {
          +        for (const key in value) {
          +            const replacement = internalize(value, key, reviver)
          +            if (replacement === undefined) {
          +                delete value[key]
          +            } else {
          +                value[key] = replacement
          +            }
          +        }
          +    }
          +
          +    return reviver.call(holder, name, value)
          +}
          +
          +let lexState
          +let buffer
          +let doubleQuote
          +let sign
          +let c
          +
          +function lex () {
          +    lexState = 'default'
          +    buffer = ''
          +    doubleQuote = false
          +    sign = 1
          +
          +    for (;;) {
          +        c = peek()
          +
          +        // This code is unreachable.
          +        // if (!lexStates[lexState]) {
          +        //     throw invalidLexState(lexState)
          +        // }
          +
          +        const token = lexStates[lexState]()
          +        if (token) {
          +            return token
          +        }
          +    }
          +}
          +
          +function peek () {
          +    if (source[pos]) {
          +        return String.fromCodePoint(source.codePointAt(pos))
          +    }
          +}
          +
          +function read () {
          +    const c = peek()
          +
          +    if (c === '\n') {
          +        line++
          +        column = 0
          +    } else if (c) {
          +        column += c.length
          +    } else {
          +        column++
          +    }
          +
          +    if (c) {
          +        pos += c.length
          +    }
          +
          +    return c
          +}
          +
          +const lexStates = {
          +    default () {
          +        switch (c) {
          +        case '\t':
          +        case '\v':
          +        case '\f':
          +        case ' ':
          +        case '\u00A0':
          +        case '\uFEFF':
          +        case '\n':
          +        case '\r':
          +        case '\u2028':
          +        case '\u2029':
          +            read()
          +            return
          +
          +        case '/':
          +            read()
          +            lexState = 'comment'
          +            return
          +
          +        case undefined:
          +            read()
          +            return newToken('eof')
          +        }
          +
          +        if (util.isSpaceSeparator(c)) {
          +            read()
          +            return
          +        }
          +
          +        // This code is unreachable.
          +        // if (!lexStates[parseState]) {
          +        //     throw invalidLexState(parseState)
          +        // }
          +
          +        return lexStates[parseState]()
          +    },
          +
          +    comment () {
          +        switch (c) {
          +        case '*':
          +            read()
          +            lexState = 'multiLineComment'
          +            return
          +
          +        case '/':
          +            read()
          +            lexState = 'singleLineComment'
          +            return
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    multiLineComment () {
          +        switch (c) {
          +        case '*':
          +            read()
          +            lexState = 'multiLineCommentAsterisk'
          +            return
          +
          +        case undefined:
          +            throw invalidChar(read())
          +        }
          +
          +        read()
          +    },
          +
          +    multiLineCommentAsterisk () {
          +        switch (c) {
          +        case '*':
          +            read()
          +            return
          +
          +        case '/':
          +            read()
          +            lexState = 'default'
          +            return
          +
          +        case undefined:
          +            throw invalidChar(read())
          +        }
          +
          +        read()
          +        lexState = 'multiLineComment'
          +    },
          +
          +    singleLineComment () {
          +        switch (c) {
          +        case '\n':
          +        case '\r':
          +        case '\u2028':
          +        case '\u2029':
          +            read()
          +            lexState = 'default'
          +            return
          +
          +        case undefined:
          +            read()
          +            return newToken('eof')
          +        }
          +
          +        read()
          +    },
          +
          +    value () {
          +        switch (c) {
          +        case '{':
          +        case '[':
          +            return newToken('punctuator', read())
          +
          +        case 'n':
          +            read()
          +            literal('ull')
          +            return newToken('null', null)
          +
          +        case 't':
          +            read()
          +            literal('rue')
          +            return newToken('boolean', true)
          +
          +        case 'f':
          +            read()
          +            literal('alse')
          +            return newToken('boolean', false)
          +
          +        case '-':
          +        case '+':
          +            if (read() === '-') {
          +                sign = -1
          +            }
          +
          +            lexState = 'sign'
          +            return
          +
          +        case '.':
          +            buffer = read()
          +            lexState = 'decimalPointLeading'
          +            return
          +
          +        case '0':
          +            buffer = read()
          +            lexState = 'zero'
          +            return
          +
          +        case '1':
          +        case '2':
          +        case '3':
          +        case '4':
          +        case '5':
          +        case '6':
          +        case '7':
          +        case '8':
          +        case '9':
          +            buffer = read()
          +            lexState = 'decimalInteger'
          +            return
          +
          +        case 'I':
          +            read()
          +            literal('nfinity')
          +            return newToken('numeric', Infinity)
          +
          +        case 'N':
          +            read()
          +            literal('aN')
          +            return newToken('numeric', NaN)
          +
          +        case '"':
          +        case "'":
          +            doubleQuote = (read() === '"')
          +            buffer = ''
          +            lexState = 'string'
          +            return
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    identifierNameStartEscape () {
          +        if (c !== 'u') {
          +            throw invalidChar(read())
          +        }
          +
          +        read()
          +        const u = unicodeEscape()
          +        switch (u) {
          +        case '$':
          +        case '_':
          +            break
          +
          +        default:
          +            if (!util.isIdStartChar(u)) {
          +                throw invalidIdentifier()
          +            }
          +
          +            break
          +        }
          +
          +        buffer += u
          +        lexState = 'identifierName'
          +    },
          +
          +    identifierName () {
          +        switch (c) {
          +        case '$':
          +        case '_':
          +        case '\u200C':
          +        case '\u200D':
          +            buffer += read()
          +            return
          +
          +        case '\\':
          +            read()
          +            lexState = 'identifierNameEscape'
          +            return
          +        }
          +
          +        if (util.isIdContinueChar(c)) {
          +            buffer += read()
          +            return
          +        }
          +
          +        return newToken('identifier', buffer)
          +    },
          +
          +    identifierNameEscape () {
          +        if (c !== 'u') {
          +            throw invalidChar(read())
          +        }
          +
          +        read()
          +        const u = unicodeEscape()
          +        switch (u) {
          +        case '$':
          +        case '_':
          +        case '\u200C':
          +        case '\u200D':
          +            break
          +
          +        default:
          +            if (!util.isIdContinueChar(u)) {
          +                throw invalidIdentifier()
          +            }
          +
          +            break
          +        }
          +
          +        buffer += u
          +        lexState = 'identifierName'
          +    },
          +
          +    sign () {
          +        switch (c) {
          +        case '.':
          +            buffer = read()
          +            lexState = 'decimalPointLeading'
          +            return
          +
          +        case '0':
          +            buffer = read()
          +            lexState = 'zero'
          +            return
          +
          +        case '1':
          +        case '2':
          +        case '3':
          +        case '4':
          +        case '5':
          +        case '6':
          +        case '7':
          +        case '8':
          +        case '9':
          +            buffer = read()
          +            lexState = 'decimalInteger'
          +            return
          +
          +        case 'I':
          +            read()
          +            literal('nfinity')
          +            return newToken('numeric', sign * Infinity)
          +
          +        case 'N':
          +            read()
          +            literal('aN')
          +            return newToken('numeric', NaN)
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    zero () {
          +        switch (c) {
          +        case '.':
          +            buffer += read()
          +            lexState = 'decimalPoint'
          +            return
          +
          +        case 'e':
          +        case 'E':
          +            buffer += read()
          +            lexState = 'decimalExponent'
          +            return
          +
          +        case 'x':
          +        case 'X':
          +            buffer += read()
          +            lexState = 'hexadecimal'
          +            return
          +        }
          +
          +        return newToken('numeric', sign * 0)
          +    },
          +
          +    decimalInteger () {
          +        switch (c) {
          +        case '.':
          +            buffer += read()
          +            lexState = 'decimalPoint'
          +            return
          +
          +        case 'e':
          +        case 'E':
          +            buffer += read()
          +            lexState = 'decimalExponent'
          +            return
          +        }
          +
          +        if (util.isDigit(c)) {
          +            buffer += read()
          +            return
          +        }
          +
          +        return newToken('numeric', sign * Number(buffer))
          +    },
          +
          +    decimalPointLeading () {
          +        if (util.isDigit(c)) {
          +            buffer += read()
          +            lexState = 'decimalFraction'
          +            return
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    decimalPoint () {
          +        switch (c) {
          +        case 'e':
          +        case 'E':
          +            buffer += read()
          +            lexState = 'decimalExponent'
          +            return
          +        }
          +
          +        if (util.isDigit(c)) {
          +            buffer += read()
          +            lexState = 'decimalFraction'
          +            return
          +        }
          +
          +        return newToken('numeric', sign * Number(buffer))
          +    },
          +
          +    decimalFraction () {
          +        switch (c) {
          +        case 'e':
          +        case 'E':
          +            buffer += read()
          +            lexState = 'decimalExponent'
          +            return
          +        }
          +
          +        if (util.isDigit(c)) {
          +            buffer += read()
          +            return
          +        }
          +
          +        return newToken('numeric', sign * Number(buffer))
          +    },
          +
          +    decimalExponent () {
          +        switch (c) {
          +        case '+':
          +        case '-':
          +            buffer += read()
          +            lexState = 'decimalExponentSign'
          +            return
          +        }
          +
          +        if (util.isDigit(c)) {
          +            buffer += read()
          +            lexState = 'decimalExponentInteger'
          +            return
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    decimalExponentSign () {
          +        if (util.isDigit(c)) {
          +            buffer += read()
          +            lexState = 'decimalExponentInteger'
          +            return
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    decimalExponentInteger () {
          +        if (util.isDigit(c)) {
          +            buffer += read()
          +            return
          +        }
          +
          +        return newToken('numeric', sign * Number(buffer))
          +    },
          +
          +    hexadecimal () {
          +        if (util.isHexDigit(c)) {
          +            buffer += read()
          +            lexState = 'hexadecimalInteger'
          +            return
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    hexadecimalInteger () {
          +        if (util.isHexDigit(c)) {
          +            buffer += read()
          +            return
          +        }
          +
          +        return newToken('numeric', sign * Number(buffer))
          +    },
          +
          +    string () {
          +        switch (c) {
          +        case '\\':
          +            read()
          +            buffer += escape()
          +            return
          +
          +        case '"':
          +            if (doubleQuote) {
          +                read()
          +                return newToken('string', buffer)
          +            }
          +
          +            buffer += read()
          +            return
          +
          +        case "'":
          +            if (!doubleQuote) {
          +                read()
          +                return newToken('string', buffer)
          +            }
          +
          +            buffer += read()
          +            return
          +
          +        case '\n':
          +        case '\r':
          +            throw invalidChar(read())
          +
          +        case '\u2028':
          +        case '\u2029':
          +            separatorChar(c)
          +            break
          +
          +        case undefined:
          +            throw invalidChar(read())
          +        }
          +
          +        buffer += read()
          +    },
          +
          +    start () {
          +        switch (c) {
          +        case '{':
          +        case '[':
          +            return newToken('punctuator', read())
          +
          +        // This code is unreachable since the default lexState handles eof.
          +        // case undefined:
          +        //     return newToken('eof')
          +        }
          +
          +        lexState = 'value'
          +    },
          +
          +    beforePropertyName () {
          +        switch (c) {
          +        case '$':
          +        case '_':
          +            buffer = read()
          +            lexState = 'identifierName'
          +            return
          +
          +        case '\\':
          +            read()
          +            lexState = 'identifierNameStartEscape'
          +            return
          +
          +        case '}':
          +            return newToken('punctuator', read())
          +
          +        case '"':
          +        case "'":
          +            doubleQuote = (read() === '"')
          +            lexState = 'string'
          +            return
          +        }
          +
          +        if (util.isIdStartChar(c)) {
          +            buffer += read()
          +            lexState = 'identifierName'
          +            return
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    afterPropertyName () {
          +        if (c === ':') {
          +            return newToken('punctuator', read())
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    beforePropertyValue () {
          +        lexState = 'value'
          +    },
          +
          +    afterPropertyValue () {
          +        switch (c) {
          +        case ',':
          +        case '}':
          +            return newToken('punctuator', read())
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    beforeArrayValue () {
          +        if (c === ']') {
          +            return newToken('punctuator', read())
          +        }
          +
          +        lexState = 'value'
          +    },
          +
          +    afterArrayValue () {
          +        switch (c) {
          +        case ',':
          +        case ']':
          +            return newToken('punctuator', read())
          +        }
          +
          +        throw invalidChar(read())
          +    },
          +
          +    end () {
          +        // This code is unreachable since it's handled by the default lexState.
          +        // if (c === undefined) {
          +        //     read()
          +        //     return newToken('eof')
          +        // }
          +
          +        throw invalidChar(read())
          +    },
          +}
          +
          +function newToken (type, value) {
          +    return {
          +        type,
          +        value,
          +        line,
          +        column,
          +    }
          +}
          +
          +function literal (s) {
          +    for (const c of s) {
          +        const p = peek()
          +
          +        if (p !== c) {
          +            throw invalidChar(read())
          +        }
          +
          +        read()
          +    }
          +}
          +
          +function escape () {
          +    const c = peek()
          +    switch (c) {
          +    case 'b':
          +        read()
          +        return '\b'
          +
          +    case 'f':
          +        read()
          +        return '\f'
          +
          +    case 'n':
          +        read()
          +        return '\n'
          +
          +    case 'r':
          +        read()
          +        return '\r'
          +
          +    case 't':
          +        read()
          +        return '\t'
          +
          +    case 'v':
          +        read()
          +        return '\v'
          +
          +    case '0':
          +        read()
          +        if (util.isDigit(peek())) {
          +            throw invalidChar(read())
          +        }
          +
          +        return '\0'
          +
          +    case 'x':
          +        read()
          +        return hexEscape()
          +
          +    case 'u':
          +        read()
          +        return unicodeEscape()
          +
          +    case '\n':
          +    case '\u2028':
          +    case '\u2029':
          +        read()
          +        return ''
          +
          +    case '\r':
          +        read()
          +        if (peek() === '\n') {
          +            read()
          +        }
          +
          +        return ''
          +
          +    case '1':
          +    case '2':
          +    case '3':
          +    case '4':
          +    case '5':
          +    case '6':
          +    case '7':
          +    case '8':
          +    case '9':
          +        throw invalidChar(read())
          +
          +    case undefined:
          +        throw invalidChar(read())
          +    }
          +
          +    return read()
          +}
          +
          +function hexEscape () {
          +    let buffer = ''
          +    let c = peek()
          +
          +    if (!util.isHexDigit(c)) {
          +        throw invalidChar(read())
          +    }
          +
          +    buffer += read()
          +
          +    c = peek()
          +    if (!util.isHexDigit(c)) {
          +        throw invalidChar(read())
          +    }
          +
          +    buffer += read()
          +
          +    return String.fromCodePoint(parseInt(buffer, 16))
          +}
          +
          +function unicodeEscape () {
          +    let buffer = ''
          +    let count = 4
          +
          +    while (count-- > 0) {
          +        const c = peek()
          +        if (!util.isHexDigit(c)) {
          +            throw invalidChar(read())
          +        }
          +
          +        buffer += read()
          +    }
          +
          +    return String.fromCodePoint(parseInt(buffer, 16))
          +}
          +
          +const parseStates = {
          +    start () {
          +        if (token.type === 'eof') {
          +            throw invalidEOF()
          +        }
          +
          +        push()
          +    },
          +
          +    beforePropertyName () {
          +        switch (token.type) {
          +        case 'identifier':
          +        case 'string':
          +            key = token.value
          +            parseState = 'afterPropertyName'
          +            return
          +
          +        case 'punctuator':
          +            // This code is unreachable since it's handled by the lexState.
          +            // if (token.value !== '}') {
          +            //     throw invalidToken()
          +            // }
          +
          +            pop()
          +            return
          +
          +        case 'eof':
          +            throw invalidEOF()
          +        }
          +
          +        // This code is unreachable since it's handled by the lexState.
          +        // throw invalidToken()
          +    },
          +
          +    afterPropertyName () {
          +        // This code is unreachable since it's handled by the lexState.
          +        // if (token.type !== 'punctuator' || token.value !== ':') {
          +        //     throw invalidToken()
          +        // }
          +
          +        if (token.type === 'eof') {
          +            throw invalidEOF()
          +        }
          +
          +        parseState = 'beforePropertyValue'
          +    },
          +
          +    beforePropertyValue () {
          +        if (token.type === 'eof') {
          +            throw invalidEOF()
          +        }
          +
          +        push()
          +    },
          +
          +    beforeArrayValue () {
          +        if (token.type === 'eof') {
          +            throw invalidEOF()
          +        }
          +
          +        if (token.type === 'punctuator' && token.value === ']') {
          +            pop()
          +            return
          +        }
          +
          +        push()
          +    },
          +
          +    afterPropertyValue () {
          +        // This code is unreachable since it's handled by the lexState.
          +        // if (token.type !== 'punctuator') {
          +        //     throw invalidToken()
          +        // }
          +
          +        if (token.type === 'eof') {
          +            throw invalidEOF()
          +        }
          +
          +        switch (token.value) {
          +        case ',':
          +            parseState = 'beforePropertyName'
          +            return
          +
          +        case '}':
          +            pop()
          +        }
          +
          +        // This code is unreachable since it's handled by the lexState.
          +        // throw invalidToken()
          +    },
          +
          +    afterArrayValue () {
          +        // This code is unreachable since it's handled by the lexState.
          +        // if (token.type !== 'punctuator') {
          +        //     throw invalidToken()
          +        // }
          +
          +        if (token.type === 'eof') {
          +            throw invalidEOF()
          +        }
          +
          +        switch (token.value) {
          +        case ',':
          +            parseState = 'beforeArrayValue'
          +            return
          +
          +        case ']':
          +            pop()
          +        }
          +
          +        // This code is unreachable since it's handled by the lexState.
          +        // throw invalidToken()
          +    },
          +
          +    end () {
          +        // This code is unreachable since it's handled by the lexState.
          +        // if (token.type !== 'eof') {
          +        //     throw invalidToken()
          +        // }
          +    },
          +}
          +
          +function push () {
          +    let value
          +
          +    switch (token.type) {
          +    case 'punctuator':
          +        switch (token.value) {
          +        case '{':
          +            value = {}
          +            break
          +
          +        case '[':
          +            value = []
          +            break
          +        }
          +
          +        break
          +
          +    case 'null':
          +    case 'boolean':
          +    case 'numeric':
          +    case 'string':
          +        value = token.value
          +        break
          +
          +    // This code is unreachable.
          +    // default:
          +    //     throw invalidToken()
          +    }
          +
          +    if (root === undefined) {
          +        root = value
          +    } else {
          +        const parent = stack[stack.length - 1]
          +        if (Array.isArray(parent)) {
          +            parent.push(value)
          +        } else {
          +            parent[key] = value
          +        }
          +    }
          +
          +    if (value !== null && typeof value === 'object') {
          +        stack.push(value)
          +
          +        if (Array.isArray(value)) {
          +            parseState = 'beforeArrayValue'
          +        } else {
          +            parseState = 'beforePropertyName'
          +        }
          +    } else {
          +        const current = stack[stack.length - 1]
          +        if (current == null) {
          +            parseState = 'end'
          +        } else if (Array.isArray(current)) {
          +            parseState = 'afterArrayValue'
          +        } else {
          +            parseState = 'afterPropertyValue'
          +        }
          +    }
          +}
          +
          +function pop () {
          +    stack.pop()
          +
          +    const current = stack[stack.length - 1]
          +    if (current == null) {
          +        parseState = 'end'
          +    } else if (Array.isArray(current)) {
          +        parseState = 'afterArrayValue'
          +    } else {
          +        parseState = 'afterPropertyValue'
          +    }
          +}
          +
          +// This code is unreachable.
          +// function invalidParseState () {
          +//     return new Error(`JSON5: invalid parse state '${parseState}'`)
          +// }
          +
          +// This code is unreachable.
          +// function invalidLexState (state) {
          +//     return new Error(`JSON5: invalid lex state '${state}'`)
          +// }
          +
          +function invalidChar (c) {
          +    if (c === undefined) {
          +        return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
          +    }
          +
          +    return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
          +}
          +
          +function invalidEOF () {
          +    return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
          +}
          +
          +// This code is unreachable.
          +// function invalidToken () {
          +//     if (token.type === 'eof') {
          +//         return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
          +//     }
          +
          +//     const c = String.fromCodePoint(token.value.codePointAt(0))
          +//     return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
          +// }
          +
          +function invalidIdentifier () {
          +    column -= 5
          +    return syntaxError(`JSON5: invalid identifier character at ${line}:${column}`)
          +}
          +
          +function separatorChar (c) {
          +    console.warn(`JSON5: '${formatChar(c)}' in strings is not valid ECMAScript; consider escaping`)
          +}
          +
          +function formatChar (c) {
          +    const replacements = {
          +        "'": "\\'",
          +        '"': '\\"',
          +        '\\': '\\\\',
          +        '\b': '\\b',
          +        '\f': '\\f',
          +        '\n': '\\n',
          +        '\r': '\\r',
          +        '\t': '\\t',
          +        '\v': '\\v',
          +        '\0': '\\0',
          +        '\u2028': '\\u2028',
          +        '\u2029': '\\u2029',
          +    }
          +
          +    if (replacements[c]) {
          +        return replacements[c]
          +    }
          +
          +    if (c < ' ') {
          +        const hexString = c.charCodeAt(0).toString(16)
          +        return '\\x' + ('00' + hexString).substring(hexString.length)
          +    }
          +
          +    return c
          +}
          +
          +function syntaxError (message) {
          +    const err = new SyntaxError(message)
          +    err.lineNumber = line
          +    err.columnNumber = column
          +    return err
          +}
          diff --git a/tools/node_modules/@babel/core/node_modules/json5/lib/register.js b/tools/node_modules/@babel/core/node_modules/json5/lib/register.js
          new file mode 100644
          index 00000000000000..935cdbafb323ac
          --- /dev/null
          +++ b/tools/node_modules/@babel/core/node_modules/json5/lib/register.js
          @@ -0,0 +1,13 @@
          +const fs = require('fs')
          +const JSON5 = require('./')
          +
          +// eslint-disable-next-line node/no-deprecated-api
          +require.extensions['.json5'] = function (module, filename) {
          +    const content = fs.readFileSync(filename, 'utf8')
          +    try {
          +        module.exports = JSON5.parse(content)
          +    } catch (err) {
          +        err.message = filename + ': ' + err.message
          +        throw err
          +    }
          +}
          diff --git a/tools/node_modules/@babel/core/node_modules/json5/lib/require.js b/tools/node_modules/@babel/core/node_modules/json5/lib/require.js
          new file mode 100644
          index 00000000000000..3aa29bee0344ef
          --- /dev/null
          +++ b/tools/node_modules/@babel/core/node_modules/json5/lib/require.js
          @@ -0,0 +1,4 @@
          +// This file is for backward compatibility with v0.5.1.
          +require('./register')
          +
          +console.warn("'json5/require' is deprecated. Please use 'json5/register' instead.")
          diff --git a/tools/node_modules/@babel/core/node_modules/json5/lib/stringify.js b/tools/node_modules/@babel/core/node_modules/json5/lib/stringify.js
          new file mode 100644
          index 00000000000000..7cb3b0e101840b
          --- /dev/null
          +++ b/tools/node_modules/@babel/core/node_modules/json5/lib/stringify.js
          @@ -0,0 +1,261 @@
          +const util = require('./util')
          +
          +module.exports = function stringify (value, replacer, space) {
          +    const stack = []
          +    let indent = ''
          +    let propertyList
          +    let replacerFunc
          +    let gap = ''
          +    let quote
          +
          +    if (
          +        replacer != null &&
          +        typeof replacer === 'object' &&
          +        !Array.isArray(replacer)
          +    ) {
          +        space = replacer.space
          +        quote = replacer.quote
          +        replacer = replacer.replacer
          +    }
          +
          +    if (typeof replacer === 'function') {
          +        replacerFunc = replacer
          +    } else if (Array.isArray(replacer)) {
          +        propertyList = []
          +        for (const v of replacer) {
          +            let item
          +
          +            if (typeof v === 'string') {
          +                item = v
          +            } else if (
          +                typeof v === 'number' ||
          +                v instanceof String ||
          +                v instanceof Number
          +            ) {
          +                item = String(v)
          +            }
          +
          +            if (item !== undefined && propertyList.indexOf(item) < 0) {
          +                propertyList.push(item)
          +            }
          +        }
          +    }
          +
          +    if (space instanceof Number) {
          +        space = Number(space)
          +    } else if (space instanceof String) {
          +        space = String(space)
          +    }
          +
          +    if (typeof space === 'number') {
          +        if (space > 0) {
          +            space = Math.min(10, Math.floor(space))
          +            gap = '          '.substr(0, space)
          +        }
          +    } else if (typeof space === 'string') {
          +        gap = space.substr(0, 10)
          +    }
          +
          +    return serializeProperty('', {'': value})
          +
          +    function serializeProperty (key, holder) {
          +        let value = holder[key]
          +        if (value != null) {
          +            if (typeof value.toJSON5 === 'function') {
          +                value = value.toJSON5(key)
          +            } else if (typeof value.toJSON === 'function') {
          +                value = value.toJSON(key)
          +            }
          +        }
          +
          +        if (replacerFunc) {
          +            value = replacerFunc.call(holder, key, value)
          +        }
          +
          +        if (value instanceof Number) {
          +            value = Number(value)
          +        } else if (value instanceof String) {
          +            value = String(value)
          +        } else if (value instanceof Boolean) {
          +            value = value.valueOf()
          +        }
          +
          +        switch (value) {
          +        case null: return 'null'
          +        case true: return 'true'
          +        case false: return 'false'
          +        }
          +
          +        if (typeof value === 'string') {
          +            return quoteString(value, false)
          +        }
          +
          +        if (typeof value === 'number') {
          +            return String(value)
          +        }
          +
          +        if (typeof value === 'object') {
          +            return Array.isArray(value) ? serializeArray(value) : serializeObject(value)
          +        }
          +
          +        return undefined
          +    }
          +
          +    function quoteString (value) {
          +        const quotes = {
          +            "'": 0.1,
          +            '"': 0.2,
          +        }
          +
          +        const replacements = {
          +            "'": "\\'",
          +            '"': '\\"',
          +            '\\': '\\\\',
          +            '\b': '\\b',
          +            '\f': '\\f',
          +            '\n': '\\n',
          +            '\r': '\\r',
          +            '\t': '\\t',
          +            '\v': '\\v',
          +            '\0': '\\0',
          +            '\u2028': '\\u2028',
          +            '\u2029': '\\u2029',
          +        }
          +
          +        let product = ''
          +
          +        for (let i = 0; i < value.length; i++) {
          +            const c = value[i]
          +            switch (c) {
          +            case "'":
          +            case '"':
          +                quotes[c]++
          +                product += c
          +                continue
          +
          +            case '\0':
          +                if (util.isDigit(value[i + 1])) {
          +                    product += '\\x00'
          +                    continue
          +                }
          +            }
          +
          +            if (replacements[c]) {
          +                product += replacements[c]
          +                continue
          +            }
          +
          +            if (c < ' ') {
          +                let hexString = c.charCodeAt(0).toString(16)
          +                product += '\\x' + ('00' + hexString).substring(hexString.length)
          +                continue
          +            }
          +
          +            product += c
          +        }
          +
          +        const quoteChar = quote || Object.keys(quotes).reduce((a, b) => (quotes[a] < quotes[b]) ? a : b)
          +
          +        product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar])
          +
          +        return quoteChar + product + quoteChar
          +    }
          +
          +    function serializeObject (value) {
          +        if (stack.indexOf(value) >= 0) {
          +            throw TypeError('Converting circular structure to JSON5')
          +        }
          +
          +        stack.push(value)
          +
          +        let stepback = indent
          +        indent = indent + gap
          +
          +        let keys = propertyList || Object.keys(value)
          +        let partial = []
          +        for (const key of keys) {
          +            const propertyString = serializeProperty(key, value)
          +            if (propertyString !== undefined) {
          +                let member = serializeKey(key) + ':'
          +                if (gap !== '') {
          +                    member += ' '
          +                }
          +                member += propertyString
          +                partial.push(member)
          +            }
          +        }
          +
          +        let final
          +        if (partial.length === 0) {
          +            final = '{}'
          +        } else {
          +            let properties
          +            if (gap === '') {
          +                properties = partial.join(',')
          +                final = '{' + properties + '}'
          +            } else {
          +                let separator = ',\n' + indent
          +                properties = partial.join(separator)
          +                final = '{\n' + indent + properties + ',\n' + stepback + '}'
          +            }
          +        }
          +
          +        stack.pop()
          +        indent = stepback
          +        return final
          +    }
          +
          +    function serializeKey (key) {
          +        if (key.length === 0) {
          +            return quoteString(key, true)
          +        }
          +
          +        const firstChar = String.fromCodePoint(key.codePointAt(0))
          +        if (!util.isIdStartChar(firstChar)) {
          +            return quoteString(key, true)
          +        }
          +
          +        for (let i = firstChar.length; i < key.length; i++) {
          +            if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
          +                return quoteString(key, true)
          +            }
          +        }
          +
          +        return key
          +    }
          +
          +    function serializeArray (value) {
          +        if (stack.indexOf(value) >= 0) {
          +            throw TypeError('Converting circular structure to JSON5')
          +        }
          +
          +        stack.push(value)
          +
          +        let stepback = indent
          +        indent = indent + gap
          +
          +        let partial = []
          +        for (let i = 0; i < value.length; i++) {
          +            const propertyString = serializeProperty(String(i), value)
          +            partial.push((propertyString !== undefined) ? propertyString : 'null')
          +        }
          +
          +        let final
          +        if (partial.length === 0) {
          +            final = '[]'
          +        } else {
          +            if (gap === '') {
          +                let properties = partial.join(',')
          +                final = '[' + properties + ']'
          +            } else {
          +                let separator = ',\n' + indent
          +                let properties = partial.join(separator)
          +                final = '[\n' + indent + properties + ',\n' + stepback + ']'
          +            }
          +        }
          +
          +        stack.pop()
          +        indent = stepback
          +        return final
          +    }
          +}
          diff --git a/tools/node_modules/@babel/core/node_modules/json5/lib/unicode.js b/tools/node_modules/@babel/core/node_modules/json5/lib/unicode.js
          new file mode 100644
          index 00000000000000..215ccd843abc25
          --- /dev/null
          +++ b/tools/node_modules/@babel/core/node_modules/json5/lib/unicode.js
          @@ -0,0 +1,4 @@
          +// This is a generated file. Do not edit.
          +module.exports.Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/
          +module.exports.ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/
          +module.exports.ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
          diff --git a/tools/node_modules/@babel/core/node_modules/json5/lib/util.js b/tools/node_modules/@babel/core/node_modules/json5/lib/util.js
          new file mode 100644
          index 00000000000000..40bfe2fa6a67b2
          --- /dev/null
          +++ b/tools/node_modules/@babel/core/node_modules/json5/lib/util.js
          @@ -0,0 +1,35 @@
          +const unicode = require('../lib/unicode')
          +
          +module.exports = {
          +    isSpaceSeparator (c) {
          +        return typeof c === 'string' && unicode.Space_Separator.test(c)
          +    },
          +
          +    isIdStartChar (c) {
          +        return typeof c === 'string' && (
          +            (c >= 'a' && c <= 'z') ||
          +        (c >= 'A' && c <= 'Z') ||
          +        (c === '$') || (c === '_') ||
          +        unicode.ID_Start.test(c)
          +        )
          +    },
          +
          +    isIdContinueChar (c) {
          +        return typeof c === 'string' && (
          +            (c >= 'a' && c <= 'z') ||
          +        (c >= 'A' && c <= 'Z') ||
          +        (c >= '0' && c <= '9') ||
          +        (c === '$') || (c === '_') ||
          +        (c === '\u200C') || (c === '\u200D') ||
          +        unicode.ID_Continue.test(c)
          +        )
          +    },
          +
          +    isDigit (c) {
          +        return typeof c === 'string' && /[0-9]/.test(c)
          +    },
          +
          +    isHexDigit (c) {
          +        return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
          +    },
          +}
          diff --git a/tools/node_modules/@babel/core/node_modules/json5/package.json b/tools/node_modules/@babel/core/node_modules/json5/package.json
          new file mode 100644
          index 00000000000000..9c5b82eae818e0
          --- /dev/null
          +++ b/tools/node_modules/@babel/core/node_modules/json5/package.json
          @@ -0,0 +1,71 @@
          +{
          +  "name": "json5",
          +  "version": "2.1.3",
          +  "description": "JSON for humans.",
          +  "main": "lib/index.js",
          +  "module": "dist/index.mjs",
          +  "bin": "lib/cli.js",
          +  "browser": "dist/index.js",
          +  "files": [
          +    "lib/",
          +    "dist/"
          +  ],
          +  "engines": {
          +    "node": ">=6"
          +  },
          +  "scripts": {
          +    "build": "rollup -c",
          +    "build-package": "node build/package.js",
          +    "build-unicode": "node build/unicode.js",
          +    "coverage": "tap --coverage-report html test",
          +    "lint": "eslint --fix .",
          +    "prepublishOnly": "npm run production",
          +    "preversion": "npm run production",
          +    "production": "npm run lint && npm test && npm run build",
          +    "test": "tap -Rspec --100 test",
          +    "version": "npm run build-package && git add package.json5"
          +  },
          +  "repository": {
          +    "type": "git",
          +    "url": "git+https://github.com/json5/json5.git"
          +  },
          +  "keywords": [
          +    "json",
          +    "json5",
          +    "es5",
          +    "es2015",
          +    "ecmascript"
          +  ],
          +  "author": "Aseem Kishore ",
          +  "contributors": [
          +    "Max Nanasy ",
          +    "Andrew Eisenberg ",
          +    "Jordan Tucker "
          +  ],
          +  "license": "MIT",
          +  "bugs": {
          +    "url": "https://github.com/json5/json5/issues"
          +  },
          +  "homepage": "http://json5.org/",
          +  "dependencies": {
          +    "minimist": "^1.2.5"
          +  },
          +  "devDependencies": {
          +    "core-js": "^2.6.5",
          +    "eslint": "^5.15.3",
          +    "eslint-config-standard": "^12.0.0",
          +    "eslint-plugin-import": "^2.16.0",
          +    "eslint-plugin-node": "^8.0.1",
          +    "eslint-plugin-promise": "^4.0.1",
          +    "eslint-plugin-standard": "^4.0.0",
          +    "regenerate": "^1.4.0",
          +    "rollup": "^0.64.1",
          +    "rollup-plugin-buble": "^0.19.6",
          +    "rollup-plugin-commonjs": "^9.2.1",
          +    "rollup-plugin-node-resolve": "^3.4.0",
          +    "rollup-plugin-terser": "^1.0.1",
          +    "sinon": "^6.3.5",
          +    "tap": "^12.6.0",
          +    "unicode-10.0.0": "^0.7.5"
          +  }
          +}
          diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/LICENSE b/tools/node_modules/@babel/core/node_modules/lodash/LICENSE
          similarity index 100%
          rename from tools/node_modules/babel-eslint/node_modules/lodash/LICENSE
          rename to tools/node_modules/@babel/core/node_modules/lodash/LICENSE
          diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/README.md b/tools/node_modules/@babel/core/node_modules/lodash/README.md
          similarity index 95%
          rename from tools/node_modules/babel-eslint/node_modules/lodash/README.md
          rename to tools/node_modules/@babel/core/node_modules/lodash/README.md
          index 292832fef2ff16..e1c99503300407 100644
          --- a/tools/node_modules/babel-eslint/node_modules/lodash/README.md
          +++ b/tools/node_modules/@babel/core/node_modules/lodash/README.md
          @@ -1,4 +1,4 @@
          -# lodash v4.17.15
          +# lodash v4.17.20
           
           The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules.
           
          @@ -28,7 +28,7 @@ var at = require('lodash/at');
           var curryN = require('lodash/fp/curryN');
           ```
           
          -See the [package source](https://github.com/lodash/lodash/tree/4.17.15-npm) for more details.
          +See the [package source](https://github.com/lodash/lodash/tree/4.17.20-npm) for more details.
           
           **Note:**
          Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL. diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_DataView.js b/tools/node_modules/@babel/core/node_modules/lodash/_DataView.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_DataView.js rename to tools/node_modules/@babel/core/node_modules/lodash/_DataView.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_Hash.js b/tools/node_modules/@babel/core/node_modules/lodash/_Hash.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_Hash.js rename to tools/node_modules/@babel/core/node_modules/lodash/_Hash.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_LazyWrapper.js b/tools/node_modules/@babel/core/node_modules/lodash/_LazyWrapper.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_LazyWrapper.js rename to tools/node_modules/@babel/core/node_modules/lodash/_LazyWrapper.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_ListCache.js b/tools/node_modules/@babel/core/node_modules/lodash/_ListCache.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_ListCache.js rename to tools/node_modules/@babel/core/node_modules/lodash/_ListCache.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_LodashWrapper.js b/tools/node_modules/@babel/core/node_modules/lodash/_LodashWrapper.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_LodashWrapper.js rename to tools/node_modules/@babel/core/node_modules/lodash/_LodashWrapper.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_Map.js b/tools/node_modules/@babel/core/node_modules/lodash/_Map.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_Map.js rename to tools/node_modules/@babel/core/node_modules/lodash/_Map.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_MapCache.js b/tools/node_modules/@babel/core/node_modules/lodash/_MapCache.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_MapCache.js rename to tools/node_modules/@babel/core/node_modules/lodash/_MapCache.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_Promise.js b/tools/node_modules/@babel/core/node_modules/lodash/_Promise.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_Promise.js rename to tools/node_modules/@babel/core/node_modules/lodash/_Promise.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_Set.js b/tools/node_modules/@babel/core/node_modules/lodash/_Set.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_Set.js rename to tools/node_modules/@babel/core/node_modules/lodash/_Set.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_SetCache.js b/tools/node_modules/@babel/core/node_modules/lodash/_SetCache.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_SetCache.js rename to tools/node_modules/@babel/core/node_modules/lodash/_SetCache.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_Stack.js b/tools/node_modules/@babel/core/node_modules/lodash/_Stack.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_Stack.js rename to tools/node_modules/@babel/core/node_modules/lodash/_Stack.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_Symbol.js b/tools/node_modules/@babel/core/node_modules/lodash/_Symbol.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_Symbol.js rename to tools/node_modules/@babel/core/node_modules/lodash/_Symbol.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_Uint8Array.js b/tools/node_modules/@babel/core/node_modules/lodash/_Uint8Array.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_Uint8Array.js rename to tools/node_modules/@babel/core/node_modules/lodash/_Uint8Array.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_WeakMap.js b/tools/node_modules/@babel/core/node_modules/lodash/_WeakMap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_WeakMap.js rename to tools/node_modules/@babel/core/node_modules/lodash/_WeakMap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_apply.js b/tools/node_modules/@babel/core/node_modules/lodash/_apply.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_apply.js rename to tools/node_modules/@babel/core/node_modules/lodash/_apply.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_arrayAggregator.js b/tools/node_modules/@babel/core/node_modules/lodash/_arrayAggregator.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_arrayAggregator.js rename to tools/node_modules/@babel/core/node_modules/lodash/_arrayAggregator.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_arrayEach.js b/tools/node_modules/@babel/core/node_modules/lodash/_arrayEach.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_arrayEach.js rename to tools/node_modules/@babel/core/node_modules/lodash/_arrayEach.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_arrayEachRight.js b/tools/node_modules/@babel/core/node_modules/lodash/_arrayEachRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_arrayEachRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/_arrayEachRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_arrayEvery.js b/tools/node_modules/@babel/core/node_modules/lodash/_arrayEvery.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_arrayEvery.js rename to tools/node_modules/@babel/core/node_modules/lodash/_arrayEvery.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_arrayFilter.js b/tools/node_modules/@babel/core/node_modules/lodash/_arrayFilter.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_arrayFilter.js rename to tools/node_modules/@babel/core/node_modules/lodash/_arrayFilter.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_arrayIncludes.js b/tools/node_modules/@babel/core/node_modules/lodash/_arrayIncludes.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_arrayIncludes.js rename to tools/node_modules/@babel/core/node_modules/lodash/_arrayIncludes.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_arrayIncludesWith.js b/tools/node_modules/@babel/core/node_modules/lodash/_arrayIncludesWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_arrayIncludesWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/_arrayIncludesWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_arrayLikeKeys.js b/tools/node_modules/@babel/core/node_modules/lodash/_arrayLikeKeys.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_arrayLikeKeys.js rename to tools/node_modules/@babel/core/node_modules/lodash/_arrayLikeKeys.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_arrayMap.js b/tools/node_modules/@babel/core/node_modules/lodash/_arrayMap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_arrayMap.js rename to tools/node_modules/@babel/core/node_modules/lodash/_arrayMap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_arrayPush.js b/tools/node_modules/@babel/core/node_modules/lodash/_arrayPush.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_arrayPush.js rename to tools/node_modules/@babel/core/node_modules/lodash/_arrayPush.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_arrayReduce.js b/tools/node_modules/@babel/core/node_modules/lodash/_arrayReduce.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_arrayReduce.js rename to tools/node_modules/@babel/core/node_modules/lodash/_arrayReduce.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_arrayReduceRight.js b/tools/node_modules/@babel/core/node_modules/lodash/_arrayReduceRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_arrayReduceRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/_arrayReduceRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_arraySample.js b/tools/node_modules/@babel/core/node_modules/lodash/_arraySample.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_arraySample.js rename to tools/node_modules/@babel/core/node_modules/lodash/_arraySample.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_arraySampleSize.js b/tools/node_modules/@babel/core/node_modules/lodash/_arraySampleSize.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_arraySampleSize.js rename to tools/node_modules/@babel/core/node_modules/lodash/_arraySampleSize.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_arrayShuffle.js b/tools/node_modules/@babel/core/node_modules/lodash/_arrayShuffle.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_arrayShuffle.js rename to tools/node_modules/@babel/core/node_modules/lodash/_arrayShuffle.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_arraySome.js b/tools/node_modules/@babel/core/node_modules/lodash/_arraySome.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_arraySome.js rename to tools/node_modules/@babel/core/node_modules/lodash/_arraySome.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_asciiSize.js b/tools/node_modules/@babel/core/node_modules/lodash/_asciiSize.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_asciiSize.js rename to tools/node_modules/@babel/core/node_modules/lodash/_asciiSize.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_asciiToArray.js b/tools/node_modules/@babel/core/node_modules/lodash/_asciiToArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_asciiToArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/_asciiToArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_asciiWords.js b/tools/node_modules/@babel/core/node_modules/lodash/_asciiWords.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_asciiWords.js rename to tools/node_modules/@babel/core/node_modules/lodash/_asciiWords.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_assignMergeValue.js b/tools/node_modules/@babel/core/node_modules/lodash/_assignMergeValue.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_assignMergeValue.js rename to tools/node_modules/@babel/core/node_modules/lodash/_assignMergeValue.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_assignValue.js b/tools/node_modules/@babel/core/node_modules/lodash/_assignValue.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_assignValue.js rename to tools/node_modules/@babel/core/node_modules/lodash/_assignValue.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_assocIndexOf.js b/tools/node_modules/@babel/core/node_modules/lodash/_assocIndexOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_assocIndexOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/_assocIndexOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseAggregator.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseAggregator.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseAggregator.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseAggregator.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseAssign.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseAssign.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseAssign.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseAssign.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseAssignIn.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseAssignIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseAssignIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseAssignIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseAssignValue.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseAssignValue.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseAssignValue.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseAssignValue.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseAt.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseAt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseAt.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseAt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseClamp.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseClamp.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseClamp.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseClamp.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseClone.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseClone.js similarity index 98% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseClone.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseClone.js index 290de9275def00..69f87054c56611 100644 --- a/tools/node_modules/babel-eslint/node_modules/lodash/_baseClone.js +++ b/tools/node_modules/@babel/core/node_modules/lodash/_baseClone.js @@ -18,7 +18,8 @@ var Stack = require('./_Stack'), isMap = require('./isMap'), isObject = require('./isObject'), isSet = require('./isSet'), - keys = require('./keys'); + keys = require('./keys'), + keysIn = require('./keysIn'); /** Used to compose bitmasks for cloning. */ var CLONE_DEEP_FLAG = 1, diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseConforms.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseConforms.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseConforms.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseConforms.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseConformsTo.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseConformsTo.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseConformsTo.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseConformsTo.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseCreate.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseCreate.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseCreate.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseCreate.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseDelay.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseDelay.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseDelay.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseDelay.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseDifference.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseDifference.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseDifference.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseDifference.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseEach.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseEach.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseEach.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseEach.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseEachRight.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseEachRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseEachRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseEachRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseEvery.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseEvery.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseEvery.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseEvery.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseExtremum.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseExtremum.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseExtremum.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseExtremum.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseFill.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseFill.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseFill.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseFill.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseFilter.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseFilter.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseFilter.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseFilter.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseFindIndex.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseFindIndex.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseFindIndex.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseFindIndex.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseFindKey.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseFindKey.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseFindKey.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseFindKey.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseFlatten.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseFlatten.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseFlatten.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseFlatten.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseFor.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseFor.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseFor.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseFor.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseForOwn.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseForOwn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseForOwn.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseForOwn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseForOwnRight.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseForOwnRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseForOwnRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseForOwnRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseForRight.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseForRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseForRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseForRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseFunctions.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseFunctions.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseFunctions.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseFunctions.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseGet.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseGet.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseGet.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseGet.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseGetAllKeys.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseGetAllKeys.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseGetAllKeys.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseGetAllKeys.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseGetTag.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseGetTag.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseGetTag.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseGetTag.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseGt.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseGt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseGt.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseGt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseHas.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseHas.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseHas.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseHas.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseHasIn.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseHasIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseHasIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseHasIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseInRange.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseInRange.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseInRange.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseInRange.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseIndexOf.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseIndexOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseIndexOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseIndexOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseIndexOfWith.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseIndexOfWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseIndexOfWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseIndexOfWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseIntersection.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseIntersection.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseIntersection.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseIntersection.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseInverter.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseInverter.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseInverter.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseInverter.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseInvoke.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseInvoke.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseInvoke.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseInvoke.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseIsArguments.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseIsArguments.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseIsArguments.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseIsArguments.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseIsArrayBuffer.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseIsArrayBuffer.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseIsArrayBuffer.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseIsArrayBuffer.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseIsDate.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseIsDate.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseIsDate.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseIsDate.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseIsEqual.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseIsEqual.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseIsEqual.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseIsEqual.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseIsEqualDeep.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseIsEqualDeep.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseIsEqualDeep.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseIsEqualDeep.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseIsMap.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseIsMap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseIsMap.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseIsMap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseIsMatch.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseIsMatch.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseIsMatch.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseIsMatch.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseIsNaN.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseIsNaN.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseIsNaN.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseIsNaN.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseIsNative.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseIsNative.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseIsNative.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseIsNative.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseIsRegExp.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseIsRegExp.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseIsRegExp.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseIsRegExp.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseIsSet.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseIsSet.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseIsSet.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseIsSet.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseIsTypedArray.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseIsTypedArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseIsTypedArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseIsTypedArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseIteratee.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseIteratee.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseIteratee.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseIteratee.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseKeys.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseKeys.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseKeys.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseKeys.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseKeysIn.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseKeysIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseKeysIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseKeysIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseLodash.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseLodash.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseLodash.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseLodash.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseLt.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseLt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseLt.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseLt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseMap.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseMap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseMap.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseMap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseMatches.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseMatches.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseMatches.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseMatches.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseMatchesProperty.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseMatchesProperty.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseMatchesProperty.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseMatchesProperty.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseMean.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseMean.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseMean.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseMean.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseMerge.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseMerge.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseMerge.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseMerge.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseMergeDeep.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseMergeDeep.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseMergeDeep.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseMergeDeep.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseNth.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseNth.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseNth.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseNth.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseOrderBy.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseOrderBy.js similarity index 68% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseOrderBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseOrderBy.js index d8a46ab20a2c5d..775a01741ede20 100644 --- a/tools/node_modules/babel-eslint/node_modules/lodash/_baseOrderBy.js +++ b/tools/node_modules/@babel/core/node_modules/lodash/_baseOrderBy.js @@ -1,10 +1,12 @@ var arrayMap = require('./_arrayMap'), + baseGet = require('./_baseGet'), baseIteratee = require('./_baseIteratee'), baseMap = require('./_baseMap'), baseSortBy = require('./_baseSortBy'), baseUnary = require('./_baseUnary'), compareMultiple = require('./_compareMultiple'), - identity = require('./identity'); + identity = require('./identity'), + isArray = require('./isArray'); /** * The base implementation of `_.orderBy` without param guards. @@ -16,8 +18,21 @@ var arrayMap = require('./_arrayMap'), * @returns {Array} Returns the new sorted array. */ function baseOrderBy(collection, iteratees, orders) { + if (iteratees.length) { + iteratees = arrayMap(iteratees, function(iteratee) { + if (isArray(iteratee)) { + return function(value) { + return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); + } + } + return iteratee; + }); + } else { + iteratees = [identity]; + } + var index = -1; - iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee)); + iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); var result = baseMap(collection, function(value, key, collection) { var criteria = arrayMap(iteratees, function(iteratee) { diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_basePick.js b/tools/node_modules/@babel/core/node_modules/lodash/_basePick.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_basePick.js rename to tools/node_modules/@babel/core/node_modules/lodash/_basePick.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_basePickBy.js b/tools/node_modules/@babel/core/node_modules/lodash/_basePickBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_basePickBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/_basePickBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseProperty.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseProperty.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseProperty.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseProperty.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_basePropertyDeep.js b/tools/node_modules/@babel/core/node_modules/lodash/_basePropertyDeep.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_basePropertyDeep.js rename to tools/node_modules/@babel/core/node_modules/lodash/_basePropertyDeep.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_basePropertyOf.js b/tools/node_modules/@babel/core/node_modules/lodash/_basePropertyOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_basePropertyOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/_basePropertyOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_basePullAll.js b/tools/node_modules/@babel/core/node_modules/lodash/_basePullAll.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_basePullAll.js rename to tools/node_modules/@babel/core/node_modules/lodash/_basePullAll.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_basePullAt.js b/tools/node_modules/@babel/core/node_modules/lodash/_basePullAt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_basePullAt.js rename to tools/node_modules/@babel/core/node_modules/lodash/_basePullAt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseRandom.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseRandom.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseRandom.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseRandom.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseRange.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseRange.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseRange.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseRange.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseReduce.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseReduce.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseReduce.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseReduce.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseRepeat.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseRepeat.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseRepeat.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseRepeat.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseRest.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseRest.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseRest.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseRest.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseSample.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseSample.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseSample.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseSample.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseSampleSize.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseSampleSize.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseSampleSize.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseSampleSize.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseSet.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseSet.js similarity index 92% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseSet.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseSet.js index 612a24cc85791f..99f4fbf9c347a7 100644 --- a/tools/node_modules/babel-eslint/node_modules/lodash/_baseSet.js +++ b/tools/node_modules/@babel/core/node_modules/lodash/_baseSet.js @@ -29,6 +29,10 @@ function baseSet(object, path, value, customizer) { var key = toKey(path[index]), newValue = value; + if (key === '__proto__' || key === 'constructor' || key === 'prototype') { + return object; + } + if (index != lastIndex) { var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined; diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseSetData.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseSetData.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseSetData.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseSetData.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseSetToString.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseSetToString.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseSetToString.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseSetToString.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseShuffle.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseShuffle.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseShuffle.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseShuffle.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseSlice.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseSlice.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseSlice.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseSlice.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseSome.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseSome.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseSome.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseSome.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseSortBy.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseSortBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseSortBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseSortBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseSortedIndex.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseSortedIndex.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseSortedIndex.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseSortedIndex.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseSortedIndexBy.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseSortedIndexBy.js similarity index 94% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseSortedIndexBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseSortedIndexBy.js index bb22e36dcdf620..c247b377ff5b1a 100644 --- a/tools/node_modules/babel-eslint/node_modules/lodash/_baseSortedIndexBy.js +++ b/tools/node_modules/@babel/core/node_modules/lodash/_baseSortedIndexBy.js @@ -22,11 +22,14 @@ var nativeFloor = Math.floor, * into `array`. */ function baseSortedIndexBy(array, value, iteratee, retHighest) { - value = iteratee(value); - var low = 0, - high = array == null ? 0 : array.length, - valIsNaN = value !== value, + high = array == null ? 0 : array.length; + if (high === 0) { + return 0; + } + + value = iteratee(value); + var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined; diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseSortedUniq.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseSortedUniq.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseSortedUniq.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseSortedUniq.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseSum.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseSum.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseSum.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseSum.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseTimes.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseTimes.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseTimes.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseTimes.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseToNumber.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseToNumber.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseToNumber.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseToNumber.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseToPairs.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseToPairs.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseToPairs.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseToPairs.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseToString.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseToString.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseToString.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseToString.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseUnary.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseUnary.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseUnary.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseUnary.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseUniq.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseUniq.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseUniq.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseUniq.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseUnset.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseUnset.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseUnset.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseUnset.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseUpdate.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseUpdate.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseUpdate.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseUpdate.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseValues.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseValues.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseValues.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseValues.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseWhile.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseWhile.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseWhile.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseWhile.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseWrapperValue.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseWrapperValue.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseWrapperValue.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseWrapperValue.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseXor.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseXor.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseXor.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseXor.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_baseZipObject.js b/tools/node_modules/@babel/core/node_modules/lodash/_baseZipObject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_baseZipObject.js rename to tools/node_modules/@babel/core/node_modules/lodash/_baseZipObject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_cacheHas.js b/tools/node_modules/@babel/core/node_modules/lodash/_cacheHas.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_cacheHas.js rename to tools/node_modules/@babel/core/node_modules/lodash/_cacheHas.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_castArrayLikeObject.js b/tools/node_modules/@babel/core/node_modules/lodash/_castArrayLikeObject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_castArrayLikeObject.js rename to tools/node_modules/@babel/core/node_modules/lodash/_castArrayLikeObject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_castFunction.js b/tools/node_modules/@babel/core/node_modules/lodash/_castFunction.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_castFunction.js rename to tools/node_modules/@babel/core/node_modules/lodash/_castFunction.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_castPath.js b/tools/node_modules/@babel/core/node_modules/lodash/_castPath.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_castPath.js rename to tools/node_modules/@babel/core/node_modules/lodash/_castPath.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_castRest.js b/tools/node_modules/@babel/core/node_modules/lodash/_castRest.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_castRest.js rename to tools/node_modules/@babel/core/node_modules/lodash/_castRest.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_castSlice.js b/tools/node_modules/@babel/core/node_modules/lodash/_castSlice.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_castSlice.js rename to tools/node_modules/@babel/core/node_modules/lodash/_castSlice.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_charsEndIndex.js b/tools/node_modules/@babel/core/node_modules/lodash/_charsEndIndex.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_charsEndIndex.js rename to tools/node_modules/@babel/core/node_modules/lodash/_charsEndIndex.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_charsStartIndex.js b/tools/node_modules/@babel/core/node_modules/lodash/_charsStartIndex.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_charsStartIndex.js rename to tools/node_modules/@babel/core/node_modules/lodash/_charsStartIndex.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_cloneArrayBuffer.js b/tools/node_modules/@babel/core/node_modules/lodash/_cloneArrayBuffer.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_cloneArrayBuffer.js rename to tools/node_modules/@babel/core/node_modules/lodash/_cloneArrayBuffer.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_cloneBuffer.js b/tools/node_modules/@babel/core/node_modules/lodash/_cloneBuffer.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_cloneBuffer.js rename to tools/node_modules/@babel/core/node_modules/lodash/_cloneBuffer.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_cloneDataView.js b/tools/node_modules/@babel/core/node_modules/lodash/_cloneDataView.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_cloneDataView.js rename to tools/node_modules/@babel/core/node_modules/lodash/_cloneDataView.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_cloneRegExp.js b/tools/node_modules/@babel/core/node_modules/lodash/_cloneRegExp.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_cloneRegExp.js rename to tools/node_modules/@babel/core/node_modules/lodash/_cloneRegExp.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_cloneSymbol.js b/tools/node_modules/@babel/core/node_modules/lodash/_cloneSymbol.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_cloneSymbol.js rename to tools/node_modules/@babel/core/node_modules/lodash/_cloneSymbol.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_cloneTypedArray.js b/tools/node_modules/@babel/core/node_modules/lodash/_cloneTypedArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_cloneTypedArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/_cloneTypedArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_compareAscending.js b/tools/node_modules/@babel/core/node_modules/lodash/_compareAscending.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_compareAscending.js rename to tools/node_modules/@babel/core/node_modules/lodash/_compareAscending.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_compareMultiple.js b/tools/node_modules/@babel/core/node_modules/lodash/_compareMultiple.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_compareMultiple.js rename to tools/node_modules/@babel/core/node_modules/lodash/_compareMultiple.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_composeArgs.js b/tools/node_modules/@babel/core/node_modules/lodash/_composeArgs.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_composeArgs.js rename to tools/node_modules/@babel/core/node_modules/lodash/_composeArgs.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_composeArgsRight.js b/tools/node_modules/@babel/core/node_modules/lodash/_composeArgsRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_composeArgsRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/_composeArgsRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_copyArray.js b/tools/node_modules/@babel/core/node_modules/lodash/_copyArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_copyArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/_copyArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_copyObject.js b/tools/node_modules/@babel/core/node_modules/lodash/_copyObject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_copyObject.js rename to tools/node_modules/@babel/core/node_modules/lodash/_copyObject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_copySymbols.js b/tools/node_modules/@babel/core/node_modules/lodash/_copySymbols.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_copySymbols.js rename to tools/node_modules/@babel/core/node_modules/lodash/_copySymbols.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_copySymbolsIn.js b/tools/node_modules/@babel/core/node_modules/lodash/_copySymbolsIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_copySymbolsIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/_copySymbolsIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_coreJsData.js b/tools/node_modules/@babel/core/node_modules/lodash/_coreJsData.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_coreJsData.js rename to tools/node_modules/@babel/core/node_modules/lodash/_coreJsData.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_countHolders.js b/tools/node_modules/@babel/core/node_modules/lodash/_countHolders.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_countHolders.js rename to tools/node_modules/@babel/core/node_modules/lodash/_countHolders.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createAggregator.js b/tools/node_modules/@babel/core/node_modules/lodash/_createAggregator.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createAggregator.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createAggregator.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createAssigner.js b/tools/node_modules/@babel/core/node_modules/lodash/_createAssigner.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createAssigner.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createAssigner.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createBaseEach.js b/tools/node_modules/@babel/core/node_modules/lodash/_createBaseEach.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createBaseEach.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createBaseEach.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createBaseFor.js b/tools/node_modules/@babel/core/node_modules/lodash/_createBaseFor.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createBaseFor.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createBaseFor.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createBind.js b/tools/node_modules/@babel/core/node_modules/lodash/_createBind.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createBind.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createBind.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createCaseFirst.js b/tools/node_modules/@babel/core/node_modules/lodash/_createCaseFirst.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createCaseFirst.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createCaseFirst.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createCompounder.js b/tools/node_modules/@babel/core/node_modules/lodash/_createCompounder.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createCompounder.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createCompounder.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createCtor.js b/tools/node_modules/@babel/core/node_modules/lodash/_createCtor.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createCtor.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createCtor.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createCurry.js b/tools/node_modules/@babel/core/node_modules/lodash/_createCurry.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createCurry.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createCurry.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createFind.js b/tools/node_modules/@babel/core/node_modules/lodash/_createFind.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createFind.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createFind.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createFlow.js b/tools/node_modules/@babel/core/node_modules/lodash/_createFlow.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createFlow.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createFlow.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createHybrid.js b/tools/node_modules/@babel/core/node_modules/lodash/_createHybrid.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createHybrid.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createHybrid.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createInverter.js b/tools/node_modules/@babel/core/node_modules/lodash/_createInverter.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createInverter.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createInverter.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createMathOperation.js b/tools/node_modules/@babel/core/node_modules/lodash/_createMathOperation.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createMathOperation.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createMathOperation.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createOver.js b/tools/node_modules/@babel/core/node_modules/lodash/_createOver.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createOver.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createOver.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createPadding.js b/tools/node_modules/@babel/core/node_modules/lodash/_createPadding.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createPadding.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createPadding.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createPartial.js b/tools/node_modules/@babel/core/node_modules/lodash/_createPartial.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createPartial.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createPartial.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createRange.js b/tools/node_modules/@babel/core/node_modules/lodash/_createRange.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createRange.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createRange.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createRecurry.js b/tools/node_modules/@babel/core/node_modules/lodash/_createRecurry.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createRecurry.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createRecurry.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createRelationalOperation.js b/tools/node_modules/@babel/core/node_modules/lodash/_createRelationalOperation.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createRelationalOperation.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createRelationalOperation.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createRound.js b/tools/node_modules/@babel/core/node_modules/lodash/_createRound.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createRound.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createRound.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createSet.js b/tools/node_modules/@babel/core/node_modules/lodash/_createSet.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createSet.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createSet.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createToPairs.js b/tools/node_modules/@babel/core/node_modules/lodash/_createToPairs.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createToPairs.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createToPairs.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_createWrap.js b/tools/node_modules/@babel/core/node_modules/lodash/_createWrap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_createWrap.js rename to tools/node_modules/@babel/core/node_modules/lodash/_createWrap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_customDefaultsAssignIn.js b/tools/node_modules/@babel/core/node_modules/lodash/_customDefaultsAssignIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_customDefaultsAssignIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/_customDefaultsAssignIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_customDefaultsMerge.js b/tools/node_modules/@babel/core/node_modules/lodash/_customDefaultsMerge.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_customDefaultsMerge.js rename to tools/node_modules/@babel/core/node_modules/lodash/_customDefaultsMerge.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_customOmitClone.js b/tools/node_modules/@babel/core/node_modules/lodash/_customOmitClone.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_customOmitClone.js rename to tools/node_modules/@babel/core/node_modules/lodash/_customOmitClone.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_deburrLetter.js b/tools/node_modules/@babel/core/node_modules/lodash/_deburrLetter.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_deburrLetter.js rename to tools/node_modules/@babel/core/node_modules/lodash/_deburrLetter.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_defineProperty.js b/tools/node_modules/@babel/core/node_modules/lodash/_defineProperty.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_defineProperty.js rename to tools/node_modules/@babel/core/node_modules/lodash/_defineProperty.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_equalArrays.js b/tools/node_modules/@babel/core/node_modules/lodash/_equalArrays.js similarity index 92% rename from tools/node_modules/babel-eslint/node_modules/lodash/_equalArrays.js rename to tools/node_modules/@babel/core/node_modules/lodash/_equalArrays.js index f6a3b7c9f27640..824228c78cb8ab 100644 --- a/tools/node_modules/babel-eslint/node_modules/lodash/_equalArrays.js +++ b/tools/node_modules/@babel/core/node_modules/lodash/_equalArrays.js @@ -27,10 +27,11 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } - // Assume cyclic values are equal. - var stacked = stack.get(array); - if (stacked && stack.get(other)) { - return stacked == other; + // Check that cyclic values are equal. + var arrStacked = stack.get(array); + var othStacked = stack.get(other); + if (arrStacked && othStacked) { + return arrStacked == other && othStacked == array; } var index = -1, result = true, diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_equalByTag.js b/tools/node_modules/@babel/core/node_modules/lodash/_equalByTag.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_equalByTag.js rename to tools/node_modules/@babel/core/node_modules/lodash/_equalByTag.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_equalObjects.js b/tools/node_modules/@babel/core/node_modules/lodash/_equalObjects.js similarity index 93% rename from tools/node_modules/babel-eslint/node_modules/lodash/_equalObjects.js rename to tools/node_modules/@babel/core/node_modules/lodash/_equalObjects.js index 17421f374c9986..cdaacd2dfd8895 100644 --- a/tools/node_modules/babel-eslint/node_modules/lodash/_equalObjects.js +++ b/tools/node_modules/@babel/core/node_modules/lodash/_equalObjects.js @@ -39,10 +39,11 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { return false; } } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked && stack.get(other)) { - return stacked == other; + // Check that cyclic values are equal. + var objStacked = stack.get(object); + var othStacked = stack.get(other); + if (objStacked && othStacked) { + return objStacked == other && othStacked == object; } var result = true; stack.set(object, other); diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_escapeHtmlChar.js b/tools/node_modules/@babel/core/node_modules/lodash/_escapeHtmlChar.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_escapeHtmlChar.js rename to tools/node_modules/@babel/core/node_modules/lodash/_escapeHtmlChar.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_escapeStringChar.js b/tools/node_modules/@babel/core/node_modules/lodash/_escapeStringChar.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_escapeStringChar.js rename to tools/node_modules/@babel/core/node_modules/lodash/_escapeStringChar.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_flatRest.js b/tools/node_modules/@babel/core/node_modules/lodash/_flatRest.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_flatRest.js rename to tools/node_modules/@babel/core/node_modules/lodash/_flatRest.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_freeGlobal.js b/tools/node_modules/@babel/core/node_modules/lodash/_freeGlobal.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_freeGlobal.js rename to tools/node_modules/@babel/core/node_modules/lodash/_freeGlobal.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_getAllKeys.js b/tools/node_modules/@babel/core/node_modules/lodash/_getAllKeys.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_getAllKeys.js rename to tools/node_modules/@babel/core/node_modules/lodash/_getAllKeys.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_getAllKeysIn.js b/tools/node_modules/@babel/core/node_modules/lodash/_getAllKeysIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_getAllKeysIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/_getAllKeysIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_getData.js b/tools/node_modules/@babel/core/node_modules/lodash/_getData.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_getData.js rename to tools/node_modules/@babel/core/node_modules/lodash/_getData.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_getFuncName.js b/tools/node_modules/@babel/core/node_modules/lodash/_getFuncName.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_getFuncName.js rename to tools/node_modules/@babel/core/node_modules/lodash/_getFuncName.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_getHolder.js b/tools/node_modules/@babel/core/node_modules/lodash/_getHolder.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_getHolder.js rename to tools/node_modules/@babel/core/node_modules/lodash/_getHolder.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_getMapData.js b/tools/node_modules/@babel/core/node_modules/lodash/_getMapData.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_getMapData.js rename to tools/node_modules/@babel/core/node_modules/lodash/_getMapData.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_getMatchData.js b/tools/node_modules/@babel/core/node_modules/lodash/_getMatchData.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_getMatchData.js rename to tools/node_modules/@babel/core/node_modules/lodash/_getMatchData.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_getNative.js b/tools/node_modules/@babel/core/node_modules/lodash/_getNative.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_getNative.js rename to tools/node_modules/@babel/core/node_modules/lodash/_getNative.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_getPrototype.js b/tools/node_modules/@babel/core/node_modules/lodash/_getPrototype.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_getPrototype.js rename to tools/node_modules/@babel/core/node_modules/lodash/_getPrototype.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_getRawTag.js b/tools/node_modules/@babel/core/node_modules/lodash/_getRawTag.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_getRawTag.js rename to tools/node_modules/@babel/core/node_modules/lodash/_getRawTag.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_getSymbols.js b/tools/node_modules/@babel/core/node_modules/lodash/_getSymbols.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_getSymbols.js rename to tools/node_modules/@babel/core/node_modules/lodash/_getSymbols.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_getSymbolsIn.js b/tools/node_modules/@babel/core/node_modules/lodash/_getSymbolsIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_getSymbolsIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/_getSymbolsIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_getTag.js b/tools/node_modules/@babel/core/node_modules/lodash/_getTag.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_getTag.js rename to tools/node_modules/@babel/core/node_modules/lodash/_getTag.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_getValue.js b/tools/node_modules/@babel/core/node_modules/lodash/_getValue.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_getValue.js rename to tools/node_modules/@babel/core/node_modules/lodash/_getValue.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_getView.js b/tools/node_modules/@babel/core/node_modules/lodash/_getView.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_getView.js rename to tools/node_modules/@babel/core/node_modules/lodash/_getView.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_getWrapDetails.js b/tools/node_modules/@babel/core/node_modules/lodash/_getWrapDetails.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_getWrapDetails.js rename to tools/node_modules/@babel/core/node_modules/lodash/_getWrapDetails.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_hasPath.js b/tools/node_modules/@babel/core/node_modules/lodash/_hasPath.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_hasPath.js rename to tools/node_modules/@babel/core/node_modules/lodash/_hasPath.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_hasUnicode.js b/tools/node_modules/@babel/core/node_modules/lodash/_hasUnicode.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_hasUnicode.js rename to tools/node_modules/@babel/core/node_modules/lodash/_hasUnicode.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_hasUnicodeWord.js b/tools/node_modules/@babel/core/node_modules/lodash/_hasUnicodeWord.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_hasUnicodeWord.js rename to tools/node_modules/@babel/core/node_modules/lodash/_hasUnicodeWord.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_hashClear.js b/tools/node_modules/@babel/core/node_modules/lodash/_hashClear.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_hashClear.js rename to tools/node_modules/@babel/core/node_modules/lodash/_hashClear.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_hashDelete.js b/tools/node_modules/@babel/core/node_modules/lodash/_hashDelete.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_hashDelete.js rename to tools/node_modules/@babel/core/node_modules/lodash/_hashDelete.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_hashGet.js b/tools/node_modules/@babel/core/node_modules/lodash/_hashGet.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_hashGet.js rename to tools/node_modules/@babel/core/node_modules/lodash/_hashGet.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_hashHas.js b/tools/node_modules/@babel/core/node_modules/lodash/_hashHas.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_hashHas.js rename to tools/node_modules/@babel/core/node_modules/lodash/_hashHas.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_hashSet.js b/tools/node_modules/@babel/core/node_modules/lodash/_hashSet.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_hashSet.js rename to tools/node_modules/@babel/core/node_modules/lodash/_hashSet.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_initCloneArray.js b/tools/node_modules/@babel/core/node_modules/lodash/_initCloneArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_initCloneArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/_initCloneArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_initCloneByTag.js b/tools/node_modules/@babel/core/node_modules/lodash/_initCloneByTag.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_initCloneByTag.js rename to tools/node_modules/@babel/core/node_modules/lodash/_initCloneByTag.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_initCloneObject.js b/tools/node_modules/@babel/core/node_modules/lodash/_initCloneObject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_initCloneObject.js rename to tools/node_modules/@babel/core/node_modules/lodash/_initCloneObject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_insertWrapDetails.js b/tools/node_modules/@babel/core/node_modules/lodash/_insertWrapDetails.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_insertWrapDetails.js rename to tools/node_modules/@babel/core/node_modules/lodash/_insertWrapDetails.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_isFlattenable.js b/tools/node_modules/@babel/core/node_modules/lodash/_isFlattenable.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_isFlattenable.js rename to tools/node_modules/@babel/core/node_modules/lodash/_isFlattenable.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_isIndex.js b/tools/node_modules/@babel/core/node_modules/lodash/_isIndex.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_isIndex.js rename to tools/node_modules/@babel/core/node_modules/lodash/_isIndex.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_isIterateeCall.js b/tools/node_modules/@babel/core/node_modules/lodash/_isIterateeCall.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_isIterateeCall.js rename to tools/node_modules/@babel/core/node_modules/lodash/_isIterateeCall.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_isKey.js b/tools/node_modules/@babel/core/node_modules/lodash/_isKey.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_isKey.js rename to tools/node_modules/@babel/core/node_modules/lodash/_isKey.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_isKeyable.js b/tools/node_modules/@babel/core/node_modules/lodash/_isKeyable.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_isKeyable.js rename to tools/node_modules/@babel/core/node_modules/lodash/_isKeyable.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_isLaziable.js b/tools/node_modules/@babel/core/node_modules/lodash/_isLaziable.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_isLaziable.js rename to tools/node_modules/@babel/core/node_modules/lodash/_isLaziable.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_isMaskable.js b/tools/node_modules/@babel/core/node_modules/lodash/_isMaskable.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_isMaskable.js rename to tools/node_modules/@babel/core/node_modules/lodash/_isMaskable.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_isMasked.js b/tools/node_modules/@babel/core/node_modules/lodash/_isMasked.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_isMasked.js rename to tools/node_modules/@babel/core/node_modules/lodash/_isMasked.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_isPrototype.js b/tools/node_modules/@babel/core/node_modules/lodash/_isPrototype.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_isPrototype.js rename to tools/node_modules/@babel/core/node_modules/lodash/_isPrototype.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_isStrictComparable.js b/tools/node_modules/@babel/core/node_modules/lodash/_isStrictComparable.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_isStrictComparable.js rename to tools/node_modules/@babel/core/node_modules/lodash/_isStrictComparable.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_iteratorToArray.js b/tools/node_modules/@babel/core/node_modules/lodash/_iteratorToArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_iteratorToArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/_iteratorToArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_lazyClone.js b/tools/node_modules/@babel/core/node_modules/lodash/_lazyClone.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_lazyClone.js rename to tools/node_modules/@babel/core/node_modules/lodash/_lazyClone.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_lazyReverse.js b/tools/node_modules/@babel/core/node_modules/lodash/_lazyReverse.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_lazyReverse.js rename to tools/node_modules/@babel/core/node_modules/lodash/_lazyReverse.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_lazyValue.js b/tools/node_modules/@babel/core/node_modules/lodash/_lazyValue.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_lazyValue.js rename to tools/node_modules/@babel/core/node_modules/lodash/_lazyValue.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_listCacheClear.js b/tools/node_modules/@babel/core/node_modules/lodash/_listCacheClear.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_listCacheClear.js rename to tools/node_modules/@babel/core/node_modules/lodash/_listCacheClear.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_listCacheDelete.js b/tools/node_modules/@babel/core/node_modules/lodash/_listCacheDelete.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_listCacheDelete.js rename to tools/node_modules/@babel/core/node_modules/lodash/_listCacheDelete.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_listCacheGet.js b/tools/node_modules/@babel/core/node_modules/lodash/_listCacheGet.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_listCacheGet.js rename to tools/node_modules/@babel/core/node_modules/lodash/_listCacheGet.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_listCacheHas.js b/tools/node_modules/@babel/core/node_modules/lodash/_listCacheHas.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_listCacheHas.js rename to tools/node_modules/@babel/core/node_modules/lodash/_listCacheHas.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_listCacheSet.js b/tools/node_modules/@babel/core/node_modules/lodash/_listCacheSet.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_listCacheSet.js rename to tools/node_modules/@babel/core/node_modules/lodash/_listCacheSet.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_mapCacheClear.js b/tools/node_modules/@babel/core/node_modules/lodash/_mapCacheClear.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_mapCacheClear.js rename to tools/node_modules/@babel/core/node_modules/lodash/_mapCacheClear.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_mapCacheDelete.js b/tools/node_modules/@babel/core/node_modules/lodash/_mapCacheDelete.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_mapCacheDelete.js rename to tools/node_modules/@babel/core/node_modules/lodash/_mapCacheDelete.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_mapCacheGet.js b/tools/node_modules/@babel/core/node_modules/lodash/_mapCacheGet.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_mapCacheGet.js rename to tools/node_modules/@babel/core/node_modules/lodash/_mapCacheGet.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_mapCacheHas.js b/tools/node_modules/@babel/core/node_modules/lodash/_mapCacheHas.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_mapCacheHas.js rename to tools/node_modules/@babel/core/node_modules/lodash/_mapCacheHas.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_mapCacheSet.js b/tools/node_modules/@babel/core/node_modules/lodash/_mapCacheSet.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_mapCacheSet.js rename to tools/node_modules/@babel/core/node_modules/lodash/_mapCacheSet.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_mapToArray.js b/tools/node_modules/@babel/core/node_modules/lodash/_mapToArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_mapToArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/_mapToArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_matchesStrictComparable.js b/tools/node_modules/@babel/core/node_modules/lodash/_matchesStrictComparable.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_matchesStrictComparable.js rename to tools/node_modules/@babel/core/node_modules/lodash/_matchesStrictComparable.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_memoizeCapped.js b/tools/node_modules/@babel/core/node_modules/lodash/_memoizeCapped.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_memoizeCapped.js rename to tools/node_modules/@babel/core/node_modules/lodash/_memoizeCapped.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_mergeData.js b/tools/node_modules/@babel/core/node_modules/lodash/_mergeData.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_mergeData.js rename to tools/node_modules/@babel/core/node_modules/lodash/_mergeData.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_metaMap.js b/tools/node_modules/@babel/core/node_modules/lodash/_metaMap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_metaMap.js rename to tools/node_modules/@babel/core/node_modules/lodash/_metaMap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_nativeCreate.js b/tools/node_modules/@babel/core/node_modules/lodash/_nativeCreate.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_nativeCreate.js rename to tools/node_modules/@babel/core/node_modules/lodash/_nativeCreate.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_nativeKeys.js b/tools/node_modules/@babel/core/node_modules/lodash/_nativeKeys.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_nativeKeys.js rename to tools/node_modules/@babel/core/node_modules/lodash/_nativeKeys.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_nativeKeysIn.js b/tools/node_modules/@babel/core/node_modules/lodash/_nativeKeysIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_nativeKeysIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/_nativeKeysIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_nodeUtil.js b/tools/node_modules/@babel/core/node_modules/lodash/_nodeUtil.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_nodeUtil.js rename to tools/node_modules/@babel/core/node_modules/lodash/_nodeUtil.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_objectToString.js b/tools/node_modules/@babel/core/node_modules/lodash/_objectToString.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_objectToString.js rename to tools/node_modules/@babel/core/node_modules/lodash/_objectToString.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_overArg.js b/tools/node_modules/@babel/core/node_modules/lodash/_overArg.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_overArg.js rename to tools/node_modules/@babel/core/node_modules/lodash/_overArg.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_overRest.js b/tools/node_modules/@babel/core/node_modules/lodash/_overRest.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_overRest.js rename to tools/node_modules/@babel/core/node_modules/lodash/_overRest.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_parent.js b/tools/node_modules/@babel/core/node_modules/lodash/_parent.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_parent.js rename to tools/node_modules/@babel/core/node_modules/lodash/_parent.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_reEscape.js b/tools/node_modules/@babel/core/node_modules/lodash/_reEscape.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_reEscape.js rename to tools/node_modules/@babel/core/node_modules/lodash/_reEscape.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_reEvaluate.js b/tools/node_modules/@babel/core/node_modules/lodash/_reEvaluate.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_reEvaluate.js rename to tools/node_modules/@babel/core/node_modules/lodash/_reEvaluate.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_reInterpolate.js b/tools/node_modules/@babel/core/node_modules/lodash/_reInterpolate.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_reInterpolate.js rename to tools/node_modules/@babel/core/node_modules/lodash/_reInterpolate.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_realNames.js b/tools/node_modules/@babel/core/node_modules/lodash/_realNames.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_realNames.js rename to tools/node_modules/@babel/core/node_modules/lodash/_realNames.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_reorder.js b/tools/node_modules/@babel/core/node_modules/lodash/_reorder.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_reorder.js rename to tools/node_modules/@babel/core/node_modules/lodash/_reorder.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_replaceHolders.js b/tools/node_modules/@babel/core/node_modules/lodash/_replaceHolders.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_replaceHolders.js rename to tools/node_modules/@babel/core/node_modules/lodash/_replaceHolders.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_root.js b/tools/node_modules/@babel/core/node_modules/lodash/_root.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_root.js rename to tools/node_modules/@babel/core/node_modules/lodash/_root.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_safeGet.js b/tools/node_modules/@babel/core/node_modules/lodash/_safeGet.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_safeGet.js rename to tools/node_modules/@babel/core/node_modules/lodash/_safeGet.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_setCacheAdd.js b/tools/node_modules/@babel/core/node_modules/lodash/_setCacheAdd.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_setCacheAdd.js rename to tools/node_modules/@babel/core/node_modules/lodash/_setCacheAdd.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_setCacheHas.js b/tools/node_modules/@babel/core/node_modules/lodash/_setCacheHas.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_setCacheHas.js rename to tools/node_modules/@babel/core/node_modules/lodash/_setCacheHas.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_setData.js b/tools/node_modules/@babel/core/node_modules/lodash/_setData.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_setData.js rename to tools/node_modules/@babel/core/node_modules/lodash/_setData.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_setToArray.js b/tools/node_modules/@babel/core/node_modules/lodash/_setToArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_setToArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/_setToArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_setToPairs.js b/tools/node_modules/@babel/core/node_modules/lodash/_setToPairs.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_setToPairs.js rename to tools/node_modules/@babel/core/node_modules/lodash/_setToPairs.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_setToString.js b/tools/node_modules/@babel/core/node_modules/lodash/_setToString.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_setToString.js rename to tools/node_modules/@babel/core/node_modules/lodash/_setToString.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_setWrapToString.js b/tools/node_modules/@babel/core/node_modules/lodash/_setWrapToString.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_setWrapToString.js rename to tools/node_modules/@babel/core/node_modules/lodash/_setWrapToString.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_shortOut.js b/tools/node_modules/@babel/core/node_modules/lodash/_shortOut.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_shortOut.js rename to tools/node_modules/@babel/core/node_modules/lodash/_shortOut.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_shuffleSelf.js b/tools/node_modules/@babel/core/node_modules/lodash/_shuffleSelf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_shuffleSelf.js rename to tools/node_modules/@babel/core/node_modules/lodash/_shuffleSelf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_stackClear.js b/tools/node_modules/@babel/core/node_modules/lodash/_stackClear.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_stackClear.js rename to tools/node_modules/@babel/core/node_modules/lodash/_stackClear.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_stackDelete.js b/tools/node_modules/@babel/core/node_modules/lodash/_stackDelete.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_stackDelete.js rename to tools/node_modules/@babel/core/node_modules/lodash/_stackDelete.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_stackGet.js b/tools/node_modules/@babel/core/node_modules/lodash/_stackGet.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_stackGet.js rename to tools/node_modules/@babel/core/node_modules/lodash/_stackGet.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_stackHas.js b/tools/node_modules/@babel/core/node_modules/lodash/_stackHas.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_stackHas.js rename to tools/node_modules/@babel/core/node_modules/lodash/_stackHas.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_stackSet.js b/tools/node_modules/@babel/core/node_modules/lodash/_stackSet.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_stackSet.js rename to tools/node_modules/@babel/core/node_modules/lodash/_stackSet.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_strictIndexOf.js b/tools/node_modules/@babel/core/node_modules/lodash/_strictIndexOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_strictIndexOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/_strictIndexOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_strictLastIndexOf.js b/tools/node_modules/@babel/core/node_modules/lodash/_strictLastIndexOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_strictLastIndexOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/_strictLastIndexOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_stringSize.js b/tools/node_modules/@babel/core/node_modules/lodash/_stringSize.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_stringSize.js rename to tools/node_modules/@babel/core/node_modules/lodash/_stringSize.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_stringToArray.js b/tools/node_modules/@babel/core/node_modules/lodash/_stringToArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_stringToArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/_stringToArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_stringToPath.js b/tools/node_modules/@babel/core/node_modules/lodash/_stringToPath.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_stringToPath.js rename to tools/node_modules/@babel/core/node_modules/lodash/_stringToPath.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_toKey.js b/tools/node_modules/@babel/core/node_modules/lodash/_toKey.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_toKey.js rename to tools/node_modules/@babel/core/node_modules/lodash/_toKey.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_toSource.js b/tools/node_modules/@babel/core/node_modules/lodash/_toSource.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_toSource.js rename to tools/node_modules/@babel/core/node_modules/lodash/_toSource.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_unescapeHtmlChar.js b/tools/node_modules/@babel/core/node_modules/lodash/_unescapeHtmlChar.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_unescapeHtmlChar.js rename to tools/node_modules/@babel/core/node_modules/lodash/_unescapeHtmlChar.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_unicodeSize.js b/tools/node_modules/@babel/core/node_modules/lodash/_unicodeSize.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_unicodeSize.js rename to tools/node_modules/@babel/core/node_modules/lodash/_unicodeSize.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_unicodeToArray.js b/tools/node_modules/@babel/core/node_modules/lodash/_unicodeToArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_unicodeToArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/_unicodeToArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_unicodeWords.js b/tools/node_modules/@babel/core/node_modules/lodash/_unicodeWords.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_unicodeWords.js rename to tools/node_modules/@babel/core/node_modules/lodash/_unicodeWords.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_updateWrapDetails.js b/tools/node_modules/@babel/core/node_modules/lodash/_updateWrapDetails.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_updateWrapDetails.js rename to tools/node_modules/@babel/core/node_modules/lodash/_updateWrapDetails.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/_wrapperClone.js b/tools/node_modules/@babel/core/node_modules/lodash/_wrapperClone.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/_wrapperClone.js rename to tools/node_modules/@babel/core/node_modules/lodash/_wrapperClone.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/add.js b/tools/node_modules/@babel/core/node_modules/lodash/add.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/add.js rename to tools/node_modules/@babel/core/node_modules/lodash/add.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/after.js b/tools/node_modules/@babel/core/node_modules/lodash/after.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/after.js rename to tools/node_modules/@babel/core/node_modules/lodash/after.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/array.js b/tools/node_modules/@babel/core/node_modules/lodash/array.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/array.js rename to tools/node_modules/@babel/core/node_modules/lodash/array.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/ary.js b/tools/node_modules/@babel/core/node_modules/lodash/ary.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/ary.js rename to tools/node_modules/@babel/core/node_modules/lodash/ary.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/assign.js b/tools/node_modules/@babel/core/node_modules/lodash/assign.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/assign.js rename to tools/node_modules/@babel/core/node_modules/lodash/assign.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/assignIn.js b/tools/node_modules/@babel/core/node_modules/lodash/assignIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/assignIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/assignIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/assignInWith.js b/tools/node_modules/@babel/core/node_modules/lodash/assignInWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/assignInWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/assignInWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/assignWith.js b/tools/node_modules/@babel/core/node_modules/lodash/assignWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/assignWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/assignWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/at.js b/tools/node_modules/@babel/core/node_modules/lodash/at.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/at.js rename to tools/node_modules/@babel/core/node_modules/lodash/at.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/attempt.js b/tools/node_modules/@babel/core/node_modules/lodash/attempt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/attempt.js rename to tools/node_modules/@babel/core/node_modules/lodash/attempt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/before.js b/tools/node_modules/@babel/core/node_modules/lodash/before.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/before.js rename to tools/node_modules/@babel/core/node_modules/lodash/before.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/bind.js b/tools/node_modules/@babel/core/node_modules/lodash/bind.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/bind.js rename to tools/node_modules/@babel/core/node_modules/lodash/bind.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/bindAll.js b/tools/node_modules/@babel/core/node_modules/lodash/bindAll.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/bindAll.js rename to tools/node_modules/@babel/core/node_modules/lodash/bindAll.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/bindKey.js b/tools/node_modules/@babel/core/node_modules/lodash/bindKey.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/bindKey.js rename to tools/node_modules/@babel/core/node_modules/lodash/bindKey.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/camelCase.js b/tools/node_modules/@babel/core/node_modules/lodash/camelCase.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/camelCase.js rename to tools/node_modules/@babel/core/node_modules/lodash/camelCase.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/capitalize.js b/tools/node_modules/@babel/core/node_modules/lodash/capitalize.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/capitalize.js rename to tools/node_modules/@babel/core/node_modules/lodash/capitalize.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/castArray.js b/tools/node_modules/@babel/core/node_modules/lodash/castArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/castArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/castArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/ceil.js b/tools/node_modules/@babel/core/node_modules/lodash/ceil.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/ceil.js rename to tools/node_modules/@babel/core/node_modules/lodash/ceil.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/chain.js b/tools/node_modules/@babel/core/node_modules/lodash/chain.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/chain.js rename to tools/node_modules/@babel/core/node_modules/lodash/chain.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/chunk.js b/tools/node_modules/@babel/core/node_modules/lodash/chunk.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/chunk.js rename to tools/node_modules/@babel/core/node_modules/lodash/chunk.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/clamp.js b/tools/node_modules/@babel/core/node_modules/lodash/clamp.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/clamp.js rename to tools/node_modules/@babel/core/node_modules/lodash/clamp.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/clone.js b/tools/node_modules/@babel/core/node_modules/lodash/clone.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/clone.js rename to tools/node_modules/@babel/core/node_modules/lodash/clone.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/cloneDeep.js b/tools/node_modules/@babel/core/node_modules/lodash/cloneDeep.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/cloneDeep.js rename to tools/node_modules/@babel/core/node_modules/lodash/cloneDeep.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/cloneDeepWith.js b/tools/node_modules/@babel/core/node_modules/lodash/cloneDeepWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/cloneDeepWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/cloneDeepWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/cloneWith.js b/tools/node_modules/@babel/core/node_modules/lodash/cloneWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/cloneWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/cloneWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/collection.js b/tools/node_modules/@babel/core/node_modules/lodash/collection.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/collection.js rename to tools/node_modules/@babel/core/node_modules/lodash/collection.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/commit.js b/tools/node_modules/@babel/core/node_modules/lodash/commit.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/commit.js rename to tools/node_modules/@babel/core/node_modules/lodash/commit.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/compact.js b/tools/node_modules/@babel/core/node_modules/lodash/compact.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/compact.js rename to tools/node_modules/@babel/core/node_modules/lodash/compact.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/concat.js b/tools/node_modules/@babel/core/node_modules/lodash/concat.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/concat.js rename to tools/node_modules/@babel/core/node_modules/lodash/concat.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/cond.js b/tools/node_modules/@babel/core/node_modules/lodash/cond.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/cond.js rename to tools/node_modules/@babel/core/node_modules/lodash/cond.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/conforms.js b/tools/node_modules/@babel/core/node_modules/lodash/conforms.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/conforms.js rename to tools/node_modules/@babel/core/node_modules/lodash/conforms.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/conformsTo.js b/tools/node_modules/@babel/core/node_modules/lodash/conformsTo.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/conformsTo.js rename to tools/node_modules/@babel/core/node_modules/lodash/conformsTo.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/constant.js b/tools/node_modules/@babel/core/node_modules/lodash/constant.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/constant.js rename to tools/node_modules/@babel/core/node_modules/lodash/constant.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/core.js b/tools/node_modules/@babel/core/node_modules/lodash/core.js similarity index 99% rename from tools/node_modules/babel-eslint/node_modules/lodash/core.js rename to tools/node_modules/@babel/core/node_modules/lodash/core.js index 89c77ded06308d..6d70dcaf87035b 100644 --- a/tools/node_modules/babel-eslint/node_modules/lodash/core.js +++ b/tools/node_modules/@babel/core/node_modules/lodash/core.js @@ -13,7 +13,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.17.15'; + var VERSION = '4.17.20'; /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; @@ -1183,6 +1183,12 @@ if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } + // Check that cyclic values are equal. + var arrStacked = stack.get(array); + var othStacked = stack.get(other); + if (arrStacked && othStacked) { + return arrStacked == other && othStacked == array; + } var index = -1, result = true, seen = (bitmask & COMPARE_UNORDERED_FLAG) ? [] : undefined; @@ -1293,6 +1299,12 @@ return false; } } + // Check that cyclic values are equal. + var objStacked = stack.get(object); + var othStacked = stack.get(other); + if (objStacked && othStacked) { + return objStacked == other && othStacked == object; + } var result = true; var skipCtor = isPartial; @@ -1935,6 +1947,10 @@ * // The `_.property` iteratee shorthand. * _.filter(users, 'active'); * // => objects for ['barney'] + * + * // Combining several predicates using `_.overEvery` or `_.overSome`. + * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); + * // => objects for ['fred', 'barney'] */ function filter(collection, predicate) { return baseFilter(collection, baseIteratee(predicate)); @@ -2188,15 +2204,15 @@ * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, + * { 'user': 'fred', 'age': 30 }, * { 'user': 'barney', 'age': 34 } * ]; * * _.sortBy(users, [function(o) { return o.user; }]); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] * * _.sortBy(users, ['user', 'age']); - * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] + * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] */ function sortBy(collection, iteratee) { var index = 0; @@ -3503,6 +3519,9 @@ * values against any array or object value, respectively. See `_.isEqual` * for a list of supported value comparisons. * + * **Note:** Multiple values can be checked by combining several matchers + * using `_.overSome` + * * @static * @memberOf _ * @since 3.0.0 @@ -3518,6 +3537,10 @@ * * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); * // => [{ 'a': 4, 'b': 5, 'c': 6 }] + * + * // Checking for several possible values + * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); + * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matches(source) { return baseMatches(assign({}, source)); diff --git a/tools/node_modules/@babel/core/node_modules/lodash/core.min.js b/tools/node_modules/@babel/core/node_modules/lodash/core.min.js new file mode 100644 index 00000000000000..f40952565b2e65 --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/lodash/core.min.js @@ -0,0 +1,30 @@ +/** + * @license + * Lodash (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE + * Build: `lodash core -o ./dist/lodash.core.js` + */ +;(function(){function n(n,t){return n.push.apply(n,t),n}function t(n,t,r,e){for(var u=n.length,o=r+(e?1:-1);e?o--:++o0&&e(f)?r>1?y(f,r-1,e,u,o):n(o,f):u||(o[o.length]=f)}return o}function g(n,t){return n&&Vt(n,t,cr)}function _(n,t){return v(t,function(t){return Tn(n[t])})}function b(n){return W(n)}function j(n,t){return n>t}function d(n){return In(n)&&b(n)==ht}function m(n,t,r,e,u){return n===t||(null==n||null==t||!In(n)&&!In(t)?n!==n&&t!==t:O(n,t,r,e,m,u))}function O(n,t,r,e,u,o){ +var i=Zt(n),c=Zt(t),f=i?lt:b(n),a=c?lt:b(t);f=f==at?bt:f,a=a==at?bt:a;var l=f==bt,p=a==bt,s=f==a;o||(o=[]);var h=Lt(o,function(t){return t[0]==n}),v=Lt(o,function(n){return n[0]==t});if(h&&v)return h[1]==t;if(o.push([n,t]),o.push([t,n]),s&&!l){var y=i?J(n,t,r,e,u,o):M(n,t,f,r,e,u,o);return o.pop(),y}if(!(r&et)){var g=l&&Rt.call(n,"__wrapped__"),_=p&&Rt.call(t,"__wrapped__");if(g||_){var j=g?n.value():n,d=_?t.value():t,y=u(j,d,r,e,o);return o.pop(),y}}if(!s)return false;var y=U(n,t,r,e,u,o);return o.pop(), +y}function x(n){return In(n)&&b(n)==dt}function w(n){return typeof n=="function"?n:null==n?Hn:(typeof n=="object"?N:r)(n)}function A(n,t){return nu?0:u+t),r=r>u?u:r,r<0&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(u);++et||o&&i&&f&&!c&&!a||e&&i&&f||!r&&f||!u)return 1; +if(!e&&!o&&!a&&n1?r[u-1]:nt;for(o=n.length>3&&typeof o=="function"?(u--,o):nt,t=Object(t);++e-1?u[o?t[i]:i]:nt}}function G(n,t,r,e){function u(){for(var t=-1,c=arguments.length,f=-1,a=e.length,l=Array(a+c),p=this&&this!==kt&&this instanceof u?i:n;++fc))return false;var a=o.get(n),l=o.get(t);if(a&&l)return a==t&&l==n;for(var p=-1,s=true,h=r&ut?[]:nt;++p-1&&n%1==0&&n0&&(r=t.apply(this,arguments)),n<=1&&(t=nt),r}}function mn(n){if(typeof n!="function")throw new TypeError(rt);return function(){return!n.apply(this,arguments)}; +}function On(n){return dn(2,n)}function xn(n){return Bn(n)?Zt(n)?S(n):$(n,Gt(n)):n}function wn(n,t){return n===t||n!==n&&t!==t}function An(n){return null!=n&&Sn(n.length)&&!Tn(n)}function En(n){return n===true||n===false||In(n)&&b(n)==st}function Nn(n){return An(n)&&(Zt(n)||Dn(n)||Tn(n.splice)||Yt(n))?!n.length:!Gt(n).length}function kn(n,t){return m(n,t)}function Fn(n){return typeof n=="number"&&Ct(n)}function Tn(n){if(!Bn(n))return false;var t=b(n);return t==yt||t==gt||t==pt||t==jt}function Sn(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=ft; +}function Bn(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function In(n){return null!=n&&typeof n=="object"}function Rn(n){return qn(n)&&n!=+n}function $n(n){return null===n}function qn(n){return typeof n=="number"||In(n)&&b(n)==_t}function Dn(n){return typeof n=="string"||!Zt(n)&&In(n)&&b(n)==mt}function Pn(n){return n===nt}function zn(n){return An(n)?n.length?S(n):[]:Un(n)}function Cn(n){return typeof n=="string"?n:null==n?"":n+""}function Gn(n,t){var r=Mt(n);return null==t?r:ur(r,t); +}function Jn(n,t){return null!=n&&Rt.call(n,t)}function Mn(n,t,r){var e=null==n?nt:n[t];return e===nt&&(e=r),Tn(e)?e.call(n):e}function Un(n){return null==n?[]:o(n,cr(n))}function Vn(n){return n=Cn(n),n&&xt.test(n)?n.replace(Ot,St):n}function Hn(n){return n}function Kn(n){return N(ur({},n))}function Ln(t,r,e){var u=cr(r),o=_(r,u);null!=e||Bn(r)&&(o.length||!u.length)||(e=r,r=t,t=this,o=_(r,cr(r)));var i=!(Bn(e)&&"chain"in e&&!e.chain),c=Tn(t);return Ut(o,function(e){var u=r[e];t[e]=u,c&&(t.prototype[e]=function(){ +var r=this.__chain__;if(i||r){var e=t(this.__wrapped__);return(e.__actions__=S(this.__actions__)).push({func:u,args:arguments,thisArg:t}),e.__chain__=r,e}return u.apply(t,n([this.value()],arguments))})}),t}function Qn(){return kt._===this&&(kt._=Dt),this}function Wn(){}function Xn(n){var t=++$t;return Cn(n)+t}function Yn(n){return n&&n.length?h(n,Hn,j):nt}function Zn(n){return n&&n.length?h(n,Hn,A):nt}var nt,tt="4.17.20",rt="Expected a function",et=1,ut=2,ot=1,it=32,ct=1/0,ft=9007199254740991,at="[object Arguments]",lt="[object Array]",pt="[object AsyncFunction]",st="[object Boolean]",ht="[object Date]",vt="[object Error]",yt="[object Function]",gt="[object GeneratorFunction]",_t="[object Number]",bt="[object Object]",jt="[object Proxy]",dt="[object RegExp]",mt="[object String]",Ot=/[&<>"']/g,xt=RegExp(Ot.source),wt=/^(?:0|[1-9]\d*)$/,At={ +"&":"&","<":"<",">":">",'"':""","'":"'"},Et=typeof global=="object"&&global&&global.Object===Object&&global,Nt=typeof self=="object"&&self&&self.Object===Object&&self,kt=Et||Nt||Function("return this")(),Ft=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Tt=Ft&&typeof module=="object"&&module&&!module.nodeType&&module,St=e(At),Bt=Array.prototype,It=Object.prototype,Rt=It.hasOwnProperty,$t=0,qt=It.toString,Dt=kt._,Pt=Object.create,zt=It.propertyIsEnumerable,Ct=kt.isFinite,Gt=i(Object.keys,Object),Jt=Math.max,Mt=function(){ +function n(){}return function(t){if(!Bn(t))return{};if(Pt)return Pt(t);n.prototype=t;var r=new n;return n.prototype=nt,r}}();f.prototype=Mt(c.prototype),f.prototype.constructor=f;var Ut=D(g),Vt=P(),Ht=Wn,Kt=Hn,Lt=C(nn),Qt=F(function(n,t,r){return G(n,ot|it,t,r)}),Wt=F(function(n,t){return p(n,1,t)}),Xt=F(function(n,t,r){return p(n,er(t)||0,r)}),Yt=Ht(function(){return arguments}())?Ht:function(n){return In(n)&&Rt.call(n,"callee")&&!zt.call(n,"callee")},Zt=Array.isArray,nr=d,tr=x,rr=Number,er=Number,ur=q(function(n,t){ +$(t,Gt(t),n)}),or=q(function(n,t){$(t,Q(t),n)}),ir=F(function(n,t){n=Object(n);var r=-1,e=t.length,u=e>2?t[2]:nt;for(u&&L(t[0],t[1],u)&&(e=1);++r objects for ['barney'] + * + * // Combining several predicates using `_.overEvery` or `_.overSome`. + * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); + * // => objects for ['fred', 'barney'] */ function filter(collection, predicate) { var func = isArray(collection) ? arrayFilter : baseFilter; diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/find.js b/tools/node_modules/@babel/core/node_modules/lodash/find.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/find.js rename to tools/node_modules/@babel/core/node_modules/lodash/find.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/findIndex.js b/tools/node_modules/@babel/core/node_modules/lodash/findIndex.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/findIndex.js rename to tools/node_modules/@babel/core/node_modules/lodash/findIndex.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/findKey.js b/tools/node_modules/@babel/core/node_modules/lodash/findKey.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/findKey.js rename to tools/node_modules/@babel/core/node_modules/lodash/findKey.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/findLast.js b/tools/node_modules/@babel/core/node_modules/lodash/findLast.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/findLast.js rename to tools/node_modules/@babel/core/node_modules/lodash/findLast.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/findLastIndex.js b/tools/node_modules/@babel/core/node_modules/lodash/findLastIndex.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/findLastIndex.js rename to tools/node_modules/@babel/core/node_modules/lodash/findLastIndex.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/findLastKey.js b/tools/node_modules/@babel/core/node_modules/lodash/findLastKey.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/findLastKey.js rename to tools/node_modules/@babel/core/node_modules/lodash/findLastKey.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/first.js b/tools/node_modules/@babel/core/node_modules/lodash/first.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/first.js rename to tools/node_modules/@babel/core/node_modules/lodash/first.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/flatMap.js b/tools/node_modules/@babel/core/node_modules/lodash/flatMap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/flatMap.js rename to tools/node_modules/@babel/core/node_modules/lodash/flatMap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/flatMapDeep.js b/tools/node_modules/@babel/core/node_modules/lodash/flatMapDeep.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/flatMapDeep.js rename to tools/node_modules/@babel/core/node_modules/lodash/flatMapDeep.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/flatMapDepth.js b/tools/node_modules/@babel/core/node_modules/lodash/flatMapDepth.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/flatMapDepth.js rename to tools/node_modules/@babel/core/node_modules/lodash/flatMapDepth.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/flatten.js b/tools/node_modules/@babel/core/node_modules/lodash/flatten.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/flatten.js rename to tools/node_modules/@babel/core/node_modules/lodash/flatten.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/flattenDeep.js b/tools/node_modules/@babel/core/node_modules/lodash/flattenDeep.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/flattenDeep.js rename to tools/node_modules/@babel/core/node_modules/lodash/flattenDeep.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/flattenDepth.js b/tools/node_modules/@babel/core/node_modules/lodash/flattenDepth.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/flattenDepth.js rename to tools/node_modules/@babel/core/node_modules/lodash/flattenDepth.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/flip.js b/tools/node_modules/@babel/core/node_modules/lodash/flip.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/flip.js rename to tools/node_modules/@babel/core/node_modules/lodash/flip.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/floor.js b/tools/node_modules/@babel/core/node_modules/lodash/floor.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/floor.js rename to tools/node_modules/@babel/core/node_modules/lodash/floor.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/flow.js b/tools/node_modules/@babel/core/node_modules/lodash/flow.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/flow.js rename to tools/node_modules/@babel/core/node_modules/lodash/flow.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/flowRight.js b/tools/node_modules/@babel/core/node_modules/lodash/flowRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/flowRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/flowRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/forEach.js b/tools/node_modules/@babel/core/node_modules/lodash/forEach.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/forEach.js rename to tools/node_modules/@babel/core/node_modules/lodash/forEach.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/forEachRight.js b/tools/node_modules/@babel/core/node_modules/lodash/forEachRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/forEachRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/forEachRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/forIn.js b/tools/node_modules/@babel/core/node_modules/lodash/forIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/forIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/forIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/forInRight.js b/tools/node_modules/@babel/core/node_modules/lodash/forInRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/forInRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/forInRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/forOwn.js b/tools/node_modules/@babel/core/node_modules/lodash/forOwn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/forOwn.js rename to tools/node_modules/@babel/core/node_modules/lodash/forOwn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/forOwnRight.js b/tools/node_modules/@babel/core/node_modules/lodash/forOwnRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/forOwnRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/forOwnRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp.js b/tools/node_modules/@babel/core/node_modules/lodash/fp.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/F.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/F.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/F.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/F.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/T.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/T.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/T.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/T.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/__.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/__.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/__.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/__.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/_baseConvert.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/_baseConvert.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/_baseConvert.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/_baseConvert.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/_convertBrowser.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/_convertBrowser.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/_convertBrowser.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/_convertBrowser.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/_falseOptions.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/_falseOptions.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/_falseOptions.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/_falseOptions.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/_mapping.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/_mapping.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/_mapping.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/_mapping.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/_util.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/_util.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/_util.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/_util.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/add.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/add.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/add.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/add.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/after.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/after.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/after.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/after.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/all.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/all.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/all.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/all.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/allPass.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/allPass.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/allPass.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/allPass.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/always.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/always.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/always.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/always.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/any.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/any.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/any.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/any.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/anyPass.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/anyPass.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/anyPass.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/anyPass.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/apply.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/apply.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/apply.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/apply.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/array.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/array.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/array.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/array.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/ary.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/ary.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/ary.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/ary.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/assign.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/assign.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/assign.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/assign.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/assignAll.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/assignAll.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/assignAll.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/assignAll.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/assignAllWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/assignAllWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/assignAllWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/assignAllWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/assignIn.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/assignIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/assignIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/assignIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/assignInAll.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/assignInAll.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/assignInAll.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/assignInAll.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/assignInAllWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/assignInAllWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/assignInAllWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/assignInAllWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/assignInWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/assignInWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/assignInWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/assignInWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/assignWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/assignWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/assignWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/assignWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/assoc.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/assoc.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/assoc.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/assoc.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/assocPath.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/assocPath.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/assocPath.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/assocPath.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/at.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/at.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/at.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/at.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/attempt.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/attempt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/attempt.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/attempt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/before.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/before.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/before.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/before.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/bind.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/bind.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/bind.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/bind.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/bindAll.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/bindAll.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/bindAll.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/bindAll.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/bindKey.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/bindKey.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/bindKey.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/bindKey.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/camelCase.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/camelCase.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/camelCase.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/camelCase.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/capitalize.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/capitalize.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/capitalize.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/capitalize.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/castArray.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/castArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/castArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/castArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/ceil.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/ceil.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/ceil.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/ceil.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/chain.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/chain.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/chain.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/chain.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/chunk.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/chunk.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/chunk.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/chunk.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/clamp.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/clamp.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/clamp.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/clamp.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/clone.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/clone.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/clone.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/clone.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/cloneDeep.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/cloneDeep.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/cloneDeep.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/cloneDeep.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/cloneDeepWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/cloneDeepWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/cloneDeepWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/cloneDeepWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/cloneWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/cloneWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/cloneWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/cloneWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/collection.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/collection.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/collection.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/collection.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/commit.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/commit.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/commit.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/commit.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/compact.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/compact.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/compact.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/compact.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/complement.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/complement.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/complement.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/complement.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/compose.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/compose.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/compose.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/compose.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/concat.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/concat.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/concat.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/concat.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/cond.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/cond.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/cond.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/cond.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/conforms.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/conforms.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/conforms.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/conforms.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/conformsTo.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/conformsTo.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/conformsTo.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/conformsTo.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/constant.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/constant.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/constant.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/constant.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/contains.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/contains.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/contains.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/contains.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/convert.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/convert.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/convert.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/convert.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/countBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/countBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/countBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/countBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/create.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/create.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/create.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/create.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/curry.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/curry.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/curry.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/curry.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/curryN.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/curryN.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/curryN.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/curryN.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/curryRight.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/curryRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/curryRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/curryRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/curryRightN.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/curryRightN.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/curryRightN.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/curryRightN.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/date.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/date.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/date.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/date.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/debounce.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/debounce.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/debounce.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/debounce.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/deburr.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/deburr.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/deburr.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/deburr.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/defaultTo.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/defaultTo.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/defaultTo.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/defaultTo.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/defaults.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/defaults.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/defaults.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/defaults.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/defaultsAll.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/defaultsAll.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/defaultsAll.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/defaultsAll.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/defaultsDeep.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/defaultsDeep.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/defaultsDeep.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/defaultsDeep.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/defaultsDeepAll.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/defaultsDeepAll.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/defaultsDeepAll.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/defaultsDeepAll.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/defer.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/defer.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/defer.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/defer.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/delay.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/delay.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/delay.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/delay.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/difference.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/difference.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/difference.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/difference.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/differenceBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/differenceBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/differenceBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/differenceBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/differenceWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/differenceWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/differenceWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/differenceWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/dissoc.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/dissoc.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/dissoc.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/dissoc.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/dissocPath.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/dissocPath.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/dissocPath.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/dissocPath.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/divide.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/divide.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/divide.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/divide.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/drop.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/drop.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/drop.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/drop.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/dropLast.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/dropLast.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/dropLast.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/dropLast.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/dropLastWhile.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/dropLastWhile.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/dropLastWhile.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/dropLastWhile.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/dropRight.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/dropRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/dropRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/dropRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/dropRightWhile.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/dropRightWhile.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/dropRightWhile.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/dropRightWhile.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/dropWhile.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/dropWhile.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/dropWhile.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/dropWhile.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/each.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/each.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/each.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/each.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/eachRight.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/eachRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/eachRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/eachRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/endsWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/endsWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/endsWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/endsWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/entries.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/entries.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/entries.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/entries.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/entriesIn.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/entriesIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/entriesIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/entriesIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/eq.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/eq.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/eq.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/eq.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/equals.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/equals.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/equals.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/equals.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/escape.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/escape.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/escape.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/escape.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/escapeRegExp.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/escapeRegExp.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/escapeRegExp.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/escapeRegExp.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/every.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/every.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/every.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/every.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/extend.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/extend.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/extend.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/extend.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/extendAll.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/extendAll.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/extendAll.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/extendAll.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/extendAllWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/extendAllWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/extendAllWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/extendAllWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/extendWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/extendWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/extendWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/extendWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/fill.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/fill.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/fill.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/fill.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/filter.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/filter.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/filter.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/filter.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/find.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/find.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/find.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/find.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/findFrom.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/findFrom.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/findFrom.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/findFrom.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/findIndex.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/findIndex.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/findIndex.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/findIndex.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/findIndexFrom.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/findIndexFrom.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/findIndexFrom.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/findIndexFrom.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/findKey.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/findKey.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/findKey.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/findKey.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/findLast.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/findLast.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/findLast.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/findLast.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/findLastFrom.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/findLastFrom.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/findLastFrom.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/findLastFrom.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/findLastIndex.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/findLastIndex.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/findLastIndex.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/findLastIndex.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/findLastIndexFrom.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/findLastIndexFrom.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/findLastIndexFrom.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/findLastIndexFrom.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/findLastKey.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/findLastKey.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/findLastKey.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/findLastKey.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/first.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/first.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/first.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/first.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/flatMap.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/flatMap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/flatMap.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/flatMap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/flatMapDeep.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/flatMapDeep.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/flatMapDeep.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/flatMapDeep.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/flatMapDepth.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/flatMapDepth.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/flatMapDepth.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/flatMapDepth.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/flatten.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/flatten.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/flatten.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/flatten.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/flattenDeep.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/flattenDeep.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/flattenDeep.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/flattenDeep.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/flattenDepth.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/flattenDepth.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/flattenDepth.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/flattenDepth.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/flip.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/flip.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/flip.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/flip.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/floor.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/floor.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/floor.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/floor.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/flow.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/flow.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/flow.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/flow.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/flowRight.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/flowRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/flowRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/flowRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/forEach.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/forEach.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/forEach.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/forEach.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/forEachRight.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/forEachRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/forEachRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/forEachRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/forIn.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/forIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/forIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/forIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/forInRight.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/forInRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/forInRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/forInRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/forOwn.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/forOwn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/forOwn.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/forOwn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/forOwnRight.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/forOwnRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/forOwnRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/forOwnRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/fromPairs.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/fromPairs.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/fromPairs.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/fromPairs.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/function.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/function.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/function.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/function.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/functions.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/functions.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/functions.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/functions.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/functionsIn.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/functionsIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/functionsIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/functionsIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/get.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/get.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/get.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/get.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/getOr.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/getOr.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/getOr.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/getOr.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/groupBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/groupBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/groupBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/groupBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/gt.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/gt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/gt.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/gt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/gte.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/gte.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/gte.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/gte.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/has.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/has.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/has.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/has.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/hasIn.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/hasIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/hasIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/hasIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/head.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/head.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/head.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/head.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/identical.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/identical.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/identical.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/identical.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/identity.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/identity.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/identity.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/identity.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/inRange.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/inRange.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/inRange.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/inRange.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/includes.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/includes.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/includes.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/includes.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/includesFrom.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/includesFrom.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/includesFrom.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/includesFrom.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/indexBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/indexBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/indexBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/indexBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/indexOf.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/indexOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/indexOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/indexOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/indexOfFrom.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/indexOfFrom.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/indexOfFrom.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/indexOfFrom.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/init.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/init.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/init.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/init.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/initial.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/initial.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/initial.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/initial.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/intersection.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/intersection.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/intersection.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/intersection.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/intersectionBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/intersectionBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/intersectionBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/intersectionBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/intersectionWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/intersectionWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/intersectionWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/intersectionWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/invert.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/invert.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/invert.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/invert.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/invertBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/invertBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/invertBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/invertBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/invertObj.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/invertObj.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/invertObj.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/invertObj.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/invoke.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/invoke.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/invoke.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/invoke.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/invokeArgs.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/invokeArgs.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/invokeArgs.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/invokeArgs.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/invokeArgsMap.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/invokeArgsMap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/invokeArgsMap.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/invokeArgsMap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/invokeMap.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/invokeMap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/invokeMap.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/invokeMap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isArguments.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isArguments.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isArguments.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isArguments.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isArray.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isArrayBuffer.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isArrayBuffer.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isArrayBuffer.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isArrayBuffer.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isArrayLike.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isArrayLike.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isArrayLike.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isArrayLike.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isArrayLikeObject.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isArrayLikeObject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isArrayLikeObject.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isArrayLikeObject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isBoolean.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isBoolean.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isBoolean.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isBoolean.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isBuffer.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isBuffer.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isBuffer.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isBuffer.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isDate.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isDate.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isDate.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isDate.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isElement.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isElement.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isElement.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isElement.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isEmpty.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isEmpty.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isEmpty.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isEmpty.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isEqual.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isEqual.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isEqual.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isEqual.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isEqualWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isEqualWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isEqualWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isEqualWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isError.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isError.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isError.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isError.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isFinite.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isFinite.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isFinite.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isFinite.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isFunction.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isFunction.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isFunction.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isFunction.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isInteger.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isInteger.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isInteger.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isInteger.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isLength.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isLength.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isLength.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isLength.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isMap.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isMap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isMap.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isMap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isMatch.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isMatch.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isMatch.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isMatch.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isMatchWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isMatchWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isMatchWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isMatchWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isNaN.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isNaN.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isNaN.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isNaN.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isNative.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isNative.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isNative.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isNative.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isNil.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isNil.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isNil.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isNil.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isNull.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isNull.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isNull.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isNull.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isNumber.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isNumber.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isNumber.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isNumber.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isObject.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isObject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isObject.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isObject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isObjectLike.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isObjectLike.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isObjectLike.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isObjectLike.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isPlainObject.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isPlainObject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isPlainObject.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isPlainObject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isRegExp.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isRegExp.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isRegExp.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isRegExp.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isSafeInteger.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isSafeInteger.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isSafeInteger.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isSafeInteger.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isSet.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isSet.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isSet.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isSet.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isString.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isString.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isString.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isString.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isSymbol.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isSymbol.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isSymbol.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isSymbol.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isTypedArray.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isTypedArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isTypedArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isTypedArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isUndefined.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isUndefined.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isUndefined.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isUndefined.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isWeakMap.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isWeakMap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isWeakMap.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isWeakMap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/isWeakSet.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/isWeakSet.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/isWeakSet.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/isWeakSet.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/iteratee.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/iteratee.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/iteratee.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/iteratee.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/join.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/join.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/join.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/join.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/juxt.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/juxt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/juxt.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/juxt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/kebabCase.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/kebabCase.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/kebabCase.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/kebabCase.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/keyBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/keyBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/keyBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/keyBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/keys.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/keys.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/keys.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/keys.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/keysIn.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/keysIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/keysIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/keysIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/lang.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/lang.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/lang.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/lang.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/last.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/last.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/last.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/last.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/lastIndexOf.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/lastIndexOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/lastIndexOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/lastIndexOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/lastIndexOfFrom.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/lastIndexOfFrom.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/lastIndexOfFrom.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/lastIndexOfFrom.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/lowerCase.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/lowerCase.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/lowerCase.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/lowerCase.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/lowerFirst.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/lowerFirst.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/lowerFirst.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/lowerFirst.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/lt.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/lt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/lt.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/lt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/lte.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/lte.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/lte.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/lte.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/map.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/map.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/map.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/map.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/mapKeys.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/mapKeys.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/mapKeys.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/mapKeys.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/mapValues.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/mapValues.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/mapValues.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/mapValues.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/matches.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/matches.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/matches.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/matches.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/matchesProperty.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/matchesProperty.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/matchesProperty.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/matchesProperty.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/math.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/math.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/math.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/math.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/max.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/max.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/max.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/max.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/maxBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/maxBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/maxBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/maxBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/mean.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/mean.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/mean.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/mean.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/meanBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/meanBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/meanBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/meanBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/memoize.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/memoize.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/memoize.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/memoize.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/merge.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/merge.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/merge.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/merge.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/mergeAll.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/mergeAll.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/mergeAll.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/mergeAll.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/mergeAllWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/mergeAllWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/mergeAllWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/mergeAllWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/mergeWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/mergeWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/mergeWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/mergeWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/method.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/method.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/method.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/method.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/methodOf.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/methodOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/methodOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/methodOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/min.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/min.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/min.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/min.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/minBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/minBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/minBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/minBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/mixin.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/mixin.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/mixin.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/mixin.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/multiply.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/multiply.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/multiply.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/multiply.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/nAry.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/nAry.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/nAry.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/nAry.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/negate.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/negate.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/negate.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/negate.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/next.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/next.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/next.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/next.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/noop.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/noop.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/noop.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/noop.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/now.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/now.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/now.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/now.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/nth.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/nth.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/nth.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/nth.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/nthArg.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/nthArg.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/nthArg.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/nthArg.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/number.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/number.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/number.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/number.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/object.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/object.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/object.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/object.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/omit.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/omit.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/omit.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/omit.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/omitAll.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/omitAll.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/omitAll.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/omitAll.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/omitBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/omitBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/omitBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/omitBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/once.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/once.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/once.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/once.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/orderBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/orderBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/orderBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/orderBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/over.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/over.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/over.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/over.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/overArgs.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/overArgs.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/overArgs.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/overArgs.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/overEvery.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/overEvery.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/overEvery.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/overEvery.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/overSome.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/overSome.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/overSome.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/overSome.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/pad.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/pad.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/pad.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/pad.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/padChars.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/padChars.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/padChars.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/padChars.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/padCharsEnd.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/padCharsEnd.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/padCharsEnd.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/padCharsEnd.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/padCharsStart.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/padCharsStart.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/padCharsStart.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/padCharsStart.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/padEnd.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/padEnd.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/padEnd.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/padEnd.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/padStart.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/padStart.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/padStart.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/padStart.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/parseInt.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/parseInt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/parseInt.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/parseInt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/partial.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/partial.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/partial.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/partial.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/partialRight.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/partialRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/partialRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/partialRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/partition.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/partition.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/partition.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/partition.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/path.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/path.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/path.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/path.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/pathEq.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/pathEq.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/pathEq.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/pathEq.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/pathOr.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/pathOr.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/pathOr.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/pathOr.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/paths.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/paths.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/paths.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/paths.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/pick.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/pick.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/pick.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/pick.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/pickAll.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/pickAll.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/pickAll.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/pickAll.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/pickBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/pickBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/pickBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/pickBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/pipe.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/pipe.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/pipe.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/pipe.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/placeholder.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/placeholder.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/placeholder.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/placeholder.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/plant.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/plant.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/plant.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/plant.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/pluck.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/pluck.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/pluck.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/pluck.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/prop.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/prop.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/prop.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/prop.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/propEq.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/propEq.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/propEq.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/propEq.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/propOr.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/propOr.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/propOr.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/propOr.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/property.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/property.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/property.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/property.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/propertyOf.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/propertyOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/propertyOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/propertyOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/props.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/props.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/props.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/props.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/pull.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/pull.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/pull.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/pull.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/pullAll.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/pullAll.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/pullAll.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/pullAll.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/pullAllBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/pullAllBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/pullAllBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/pullAllBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/pullAllWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/pullAllWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/pullAllWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/pullAllWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/pullAt.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/pullAt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/pullAt.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/pullAt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/random.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/random.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/random.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/random.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/range.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/range.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/range.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/range.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/rangeRight.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/rangeRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/rangeRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/rangeRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/rangeStep.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/rangeStep.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/rangeStep.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/rangeStep.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/rangeStepRight.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/rangeStepRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/rangeStepRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/rangeStepRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/rearg.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/rearg.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/rearg.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/rearg.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/reduce.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/reduce.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/reduce.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/reduce.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/reduceRight.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/reduceRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/reduceRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/reduceRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/reject.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/reject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/reject.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/reject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/remove.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/remove.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/remove.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/remove.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/repeat.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/repeat.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/repeat.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/repeat.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/replace.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/replace.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/replace.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/replace.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/rest.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/rest.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/rest.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/rest.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/restFrom.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/restFrom.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/restFrom.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/restFrom.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/result.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/result.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/result.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/result.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/reverse.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/reverse.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/reverse.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/reverse.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/round.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/round.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/round.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/round.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/sample.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/sample.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/sample.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/sample.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/sampleSize.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/sampleSize.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/sampleSize.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/sampleSize.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/seq.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/seq.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/seq.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/seq.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/set.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/set.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/set.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/set.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/setWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/setWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/setWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/setWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/shuffle.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/shuffle.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/shuffle.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/shuffle.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/size.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/size.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/size.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/size.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/slice.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/slice.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/slice.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/slice.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/snakeCase.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/snakeCase.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/snakeCase.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/snakeCase.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/some.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/some.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/some.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/some.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/sortBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/sortBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/sortBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/sortBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/sortedIndex.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/sortedIndex.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/sortedIndex.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/sortedIndex.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/sortedIndexBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/sortedIndexBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/sortedIndexBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/sortedIndexBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/sortedIndexOf.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/sortedIndexOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/sortedIndexOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/sortedIndexOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/sortedLastIndex.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/sortedLastIndex.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/sortedLastIndex.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/sortedLastIndex.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/sortedLastIndexBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/sortedLastIndexBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/sortedLastIndexBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/sortedLastIndexBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/sortedLastIndexOf.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/sortedLastIndexOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/sortedLastIndexOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/sortedLastIndexOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/sortedUniq.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/sortedUniq.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/sortedUniq.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/sortedUniq.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/sortedUniqBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/sortedUniqBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/sortedUniqBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/sortedUniqBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/split.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/split.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/split.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/split.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/spread.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/spread.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/spread.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/spread.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/spreadFrom.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/spreadFrom.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/spreadFrom.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/spreadFrom.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/startCase.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/startCase.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/startCase.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/startCase.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/startsWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/startsWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/startsWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/startsWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/string.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/string.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/string.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/string.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/stubArray.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/stubArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/stubArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/stubArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/stubFalse.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/stubFalse.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/stubFalse.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/stubFalse.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/stubObject.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/stubObject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/stubObject.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/stubObject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/stubString.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/stubString.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/stubString.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/stubString.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/stubTrue.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/stubTrue.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/stubTrue.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/stubTrue.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/subtract.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/subtract.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/subtract.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/subtract.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/sum.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/sum.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/sum.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/sum.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/sumBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/sumBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/sumBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/sumBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/symmetricDifference.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/symmetricDifference.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/symmetricDifference.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/symmetricDifference.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/symmetricDifferenceBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/symmetricDifferenceBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/symmetricDifferenceBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/symmetricDifferenceBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/symmetricDifferenceWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/symmetricDifferenceWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/symmetricDifferenceWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/symmetricDifferenceWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/tail.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/tail.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/tail.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/tail.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/take.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/take.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/take.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/take.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/takeLast.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/takeLast.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/takeLast.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/takeLast.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/takeLastWhile.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/takeLastWhile.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/takeLastWhile.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/takeLastWhile.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/takeRight.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/takeRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/takeRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/takeRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/takeRightWhile.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/takeRightWhile.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/takeRightWhile.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/takeRightWhile.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/takeWhile.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/takeWhile.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/takeWhile.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/takeWhile.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/tap.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/tap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/tap.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/tap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/template.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/template.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/template.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/template.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/templateSettings.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/templateSettings.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/templateSettings.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/templateSettings.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/throttle.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/throttle.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/throttle.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/throttle.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/thru.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/thru.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/thru.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/thru.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/times.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/times.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/times.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/times.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/toArray.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/toArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/toArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/toArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/toFinite.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/toFinite.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/toFinite.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/toFinite.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/toInteger.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/toInteger.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/toInteger.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/toInteger.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/toIterator.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/toIterator.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/toIterator.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/toIterator.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/toJSON.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/toJSON.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/toJSON.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/toJSON.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/toLength.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/toLength.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/toLength.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/toLength.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/toLower.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/toLower.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/toLower.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/toLower.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/toNumber.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/toNumber.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/toNumber.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/toNumber.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/toPairs.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/toPairs.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/toPairs.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/toPairs.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/toPairsIn.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/toPairsIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/toPairsIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/toPairsIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/toPath.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/toPath.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/toPath.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/toPath.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/toPlainObject.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/toPlainObject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/toPlainObject.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/toPlainObject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/toSafeInteger.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/toSafeInteger.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/toSafeInteger.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/toSafeInteger.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/toString.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/toString.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/toString.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/toString.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/toUpper.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/toUpper.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/toUpper.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/toUpper.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/transform.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/transform.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/transform.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/transform.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/trim.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/trim.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/trim.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/trim.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/trimChars.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/trimChars.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/trimChars.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/trimChars.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/trimCharsEnd.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/trimCharsEnd.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/trimCharsEnd.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/trimCharsEnd.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/trimCharsStart.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/trimCharsStart.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/trimCharsStart.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/trimCharsStart.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/trimEnd.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/trimEnd.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/trimEnd.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/trimEnd.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/trimStart.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/trimStart.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/trimStart.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/trimStart.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/truncate.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/truncate.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/truncate.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/truncate.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/unapply.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/unapply.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/unapply.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/unapply.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/unary.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/unary.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/unary.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/unary.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/unescape.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/unescape.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/unescape.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/unescape.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/union.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/union.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/union.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/union.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/unionBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/unionBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/unionBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/unionBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/unionWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/unionWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/unionWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/unionWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/uniq.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/uniq.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/uniq.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/uniq.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/uniqBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/uniqBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/uniqBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/uniqBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/uniqWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/uniqWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/uniqWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/uniqWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/uniqueId.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/uniqueId.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/uniqueId.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/uniqueId.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/unnest.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/unnest.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/unnest.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/unnest.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/unset.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/unset.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/unset.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/unset.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/unzip.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/unzip.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/unzip.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/unzip.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/unzipWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/unzipWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/unzipWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/unzipWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/update.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/update.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/update.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/update.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/updateWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/updateWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/updateWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/updateWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/upperCase.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/upperCase.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/upperCase.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/upperCase.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/upperFirst.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/upperFirst.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/upperFirst.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/upperFirst.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/useWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/useWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/useWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/useWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/util.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/util.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/util.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/util.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/value.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/value.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/value.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/value.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/valueOf.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/valueOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/valueOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/valueOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/values.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/values.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/values.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/values.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/valuesIn.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/valuesIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/valuesIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/valuesIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/where.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/where.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/where.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/where.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/whereEq.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/whereEq.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/whereEq.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/whereEq.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/without.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/without.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/without.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/without.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/words.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/words.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/words.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/words.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/wrap.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/wrap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/wrap.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/wrap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/wrapperAt.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/wrapperAt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/wrapperAt.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/wrapperAt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/wrapperChain.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/wrapperChain.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/wrapperChain.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/wrapperChain.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/wrapperLodash.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/wrapperLodash.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/wrapperLodash.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/wrapperLodash.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/wrapperReverse.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/wrapperReverse.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/wrapperReverse.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/wrapperReverse.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/wrapperValue.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/wrapperValue.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/wrapperValue.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/wrapperValue.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/xor.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/xor.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/xor.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/xor.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/xorBy.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/xorBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/xorBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/xorBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/xorWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/xorWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/xorWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/xorWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/zip.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/zip.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/zip.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/zip.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/zipAll.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/zipAll.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/zipAll.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/zipAll.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/zipObj.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/zipObj.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/zipObj.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/zipObj.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/zipObject.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/zipObject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/zipObject.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/zipObject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/zipObjectDeep.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/zipObjectDeep.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/zipObjectDeep.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/zipObjectDeep.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fp/zipWith.js b/tools/node_modules/@babel/core/node_modules/lodash/fp/zipWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fp/zipWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/fp/zipWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/fromPairs.js b/tools/node_modules/@babel/core/node_modules/lodash/fromPairs.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/fromPairs.js rename to tools/node_modules/@babel/core/node_modules/lodash/fromPairs.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/function.js b/tools/node_modules/@babel/core/node_modules/lodash/function.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/function.js rename to tools/node_modules/@babel/core/node_modules/lodash/function.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/functions.js b/tools/node_modules/@babel/core/node_modules/lodash/functions.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/functions.js rename to tools/node_modules/@babel/core/node_modules/lodash/functions.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/functionsIn.js b/tools/node_modules/@babel/core/node_modules/lodash/functionsIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/functionsIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/functionsIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/get.js b/tools/node_modules/@babel/core/node_modules/lodash/get.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/get.js rename to tools/node_modules/@babel/core/node_modules/lodash/get.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/groupBy.js b/tools/node_modules/@babel/core/node_modules/lodash/groupBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/groupBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/groupBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/gt.js b/tools/node_modules/@babel/core/node_modules/lodash/gt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/gt.js rename to tools/node_modules/@babel/core/node_modules/lodash/gt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/gte.js b/tools/node_modules/@babel/core/node_modules/lodash/gte.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/gte.js rename to tools/node_modules/@babel/core/node_modules/lodash/gte.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/has.js b/tools/node_modules/@babel/core/node_modules/lodash/has.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/has.js rename to tools/node_modules/@babel/core/node_modules/lodash/has.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/hasIn.js b/tools/node_modules/@babel/core/node_modules/lodash/hasIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/hasIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/hasIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/head.js b/tools/node_modules/@babel/core/node_modules/lodash/head.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/head.js rename to tools/node_modules/@babel/core/node_modules/lodash/head.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/identity.js b/tools/node_modules/@babel/core/node_modules/lodash/identity.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/identity.js rename to tools/node_modules/@babel/core/node_modules/lodash/identity.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/inRange.js b/tools/node_modules/@babel/core/node_modules/lodash/inRange.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/inRange.js rename to tools/node_modules/@babel/core/node_modules/lodash/inRange.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/includes.js b/tools/node_modules/@babel/core/node_modules/lodash/includes.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/includes.js rename to tools/node_modules/@babel/core/node_modules/lodash/includes.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/index.js b/tools/node_modules/@babel/core/node_modules/lodash/index.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/index.js rename to tools/node_modules/@babel/core/node_modules/lodash/index.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/indexOf.js b/tools/node_modules/@babel/core/node_modules/lodash/indexOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/indexOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/indexOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/initial.js b/tools/node_modules/@babel/core/node_modules/lodash/initial.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/initial.js rename to tools/node_modules/@babel/core/node_modules/lodash/initial.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/intersection.js b/tools/node_modules/@babel/core/node_modules/lodash/intersection.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/intersection.js rename to tools/node_modules/@babel/core/node_modules/lodash/intersection.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/intersectionBy.js b/tools/node_modules/@babel/core/node_modules/lodash/intersectionBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/intersectionBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/intersectionBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/intersectionWith.js b/tools/node_modules/@babel/core/node_modules/lodash/intersectionWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/intersectionWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/intersectionWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/invert.js b/tools/node_modules/@babel/core/node_modules/lodash/invert.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/invert.js rename to tools/node_modules/@babel/core/node_modules/lodash/invert.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/invertBy.js b/tools/node_modules/@babel/core/node_modules/lodash/invertBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/invertBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/invertBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/invoke.js b/tools/node_modules/@babel/core/node_modules/lodash/invoke.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/invoke.js rename to tools/node_modules/@babel/core/node_modules/lodash/invoke.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/invokeMap.js b/tools/node_modules/@babel/core/node_modules/lodash/invokeMap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/invokeMap.js rename to tools/node_modules/@babel/core/node_modules/lodash/invokeMap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isArguments.js b/tools/node_modules/@babel/core/node_modules/lodash/isArguments.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isArguments.js rename to tools/node_modules/@babel/core/node_modules/lodash/isArguments.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isArray.js b/tools/node_modules/@babel/core/node_modules/lodash/isArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/isArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isArrayBuffer.js b/tools/node_modules/@babel/core/node_modules/lodash/isArrayBuffer.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isArrayBuffer.js rename to tools/node_modules/@babel/core/node_modules/lodash/isArrayBuffer.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isArrayLike.js b/tools/node_modules/@babel/core/node_modules/lodash/isArrayLike.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isArrayLike.js rename to tools/node_modules/@babel/core/node_modules/lodash/isArrayLike.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isArrayLikeObject.js b/tools/node_modules/@babel/core/node_modules/lodash/isArrayLikeObject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isArrayLikeObject.js rename to tools/node_modules/@babel/core/node_modules/lodash/isArrayLikeObject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isBoolean.js b/tools/node_modules/@babel/core/node_modules/lodash/isBoolean.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isBoolean.js rename to tools/node_modules/@babel/core/node_modules/lodash/isBoolean.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isBuffer.js b/tools/node_modules/@babel/core/node_modules/lodash/isBuffer.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isBuffer.js rename to tools/node_modules/@babel/core/node_modules/lodash/isBuffer.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isDate.js b/tools/node_modules/@babel/core/node_modules/lodash/isDate.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isDate.js rename to tools/node_modules/@babel/core/node_modules/lodash/isDate.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isElement.js b/tools/node_modules/@babel/core/node_modules/lodash/isElement.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isElement.js rename to tools/node_modules/@babel/core/node_modules/lodash/isElement.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isEmpty.js b/tools/node_modules/@babel/core/node_modules/lodash/isEmpty.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isEmpty.js rename to tools/node_modules/@babel/core/node_modules/lodash/isEmpty.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isEqual.js b/tools/node_modules/@babel/core/node_modules/lodash/isEqual.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isEqual.js rename to tools/node_modules/@babel/core/node_modules/lodash/isEqual.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isEqualWith.js b/tools/node_modules/@babel/core/node_modules/lodash/isEqualWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isEqualWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/isEqualWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isError.js b/tools/node_modules/@babel/core/node_modules/lodash/isError.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isError.js rename to tools/node_modules/@babel/core/node_modules/lodash/isError.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isFinite.js b/tools/node_modules/@babel/core/node_modules/lodash/isFinite.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isFinite.js rename to tools/node_modules/@babel/core/node_modules/lodash/isFinite.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isFunction.js b/tools/node_modules/@babel/core/node_modules/lodash/isFunction.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isFunction.js rename to tools/node_modules/@babel/core/node_modules/lodash/isFunction.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isInteger.js b/tools/node_modules/@babel/core/node_modules/lodash/isInteger.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isInteger.js rename to tools/node_modules/@babel/core/node_modules/lodash/isInteger.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isLength.js b/tools/node_modules/@babel/core/node_modules/lodash/isLength.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isLength.js rename to tools/node_modules/@babel/core/node_modules/lodash/isLength.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isMap.js b/tools/node_modules/@babel/core/node_modules/lodash/isMap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isMap.js rename to tools/node_modules/@babel/core/node_modules/lodash/isMap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isMatch.js b/tools/node_modules/@babel/core/node_modules/lodash/isMatch.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isMatch.js rename to tools/node_modules/@babel/core/node_modules/lodash/isMatch.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isMatchWith.js b/tools/node_modules/@babel/core/node_modules/lodash/isMatchWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isMatchWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/isMatchWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isNaN.js b/tools/node_modules/@babel/core/node_modules/lodash/isNaN.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isNaN.js rename to tools/node_modules/@babel/core/node_modules/lodash/isNaN.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isNative.js b/tools/node_modules/@babel/core/node_modules/lodash/isNative.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isNative.js rename to tools/node_modules/@babel/core/node_modules/lodash/isNative.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isNil.js b/tools/node_modules/@babel/core/node_modules/lodash/isNil.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isNil.js rename to tools/node_modules/@babel/core/node_modules/lodash/isNil.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isNull.js b/tools/node_modules/@babel/core/node_modules/lodash/isNull.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isNull.js rename to tools/node_modules/@babel/core/node_modules/lodash/isNull.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isNumber.js b/tools/node_modules/@babel/core/node_modules/lodash/isNumber.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isNumber.js rename to tools/node_modules/@babel/core/node_modules/lodash/isNumber.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isObject.js b/tools/node_modules/@babel/core/node_modules/lodash/isObject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isObject.js rename to tools/node_modules/@babel/core/node_modules/lodash/isObject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isObjectLike.js b/tools/node_modules/@babel/core/node_modules/lodash/isObjectLike.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isObjectLike.js rename to tools/node_modules/@babel/core/node_modules/lodash/isObjectLike.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isPlainObject.js b/tools/node_modules/@babel/core/node_modules/lodash/isPlainObject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isPlainObject.js rename to tools/node_modules/@babel/core/node_modules/lodash/isPlainObject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isRegExp.js b/tools/node_modules/@babel/core/node_modules/lodash/isRegExp.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isRegExp.js rename to tools/node_modules/@babel/core/node_modules/lodash/isRegExp.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isSafeInteger.js b/tools/node_modules/@babel/core/node_modules/lodash/isSafeInteger.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isSafeInteger.js rename to tools/node_modules/@babel/core/node_modules/lodash/isSafeInteger.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isSet.js b/tools/node_modules/@babel/core/node_modules/lodash/isSet.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isSet.js rename to tools/node_modules/@babel/core/node_modules/lodash/isSet.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isString.js b/tools/node_modules/@babel/core/node_modules/lodash/isString.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isString.js rename to tools/node_modules/@babel/core/node_modules/lodash/isString.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isSymbol.js b/tools/node_modules/@babel/core/node_modules/lodash/isSymbol.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isSymbol.js rename to tools/node_modules/@babel/core/node_modules/lodash/isSymbol.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isTypedArray.js b/tools/node_modules/@babel/core/node_modules/lodash/isTypedArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isTypedArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/isTypedArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isUndefined.js b/tools/node_modules/@babel/core/node_modules/lodash/isUndefined.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isUndefined.js rename to tools/node_modules/@babel/core/node_modules/lodash/isUndefined.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isWeakMap.js b/tools/node_modules/@babel/core/node_modules/lodash/isWeakMap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isWeakMap.js rename to tools/node_modules/@babel/core/node_modules/lodash/isWeakMap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/isWeakSet.js b/tools/node_modules/@babel/core/node_modules/lodash/isWeakSet.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/isWeakSet.js rename to tools/node_modules/@babel/core/node_modules/lodash/isWeakSet.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/iteratee.js b/tools/node_modules/@babel/core/node_modules/lodash/iteratee.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/iteratee.js rename to tools/node_modules/@babel/core/node_modules/lodash/iteratee.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/join.js b/tools/node_modules/@babel/core/node_modules/lodash/join.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/join.js rename to tools/node_modules/@babel/core/node_modules/lodash/join.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/kebabCase.js b/tools/node_modules/@babel/core/node_modules/lodash/kebabCase.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/kebabCase.js rename to tools/node_modules/@babel/core/node_modules/lodash/kebabCase.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/keyBy.js b/tools/node_modules/@babel/core/node_modules/lodash/keyBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/keyBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/keyBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/keys.js b/tools/node_modules/@babel/core/node_modules/lodash/keys.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/keys.js rename to tools/node_modules/@babel/core/node_modules/lodash/keys.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/keysIn.js b/tools/node_modules/@babel/core/node_modules/lodash/keysIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/keysIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/keysIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/lang.js b/tools/node_modules/@babel/core/node_modules/lodash/lang.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/lang.js rename to tools/node_modules/@babel/core/node_modules/lodash/lang.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/last.js b/tools/node_modules/@babel/core/node_modules/lodash/last.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/last.js rename to tools/node_modules/@babel/core/node_modules/lodash/last.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/lastIndexOf.js b/tools/node_modules/@babel/core/node_modules/lodash/lastIndexOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/lastIndexOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/lastIndexOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/lodash.js b/tools/node_modules/@babel/core/node_modules/lodash/lodash.js similarity index 99% rename from tools/node_modules/babel-eslint/node_modules/lodash/lodash.js rename to tools/node_modules/@babel/core/node_modules/lodash/lodash.js index 9b95dfefe87f73..1fd7116f426a28 100644 --- a/tools/node_modules/babel-eslint/node_modules/lodash/lodash.js +++ b/tools/node_modules/@babel/core/node_modules/lodash/lodash.js @@ -12,7 +12,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.17.15'; + var VERSION = '4.17.20'; /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; @@ -3719,8 +3719,21 @@ * @returns {Array} Returns the new sorted array. */ function baseOrderBy(collection, iteratees, orders) { + if (iteratees.length) { + iteratees = arrayMap(iteratees, function(iteratee) { + if (isArray(iteratee)) { + return function(value) { + return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); + } + } + return iteratee; + }); + } else { + iteratees = [identity]; + } + var index = -1; - iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee())); + iteratees = arrayMap(iteratees, baseUnary(getIteratee())); var result = baseMap(collection, function(value, key, collection) { var criteria = arrayMap(iteratees, function(iteratee) { @@ -3977,6 +3990,10 @@ var key = toKey(path[index]), newValue = value; + if (key === '__proto__' || key === 'constructor' || key === 'prototype') { + return object; + } + if (index != lastIndex) { var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined; @@ -4129,11 +4146,14 @@ * into `array`. */ function baseSortedIndexBy(array, value, iteratee, retHighest) { - value = iteratee(value); - var low = 0, - high = array == null ? 0 : array.length, - valIsNaN = value !== value, + high = array == null ? 0 : array.length; + if (high === 0) { + return 0; + } + + value = iteratee(value); + var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined; @@ -5618,10 +5638,11 @@ if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } - // Assume cyclic values are equal. - var stacked = stack.get(array); - if (stacked && stack.get(other)) { - return stacked == other; + // Check that cyclic values are equal. + var arrStacked = stack.get(array); + var othStacked = stack.get(other); + if (arrStacked && othStacked) { + return arrStacked == other && othStacked == array; } var index = -1, result = true, @@ -5783,10 +5804,11 @@ return false; } } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked && stack.get(other)) { - return stacked == other; + // Check that cyclic values are equal. + var objStacked = stack.get(object); + var othStacked = stack.get(other); + if (objStacked && othStacked) { + return objStacked == other && othStacked == object; } var result = true; stack.set(object, other); @@ -9167,6 +9189,10 @@ * // The `_.property` iteratee shorthand. * _.filter(users, 'active'); * // => objects for ['barney'] + * + * // Combining several predicates using `_.overEvery` or `_.overSome`. + * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); + * // => objects for ['fred', 'barney'] */ function filter(collection, predicate) { var func = isArray(collection) ? arrayFilter : baseFilter; @@ -9916,15 +9942,15 @@ * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, + * { 'user': 'fred', 'age': 30 }, * { 'user': 'barney', 'age': 34 } * ]; * * _.sortBy(users, [function(o) { return o.user; }]); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] * * _.sortBy(users, ['user', 'age']); - * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] + * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] */ var sortBy = baseRest(function(collection, iteratees) { if (collection == null) { @@ -14799,11 +14825,11 @@ // Use a sourceURL for easier debugging. // The sourceURL gets injected into the source that's eval-ed, so be careful - // with lookup (in case of e.g. prototype pollution), and strip newlines if any. - // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection. + // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in + // and escape the comment, thus injecting code that gets evaled. var sourceURL = '//# sourceURL=' + (hasOwnProperty.call(options, 'sourceURL') - ? (options.sourceURL + '').replace(/[\r\n]/g, ' ') + ? (options.sourceURL + '').replace(/\s/g, ' ') : ('lodash.templateSources[' + (++templateCounter) + ']') ) + '\n'; @@ -14836,8 +14862,6 @@ // If `variable` is not specified wrap a with-statement around the generated // code to add the data object to the top of the scope chain. - // Like with sourceURL, we take care to not check the option's prototype, - // as this configuration is a code injection vector. var variable = hasOwnProperty.call(options, 'variable') && options.variable; if (!variable) { source = 'with (obj) {\n' + source + '\n}\n'; @@ -15544,6 +15568,9 @@ * values against any array or object value, respectively. See `_.isEqual` * for a list of supported value comparisons. * + * **Note:** Multiple values can be checked by combining several matchers + * using `_.overSome` + * * @static * @memberOf _ * @since 3.0.0 @@ -15559,6 +15586,10 @@ * * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); * // => [{ 'a': 4, 'b': 5, 'c': 6 }] + * + * // Checking for several possible values + * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); + * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matches(source) { return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); @@ -15573,6 +15604,9 @@ * `srcValue` values against any array or object value, respectively. See * `_.isEqual` for a list of supported value comparisons. * + * **Note:** Multiple values can be checked by combining several matchers + * using `_.overSome` + * * @static * @memberOf _ * @since 3.2.0 @@ -15589,6 +15623,10 @@ * * _.find(objects, _.matchesProperty('a', 4)); * // => { 'a': 4, 'b': 5, 'c': 6 } + * + * // Checking for several possible values + * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)])); + * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matchesProperty(path, srcValue) { return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); @@ -15812,6 +15850,10 @@ * Creates a function that checks if **all** of the `predicates` return * truthy when invoked with the arguments it receives. * + * Following shorthands are possible for providing predicates. + * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. + * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. + * * @static * @memberOf _ * @since 4.0.0 @@ -15838,6 +15880,10 @@ * Creates a function that checks if **any** of the `predicates` return * truthy when invoked with the arguments it receives. * + * Following shorthands are possible for providing predicates. + * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. + * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. + * * @static * @memberOf _ * @since 4.0.0 @@ -15857,6 +15903,9 @@ * * func(NaN); * // => false + * + * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }]) + * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]]) */ var overSome = createOver(arraySome); diff --git a/tools/node_modules/@babel/core/node_modules/lodash/lodash.min.js b/tools/node_modules/@babel/core/node_modules/lodash/lodash.min.js new file mode 100644 index 00000000000000..a078dd9317619a --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/lodash/lodash.min.js @@ -0,0 +1,139 @@ +/** + * @license + * Lodash + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ +(function(){function n(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u-1}function f(n,t,r){for(var e=-1,u=null==n?0:n.length;++e-1;);return r}function W(n,t){for(var r=n.length;r--&&y(t,n[r],0)>-1;);return r}function L(n,t){for(var r=n.length,e=0;r--;)n[r]===t&&++e;return e}function C(n){return"\\"+Gr[n]}function U(n,t){ +return null==n?Y:n[t]}function B(n){return Dr.test(n)}function T(n){return Mr.test(n)}function $(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function D(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function M(n,t){return function(r){return n(t(r))}}function F(n,t){for(var r=-1,e=n.length,u=0,i=[];++r>>1,Un=[["ary",dn],["bind",sn],["bindKey",hn],["curry",_n],["curryRight",vn],["flip",wn],["partial",gn],["partialRight",yn],["rearg",bn]],Bn="[object Arguments]",Tn="[object Array]",$n="[object AsyncFunction]",Dn="[object Boolean]",Mn="[object Date]",Fn="[object DOMException]",Nn="[object Error]",Pn="[object Function]",qn="[object GeneratorFunction]",Zn="[object Map]",Kn="[object Number]",Vn="[object Null]",Gn="[object Object]",Hn="[object Promise]",Jn="[object Proxy]",Yn="[object RegExp]",Qn="[object Set]",Xn="[object String]",nt="[object Symbol]",tt="[object Undefined]",rt="[object WeakMap]",et="[object WeakSet]",ut="[object ArrayBuffer]",it="[object DataView]",ot="[object Float32Array]",ft="[object Float64Array]",ct="[object Int8Array]",at="[object Int16Array]",lt="[object Int32Array]",st="[object Uint8Array]",ht="[object Uint8ClampedArray]",pt="[object Uint16Array]",_t="[object Uint32Array]",vt=/\b__p \+= '';/g,gt=/\b(__p \+=) '' \+/g,yt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,dt=/&(?:amp|lt|gt|quot|#39);/g,bt=/[&<>"']/g,wt=RegExp(dt.source),mt=RegExp(bt.source),xt=/<%-([\s\S]+?)%>/g,jt=/<%([\s\S]+?)%>/g,At=/<%=([\s\S]+?)%>/g,kt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ot=/^\w*$/,It=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Rt=/[\\^$.*+?()[\]{}|]/g,zt=RegExp(Rt.source),Et=/^\s+|\s+$/g,St=/^\s+/,Wt=/\s+$/,Lt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ct=/\{\n\/\* \[wrapped with (.+)\] \*/,Ut=/,? & /,Bt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Tt=/\\(\\)?/g,$t=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Dt=/\w*$/,Mt=/^[-+]0x[0-9a-f]+$/i,Ft=/^0b[01]+$/i,Nt=/^\[object .+?Constructor\]$/,Pt=/^0o[0-7]+$/i,qt=/^(?:0|[1-9]\d*)$/,Zt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Kt=/($^)/,Vt=/['\n\r\u2028\u2029\\]/g,Gt="\\ud800-\\udfff",Ht="\\u0300-\\u036f",Jt="\\ufe20-\\ufe2f",Yt="\\u20d0-\\u20ff",Qt=Ht+Jt+Yt,Xt="\\u2700-\\u27bf",nr="a-z\\xdf-\\xf6\\xf8-\\xff",tr="\\xac\\xb1\\xd7\\xf7",rr="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",er="\\u2000-\\u206f",ur=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ir="A-Z\\xc0-\\xd6\\xd8-\\xde",or="\\ufe0e\\ufe0f",fr=tr+rr+er+ur,cr="['\u2019]",ar="["+Gt+"]",lr="["+fr+"]",sr="["+Qt+"]",hr="\\d+",pr="["+Xt+"]",_r="["+nr+"]",vr="[^"+Gt+fr+hr+Xt+nr+ir+"]",gr="\\ud83c[\\udffb-\\udfff]",yr="(?:"+sr+"|"+gr+")",dr="[^"+Gt+"]",br="(?:\\ud83c[\\udde6-\\uddff]){2}",wr="[\\ud800-\\udbff][\\udc00-\\udfff]",mr="["+ir+"]",xr="\\u200d",jr="(?:"+_r+"|"+vr+")",Ar="(?:"+mr+"|"+vr+")",kr="(?:"+cr+"(?:d|ll|m|re|s|t|ve))?",Or="(?:"+cr+"(?:D|LL|M|RE|S|T|VE))?",Ir=yr+"?",Rr="["+or+"]?",zr="(?:"+xr+"(?:"+[dr,br,wr].join("|")+")"+Rr+Ir+")*",Er="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Sr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Wr=Rr+Ir+zr,Lr="(?:"+[pr,br,wr].join("|")+")"+Wr,Cr="(?:"+[dr+sr+"?",sr,br,wr,ar].join("|")+")",Ur=RegExp(cr,"g"),Br=RegExp(sr,"g"),Tr=RegExp(gr+"(?="+gr+")|"+Cr+Wr,"g"),$r=RegExp([mr+"?"+_r+"+"+kr+"(?="+[lr,mr,"$"].join("|")+")",Ar+"+"+Or+"(?="+[lr,mr+jr,"$"].join("|")+")",mr+"?"+jr+"+"+kr,mr+"+"+Or,Sr,Er,hr,Lr].join("|"),"g"),Dr=RegExp("["+xr+Gt+Qt+or+"]"),Mr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Fr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Nr=-1,Pr={}; +Pr[ot]=Pr[ft]=Pr[ct]=Pr[at]=Pr[lt]=Pr[st]=Pr[ht]=Pr[pt]=Pr[_t]=!0,Pr[Bn]=Pr[Tn]=Pr[ut]=Pr[Dn]=Pr[it]=Pr[Mn]=Pr[Nn]=Pr[Pn]=Pr[Zn]=Pr[Kn]=Pr[Gn]=Pr[Yn]=Pr[Qn]=Pr[Xn]=Pr[rt]=!1;var qr={};qr[Bn]=qr[Tn]=qr[ut]=qr[it]=qr[Dn]=qr[Mn]=qr[ot]=qr[ft]=qr[ct]=qr[at]=qr[lt]=qr[Zn]=qr[Kn]=qr[Gn]=qr[Yn]=qr[Qn]=qr[Xn]=qr[nt]=qr[st]=qr[ht]=qr[pt]=qr[_t]=!0,qr[Nn]=qr[Pn]=qr[rt]=!1;var Zr={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a", +"\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae", +"\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g", +"\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O", +"\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w", +"\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"},Kr={"&":"&","<":"<",">":">",'"':""","'":"'"},Vr={"&":"&","<":"<",">":">",""":'"',"'":"'"},Gr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Hr=parseFloat,Jr=parseInt,Yr="object"==typeof global&&global&&global.Object===Object&&global,Qr="object"==typeof self&&self&&self.Object===Object&&self,Xr=Yr||Qr||Function("return this")(),ne="object"==typeof exports&&exports&&!exports.nodeType&&exports,te=ne&&"object"==typeof module&&module&&!module.nodeType&&module,re=te&&te.exports===ne,ee=re&&Yr.process,ue=function(){ +try{var n=te&&te.require&&te.require("util").types;return n?n:ee&&ee.binding&&ee.binding("util")}catch(n){}}(),ie=ue&&ue.isArrayBuffer,oe=ue&&ue.isDate,fe=ue&&ue.isMap,ce=ue&&ue.isRegExp,ae=ue&&ue.isSet,le=ue&&ue.isTypedArray,se=m("length"),he=x(Zr),pe=x(Kr),_e=x(Vr),ve=function p(x){function q(n){if(oc(n)&&!yh(n)&&!(n instanceof Bt)){if(n instanceof H)return n;if(yl.call(n,"__wrapped__"))return to(n)}return new H(n)}function G(){}function H(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t, +this.__index__=0,this.__values__=Y}function Bt(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Wn,this.__views__=[]}function Gt(){var n=new Bt(this.__wrapped__);return n.__actions__=Uu(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Uu(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Uu(this.__views__),n}function Ht(){if(this.__filtered__){var n=new Bt(this);n.__dir__=-1, +n.__filtered__=!0}else n=this.clone(),n.__dir__*=-1;return n}function Jt(){var n=this.__wrapped__.value(),t=this.__dir__,r=yh(n),e=t<0,u=r?n.length:0,i=Ai(0,u,this.__views__),o=i.start,f=i.end,c=f-o,a=e?f:o-1,l=this.__iteratees__,s=l.length,h=0,p=Vl(c,this.__takeCount__);if(!r||!e&&u==c&&p==c)return du(n,this.__actions__);var _=[];n:for(;c--&&h-1}function cr(n,t){var r=this.__data__,e=Er(r,n);return e<0?(++this.size,r.push([n,t])):r[e][1]=t,this}function ar(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t=t?n:t)),n}function Dr(n,t,e,u,i,o){var f,c=t&on,a=t&fn,l=t&cn;if(e&&(f=i?e(n,u,i,o):e(n)),f!==Y)return f;if(!ic(n))return n;var s=yh(n);if(s){if(f=Ii(n),!c)return Uu(n,f)}else{var h=Is(n),p=h==Pn||h==qn;if(bh(n))return ku(n,c);if(h==Gn||h==Bn||p&&!i){if(f=a||p?{}:Ri(n),!c)return a?$u(n,Lr(f,n)):Tu(n,Wr(f,n))}else{if(!qr[h])return i?n:{};f=zi(n,h,c)}}o||(o=new dr);var _=o.get(n);if(_)return _;o.set(n,f),jh(n)?n.forEach(function(r){f.add(Dr(r,t,e,r,n,o))}):mh(n)&&n.forEach(function(r,u){ +f.set(u,Dr(r,t,e,u,n,o))});var v=l?a?gi:vi:a?Nc:Fc,g=s?Y:v(n);return r(g||n,function(r,u){g&&(u=r,r=n[u]),zr(f,u,Dr(r,t,e,u,n,o))}),f}function Mr(n){var t=Fc(n);return function(r){return Zr(r,n,t)}}function Zr(n,t,r){var e=r.length;if(null==n)return!e;for(n=cl(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===Y&&!(u in n)||!i(o))return!1}return!0}function Kr(n,t,r){if("function"!=typeof n)throw new sl(tn);return Es(function(){n.apply(Y,r)},t)}function Vr(n,t,r,e){var u=-1,i=o,a=!0,l=n.length,s=[],h=t.length; +if(!l)return s;r&&(t=c(t,R(r))),e?(i=f,a=!1):t.length>=X&&(i=E,a=!1,t=new vr(t));n:for(;++uu?0:u+r), +e=e===Y||e>u?u:jc(e),e<0&&(e+=u),e=r>e?0:Ac(e);r0&&r(f)?t>1?te(f,t-1,r,e,u):a(u,f):e||(u[u.length]=f)}return u}function ee(n,t){return n&&ys(n,t,Fc)}function ue(n,t){return n&&ds(n,t,Fc)}function se(n,t){return i(t,function(t){return rc(n[t])})}function ve(n,t){t=ju(t,n);for(var r=0,e=t.length;null!=n&&rt}function we(n,t){return null!=n&&yl.call(n,t)}function me(n,t){return null!=n&&t in cl(n)}function xe(n,t,r){return n>=Vl(t,r)&&n=120&&p.length>=120)?new vr(a&&p):Y}p=n[0]; +var _=-1,v=l[0];n:for(;++_-1;)f!==n&&Sl.call(f,a,1),Sl.call(n,a,1);return n}function Qe(n,t){for(var r=n?t.length:0,e=r-1;r--;){ +var u=t[r];if(r==e||u!==i){var i=u;Wi(u)?Sl.call(n,u,1):vu(n,u)}}return n}function Xe(n,t){return n+Ml(Jl()*(t-n+1))}function nu(n,t,r,e){for(var u=-1,i=Kl(Dl((t-n)/(r||1)),0),o=el(i);i--;)o[e?i:++u]=n,n+=r;return o}function tu(n,t){var r="";if(!n||t<1||t>zn)return r;do t%2&&(r+=n),t=Ml(t/2),t&&(n+=n);while(t);return r}function ru(n,t){return Ss(Zi(n,t,Sa),n+"")}function eu(n){return kr(na(n))}function uu(n,t){var r=na(n);return Yi(r,$r(t,0,r.length))}function iu(n,t,r,e){if(!ic(n))return n;t=ju(t,n); +for(var u=-1,i=t.length,o=i-1,f=n;null!=f&&++uu?0:u+t),r=r>u?u:r,r<0&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0;for(var i=el(u);++e>>1,o=n[i];null!==o&&!yc(o)&&(r?o<=t:o=X){var s=t?null:js(n);if(s)return N(s);c=!1,u=E,l=new vr}else l=t?[]:a;n:for(;++e=e?n:fu(n,t,r)}function ku(n,t){if(t)return n.slice();var r=n.length,e=Il?Il(r):new n.constructor(r); +return n.copy(e),e}function Ou(n){var t=new n.constructor(n.byteLength);return new Ol(t).set(new Ol(n)),t}function Iu(n,t){return new n.constructor(t?Ou(n.buffer):n.buffer,n.byteOffset,n.byteLength)}function Ru(n){var t=new n.constructor(n.source,Dt.exec(n));return t.lastIndex=n.lastIndex,t}function zu(n){return hs?cl(hs.call(n)):{}}function Eu(n,t){return new n.constructor(t?Ou(n.buffer):n.buffer,n.byteOffset,n.length)}function Su(n,t){if(n!==t){var r=n!==Y,e=null===n,u=n===n,i=yc(n),o=t!==Y,f=null===t,c=t===t,a=yc(t); +if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&n=f)return c;return c*("desc"==r[e]?-1:1)}}return n.index-t.index}function Lu(n,t,r,e){for(var u=-1,i=n.length,o=r.length,f=-1,c=t.length,a=Kl(i-o,0),l=el(c+a),s=!e;++f1?r[u-1]:Y,o=u>2?r[2]:Y;for(i=n.length>3&&"function"==typeof i?(u--,i):Y,o&&Li(r[0],r[1],o)&&(i=u<3?Y:i,u=1),t=cl(t);++e-1?u[i?t[o]:o]:Y}}function Hu(n){return _i(function(t){var r=t.length,e=r,u=H.prototype.thru;for(n&&t.reverse();e--;){var i=t[e];if("function"!=typeof i)throw new sl(tn);if(u&&!o&&"wrapper"==yi(i))var o=new H([],!0)}for(e=o?e:r;++e1&&d.reverse(),s&&cf))return!1;var a=i.get(n),l=i.get(t);if(a&&l)return a==t&&l==n;var s=-1,p=!0,_=r&ln?new vr:Y;for(i.set(n,t),i.set(t,n);++s1?"& ":"")+t[e],t=t.join(r>2?", ":" "),n.replace(Lt,"{\n/* [wrapped with "+t+"] */\n")}function Si(n){return yh(n)||gh(n)||!!(Wl&&n&&n[Wl])}function Wi(n,t){var r=typeof n; +return t=null==t?zn:t,!!t&&("number"==r||"symbol"!=r&&qt.test(n))&&n>-1&&n%1==0&&n0){if(++t>=jn)return arguments[0]}else t=0; +return n.apply(Y,arguments)}}function Yi(n,t){var r=-1,e=n.length,u=e-1;for(t=t===Y?e:t;++r=this.__values__.length;return{done:n,value:n?Y:this.__values__[this.__index__++]}}function rf(){return this}function ef(n){for(var t,r=this;r instanceof G;){var e=to(r);e.__index__=0,e.__values__=Y,t?u.__wrapped__=e:t=e;var u=e;r=r.__wrapped__}return u.__wrapped__=n,t}function uf(){var n=this.__wrapped__;if(n instanceof Bt){var t=n;return this.__actions__.length&&(t=new Bt(this)),t=t.reverse(),t.__actions__.push({func:Qo,args:[Ro],thisArg:Y}),new H(t,this.__chain__)}return this.thru(Ro); +}function of(){return du(this.__wrapped__,this.__actions__)}function ff(n,t,r){var e=yh(n)?u:Gr;return r&&Li(n,t,r)&&(t=Y),e(n,bi(t,3))}function cf(n,t){return(yh(n)?i:ne)(n,bi(t,3))}function af(n,t){return te(vf(n,t),1)}function lf(n,t){return te(vf(n,t),Rn)}function sf(n,t,r){return r=r===Y?1:jc(r),te(vf(n,t),r)}function hf(n,t){return(yh(n)?r:vs)(n,bi(t,3))}function pf(n,t){return(yh(n)?e:gs)(n,bi(t,3))}function _f(n,t,r,e){n=Vf(n)?n:na(n),r=r&&!e?jc(r):0;var u=n.length;return r<0&&(r=Kl(u+r,0)), +gc(n)?r<=u&&n.indexOf(t,r)>-1:!!u&&y(n,t,r)>-1}function vf(n,t){return(yh(n)?c:Fe)(n,bi(t,3))}function gf(n,t,r,e){return null==n?[]:(yh(t)||(t=null==t?[]:[t]),r=e?Y:r,yh(r)||(r=null==r?[]:[r]),Ve(n,t,r))}function yf(n,t,r){var e=yh(n)?l:j,u=arguments.length<3;return e(n,bi(t,4),r,u,vs)}function df(n,t,r){var e=yh(n)?s:j,u=arguments.length<3;return e(n,bi(t,4),r,u,gs)}function bf(n,t){return(yh(n)?i:ne)(n,Lf(bi(t,3)))}function wf(n){return(yh(n)?kr:eu)(n)}function mf(n,t,r){return t=(r?Li(n,t,r):t===Y)?1:jc(t), +(yh(n)?Or:uu)(n,t)}function xf(n){return(yh(n)?Ir:ou)(n)}function jf(n){if(null==n)return 0;if(Vf(n))return gc(n)?K(n):n.length;var t=Is(n);return t==Zn||t==Qn?n.size:$e(n).length}function Af(n,t,r){var e=yh(n)?h:cu;return r&&Li(n,t,r)&&(t=Y),e(n,bi(t,3))}function kf(n,t){if("function"!=typeof t)throw new sl(tn);return n=jc(n),function(){if(--n<1)return t.apply(this,arguments)}}function Of(n,t,r){return t=r?Y:t,t=n&&null==t?n.length:t,fi(n,dn,Y,Y,Y,Y,t)}function If(n,t){var r;if("function"!=typeof t)throw new sl(tn); +return n=jc(n),function(){return--n>0&&(r=t.apply(this,arguments)),n<=1&&(t=Y),r}}function Rf(n,t,r){t=r?Y:t;var e=fi(n,_n,Y,Y,Y,Y,Y,t);return e.placeholder=Rf.placeholder,e}function zf(n,t,r){t=r?Y:t;var e=fi(n,vn,Y,Y,Y,Y,Y,t);return e.placeholder=zf.placeholder,e}function Ef(n,t,r){function e(t){var r=h,e=p;return h=p=Y,d=t,v=n.apply(e,r)}function u(n){return d=n,g=Es(f,t),b?e(n):v}function i(n){var r=n-y,e=n-d,u=t-r;return w?Vl(u,_-e):u}function o(n){var r=n-y,e=n-d;return y===Y||r>=t||r<0||w&&e>=_; +}function f(){var n=ih();return o(n)?c(n):(g=Es(f,i(n)),Y)}function c(n){return g=Y,m&&h?e(n):(h=p=Y,v)}function a(){g!==Y&&xs(g),d=0,h=y=p=g=Y}function l(){return g===Y?v:c(ih())}function s(){var n=ih(),r=o(n);if(h=arguments,p=this,y=n,r){if(g===Y)return u(y);if(w)return xs(g),g=Es(f,t),e(y)}return g===Y&&(g=Es(f,t)),v}var h,p,_,v,g,y,d=0,b=!1,w=!1,m=!0;if("function"!=typeof n)throw new sl(tn);return t=kc(t)||0,ic(r)&&(b=!!r.leading,w="maxWait"in r,_=w?Kl(kc(r.maxWait)||0,t):_,m="trailing"in r?!!r.trailing:m), +s.cancel=a,s.flush=l,s}function Sf(n){return fi(n,wn)}function Wf(n,t){if("function"!=typeof n||null!=t&&"function"!=typeof t)throw new sl(tn);var r=function(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;if(i.has(u))return i.get(u);var o=n.apply(this,e);return r.cache=i.set(u,o)||i,o};return r.cache=new(Wf.Cache||ar),r}function Lf(n){if("function"!=typeof n)throw new sl(tn);return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2: +return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function Cf(n){return If(2,n)}function Uf(n,t){if("function"!=typeof n)throw new sl(tn);return t=t===Y?t:jc(t),ru(n,t)}function Bf(t,r){if("function"!=typeof t)throw new sl(tn);return r=null==r?0:Kl(jc(r),0),ru(function(e){var u=e[r],i=Au(e,0,r);return u&&a(i,u),n(t,this,i)})}function Tf(n,t,r){var e=!0,u=!0;if("function"!=typeof n)throw new sl(tn);return ic(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u), +Ef(n,t,{leading:e,maxWait:t,trailing:u})}function $f(n){return Of(n,1)}function Df(n,t){return sh(xu(t),n)}function Mf(){if(!arguments.length)return[];var n=arguments[0];return yh(n)?n:[n]}function Ff(n){return Dr(n,cn)}function Nf(n,t){return t="function"==typeof t?t:Y,Dr(n,cn,t)}function Pf(n){return Dr(n,on|cn)}function qf(n,t){return t="function"==typeof t?t:Y,Dr(n,on|cn,t)}function Zf(n,t){return null==t||Zr(n,t,Fc(t))}function Kf(n,t){return n===t||n!==n&&t!==t}function Vf(n){return null!=n&&uc(n.length)&&!rc(n); +}function Gf(n){return oc(n)&&Vf(n)}function Hf(n){return n===!0||n===!1||oc(n)&&de(n)==Dn}function Jf(n){return oc(n)&&1===n.nodeType&&!_c(n)}function Yf(n){if(null==n)return!0;if(Vf(n)&&(yh(n)||"string"==typeof n||"function"==typeof n.splice||bh(n)||Ah(n)||gh(n)))return!n.length;var t=Is(n);if(t==Zn||t==Qn)return!n.size;if($i(n))return!$e(n).length;for(var r in n)if(yl.call(n,r))return!1;return!0}function Qf(n,t){return ze(n,t)}function Xf(n,t,r){r="function"==typeof r?r:Y;var e=r?r(n,t):Y;return e===Y?ze(n,t,Y,r):!!e; +}function nc(n){if(!oc(n))return!1;var t=de(n);return t==Nn||t==Fn||"string"==typeof n.message&&"string"==typeof n.name&&!_c(n)}function tc(n){return"number"==typeof n&&Pl(n)}function rc(n){if(!ic(n))return!1;var t=de(n);return t==Pn||t==qn||t==$n||t==Jn}function ec(n){return"number"==typeof n&&n==jc(n)}function uc(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=zn}function ic(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function oc(n){return null!=n&&"object"==typeof n}function fc(n,t){ +return n===t||We(n,t,mi(t))}function cc(n,t,r){return r="function"==typeof r?r:Y,We(n,t,mi(t),r)}function ac(n){return pc(n)&&n!=+n}function lc(n){if(Rs(n))throw new il(nn);return Le(n)}function sc(n){return null===n}function hc(n){return null==n}function pc(n){return"number"==typeof n||oc(n)&&de(n)==Kn}function _c(n){if(!oc(n)||de(n)!=Gn)return!1;var t=Rl(n);if(null===t)return!0;var r=yl.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&gl.call(r)==ml}function vc(n){ +return ec(n)&&n>=-zn&&n<=zn}function gc(n){return"string"==typeof n||!yh(n)&&oc(n)&&de(n)==Xn}function yc(n){return"symbol"==typeof n||oc(n)&&de(n)==nt}function dc(n){return n===Y}function bc(n){return oc(n)&&Is(n)==rt}function wc(n){return oc(n)&&de(n)==et}function mc(n){if(!n)return[];if(Vf(n))return gc(n)?V(n):Uu(n);if(Ll&&n[Ll])return $(n[Ll]());var t=Is(n);return(t==Zn?D:t==Qn?N:na)(n)}function xc(n){if(!n)return 0===n?n:0;if(n=kc(n),n===Rn||n===-Rn){return(n<0?-1:1)*En}return n===n?n:0}function jc(n){ +var t=xc(n),r=t%1;return t===t?r?t-r:t:0}function Ac(n){return n?$r(jc(n),0,Wn):0}function kc(n){if("number"==typeof n)return n;if(yc(n))return Sn;if(ic(n)){var t="function"==typeof n.valueOf?n.valueOf():n;n=ic(t)?t+"":t}if("string"!=typeof n)return 0===n?n:+n;n=n.replace(Et,"");var r=Ft.test(n);return r||Pt.test(n)?Jr(n.slice(2),r?2:8):Mt.test(n)?Sn:+n}function Oc(n){return Bu(n,Nc(n))}function Ic(n){return n?$r(jc(n),-zn,zn):0===n?n:0}function Rc(n){return null==n?"":pu(n)}function zc(n,t){var r=_s(n); +return null==t?r:Wr(r,t)}function Ec(n,t){return v(n,bi(t,3),ee)}function Sc(n,t){return v(n,bi(t,3),ue)}function Wc(n,t){return null==n?n:ys(n,bi(t,3),Nc)}function Lc(n,t){return null==n?n:ds(n,bi(t,3),Nc)}function Cc(n,t){return n&&ee(n,bi(t,3))}function Uc(n,t){return n&&ue(n,bi(t,3))}function Bc(n){return null==n?[]:se(n,Fc(n))}function Tc(n){return null==n?[]:se(n,Nc(n))}function $c(n,t,r){var e=null==n?Y:ve(n,t);return e===Y?r:e}function Dc(n,t){return null!=n&&Oi(n,t,we)}function Mc(n,t){return null!=n&&Oi(n,t,me); +}function Fc(n){return Vf(n)?Ar(n):$e(n)}function Nc(n){return Vf(n)?Ar(n,!0):De(n)}function Pc(n,t){var r={};return t=bi(t,3),ee(n,function(n,e,u){Cr(r,t(n,e,u),n)}),r}function qc(n,t){var r={};return t=bi(t,3),ee(n,function(n,e,u){Cr(r,e,t(n,e,u))}),r}function Zc(n,t){return Kc(n,Lf(bi(t)))}function Kc(n,t){if(null==n)return{};var r=c(gi(n),function(n){return[n]});return t=bi(t),He(n,r,function(n,r){return t(n,r[0])})}function Vc(n,t,r){t=ju(t,n);var e=-1,u=t.length;for(u||(u=1,n=Y);++et){ +var e=n;n=t,t=e}if(r||n%1||t%1){var u=Jl();return Vl(n+u*(t-n+Hr("1e-"+((u+"").length-1))),t)}return Xe(n,t)}function ia(n){return Jh(Rc(n).toLowerCase())}function oa(n){return n=Rc(n),n&&n.replace(Zt,he).replace(Br,"")}function fa(n,t,r){n=Rc(n),t=pu(t);var e=n.length;r=r===Y?e:$r(jc(r),0,e);var u=r;return r-=t.length,r>=0&&n.slice(r,u)==t}function ca(n){return n=Rc(n),n&&mt.test(n)?n.replace(bt,pe):n}function aa(n){return n=Rc(n),n&&zt.test(n)?n.replace(Rt,"\\$&"):n}function la(n,t,r){n=Rc(n),t=jc(t); +var e=t?K(n):0;if(!t||e>=t)return n;var u=(t-e)/2;return ni(Ml(u),r)+n+ni(Dl(u),r)}function sa(n,t,r){n=Rc(n),t=jc(t);var e=t?K(n):0;return t&&e>>0)?(n=Rc(n),n&&("string"==typeof t||null!=t&&!xh(t))&&(t=pu(t),!t&&B(n))?Au(V(n),0,r):n.split(t,r)):[]}function ya(n,t,r){return n=Rc(n),r=null==r?0:$r(jc(r),0,n.length),t=pu(t),n.slice(r,r+t.length)==t}function da(n,t,r){var e=q.templateSettings;r&&Li(n,t,r)&&(t=Y),n=Rc(n),t=zh({},t,e,ci);var u,i,o=zh({},t.imports,e.imports,ci),f=Fc(o),c=z(o,f),a=0,l=t.interpolate||Kt,s="__p += '",h=al((t.escape||Kt).source+"|"+l.source+"|"+(l===At?$t:Kt).source+"|"+(t.evaluate||Kt).source+"|$","g"),p="//# sourceURL="+(yl.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Nr+"]")+"\n"; +n.replace(h,function(t,r,e,o,f,c){return e||(e=o),s+=n.slice(a,c).replace(Vt,C),r&&(u=!0,s+="' +\n__e("+r+") +\n'"),f&&(i=!0,s+="';\n"+f+";\n__p += '"),e&&(s+="' +\n((__t = ("+e+")) == null ? '' : __t) +\n'"),a=c+t.length,t}),s+="';\n";var _=yl.call(t,"variable")&&t.variable;_||(s="with (obj) {\n"+s+"\n}\n"),s=(i?s.replace(vt,""):s).replace(gt,"$1").replace(yt,"$1;"),s="function("+(_||"obj")+") {\n"+(_?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+s+"return __p\n}"; +var v=Yh(function(){return ol(f,p+"return "+s).apply(Y,c)});if(v.source=s,nc(v))throw v;return v}function ba(n){return Rc(n).toLowerCase()}function wa(n){return Rc(n).toUpperCase()}function ma(n,t,r){if(n=Rc(n),n&&(r||t===Y))return n.replace(Et,"");if(!n||!(t=pu(t)))return n;var e=V(n),u=V(t);return Au(e,S(e,u),W(e,u)+1).join("")}function xa(n,t,r){if(n=Rc(n),n&&(r||t===Y))return n.replace(Wt,"");if(!n||!(t=pu(t)))return n;var e=V(n);return Au(e,0,W(e,V(t))+1).join("")}function ja(n,t,r){if(n=Rc(n), +n&&(r||t===Y))return n.replace(St,"");if(!n||!(t=pu(t)))return n;var e=V(n);return Au(e,S(e,V(t))).join("")}function Aa(n,t){var r=mn,e=xn;if(ic(t)){var u="separator"in t?t.separator:u;r="length"in t?jc(t.length):r,e="omission"in t?pu(t.omission):e}n=Rc(n);var i=n.length;if(B(n)){var o=V(n);i=o.length}if(r>=i)return n;var f=r-K(e);if(f<1)return e;var c=o?Au(o,0,f).join(""):n.slice(0,f);if(u===Y)return c+e;if(o&&(f+=c.length-f),xh(u)){if(n.slice(f).search(u)){var a,l=c;for(u.global||(u=al(u.source,Rc(Dt.exec(u))+"g")), +u.lastIndex=0;a=u.exec(l);)var s=a.index;c=c.slice(0,s===Y?f:s)}}else if(n.indexOf(pu(u),f)!=f){var h=c.lastIndexOf(u);h>-1&&(c=c.slice(0,h))}return c+e}function ka(n){return n=Rc(n),n&&wt.test(n)?n.replace(dt,_e):n}function Oa(n,t,r){return n=Rc(n),t=r?Y:t,t===Y?T(n)?J(n):_(n):n.match(t)||[]}function Ia(t){var r=null==t?0:t.length,e=bi();return t=r?c(t,function(n){if("function"!=typeof n[1])throw new sl(tn);return[e(n[0]),n[1]]}):[],ru(function(e){for(var u=-1;++uzn)return[];var r=Wn,e=Vl(n,Wn);t=bi(t),n-=Wn;for(var u=O(e,t);++r1?n[t-1]:Y;return r="function"==typeof r?(n.pop(), +r):Y,Vo(n,r)}),Js=_i(function(n){var t=n.length,r=t?n[0]:0,e=this.__wrapped__,u=function(t){return Tr(t,n)};return!(t>1||this.__actions__.length)&&e instanceof Bt&&Wi(r)?(e=e.slice(r,+r+(t?1:0)),e.__actions__.push({func:Qo,args:[u],thisArg:Y}),new H(e,this.__chain__).thru(function(n){return t&&!n.length&&n.push(Y),n})):this.thru(u)}),Ys=Du(function(n,t,r){yl.call(n,r)?++n[r]:Cr(n,r,1)}),Qs=Gu(lo),Xs=Gu(so),nh=Du(function(n,t,r){yl.call(n,r)?n[r].push(t):Cr(n,r,[t])}),th=ru(function(t,r,e){var u=-1,i="function"==typeof r,o=Vf(t)?el(t.length):[]; +return vs(t,function(t){o[++u]=i?n(r,t,e):ke(t,r,e)}),o}),rh=Du(function(n,t,r){Cr(n,r,t)}),eh=Du(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),uh=ru(function(n,t){if(null==n)return[];var r=t.length;return r>1&&Li(n,t[0],t[1])?t=[]:r>2&&Li(t[0],t[1],t[2])&&(t=[t[0]]),Ve(n,te(t,1),[])}),ih=Tl||function(){return Xr.Date.now()},oh=ru(function(n,t,r){var e=sn;if(r.length){var u=F(r,di(oh));e|=gn}return fi(n,e,t,r,u)}),fh=ru(function(n,t,r){var e=sn|hn;if(r.length){var u=F(r,di(fh));e|=gn; +}return fi(t,e,n,r,u)}),ch=ru(function(n,t){return Kr(n,1,t)}),ah=ru(function(n,t,r){return Kr(n,kc(t)||0,r)});Wf.Cache=ar;var lh=ms(function(t,r){r=1==r.length&&yh(r[0])?c(r[0],R(bi())):c(te(r,1),R(bi()));var e=r.length;return ru(function(u){for(var i=-1,o=Vl(u.length,e);++i=t}),gh=Oe(function(){return arguments}())?Oe:function(n){return oc(n)&&yl.call(n,"callee")&&!El.call(n,"callee")},yh=el.isArray,dh=ie?R(ie):Ie,bh=Nl||Na,wh=oe?R(oe):Re,mh=fe?R(fe):Se,xh=ce?R(ce):Ce,jh=ae?R(ae):Ue,Ah=le?R(le):Be,kh=ei(Me),Oh=ei(function(n,t){return n<=t}),Ih=Mu(function(n,t){if($i(t)||Vf(t))return Bu(t,Fc(t),n),Y;for(var r in t)yl.call(t,r)&&zr(n,r,t[r])}),Rh=Mu(function(n,t){Bu(t,Nc(t),n)}),zh=Mu(function(n,t,r,e){Bu(t,Nc(t),n,e)}),Eh=Mu(function(n,t,r,e){Bu(t,Fc(t),n,e); +}),Sh=_i(Tr),Wh=ru(function(n,t){n=cl(n);var r=-1,e=t.length,u=e>2?t[2]:Y;for(u&&Li(t[0],t[1],u)&&(e=1);++r1),t}),Bu(n,gi(n),r),e&&(r=Dr(r,on|fn|cn,li));for(var u=t.length;u--;)vu(r,t[u]);return r}),Mh=_i(function(n,t){return null==n?{}:Ge(n,t)}),Fh=oi(Fc),Nh=oi(Nc),Ph=Zu(function(n,t,r){return t=t.toLowerCase(),n+(r?ia(t):t)}),qh=Zu(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),Zh=Zu(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),Kh=qu("toLowerCase"),Vh=Zu(function(n,t,r){ +return n+(r?"_":"")+t.toLowerCase()}),Gh=Zu(function(n,t,r){return n+(r?" ":"")+Jh(t)}),Hh=Zu(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),Jh=qu("toUpperCase"),Yh=ru(function(t,r){try{return n(t,Y,r)}catch(n){return nc(n)?n:new il(n)}}),Qh=_i(function(n,t){return r(t,function(t){t=Qi(t),Cr(n,t,oh(n[t],n))}),n}),Xh=Hu(),np=Hu(!0),tp=ru(function(n,t){return function(r){return ke(r,n,t)}}),rp=ru(function(n,t){return function(r){return ke(n,r,t)}}),ep=Xu(c),up=Xu(u),ip=Xu(h),op=ri(),fp=ri(!0),cp=Qu(function(n,t){ +return n+t},0),ap=ii("ceil"),lp=Qu(function(n,t){return n/t},1),sp=ii("floor"),hp=Qu(function(n,t){return n*t},1),pp=ii("round"),_p=Qu(function(n,t){return n-t},0);return q.after=kf,q.ary=Of,q.assign=Ih,q.assignIn=Rh,q.assignInWith=zh,q.assignWith=Eh,q.at=Sh,q.before=If,q.bind=oh,q.bindAll=Qh,q.bindKey=fh,q.castArray=Mf,q.chain=Jo,q.chunk=ro,q.compact=eo,q.concat=uo,q.cond=Ia,q.conforms=Ra,q.constant=za,q.countBy=Ys,q.create=zc,q.curry=Rf,q.curryRight=zf,q.debounce=Ef,q.defaults=Wh,q.defaultsDeep=Lh, +q.defer=ch,q.delay=ah,q.difference=Ls,q.differenceBy=Cs,q.differenceWith=Us,q.drop=io,q.dropRight=oo,q.dropRightWhile=fo,q.dropWhile=co,q.fill=ao,q.filter=cf,q.flatMap=af,q.flatMapDeep=lf,q.flatMapDepth=sf,q.flatten=ho,q.flattenDeep=po,q.flattenDepth=_o,q.flip=Sf,q.flow=Xh,q.flowRight=np,q.fromPairs=vo,q.functions=Bc,q.functionsIn=Tc,q.groupBy=nh,q.initial=bo,q.intersection=Bs,q.intersectionBy=Ts,q.intersectionWith=$s,q.invert=Ch,q.invertBy=Uh,q.invokeMap=th,q.iteratee=Wa,q.keyBy=rh,q.keys=Fc,q.keysIn=Nc, +q.map=vf,q.mapKeys=Pc,q.mapValues=qc,q.matches=La,q.matchesProperty=Ca,q.memoize=Wf,q.merge=Th,q.mergeWith=$h,q.method=tp,q.methodOf=rp,q.mixin=Ua,q.negate=Lf,q.nthArg=$a,q.omit=Dh,q.omitBy=Zc,q.once=Cf,q.orderBy=gf,q.over=ep,q.overArgs=lh,q.overEvery=up,q.overSome=ip,q.partial=sh,q.partialRight=hh,q.partition=eh,q.pick=Mh,q.pickBy=Kc,q.property=Da,q.propertyOf=Ma,q.pull=Ds,q.pullAll=Ao,q.pullAllBy=ko,q.pullAllWith=Oo,q.pullAt=Ms,q.range=op,q.rangeRight=fp,q.rearg=ph,q.reject=bf,q.remove=Io,q.rest=Uf, +q.reverse=Ro,q.sampleSize=mf,q.set=Gc,q.setWith=Hc,q.shuffle=xf,q.slice=zo,q.sortBy=uh,q.sortedUniq=Bo,q.sortedUniqBy=To,q.split=ga,q.spread=Bf,q.tail=$o,q.take=Do,q.takeRight=Mo,q.takeRightWhile=Fo,q.takeWhile=No,q.tap=Yo,q.throttle=Tf,q.thru=Qo,q.toArray=mc,q.toPairs=Fh,q.toPairsIn=Nh,q.toPath=Va,q.toPlainObject=Oc,q.transform=Jc,q.unary=$f,q.union=Fs,q.unionBy=Ns,q.unionWith=Ps,q.uniq=Po,q.uniqBy=qo,q.uniqWith=Zo,q.unset=Yc,q.unzip=Ko,q.unzipWith=Vo,q.update=Qc,q.updateWith=Xc,q.values=na,q.valuesIn=ta, +q.without=qs,q.words=Oa,q.wrap=Df,q.xor=Zs,q.xorBy=Ks,q.xorWith=Vs,q.zip=Gs,q.zipObject=Go,q.zipObjectDeep=Ho,q.zipWith=Hs,q.entries=Fh,q.entriesIn=Nh,q.extend=Rh,q.extendWith=zh,Ua(q,q),q.add=cp,q.attempt=Yh,q.camelCase=Ph,q.capitalize=ia,q.ceil=ap,q.clamp=ra,q.clone=Ff,q.cloneDeep=Pf,q.cloneDeepWith=qf,q.cloneWith=Nf,q.conformsTo=Zf,q.deburr=oa,q.defaultTo=Ea,q.divide=lp,q.endsWith=fa,q.eq=Kf,q.escape=ca,q.escapeRegExp=aa,q.every=ff,q.find=Qs,q.findIndex=lo,q.findKey=Ec,q.findLast=Xs,q.findLastIndex=so, +q.findLastKey=Sc,q.floor=sp,q.forEach=hf,q.forEachRight=pf,q.forIn=Wc,q.forInRight=Lc,q.forOwn=Cc,q.forOwnRight=Uc,q.get=$c,q.gt=_h,q.gte=vh,q.has=Dc,q.hasIn=Mc,q.head=go,q.identity=Sa,q.includes=_f,q.indexOf=yo,q.inRange=ea,q.invoke=Bh,q.isArguments=gh,q.isArray=yh,q.isArrayBuffer=dh,q.isArrayLike=Vf,q.isArrayLikeObject=Gf,q.isBoolean=Hf,q.isBuffer=bh,q.isDate=wh,q.isElement=Jf,q.isEmpty=Yf,q.isEqual=Qf,q.isEqualWith=Xf,q.isError=nc,q.isFinite=tc,q.isFunction=rc,q.isInteger=ec,q.isLength=uc,q.isMap=mh, +q.isMatch=fc,q.isMatchWith=cc,q.isNaN=ac,q.isNative=lc,q.isNil=hc,q.isNull=sc,q.isNumber=pc,q.isObject=ic,q.isObjectLike=oc,q.isPlainObject=_c,q.isRegExp=xh,q.isSafeInteger=vc,q.isSet=jh,q.isString=gc,q.isSymbol=yc,q.isTypedArray=Ah,q.isUndefined=dc,q.isWeakMap=bc,q.isWeakSet=wc,q.join=wo,q.kebabCase=qh,q.last=mo,q.lastIndexOf=xo,q.lowerCase=Zh,q.lowerFirst=Kh,q.lt=kh,q.lte=Oh,q.max=Ha,q.maxBy=Ja,q.mean=Ya,q.meanBy=Qa,q.min=Xa,q.minBy=nl,q.stubArray=Fa,q.stubFalse=Na,q.stubObject=Pa,q.stubString=qa, +q.stubTrue=Za,q.multiply=hp,q.nth=jo,q.noConflict=Ba,q.noop=Ta,q.now=ih,q.pad=la,q.padEnd=sa,q.padStart=ha,q.parseInt=pa,q.random=ua,q.reduce=yf,q.reduceRight=df,q.repeat=_a,q.replace=va,q.result=Vc,q.round=pp,q.runInContext=p,q.sample=wf,q.size=jf,q.snakeCase=Vh,q.some=Af,q.sortedIndex=Eo,q.sortedIndexBy=So,q.sortedIndexOf=Wo,q.sortedLastIndex=Lo,q.sortedLastIndexBy=Co,q.sortedLastIndexOf=Uo,q.startCase=Gh,q.startsWith=ya,q.subtract=_p,q.sum=tl,q.sumBy=rl,q.template=da,q.times=Ka,q.toFinite=xc,q.toInteger=jc, +q.toLength=Ac,q.toLower=ba,q.toNumber=kc,q.toSafeInteger=Ic,q.toString=Rc,q.toUpper=wa,q.trim=ma,q.trimEnd=xa,q.trimStart=ja,q.truncate=Aa,q.unescape=ka,q.uniqueId=Ga,q.upperCase=Hh,q.upperFirst=Jh,q.each=hf,q.eachRight=pf,q.first=go,Ua(q,function(){var n={};return ee(q,function(t,r){yl.call(q.prototype,r)||(n[r]=t)}),n}(),{chain:!1}),q.VERSION=Q,r(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){q[n].placeholder=q}),r(["drop","take"],function(n,t){Bt.prototype[n]=function(r){ +r=r===Y?1:Kl(jc(r),0);var e=this.__filtered__&&!t?new Bt(this):this.clone();return e.__filtered__?e.__takeCount__=Vl(r,e.__takeCount__):e.__views__.push({size:Vl(r,Wn),type:n+(e.__dir__<0?"Right":"")}),e},Bt.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),r(["filter","map","takeWhile"],function(n,t){var r=t+1,e=r==kn||r==In;Bt.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:bi(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),r(["head","last"],function(n,t){ +var r="take"+(t?"Right":"");Bt.prototype[n]=function(){return this[r](1).value()[0]}}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Bt.prototype[n]=function(){return this.__filtered__?new Bt(this):this[r](1)}}),Bt.prototype.compact=function(){return this.filter(Sa)},Bt.prototype.find=function(n){return this.filter(n).head()},Bt.prototype.findLast=function(n){return this.reverse().find(n)},Bt.prototype.invokeMap=ru(function(n,t){return"function"==typeof n?new Bt(this):this.map(function(r){ +return ke(r,n,t)})}),Bt.prototype.reject=function(n){return this.filter(Lf(bi(n)))},Bt.prototype.slice=function(n,t){n=jc(n);var r=this;return r.__filtered__&&(n>0||t<0)?new Bt(r):(n<0?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==Y&&(t=jc(t),r=t<0?r.dropRight(-t):r.take(t-n)),r)},Bt.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Bt.prototype.toArray=function(){return this.take(Wn)},ee(Bt.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=q[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t); +u&&(q.prototype[t]=function(){var t=this.__wrapped__,o=e?[1]:arguments,f=t instanceof Bt,c=o[0],l=f||yh(t),s=function(n){var t=u.apply(q,a([n],o));return e&&h?t[0]:t};l&&r&&"function"==typeof c&&1!=c.length&&(f=l=!1);var h=this.__chain__,p=!!this.__actions__.length,_=i&&!h,v=f&&!p;if(!i&&l){t=v?t:new Bt(this);var g=n.apply(t,o);return g.__actions__.push({func:Qo,args:[s],thisArg:Y}),new H(g,h)}return _&&v?n.apply(this,o):(g=this.thru(s),_?e?g.value()[0]:g.value():g)})}),r(["pop","push","shift","sort","splice","unshift"],function(n){ +var t=hl[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);q.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(yh(u)?u:[],n)}return this[r](function(r){return t.apply(yh(r)?r:[],n)})}}),ee(Bt.prototype,function(n,t){var r=q[t];if(r){var e=r.name+"";yl.call(is,e)||(is[e]=[]),is[e].push({name:t,func:r})}}),is[Ju(Y,hn).name]=[{name:"wrapper",func:Y}],Bt.prototype.clone=Gt,Bt.prototype.reverse=Ht,Bt.prototype.value=Jt,q.prototype.at=Js, +q.prototype.chain=Xo,q.prototype.commit=nf,q.prototype.next=tf,q.prototype.plant=ef,q.prototype.reverse=uf,q.prototype.toJSON=q.prototype.valueOf=q.prototype.value=of,q.prototype.first=q.prototype.head,Ll&&(q.prototype[Ll]=rf),q},ge=ve();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Xr._=ge,define(function(){return ge})):te?((te.exports=ge)._=ge,ne._=ge):Xr._=ge}).call(this); \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/lowerCase.js b/tools/node_modules/@babel/core/node_modules/lodash/lowerCase.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/lowerCase.js rename to tools/node_modules/@babel/core/node_modules/lodash/lowerCase.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/lowerFirst.js b/tools/node_modules/@babel/core/node_modules/lodash/lowerFirst.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/lowerFirst.js rename to tools/node_modules/@babel/core/node_modules/lodash/lowerFirst.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/lt.js b/tools/node_modules/@babel/core/node_modules/lodash/lt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/lt.js rename to tools/node_modules/@babel/core/node_modules/lodash/lt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/lte.js b/tools/node_modules/@babel/core/node_modules/lodash/lte.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/lte.js rename to tools/node_modules/@babel/core/node_modules/lodash/lte.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/map.js b/tools/node_modules/@babel/core/node_modules/lodash/map.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/map.js rename to tools/node_modules/@babel/core/node_modules/lodash/map.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/mapKeys.js b/tools/node_modules/@babel/core/node_modules/lodash/mapKeys.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/mapKeys.js rename to tools/node_modules/@babel/core/node_modules/lodash/mapKeys.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/mapValues.js b/tools/node_modules/@babel/core/node_modules/lodash/mapValues.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/mapValues.js rename to tools/node_modules/@babel/core/node_modules/lodash/mapValues.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/matches.js b/tools/node_modules/@babel/core/node_modules/lodash/matches.js similarity index 79% rename from tools/node_modules/babel-eslint/node_modules/lodash/matches.js rename to tools/node_modules/@babel/core/node_modules/lodash/matches.js index 11145db37f4fa1..e10b35198b8517 100644 --- a/tools/node_modules/babel-eslint/node_modules/lodash/matches.js +++ b/tools/node_modules/@babel/core/node_modules/lodash/matches.js @@ -16,6 +16,9 @@ var CLONE_DEEP_FLAG = 1; * values against any array or object value, respectively. See `_.isEqual` * for a list of supported value comparisons. * + * **Note:** Multiple values can be checked by combining several matchers + * using `_.overSome` + * * @static * @memberOf _ * @since 3.0.0 @@ -31,6 +34,10 @@ var CLONE_DEEP_FLAG = 1; * * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); * // => [{ 'a': 4, 'b': 5, 'c': 6 }] + * + * // Checking for several possible values + * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); + * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matches(source) { return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/matchesProperty.js b/tools/node_modules/@babel/core/node_modules/lodash/matchesProperty.js similarity index 79% rename from tools/node_modules/babel-eslint/node_modules/lodash/matchesProperty.js rename to tools/node_modules/@babel/core/node_modules/lodash/matchesProperty.js index cc062ac99378e9..e6f1a882d610a8 100644 --- a/tools/node_modules/babel-eslint/node_modules/lodash/matchesProperty.js +++ b/tools/node_modules/@babel/core/node_modules/lodash/matchesProperty.js @@ -13,6 +13,9 @@ var CLONE_DEEP_FLAG = 1; * `srcValue` values against any array or object value, respectively. See * `_.isEqual` for a list of supported value comparisons. * + * **Note:** Multiple values can be checked by combining several matchers + * using `_.overSome` + * * @static * @memberOf _ * @since 3.2.0 @@ -29,6 +32,10 @@ var CLONE_DEEP_FLAG = 1; * * _.find(objects, _.matchesProperty('a', 4)); * // => { 'a': 4, 'b': 5, 'c': 6 } + * + * // Checking for several possible values + * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)])); + * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] */ function matchesProperty(path, srcValue) { return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/math.js b/tools/node_modules/@babel/core/node_modules/lodash/math.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/math.js rename to tools/node_modules/@babel/core/node_modules/lodash/math.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/max.js b/tools/node_modules/@babel/core/node_modules/lodash/max.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/max.js rename to tools/node_modules/@babel/core/node_modules/lodash/max.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/maxBy.js b/tools/node_modules/@babel/core/node_modules/lodash/maxBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/maxBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/maxBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/mean.js b/tools/node_modules/@babel/core/node_modules/lodash/mean.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/mean.js rename to tools/node_modules/@babel/core/node_modules/lodash/mean.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/meanBy.js b/tools/node_modules/@babel/core/node_modules/lodash/meanBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/meanBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/meanBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/memoize.js b/tools/node_modules/@babel/core/node_modules/lodash/memoize.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/memoize.js rename to tools/node_modules/@babel/core/node_modules/lodash/memoize.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/merge.js b/tools/node_modules/@babel/core/node_modules/lodash/merge.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/merge.js rename to tools/node_modules/@babel/core/node_modules/lodash/merge.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/mergeWith.js b/tools/node_modules/@babel/core/node_modules/lodash/mergeWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/mergeWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/mergeWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/method.js b/tools/node_modules/@babel/core/node_modules/lodash/method.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/method.js rename to tools/node_modules/@babel/core/node_modules/lodash/method.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/methodOf.js b/tools/node_modules/@babel/core/node_modules/lodash/methodOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/methodOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/methodOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/min.js b/tools/node_modules/@babel/core/node_modules/lodash/min.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/min.js rename to tools/node_modules/@babel/core/node_modules/lodash/min.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/minBy.js b/tools/node_modules/@babel/core/node_modules/lodash/minBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/minBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/minBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/mixin.js b/tools/node_modules/@babel/core/node_modules/lodash/mixin.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/mixin.js rename to tools/node_modules/@babel/core/node_modules/lodash/mixin.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/multiply.js b/tools/node_modules/@babel/core/node_modules/lodash/multiply.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/multiply.js rename to tools/node_modules/@babel/core/node_modules/lodash/multiply.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/negate.js b/tools/node_modules/@babel/core/node_modules/lodash/negate.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/negate.js rename to tools/node_modules/@babel/core/node_modules/lodash/negate.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/next.js b/tools/node_modules/@babel/core/node_modules/lodash/next.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/next.js rename to tools/node_modules/@babel/core/node_modules/lodash/next.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/noop.js b/tools/node_modules/@babel/core/node_modules/lodash/noop.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/noop.js rename to tools/node_modules/@babel/core/node_modules/lodash/noop.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/now.js b/tools/node_modules/@babel/core/node_modules/lodash/now.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/now.js rename to tools/node_modules/@babel/core/node_modules/lodash/now.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/nth.js b/tools/node_modules/@babel/core/node_modules/lodash/nth.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/nth.js rename to tools/node_modules/@babel/core/node_modules/lodash/nth.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/nthArg.js b/tools/node_modules/@babel/core/node_modules/lodash/nthArg.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/nthArg.js rename to tools/node_modules/@babel/core/node_modules/lodash/nthArg.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/number.js b/tools/node_modules/@babel/core/node_modules/lodash/number.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/number.js rename to tools/node_modules/@babel/core/node_modules/lodash/number.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/object.js b/tools/node_modules/@babel/core/node_modules/lodash/object.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/object.js rename to tools/node_modules/@babel/core/node_modules/lodash/object.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/omit.js b/tools/node_modules/@babel/core/node_modules/lodash/omit.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/omit.js rename to tools/node_modules/@babel/core/node_modules/lodash/omit.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/omitBy.js b/tools/node_modules/@babel/core/node_modules/lodash/omitBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/omitBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/omitBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/once.js b/tools/node_modules/@babel/core/node_modules/lodash/once.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/once.js rename to tools/node_modules/@babel/core/node_modules/lodash/once.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/orderBy.js b/tools/node_modules/@babel/core/node_modules/lodash/orderBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/orderBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/orderBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/over.js b/tools/node_modules/@babel/core/node_modules/lodash/over.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/over.js rename to tools/node_modules/@babel/core/node_modules/lodash/over.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/overArgs.js b/tools/node_modules/@babel/core/node_modules/lodash/overArgs.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/overArgs.js rename to tools/node_modules/@babel/core/node_modules/lodash/overArgs.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/overEvery.js b/tools/node_modules/@babel/core/node_modules/lodash/overEvery.js similarity index 71% rename from tools/node_modules/babel-eslint/node_modules/lodash/overEvery.js rename to tools/node_modules/@babel/core/node_modules/lodash/overEvery.js index c115d15384c866..fb19d13ed987e1 100644 --- a/tools/node_modules/babel-eslint/node_modules/lodash/overEvery.js +++ b/tools/node_modules/@babel/core/node_modules/lodash/overEvery.js @@ -5,6 +5,10 @@ var arrayEvery = require('./_arrayEvery'), * Creates a function that checks if **all** of the `predicates` return * truthy when invoked with the arguments it receives. * + * Following shorthands are possible for providing predicates. + * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. + * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. + * * @static * @memberOf _ * @since 4.0.0 diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/overSome.js b/tools/node_modules/@babel/core/node_modules/lodash/overSome.js similarity index 62% rename from tools/node_modules/babel-eslint/node_modules/lodash/overSome.js rename to tools/node_modules/@babel/core/node_modules/lodash/overSome.js index f902907a954114..414ab66b925d1a 100644 --- a/tools/node_modules/babel-eslint/node_modules/lodash/overSome.js +++ b/tools/node_modules/@babel/core/node_modules/lodash/overSome.js @@ -5,6 +5,10 @@ var arraySome = require('./_arraySome'), * Creates a function that checks if **any** of the `predicates` return * truthy when invoked with the arguments it receives. * + * Following shorthands are possible for providing predicates. + * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. + * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. + * * @static * @memberOf _ * @since 4.0.0 @@ -24,6 +28,9 @@ var arraySome = require('./_arraySome'), * * func(NaN); * // => false + * + * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }]) + * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]]) */ var overSome = createOver(arraySome); diff --git a/tools/node_modules/@babel/core/node_modules/lodash/package.json b/tools/node_modules/@babel/core/node_modules/lodash/package.json new file mode 100644 index 00000000000000..2539c2434cb741 --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/lodash/package.json @@ -0,0 +1,17 @@ +{ + "name": "lodash", + "version": "4.17.20", + "description": "Lodash modular utilities.", + "keywords": "modules, stdlib, util", + "homepage": "https://lodash.com/", + "repository": "lodash/lodash", + "icon": "https://lodash.com/icon.svg", + "license": "MIT", + "main": "lodash.js", + "author": "John-David Dalton ", + "contributors": [ + "John-David Dalton ", + "Mathias Bynens " + ], + "scripts": { "test": "echo \"See https://travis-ci.org/lodash-archive/lodash-cli for testing details.\"" } +} diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/pad.js b/tools/node_modules/@babel/core/node_modules/lodash/pad.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/pad.js rename to tools/node_modules/@babel/core/node_modules/lodash/pad.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/padEnd.js b/tools/node_modules/@babel/core/node_modules/lodash/padEnd.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/padEnd.js rename to tools/node_modules/@babel/core/node_modules/lodash/padEnd.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/padStart.js b/tools/node_modules/@babel/core/node_modules/lodash/padStart.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/padStart.js rename to tools/node_modules/@babel/core/node_modules/lodash/padStart.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/parseInt.js b/tools/node_modules/@babel/core/node_modules/lodash/parseInt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/parseInt.js rename to tools/node_modules/@babel/core/node_modules/lodash/parseInt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/partial.js b/tools/node_modules/@babel/core/node_modules/lodash/partial.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/partial.js rename to tools/node_modules/@babel/core/node_modules/lodash/partial.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/partialRight.js b/tools/node_modules/@babel/core/node_modules/lodash/partialRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/partialRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/partialRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/partition.js b/tools/node_modules/@babel/core/node_modules/lodash/partition.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/partition.js rename to tools/node_modules/@babel/core/node_modules/lodash/partition.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/pick.js b/tools/node_modules/@babel/core/node_modules/lodash/pick.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/pick.js rename to tools/node_modules/@babel/core/node_modules/lodash/pick.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/pickBy.js b/tools/node_modules/@babel/core/node_modules/lodash/pickBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/pickBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/pickBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/plant.js b/tools/node_modules/@babel/core/node_modules/lodash/plant.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/plant.js rename to tools/node_modules/@babel/core/node_modules/lodash/plant.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/property.js b/tools/node_modules/@babel/core/node_modules/lodash/property.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/property.js rename to tools/node_modules/@babel/core/node_modules/lodash/property.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/propertyOf.js b/tools/node_modules/@babel/core/node_modules/lodash/propertyOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/propertyOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/propertyOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/pull.js b/tools/node_modules/@babel/core/node_modules/lodash/pull.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/pull.js rename to tools/node_modules/@babel/core/node_modules/lodash/pull.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/pullAll.js b/tools/node_modules/@babel/core/node_modules/lodash/pullAll.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/pullAll.js rename to tools/node_modules/@babel/core/node_modules/lodash/pullAll.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/pullAllBy.js b/tools/node_modules/@babel/core/node_modules/lodash/pullAllBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/pullAllBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/pullAllBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/pullAllWith.js b/tools/node_modules/@babel/core/node_modules/lodash/pullAllWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/pullAllWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/pullAllWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/pullAt.js b/tools/node_modules/@babel/core/node_modules/lodash/pullAt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/pullAt.js rename to tools/node_modules/@babel/core/node_modules/lodash/pullAt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/random.js b/tools/node_modules/@babel/core/node_modules/lodash/random.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/random.js rename to tools/node_modules/@babel/core/node_modules/lodash/random.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/range.js b/tools/node_modules/@babel/core/node_modules/lodash/range.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/range.js rename to tools/node_modules/@babel/core/node_modules/lodash/range.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/rangeRight.js b/tools/node_modules/@babel/core/node_modules/lodash/rangeRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/rangeRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/rangeRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/rearg.js b/tools/node_modules/@babel/core/node_modules/lodash/rearg.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/rearg.js rename to tools/node_modules/@babel/core/node_modules/lodash/rearg.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/reduce.js b/tools/node_modules/@babel/core/node_modules/lodash/reduce.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/reduce.js rename to tools/node_modules/@babel/core/node_modules/lodash/reduce.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/reduceRight.js b/tools/node_modules/@babel/core/node_modules/lodash/reduceRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/reduceRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/reduceRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/reject.js b/tools/node_modules/@babel/core/node_modules/lodash/reject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/reject.js rename to tools/node_modules/@babel/core/node_modules/lodash/reject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/remove.js b/tools/node_modules/@babel/core/node_modules/lodash/remove.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/remove.js rename to tools/node_modules/@babel/core/node_modules/lodash/remove.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/repeat.js b/tools/node_modules/@babel/core/node_modules/lodash/repeat.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/repeat.js rename to tools/node_modules/@babel/core/node_modules/lodash/repeat.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/replace.js b/tools/node_modules/@babel/core/node_modules/lodash/replace.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/replace.js rename to tools/node_modules/@babel/core/node_modules/lodash/replace.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/rest.js b/tools/node_modules/@babel/core/node_modules/lodash/rest.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/rest.js rename to tools/node_modules/@babel/core/node_modules/lodash/rest.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/result.js b/tools/node_modules/@babel/core/node_modules/lodash/result.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/result.js rename to tools/node_modules/@babel/core/node_modules/lodash/result.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/reverse.js b/tools/node_modules/@babel/core/node_modules/lodash/reverse.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/reverse.js rename to tools/node_modules/@babel/core/node_modules/lodash/reverse.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/round.js b/tools/node_modules/@babel/core/node_modules/lodash/round.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/round.js rename to tools/node_modules/@babel/core/node_modules/lodash/round.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/sample.js b/tools/node_modules/@babel/core/node_modules/lodash/sample.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/sample.js rename to tools/node_modules/@babel/core/node_modules/lodash/sample.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/sampleSize.js b/tools/node_modules/@babel/core/node_modules/lodash/sampleSize.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/sampleSize.js rename to tools/node_modules/@babel/core/node_modules/lodash/sampleSize.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/seq.js b/tools/node_modules/@babel/core/node_modules/lodash/seq.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/seq.js rename to tools/node_modules/@babel/core/node_modules/lodash/seq.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/set.js b/tools/node_modules/@babel/core/node_modules/lodash/set.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/set.js rename to tools/node_modules/@babel/core/node_modules/lodash/set.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/setWith.js b/tools/node_modules/@babel/core/node_modules/lodash/setWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/setWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/setWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/shuffle.js b/tools/node_modules/@babel/core/node_modules/lodash/shuffle.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/shuffle.js rename to tools/node_modules/@babel/core/node_modules/lodash/shuffle.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/size.js b/tools/node_modules/@babel/core/node_modules/lodash/size.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/size.js rename to tools/node_modules/@babel/core/node_modules/lodash/size.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/slice.js b/tools/node_modules/@babel/core/node_modules/lodash/slice.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/slice.js rename to tools/node_modules/@babel/core/node_modules/lodash/slice.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/snakeCase.js b/tools/node_modules/@babel/core/node_modules/lodash/snakeCase.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/snakeCase.js rename to tools/node_modules/@babel/core/node_modules/lodash/snakeCase.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/some.js b/tools/node_modules/@babel/core/node_modules/lodash/some.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/some.js rename to tools/node_modules/@babel/core/node_modules/lodash/some.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/sortBy.js b/tools/node_modules/@babel/core/node_modules/lodash/sortBy.js similarity index 92% rename from tools/node_modules/babel-eslint/node_modules/lodash/sortBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/sortBy.js index 4ba8f7a0ed9bb5..d756aba6c5ebd3 100644 --- a/tools/node_modules/babel-eslint/node_modules/lodash/sortBy.js +++ b/tools/node_modules/@babel/core/node_modules/lodash/sortBy.js @@ -22,15 +22,15 @@ var baseFlatten = require('./_baseFlatten'), * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, + * { 'user': 'fred', 'age': 30 }, * { 'user': 'barney', 'age': 34 } * ]; * * _.sortBy(users, [function(o) { return o.user; }]); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] * * _.sortBy(users, ['user', 'age']); - * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] + * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] */ var sortBy = baseRest(function(collection, iteratees) { if (collection == null) { diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/sortedIndex.js b/tools/node_modules/@babel/core/node_modules/lodash/sortedIndex.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/sortedIndex.js rename to tools/node_modules/@babel/core/node_modules/lodash/sortedIndex.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/sortedIndexBy.js b/tools/node_modules/@babel/core/node_modules/lodash/sortedIndexBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/sortedIndexBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/sortedIndexBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/sortedIndexOf.js b/tools/node_modules/@babel/core/node_modules/lodash/sortedIndexOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/sortedIndexOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/sortedIndexOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/sortedLastIndex.js b/tools/node_modules/@babel/core/node_modules/lodash/sortedLastIndex.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/sortedLastIndex.js rename to tools/node_modules/@babel/core/node_modules/lodash/sortedLastIndex.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/sortedLastIndexBy.js b/tools/node_modules/@babel/core/node_modules/lodash/sortedLastIndexBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/sortedLastIndexBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/sortedLastIndexBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/sortedLastIndexOf.js b/tools/node_modules/@babel/core/node_modules/lodash/sortedLastIndexOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/sortedLastIndexOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/sortedLastIndexOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/sortedUniq.js b/tools/node_modules/@babel/core/node_modules/lodash/sortedUniq.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/sortedUniq.js rename to tools/node_modules/@babel/core/node_modules/lodash/sortedUniq.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/sortedUniqBy.js b/tools/node_modules/@babel/core/node_modules/lodash/sortedUniqBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/sortedUniqBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/sortedUniqBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/split.js b/tools/node_modules/@babel/core/node_modules/lodash/split.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/split.js rename to tools/node_modules/@babel/core/node_modules/lodash/split.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/spread.js b/tools/node_modules/@babel/core/node_modules/lodash/spread.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/spread.js rename to tools/node_modules/@babel/core/node_modules/lodash/spread.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/startCase.js b/tools/node_modules/@babel/core/node_modules/lodash/startCase.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/startCase.js rename to tools/node_modules/@babel/core/node_modules/lodash/startCase.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/startsWith.js b/tools/node_modules/@babel/core/node_modules/lodash/startsWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/startsWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/startsWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/string.js b/tools/node_modules/@babel/core/node_modules/lodash/string.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/string.js rename to tools/node_modules/@babel/core/node_modules/lodash/string.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/stubArray.js b/tools/node_modules/@babel/core/node_modules/lodash/stubArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/stubArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/stubArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/stubFalse.js b/tools/node_modules/@babel/core/node_modules/lodash/stubFalse.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/stubFalse.js rename to tools/node_modules/@babel/core/node_modules/lodash/stubFalse.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/stubObject.js b/tools/node_modules/@babel/core/node_modules/lodash/stubObject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/stubObject.js rename to tools/node_modules/@babel/core/node_modules/lodash/stubObject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/stubString.js b/tools/node_modules/@babel/core/node_modules/lodash/stubString.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/stubString.js rename to tools/node_modules/@babel/core/node_modules/lodash/stubString.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/stubTrue.js b/tools/node_modules/@babel/core/node_modules/lodash/stubTrue.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/stubTrue.js rename to tools/node_modules/@babel/core/node_modules/lodash/stubTrue.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/subtract.js b/tools/node_modules/@babel/core/node_modules/lodash/subtract.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/subtract.js rename to tools/node_modules/@babel/core/node_modules/lodash/subtract.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/sum.js b/tools/node_modules/@babel/core/node_modules/lodash/sum.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/sum.js rename to tools/node_modules/@babel/core/node_modules/lodash/sum.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/sumBy.js b/tools/node_modules/@babel/core/node_modules/lodash/sumBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/sumBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/sumBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/tail.js b/tools/node_modules/@babel/core/node_modules/lodash/tail.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/tail.js rename to tools/node_modules/@babel/core/node_modules/lodash/tail.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/take.js b/tools/node_modules/@babel/core/node_modules/lodash/take.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/take.js rename to tools/node_modules/@babel/core/node_modules/lodash/take.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/takeRight.js b/tools/node_modules/@babel/core/node_modules/lodash/takeRight.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/takeRight.js rename to tools/node_modules/@babel/core/node_modules/lodash/takeRight.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/takeRightWhile.js b/tools/node_modules/@babel/core/node_modules/lodash/takeRightWhile.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/takeRightWhile.js rename to tools/node_modules/@babel/core/node_modules/lodash/takeRightWhile.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/takeWhile.js b/tools/node_modules/@babel/core/node_modules/lodash/takeWhile.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/takeWhile.js rename to tools/node_modules/@babel/core/node_modules/lodash/takeWhile.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/tap.js b/tools/node_modules/@babel/core/node_modules/lodash/tap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/tap.js rename to tools/node_modules/@babel/core/node_modules/lodash/tap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/template.js b/tools/node_modules/@babel/core/node_modules/lodash/template.js similarity index 96% rename from tools/node_modules/babel-eslint/node_modules/lodash/template.js rename to tools/node_modules/@babel/core/node_modules/lodash/template.js index f71d13024982f0..1556a099afe4e4 100644 --- a/tools/node_modules/babel-eslint/node_modules/lodash/template.js +++ b/tools/node_modules/@babel/core/node_modules/lodash/template.js @@ -169,11 +169,11 @@ function template(string, options, guard) { // Use a sourceURL for easier debugging. // The sourceURL gets injected into the source that's eval-ed, so be careful - // with lookup (in case of e.g. prototype pollution), and strip newlines if any. - // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection. + // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in + // and escape the comment, thus injecting code that gets evaled. var sourceURL = hasOwnProperty.call(options, 'sourceURL') ? ('//# sourceURL=' + - (options.sourceURL + '').replace(/[\r\n]/g, ' ') + + (options.sourceURL + '').replace(/\s/g, ' ') + '\n') : ''; @@ -206,8 +206,6 @@ function template(string, options, guard) { // If `variable` is not specified wrap a with-statement around the generated // code to add the data object to the top of the scope chain. - // Like with sourceURL, we take care to not check the option's prototype, - // as this configuration is a code injection vector. var variable = hasOwnProperty.call(options, 'variable') && options.variable; if (!variable) { source = 'with (obj) {\n' + source + '\n}\n'; diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/templateSettings.js b/tools/node_modules/@babel/core/node_modules/lodash/templateSettings.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/templateSettings.js rename to tools/node_modules/@babel/core/node_modules/lodash/templateSettings.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/throttle.js b/tools/node_modules/@babel/core/node_modules/lodash/throttle.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/throttle.js rename to tools/node_modules/@babel/core/node_modules/lodash/throttle.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/thru.js b/tools/node_modules/@babel/core/node_modules/lodash/thru.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/thru.js rename to tools/node_modules/@babel/core/node_modules/lodash/thru.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/times.js b/tools/node_modules/@babel/core/node_modules/lodash/times.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/times.js rename to tools/node_modules/@babel/core/node_modules/lodash/times.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/toArray.js b/tools/node_modules/@babel/core/node_modules/lodash/toArray.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/toArray.js rename to tools/node_modules/@babel/core/node_modules/lodash/toArray.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/toFinite.js b/tools/node_modules/@babel/core/node_modules/lodash/toFinite.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/toFinite.js rename to tools/node_modules/@babel/core/node_modules/lodash/toFinite.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/toInteger.js b/tools/node_modules/@babel/core/node_modules/lodash/toInteger.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/toInteger.js rename to tools/node_modules/@babel/core/node_modules/lodash/toInteger.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/toIterator.js b/tools/node_modules/@babel/core/node_modules/lodash/toIterator.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/toIterator.js rename to tools/node_modules/@babel/core/node_modules/lodash/toIterator.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/toJSON.js b/tools/node_modules/@babel/core/node_modules/lodash/toJSON.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/toJSON.js rename to tools/node_modules/@babel/core/node_modules/lodash/toJSON.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/toLength.js b/tools/node_modules/@babel/core/node_modules/lodash/toLength.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/toLength.js rename to tools/node_modules/@babel/core/node_modules/lodash/toLength.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/toLower.js b/tools/node_modules/@babel/core/node_modules/lodash/toLower.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/toLower.js rename to tools/node_modules/@babel/core/node_modules/lodash/toLower.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/toNumber.js b/tools/node_modules/@babel/core/node_modules/lodash/toNumber.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/toNumber.js rename to tools/node_modules/@babel/core/node_modules/lodash/toNumber.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/toPairs.js b/tools/node_modules/@babel/core/node_modules/lodash/toPairs.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/toPairs.js rename to tools/node_modules/@babel/core/node_modules/lodash/toPairs.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/toPairsIn.js b/tools/node_modules/@babel/core/node_modules/lodash/toPairsIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/toPairsIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/toPairsIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/toPath.js b/tools/node_modules/@babel/core/node_modules/lodash/toPath.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/toPath.js rename to tools/node_modules/@babel/core/node_modules/lodash/toPath.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/toPlainObject.js b/tools/node_modules/@babel/core/node_modules/lodash/toPlainObject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/toPlainObject.js rename to tools/node_modules/@babel/core/node_modules/lodash/toPlainObject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/toSafeInteger.js b/tools/node_modules/@babel/core/node_modules/lodash/toSafeInteger.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/toSafeInteger.js rename to tools/node_modules/@babel/core/node_modules/lodash/toSafeInteger.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/toString.js b/tools/node_modules/@babel/core/node_modules/lodash/toString.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/toString.js rename to tools/node_modules/@babel/core/node_modules/lodash/toString.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/toUpper.js b/tools/node_modules/@babel/core/node_modules/lodash/toUpper.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/toUpper.js rename to tools/node_modules/@babel/core/node_modules/lodash/toUpper.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/transform.js b/tools/node_modules/@babel/core/node_modules/lodash/transform.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/transform.js rename to tools/node_modules/@babel/core/node_modules/lodash/transform.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/trim.js b/tools/node_modules/@babel/core/node_modules/lodash/trim.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/trim.js rename to tools/node_modules/@babel/core/node_modules/lodash/trim.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/trimEnd.js b/tools/node_modules/@babel/core/node_modules/lodash/trimEnd.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/trimEnd.js rename to tools/node_modules/@babel/core/node_modules/lodash/trimEnd.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/trimStart.js b/tools/node_modules/@babel/core/node_modules/lodash/trimStart.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/trimStart.js rename to tools/node_modules/@babel/core/node_modules/lodash/trimStart.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/truncate.js b/tools/node_modules/@babel/core/node_modules/lodash/truncate.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/truncate.js rename to tools/node_modules/@babel/core/node_modules/lodash/truncate.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/unary.js b/tools/node_modules/@babel/core/node_modules/lodash/unary.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/unary.js rename to tools/node_modules/@babel/core/node_modules/lodash/unary.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/unescape.js b/tools/node_modules/@babel/core/node_modules/lodash/unescape.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/unescape.js rename to tools/node_modules/@babel/core/node_modules/lodash/unescape.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/union.js b/tools/node_modules/@babel/core/node_modules/lodash/union.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/union.js rename to tools/node_modules/@babel/core/node_modules/lodash/union.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/unionBy.js b/tools/node_modules/@babel/core/node_modules/lodash/unionBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/unionBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/unionBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/unionWith.js b/tools/node_modules/@babel/core/node_modules/lodash/unionWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/unionWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/unionWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/uniq.js b/tools/node_modules/@babel/core/node_modules/lodash/uniq.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/uniq.js rename to tools/node_modules/@babel/core/node_modules/lodash/uniq.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/uniqBy.js b/tools/node_modules/@babel/core/node_modules/lodash/uniqBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/uniqBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/uniqBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/uniqWith.js b/tools/node_modules/@babel/core/node_modules/lodash/uniqWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/uniqWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/uniqWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/uniqueId.js b/tools/node_modules/@babel/core/node_modules/lodash/uniqueId.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/uniqueId.js rename to tools/node_modules/@babel/core/node_modules/lodash/uniqueId.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/unset.js b/tools/node_modules/@babel/core/node_modules/lodash/unset.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/unset.js rename to tools/node_modules/@babel/core/node_modules/lodash/unset.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/unzip.js b/tools/node_modules/@babel/core/node_modules/lodash/unzip.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/unzip.js rename to tools/node_modules/@babel/core/node_modules/lodash/unzip.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/unzipWith.js b/tools/node_modules/@babel/core/node_modules/lodash/unzipWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/unzipWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/unzipWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/update.js b/tools/node_modules/@babel/core/node_modules/lodash/update.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/update.js rename to tools/node_modules/@babel/core/node_modules/lodash/update.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/updateWith.js b/tools/node_modules/@babel/core/node_modules/lodash/updateWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/updateWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/updateWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/upperCase.js b/tools/node_modules/@babel/core/node_modules/lodash/upperCase.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/upperCase.js rename to tools/node_modules/@babel/core/node_modules/lodash/upperCase.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/upperFirst.js b/tools/node_modules/@babel/core/node_modules/lodash/upperFirst.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/upperFirst.js rename to tools/node_modules/@babel/core/node_modules/lodash/upperFirst.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/util.js b/tools/node_modules/@babel/core/node_modules/lodash/util.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/util.js rename to tools/node_modules/@babel/core/node_modules/lodash/util.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/value.js b/tools/node_modules/@babel/core/node_modules/lodash/value.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/value.js rename to tools/node_modules/@babel/core/node_modules/lodash/value.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/valueOf.js b/tools/node_modules/@babel/core/node_modules/lodash/valueOf.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/valueOf.js rename to tools/node_modules/@babel/core/node_modules/lodash/valueOf.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/values.js b/tools/node_modules/@babel/core/node_modules/lodash/values.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/values.js rename to tools/node_modules/@babel/core/node_modules/lodash/values.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/valuesIn.js b/tools/node_modules/@babel/core/node_modules/lodash/valuesIn.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/valuesIn.js rename to tools/node_modules/@babel/core/node_modules/lodash/valuesIn.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/without.js b/tools/node_modules/@babel/core/node_modules/lodash/without.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/without.js rename to tools/node_modules/@babel/core/node_modules/lodash/without.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/words.js b/tools/node_modules/@babel/core/node_modules/lodash/words.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/words.js rename to tools/node_modules/@babel/core/node_modules/lodash/words.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/wrap.js b/tools/node_modules/@babel/core/node_modules/lodash/wrap.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/wrap.js rename to tools/node_modules/@babel/core/node_modules/lodash/wrap.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/wrapperAt.js b/tools/node_modules/@babel/core/node_modules/lodash/wrapperAt.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/wrapperAt.js rename to tools/node_modules/@babel/core/node_modules/lodash/wrapperAt.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/wrapperChain.js b/tools/node_modules/@babel/core/node_modules/lodash/wrapperChain.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/wrapperChain.js rename to tools/node_modules/@babel/core/node_modules/lodash/wrapperChain.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/wrapperLodash.js b/tools/node_modules/@babel/core/node_modules/lodash/wrapperLodash.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/wrapperLodash.js rename to tools/node_modules/@babel/core/node_modules/lodash/wrapperLodash.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/wrapperReverse.js b/tools/node_modules/@babel/core/node_modules/lodash/wrapperReverse.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/wrapperReverse.js rename to tools/node_modules/@babel/core/node_modules/lodash/wrapperReverse.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/wrapperValue.js b/tools/node_modules/@babel/core/node_modules/lodash/wrapperValue.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/wrapperValue.js rename to tools/node_modules/@babel/core/node_modules/lodash/wrapperValue.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/xor.js b/tools/node_modules/@babel/core/node_modules/lodash/xor.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/xor.js rename to tools/node_modules/@babel/core/node_modules/lodash/xor.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/xorBy.js b/tools/node_modules/@babel/core/node_modules/lodash/xorBy.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/xorBy.js rename to tools/node_modules/@babel/core/node_modules/lodash/xorBy.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/xorWith.js b/tools/node_modules/@babel/core/node_modules/lodash/xorWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/xorWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/xorWith.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/zip.js b/tools/node_modules/@babel/core/node_modules/lodash/zip.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/zip.js rename to tools/node_modules/@babel/core/node_modules/lodash/zip.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/zipObject.js b/tools/node_modules/@babel/core/node_modules/lodash/zipObject.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/zipObject.js rename to tools/node_modules/@babel/core/node_modules/lodash/zipObject.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/zipObjectDeep.js b/tools/node_modules/@babel/core/node_modules/lodash/zipObjectDeep.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/zipObjectDeep.js rename to tools/node_modules/@babel/core/node_modules/lodash/zipObjectDeep.js diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/zipWith.js b/tools/node_modules/@babel/core/node_modules/lodash/zipWith.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/lodash/zipWith.js rename to tools/node_modules/@babel/core/node_modules/lodash/zipWith.js diff --git a/tools/node_modules/@babel/core/node_modules/minimist/LICENSE b/tools/node_modules/@babel/core/node_modules/minimist/LICENSE new file mode 100644 index 00000000000000..ee27ba4b4412b0 --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/minimist/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/@babel/core/node_modules/minimist/index.js b/tools/node_modules/@babel/core/node_modules/minimist/index.js new file mode 100644 index 00000000000000..d2afe5e4d4056e --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/minimist/index.js @@ -0,0 +1,245 @@ +module.exports = function (args, opts) { + if (!opts) opts = {}; + + var flags = { bools : {}, strings : {}, unknownFn: null }; + + if (typeof opts['unknown'] === 'function') { + flags.unknownFn = opts['unknown']; + } + + if (typeof opts['boolean'] === 'boolean' && opts['boolean']) { + flags.allBools = true; + } else { + [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { + flags.bools[key] = true; + }); + } + + var aliases = {}; + Object.keys(opts.alias || {}).forEach(function (key) { + aliases[key] = [].concat(opts.alias[key]); + aliases[key].forEach(function (x) { + aliases[x] = [key].concat(aliases[key].filter(function (y) { + return x !== y; + })); + }); + }); + + [].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true; + if (aliases[key]) { + flags.strings[aliases[key]] = true; + } + }); + + var defaults = opts['default'] || {}; + + var argv = { _ : [] }; + Object.keys(flags.bools).forEach(function (key) { + setArg(key, defaults[key] === undefined ? false : defaults[key]); + }); + + var notFlags = []; + + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--')+1); + args = args.slice(0, args.indexOf('--')); + } + + function argDefined(key, arg) { + return (flags.allBools && /^--[^=]+$/.test(arg)) || + flags.strings[key] || flags.bools[key] || aliases[key]; + } + + function setArg (key, val, arg) { + if (arg && flags.unknownFn && !argDefined(key, arg)) { + if (flags.unknownFn(arg) === false) return; + } + + var value = !flags.strings[key] && isNumber(val) + ? Number(val) : val + ; + setKey(argv, key.split('.'), value); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), value); + }); + } + + function setKey (obj, keys, value) { + var o = obj; + for (var i = 0; i < keys.length-1; i++) { + var key = keys[i]; + if (key === '__proto__') return; + if (o[key] === undefined) o[key] = {}; + if (o[key] === Object.prototype || o[key] === Number.prototype + || o[key] === String.prototype) o[key] = {}; + if (o[key] === Array.prototype) o[key] = []; + o = o[key]; + } + + var key = keys[keys.length - 1]; + if (key === '__proto__') return; + if (o === Object.prototype || o === Number.prototype + || o === String.prototype) o = {}; + if (o === Array.prototype) o = []; + if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') { + o[key] = value; + } + else if (Array.isArray(o[key])) { + o[key].push(value); + } + else { + o[key] = [ o[key], value ]; + } + } + + function aliasIsBoolean(key) { + return aliases[key].some(function (x) { + return flags.bools[x]; + }); + } + + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + + if (/^--.+=/.test(arg)) { + // Using [\s\S] instead of . because js doesn't support the + // 'dotall' regex modifier. See: + // http://stackoverflow.com/a/1068308/13216 + var m = arg.match(/^--([^=]+)=([\s\S]*)$/); + var key = m[1]; + var value = m[2]; + if (flags.bools[key]) { + value = value !== 'false'; + } + setArg(key, value, arg); + } + else if (/^--no-.+/.test(arg)) { + var key = arg.match(/^--no-(.+)/)[1]; + setArg(key, false, arg); + } + else if (/^--.+/.test(arg)) { + var key = arg.match(/^--(.+)/)[1]; + var next = args[i + 1]; + if (next !== undefined && !/^-/.test(next) + && !flags.bools[key] + && !flags.allBools + && (aliases[key] ? !aliasIsBoolean(key) : true)) { + setArg(key, next, arg); + i++; + } + else if (/^(true|false)$/.test(next)) { + setArg(key, next === 'true', arg); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + else if (/^-[^-]+/.test(arg)) { + var letters = arg.slice(1,-1).split(''); + + var broken = false; + for (var j = 0; j < letters.length; j++) { + var next = arg.slice(j+2); + + if (next === '-') { + setArg(letters[j], next, arg) + continue; + } + + if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) { + setArg(letters[j], next.split('=')[1], arg); + broken = true; + break; + } + + if (/[A-Za-z]/.test(letters[j]) + && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { + setArg(letters[j], next, arg); + broken = true; + break; + } + + if (letters[j+1] && letters[j+1].match(/\W/)) { + setArg(letters[j], arg.slice(j+2), arg); + broken = true; + break; + } + else { + setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg); + } + } + + var key = arg.slice(-1)[0]; + if (!broken && key !== '-') { + if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) + && !flags.bools[key] + && (aliases[key] ? !aliasIsBoolean(key) : true)) { + setArg(key, args[i+1], arg); + i++; + } + else if (args[i+1] && /^(true|false)$/.test(args[i+1])) { + setArg(key, args[i+1] === 'true', arg); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + } + else { + if (!flags.unknownFn || flags.unknownFn(arg) !== false) { + argv._.push( + flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) + ); + } + if (opts.stopEarly) { + argv._.push.apply(argv._, args.slice(i + 1)); + break; + } + } + } + + Object.keys(defaults).forEach(function (key) { + if (!hasKey(argv, key.split('.'))) { + setKey(argv, key.split('.'), defaults[key]); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), defaults[key]); + }); + } + }); + + if (opts['--']) { + argv['--'] = new Array(); + notFlags.forEach(function(key) { + argv['--'].push(key); + }); + } + else { + notFlags.forEach(function(key) { + argv._.push(key); + }); + } + + return argv; +}; + +function hasKey (obj, keys) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + o = (o[key] || {}); + }); + + var key = keys[keys.length - 1]; + return key in o; +} + +function isNumber (x) { + if (typeof x === 'number') return true; + if (/^0x[0-9a-f]+$/i.test(x)) return true; + return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); +} + diff --git a/tools/node_modules/@babel/core/node_modules/minimist/package.json b/tools/node_modules/@babel/core/node_modules/minimist/package.json new file mode 100644 index 00000000000000..c091d41375f9aa --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/minimist/package.json @@ -0,0 +1,45 @@ +{ + "name": "minimist", + "version": "1.2.5", + "description": "parse argument options", + "main": "index.js", + "devDependencies": { + "covert": "^1.0.0", + "tap": "~0.4.0", + "tape": "^3.5.0" + }, + "scripts": { + "test": "tap test/*.js", + "coverage": "covert test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "ff/5", + "firefox/latest", + "chrome/10", + "chrome/latest", + "safari/5.1", + "safari/latest", + "opera/12" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/minimist.git" + }, + "homepage": "https://github.com/substack/minimist", + "keywords": [ + "argv", + "getopt", + "parser", + "optimist" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT" +} diff --git a/tools/node_modules/@babel/core/node_modules/minimist/readme.markdown b/tools/node_modules/@babel/core/node_modules/minimist/readme.markdown new file mode 100644 index 00000000000000..5fd97ab11ee9d8 --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/minimist/readme.markdown @@ -0,0 +1,95 @@ +# minimist + +parse argument options + +This module is the guts of optimist's argument parser without all the +fanciful decoration. + +# example + +``` js +var argv = require('minimist')(process.argv.slice(2)); +console.log(argv); +``` + +``` +$ node example/parse.js -a beep -b boop +{ _: [], a: 'beep', b: 'boop' } +``` + +``` +$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz +{ _: [ 'foo', 'bar', 'baz' ], + x: 3, + y: 4, + n: 5, + a: true, + b: true, + c: true, + beep: 'boop' } +``` + +# security + +Previous versions had a prototype pollution bug that could cause privilege +escalation in some circumstances when handling untrusted user input. + +Please use version 1.2.3 or later: https://snyk.io/vuln/SNYK-JS-MINIMIST-559764 + +# methods + +``` js +var parseArgs = require('minimist') +``` + +## var argv = parseArgs(args, opts={}) + +Return an argument object `argv` populated with the array arguments from `args`. + +`argv._` contains all the arguments that didn't have an option associated with +them. + +Numeric-looking arguments will be returned as numbers unless `opts.string` or +`opts.boolean` is set for that argument name. + +Any arguments after `'--'` will not be parsed and will end up in `argv._`. + +options can be: + +* `opts.string` - a string or array of strings argument names to always treat as +strings +* `opts.boolean` - a boolean, string or array of strings to always treat as +booleans. if `true` will treat all double hyphenated arguments without equal signs +as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`) +* `opts.alias` - an object mapping string names to strings or arrays of string +argument names to use as aliases +* `opts.default` - an object mapping string argument names to default values +* `opts.stopEarly` - when true, populate `argv._` with everything after the +first non-option +* `opts['--']` - when true, populate `argv._` with everything before the `--` +and `argv['--']` with everything after the `--`. Here's an example: + + ``` + > require('./')('one two three -- four five --six'.split(' '), { '--': true }) + { _: [ 'one', 'two', 'three' ], + '--': [ 'four', 'five', '--six' ] } + ``` + + Note that with `opts['--']` set, parsing for arguments still stops after the + `--`. + +* `opts.unknown` - a function which is invoked with a command line parameter not +defined in the `opts` configuration object. If the function returns `false`, the +unknown option is not added to `argv`. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install minimist +``` + +# license + +MIT diff --git a/tools/node_modules/babel-eslint/node_modules/ms/index.js b/tools/node_modules/@babel/core/node_modules/ms/index.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/ms/index.js rename to tools/node_modules/@babel/core/node_modules/ms/index.js diff --git a/tools/node_modules/babel-eslint/node_modules/ms/license.md b/tools/node_modules/@babel/core/node_modules/ms/license.md similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/ms/license.md rename to tools/node_modules/@babel/core/node_modules/ms/license.md diff --git a/tools/node_modules/babel-eslint/node_modules/ms/package.json b/tools/node_modules/@babel/core/node_modules/ms/package.json similarity index 69% rename from tools/node_modules/babel-eslint/node_modules/ms/package.json rename to tools/node_modules/@babel/core/node_modules/ms/package.json index 7192a30c57c910..eea666e1fb03d6 100644 --- a/tools/node_modules/babel-eslint/node_modules/ms/package.json +++ b/tools/node_modules/@babel/core/node_modules/ms/package.json @@ -1,16 +1,16 @@ { - "bugs": { - "url": "https://github.com/zeit/ms/issues" - }, - "bundleDependencies": false, - "deprecated": false, + "name": "ms", + "version": "2.1.2", "description": "Tiny millisecond conversion utility", - "devDependencies": { - "eslint": "4.12.1", - "expect.js": "0.3.1", - "husky": "0.14.3", - "lint-staged": "5.0.0", - "mocha": "4.0.1" + "repository": "zeit/ms", + "main": "./index", + "files": [ + "index.js" + ], + "scripts": { + "precommit": "lint-staged", + "lint": "eslint lib/* bin/*", + "test": "mocha tests.js" }, "eslintConfig": { "extends": "eslint:recommended", @@ -19,11 +19,6 @@ "es6": true } }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/zeit/ms#readme", - "license": "MIT", "lint-staged": { "*.js": [ "npm run lint", @@ -31,16 +26,12 @@ "git add" ] }, - "main": "./index", - "name": "ms", - "repository": { - "type": "git", - "url": "git+https://github.com/zeit/ms.git" - }, - "scripts": { - "lint": "eslint lib/* bin/*", - "precommit": "lint-staged", - "test": "mocha tests.js" - }, - "version": "2.1.2" -} \ No newline at end of file + "license": "MIT", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + } +} diff --git a/tools/node_modules/babel-eslint/node_modules/ms/readme.md b/tools/node_modules/@babel/core/node_modules/ms/readme.md similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/ms/readme.md rename to tools/node_modules/@babel/core/node_modules/ms/readme.md diff --git a/tools/node_modules/babel-eslint/node_modules/path-parse/LICENSE b/tools/node_modules/@babel/core/node_modules/path-parse/LICENSE similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/path-parse/LICENSE rename to tools/node_modules/@babel/core/node_modules/path-parse/LICENSE diff --git a/tools/node_modules/babel-eslint/node_modules/path-parse/README.md b/tools/node_modules/@babel/core/node_modules/path-parse/README.md similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/path-parse/README.md rename to tools/node_modules/@babel/core/node_modules/path-parse/README.md diff --git a/tools/node_modules/babel-eslint/node_modules/path-parse/index.js b/tools/node_modules/@babel/core/node_modules/path-parse/index.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/path-parse/index.js rename to tools/node_modules/@babel/core/node_modules/path-parse/index.js diff --git a/tools/node_modules/babel-eslint/node_modules/path-parse/package.json b/tools/node_modules/@babel/core/node_modules/path-parse/package.json similarity index 69% rename from tools/node_modules/babel-eslint/node_modules/path-parse/package.json rename to tools/node_modules/@babel/core/node_modules/path-parse/package.json index 49b06b414272ce..21332bb14f8b7f 100644 --- a/tools/node_modules/babel-eslint/node_modules/path-parse/package.json +++ b/tools/node_modules/@babel/core/node_modules/path-parse/package.json @@ -1,15 +1,15 @@ { - "author": { - "name": "Javier Blanco", - "email": "http://jbgutierrez.info" + "name": "path-parse", + "version": "1.0.6", + "description": "Node.js path.parse() ponyfill", + "main": "index.js", + "scripts": { + "test": "node test.js" }, - "bugs": { - "url": "https://github.com/jbgutierrez/path-parse/issues" + "repository": { + "type": "git", + "url": "https://github.com/jbgutierrez/path-parse.git" }, - "bundleDependencies": false, - "deprecated": false, - "description": "Node.js path.parse() ponyfill", - "homepage": "https://github.com/jbgutierrez/path-parse#readme", "keywords": [ "path", "paths", @@ -24,15 +24,10 @@ "polyfill", "shim" ], + "author": "Javier Blanco ", "license": "MIT", - "main": "index.js", - "name": "path-parse", - "repository": { - "type": "git", - "url": "git+https://github.com/jbgutierrez/path-parse.git" - }, - "scripts": { - "test": "node test.js" + "bugs": { + "url": "https://github.com/jbgutierrez/path-parse/issues" }, - "version": "1.0.6" -} \ No newline at end of file + "homepage": "https://github.com/jbgutierrez/path-parse#readme" +} diff --git a/tools/node_modules/babel-eslint/node_modules/resolve/LICENSE b/tools/node_modules/@babel/core/node_modules/resolve/LICENSE similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/resolve/LICENSE rename to tools/node_modules/@babel/core/node_modules/resolve/LICENSE diff --git a/tools/node_modules/@babel/core/node_modules/resolve/index.js b/tools/node_modules/@babel/core/node_modules/resolve/index.js new file mode 100644 index 00000000000000..125d8146423596 --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/resolve/index.js @@ -0,0 +1,6 @@ +var async = require('./lib/async'); +async.core = require('./lib/core'); +async.isCore = require('./lib/is-core'); +async.sync = require('./lib/sync'); + +module.exports = async; diff --git a/tools/node_modules/babel-eslint/node_modules/resolve/lib/async.js b/tools/node_modules/@babel/core/node_modules/resolve/lib/async.js similarity index 58% rename from tools/node_modules/babel-eslint/node_modules/resolve/lib/async.js rename to tools/node_modules/@babel/core/node_modules/resolve/lib/async.js index 004b2798baf0c2..29285079451b15 100644 --- a/tools/node_modules/babel-eslint/node_modules/resolve/lib/async.js +++ b/tools/node_modules/@babel/core/node_modules/resolve/lib/async.js @@ -1,9 +1,11 @@ -var core = require('./core'); var fs = require('fs'); var path = require('path'); -var caller = require('./caller.js'); -var nodeModulesPaths = require('./node-modules-paths.js'); -var normalizeOptions = require('./normalize-options.js'); +var caller = require('./caller'); +var nodeModulesPaths = require('./node-modules-paths'); +var normalizeOptions = require('./normalize-options'); +var isCore = require('is-core-module'); + +var realpathFS = fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; var defaultIsFile = function isFile(file, cb) { fs.stat(file, function (err, stat) { @@ -25,17 +27,29 @@ var defaultIsDir = function isDirectory(dir, cb) { }); }; -var maybeUnwrapSymlink = function maybeUnwrapSymlink(x, opts, cb) { +var defaultRealpath = function realpath(x, cb) { + realpathFS(x, function (realpathErr, realPath) { + if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr); + else cb(null, realpathErr ? x : realPath); + }); +}; + +var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) { if (opts && opts.preserveSymlinks === false) { - fs.realpath(x, function (realPathErr, realPath) { - if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); - else cb(null, realPathErr ? x : realPath); - }); + realpath(x, cb); } else { cb(null, x); } }; +var getPackageCandidates = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path.join(dirs[i], x); + } + return dirs; +}; + module.exports = function resolve(x, options, callback) { var cb = callback; var opts = options; @@ -55,8 +69,11 @@ module.exports = function resolve(x, options, callback) { var isFile = opts.isFile || defaultIsFile; var isDirectory = opts.isDirectory || defaultIsDir; var readFile = opts.readFile || fs.readFile; + var realpath = opts.realpath || defaultRealpath; + var packageIterator = opts.packageIterator; var extensions = opts.extensions || ['.js']; + var includeCoreModules = opts.includeCoreModules !== false; var basedir = opts.basedir || path.dirname(caller()); var parent = opts.filename || basedir; @@ -65,7 +82,8 @@ module.exports = function resolve(x, options, callback) { // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory var absoluteStart = path.resolve(basedir); - maybeUnwrapSymlink( + maybeRealpath( + realpath, absoluteStart, opts, function (err, realStart) { @@ -78,15 +96,16 @@ module.exports = function resolve(x, options, callback) { function init(basedir) { if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { res = path.resolve(basedir, x); - if (x === '..' || x.slice(-1) === '/') res += '/'; + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; if ((/\/$/).test(x) && res === basedir) { loadAsDirectory(res, opts.package, onfile); } else loadAsFile(res, opts.package, onfile); + } else if (includeCoreModules && isCore(x)) { + return cb(null, x); } else loadNodeModules(x, basedir, function (err, n, pkg) { if (err) cb(err); - else if (core[x]) return cb(null, x); else if (n) { - return maybeUnwrapSymlink(n, opts, function (err, realN) { + return maybeRealpath(realpath, n, opts, function (err, realN) { if (err) { cb(err); } else { @@ -107,7 +126,7 @@ module.exports = function resolve(x, options, callback) { else loadAsDirectory(res, function (err, d, pkg) { if (err) cb(err); else if (d) { - maybeUnwrapSymlink(d, opts, function (err, realD) { + maybeRealpath(realpath, d, opts, function (err, realD) { if (err) { cb(err); } else { @@ -171,19 +190,22 @@ module.exports = function resolve(x, options, callback) { } if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null); - var pkgfile = path.join(dir, 'package.json'); - isFile(pkgfile, function (err, ex) { - // on err, ex is false - if (!ex) return loadpkg(path.dirname(dir), cb); + maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return loadpkg(path.dirname(dir), cb); + var pkgfile = path.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + // on err, ex is false + if (!ex) return loadpkg(path.dirname(dir), cb); - readFile(pkgfile, function (err, body) { - if (err) cb(err); - try { var pkg = JSON.parse(body); } catch (jsonErr) {} + readFile(pkgfile, function (err, body) { + if (err) cb(err); + try { var pkg = JSON.parse(body); } catch (jsonErr) {} - if (pkg && opts.packageFilter) { - pkg = opts.packageFilter(pkg, pkgfile); - } - cb(null, pkg, dir); + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + cb(null, pkg, dir); + }); }); }); } @@ -196,46 +218,49 @@ module.exports = function resolve(x, options, callback) { fpkg = opts.package; } - var pkgfile = path.join(x, 'package.json'); - isFile(pkgfile, function (err, ex) { - if (err) return cb(err); - if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb); - - readFile(pkgfile, function (err, body) { + maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return cb(unwrapErr); + var pkgfile = path.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { if (err) return cb(err); - try { - var pkg = JSON.parse(body); - } catch (jsonErr) {} + if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb); - if (opts.packageFilter) { - pkg = opts.packageFilter(pkg, pkgfile); - } + readFile(pkgfile, function (err, body) { + if (err) return cb(err); + try { + var pkg = JSON.parse(body); + } catch (jsonErr) {} - if (pkg.main) { - if (typeof pkg.main !== 'string') { - var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); - mainError.code = 'INVALID_PACKAGE_MAIN'; - return cb(mainError); + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); } - if (pkg.main === '.' || pkg.main === './') { - pkg.main = 'index'; - } - loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) { - if (err) return cb(err); - if (m) return cb(null, m, pkg); - if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb); - var dir = path.resolve(x, pkg.main); - loadAsDirectory(dir, pkg, function (err, n, pkg) { + if (pkg && pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + return cb(mainError); + } + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) { if (err) return cb(err); - if (n) return cb(null, n, pkg); - loadAsFile(path.join(x, 'index'), pkg, cb); + if (m) return cb(null, m, pkg); + if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb); + + var dir = path.resolve(x, pkg.main); + loadAsDirectory(dir, pkg, function (err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + loadAsFile(path.join(x, 'index'), pkg, cb); + }); }); - }); - return; - } + return; + } - loadAsFile(path.join(x, '/index'), pkg, cb); + loadAsFile(path.join(x, '/index'), pkg, cb); + }); }); }); } @@ -244,19 +269,18 @@ module.exports = function resolve(x, options, callback) { if (dirs.length === 0) return cb(null, undefined); var dir = dirs[0]; - isDirectory(dir, isdir); + isDirectory(path.dirname(dir), isdir); function isdir(err, isdir) { if (err) return cb(err); if (!isdir) return processDirs(cb, dirs.slice(1)); - var file = path.join(dir, x); - loadAsFile(file, opts.package, onfile); + loadAsFile(dir, opts.package, onfile); } function onfile(err, m, pkg) { if (err) return cb(err); if (m) return cb(null, m, pkg); - loadAsDirectory(path.join(dir, x), opts.package, ondir); + loadAsDirectory(dir, opts.package, ondir); } function ondir(err, n, pkg) { @@ -266,6 +290,10 @@ module.exports = function resolve(x, options, callback) { } } function loadNodeModules(x, start, cb) { - processDirs(cb, nodeModulesPaths(start, opts, x)); + var thunk = function () { return getPackageCandidates(x, start, opts); }; + processDirs( + cb, + packageIterator ? packageIterator(x, start, thunk, opts) : thunk() + ); } }; diff --git a/tools/node_modules/babel-eslint/node_modules/resolve/lib/caller.js b/tools/node_modules/@babel/core/node_modules/resolve/lib/caller.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/resolve/lib/caller.js rename to tools/node_modules/@babel/core/node_modules/resolve/lib/caller.js diff --git a/tools/node_modules/babel-eslint/node_modules/resolve/lib/core.js b/tools/node_modules/@babel/core/node_modules/resolve/lib/core.js similarity index 93% rename from tools/node_modules/babel-eslint/node_modules/resolve/lib/core.js rename to tools/node_modules/@babel/core/node_modules/resolve/lib/core.js index 0877650ccad4e8..c417d23c5a8ff7 100644 --- a/tools/node_modules/babel-eslint/node_modules/resolve/lib/core.js +++ b/tools/node_modules/@babel/core/node_modules/resolve/lib/core.js @@ -6,8 +6,8 @@ function specifierIncluded(specifier) { var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); for (var i = 0; i < 3; ++i) { - var cur = Number(current[i] || 0); - var ver = Number(versionParts[i] || 0); + var cur = parseInt(current[i] || 0, 10); + var ver = parseInt(versionParts[i] || 0, 10); if (cur === ver) { continue; // eslint-disable-line no-restricted-syntax, no-continue } diff --git a/tools/node_modules/babel-eslint/node_modules/resolve/lib/core.json b/tools/node_modules/@babel/core/node_modules/resolve/lib/core.json similarity index 87% rename from tools/node_modules/babel-eslint/node_modules/resolve/lib/core.json rename to tools/node_modules/@babel/core/node_modules/resolve/lib/core.json index 12a6ac7e6c364b..226198f89b5ef0 100644 --- a/tools/node_modules/babel-eslint/node_modules/resolve/lib/core.json +++ b/tools/node_modules/@babel/core/node_modules/resolve/lib/core.json @@ -1,5 +1,6 @@ { "assert": true, + "assert/strict": ">= 15", "async_hooks": ">= 8", "buffer_ieee754": "< 0.9.7", "buffer": true, @@ -11,12 +12,14 @@ "_debug_agent": ">= 1 && < 8", "_debugger": "< 8", "dgram": true, + "diagnostics_channel": ">= 15.1", "dns": true, - "domain": true, + "dns/promises": ">= 15", + "domain": ">= 0.7.12", "events": true, "freelist": "< 6", "fs": true, - "fs/promises": ">= 10 && < 10.1", + "fs/promises": [">= 10 && < 10.1", ">= 14"], "_http_agent": ">= 0.11.1", "_http_client": ">= 0.11.1", "_http_common": ">= 0.11.1", @@ -49,9 +52,11 @@ "_stream_readable": ">= 0.9.4", "_stream_writable": ">= 0.9.4", "stream": true, + "stream/promises": ">= 15", "string_decoder": true, - "sys": true, + "sys": [">= 0.6 && < 0.7", ">= 0.8"], "timers": true, + "timers/promises": ">= 15", "_tls_common": ">= 0.11.13", "_tls_legacy": ">= 0.11.3 && < 10", "_tls_wrap": ">= 0.11.3", @@ -69,6 +74,7 @@ "v8/tools/splaytree": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], "v8": ">= 1", "vm": true, + "wasi": ">= 13.4 && < 13.5", "worker_threads": ">= 11.7", "zlib": true } diff --git a/tools/node_modules/@babel/core/node_modules/resolve/lib/is-core.js b/tools/node_modules/@babel/core/node_modules/resolve/lib/is-core.js new file mode 100644 index 00000000000000..537f5c782ffe55 --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/resolve/lib/is-core.js @@ -0,0 +1,5 @@ +var isCoreModule = require('is-core-module'); + +module.exports = function isCore(x) { + return isCoreModule(x); +}; diff --git a/tools/node_modules/babel-eslint/node_modules/resolve/lib/node-modules-paths.js b/tools/node_modules/@babel/core/node_modules/resolve/lib/node-modules-paths.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/resolve/lib/node-modules-paths.js rename to tools/node_modules/@babel/core/node_modules/resolve/lib/node-modules-paths.js diff --git a/tools/node_modules/babel-eslint/node_modules/resolve/lib/normalize-options.js b/tools/node_modules/@babel/core/node_modules/resolve/lib/normalize-options.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/resolve/lib/normalize-options.js rename to tools/node_modules/@babel/core/node_modules/resolve/lib/normalize-options.js diff --git a/tools/node_modules/babel-eslint/node_modules/resolve/lib/sync.js b/tools/node_modules/@babel/core/node_modules/resolve/lib/sync.js similarity index 63% rename from tools/node_modules/babel-eslint/node_modules/resolve/lib/sync.js rename to tools/node_modules/@babel/core/node_modules/resolve/lib/sync.js index e8d83de5b6d3b2..d5308c926e498b 100644 --- a/tools/node_modules/babel-eslint/node_modules/resolve/lib/sync.js +++ b/tools/node_modules/@babel/core/node_modules/resolve/lib/sync.js @@ -1,9 +1,11 @@ -var core = require('./core'); +var isCore = require('is-core-module'); var fs = require('fs'); var path = require('path'); -var caller = require('./caller.js'); -var nodeModulesPaths = require('./node-modules-paths.js'); -var normalizeOptions = require('./normalize-options.js'); +var caller = require('./caller'); +var nodeModulesPaths = require('./node-modules-paths'); +var normalizeOptions = require('./normalize-options'); + +var realpathFS = fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; var defaultIsFile = function isFile(file) { try { @@ -25,20 +27,33 @@ var defaultIsDir = function isDirectory(dir) { return stat.isDirectory(); }; -var maybeUnwrapSymlink = function maybeUnwrapSymlink(x, opts) { - if (opts && opts.preserveSymlinks === false) { - try { - return fs.realpathSync(x); - } catch (realPathErr) { - if (realPathErr.code !== 'ENOENT') { - throw realPathErr; - } +var defaultRealpathSync = function realpathSync(x) { + try { + return realpathFS(x); + } catch (realpathErr) { + if (realpathErr.code !== 'ENOENT') { + throw realpathErr; } } return x; }; -module.exports = function (x, options) { +var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) { + if (opts && opts.preserveSymlinks === false) { + return realpathSync(x); + } + return x; +}; + +var getPackageCandidates = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path.join(dirs[i], x); + } + return dirs; +}; + +module.exports = function resolveSync(x, options) { if (typeof x !== 'string') { throw new TypeError('Path must be a string.'); } @@ -47,30 +62,31 @@ module.exports = function (x, options) { var isFile = opts.isFile || defaultIsFile; var readFileSync = opts.readFileSync || fs.readFileSync; var isDirectory = opts.isDirectory || defaultIsDir; + var realpathSync = opts.realpathSync || defaultRealpathSync; + var packageIterator = opts.packageIterator; var extensions = opts.extensions || ['.js']; + var includeCoreModules = opts.includeCoreModules !== false; var basedir = opts.basedir || path.dirname(caller()); var parent = opts.filename || basedir; opts.paths = opts.paths || []; // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory - var absoluteStart = maybeUnwrapSymlink(path.resolve(basedir), opts); + var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts); if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { var res = path.resolve(absoluteStart, x); - if (x === '..' || x.slice(-1) === '/') res += '/'; + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; var m = loadAsFileSync(res) || loadAsDirectorySync(res); - if (m) return maybeUnwrapSymlink(m, opts); - } else if (core[x]) { + if (m) return maybeRealpathSync(realpathSync, m, opts); + } else if (includeCoreModules && isCore(x)) { return x; } else { var n = loadNodeModulesSync(x, absoluteStart); - if (n) return maybeUnwrapSymlink(n, opts); + if (n) return maybeRealpathSync(realpathSync, n, opts); } - if (core[x]) return x; - var err = new Error("Cannot find module '" + x + "' from '" + parent + "'"); err.code = 'MODULE_NOT_FOUND'; throw err; @@ -105,7 +121,7 @@ module.exports = function (x, options) { } if ((/[/\\]node_modules[/\\]*$/).test(dir)) return; - var pkgfile = path.join(dir, 'package.json'); + var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), 'package.json'); if (!isFile(pkgfile)) { return loadpkg(path.dirname(dir)); @@ -118,25 +134,27 @@ module.exports = function (x, options) { } catch (jsonErr) {} if (pkg && opts.packageFilter) { - pkg = opts.packageFilter(pkg, dir); + // v2 will pass pkgfile + pkg = opts.packageFilter(pkg, /*pkgfile,*/ dir); // eslint-disable-line spaced-comment } return { pkg: pkg, dir: dir }; } function loadAsDirectorySync(x) { - var pkgfile = path.join(x, '/package.json'); + var pkgfile = path.join(maybeRealpathSync(realpathSync, x, opts), '/package.json'); if (isFile(pkgfile)) { try { var body = readFileSync(pkgfile, 'UTF8'); var pkg = JSON.parse(body); } catch (e) {} - if (opts.packageFilter) { - pkg = opts.packageFilter(pkg, x); + if (pkg && opts.packageFilter) { + // v2 will pass pkgfile + pkg = opts.packageFilter(pkg, /*pkgfile,*/ x); // eslint-disable-line spaced-comment } - if (pkg.main) { + if (pkg && pkg.main) { if (typeof pkg.main !== 'string') { var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); mainError.code = 'INVALID_PACKAGE_MAIN'; @@ -158,13 +176,15 @@ module.exports = function (x, options) { } function loadNodeModulesSync(x, start) { - var dirs = nodeModulesPaths(start, opts, x); + var thunk = function () { return getPackageCandidates(x, start, opts); }; + var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk(); + for (var i = 0; i < dirs.length; i++) { var dir = dirs[i]; - if (isDirectory(dir)) { - var m = loadAsFileSync(path.join(dir, '/', x)); + if (isDirectory(path.dirname(dir))) { + var m = loadAsFileSync(dir); if (m) return m; - var n = loadAsDirectorySync(path.join(dir, '/', x)); + var n = loadAsDirectorySync(dir); if (n) return n; } } diff --git a/tools/node_modules/@babel/core/node_modules/resolve/package.json b/tools/node_modules/@babel/core/node_modules/resolve/package.json new file mode 100644 index 00000000000000..dfcfc497b34eaf --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/resolve/package.json @@ -0,0 +1,51 @@ +{ + "name": "resolve", + "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", + "version": "1.19.0", + "repository": { + "type": "git", + "url": "git://github.com/browserify/resolve.git" + }, + "main": "index.js", + "keywords": [ + "resolve", + "require", + "node", + "module" + ], + "scripts": { + "prepublish": "safe-publish-latest && cp node_modules/is-core-module/core.json ./lib/", + "prelint": "eclint check '**/*'", + "lint": "eslint --ext=js,mjs .", + "pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async", + "tests-only": "tape test/*.js", + "pretest": "npm run lint", + "test": "npm run --silent tests-only", + "posttest": "npm run test:multirepo && aud --production", + "test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test" + }, + "devDependencies": { + "@ljharb/eslint-config": "^17.2.0", + "array.prototype.map": "^1.0.2", + "aud": "^1.1.3", + "eclint": "^2.8.1", + "eslint": "^7.13.0", + "object-keys": "^1.1.1", + "safe-publish-latest": "^1.1.4", + "tap": "0.4.13", + "tape": "^5.0.1" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "dependencies": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + } +} diff --git a/tools/node_modules/babel-eslint/node_modules/resolve/readme.markdown b/tools/node_modules/@babel/core/node_modules/resolve/readme.markdown similarity index 67% rename from tools/node_modules/babel-eslint/node_modules/resolve/readme.markdown rename to tools/node_modules/@babel/core/node_modules/resolve/readme.markdown index f1b27063901cb3..f742c38dd48df8 100644 --- a/tools/node_modules/babel-eslint/node_modules/resolve/readme.markdown +++ b/tools/node_modules/@babel/core/node_modules/resolve/readme.markdown @@ -5,7 +5,7 @@ algorithm](https://nodejs.org/api/modules.html#modules_all_together) such that you can `require.resolve()` on behalf of a file asynchronously and synchronously -[![build status](https://secure.travis-ci.org/browserify/node-resolve.png)](http://travis-ci.org/browserify/node-resolve) +[![build status](https://secure.travis-ci.org/browserify/resolve.png)](http://travis-ci.org/browserify/resolve) # example @@ -43,6 +43,12 @@ $ node example/sync.js var resolve = require('resolve'); ``` +For both the synchronous and asynchronous methods, errors may have any of the following `err.code` values: + +- `MODULE_NOT_FOUND`: the given path string (`id`) could not be resolved to a module +- `INVALID_BASEDIR`: the specified `opts.basedir` doesn't exist, or is not a directory +- `INVALID_PACKAGE_MAIN`: a `package.json` was encountered with an invalid `main` property (eg. not a string) + ## resolve(id, opts={}, cb) Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`. @@ -55,15 +61,20 @@ options are: * opts.extensions - array of file extensions to search in order +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search + * opts.readFile - how to read files asynchronously * opts.isFile - function to asynchronously test whether a file exists * opts.isDirectory - function to asynchronously test whether a directory exists -* `opts.packageFilter(pkg, pkgfile)` - transform the parsed package.json contents before looking at the "main" field +* opts.realpath - function to asynchronously resolve a potential symlink to its real path + +* `opts.packageFilter(pkg, pkgfile, dir)` - transform the parsed package.json contents before looking at the "main" field * pkg - package data * pkgfile - path to package.json + * dir - directory for package.json * `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package * pkg - package data @@ -79,6 +90,12 @@ options are: * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution * opts - the resolution options +* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) + * request - the import specifier being resolved + * start - lookup path + * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + * opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` * opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. @@ -93,6 +110,7 @@ default `opts` values: paths: [], basedir: __dirname, extensions: ['.js'], + includeCoreModules: true, readFile: fs.readFile, isFile: function isFile(file, cb) { fs.stat(file, function (err, stat) { @@ -112,6 +130,13 @@ default `opts` values: return cb(err); }); }, + realpath: function realpath(file, cb) { + var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; + realpath(file, function (realPathErr, realPath) { + if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); + else cb(null, realPathErr ? file : realPath); + }); + }, moduleDirectory: 'node_modules', preserveSymlinks: true } @@ -128,12 +153,16 @@ options are: * opts.extensions - array of file extensions to search in order +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search + * opts.readFile - how to read files synchronously * opts.isFile - function to synchronously test whether a file exists * opts.isDirectory - function to synchronously test whether a directory exists +* opts.realpathSync - function to synchronously resolve a potential symlink to its real path + * `opts.packageFilter(pkg, dir)` - transform the parsed package.json contents before looking at the "main" field * pkg - package data * dir - directory for package.json (Note: the second argument will change to "pkgfile" in v2) @@ -146,6 +175,18 @@ options are: * opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) + For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function + * request - the import specifier being resolved + * start - lookup path + * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) + * request - the import specifier being resolved + * start - lookup path + * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + * opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` * opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. @@ -160,6 +201,7 @@ default `opts` values: paths: [], basedir: __dirname, extensions: ['.js'], + includeCoreModules: true, readFileSync: fs.readFileSync, isFile: function isFile(file) { try { @@ -179,15 +221,22 @@ default `opts` values: } return stat.isDirectory(); }, + realpathSync: function realpathSync(file) { + try { + var realpath = typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; + return realpath(file); + } catch (realPathErr) { + if (realPathErr.code !== 'ENOENT') { + throw realPathErr; + } + } + return file; + }, moduleDirectory: 'node_modules', preserveSymlinks: true } ``` -## resolve.isCore(pkg) - -Return whether a package is in core. - # install With [npm](https://npmjs.org) do: diff --git a/tools/node_modules/babel-eslint/node_modules/trim-right/license b/tools/node_modules/@babel/core/node_modules/safe-buffer/LICENSE similarity index 93% rename from tools/node_modules/babel-eslint/node_modules/trim-right/license rename to tools/node_modules/@babel/core/node_modules/safe-buffer/LICENSE index 654d0bfe943437..0c068ceecbd48f 100644 --- a/tools/node_modules/babel-eslint/node_modules/trim-right/license +++ b/tools/node_modules/@babel/core/node_modules/safe-buffer/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Feross Aboukhadijeh Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/tools/node_modules/@babel/core/node_modules/safe-buffer/README.md b/tools/node_modules/@babel/core/node_modules/safe-buffer/README.md new file mode 100644 index 00000000000000..e9a81afd0406f0 --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/safe-buffer/README.md @@ -0,0 +1,584 @@ +# safe-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] + +[travis-image]: https://img.shields.io/travis/feross/safe-buffer/master.svg +[travis-url]: https://travis-ci.org/feross/safe-buffer +[npm-image]: https://img.shields.io/npm/v/safe-buffer.svg +[npm-url]: https://npmjs.org/package/safe-buffer +[downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg +[downloads-url]: https://npmjs.org/package/safe-buffer +[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg +[standard-url]: https://standardjs.com + +#### Safer Node.js Buffer API + +**Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`, +`Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.** + +**Uses the built-in implementation when available.** + +## install + +``` +npm install safe-buffer +``` + +## usage + +The goal of this package is to provide a safe replacement for the node.js `Buffer`. + +It's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to +the top of your node.js modules: + +```js +var Buffer = require('safe-buffer').Buffer + +// Existing buffer code will continue to work without issues: + +new Buffer('hey', 'utf8') +new Buffer([1, 2, 3], 'utf8') +new Buffer(obj) +new Buffer(16) // create an uninitialized buffer (potentially unsafe) + +// But you can use these new explicit APIs to make clear what you want: + +Buffer.from('hey', 'utf8') // convert from many types to a Buffer +Buffer.alloc(16) // create a zero-filled buffer (safe) +Buffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe) +``` + +## api + +### Class Method: Buffer.from(array) + + +* `array` {Array} + +Allocates a new `Buffer` using an `array` of octets. + +```js +const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]); + // creates a new Buffer containing ASCII bytes + // ['b','u','f','f','e','r'] +``` + +A `TypeError` will be thrown if `array` is not an `Array`. + +### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]]) + + +* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or + a `new ArrayBuffer()` +* `byteOffset` {Number} Default: `0` +* `length` {Number} Default: `arrayBuffer.length - byteOffset` + +When passed a reference to the `.buffer` property of a `TypedArray` instance, +the newly created `Buffer` will share the same allocated memory as the +TypedArray. + +```js +const arr = new Uint16Array(2); +arr[0] = 5000; +arr[1] = 4000; + +const buf = Buffer.from(arr.buffer); // shares the memory with arr; + +console.log(buf); + // Prints: + +// changing the TypedArray changes the Buffer also +arr[1] = 6000; + +console.log(buf); + // Prints: +``` + +The optional `byteOffset` and `length` arguments specify a memory range within +the `arrayBuffer` that will be shared by the `Buffer`. + +```js +const ab = new ArrayBuffer(10); +const buf = Buffer.from(ab, 0, 2); +console.log(buf.length); + // Prints: 2 +``` + +A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`. + +### Class Method: Buffer.from(buffer) + + +* `buffer` {Buffer} + +Copies the passed `buffer` data onto a new `Buffer` instance. + +```js +const buf1 = Buffer.from('buffer'); +const buf2 = Buffer.from(buf1); + +buf1[0] = 0x61; +console.log(buf1.toString()); + // 'auffer' +console.log(buf2.toString()); + // 'buffer' (copy is not changed) +``` + +A `TypeError` will be thrown if `buffer` is not a `Buffer`. + +### Class Method: Buffer.from(str[, encoding]) + + +* `str` {String} String to encode. +* `encoding` {String} Encoding to use, Default: `'utf8'` + +Creates a new `Buffer` containing the given JavaScript string `str`. If +provided, the `encoding` parameter identifies the character encoding. +If not provided, `encoding` defaults to `'utf8'`. + +```js +const buf1 = Buffer.from('this is a tést'); +console.log(buf1.toString()); + // prints: this is a tést +console.log(buf1.toString('ascii')); + // prints: this is a tC)st + +const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex'); +console.log(buf2.toString()); + // prints: this is a tést +``` + +A `TypeError` will be thrown if `str` is not a string. + +### Class Method: Buffer.alloc(size[, fill[, encoding]]) + + +* `size` {Number} +* `fill` {Value} Default: `undefined` +* `encoding` {String} Default: `utf8` + +Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the +`Buffer` will be *zero-filled*. + +```js +const buf = Buffer.alloc(5); +console.log(buf); + // +``` + +The `size` must be less than or equal to the value of +`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is +`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will +be created if a `size` less than or equal to 0 is specified. + +If `fill` is specified, the allocated `Buffer` will be initialized by calling +`buf.fill(fill)`. See [`buf.fill()`][] for more information. + +```js +const buf = Buffer.alloc(5, 'a'); +console.log(buf); + // +``` + +If both `fill` and `encoding` are specified, the allocated `Buffer` will be +initialized by calling `buf.fill(fill, encoding)`. For example: + +```js +const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); +console.log(buf); + // +``` + +Calling `Buffer.alloc(size)` can be significantly slower than the alternative +`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance +contents will *never contain sensitive data*. + +A `TypeError` will be thrown if `size` is not a number. + +### Class Method: Buffer.allocUnsafe(size) + + +* `size` {Number} + +Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must +be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit +architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is +thrown. A zero-length Buffer will be created if a `size` less than or equal to +0 is specified. + +The underlying memory for `Buffer` instances created in this way is *not +initialized*. The contents of the newly created `Buffer` are unknown and +*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such +`Buffer` instances to zeroes. + +```js +const buf = Buffer.allocUnsafe(5); +console.log(buf); + // + // (octets will be different, every time) +buf.fill(0); +console.log(buf); + // +``` + +A `TypeError` will be thrown if `size` is not a number. + +Note that the `Buffer` module pre-allocates an internal `Buffer` instance of +size `Buffer.poolSize` that is used as a pool for the fast allocation of new +`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated +`new Buffer(size)` constructor) only when `size` is less than or equal to +`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default +value of `Buffer.poolSize` is `8192` but can be modified. + +Use of this pre-allocated internal memory pool is a key difference between +calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. +Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer +pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal +Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The +difference is subtle but can be important when an application requires the +additional performance that `Buffer.allocUnsafe(size)` provides. + +### Class Method: Buffer.allocUnsafeSlow(size) + + +* `size` {Number} + +Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The +`size` must be less than or equal to the value of +`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is +`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will +be created if a `size` less than or equal to 0 is specified. + +The underlying memory for `Buffer` instances created in this way is *not +initialized*. The contents of the newly created `Buffer` are unknown and +*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such +`Buffer` instances to zeroes. + +When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, +allocations under 4KB are, by default, sliced from a single pre-allocated +`Buffer`. This allows applications to avoid the garbage collection overhead of +creating many individually allocated Buffers. This approach improves both +performance and memory usage by eliminating the need to track and cleanup as +many `Persistent` objects. + +However, in the case where a developer may need to retain a small chunk of +memory from a pool for an indeterminate amount of time, it may be appropriate +to create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then +copy out the relevant bits. + +```js +// need to keep around a few small chunks of memory +const store = []; + +socket.on('readable', () => { + const data = socket.read(); + // allocate for retained data + const sb = Buffer.allocUnsafeSlow(10); + // copy the data into the new allocation + data.copy(sb, 0, 0, 10); + store.push(sb); +}); +``` + +Use of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after* +a developer has observed undue memory retention in their applications. + +A `TypeError` will be thrown if `size` is not a number. + +### All the Rest + +The rest of the `Buffer` API is exactly the same as in node.js. +[See the docs](https://nodejs.org/api/buffer.html). + + +## Related links + +- [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660) +- [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4) + +## Why is `Buffer` unsafe? + +Today, the node.js `Buffer` constructor is overloaded to handle many different argument +types like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.), +`ArrayBuffer`, and also `Number`. + +The API is optimized for convenience: you can throw any type at it, and it will try to do +what you want. + +Because the Buffer constructor is so powerful, you often see code like this: + +```js +// Convert UTF-8 strings to hex +function toHex (str) { + return new Buffer(str).toString('hex') +} +``` + +***But what happens if `toHex` is called with a `Number` argument?*** + +### Remote Memory Disclosure + +If an attacker can make your program call the `Buffer` constructor with a `Number` +argument, then they can make it allocate uninitialized memory from the node.js process. +This could potentially disclose TLS private keys, user data, or database passwords. + +When the `Buffer` constructor is passed a `Number` argument, it returns an +**UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like +this, you **MUST** overwrite the contents before returning it to the user. + +From the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size): + +> `new Buffer(size)` +> +> - `size` Number +> +> The underlying memory for `Buffer` instances created in this way is not initialized. +> **The contents of a newly created `Buffer` are unknown and could contain sensitive +> data.** Use `buf.fill(0)` to initialize a Buffer to zeroes. + +(Emphasis our own.) + +Whenever the programmer intended to create an uninitialized `Buffer` you often see code +like this: + +```js +var buf = new Buffer(16) + +// Immediately overwrite the uninitialized buffer with data from another buffer +for (var i = 0; i < buf.length; i++) { + buf[i] = otherBuf[i] +} +``` + + +### Would this ever be a problem in real code? + +Yes. It's surprisingly common to forget to check the type of your variables in a +dynamically-typed language like JavaScript. + +Usually the consequences of assuming the wrong type is that your program crashes with an +uncaught exception. But the failure mode for forgetting to check the type of arguments to +the `Buffer` constructor is more catastrophic. + +Here's an example of a vulnerable service that takes a JSON payload and converts it to +hex: + +```js +// Take a JSON payload {str: "some string"} and convert it to hex +var server = http.createServer(function (req, res) { + var data = '' + req.setEncoding('utf8') + req.on('data', function (chunk) { + data += chunk + }) + req.on('end', function () { + var body = JSON.parse(data) + res.end(new Buffer(body.str).toString('hex')) + }) +}) + +server.listen(8080) +``` + +In this example, an http client just has to send: + +```json +{ + "str": 1000 +} +``` + +and it will get back 1,000 bytes of uninitialized memory from the server. + +This is a very serious bug. It's similar in severity to the +[the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process +memory by remote attackers. + + +### Which real-world packages were vulnerable? + +#### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht) + +[Mathias Buus](https://github.com/mafintosh) and I +([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages, +[`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow +anyone on the internet to send a series of messages to a user of `bittorrent-dht` and get +them to reveal 20 bytes at a time of uninitialized memory from the node.js process. + +Here's +[the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8) +that fixed it. We released a new fixed version, created a +[Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all +vulnerable versions on npm so users will get a warning to upgrade to a newer version. + +#### [`ws`](https://www.npmjs.com/package/ws) + +That got us wondering if there were other vulnerable packages. Sure enough, within a short +period of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the +most popular WebSocket implementation in node.js. + +If certain APIs were called with `Number` parameters instead of `String` or `Buffer` as +expected, then uninitialized server memory would be disclosed to the remote peer. + +These were the vulnerable methods: + +```js +socket.send(number) +socket.ping(number) +socket.pong(number) +``` + +Here's a vulnerable socket server with some echo functionality: + +```js +server.on('connection', function (socket) { + socket.on('message', function (message) { + message = JSON.parse(message) + if (message.type === 'echo') { + socket.send(message.data) // send back the user's message + } + }) +}) +``` + +`socket.send(number)` called on the server, will disclose server memory. + +Here's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue +was fixed, with a more detailed explanation. Props to +[Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the +[Node Security Project disclosure](https://nodesecurity.io/advisories/67). + + +### What's the solution? + +It's important that node.js offers a fast way to get memory otherwise performance-critical +applications would needlessly get a lot slower. + +But we need a better way to *signal our intent* as programmers. **When we want +uninitialized memory, we should request it explicitly.** + +Sensitive functionality should not be packed into a developer-friendly API that loosely +accepts many different types. This type of API encourages the lazy practice of passing +variables in without checking the type very carefully. + +#### A new API: `Buffer.allocUnsafe(number)` + +The functionality of creating buffers with uninitialized memory should be part of another +API. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that +frequently gets user input of all sorts of different types passed into it. + +```js +var buf = Buffer.allocUnsafe(16) // careful, uninitialized memory! + +// Immediately overwrite the uninitialized buffer with data from another buffer +for (var i = 0; i < buf.length; i++) { + buf[i] = otherBuf[i] +} +``` + + +### How do we fix node.js core? + +We sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as +`semver-major`) which defends against one case: + +```js +var str = 16 +new Buffer(str, 'utf8') +``` + +In this situation, it's implied that the programmer intended the first argument to be a +string, since they passed an encoding as a second argument. Today, node.js will allocate +uninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not +what the programmer intended. + +But this is only a partial solution, since if the programmer does `new Buffer(variable)` +(without an `encoding` parameter) there's no way to know what they intended. If `variable` +is sometimes a number, then uninitialized memory will sometimes be returned. + +### What's the real long-term fix? + +We could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when +we need uninitialized memory. But that would break 1000s of packages. + +~~We believe the best solution is to:~~ + +~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~ + +~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~ + +#### Update + +We now support adding three new APIs: + +- `Buffer.from(value)` - convert from any type to a buffer +- `Buffer.alloc(size)` - create a zero-filled buffer +- `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size + +This solves the core problem that affected `ws` and `bittorrent-dht` which is +`Buffer(variable)` getting tricked into taking a number argument. + +This way, existing code continues working and the impact on the npm ecosystem will be +minimal. Over time, npm maintainers can migrate performance-critical code to use +`Buffer.allocUnsafe(number)` instead of `new Buffer(number)`. + + +### Conclusion + +We think there's a serious design issue with the `Buffer` API as it exists today. It +promotes insecure software by putting high-risk functionality into a convenient API +with friendly "developer ergonomics". + +This wasn't merely a theoretical exercise because we found the issue in some of the +most popular npm packages. + +Fortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of +`buffer`. + +```js +var Buffer = require('safe-buffer').Buffer +``` + +Eventually, we hope that node.js core can switch to this new, safer behavior. We believe +the impact on the ecosystem would be minimal since it's not a breaking change. +Well-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while +older, insecure packages would magically become safe from this attack vector. + + +## links + +- [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514) +- [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67) +- [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68) + + +## credit + +The original issues in `bittorrent-dht` +([disclosure](https://nodesecurity.io/advisories/68)) and +`ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by +[Mathias Buus](https://github.com/mafintosh) and +[Feross Aboukhadijeh](http://feross.org/). + +Thanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues +and for his work running the [Node Security Project](https://nodesecurity.io/). + +Thanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and +auditing the code. + + +## license + +MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org) diff --git a/tools/node_modules/@babel/core/node_modules/safe-buffer/index.js b/tools/node_modules/@babel/core/node_modules/safe-buffer/index.js new file mode 100644 index 00000000000000..22438dabbbceef --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/safe-buffer/index.js @@ -0,0 +1,62 @@ +/* eslint-disable node/no-deprecated-api */ +var buffer = require('buffer') +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} diff --git a/tools/node_modules/@babel/core/node_modules/safe-buffer/package.json b/tools/node_modules/@babel/core/node_modules/safe-buffer/package.json new file mode 100644 index 00000000000000..623fbc3f6b0c48 --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/safe-buffer/package.json @@ -0,0 +1,37 @@ +{ + "name": "safe-buffer", + "description": "Safer Node.js Buffer API", + "version": "5.1.2", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org" + }, + "bugs": { + "url": "https://github.com/feross/safe-buffer/issues" + }, + "devDependencies": { + "standard": "*", + "tape": "^4.0.0" + }, + "homepage": "https://github.com/feross/safe-buffer", + "keywords": [ + "buffer", + "buffer allocate", + "node security", + "safe", + "safe-buffer", + "security", + "uninitialized" + ], + "license": "MIT", + "main": "index.js", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "git://github.com/feross/safe-buffer.git" + }, + "scripts": { + "test": "standard && tape test/*.js" + } +} diff --git a/tools/node_modules/@babel/core/node_modules/semver/LICENSE b/tools/node_modules/@babel/core/node_modules/semver/LICENSE new file mode 100644 index 00000000000000..19129e315fe593 --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/semver/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/tools/node_modules/@babel/core/node_modules/semver/README.md b/tools/node_modules/@babel/core/node_modules/semver/README.md new file mode 100644 index 00000000000000..f8dfa5a0df5fc4 --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/semver/README.md @@ -0,0 +1,412 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Install + +```bash +npm install --save semver +```` + +## Usage + +As a node module: + +```js +const semver = require('semver') + +semver.valid('1.2.3') // '1.2.3' +semver.valid('a.b.c') // null +semver.clean(' =v1.2.3 ') // '1.2.3' +semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true +semver.gt('1.2.3', '9.8.7') // false +semver.lt('1.2.3', '9.8.7') // true +semver.minVersion('>=1.0.0') // '1.0.0' +semver.valid(semver.coerce('v2')) // '2.0.0' +semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' +``` + +As a command-line utility: + +``` +$ semver -h + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them. +``` + +## Versions + +A "version" is described by the `v2.0.0` specification found at +. + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Ranges + +A `version range` is a set of `comparators` which specify versions +that satisfy the range. + +A `comparator` is composed of an `operator` and a `version`. The set +of primitive `operators` is: + +* `<` Less than +* `<=` Less than or equal to +* `>` Greater than +* `>=` Greater than or equal to +* `=` Equal. If no operator is specified, then equality is assumed, + so this operator is optional, but MAY be included. + +For example, the comparator `>=1.2.7` would match the versions +`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` +or `1.1.0`. + +Comparators can be joined by whitespace to form a `comparator set`, +which is satisfied by the **intersection** of all of the comparators +it includes. + +A range is composed of one or more comparator sets, joined by `||`. A +version matches a range if and only if every comparator in at least +one of the `||`-separated comparator sets is satisfied by the version. + +For example, the range `>=1.2.7 <1.3.0` would match the versions +`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, +or `1.1.0`. + +The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, +`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. + +### Prerelease Tags + +If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then +it will only be allowed to satisfy comparator sets if at least one +comparator with the same `[major, minor, patch]` tuple also has a +prerelease tag. + +For example, the range `>1.2.3-alpha.3` would be allowed to match the +version `1.2.3-alpha.7`, but it would *not* be satisfied by +`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater +than" `1.2.3-alpha.3` according to the SemVer sort rules. The version +range only accepts prerelease tags on the `1.2.3` version. The +version `3.4.5` *would* satisfy the range, because it does not have a +prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. + +The purpose for this behavior is twofold. First, prerelease versions +frequently are updated very quickly, and contain many breaking changes +that are (by the author's design) not yet fit for public consumption. +Therefore, by default, they are excluded from range matching +semantics. + +Second, a user who has opted into using a prerelease version has +clearly indicated the intent to use *that specific* set of +alpha/beta/rc versions. By including a prerelease tag in the range, +the user is indicating that they are aware of the risk. However, it +is still not appropriate to assume that they have opted into taking a +similar risk on the *next* set of prerelease versions. + +Note that this behavior can be suppressed (treating all prerelease +versions as if they were normal versions, for the purpose of range +matching) by setting the `includePrerelease` flag on the options +object to any +[functions](https://github.com/npm/node-semver#functions) that do +range matching. + +#### Prerelease Identifiers + +The method `.inc` takes an additional `identifier` string argument that +will append the value of the string as a prerelease identifier: + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta') +// '1.2.4-beta.0' +``` + +command-line example: + +```bash +$ semver 1.2.3 -i prerelease --preid beta +1.2.4-beta.0 +``` + +Which then can be used to increment further: + +```bash +$ semver 1.2.4-beta.0 -i prerelease +1.2.4-beta.1 +``` + +### Advanced Range Syntax + +Advanced range syntax desugars to primitive comparators in +deterministic ways. + +Advanced ranges may be combined in the same way as primitive +comparators using white space or `||`. + +#### Hyphen Ranges `X.Y.Z - A.B.C` + +Specifies an inclusive set. + +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` + +If a partial version is provided as the first version in the inclusive +range, then the missing pieces are replaced with zeroes. + +* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` + +If a partial version is provided as the second version in the +inclusive range, then all versions that start with the supplied parts +of the tuple are accepted, but nothing that would be greater than the +provided tuple parts. + +* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.0` + +#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` + +Any of `X`, `x`, or `*` may be used to "stand in" for one of the +numeric values in the `[major, minor, patch]` tuple. + +* `*` := `>=0.0.0` (Any version satisfies) +* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) +* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) + +A partial version range is treated as an X-Range, so the special +character is in fact optional. + +* `""` (empty string) := `*` := `>=0.0.0` +* `1` := `1.x.x` := `>=1.0.0 <2.0.0` +* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` + +#### Tilde Ranges `~1.2.3` `~1.2` `~1` + +Allows patch-level changes if a minor version is specified on the +comparator. Allows minor-level changes if not. + +* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` +* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) +* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) +* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` +* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) +* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) +* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. + +#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` + +Allows changes that do not modify the left-most non-zero digit in the +`[major, minor, patch]` tuple. In other words, this allows patch and +minor updates for versions `1.0.0` and above, patch updates for +versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. + +Many authors treat a `0.x` version as if the `x` were the major +"breaking-change" indicator. + +Caret ranges are ideal when an author may make breaking changes +between `0.2.4` and `0.3.0` releases, which is a common practice. +However, it presumes that there will *not* be breaking changes between +`0.2.4` and `0.2.5`. It allows for changes that are presumed to be +additive (but non-breaking), according to commonly observed practices. + +* `^1.2.3` := `>=1.2.3 <2.0.0` +* `^0.2.3` := `>=0.2.3 <0.3.0` +* `^0.0.3` := `>=0.0.3 <0.0.4` +* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. +* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the + `0.0.3` version *only* will be allowed, if they are greater than or + equal to `beta`. So, `0.0.3-pr.2` would be allowed. + +When parsing caret ranges, a missing `patch` value desugars to the +number `0`, but will allow flexibility within that value, even if the +major and minor versions are both `0`. + +* `^1.2.x` := `>=1.2.0 <2.0.0` +* `^0.0.x` := `>=0.0.0 <0.1.0` +* `^0.0` := `>=0.0.0 <0.1.0` + +A missing `minor` and `patch` values will desugar to zero, but also +allow flexibility within those values, even if the major version is +zero. + +* `^1.x` := `>=1.0.0 <2.0.0` +* `^0.x` := `>=0.0.0 <1.0.0` + +### Range Grammar + +Putting all this together, here is a Backus-Naur grammar for ranges, +for the benefit of parser authors: + +```bnf +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ +``` + +## Functions + +All methods and classes take a final `options` object argument. All +options in this object are `false` by default. The options supported +are: + +- `loose` Be more forgiving about not-quite-valid semver strings. + (Any resulting output will always be 100% strict compliant, of + course.) For backwards compatibility reasons, if the `options` + argument is a boolean value instead of an object, it is interpreted + to be the `loose` param. +- `includePrerelease` Set to suppress the [default + behavior](https://github.com/npm/node-semver#prerelease-tags) of + excluding prerelease tagged versions from ranges unless they are + explicitly opted into. + +Strict-mode Comparators and Ranges will be strict about the SemVer +strings that they parse. + +* `valid(v)`: Return the parsed version, or null if it's not valid. +* `inc(v, release)`: Return the version incremented by the release + type (`major`, `premajor`, `minor`, `preminor`, `patch`, + `prepatch`, or `prerelease`), or null if it's not valid + * `premajor` in one call will bump the version up to the next major + version and down to a prerelease of that major version. + `preminor`, and `prepatch` work the same way. + * If called from a non-prerelease version, the `prerelease` will work the + same as `prepatch`. It increments the patch version, then makes a + prerelease. If the input version is already a prerelease it simply + increments it. +* `prerelease(v)`: Returns an array of prerelease components, or null + if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` +* `major(v)`: Return the major version number. +* `minor(v)`: Return the minor version number. +* `patch(v)`: Return the patch version number. +* `intersects(r1, r2, loose)`: Return true if the two supplied ranges + or comparators intersect. +* `parse(v)`: Attempt to parse a string as a semantic version, returning either + a `SemVer` object or `null`. + +### Comparison + +* `gt(v1, v2)`: `v1 > v2` +* `gte(v1, v2)`: `v1 >= v2` +* `lt(v1, v2)`: `v1 < v2` +* `lte(v1, v2)`: `v1 <= v2` +* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, + even if they're not the exact same string. You already know how to + compare strings. +* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. +* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions + in descending order when passed to `Array.sort()`. +* `diff(v1, v2)`: Returns difference between two versions by the release type + (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), + or null if the versions are the same. + +### Comparators + +* `intersects(comparator)`: Return true if the comparators intersect + +### Ranges + +* `validRange(range)`: Return the valid range or null if it's not valid +* `satisfies(version, range)`: Return true if the version satisfies the + range. +* `maxSatisfying(versions, range)`: Return the highest version in the list + that satisfies the range, or `null` if none of them do. +* `minSatisfying(versions, range)`: Return the lowest version in the list + that satisfies the range, or `null` if none of them do. +* `minVersion(range)`: Return the lowest version that can possibly match + the given range. +* `gtr(version, range)`: Return `true` if version is greater than all the + versions possible in the range. +* `ltr(version, range)`: Return `true` if version is less than all the + versions possible in the range. +* `outside(version, range, hilo)`: Return true if the version is outside + the bounds of the range in either the high or low direction. The + `hilo` argument must be either the string `'>'` or `'<'`. (This is + the function called by `gtr` and `ltr`.) +* `intersects(range)`: Return true if any of the ranges comparators intersect + +Note that, since ranges may be non-contiguous, a version might not be +greater than a range, less than a range, *or* satisfy a range! For +example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` +until `2.0.0`, so the version `1.2.10` would not be greater than the +range (because `2.0.1` satisfies, which is higher), nor less than the +range (since `1.2.8` satisfies, which is lower), and it also does not +satisfy the range. + +If you want to know if a version satisfies or does not satisfy a +range, use the `satisfies(version, range)` function. + +### Coercion + +* `coerce(version)`: Coerces a string to semver if possible + +This aims to provide a very forgiving translation of a non-semver string to +semver. It looks for the first digit in a string, and consumes all +remaining characters which satisfy at least a partial semver (e.g., `1`, +`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer +versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All +surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes +`3.4.0`). Only text which lacks digits will fail coercion (`version one` +is not valid). The maximum length for any semver component considered for +coercion is 16 characters; longer components will be ignored +(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any +semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value +components are invalid (`9999999999999999.4.7.4` is likely invalid). diff --git a/tools/node_modules/@babel/core/node_modules/semver/bin/semver b/tools/node_modules/@babel/core/node_modules/semver/bin/semver new file mode 100755 index 00000000000000..801e77f1303c15 --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/semver/bin/semver @@ -0,0 +1,160 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +var argv = process.argv.slice(2) + +var versions = [] + +var range = [] + +var inc = null + +var version = require('../package.json').version + +var loose = false + +var includePrerelease = false + +var coerce = false + +var identifier + +var semver = require('../semver') + +var reverse = false + +var options = {} + +main() + +function main () { + if (!argv.length) return help() + while (argv.length) { + var a = argv.shift() + var indexOfEqualSign = a.indexOf('=') + if (indexOfEqualSign !== -1) { + a = a.slice(0, indexOfEqualSign) + argv.unshift(a.slice(indexOfEqualSign + 1)) + } + switch (a) { + case '-rv': case '-rev': case '--rev': case '--reverse': + reverse = true + break + case '-l': case '--loose': + loose = true + break + case '-p': case '--include-prerelease': + includePrerelease = true + break + case '-v': case '--version': + versions.push(argv.shift()) + break + case '-i': case '--inc': case '--increment': + switch (argv[0]) { + case 'major': case 'minor': case 'patch': case 'prerelease': + case 'premajor': case 'preminor': case 'prepatch': + inc = argv.shift() + break + default: + inc = 'patch' + break + } + break + case '--preid': + identifier = argv.shift() + break + case '-r': case '--range': + range.push(argv.shift()) + break + case '-c': case '--coerce': + coerce = true + break + case '-h': case '--help': case '-?': + return help() + default: + versions.push(a) + break + } + } + + var options = { loose: loose, includePrerelease: includePrerelease } + + versions = versions.map(function (v) { + return coerce ? (semver.coerce(v) || { version: v }).version : v + }).filter(function (v) { + return semver.valid(v) + }) + if (!versions.length) return fail() + if (inc && (versions.length !== 1 || range.length)) { return failInc() } + + for (var i = 0, l = range.length; i < l; i++) { + versions = versions.filter(function (v) { + return semver.satisfies(v, range[i], options) + }) + if (!versions.length) return fail() + } + return success(versions) +} + +function failInc () { + console.error('--inc can only be used on a single version with no range') + fail() +} + +function fail () { process.exit(1) } + +function success () { + var compare = reverse ? 'rcompare' : 'compare' + versions.sort(function (a, b) { + return semver[compare](a, b, options) + }).map(function (v) { + return semver.clean(v, options) + }).map(function (v) { + return inc ? semver.inc(v, inc, options, identifier) : v + }).forEach(function (v, i, _) { console.log(v) }) +} + +function help () { + console.log(['SemVer ' + version, + '', + 'A JavaScript implementation of the https://semver.org/ specification', + 'Copyright Isaac Z. Schlueter', + '', + 'Usage: semver [options] [ [...]]', + 'Prints valid versions sorted by SemVer precedence', + '', + 'Options:', + '-r --range ', + ' Print versions that match the specified range.', + '', + '-i --increment []', + ' Increment a version by the specified level. Level can', + ' be one of: major, minor, patch, premajor, preminor,', + " prepatch, or prerelease. Default level is 'patch'.", + ' Only one version may be specified.', + '', + '--preid ', + ' Identifier to be used to prefix premajor, preminor,', + ' prepatch or prerelease version increments.', + '', + '-l --loose', + ' Interpret versions and ranges loosely', + '', + '-p --include-prerelease', + ' Always include prerelease versions in range matching', + '', + '-c --coerce', + ' Coerce a string into SemVer if possible', + ' (does not imply --loose)', + '', + 'Program exits successfully if any valid version satisfies', + 'all supplied ranges, and prints all satisfying versions.', + '', + 'If no satisfying versions are found, then exits failure.', + '', + 'Versions are printed in ascending order, so supplying', + 'multiple versions to the utility will just sort them.' + ].join('\n')) +} diff --git a/tools/node_modules/@babel/core/node_modules/semver/package.json b/tools/node_modules/@babel/core/node_modules/semver/package.json new file mode 100644 index 00000000000000..69d2db162c9297 --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/semver/package.json @@ -0,0 +1,28 @@ +{ + "name": "semver", + "version": "5.7.1", + "description": "The semantic version parser used by npm.", + "main": "semver.js", + "scripts": { + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "devDependencies": { + "tap": "^13.0.0-rc.18" + }, + "license": "ISC", + "repository": "https://github.com/npm/node-semver", + "bin": { + "semver": "./bin/semver" + }, + "files": [ + "bin", + "range.bnf", + "semver.js" + ], + "tap": { + "check-coverage": true + } +} diff --git a/tools/node_modules/@babel/core/node_modules/semver/range.bnf b/tools/node_modules/@babel/core/node_modules/semver/range.bnf new file mode 100644 index 00000000000000..d4c6ae0d76c9ac --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/semver/range.bnf @@ -0,0 +1,16 @@ +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | [1-9] ( [0-9] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ diff --git a/tools/node_modules/@babel/core/node_modules/semver/semver.js b/tools/node_modules/@babel/core/node_modules/semver/semver.js new file mode 100644 index 00000000000000..d315d5d68b179e --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/semver/semver.js @@ -0,0 +1,1483 @@ +exports = module.exports = SemVer + +var debug +/* istanbul ignore next */ +if (typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG)) { + debug = function () { + var args = Array.prototype.slice.call(arguments, 0) + args.unshift('SEMVER') + console.log.apply(console, args) + } +} else { + debug = function () {} +} + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0' + +var MAX_LENGTH = 256 +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +var MAX_SAFE_COMPONENT_LENGTH = 16 + +// The actual regexps go on exports.re +var re = exports.re = [] +var src = exports.src = [] +var R = 0 + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +var NUMERICIDENTIFIER = R++ +src[NUMERICIDENTIFIER] = '0|[1-9]\\d*' +var NUMERICIDENTIFIERLOOSE = R++ +src[NUMERICIDENTIFIERLOOSE] = '[0-9]+' + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +var NONNUMERICIDENTIFIER = R++ +src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' + +// ## Main Version +// Three dot-separated numeric identifiers. + +var MAINVERSION = R++ +src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')' + +var MAINVERSIONLOOSE = R++ +src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')' + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +var PRERELEASEIDENTIFIER = R++ +src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + + '|' + src[NONNUMERICIDENTIFIER] + ')' + +var PRERELEASEIDENTIFIERLOOSE = R++ +src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + + '|' + src[NONNUMERICIDENTIFIER] + ')' + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +var PRERELEASE = R++ +src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))' + +var PRERELEASELOOSE = R++ +src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))' + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +var BUILDIDENTIFIER = R++ +src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+' + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +var BUILD = R++ +src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))' + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +var FULL = R++ +var FULLPLAIN = 'v?' + src[MAINVERSION] + + src[PRERELEASE] + '?' + + src[BUILD] + '?' + +src[FULL] = '^' + FULLPLAIN + '$' + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + + src[PRERELEASELOOSE] + '?' + + src[BUILD] + '?' + +var LOOSE = R++ +src[LOOSE] = '^' + LOOSEPLAIN + '$' + +var GTLT = R++ +src[GTLT] = '((?:<|>)?=?)' + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +var XRANGEIDENTIFIERLOOSE = R++ +src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' +var XRANGEIDENTIFIER = R++ +src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*' + +var XRANGEPLAIN = R++ +src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:' + src[PRERELEASE] + ')?' + + src[BUILD] + '?' + + ')?)?' + +var XRANGEPLAINLOOSE = R++ +src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:' + src[PRERELEASELOOSE] + ')?' + + src[BUILD] + '?' + + ')?)?' + +var XRANGE = R++ +src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$' +var XRANGELOOSE = R++ +src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$' + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +var COERCE = R++ +src[COERCE] = '(?:^|[^\\d])' + + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:$|[^\\d])' + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +var LONETILDE = R++ +src[LONETILDE] = '(?:~>?)' + +var TILDETRIM = R++ +src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+' +re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g') +var tildeTrimReplace = '$1~' + +var TILDE = R++ +src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$' +var TILDELOOSE = R++ +src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$' + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +var LONECARET = R++ +src[LONECARET] = '(?:\\^)' + +var CARETTRIM = R++ +src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+' +re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g') +var caretTrimReplace = '$1^' + +var CARET = R++ +src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$' +var CARETLOOSE = R++ +src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$' + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +var COMPARATORLOOSE = R++ +src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$' +var COMPARATOR = R++ +src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$' + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +var COMPARATORTRIM = R++ +src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')' + +// this one has to use the /g flag +re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g') +var comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +var HYPHENRANGE = R++ +src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAIN] + ')' + + '\\s*$' + +var HYPHENRANGELOOSE = R++ +src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s*$' + +// Star ranges basically just allow anything at all. +var STAR = R++ +src[STAR] = '(<|>)?=?\\s*\\*' + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + debug(i, src[i]) + if (!re[i]) { + re[i] = new RegExp(src[i]) + } +} + +exports.parse = parse +function parse (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + if (version.length > MAX_LENGTH) { + return null + } + + var r = options.loose ? re[LOOSE] : re[FULL] + if (!r.test(version)) { + return null + } + + try { + return new SemVer(version, options) + } catch (er) { + return null + } +} + +exports.valid = valid +function valid (version, options) { + var v = parse(version, options) + return v ? v.version : null +} + +exports.clean = clean +function clean (version, options) { + var s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} + +exports.SemVer = SemVer + +function SemVer (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + if (version instanceof SemVer) { + if (version.loose === options.loose) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') + } + + if (!(this instanceof SemVer)) { + return new SemVer(version, options) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + + var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]) + + if (!m) { + throw new TypeError('Invalid Version: ' + version) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map(function (id) { + if (/^[0-9]+$/.test(id)) { + var num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() +} + +SemVer.prototype.format = function () { + this.version = this.major + '.' + this.minor + '.' + this.patch + if (this.prerelease.length) { + this.version += '-' + this.prerelease.join('.') + } + return this.version +} + +SemVer.prototype.toString = function () { + return this.version +} + +SemVer.prototype.compare = function (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return this.compareMain(other) || this.comparePre(other) +} + +SemVer.prototype.compareMain = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) +} + +SemVer.prototype.comparePre = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + var i = 0 + do { + var a = this.prerelease[i] + var b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) +} + +// preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. +SemVer.prototype.inc = function (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier) + this.inc('pre', identifier) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier) + } + this.inc('pre', identifier) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0] + } else { + var i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + this.prerelease.push(0) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0] + } + } else { + this.prerelease = [identifier, 0] + } + } + break + + default: + throw new Error('invalid increment argument: ' + release) + } + this.format() + this.raw = this.version + return this +} + +exports.inc = inc +function inc (version, release, loose, identifier) { + if (typeof (loose) === 'string') { + identifier = loose + loose = undefined + } + + try { + return new SemVer(version, loose).inc(release, identifier).version + } catch (er) { + return null + } +} + +exports.diff = diff +function diff (version1, version2) { + if (eq(version1, version2)) { + return null + } else { + var v1 = parse(version1) + var v2 = parse(version2) + var prefix = '' + if (v1.prerelease.length || v2.prerelease.length) { + prefix = 'pre' + var defaultResult = 'prerelease' + } + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key + } + } + } + return defaultResult // may be undefined + } +} + +exports.compareIdentifiers = compareIdentifiers + +var numeric = /^[0-9]+$/ +function compareIdentifiers (a, b) { + var anum = numeric.test(a) + var bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +exports.rcompareIdentifiers = rcompareIdentifiers +function rcompareIdentifiers (a, b) { + return compareIdentifiers(b, a) +} + +exports.major = major +function major (a, loose) { + return new SemVer(a, loose).major +} + +exports.minor = minor +function minor (a, loose) { + return new SemVer(a, loose).minor +} + +exports.patch = patch +function patch (a, loose) { + return new SemVer(a, loose).patch +} + +exports.compare = compare +function compare (a, b, loose) { + return new SemVer(a, loose).compare(new SemVer(b, loose)) +} + +exports.compareLoose = compareLoose +function compareLoose (a, b) { + return compare(a, b, true) +} + +exports.rcompare = rcompare +function rcompare (a, b, loose) { + return compare(b, a, loose) +} + +exports.sort = sort +function sort (list, loose) { + return list.sort(function (a, b) { + return exports.compare(a, b, loose) + }) +} + +exports.rsort = rsort +function rsort (list, loose) { + return list.sort(function (a, b) { + return exports.rcompare(a, b, loose) + }) +} + +exports.gt = gt +function gt (a, b, loose) { + return compare(a, b, loose) > 0 +} + +exports.lt = lt +function lt (a, b, loose) { + return compare(a, b, loose) < 0 +} + +exports.eq = eq +function eq (a, b, loose) { + return compare(a, b, loose) === 0 +} + +exports.neq = neq +function neq (a, b, loose) { + return compare(a, b, loose) !== 0 +} + +exports.gte = gte +function gte (a, b, loose) { + return compare(a, b, loose) >= 0 +} + +exports.lte = lte +function lte (a, b, loose) { + return compare(a, b, loose) <= 0 +} + +exports.cmp = cmp +function cmp (a, op, b, loose) { + switch (op) { + case '===': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a === b + + case '!==': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError('Invalid operator: ' + op) + } +} + +exports.Comparator = Comparator +function Comparator (comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + if (!(this instanceof Comparator)) { + return new Comparator(comp, options) + } + + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) +} + +var ANY = {} +Comparator.prototype.parse = function (comp) { + var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR] + var m = comp.match(r) + + if (!m) { + throw new TypeError('Invalid comparator: ' + comp) + } + + this.operator = m[1] + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } +} + +Comparator.prototype.toString = function () { + return this.value +} + +Comparator.prototype.test = function (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY) { + return true + } + + if (typeof version === 'string') { + version = new SemVer(version, this.options) + } + + return cmp(version, this.operator, this.semver, this.options) +} + +Comparator.prototype.intersects = function (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + var rangeTmp + + if (this.operator === '') { + rangeTmp = new Range(comp.value, options) + return satisfies(this.value, rangeTmp, options) + } else if (comp.operator === '') { + rangeTmp = new Range(this.value, options) + return satisfies(comp.semver, rangeTmp, options) + } + + var sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>') + var sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<') + var sameSemVer = this.semver.version === comp.semver.version + var differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<=') + var oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, options) && + ((this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<')) + var oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, options) && + ((this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>')) + + return sameDirectionIncreasing || sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || oppositeDirectionsGreaterThan +} + +exports.Range = Range +function Range (range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (range instanceof Range) { + if (range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + return new Range(range.value, options) + } + + if (!(this instanceof Range)) { + return new Range(range, options) + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First, split based on boolean or || + this.raw = range + this.set = range.split(/\s*\|\|\s*/).map(function (range) { + return this.parseRange(range.trim()) + }, this).filter(function (c) { + // throw out any that are not relevant for whatever reason + return c.length + }) + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + range) + } + + this.format() +} + +Range.prototype.format = function () { + this.range = this.set.map(function (comps) { + return comps.join(' ').trim() + }).join('||').trim() + return this.range +} + +Range.prototype.toString = function () { + return this.range +} + +Range.prototype.parseRange = function (range) { + var loose = this.options.loose + range = range.trim() + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE] + range = range.replace(hr, hyphenReplace) + debug('hyphen replace', range) + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, re[COMPARATORTRIM]) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[TILDETRIM], tildeTrimReplace) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[CARETTRIM], caretTrimReplace) + + // normalize spaces + range = range.split(/\s+/).join(' ') + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR] + var set = range.split(' ').map(function (comp) { + return parseComparator(comp, this.options) + }, this).join(' ').split(/\s+/) + if (this.options.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function (comp) { + return !!comp.match(compRe) + }) + } + set = set.map(function (comp) { + return new Comparator(comp, this.options) + }, this) + + return set +} + +Range.prototype.intersects = function (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some(function (thisComparators) { + return thisComparators.every(function (thisComparator) { + return range.set.some(function (rangeComparators) { + return rangeComparators.every(function (rangeComparator) { + return thisComparator.intersects(rangeComparator, options) + }) + }) + }) + }) +} + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators +function toComparators (range, options) { + return new Range(range, options).set.map(function (comp) { + return comp.map(function (c) { + return c.value + }).join(' ').trim().split(' ') + }) +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator (comp, options) { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +function isX (id) { + return !id || id.toLowerCase() === 'x' || id === '*' +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceTilde(comp, options) + }).join(' ') +} + +function replaceTilde (comp, options) { + var r = options.loose ? re[TILDELOOSE] : re[TILDE] + return comp.replace(r, function (_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0 + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else if (pr) { + debug('replaceTilde pr', pr) + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } else { + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceCaret(comp, options) + }).join(' ') +} + +function replaceCaret (comp, options) { + debug('caret', comp, options) + var r = options.loose ? re[CARETLOOSE] : re[CARET] + return comp.replace(r, function (_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + if (M === '0') { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else { + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + (+M + 1) + '.0.0' + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + (+M + 1) + '.0.0' + } + } + + debug('caret return', ret) + return ret + }) +} + +function replaceXRanges (comp, options) { + debug('replaceXRanges', comp, options) + return comp.split(/\s+/).map(function (comp) { + return replaceXRange(comp, options) + }).join(' ') +} + +function replaceXRange (comp, options) { + comp = comp.trim() + var r = options.loose ? re[XRANGELOOSE] : re[XRANGE] + return comp.replace(r, function (ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + var xM = isX(M) + var xm = xM || isX(m) + var xp = xm || isX(p) + var anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + ret = gtlt + M + '.' + m + '.' + p + } else if (xm) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (xp) { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars (comp, options) { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re[STAR], '') +} + +// This function is passed to string.replace(re[HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +function hyphenReplace ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = '>=' + fM + '.0.0' + } else if (isX(fp)) { + from = '>=' + fM + '.' + fm + '.0' + } else { + from = '>=' + from + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = '<' + (+tM + 1) + '.0.0' + } else if (isX(tp)) { + to = '<' + tM + '.' + (+tm + 1) + '.0' + } else if (tpr) { + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr + } else { + to = '<=' + to + } + + return (from + ' ' + to).trim() +} + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + version = new SemVer(version, this.options) + } + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false +} + +function testSet (set, version, options) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} + +exports.satisfies = satisfies +function satisfies (version, range, options) { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} + +exports.maxSatisfying = maxSatisfying +function maxSatisfying (versions, range, options) { + var max = null + var maxSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} + +exports.minSatisfying = minSatisfying +function minSatisfying (versions, range, options) { + var min = null + var minSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} + +exports.minVersion = minVersion +function minVersion (range, loose) { + range = new Range(range, loose) + + var minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + comparators.forEach(function (comparator) { + // Clone to avoid manipulating the comparator's semver object. + var compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error('Unexpected operation: ' + comparator.operator) + } + }) + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} + +exports.validRange = validRange +function validRange (range, options) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr +function ltr (version, range, options) { + return outside(version, range, '<', options) +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr +function gtr (version, range, options) { + return outside(version, range, '>', options) +} + +exports.outside = outside +function outside (version, range, hilo, options) { + version = new SemVer(version, options) + range = new Range(range, options) + + var gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + var high = null + var low = null + + comparators.forEach(function (comparator) { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +exports.prerelease = prerelease +function prerelease (version, options) { + var parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} + +exports.intersects = intersects +function intersects (r1, r2, options) { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2) +} + +exports.coerce = coerce +function coerce (version) { + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + var match = version.match(re[COERCE]) + + if (match == null) { + return null + } + + return parse(match[1] + + '.' + (match[2] || '0') + + '.' + (match[3] || '0')) +} diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/LICENSE b/tools/node_modules/@babel/core/node_modules/source-map/LICENSE similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/source-map/LICENSE rename to tools/node_modules/@babel/core/node_modules/source-map/LICENSE diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/README.md b/tools/node_modules/@babel/core/node_modules/source-map/README.md similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/source-map/README.md rename to tools/node_modules/@babel/core/node_modules/source-map/README.md diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/dist/source-map.debug.js b/tools/node_modules/@babel/core/node_modules/source-map/dist/source-map.debug.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/source-map/dist/source-map.debug.js rename to tools/node_modules/@babel/core/node_modules/source-map/dist/source-map.debug.js diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/dist/source-map.js b/tools/node_modules/@babel/core/node_modules/source-map/dist/source-map.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/source-map/dist/source-map.js rename to tools/node_modules/@babel/core/node_modules/source-map/dist/source-map.js diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/dist/source-map.min.js b/tools/node_modules/@babel/core/node_modules/source-map/dist/source-map.min.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/source-map/dist/source-map.min.js rename to tools/node_modules/@babel/core/node_modules/source-map/dist/source-map.min.js diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/array-set.js b/tools/node_modules/@babel/core/node_modules/source-map/lib/array-set.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/source-map/lib/array-set.js rename to tools/node_modules/@babel/core/node_modules/source-map/lib/array-set.js diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/base64-vlq.js b/tools/node_modules/@babel/core/node_modules/source-map/lib/base64-vlq.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/source-map/lib/base64-vlq.js rename to tools/node_modules/@babel/core/node_modules/source-map/lib/base64-vlq.js diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/base64.js b/tools/node_modules/@babel/core/node_modules/source-map/lib/base64.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/source-map/lib/base64.js rename to tools/node_modules/@babel/core/node_modules/source-map/lib/base64.js diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/binary-search.js b/tools/node_modules/@babel/core/node_modules/source-map/lib/binary-search.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/source-map/lib/binary-search.js rename to tools/node_modules/@babel/core/node_modules/source-map/lib/binary-search.js diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/mapping-list.js b/tools/node_modules/@babel/core/node_modules/source-map/lib/mapping-list.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/source-map/lib/mapping-list.js rename to tools/node_modules/@babel/core/node_modules/source-map/lib/mapping-list.js diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/quick-sort.js b/tools/node_modules/@babel/core/node_modules/source-map/lib/quick-sort.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/source-map/lib/quick-sort.js rename to tools/node_modules/@babel/core/node_modules/source-map/lib/quick-sort.js diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/source-map-consumer.js b/tools/node_modules/@babel/core/node_modules/source-map/lib/source-map-consumer.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/source-map/lib/source-map-consumer.js rename to tools/node_modules/@babel/core/node_modules/source-map/lib/source-map-consumer.js diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/source-map-generator.js b/tools/node_modules/@babel/core/node_modules/source-map/lib/source-map-generator.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/source-map/lib/source-map-generator.js rename to tools/node_modules/@babel/core/node_modules/source-map/lib/source-map-generator.js diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/source-node.js b/tools/node_modules/@babel/core/node_modules/source-map/lib/source-node.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/source-map/lib/source-node.js rename to tools/node_modules/@babel/core/node_modules/source-map/lib/source-node.js diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/lib/util.js b/tools/node_modules/@babel/core/node_modules/source-map/lib/util.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/source-map/lib/util.js rename to tools/node_modules/@babel/core/node_modules/source-map/lib/util.js diff --git a/tools/node_modules/@babel/core/node_modules/source-map/package.json b/tools/node_modules/@babel/core/node_modules/source-map/package.json new file mode 100644 index 00000000000000..048e3ae86099f8 --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/source-map/package.json @@ -0,0 +1,72 @@ +{ + "name": "source-map", + "description": "Generates and consumes source maps", + "version": "0.5.7", + "homepage": "https://github.com/mozilla/source-map", + "author": "Nick Fitzgerald ", + "contributors": [ + "Tobias Koppers ", + "Duncan Beevers ", + "Stephen Crane ", + "Ryan Seddon ", + "Miles Elam ", + "Mihai Bazon ", + "Michael Ficarra ", + "Todd Wolfson ", + "Alexander Solovyov ", + "Felix Gnass ", + "Conrad Irwin ", + "usrbincc ", + "David Glasser ", + "Chase Douglas ", + "Evan Wallace ", + "Heather Arthur ", + "Hugh Kennedy ", + "David Glasser ", + "Simon Lydell ", + "Jmeas Smith ", + "Michael Z Goddard ", + "azu ", + "John Gozde ", + "Adam Kirkton ", + "Chris Montgomery ", + "J. Ryan Stinnett ", + "Jack Herrington ", + "Chris Truter ", + "Daniel Espeset ", + "Jamie Wong ", + "Eddy Bruël ", + "Hawken Rives ", + "Gilad Peleg ", + "djchie ", + "Gary Ye ", + "Nicolas Lalevée " + ], + "repository": { + "type": "git", + "url": "http://github.com/mozilla/source-map.git" + }, + "main": "./source-map.js", + "files": [ + "source-map.js", + "lib/", + "dist/source-map.debug.js", + "dist/source-map.js", + "dist/source-map.min.js", + "dist/source-map.min.js.map" + ], + "engines": { + "node": ">=0.10.0" + }, + "license": "BSD-3-Clause", + "scripts": { + "test": "npm run build && node test/run-tests.js", + "build": "webpack --color", + "toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md" + }, + "devDependencies": { + "doctoc": "^0.15.0", + "webpack": "^1.12.0" + }, + "typings": "source-map" +} diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/source-map.js b/tools/node_modules/@babel/core/node_modules/source-map/source-map.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/source-map/source-map.js rename to tools/node_modules/@babel/core/node_modules/source-map/source-map.js diff --git a/tools/node_modules/babel-eslint/node_modules/supports-color/browser.js b/tools/node_modules/@babel/core/node_modules/supports-color/browser.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/supports-color/browser.js rename to tools/node_modules/@babel/core/node_modules/supports-color/browser.js diff --git a/tools/node_modules/babel-eslint/node_modules/supports-color/index.js b/tools/node_modules/@babel/core/node_modules/supports-color/index.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/supports-color/index.js rename to tools/node_modules/@babel/core/node_modules/supports-color/index.js diff --git a/tools/node_modules/babel-eslint/node_modules/supports-color/license b/tools/node_modules/@babel/core/node_modules/supports-color/license similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/supports-color/license rename to tools/node_modules/@babel/core/node_modules/supports-color/license diff --git a/tools/node_modules/@babel/core/node_modules/supports-color/package.json b/tools/node_modules/@babel/core/node_modules/supports-color/package.json new file mode 100644 index 00000000000000..ad199f5cdb0436 --- /dev/null +++ b/tools/node_modules/@babel/core/node_modules/supports-color/package.json @@ -0,0 +1,53 @@ +{ + "name": "supports-color", + "version": "5.5.0", + "description": "Detect whether a terminal supports color", + "license": "MIT", + "repository": "chalk/supports-color", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js", + "browser.js" + ], + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "ansi", + "styles", + "tty", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "support", + "supports", + "capability", + "detect", + "truecolor", + "16m" + ], + "dependencies": { + "has-flag": "^3.0.0" + }, + "devDependencies": { + "ava": "^0.25.0", + "import-fresh": "^2.0.0", + "xo": "^0.20.0" + }, + "browser": "browser.js" +} diff --git a/tools/node_modules/babel-eslint/node_modules/supports-color/readme.md b/tools/node_modules/@babel/core/node_modules/supports-color/readme.md similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/supports-color/readme.md rename to tools/node_modules/@babel/core/node_modules/supports-color/readme.md diff --git a/tools/node_modules/babel-eslint/node_modules/to-fast-properties/index.js b/tools/node_modules/@babel/core/node_modules/to-fast-properties/index.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/to-fast-properties/index.js rename to tools/node_modules/@babel/core/node_modules/to-fast-properties/index.js diff --git a/tools/node_modules/babel-eslint/node_modules/to-fast-properties/license b/tools/node_modules/@babel/core/node_modules/to-fast-properties/license similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/to-fast-properties/license rename to tools/node_modules/@babel/core/node_modules/to-fast-properties/license diff --git a/tools/node_modules/babel-eslint/node_modules/to-fast-properties/package.json b/tools/node_modules/@babel/core/node_modules/to-fast-properties/package.json similarity index 61% rename from tools/node_modules/babel-eslint/node_modules/to-fast-properties/package.json rename to tools/node_modules/@babel/core/node_modules/to-fast-properties/package.json index 2c80c243891203..7a64b2ccb13dce 100644 --- a/tools/node_modules/babel-eslint/node_modules/to-fast-properties/package.json +++ b/tools/node_modules/@babel/core/node_modules/to-fast-properties/package.json @@ -1,25 +1,23 @@ { + "name": "to-fast-properties", + "version": "2.0.0", + "description": "Force V8 to use fast properties for an object", + "license": "MIT", + "repository": "sindresorhus/to-fast-properties", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, - "bugs": { - "url": "https://github.com/sindresorhus/to-fast-properties/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Force V8 to use fast properties for an object", - "devDependencies": { - "ava": "0.0.4" - }, "engines": { "node": ">=4" }, + "scripts": { + "test": "node --allow-natives-syntax test.js" + }, "files": [ "index.js" ], - "homepage": "https://github.com/sindresorhus/to-fast-properties#readme", "keywords": [ "object", "obj", @@ -31,14 +29,7 @@ "convert", "mode" ], - "license": "MIT", - "name": "to-fast-properties", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/to-fast-properties.git" - }, - "scripts": { - "test": "node --allow-natives-syntax test.js" - }, - "version": "2.0.0" -} \ No newline at end of file + "devDependencies": { + "ava": "0.0.4" + } +} diff --git a/tools/node_modules/babel-eslint/node_modules/to-fast-properties/readme.md b/tools/node_modules/@babel/core/node_modules/to-fast-properties/readme.md similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/to-fast-properties/readme.md rename to tools/node_modules/@babel/core/node_modules/to-fast-properties/readme.md diff --git a/tools/node_modules/@babel/core/package.json b/tools/node_modules/@babel/core/package.json new file mode 100644 index 00000000000000..5f93e494ea7963 --- /dev/null +++ b/tools/node_modules/@babel/core/package.json @@ -0,0 +1,66 @@ +{ + "name": "@babel/core", + "version": "7.12.9", + "description": "Babel compiler core.", + "main": "lib/index.js", + "author": "Sebastian McKenzie ", + "homepage": "https://babeljs.io/", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "packages/babel-core" + }, + "keywords": [ + "6to5", + "babel", + "classes", + "const", + "es6", + "harmony", + "let", + "modules", + "transpile", + "transpiler", + "var", + "babel-core", + "compiler" + ], + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + }, + "browser": { + "./lib/config/files/index.js": "./lib/config/files/index-browser.js", + "./lib/transform-file.js": "./lib/transform-file-browser.js", + "./src/config/files/index.js": "./src/config/files/index-browser.js", + "./src/transform-file.js": "./src/transform-file-browser.js" + }, + "dependencies": { + "@babel/code-frame": "^7.10.4", + "@babel/generator": "^7.12.5", + "@babel/helper-module-transforms": "^7.12.1", + "@babel/helpers": "^7.12.5", + "@babel/parser": "^7.12.7", + "@babel/template": "^7.12.7", + "@babel/traverse": "^7.12.9", + "@babel/types": "^7.12.7", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.1", + "json5": "^2.1.2", + "lodash": "^4.17.19", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + }, + "devDependencies": { + "@babel/helper-transform-fixture-test-runner": "7.12.1" + } +} \ No newline at end of file diff --git a/tools/node_modules/@babel/core/src/config/files/index-browser.js b/tools/node_modules/@babel/core/src/config/files/index-browser.js new file mode 100644 index 00000000000000..2fb0b6eba1b899 --- /dev/null +++ b/tools/node_modules/@babel/core/src/config/files/index-browser.js @@ -0,0 +1,96 @@ +// @flow + +import type { Handler } from "gensync"; + +import type { + ConfigFile, + IgnoreFile, + RelativeConfig, + FilePackageData, +} from "./types"; + +import type { CallerMetadata } from "../validation/options"; + +export type { ConfigFile, IgnoreFile, RelativeConfig, FilePackageData }; + +// eslint-disable-next-line require-yield +export function* findConfigUpwards( + rootDir: string, // eslint-disable-line no-unused-vars +): Handler { + return null; +} + +// eslint-disable-next-line require-yield +export function* findPackageData(filepath: string): Handler { + return { + filepath, + directories: [], + pkg: null, + isPackage: false, + }; +} + +// eslint-disable-next-line require-yield +export function* findRelativeConfig( + pkgData: FilePackageData, // eslint-disable-line no-unused-vars + envName: string, // eslint-disable-line no-unused-vars + caller: CallerMetadata | void, // eslint-disable-line no-unused-vars +): Handler { + return { pkg: null, config: null, ignore: null }; +} + +// eslint-disable-next-line require-yield +export function* findRootConfig( + dirname: string, // eslint-disable-line no-unused-vars + envName: string, // eslint-disable-line no-unused-vars + caller: CallerMetadata | void, // eslint-disable-line no-unused-vars +): Handler { + return null; +} + +// eslint-disable-next-line require-yield +export function* loadConfig( + name: string, + dirname: string, + envName: string, // eslint-disable-line no-unused-vars + caller: CallerMetadata | void, // eslint-disable-line no-unused-vars +): Handler { + throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`); +} + +// eslint-disable-next-line require-yield +export function* resolveShowConfigPath( + dirname: string, // eslint-disable-line no-unused-vars +): Handler { + return null; +} + +export const ROOT_CONFIG_FILENAMES = []; + +// eslint-disable-next-line no-unused-vars +export function resolvePlugin(name: string, dirname: string): string | null { + return null; +} + +// eslint-disable-next-line no-unused-vars +export function resolvePreset(name: string, dirname: string): string | null { + return null; +} + +export function loadPlugin( + name: string, + dirname: string, +): { filepath: string, value: mixed } { + throw new Error( + `Cannot load plugin ${name} relative to ${dirname} in a browser`, + ); +} + +export function loadPreset( + name: string, + dirname: string, +): { filepath: string, value: mixed } { + throw new Error( + `Cannot load preset ${name} relative to ${dirname} in a browser`, + ); +} diff --git a/tools/node_modules/@babel/core/src/config/files/index.js b/tools/node_modules/@babel/core/src/config/files/index.js new file mode 100644 index 00000000000000..2321fb7605d9aa --- /dev/null +++ b/tools/node_modules/@babel/core/src/config/files/index.js @@ -0,0 +1,31 @@ +// @flow + +import typeof * as indexBrowserType from "./index-browser"; +import typeof * as indexType from "./index"; + +// Kind of gross, but essentially asserting that the exports of this module are the same as the +// exports of index-browser, since this file may be replaced at bundle time with index-browser. +((({}: any): $Exact): $Exact); + +export { findPackageData } from "./package"; + +export { + findConfigUpwards, + findRelativeConfig, + findRootConfig, + loadConfig, + resolveShowConfigPath, + ROOT_CONFIG_FILENAMES, +} from "./configuration"; +export type { + ConfigFile, + IgnoreFile, + RelativeConfig, + FilePackageData, +} from "./types"; +export { + resolvePlugin, + resolvePreset, + loadPlugin, + loadPreset, +} from "./plugins"; diff --git a/tools/node_modules/@babel/core/src/transform-file-browser.js b/tools/node_modules/@babel/core/src/transform-file-browser.js new file mode 100644 index 00000000000000..fc1b12af0e50ae --- /dev/null +++ b/tools/node_modules/@babel/core/src/transform-file-browser.js @@ -0,0 +1,29 @@ +// @flow + +// duplicated from transform-file so we do not have to import anything here +type TransformFile = { + (filename: string, callback: Function): void, + (filename: string, opts: ?Object, callback: Function): void, +}; + +export const transformFile: TransformFile = (function transformFile( + filename, + opts, + callback, +) { + if (typeof opts === "function") { + callback = opts; + } + + callback(new Error("Transforming files is not supported in browsers"), null); +}: Function); + +export function transformFileSync() { + throw new Error("Transforming files is not supported in browsers"); +} + +export function transformFileAsync() { + return Promise.reject( + new Error("Transforming files is not supported in browsers"), + ); +} diff --git a/tools/node_modules/@babel/core/src/transform-file.js b/tools/node_modules/@babel/core/src/transform-file.js new file mode 100644 index 00000000000000..480afc1cf6f737 --- /dev/null +++ b/tools/node_modules/@babel/core/src/transform-file.js @@ -0,0 +1,40 @@ +// @flow + +import gensync from "gensync"; + +import loadConfig, { type InputOptions, type ResolvedConfig } from "./config"; +import { + run, + type FileResult, + type FileResultCallback, +} from "./transformation"; +import * as fs from "./gensync-utils/fs"; + +import typeof * as transformFileBrowserType from "./transform-file-browser"; +import typeof * as transformFileType from "./transform-file"; + +// Kind of gross, but essentially asserting that the exports of this module are the same as the +// exports of transform-file-browser, since this file may be replaced at bundle time with +// transform-file-browser. +((({}: any): $Exact): $Exact); + +type TransformFile = { + (filename: string, callback: FileResultCallback): void, + (filename: string, opts: ?InputOptions, callback: FileResultCallback): void, +}; + +const transformFileRunner = gensync<[string, ?InputOptions], FileResult | null>( + function* (filename, opts) { + const options = { ...opts, filename }; + + const config: ResolvedConfig | null = yield* loadConfig(options); + if (config === null) return null; + + const code = yield* fs.readFile(filename, "utf8"); + return yield* run(config, code); + }, +); + +export const transformFile: TransformFile = transformFileRunner.errback; +export const transformFileSync = transformFileRunner.sync; +export const transformFileAsync = transformFileRunner.async; diff --git a/tools/node_modules/@babel/eslint-parser/LICENSE b/tools/node_modules/@babel/eslint-parser/LICENSE new file mode 100644 index 00000000000000..f31575ec773bb1 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-present Sebastian McKenzie and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/@babel/eslint-parser/README.md b/tools/node_modules/@babel/eslint-parser/README.md new file mode 100644 index 00000000000000..8ee13ebda10ac1 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/README.md @@ -0,0 +1,124 @@ +# @babel/eslint-parser [![npm](https://img.shields.io/npm/v/@babel/eslint-parser.svg)](https://www.npmjs.com/package/@babel/eslint-parser) [![travis](https://img.shields.io/travis/babel/@babel/eslint-parser/main.svg)](https://travis-ci.org/babel/@babel/eslint-parser) [![npm-downloads](https://img.shields.io/npm/dm/@babel/eslint-parser.svg)](https://www.npmjs.com/package/@babel/eslint-parser) + +**@babel/eslint-parser** allows you to lint **ALL** valid Babel code with the fantastic +[ESLint](https://github.com/eslint/eslint). + +## When should I use @babel/eslint-parser? + +ESLint's default parser and core rules [only support the latest final ECMAScript standard](https://github.com/eslint/eslint/blob/a675c89573836adaf108a932696b061946abf1e6/README.md#what-about-experimental-features) and do not support experimental (such as new features) and non-standard (such as Flow or TypeScript types) syntax provided by Babel. @babel/eslint-parser is a parser that allows ESLint to run on source code that is transformed by Babel. + +**Note:** You only need to use @babel/parser-eslint if you are using Babel to transform your code. If this is not the case, please use the relevant parser for your chosen flavor of ECMAScript (note that the default parser supports all non-experimental syntax as well as JSX). + +## How does it work? + +ESLint allows for the use of [custom parsers](https://eslint.org/docs/developer-guide/working-with-custom-parsers). When using this plugin, your code is parsed by Babel's parser (using the configuration specified in your [Babel configuration file](https://babeljs.io/docs/en/configuration)) and the resulting AST is +transformed into an [ESTree](https://github.com/estree/estree)-compliant structure that ESLint can understand. All location info such as line numbers, +columns is also retained so you can track down errors with ease. + +**Note:** ESLint's core rules do not support experimental syntax and may therefore not work as expected when using `@babel/eslint-parser`. Please use the companion [`@babel/eslint-plugin`](https://github.com/babel/babel/tree/main/eslint/babel-eslint-plugin) plugin for core rules that you have issues with. + +## Usage + +### Installation + +```sh +$ npm install eslint @babel/core @babel/eslint-parser --save-dev +# or +$ yarn add eslint @babel/core @babel/eslint-parser -D +``` + +**Note:** @babel/eslint-parser requires `@babel/core@>=7.2.0` and a valid Babel configuration file to run. If you do not have this already set up, please see the [Babel Usage Guide](https://babeljs.io/docs/en/usage). + +### Setup + +To use @babel/eslint-parser, `"@babel/eslint-parser"` must be specified as the `parser` in your ESLint configuration file (see [here](https://eslint.org/docs/user-guide/configuring#specifying-parser) for more detailed information). + +**.eslintrc.js** + +```js +module.exports = { + parser: "@babel/eslint-parser", +}; +``` + +With the parser set, your configuration can be configured as described in the [Configuring ESLint](https://eslint.org/docs/user-guide/configuring) documentation. + +**Note:** The `parserOptions` described in the [official documentation](https://eslint.org/docs/user-guide/configuring#specifying-parser-options) are for the default parser and are not necessarily supported by @babel/eslint-parser. Please see the section directly below for supported `parserOptions`. + +### Additional parser configuration + +Additional configuration options can be set in your ESLint configuration under the `parserOptions` key. Please note that the `ecmaFeatures` config property may still be required for ESLint to work properly with features not in ECMAScript 5 by default. + +- `requireConfigFile` (default `true`) can be set to `false` to allow @babel/eslint-parser to run on files that do not have a Babel configuration associated with them. This can be useful for linting files that are not transformed by Babel (such as tooling configuration files), though we recommend using the default parser via [glob-based configuration](https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns). Note: @babel/eslint-parser will not parse any experimental syntax when no configuration file is found. +- `sourceType` can be set to `"module"`(default) or `"script"` if your code isn't using ECMAScript modules. +- `allowImportExportEverywhere` (default `false`) can be set to `true` to allow import and export declarations to appear anywhere a statement is allowed if your build environment supports that. Otherwise import and export declarations can only appear at a program's top level. +- `ecmaFeatures.globalReturn` (default `false`) allow return statements in the global scope when used with `sourceType: "script"`. +- `babelOptions` is an object containing Babel configuration [options](https://babeljs.io/docs/en/options) that are passed to Babel's parser at runtime. For cases where users might not want to use a Babel configuration file or are running Babel through another tool (such as Webpack with `babel-loader`). + +**.eslintrc.js** + +```js +module.exports = { + parser: "@babel/eslint-parser", + parserOptions: { + sourceType: "module", + allowImportExportEverywhere: false, + ecmaFeatures: { + globalReturn: false, + }, + babelOptions: { + configFile: "path/to/config.js", + }, + }, +}; +``` + +**.eslintrc.js using glob-based configuration** + +This configuration would use the default parser for all files except for those found by the `"files/transformed/by/babel/*.js"` glob. + +```js +module.exports = { + rules: { + indent: "error", + }, + overrides: [ + { + files: ["files/transformed/by/babel/*.js"], + parser: "@babel/eslint-parser", + }, + ], +}; +``` + +### Run + +```sh +$ ./node_modules/.bin/eslint yourfile.js +``` + +## Known issues + +Flow: + +> Check out [eslint-plugin-flowtype](https://github.com/gajus/eslint-plugin-flowtype): An `eslint` plugin that makes flow type annotations global variables and marks declarations as used. Solves the problem of false positives with `no-undef` and `no-unused-vars`. + +- `no-undef` for global flow types: `ReactElement`, `ReactClass` [#130](https://github.com/babel/@babel/eslint-parser/issues/130#issuecomment-111215076) + - Workaround: define types as globals in `.eslintrc` or define types and import them `import type ReactElement from './types'` +- `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/@babel/eslint-parser/issues/132#issuecomment-112815926) + +Modules/strict mode + +- `no-unused-vars: ["error", { vars: local }]` [#136](https://github.com/babel/@babel/eslint-parser/issues/136) + +Please check out [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for React/JSX issues. + +- `no-unused-vars` with jsx + +Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for other issues. + +## Questions and support + +If you have an issue, please first check if it can be reproduced with the default parser and with the latest versions of `eslint` and `@babel/eslint-parser`. If it is not reproducible with the default parser, it is most likely an issue with `@babel/eslint-parser`. + +For questions and support please visit the [`#discussion`](https://babeljs.slack.com/messages/discussion/) Babel Slack channel (sign up [here](https://github.com/babel/notes/issues/38)) or the ESLint [Gitter](https://gitter.im/eslint/eslint). diff --git a/tools/node_modules/babel-eslint/lib/analyze-scope.js b/tools/node_modules/@babel/eslint-parser/lib/analyze-scope.js similarity index 62% rename from tools/node_modules/babel-eslint/lib/analyze-scope.js rename to tools/node_modules/@babel/eslint-parser/lib/analyze-scope.js index 9ad95bd2517e4f..30dffb6711023a 100644 --- a/tools/node_modules/babel-eslint/lib/analyze-scope.js +++ b/tools/node_modules/@babel/eslint-parser/lib/analyze-scope.js @@ -1,55 +1,81 @@ "use strict"; -const t = require("@babel/types"); -const requireFromESLint = require("./require-from-eslint"); - -const escope = requireFromESLint("eslint-scope"); -const Definition = requireFromESLint("eslint-scope/lib/definition").Definition; -const OriginalPatternVisitor = requireFromESLint( - "eslint-scope/lib/pattern-visitor" -); -const OriginalReferencer = requireFromESLint("eslint-scope/lib/referencer"); -const fallback = require("eslint-visitor-keys").getKeys; -const childVisitorKeys = require("./visitor-keys"); - -const flowFlippedAliasKeys = t.FLIPPED_ALIAS_KEYS.Flow.concat([ - "ArrayPattern", - "ClassDeclaration", - "ClassExpression", - "FunctionDeclaration", - "FunctionExpression", - "Identifier", - "ObjectPattern", - "RestElement", -]); -const visitorKeysMap = Object.keys(t.VISITOR_KEYS).reduce(function(acc, key) { - const value = t.VISITOR_KEYS[key]; - if (flowFlippedAliasKeys.indexOf(value) === -1) { +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = analyzeScope; + +var _core = require("@babel/core"); + +var _eslintScope = _interopRequireDefault(require("eslint-scope")); + +var _definition = require("eslint-scope/lib/definition"); + +var _patternVisitor = _interopRequireDefault(require("eslint-scope/lib/pattern-visitor")); + +var _referencer = _interopRequireDefault(require("eslint-scope/lib/referencer")); + +var _eslintVisitorKeys = require("eslint-visitor-keys"); + +var _visitorKeys = _interopRequireDefault(require("./visitor-keys")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const flowFlippedAliasKeys = _core.types.FLIPPED_ALIAS_KEYS.Flow.concat(["ArrayPattern", "ClassDeclaration", "ClassExpression", "FunctionDeclaration", "FunctionExpression", "Identifier", "ObjectPattern", "RestElement"]); + +const visitorKeysMap = Object.entries(_core.types.VISITOR_KEYS).reduce((acc, [key, value]) => { + if (!flowFlippedAliasKeys.includes(value)) { acc[key] = value; } + return acc; }, {}); - const propertyTypes = { - // loops - callProperties: { type: "loop", values: ["value"] }, - indexers: { type: "loop", values: ["key", "value"] }, - properties: { type: "loop", values: ["argument", "value"] }, - types: { type: "loop" }, - params: { type: "loop" }, - // single property - argument: { type: "single" }, - elementType: { type: "single" }, - qualification: { type: "single" }, - rest: { type: "single" }, - returnType: { type: "single" }, - // others - typeAnnotation: { type: "typeAnnotation" }, - typeParameters: { type: "typeParameters" }, - id: { type: "id" }, + callProperties: { + type: "loop", + values: ["value"] + }, + indexers: { + type: "loop", + values: ["key", "value"] + }, + properties: { + type: "loop", + values: ["argument", "value"] + }, + types: { + type: "loop" + }, + params: { + type: "loop" + }, + argument: { + type: "single" + }, + elementType: { + type: "single" + }, + qualification: { + type: "single" + }, + rest: { + type: "single" + }, + returnType: { + type: "single" + }, + typeAnnotation: { + type: "typeAnnotation" + }, + typeParameters: { + type: "typeParameters" + }, + id: { + type: "id" + } }; -class PatternVisitor extends OriginalPatternVisitor { +class PatternVisitor extends _patternVisitor.default { ArrayPattern(node) { node.elements.forEach(this.visit, this); } @@ -57,81 +83,73 @@ class PatternVisitor extends OriginalPatternVisitor { ObjectPattern(node) { node.properties.forEach(this.visit, this); } + } -class Referencer extends OriginalReferencer { - // inherits. +class Referencer extends _referencer.default { visitPattern(node, options, callback) { if (!node) { return; } - // Visit type annotations. this._checkIdentifierOrVisit(node.typeAnnotation); - if (t.isAssignmentPattern(node)) { + + if (_core.types.isAssignmentPattern(node)) { this._checkIdentifierOrVisit(node.left.typeAnnotation); } - // Overwrite `super.visitPattern(node, options, callback)` in order to not visit `ArrayPattern#typeAnnotation` and `ObjectPattern#typeAnnotation`. if (typeof options === "function") { callback = options; - options = { processRightHandNodes: false }; + options = { + processRightHandNodes: false + }; } const visitor = new PatternVisitor(this.options, node, callback); visitor.visit(node); - // Process the right hand nodes recursively. if (options.processRightHandNodes) { visitor.rightHandNodes.forEach(this.visit, this); } } - // inherits. visitClass(node) { - // Decorators. this._visitArray(node.decorators); - // Flow type parameters. const typeParamScope = this._nestTypeParamScope(node); - // Flow super types. this._visitTypeAnnotation(node.implements); - this._visitTypeAnnotation( - node.superTypeParameters && node.superTypeParameters.params - ); - // Basic. + this._visitTypeAnnotation(node.superTypeParameters && node.superTypeParameters.params); + super.visitClass(node); - // Close the type parameter scope. if (typeParamScope) { this.close(node); } } - // inherits. visitFunction(node) { const typeParamScope = this._nestTypeParamScope(node); - // Flow return types. this._checkIdentifierOrVisit(node.returnType); - // Basic. super.visitFunction(node); - // Close the type parameter scope. if (typeParamScope) { this.close(node); } } - // inherits. visitProperty(node) { - if (node.value && node.value.type === "TypeCastExpression") { + var _node$value; + + if (((_node$value = node.value) == null ? void 0 : _node$value.type) === "TypeCastExpression") { this._visitTypeAnnotation(node.value); } + this._visitArray(node.decorators); + super.visitProperty(node); } @@ -140,8 +158,8 @@ class Referencer extends OriginalReferencer { const typeParamScope = this._nestTypeParamScope(node); - // TODO: Handle mixins this._visitArray(node.extends); + this.visit(node.body); if (typeParamScope) { @@ -169,6 +187,10 @@ class Referencer extends OriginalReferencer { this._visitClassProperty(node); } + ClassPrivateMethod(node) { + super.MethodDefinition(node); + } + DeclareModule(node) { this._visitDeclareX(node); } @@ -185,13 +207,13 @@ class Referencer extends OriginalReferencer { this._visitDeclareX(node); } - // visit OptionalMemberExpression as a MemberExpression. OptionalMemberExpression(node) { super.MemberExpression(node); } _visitClassProperty(node) { this._visitTypeAnnotation(node.typeAnnotation); + this.visitProperty(node); } @@ -201,16 +223,14 @@ class Referencer extends OriginalReferencer { } const typeParamScope = this._nestTypeParamScope(node); + if (typeParamScope) { this.close(node); } } _createScopeVariable(node, name) { - this.currentScope().variableScope.__define( - name, - new Definition("Variable", name, node, null, null, null) - ); + this.currentScope().variableScope.__define(name, new _definition.Definition("Variable", name, node, null, null, null)); } _nestTypeParamScope(node) { @@ -219,23 +239,21 @@ class Referencer extends OriginalReferencer { } const parentScope = this.scopeManager.__currentScope; - const scope = new escope.Scope( - this.scopeManager, - "type-parameters", - parentScope, - node, - false - ); + const scope = new _eslintScope.default.Scope(this.scopeManager, "type-parameters", parentScope, node, false); this.scopeManager.__nestScope(scope); + for (let j = 0; j < node.typeParameters.params.length; j++) { const name = node.typeParameters.params[j]; - scope.__define(name, new Definition("TypeParameter", name, name)); + + scope.__define(name, new _definition.Definition("TypeParameter", name, name)); + if (name.typeAnnotation) { this._checkIdentifierOrVisit(name); } } - scope.__define = function() { + + scope.__define = function () { return parentScope.__define.apply(parentScope, arguments); }; @@ -246,31 +264,33 @@ class Referencer extends OriginalReferencer { if (!node) { return; } + if (Array.isArray(node)) { node.forEach(this._visitTypeAnnotation, this); return; } - // get property to check (params, id, etc...) const visitorValues = visitorKeysMap[node.type]; + if (!visitorValues) { return; } - // can have multiple properties for (let i = 0; i < visitorValues.length; i++) { const visitorValue = visitorValues[i]; const propertyType = propertyTypes[visitorValue]; const nodeProperty = node[visitorValue]; - // check if property or type is defined + if (propertyType == null || nodeProperty == null) { continue; } + if (propertyType.type === "loop") { for (let j = 0; j < nodeProperty.length; j++) { if (Array.isArray(propertyType.values)) { for (let k = 0; k < propertyType.values.length; k++) { const loopPropertyNode = nodeProperty[j][propertyType.values[k]]; + if (loopPropertyNode) { this._checkIdentifierOrVisit(loopPropertyNode); } @@ -298,9 +318,9 @@ class Referencer extends OriginalReferencer { } _checkIdentifierOrVisit(node) { - if (node && node.typeAnnotation) { + if (node == null ? void 0 : node.typeAnnotation) { this._visitTypeAnnotation(node.typeAnnotation); - } else if (node && node.type === "Identifier") { + } else if ((node == null ? void 0 : node.type) === "Identifier") { this.visit(node); } else { this._visitTypeAnnotation(node); @@ -314,29 +334,23 @@ class Referencer extends OriginalReferencer { } } } + } -module.exports = function(ast, parserOptions) { +function analyzeScope(ast, parserOptions) { const options = { ignoreEval: true, optimistic: false, directive: false, - nodejsScope: - ast.sourceType === "script" && - (parserOptions.ecmaFeatures && - parserOptions.ecmaFeatures.globalReturn) === true, + nodejsScope: ast.sourceType === "script" && (parserOptions.ecmaFeatures && parserOptions.ecmaFeatures.globalReturn) === true, impliedStrict: false, sourceType: ast.sourceType, - ecmaVersion: parserOptions.ecmaVersion || 2018, - fallback, + ecmaVersion: parserOptions.ecmaVersion, + fallback: _eslintVisitorKeys.getKeys }; - - options.childVisitorKeys = childVisitorKeys; - - const scopeManager = new escope.ScopeManager(options); + options.childVisitorKeys = _visitorKeys.default; + const scopeManager = new _eslintScope.default.ScopeManager(options); const referencer = new Referencer(options, scopeManager); - referencer.visit(ast); - return scopeManager; -}; +} \ No newline at end of file diff --git a/tools/node_modules/@babel/eslint-parser/lib/configuration.js b/tools/node_modules/@babel/eslint-parser/lib/configuration.js new file mode 100644 index 00000000000000..e8883cc58a5c20 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/lib/configuration.js @@ -0,0 +1,66 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.normalizeESLintConfig = normalizeESLintConfig; +exports.normalizeBabelParseConfig = normalizeBabelParseConfig; + +var _core = require("@babel/core"); + +function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } + +function normalizeESLintConfig(options) { + const { + babelOptions = {}, + ecmaVersion = 2020, + sourceType = "module", + allowImportExportEverywhere = false, + requireConfigFile = true + } = options, + otherOptions = _objectWithoutPropertiesLoose(options, ["babelOptions", "ecmaVersion", "sourceType", "allowImportExportEverywhere", "requireConfigFile"]); + + return Object.assign({ + babelOptions, + ecmaVersion, + sourceType, + allowImportExportEverywhere, + requireConfigFile + }, otherOptions); +} + +function normalizeBabelParseConfig(options) { + var _options$babelOptions, _options$babelOptions2; + + const parseOptions = Object.assign({ + sourceType: options.sourceType, + filename: options.filePath + }, options.babelOptions, { + parserOpts: Object.assign({ + allowImportExportEverywhere: options.allowImportExportEverywhere, + allowReturnOutsideFunction: true, + allowSuperOutsideMethod: true + }, options.babelOptions.parserOpts, { + plugins: ["estree", ...((_options$babelOptions = (_options$babelOptions2 = options.babelOptions.parserOpts) == null ? void 0 : _options$babelOptions2.plugins) != null ? _options$babelOptions : [])], + ranges: true, + tokens: true + }), + caller: Object.assign({ + name: "@babel/eslint-parser" + }, options.babelOptions.caller) + }); + + if (options.requireConfigFile !== false) { + const config = (0, _core.loadPartialConfig)(parseOptions); + + if (config !== null) { + if (!config.hasFilesystemConfig()) { + throw new Error(`No Babel config file detected for ${config.options.filename}. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.`); + } + + return config.options; + } + } + + return parseOptions; +} \ No newline at end of file diff --git a/tools/node_modules/@babel/eslint-parser/lib/convert/convertAST.js b/tools/node_modules/@babel/eslint-parser/lib/convert/convertAST.js new file mode 100644 index 00000000000000..4b9496c95fa6af --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/lib/convert/convertAST.js @@ -0,0 +1,158 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = convertAST; + +var _core = require("@babel/core"); + +var _visitorKeys = require("../visitor-keys"); + +function convertNodes(ast, code) { + const astTransformVisitor = { + noScope: true, + + enter(path) { + const { + node + } = path; + + if (node.innerComments) { + delete node.innerComments; + } + + if (node.trailingComments) { + delete node.trailingComments; + } + + if (node.leadingComments) { + delete node.leadingComments; + } + }, + + exit(path) { + const { + node + } = path; + + if (node.extra) { + delete node.extra; + } + + if (node == null ? void 0 : node.loc.identifierName) { + delete node.loc.identifierName; + } + + if (path.isTypeParameter()) { + node.type = "Identifier"; + node.typeAnnotation = node.bound; + delete node.bound; + } + + if (path.isQualifiedTypeIdentifier()) { + delete node.id; + } + + if (path.isObjectTypeProperty()) { + delete node.key; + } + + if (path.isObjectTypeIndexer()) { + delete node.id; + } + + if (path.isFunctionTypeParam()) { + delete node.name; + } + + if (path.isImportDeclaration()) { + delete node.isType; + } + + if (path.isTemplateLiteral()) { + for (let i = 0; i < node.quasis.length; i++) { + const q = node.quasis[i]; + q.range[0] -= 1; + + if (q.tail) { + q.range[1] += 1; + } else { + q.range[1] += 2; + } + + q.loc.start.column -= 1; + + if (q.tail) { + q.loc.end.column += 1; + } else { + q.loc.end.column += 2; + } + } + } + } + + }; + const state = { + source: code + }; + const oldVisitorKeys = new Map(); + + try { + for (const [type, visitorKey] of Object.entries(_visitorKeys.conflictTypes)) { + oldVisitorKeys.set(type, _core.types.VISITOR_KEYS[type]); + _core.types.VISITOR_KEYS[type] = visitorKey; + } + + for (const [type, visitorKey] of Object.entries(_visitorKeys.newTypes)) { + _core.types.VISITOR_KEYS[type] = visitorKey; + } + + (0, _core.traverse)(ast, astTransformVisitor, null, state); + } finally { + for (const type of Object.keys(_visitorKeys.newTypes)) { + delete _core.types.VISITOR_KEYS[type]; + } + + for (const type of Object.keys(_visitorKeys.conflictTypes)) { + _core.types.VISITOR_KEYS[type] = oldVisitorKeys.get(type); + } + } +} + +function convertProgramNode(ast) { + ast.type = "Program"; + ast.sourceType = ast.program.sourceType; + ast.body = ast.program.body; + delete ast.program; + delete ast.errors; + + if (ast.comments.length) { + const lastComment = ast.comments[ast.comments.length - 1]; + + if (ast.tokens.length) { + const lastToken = ast.tokens[ast.tokens.length - 1]; + + if (lastComment.end > lastToken.end) { + ast.range[1] = lastToken.end; + ast.loc.end.line = lastToken.loc.end.line; + ast.loc.end.column = lastToken.loc.end.column; + } + } + } else { + if (!ast.tokens.length) { + ast.loc.start.line = 1; + ast.loc.end.line = 1; + } + } + + if (ast.body && ast.body.length > 0) { + ast.loc.start.line = ast.body[0].loc.start.line; + ast.range[0] = ast.body[0].start; + } +} + +function convertAST(ast, code) { + convertNodes(ast, code); + convertProgramNode(ast); +} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/lib/babylon-to-espree/convertComments.js b/tools/node_modules/@babel/eslint-parser/lib/convert/convertComments.js similarity index 55% rename from tools/node_modules/babel-eslint/lib/babylon-to-espree/convertComments.js rename to tools/node_modules/@babel/eslint-parser/lib/convert/convertComments.js index 17d7117372946d..bbe5b6104086ed 100644 --- a/tools/node_modules/babel-eslint/lib/babylon-to-espree/convertComments.js +++ b/tools/node_modules/@babel/eslint-parser/lib/convert/convertComments.js @@ -1,17 +1,20 @@ "use strict"; -module.exports = function(comments) { - for (var i = 0; i < comments.length; i++) { - var comment = comments[i]; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = convertComments; + +function convertComments(comments) { + for (const comment of comments) { if (comment.type === "CommentBlock") { comment.type = "Block"; } else if (comment.type === "CommentLine") { comment.type = "Line"; } - // sometimes comments don't get ranges computed, - // even with options.ranges === true + if (!comment.range) { comment.range = [comment.start, comment.end]; } } -}; +} \ No newline at end of file diff --git a/tools/node_modules/@babel/eslint-parser/lib/convert/convertTokens.js b/tools/node_modules/@babel/eslint-parser/lib/convert/convertTokens.js new file mode 100644 index 00000000000000..6d194e8886137b --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/lib/convert/convertTokens.js @@ -0,0 +1,150 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = convertTokens; + +var _core = require("@babel/core"); + +function convertTemplateType(tokens) { + let curlyBrace = null; + let templateTokens = []; + const result = []; + + function addTemplateType() { + const start = templateTokens[0]; + const end = templateTokens[templateTokens.length - 1]; + const value = templateTokens.reduce((result, token) => { + if (token.value) { + result += token.value; + } else if (token.type !== _core.tokTypes.template) { + result += token.type.label; + } + + return result; + }, ""); + result.push({ + type: "Template", + value: value, + start: start.start, + end: end.end, + loc: { + start: start.loc.start, + end: end.loc.end + } + }); + templateTokens = []; + } + + tokens.forEach(token => { + switch (token.type) { + case _core.tokTypes.backQuote: + if (curlyBrace) { + result.push(curlyBrace); + curlyBrace = null; + } + + templateTokens.push(token); + + if (templateTokens.length > 1) { + addTemplateType(); + } + + break; + + case _core.tokTypes.dollarBraceL: + templateTokens.push(token); + addTemplateType(); + break; + + case _core.tokTypes.braceR: + if (curlyBrace) { + result.push(curlyBrace); + } + + curlyBrace = token; + break; + + case _core.tokTypes.template: + if (curlyBrace) { + templateTokens.push(curlyBrace); + curlyBrace = null; + } + + templateTokens.push(token); + break; + + case _core.tokTypes.eof: + if (curlyBrace) { + result.push(curlyBrace); + } + + break; + + default: + if (curlyBrace) { + result.push(curlyBrace); + curlyBrace = null; + } + + result.push(token); + } + }); + return result; +} + +function convertToken(token, source) { + const type = token.type; + token.range = [token.start, token.end]; + + if (type === _core.tokTypes.name) { + token.type = "Identifier"; + } else if (type === _core.tokTypes.semi || type === _core.tokTypes.comma || type === _core.tokTypes.parenL || type === _core.tokTypes.parenR || type === _core.tokTypes.braceL || type === _core.tokTypes.braceR || type === _core.tokTypes.slash || type === _core.tokTypes.dot || type === _core.tokTypes.bracketL || type === _core.tokTypes.bracketR || type === _core.tokTypes.ellipsis || type === _core.tokTypes.arrow || type === _core.tokTypes.pipeline || type === _core.tokTypes.star || type === _core.tokTypes.incDec || type === _core.tokTypes.colon || type === _core.tokTypes.question || type === _core.tokTypes.template || type === _core.tokTypes.backQuote || type === _core.tokTypes.dollarBraceL || type === _core.tokTypes.at || type === _core.tokTypes.logicalOR || type === _core.tokTypes.logicalAND || type === _core.tokTypes.nullishCoalescing || type === _core.tokTypes.bitwiseOR || type === _core.tokTypes.bitwiseXOR || type === _core.tokTypes.bitwiseAND || type === _core.tokTypes.equality || type === _core.tokTypes.relational || type === _core.tokTypes.bitShift || type === _core.tokTypes.plusMin || type === _core.tokTypes.modulo || type === _core.tokTypes.exponent || type === _core.tokTypes.bang || type === _core.tokTypes.tilde || type === _core.tokTypes.doubleColon || type === _core.tokTypes.hash || type === _core.tokTypes.questionDot || type.isAssign) { + token.type = "Punctuator"; + if (!token.value) token.value = type.label; + } else if (type === _core.tokTypes.jsxTagStart) { + token.type = "Punctuator"; + token.value = "<"; + } else if (type === _core.tokTypes.jsxTagEnd) { + token.type = "Punctuator"; + token.value = ">"; + } else if (type === _core.tokTypes.jsxName) { + token.type = "JSXIdentifier"; + } else if (type === _core.tokTypes.jsxText) { + token.type = "JSXText"; + } else if (type.keyword === "null") { + token.type = "Null"; + } else if (type.keyword === "false" || type.keyword === "true") { + token.type = "Boolean"; + } else if (type.keyword) { + token.type = "Keyword"; + } else if (type === _core.tokTypes.num) { + token.type = "Numeric"; + token.value = source.slice(token.start, token.end); + } else if (type === _core.tokTypes.string) { + token.type = "String"; + token.value = source.slice(token.start, token.end); + } else if (type === _core.tokTypes.regexp) { + token.type = "RegularExpression"; + const value = token.value; + token.regex = { + pattern: value.pattern, + flags: value.flags + }; + token.value = `/${value.pattern}/${value.flags}`; + } else if (type === _core.tokTypes.bigint) { + token.type = "Numeric"; + token.value = `${token.value}n`; + } + + if (typeof token.type !== "string") { + delete token.type.rightAssociative; + } + + return token; +} + +function convertTokens(tokens, code) { + return convertTemplateType(tokens).filter(t => t.type !== "CommentLine" && t.type !== "CommentBlock").map(t => convertToken(t, code)); +} \ No newline at end of file diff --git a/tools/node_modules/@babel/eslint-parser/lib/convert/index.js b/tools/node_modules/@babel/eslint-parser/lib/convert/index.js new file mode 100644 index 00000000000000..f7133e2222944f --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/lib/convert/index.js @@ -0,0 +1,20 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _default; + +var _convertTokens = _interopRequireDefault(require("./convertTokens")); + +var _convertComments = _interopRequireDefault(require("./convertComments")); + +var _convertAST = _interopRequireDefault(require("./convertAST")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _default(ast, code) { + ast.tokens = (0, _convertTokens.default)(ast.tokens, code); + (0, _convertComments.default)(ast.comments); + (0, _convertAST.default)(ast, code); +} \ No newline at end of file diff --git a/tools/node_modules/@babel/eslint-parser/lib/index.js b/tools/node_modules/@babel/eslint-parser/lib/index.js new file mode 100644 index 00000000000000..e61b78c1836148 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/lib/index.js @@ -0,0 +1,68 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.parse = parse; +exports.parseForESLint = parseForESLint; + +var _semver = _interopRequireDefault(require("semver")); + +var _core = require("@babel/core"); + +var _package = _interopRequireDefault(require("../package.json")); + +var _configuration = require("./configuration"); + +var _convert = _interopRequireDefault(require("./convert")); + +var _analyzeScope = _interopRequireDefault(require("./analyze-scope")); + +var _visitorKeys = _interopRequireDefault(require("./visitor-keys")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +let isRunningMinSupportedCoreVersion = null; + +function baseParse(code, options) { + const minSupportedCoreVersion = ">=7.2.0"; + + if (typeof isRunningMinSupportedCoreVersion !== "boolean") { + isRunningMinSupportedCoreVersion = _semver.default.satisfies(_core.version, minSupportedCoreVersion); + } + + if (!isRunningMinSupportedCoreVersion) { + throw new Error(`@babel/eslint-parser@${_package.default.version} does not support @babel/core@${_core.version}. Please upgrade to @babel/core@${minSupportedCoreVersion}.`); + } + + let ast; + + try { + ast = (0, _core.parseSync)(code, (0, _configuration.normalizeBabelParseConfig)(options)); + } catch (err) { + if (err instanceof SyntaxError) { + err.lineNumber = err.loc.line; + err.column = err.loc.column; + } + + throw err; + } + + (0, _convert.default)(ast, code); + return ast; +} + +function parse(code, options = {}) { + return baseParse(code, (0, _configuration.normalizeESLintConfig)(options)); +} + +function parseForESLint(code, options = {}) { + const normalizedOptions = (0, _configuration.normalizeESLintConfig)(options); + const ast = baseParse(code, normalizedOptions); + const scopeManager = (0, _analyzeScope.default)(ast, normalizedOptions); + return { + ast, + scopeManager, + visitorKeys: _visitorKeys.default + }; +} \ No newline at end of file diff --git a/tools/node_modules/@babel/eslint-parser/lib/visitor-keys.js b/tools/node_modules/@babel/eslint-parser/lib/visitor-keys.js new file mode 100644 index 00000000000000..df9bc9e2b06864 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/lib/visitor-keys.js @@ -0,0 +1,28 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = exports.conflictTypes = exports.newTypes = void 0; + +var _core = require("@babel/core"); + +var _eslintVisitorKeys = require("eslint-visitor-keys"); + +const newTypes = { + ChainExpression: _eslintVisitorKeys.KEYS.ChainExpression, + ImportExpression: _eslintVisitorKeys.KEYS.ImportExpression, + Literal: _eslintVisitorKeys.KEYS.Literal, + MethodDefinition: ["decorators"].concat(_eslintVisitorKeys.KEYS.MethodDefinition), + Property: ["decorators"].concat(_eslintVisitorKeys.KEYS.Property) +}; +exports.newTypes = newTypes; +const conflictTypes = { + ClassPrivateMethod: ["decorators"].concat(_eslintVisitorKeys.KEYS.MethodDefinition), + ExportAllDeclaration: _eslintVisitorKeys.KEYS.ExportAllDeclaration +}; +exports.conflictTypes = conflictTypes; + +var _default = Object.assign({}, newTypes, _core.types.VISITOR_KEYS, conflictTypes); + +exports.default = _default; \ No newline at end of file diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/LICENSE b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/LICENSE new file mode 100644 index 00000000000000..d36a526f7ed5d1 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/LICENSE @@ -0,0 +1,22 @@ +Copyright JS Foundation and other contributors, https://js.foundation +Copyright (C) 2012-2013 Yusuke Suzuki (twitter: @Constellation) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/README.md b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/README.md new file mode 100644 index 00000000000000..7e7ce0d345cdf2 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/README.md @@ -0,0 +1,54 @@ +# ESLint Scope + +ESLint Scope is the [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm) scope analyzer used in ESLint. It is a fork of [escope](http://github.com/estools/escope). + +## Usage + +Install: + +``` +npm i eslint-scope --save +``` + +Example: + +```js +var eslintScope = require('eslint-scope'); +var espree = require('espree'); +var estraverse = require('estraverse'); + +var ast = espree.parse(code); +var scopeManager = eslintScope.analyze(ast); + +var currentScope = scopeManager.acquire(ast); // global scope + +estraverse.traverse(ast, { + enter: function(node, parent) { + // do stuff + + if (/Function/.test(node.type)) { + currentScope = scopeManager.acquire(node); // get current function scope + } + }, + leave: function(node, parent) { + if (/Function/.test(node.type)) { + currentScope = currentScope.upper; // set to parent scope + } + + // do stuff + } +}); +``` + +## Contributing + +Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/eslint-scope/issues). + +## Build Commands + +* `npm test` - run all linting and tests +* `npm run lint` - run all linting + +## License + +ESLint Scope is licensed under a permissive BSD 2-clause license. diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/definition.js b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/definition.js new file mode 100644 index 00000000000000..172bfe23b5fdcf --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/definition.js @@ -0,0 +1,86 @@ +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +"use strict"; + +const Variable = require("./variable"); + +/** + * @class Definition + */ +class Definition { + constructor(type, name, node, parent, index, kind) { + + /** + * @member {String} Definition#type - type of the occurrence (e.g. "Parameter", "Variable", ...). + */ + this.type = type; + + /** + * @member {espree.Identifier} Definition#name - the identifier AST node of the occurrence. + */ + this.name = name; + + /** + * @member {espree.Node} Definition#node - the enclosing node of the identifier. + */ + this.node = node; + + /** + * @member {espree.Node?} Definition#parent - the enclosing statement node of the identifier. + */ + this.parent = parent; + + /** + * @member {Number?} Definition#index - the index in the declaration statement. + */ + this.index = index; + + /** + * @member {String?} Definition#kind - the kind of the declaration statement. + */ + this.kind = kind; + } +} + +/** + * @class ParameterDefinition + */ +class ParameterDefinition extends Definition { + constructor(name, node, index, rest) { + super(Variable.Parameter, name, node, null, index, null); + + /** + * Whether the parameter definition is a part of a rest parameter. + * @member {boolean} ParameterDefinition#rest + */ + this.rest = rest; + } +} + +module.exports = { + ParameterDefinition, + Definition +}; + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/index.js b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/index.js new file mode 100644 index 00000000000000..0f16fa40f8323f --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/index.js @@ -0,0 +1,165 @@ +/* + Copyright (C) 2012-2014 Yusuke Suzuki + Copyright (C) 2013 Alex Seville + Copyright (C) 2014 Thiago de Arruda + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * Escope (escope) is an ECMAScript + * scope analyzer extracted from the esmangle project. + *

          + * escope finds lexical scopes in a source program, i.e. areas of that + * program where different occurrences of the same identifier refer to the same + * variable. With each scope the contained variables are collected, and each + * identifier reference in code is linked to its corresponding variable (if + * possible). + *

          + * escope works on a syntax tree of the parsed source code which has + * to adhere to the + * Mozilla Parser API. E.g. espree is a parser + * that produces such syntax trees. + *

          + * The main interface is the {@link analyze} function. + * @module escope + */ +"use strict"; + +/* eslint no-underscore-dangle: ["error", { "allow": ["__currentScope"] }] */ + +const assert = require("assert"); + +const ScopeManager = require("./scope-manager"); +const Referencer = require("./referencer"); +const Reference = require("./reference"); +const Variable = require("./variable"); +const Scope = require("./scope").Scope; +const version = require("../package.json").version; + +/** + * Set the default options + * @returns {Object} options + */ +function defaultOptions() { + return { + optimistic: false, + directive: false, + nodejsScope: false, + impliedStrict: false, + sourceType: "script", // one of ['script', 'module'] + ecmaVersion: 5, + childVisitorKeys: null, + fallback: "iteration" + }; +} + +/** + * Preform deep update on option object + * @param {Object} target - Options + * @param {Object} override - Updates + * @returns {Object} Updated options + */ +function updateDeeply(target, override) { + + /** + * Is hash object + * @param {Object} value - Test value + * @returns {boolean} Result + */ + function isHashObject(value) { + return typeof value === "object" && value instanceof Object && !(value instanceof Array) && !(value instanceof RegExp); + } + + for (const key in override) { + if (Object.prototype.hasOwnProperty.call(override, key)) { + const val = override[key]; + + if (isHashObject(val)) { + if (isHashObject(target[key])) { + updateDeeply(target[key], val); + } else { + target[key] = updateDeeply({}, val); + } + } else { + target[key] = val; + } + } + } + return target; +} + +/** + * Main interface function. Takes an Espree syntax tree and returns the + * analyzed scopes. + * @function analyze + * @param {espree.Tree} tree - Abstract Syntax Tree + * @param {Object} providedOptions - Options that tailor the scope analysis + * @param {boolean} [providedOptions.optimistic=false] - the optimistic flag + * @param {boolean} [providedOptions.directive=false]- the directive flag + * @param {boolean} [providedOptions.ignoreEval=false]- whether to check 'eval()' calls + * @param {boolean} [providedOptions.nodejsScope=false]- whether the whole + * script is executed under node.js environment. When enabled, escope adds + * a function scope immediately following the global scope. + * @param {boolean} [providedOptions.impliedStrict=false]- implied strict mode + * (if ecmaVersion >= 5). + * @param {string} [providedOptions.sourceType='script']- the source type of the script. one of 'script' and 'module' + * @param {number} [providedOptions.ecmaVersion=5]- which ECMAScript version is considered + * @param {Object} [providedOptions.childVisitorKeys=null] - Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option. + * @param {string} [providedOptions.fallback='iteration'] - A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option. + * @returns {ScopeManager} ScopeManager + */ +function analyze(tree, providedOptions) { + const options = updateDeeply(defaultOptions(), providedOptions); + const scopeManager = new ScopeManager(options); + const referencer = new Referencer(options, scopeManager); + + referencer.visit(tree); + + assert(scopeManager.__currentScope === null, "currentScope should be null."); + + return scopeManager; +} + +module.exports = { + + /** @name module:escope.version */ + version, + + /** @name module:escope.Reference */ + Reference, + + /** @name module:escope.Variable */ + Variable, + + /** @name module:escope.Scope */ + Scope, + + /** @name module:escope.ScopeManager */ + ScopeManager, + analyze +}; + + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/pattern-visitor.js b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/pattern-visitor.js new file mode 100644 index 00000000000000..afa629173b73ae --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/pattern-visitor.js @@ -0,0 +1,152 @@ +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +"use strict"; + +/* eslint-disable no-undefined */ + +const Syntax = require("estraverse").Syntax; +const esrecurse = require("esrecurse"); + +/** + * Get last array element + * @param {array} xs - array + * @returns {any} Last elment + */ +function getLast(xs) { + return xs[xs.length - 1] || null; +} + +class PatternVisitor extends esrecurse.Visitor { + static isPattern(node) { + const nodeType = node.type; + + return ( + nodeType === Syntax.Identifier || + nodeType === Syntax.ObjectPattern || + nodeType === Syntax.ArrayPattern || + nodeType === Syntax.SpreadElement || + nodeType === Syntax.RestElement || + nodeType === Syntax.AssignmentPattern + ); + } + + constructor(options, rootPattern, callback) { + super(null, options); + this.rootPattern = rootPattern; + this.callback = callback; + this.assignments = []; + this.rightHandNodes = []; + this.restElements = []; + } + + Identifier(pattern) { + const lastRestElement = getLast(this.restElements); + + this.callback(pattern, { + topLevel: pattern === this.rootPattern, + rest: lastRestElement !== null && lastRestElement !== undefined && lastRestElement.argument === pattern, + assignments: this.assignments + }); + } + + Property(property) { + + // Computed property's key is a right hand node. + if (property.computed) { + this.rightHandNodes.push(property.key); + } + + // If it's shorthand, its key is same as its value. + // If it's shorthand and has its default value, its key is same as its value.left (the value is AssignmentPattern). + // If it's not shorthand, the name of new variable is its value's. + this.visit(property.value); + } + + ArrayPattern(pattern) { + for (let i = 0, iz = pattern.elements.length; i < iz; ++i) { + const element = pattern.elements[i]; + + this.visit(element); + } + } + + AssignmentPattern(pattern) { + this.assignments.push(pattern); + this.visit(pattern.left); + this.rightHandNodes.push(pattern.right); + this.assignments.pop(); + } + + RestElement(pattern) { + this.restElements.push(pattern); + this.visit(pattern.argument); + this.restElements.pop(); + } + + MemberExpression(node) { + + // Computed property's key is a right hand node. + if (node.computed) { + this.rightHandNodes.push(node.property); + } + + // the object is only read, write to its property. + this.rightHandNodes.push(node.object); + } + + // + // ForInStatement.left and AssignmentExpression.left are LeftHandSideExpression. + // By spec, LeftHandSideExpression is Pattern or MemberExpression. + // (see also: https://github.com/estree/estree/pull/20#issuecomment-74584758) + // But espree 2.0 parses to ArrayExpression, ObjectExpression, etc... + // + + SpreadElement(node) { + this.visit(node.argument); + } + + ArrayExpression(node) { + node.elements.forEach(this.visit, this); + } + + AssignmentExpression(node) { + this.assignments.push(node); + this.visit(node.left); + this.rightHandNodes.push(node.right); + this.assignments.pop(); + } + + CallExpression(node) { + + // arguments are right hand nodes. + node.arguments.forEach(a => { + this.rightHandNodes.push(a); + }); + this.visit(node.callee); + } +} + +module.exports = PatternVisitor; + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/reference.js b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/reference.js new file mode 100644 index 00000000000000..9529827fe786c6 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/reference.js @@ -0,0 +1,167 @@ +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +"use strict"; + +const READ = 0x1; +const WRITE = 0x2; +const RW = READ | WRITE; + +/** + * A Reference represents a single occurrence of an identifier in code. + * @class Reference + */ +class Reference { + constructor(ident, scope, flag, writeExpr, maybeImplicitGlobal, partial, init) { + + /** + * Identifier syntax node. + * @member {espreeIdentifier} Reference#identifier + */ + this.identifier = ident; + + /** + * Reference to the enclosing Scope. + * @member {Scope} Reference#from + */ + this.from = scope; + + /** + * Whether the reference comes from a dynamic scope (such as 'eval', + * 'with', etc.), and may be trapped by dynamic scopes. + * @member {boolean} Reference#tainted + */ + this.tainted = false; + + /** + * The variable this reference is resolved with. + * @member {Variable} Reference#resolved + */ + this.resolved = null; + + /** + * The read-write mode of the reference. (Value is one of {@link + * Reference.READ}, {@link Reference.RW}, {@link Reference.WRITE}). + * @member {number} Reference#flag + * @private + */ + this.flag = flag; + if (this.isWrite()) { + + /** + * If reference is writeable, this is the tree being written to it. + * @member {espreeNode} Reference#writeExpr + */ + this.writeExpr = writeExpr; + + /** + * Whether the Reference might refer to a partial value of writeExpr. + * @member {boolean} Reference#partial + */ + this.partial = partial; + + /** + * Whether the Reference is to write of initialization. + * @member {boolean} Reference#init + */ + this.init = init; + } + this.__maybeImplicitGlobal = maybeImplicitGlobal; + } + + /** + * Whether the reference is static. + * @method Reference#isStatic + * @returns {boolean} static + */ + isStatic() { + return !this.tainted && this.resolved && this.resolved.scope.isStatic(); + } + + /** + * Whether the reference is writeable. + * @method Reference#isWrite + * @returns {boolean} write + */ + isWrite() { + return !!(this.flag & Reference.WRITE); + } + + /** + * Whether the reference is readable. + * @method Reference#isRead + * @returns {boolean} read + */ + isRead() { + return !!(this.flag & Reference.READ); + } + + /** + * Whether the reference is read-only. + * @method Reference#isReadOnly + * @returns {boolean} read only + */ + isReadOnly() { + return this.flag === Reference.READ; + } + + /** + * Whether the reference is write-only. + * @method Reference#isWriteOnly + * @returns {boolean} write only + */ + isWriteOnly() { + return this.flag === Reference.WRITE; + } + + /** + * Whether the reference is read-write. + * @method Reference#isReadWrite + * @returns {boolean} read write + */ + isReadWrite() { + return this.flag === Reference.RW; + } +} + +/** + * @constant Reference.READ + * @private + */ +Reference.READ = READ; + +/** + * @constant Reference.WRITE + * @private + */ +Reference.WRITE = WRITE; + +/** + * @constant Reference.RW + * @private + */ +Reference.RW = RW; + +module.exports = Reference; + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/referencer.js b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/referencer.js new file mode 100644 index 00000000000000..63d1935b3a957f --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/referencer.js @@ -0,0 +1,629 @@ +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +"use strict"; + +/* eslint-disable no-underscore-dangle */ +/* eslint-disable no-undefined */ + +const Syntax = require("estraverse").Syntax; +const esrecurse = require("esrecurse"); +const Reference = require("./reference"); +const Variable = require("./variable"); +const PatternVisitor = require("./pattern-visitor"); +const definition = require("./definition"); +const assert = require("assert"); + +const ParameterDefinition = definition.ParameterDefinition; +const Definition = definition.Definition; + +/** + * Traverse identifier in pattern + * @param {Object} options - options + * @param {pattern} rootPattern - root pattern + * @param {Refencer} referencer - referencer + * @param {callback} callback - callback + * @returns {void} + */ +function traverseIdentifierInPattern(options, rootPattern, referencer, callback) { + + // Call the callback at left hand identifier nodes, and Collect right hand nodes. + const visitor = new PatternVisitor(options, rootPattern, callback); + + visitor.visit(rootPattern); + + // Process the right hand nodes recursively. + if (referencer !== null && referencer !== undefined) { + visitor.rightHandNodes.forEach(referencer.visit, referencer); + } +} + +// Importing ImportDeclaration. +// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-moduledeclarationinstantiation +// https://github.com/estree/estree/blob/master/es6.md#importdeclaration +// FIXME: Now, we don't create module environment, because the context is +// implementation dependent. + +class Importer extends esrecurse.Visitor { + constructor(declaration, referencer) { + super(null, referencer.options); + this.declaration = declaration; + this.referencer = referencer; + } + + visitImport(id, specifier) { + this.referencer.visitPattern(id, pattern => { + this.referencer.currentScope().__define(pattern, + new Definition( + Variable.ImportBinding, + pattern, + specifier, + this.declaration, + null, + null + )); + }); + } + + ImportNamespaceSpecifier(node) { + const local = (node.local || node.id); + + if (local) { + this.visitImport(local, node); + } + } + + ImportDefaultSpecifier(node) { + const local = (node.local || node.id); + + this.visitImport(local, node); + } + + ImportSpecifier(node) { + const local = (node.local || node.id); + + if (node.name) { + this.visitImport(node.name, node); + } else { + this.visitImport(local, node); + } + } +} + +// Referencing variables and creating bindings. +class Referencer extends esrecurse.Visitor { + constructor(options, scopeManager) { + super(null, options); + this.options = options; + this.scopeManager = scopeManager; + this.parent = null; + this.isInnerMethodDefinition = false; + } + + currentScope() { + return this.scopeManager.__currentScope; + } + + close(node) { + while (this.currentScope() && node === this.currentScope().block) { + this.scopeManager.__currentScope = this.currentScope().__close(this.scopeManager); + } + } + + pushInnerMethodDefinition(isInnerMethodDefinition) { + const previous = this.isInnerMethodDefinition; + + this.isInnerMethodDefinition = isInnerMethodDefinition; + return previous; + } + + popInnerMethodDefinition(isInnerMethodDefinition) { + this.isInnerMethodDefinition = isInnerMethodDefinition; + } + + referencingDefaultValue(pattern, assignments, maybeImplicitGlobal, init) { + const scope = this.currentScope(); + + assignments.forEach(assignment => { + scope.__referencing( + pattern, + Reference.WRITE, + assignment.right, + maybeImplicitGlobal, + pattern !== assignment.left, + init + ); + }); + } + + visitPattern(node, options, callback) { + let visitPatternOptions = options; + let visitPatternCallback = callback; + + if (typeof options === "function") { + visitPatternCallback = options; + visitPatternOptions = { processRightHandNodes: false }; + } + + traverseIdentifierInPattern( + this.options, + node, + visitPatternOptions.processRightHandNodes ? this : null, + visitPatternCallback + ); + } + + visitFunction(node) { + let i, iz; + + // FunctionDeclaration name is defined in upper scope + // NOTE: Not referring variableScope. It is intended. + // Since + // in ES5, FunctionDeclaration should be in FunctionBody. + // in ES6, FunctionDeclaration should be block scoped. + + if (node.type === Syntax.FunctionDeclaration) { + + // id is defined in upper scope + this.currentScope().__define(node.id, + new Definition( + Variable.FunctionName, + node.id, + node, + null, + null, + null + )); + } + + // FunctionExpression with name creates its special scope; + // FunctionExpressionNameScope. + if (node.type === Syntax.FunctionExpression && node.id) { + this.scopeManager.__nestFunctionExpressionNameScope(node); + } + + // Consider this function is in the MethodDefinition. + this.scopeManager.__nestFunctionScope(node, this.isInnerMethodDefinition); + + const that = this; + + /** + * Visit pattern callback + * @param {pattern} pattern - pattern + * @param {Object} info - info + * @returns {void} + */ + function visitPatternCallback(pattern, info) { + that.currentScope().__define(pattern, + new ParameterDefinition( + pattern, + node, + i, + info.rest + )); + + that.referencingDefaultValue(pattern, info.assignments, null, true); + } + + // Process parameter declarations. + for (i = 0, iz = node.params.length; i < iz; ++i) { + this.visitPattern(node.params[i], { processRightHandNodes: true }, visitPatternCallback); + } + + // if there's a rest argument, add that + if (node.rest) { + this.visitPattern({ + type: "RestElement", + argument: node.rest + }, pattern => { + this.currentScope().__define(pattern, + new ParameterDefinition( + pattern, + node, + node.params.length, + true + )); + }); + } + + // In TypeScript there are a number of function-like constructs which have no body, + // so check it exists before traversing + if (node.body) { + + // Skip BlockStatement to prevent creating BlockStatement scope. + if (node.body.type === Syntax.BlockStatement) { + this.visitChildren(node.body); + } else { + this.visit(node.body); + } + } + + this.close(node); + } + + visitClass(node) { + if (node.type === Syntax.ClassDeclaration) { + this.currentScope().__define(node.id, + new Definition( + Variable.ClassName, + node.id, + node, + null, + null, + null + )); + } + + this.visit(node.superClass); + + this.scopeManager.__nestClassScope(node); + + if (node.id) { + this.currentScope().__define(node.id, + new Definition( + Variable.ClassName, + node.id, + node + )); + } + this.visit(node.body); + + this.close(node); + } + + visitProperty(node) { + let previous; + + if (node.computed) { + this.visit(node.key); + } + + const isMethodDefinition = node.type === Syntax.MethodDefinition; + + if (isMethodDefinition) { + previous = this.pushInnerMethodDefinition(true); + } + this.visit(node.value); + if (isMethodDefinition) { + this.popInnerMethodDefinition(previous); + } + } + + visitForIn(node) { + if (node.left.type === Syntax.VariableDeclaration && node.left.kind !== "var") { + this.scopeManager.__nestForScope(node); + } + + if (node.left.type === Syntax.VariableDeclaration) { + this.visit(node.left); + this.visitPattern(node.left.declarations[0].id, pattern => { + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, null, true, true); + }); + } else { + this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => { + let maybeImplicitGlobal = null; + + if (!this.currentScope().isStrict) { + maybeImplicitGlobal = { + pattern, + node + }; + } + this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, true, false); + }); + } + this.visit(node.right); + this.visit(node.body); + + this.close(node); + } + + visitVariableDeclaration(variableTargetScope, type, node, index) { + + const decl = node.declarations[index]; + const init = decl.init; + + this.visitPattern(decl.id, { processRightHandNodes: true }, (pattern, info) => { + variableTargetScope.__define( + pattern, + new Definition( + type, + pattern, + decl, + node, + index, + node.kind + ) + ); + + this.referencingDefaultValue(pattern, info.assignments, null, true); + if (init) { + this.currentScope().__referencing(pattern, Reference.WRITE, init, null, !info.topLevel, true); + } + }); + } + + AssignmentExpression(node) { + if (PatternVisitor.isPattern(node.left)) { + if (node.operator === "=") { + this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => { + let maybeImplicitGlobal = null; + + if (!this.currentScope().isStrict) { + maybeImplicitGlobal = { + pattern, + node + }; + } + this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, !info.topLevel, false); + }); + } else { + this.currentScope().__referencing(node.left, Reference.RW, node.right); + } + } else { + this.visit(node.left); + } + this.visit(node.right); + } + + CatchClause(node) { + this.scopeManager.__nestCatchScope(node); + + this.visitPattern(node.param, { processRightHandNodes: true }, (pattern, info) => { + this.currentScope().__define(pattern, + new Definition( + Variable.CatchClause, + node.param, + node, + null, + null, + null + )); + this.referencingDefaultValue(pattern, info.assignments, null, true); + }); + this.visit(node.body); + + this.close(node); + } + + Program(node) { + this.scopeManager.__nestGlobalScope(node); + + if (this.scopeManager.__isNodejsScope()) { + + // Force strictness of GlobalScope to false when using node.js scope. + this.currentScope().isStrict = false; + this.scopeManager.__nestFunctionScope(node, false); + } + + if (this.scopeManager.__isES6() && this.scopeManager.isModule()) { + this.scopeManager.__nestModuleScope(node); + } + + if (this.scopeManager.isStrictModeSupported() && this.scopeManager.isImpliedStrict()) { + this.currentScope().isStrict = true; + } + + this.visitChildren(node); + this.close(node); + } + + Identifier(node) { + this.currentScope().__referencing(node); + } + + UpdateExpression(node) { + if (PatternVisitor.isPattern(node.argument)) { + this.currentScope().__referencing(node.argument, Reference.RW, null); + } else { + this.visitChildren(node); + } + } + + MemberExpression(node) { + this.visit(node.object); + if (node.computed) { + this.visit(node.property); + } + } + + Property(node) { + this.visitProperty(node); + } + + MethodDefinition(node) { + this.visitProperty(node); + } + + BreakStatement() {} // eslint-disable-line class-methods-use-this + + ContinueStatement() {} // eslint-disable-line class-methods-use-this + + LabeledStatement(node) { + this.visit(node.body); + } + + ForStatement(node) { + + // Create ForStatement declaration. + // NOTE: In ES6, ForStatement dynamically generates + // per iteration environment. However, escope is + // a static analyzer, we only generate one scope for ForStatement. + if (node.init && node.init.type === Syntax.VariableDeclaration && node.init.kind !== "var") { + this.scopeManager.__nestForScope(node); + } + + this.visitChildren(node); + + this.close(node); + } + + ClassExpression(node) { + this.visitClass(node); + } + + ClassDeclaration(node) { + this.visitClass(node); + } + + CallExpression(node) { + + // Check this is direct call to eval + if (!this.scopeManager.__ignoreEval() && node.callee.type === Syntax.Identifier && node.callee.name === "eval") { + + // NOTE: This should be `variableScope`. Since direct eval call always creates Lexical environment and + // let / const should be enclosed into it. Only VariableDeclaration affects on the caller's environment. + this.currentScope().variableScope.__detectEval(); + } + this.visitChildren(node); + } + + BlockStatement(node) { + if (this.scopeManager.__isES6()) { + this.scopeManager.__nestBlockScope(node); + } + + this.visitChildren(node); + + this.close(node); + } + + ThisExpression() { + this.currentScope().variableScope.__detectThis(); + } + + WithStatement(node) { + this.visit(node.object); + + // Then nest scope for WithStatement. + this.scopeManager.__nestWithScope(node); + + this.visit(node.body); + + this.close(node); + } + + VariableDeclaration(node) { + const variableTargetScope = (node.kind === "var") ? this.currentScope().variableScope : this.currentScope(); + + for (let i = 0, iz = node.declarations.length; i < iz; ++i) { + const decl = node.declarations[i]; + + this.visitVariableDeclaration(variableTargetScope, Variable.Variable, node, i); + if (decl.init) { + this.visit(decl.init); + } + } + } + + // sec 13.11.8 + SwitchStatement(node) { + this.visit(node.discriminant); + + if (this.scopeManager.__isES6()) { + this.scopeManager.__nestSwitchScope(node); + } + + for (let i = 0, iz = node.cases.length; i < iz; ++i) { + this.visit(node.cases[i]); + } + + this.close(node); + } + + FunctionDeclaration(node) { + this.visitFunction(node); + } + + FunctionExpression(node) { + this.visitFunction(node); + } + + ForOfStatement(node) { + this.visitForIn(node); + } + + ForInStatement(node) { + this.visitForIn(node); + } + + ArrowFunctionExpression(node) { + this.visitFunction(node); + } + + ImportDeclaration(node) { + assert(this.scopeManager.__isES6() && this.scopeManager.isModule(), "ImportDeclaration should appear when the mode is ES6 and in the module context."); + + const importer = new Importer(node, this); + + importer.visit(node); + } + + visitExportDeclaration(node) { + if (node.source) { + return; + } + if (node.declaration) { + this.visit(node.declaration); + return; + } + + this.visitChildren(node); + } + + // TODO: ExportDeclaration doesn't exist. for bc? + ExportDeclaration(node) { + this.visitExportDeclaration(node); + } + + ExportAllDeclaration(node) { + this.visitExportDeclaration(node); + } + + ExportDefaultDeclaration(node) { + this.visitExportDeclaration(node); + } + + ExportNamedDeclaration(node) { + this.visitExportDeclaration(node); + } + + ExportSpecifier(node) { + + // TODO: `node.id` doesn't exist. for bc? + const local = (node.id || node.local); + + this.visit(local); + } + + MetaProperty() { // eslint-disable-line class-methods-use-this + + // do nothing. + } +} + +module.exports = Referencer; + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/scope-manager.js b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/scope-manager.js new file mode 100644 index 00000000000000..c1927994b1166e --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/scope-manager.js @@ -0,0 +1,247 @@ +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +"use strict"; + +/* eslint-disable no-underscore-dangle */ + +const Scope = require("./scope"); +const assert = require("assert"); + +const GlobalScope = Scope.GlobalScope; +const CatchScope = Scope.CatchScope; +const WithScope = Scope.WithScope; +const ModuleScope = Scope.ModuleScope; +const ClassScope = Scope.ClassScope; +const SwitchScope = Scope.SwitchScope; +const FunctionScope = Scope.FunctionScope; +const ForScope = Scope.ForScope; +const FunctionExpressionNameScope = Scope.FunctionExpressionNameScope; +const BlockScope = Scope.BlockScope; + +/** + * @class ScopeManager + */ +class ScopeManager { + constructor(options) { + this.scopes = []; + this.globalScope = null; + this.__nodeToScope = new WeakMap(); + this.__currentScope = null; + this.__options = options; + this.__declaredVariables = new WeakMap(); + } + + __useDirective() { + return this.__options.directive; + } + + __isOptimistic() { + return this.__options.optimistic; + } + + __ignoreEval() { + return this.__options.ignoreEval; + } + + __isNodejsScope() { + return this.__options.nodejsScope; + } + + isModule() { + return this.__options.sourceType === "module"; + } + + isImpliedStrict() { + return this.__options.impliedStrict; + } + + isStrictModeSupported() { + return this.__options.ecmaVersion >= 5; + } + + // Returns appropriate scope for this node. + __get(node) { + return this.__nodeToScope.get(node); + } + + /** + * Get variables that are declared by the node. + * + * "are declared by the node" means the node is same as `Variable.defs[].node` or `Variable.defs[].parent`. + * If the node declares nothing, this method returns an empty array. + * CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details. + * + * @param {Espree.Node} node - a node to get. + * @returns {Variable[]} variables that declared by the node. + */ + getDeclaredVariables(node) { + return this.__declaredVariables.get(node) || []; + } + + /** + * acquire scope from node. + * @method ScopeManager#acquire + * @param {Espree.Node} node - node for the acquired scope. + * @param {boolean=} inner - look up the most inner scope, default value is false. + * @returns {Scope?} Scope from node + */ + acquire(node, inner) { + + /** + * predicate + * @param {Scope} testScope - scope to test + * @returns {boolean} predicate + */ + function predicate(testScope) { + if (testScope.type === "function" && testScope.functionExpressionScope) { + return false; + } + return true; + } + + const scopes = this.__get(node); + + if (!scopes || scopes.length === 0) { + return null; + } + + // Heuristic selection from all scopes. + // If you would like to get all scopes, please use ScopeManager#acquireAll. + if (scopes.length === 1) { + return scopes[0]; + } + + if (inner) { + for (let i = scopes.length - 1; i >= 0; --i) { + const scope = scopes[i]; + + if (predicate(scope)) { + return scope; + } + } + } else { + for (let i = 0, iz = scopes.length; i < iz; ++i) { + const scope = scopes[i]; + + if (predicate(scope)) { + return scope; + } + } + } + + return null; + } + + /** + * acquire all scopes from node. + * @method ScopeManager#acquireAll + * @param {Espree.Node} node - node for the acquired scope. + * @returns {Scopes?} Scope array + */ + acquireAll(node) { + return this.__get(node); + } + + /** + * release the node. + * @method ScopeManager#release + * @param {Espree.Node} node - releasing node. + * @param {boolean=} inner - look up the most inner scope, default value is false. + * @returns {Scope?} upper scope for the node. + */ + release(node, inner) { + const scopes = this.__get(node); + + if (scopes && scopes.length) { + const scope = scopes[0].upper; + + if (!scope) { + return null; + } + return this.acquire(scope.block, inner); + } + return null; + } + + attach() { } // eslint-disable-line class-methods-use-this + + detach() { } // eslint-disable-line class-methods-use-this + + __nestScope(scope) { + if (scope instanceof GlobalScope) { + assert(this.__currentScope === null); + this.globalScope = scope; + } + this.__currentScope = scope; + return scope; + } + + __nestGlobalScope(node) { + return this.__nestScope(new GlobalScope(this, node)); + } + + __nestBlockScope(node) { + return this.__nestScope(new BlockScope(this, this.__currentScope, node)); + } + + __nestFunctionScope(node, isMethodDefinition) { + return this.__nestScope(new FunctionScope(this, this.__currentScope, node, isMethodDefinition)); + } + + __nestForScope(node) { + return this.__nestScope(new ForScope(this, this.__currentScope, node)); + } + + __nestCatchScope(node) { + return this.__nestScope(new CatchScope(this, this.__currentScope, node)); + } + + __nestWithScope(node) { + return this.__nestScope(new WithScope(this, this.__currentScope, node)); + } + + __nestClassScope(node) { + return this.__nestScope(new ClassScope(this, this.__currentScope, node)); + } + + __nestSwitchScope(node) { + return this.__nestScope(new SwitchScope(this, this.__currentScope, node)); + } + + __nestModuleScope(node) { + return this.__nestScope(new ModuleScope(this, this.__currentScope, node)); + } + + __nestFunctionExpressionNameScope(node) { + return this.__nestScope(new FunctionExpressionNameScope(this, this.__currentScope, node)); + } + + __isES6() { + return this.__options.ecmaVersion >= 6; + } +} + +module.exports = ScopeManager; + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/scope.js b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/scope.js new file mode 100644 index 00000000000000..5c4c967780a3e5 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/scope.js @@ -0,0 +1,748 @@ +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +"use strict"; + +/* eslint-disable no-underscore-dangle */ +/* eslint-disable no-undefined */ + +const Syntax = require("estraverse").Syntax; + +const Reference = require("./reference"); +const Variable = require("./variable"); +const Definition = require("./definition").Definition; +const assert = require("assert"); + +/** + * Test if scope is struct + * @param {Scope} scope - scope + * @param {Block} block - block + * @param {boolean} isMethodDefinition - is method definiton + * @param {boolean} useDirective - use directive + * @returns {boolean} is strict scope + */ +function isStrictScope(scope, block, isMethodDefinition, useDirective) { + let body; + + // When upper scope is exists and strict, inner scope is also strict. + if (scope.upper && scope.upper.isStrict) { + return true; + } + + if (isMethodDefinition) { + return true; + } + + if (scope.type === "class" || scope.type === "module") { + return true; + } + + if (scope.type === "block" || scope.type === "switch") { + return false; + } + + if (scope.type === "function") { + if (block.type === Syntax.ArrowFunctionExpression && block.body.type !== Syntax.BlockStatement) { + return false; + } + + if (block.type === Syntax.Program) { + body = block; + } else { + body = block.body; + } + + if (!body) { + return false; + } + } else if (scope.type === "global") { + body = block; + } else { + return false; + } + + // Search 'use strict' directive. + if (useDirective) { + for (let i = 0, iz = body.body.length; i < iz; ++i) { + const stmt = body.body[i]; + + if (stmt.type !== Syntax.DirectiveStatement) { + break; + } + if (stmt.raw === "\"use strict\"" || stmt.raw === "'use strict'") { + return true; + } + } + } else { + for (let i = 0, iz = body.body.length; i < iz; ++i) { + const stmt = body.body[i]; + + if (stmt.type !== Syntax.ExpressionStatement) { + break; + } + const expr = stmt.expression; + + if (expr.type !== Syntax.Literal || typeof expr.value !== "string") { + break; + } + if (expr.raw !== null && expr.raw !== undefined) { + if (expr.raw === "\"use strict\"" || expr.raw === "'use strict'") { + return true; + } + } else { + if (expr.value === "use strict") { + return true; + } + } + } + } + return false; +} + +/** + * Register scope + * @param {ScopeManager} scopeManager - scope manager + * @param {Scope} scope - scope + * @returns {void} + */ +function registerScope(scopeManager, scope) { + scopeManager.scopes.push(scope); + + const scopes = scopeManager.__nodeToScope.get(scope.block); + + if (scopes) { + scopes.push(scope); + } else { + scopeManager.__nodeToScope.set(scope.block, [scope]); + } +} + +/** + * Should be statically + * @param {Object} def - def + * @returns {boolean} should be statically + */ +function shouldBeStatically(def) { + return ( + (def.type === Variable.ClassName) || + (def.type === Variable.Variable && def.parent.kind !== "var") + ); +} + +/** + * @class Scope + */ +class Scope { + constructor(scopeManager, type, upperScope, block, isMethodDefinition) { + + /** + * One of 'module', 'block', 'switch', 'function', 'catch', 'with', 'function', 'class', 'global'. + * @member {String} Scope#type + */ + this.type = type; + + /** + * The scoped {@link Variable}s of this scope, as { Variable.name + * : Variable }. + * @member {Map} Scope#set + */ + this.set = new Map(); + + /** + * The tainted variables of this scope, as { Variable.name : + * boolean }. + * @member {Map} Scope#taints */ + this.taints = new Map(); + + /** + * Generally, through the lexical scoping of JS you can always know + * which variable an identifier in the source code refers to. There are + * a few exceptions to this rule. With 'global' and 'with' scopes you + * can only decide at runtime which variable a reference refers to. + * Moreover, if 'eval()' is used in a scope, it might introduce new + * bindings in this or its parent scopes. + * All those scopes are considered 'dynamic'. + * @member {boolean} Scope#dynamic + */ + this.dynamic = this.type === "global" || this.type === "with"; + + /** + * A reference to the scope-defining syntax node. + * @member {espree.Node} Scope#block + */ + this.block = block; + + /** + * The {@link Reference|references} that are not resolved with this scope. + * @member {Reference[]} Scope#through + */ + this.through = []; + + /** + * The scoped {@link Variable}s of this scope. In the case of a + * 'function' scope this includes the automatic argument arguments as + * its first element, as well as all further formal arguments. + * @member {Variable[]} Scope#variables + */ + this.variables = []; + + /** + * Any variable {@link Reference|reference} found in this scope. This + * includes occurrences of local variables as well as variables from + * parent scopes (including the global scope). For local variables + * this also includes defining occurrences (like in a 'var' statement). + * In a 'function' scope this does not include the occurrences of the + * formal parameter in the parameter list. + * @member {Reference[]} Scope#references + */ + this.references = []; + + /** + * For 'global' and 'function' scopes, this is a self-reference. For + * other scope types this is the variableScope value of the + * parent scope. + * @member {Scope} Scope#variableScope + */ + this.variableScope = + (this.type === "global" || this.type === "function" || this.type === "module") ? this : upperScope.variableScope; + + /** + * Whether this scope is created by a FunctionExpression. + * @member {boolean} Scope#functionExpressionScope + */ + this.functionExpressionScope = false; + + /** + * Whether this is a scope that contains an 'eval()' invocation. + * @member {boolean} Scope#directCallToEvalScope + */ + this.directCallToEvalScope = false; + + /** + * @member {boolean} Scope#thisFound + */ + this.thisFound = false; + + this.__left = []; + + /** + * Reference to the parent {@link Scope|scope}. + * @member {Scope} Scope#upper + */ + this.upper = upperScope; + + /** + * Whether 'use strict' is in effect in this scope. + * @member {boolean} Scope#isStrict + */ + this.isStrict = isStrictScope(this, block, isMethodDefinition, scopeManager.__useDirective()); + + /** + * List of nested {@link Scope}s. + * @member {Scope[]} Scope#childScopes + */ + this.childScopes = []; + if (this.upper) { + this.upper.childScopes.push(this); + } + + this.__declaredVariables = scopeManager.__declaredVariables; + + registerScope(scopeManager, this); + } + + __shouldStaticallyClose(scopeManager) { + return (!this.dynamic || scopeManager.__isOptimistic()); + } + + __shouldStaticallyCloseForGlobal(ref) { + + // On global scope, let/const/class declarations should be resolved statically. + const name = ref.identifier.name; + + if (!this.set.has(name)) { + return false; + } + + const variable = this.set.get(name); + const defs = variable.defs; + + return defs.length > 0 && defs.every(shouldBeStatically); + } + + __staticCloseRef(ref) { + if (!this.__resolve(ref)) { + this.__delegateToUpperScope(ref); + } + } + + __dynamicCloseRef(ref) { + + // notify all names are through to global + let current = this; + + do { + current.through.push(ref); + current = current.upper; + } while (current); + } + + __globalCloseRef(ref) { + + // let/const/class declarations should be resolved statically. + // others should be resolved dynamically. + if (this.__shouldStaticallyCloseForGlobal(ref)) { + this.__staticCloseRef(ref); + } else { + this.__dynamicCloseRef(ref); + } + } + + __close(scopeManager) { + let closeRef; + + if (this.__shouldStaticallyClose(scopeManager)) { + closeRef = this.__staticCloseRef; + } else if (this.type !== "global") { + closeRef = this.__dynamicCloseRef; + } else { + closeRef = this.__globalCloseRef; + } + + // Try Resolving all references in this scope. + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; + + closeRef.call(this, ref); + } + this.__left = null; + + return this.upper; + } + + // To override by function scopes. + // References in default parameters isn't resolved to variables which are in their function body. + __isValidResolution(ref, variable) { // eslint-disable-line class-methods-use-this, no-unused-vars + return true; + } + + __resolve(ref) { + const name = ref.identifier.name; + + if (!this.set.has(name)) { + return false; + } + const variable = this.set.get(name); + + if (!this.__isValidResolution(ref, variable)) { + return false; + } + variable.references.push(ref); + variable.stack = variable.stack && ref.from.variableScope === this.variableScope; + if (ref.tainted) { + variable.tainted = true; + this.taints.set(variable.name, true); + } + ref.resolved = variable; + + return true; + } + + __delegateToUpperScope(ref) { + if (this.upper) { + this.upper.__left.push(ref); + } + this.through.push(ref); + } + + __addDeclaredVariablesOfNode(variable, node) { + if (node === null || node === undefined) { + return; + } + + let variables = this.__declaredVariables.get(node); + + if (variables === null || variables === undefined) { + variables = []; + this.__declaredVariables.set(node, variables); + } + if (variables.indexOf(variable) === -1) { + variables.push(variable); + } + } + + __defineGeneric(name, set, variables, node, def) { + let variable; + + variable = set.get(name); + if (!variable) { + variable = new Variable(name, this); + set.set(name, variable); + variables.push(variable); + } + + if (def) { + variable.defs.push(def); + this.__addDeclaredVariablesOfNode(variable, def.node); + this.__addDeclaredVariablesOfNode(variable, def.parent); + } + if (node) { + variable.identifiers.push(node); + } + } + + __define(node, def) { + if (node && node.type === Syntax.Identifier) { + this.__defineGeneric( + node.name, + this.set, + this.variables, + node, + def + ); + } + } + + __referencing(node, assign, writeExpr, maybeImplicitGlobal, partial, init) { + + // because Array element may be null + if (!node || node.type !== Syntax.Identifier) { + return; + } + + // Specially handle like `this`. + if (node.name === "super") { + return; + } + + const ref = new Reference(node, this, assign || Reference.READ, writeExpr, maybeImplicitGlobal, !!partial, !!init); + + this.references.push(ref); + this.__left.push(ref); + } + + __detectEval() { + let current = this; + + this.directCallToEvalScope = true; + do { + current.dynamic = true; + current = current.upper; + } while (current); + } + + __detectThis() { + this.thisFound = true; + } + + __isClosed() { + return this.__left === null; + } + + /** + * returns resolved {Reference} + * @method Scope#resolve + * @param {Espree.Identifier} ident - identifier to be resolved. + * @returns {Reference} reference + */ + resolve(ident) { + let ref, i, iz; + + assert(this.__isClosed(), "Scope should be closed."); + assert(ident.type === Syntax.Identifier, "Target should be identifier."); + for (i = 0, iz = this.references.length; i < iz; ++i) { + ref = this.references[i]; + if (ref.identifier === ident) { + return ref; + } + } + return null; + } + + /** + * returns this scope is static + * @method Scope#isStatic + * @returns {boolean} static + */ + isStatic() { + return !this.dynamic; + } + + /** + * returns this scope has materialized arguments + * @method Scope#isArgumentsMaterialized + * @returns {boolean} arguemnts materialized + */ + isArgumentsMaterialized() { // eslint-disable-line class-methods-use-this + return true; + } + + /** + * returns this scope has materialized `this` reference + * @method Scope#isThisMaterialized + * @returns {boolean} this materialized + */ + isThisMaterialized() { // eslint-disable-line class-methods-use-this + return true; + } + + isUsedName(name) { + if (this.set.has(name)) { + return true; + } + for (let i = 0, iz = this.through.length; i < iz; ++i) { + if (this.through[i].identifier.name === name) { + return true; + } + } + return false; + } +} + +class GlobalScope extends Scope { + constructor(scopeManager, block) { + super(scopeManager, "global", null, block, false); + this.implicit = { + set: new Map(), + variables: [], + + /** + * List of {@link Reference}s that are left to be resolved (i.e. which + * need to be linked to the variable they refer to). + * @member {Reference[]} Scope#implicit#left + */ + left: [] + }; + } + + __close(scopeManager) { + const implicit = []; + + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; + + if (ref.__maybeImplicitGlobal && !this.set.has(ref.identifier.name)) { + implicit.push(ref.__maybeImplicitGlobal); + } + } + + // create an implicit global variable from assignment expression + for (let i = 0, iz = implicit.length; i < iz; ++i) { + const info = implicit[i]; + + this.__defineImplicit(info.pattern, + new Definition( + Variable.ImplicitGlobalVariable, + info.pattern, + info.node, + null, + null, + null + )); + + } + + this.implicit.left = this.__left; + + return super.__close(scopeManager); + } + + __defineImplicit(node, def) { + if (node && node.type === Syntax.Identifier) { + this.__defineGeneric( + node.name, + this.implicit.set, + this.implicit.variables, + node, + def + ); + } + } +} + +class ModuleScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "module", upperScope, block, false); + } +} + +class FunctionExpressionNameScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "function-expression-name", upperScope, block, false); + this.__define(block.id, + new Definition( + Variable.FunctionName, + block.id, + block, + null, + null, + null + )); + this.functionExpressionScope = true; + } +} + +class CatchScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "catch", upperScope, block, false); + } +} + +class WithScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "with", upperScope, block, false); + } + + __close(scopeManager) { + if (this.__shouldStaticallyClose(scopeManager)) { + return super.__close(scopeManager); + } + + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; + + ref.tainted = true; + this.__delegateToUpperScope(ref); + } + this.__left = null; + + return this.upper; + } +} + +class BlockScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "block", upperScope, block, false); + } +} + +class SwitchScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "switch", upperScope, block, false); + } +} + +class FunctionScope extends Scope { + constructor(scopeManager, upperScope, block, isMethodDefinition) { + super(scopeManager, "function", upperScope, block, isMethodDefinition); + + // section 9.2.13, FunctionDeclarationInstantiation. + // NOTE Arrow functions never have an arguments objects. + if (this.block.type !== Syntax.ArrowFunctionExpression) { + this.__defineArguments(); + } + } + + isArgumentsMaterialized() { + + // TODO(Constellation) + // We can more aggressive on this condition like this. + // + // function t() { + // // arguments of t is always hidden. + // function arguments() { + // } + // } + if (this.block.type === Syntax.ArrowFunctionExpression) { + return false; + } + + if (!this.isStatic()) { + return true; + } + + const variable = this.set.get("arguments"); + + assert(variable, "Always have arguments variable."); + return variable.tainted || variable.references.length !== 0; + } + + isThisMaterialized() { + if (!this.isStatic()) { + return true; + } + return this.thisFound; + } + + __defineArguments() { + this.__defineGeneric( + "arguments", + this.set, + this.variables, + null, + null + ); + this.taints.set("arguments", true); + } + + // References in default parameters isn't resolved to variables which are in their function body. + // const x = 1 + // function f(a = x) { // This `x` is resolved to the `x` in the outer scope. + // const x = 2 + // console.log(a) + // } + __isValidResolution(ref, variable) { + + // If `options.nodejsScope` is true, `this.block` becomes a Program node. + if (this.block.type === "Program") { + return true; + } + + const bodyStart = this.block.body.range[0]; + + // It's invalid resolution in the following case: + return !( + variable.scope === this && + ref.identifier.range[0] < bodyStart && // the reference is in the parameter part. + variable.defs.every(d => d.name.range[0] >= bodyStart) // the variable is in the body. + ); + } +} + +class ForScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "for", upperScope, block, false); + } +} + +class ClassScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "class", upperScope, block, false); + } +} + +module.exports = { + Scope, + GlobalScope, + ModuleScope, + FunctionExpressionNameScope, + CatchScope, + WithScope, + BlockScope, + SwitchScope, + FunctionScope, + ForScope, + ClassScope +}; + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/variable.js b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/variable.js new file mode 100644 index 00000000000000..702c4780a248a3 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/lib/variable.js @@ -0,0 +1,88 @@ +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +"use strict"; + +/** + * A Variable represents a locally scoped identifier. These include arguments to + * functions. + * @class Variable + */ +class Variable { + constructor(name, scope) { + + /** + * The variable name, as given in the source code. + * @member {String} Variable#name + */ + this.name = name; + + /** + * List of defining occurrences of this variable (like in 'var ...' + * statements or as parameter), as AST nodes. + * @member {espree.Identifier[]} Variable#identifiers + */ + this.identifiers = []; + + /** + * List of {@link Reference|references} of this variable (excluding parameter entries) + * in its defining scope and all nested scopes. For defining + * occurrences only see {@link Variable#defs}. + * @member {Reference[]} Variable#references + */ + this.references = []; + + /** + * List of defining occurrences of this variable (like in 'var ...' + * statements or as parameter), as custom objects. + * @member {Definition[]} Variable#defs + */ + this.defs = []; + + this.tainted = false; + + /** + * Whether this is a stack variable. + * @member {boolean} Variable#stack + */ + this.stack = true; + + /** + * Reference to the enclosing Scope. + * @member {Scope} Variable#scope + */ + this.scope = scope; + } +} + +Variable.CatchClause = "CatchClause"; +Variable.Parameter = "Parameter"; +Variable.FunctionName = "FunctionName"; +Variable.ClassName = "ClassName"; +Variable.Variable = "Variable"; +Variable.ImportBinding = "ImportBinding"; +Variable.ImplicitGlobalVariable = "ImplicitGlobalVariable"; + +module.exports = Variable; + +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/package.json b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/package.json new file mode 100644 index 00000000000000..a19fd8ce712203 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-scope/package.json @@ -0,0 +1,48 @@ +{ + "name": "eslint-scope", + "description": "ECMAScript scope analyzer for ESLint", + "homepage": "http://github.com/eslint/eslint-scope", + "main": "lib/index.js", + "version": "5.1.0", + "engines": { + "node": ">=8.0.0" + }, + "repository": "eslint/eslint-scope", + "bugs": { + "url": "https://github.com/eslint/eslint-scope/issues" + }, + "license": "BSD-2-Clause", + "scripts": { + "test": "node Makefile.js test", + "lint": "node Makefile.js lint", + "generate-release": "eslint-generate-release", + "generate-alpharelease": "eslint-generate-prerelease alpha", + "generate-betarelease": "eslint-generate-prerelease beta", + "generate-rcrelease": "eslint-generate-prerelease rc", + "publish-release": "eslint-publish-release" + }, + "files": [ + "LICENSE", + "README.md", + "lib" + ], + "dependencies": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + }, + "devDependencies": { + "@typescript-eslint/parser": "^1.11.0", + "chai": "^4.2.0", + "eslint": "^6.0.1", + "eslint-config-eslint": "^5.0.1", + "eslint-plugin-node": "^9.1.0", + "eslint-release": "^1.0.0", + "eslint-visitor-keys": "^1.2.0", + "espree": "^7.1.0", + "istanbul": "^0.4.5", + "mocha": "^6.1.4", + "npm-license": "^0.3.3", + "shelljs": "^0.8.3", + "typescript": "^3.5.2" + } +} diff --git a/tools/node_modules/babel-eslint/node_modules/eslint-visitor-keys/LICENSE b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys/LICENSE similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/eslint-visitor-keys/LICENSE rename to tools/node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys/LICENSE diff --git a/tools/node_modules/babel-eslint/node_modules/eslint-visitor-keys/README.md b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys/README.md similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/eslint-visitor-keys/README.md rename to tools/node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys/README.md diff --git a/tools/node_modules/babel-eslint/node_modules/eslint-visitor-keys/lib/index.js b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys/lib/index.js similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/eslint-visitor-keys/lib/index.js rename to tools/node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys/lib/index.js diff --git a/tools/node_modules/babel-eslint/node_modules/eslint-visitor-keys/lib/visitor-keys.json b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys/lib/visitor-keys.json similarity index 98% rename from tools/node_modules/babel-eslint/node_modules/eslint-visitor-keys/lib/visitor-keys.json rename to tools/node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys/lib/visitor-keys.json index d31b7b29439a13..a33bbc66005b6a 100644 --- a/tools/node_modules/babel-eslint/node_modules/eslint-visitor-keys/lib/visitor-keys.json +++ b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys/lib/visitor-keys.json @@ -38,6 +38,9 @@ "param", "body" ], + "ChainExpression": [ + "expression" + ], "ClassBody": [ "body" ], @@ -66,6 +69,7 @@ ], "EmptyStatement": [], "ExportAllDeclaration": [ + "exported", "source" ], "ExportDefaultDeclaration": [ diff --git a/tools/node_modules/babel-eslint/node_modules/eslint-visitor-keys/package.json b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys/package.json similarity index 73% rename from tools/node_modules/babel-eslint/node_modules/eslint-visitor-keys/package.json rename to tools/node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys/package.json index 68eec940691e0b..63267be6437e03 100644 --- a/tools/node_modules/babel-eslint/node_modules/eslint-visitor-keys/package.json +++ b/tools/node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys/package.json @@ -1,15 +1,15 @@ { - "author": { - "name": "Toru Nagashima", - "url": "https://github.com/mysticatea" - }, - "bugs": { - "url": "https://github.com/eslint/eslint-visitor-keys/issues" + "name": "eslint-visitor-keys", + "version": "1.3.0", + "description": "Constants and utilities about visitor keys to traverse AST.", + "main": "lib/index.js", + "files": [ + "lib" + ], + "engines": { + "node": ">=4" }, - "bundleDependencies": false, "dependencies": {}, - "deprecated": false, - "description": "Constants and utilities about visitor keys to traverse AST.", "devDependencies": { "eslint": "^4.7.2", "eslint-config-eslint": "^4.0.0", @@ -18,31 +18,23 @@ "nyc": "^11.2.1", "opener": "^1.4.3" }, - "engines": { - "node": ">=4" - }, - "files": [ - "lib" - ], - "homepage": "https://github.com/eslint/eslint-visitor-keys#readme", - "keywords": [], - "license": "Apache-2.0", - "main": "lib/index.js", - "name": "eslint-visitor-keys", - "repository": { - "type": "git", - "url": "git+https://github.com/eslint/eslint-visitor-keys.git" - }, "scripts": { + "lint": "eslint lib tests/lib", + "pretest": "npm run -s lint", + "test": "nyc mocha tests/lib", "coverage": "nyc report --reporter lcov && opener coverage/lcov-report/index.html", + "generate-release": "eslint-generate-release", "generate-alpharelease": "eslint-generate-prerelease alpha", "generate-betarelease": "eslint-generate-prerelease beta", "generate-rcrelease": "eslint-generate-prerelease rc", - "generate-release": "eslint-generate-release", - "lint": "eslint lib tests/lib", - "pretest": "npm run -s lint", - "publish-release": "eslint-publish-release", - "test": "nyc mocha tests/lib" + "publish-release": "eslint-publish-release" + }, + "repository": "eslint/eslint-visitor-keys", + "keywords": [], + "author": "Toru Nagashima (https://github.com/mysticatea)", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/eslint/eslint-visitor-keys/issues" }, - "version": "1.1.0" -} \ No newline at end of file + "homepage": "https://github.com/eslint/eslint-visitor-keys#readme" +} diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/README.md b/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/README.md new file mode 100644 index 00000000000000..ffea6b434a4a63 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/README.md @@ -0,0 +1,171 @@ +### Esrecurse [![Build Status](https://travis-ci.org/estools/esrecurse.svg?branch=master)](https://travis-ci.org/estools/esrecurse) + +Esrecurse ([esrecurse](https://github.com/estools/esrecurse)) is +[ECMAScript](https://www.ecma-international.org/publications/standards/Ecma-262.htm) +recursive traversing functionality. + +### Example Usage + +The following code will output all variables declared at the root of a file. + +```javascript +esrecurse.visit(ast, { + XXXStatement: function (node) { + this.visit(node.left); + // do something... + this.visit(node.right); + } +}); +``` + +We can use `Visitor` instance. + +```javascript +var visitor = new esrecurse.Visitor({ + XXXStatement: function (node) { + this.visit(node.left); + // do something... + this.visit(node.right); + } +}); + +visitor.visit(ast); +``` + +We can inherit `Visitor` instance easily. + +```javascript +class Derived extends esrecurse.Visitor { + constructor() + { + super(null); + } + + XXXStatement(node) { + } +} +``` + +```javascript +function DerivedVisitor() { + esrecurse.Visitor.call(/* this for constructor */ this /* visitor object automatically becomes this. */); +} +util.inherits(DerivedVisitor, esrecurse.Visitor); +DerivedVisitor.prototype.XXXStatement = function (node) { + this.visit(node.left); + // do something... + this.visit(node.right); +}; +``` + +And you can invoke default visiting operation inside custom visit operation. + +```javascript +function DerivedVisitor() { + esrecurse.Visitor.call(/* this for constructor */ this /* visitor object automatically becomes this. */); +} +util.inherits(DerivedVisitor, esrecurse.Visitor); +DerivedVisitor.prototype.XXXStatement = function (node) { + // do something... + this.visitChildren(node); +}; +``` + +The `childVisitorKeys` option does customize the behaviour of `this.visitChildren(node)`. +We can use user-defined node types. + +```javascript +// This tree contains a user-defined `TestExpression` node. +var tree = { + type: 'TestExpression', + + // This 'argument' is the property containing the other **node**. + argument: { + type: 'Literal', + value: 20 + }, + + // This 'extended' is the property not containing the other **node**. + extended: true +}; +esrecurse.visit( + ast, + { + Literal: function (node) { + // do something... + } + }, + { + // Extending the existing traversing rules. + childVisitorKeys: { + // TargetNodeName: [ 'keys', 'containing', 'the', 'other', '**node**' ] + TestExpression: ['argument'] + } + } +); +``` + +We can use the `fallback` option as well. +If the `fallback` option is `"iteration"`, `esrecurse` would visit all enumerable properties of unknown nodes. +Please note circular references cause the stack overflow. AST might have circular references in additional properties for some purpose (e.g. `node.parent`). + +```javascript +esrecurse.visit( + ast, + { + Literal: function (node) { + // do something... + } + }, + { + fallback: 'iteration' + } +); +``` + +If the `fallback` option is a function, `esrecurse` calls this function to determine the enumerable properties of unknown nodes. +Please note circular references cause the stack overflow. AST might have circular references in additional properties for some purpose (e.g. `node.parent`). + +```javascript +esrecurse.visit( + ast, + { + Literal: function (node) { + // do something... + } + }, + { + fallback: function (node) { + return Object.keys(node).filter(function(key) { + return key !== 'argument' + }); + } + } +); +``` + +### License + +Copyright (C) 2014 [Yusuke Suzuki](https://github.com/Constellation) + (twitter: [@Constellation](https://twitter.com/Constellation)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/esrecurse.js b/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/esrecurse.js new file mode 100644 index 00000000000000..15d57dfd0218f6 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/esrecurse.js @@ -0,0 +1,117 @@ +/* + Copyright (C) 2014 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +(function () { + 'use strict'; + + var estraverse = require('estraverse'); + + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === 'object' && typeof node.type === 'string'; + } + + function isProperty(nodeType, key) { + return (nodeType === estraverse.Syntax.ObjectExpression || nodeType === estraverse.Syntax.ObjectPattern) && key === 'properties'; + } + + function Visitor(visitor, options) { + options = options || {}; + + this.__visitor = visitor || this; + this.__childVisitorKeys = options.childVisitorKeys + ? Object.assign({}, estraverse.VisitorKeys, options.childVisitorKeys) + : estraverse.VisitorKeys; + if (options.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof options.fallback === 'function') { + this.__fallback = options.fallback; + } + } + + /* Default method for visiting children. + * When you need to call default visiting operation inside custom visiting + * operation, you can use it with `this.visitChildren(node)`. + */ + Visitor.prototype.visitChildren = function (node) { + var type, children, i, iz, j, jz, child; + + if (node == null) { + return; + } + + type = node.type || estraverse.Syntax.Property; + + children = this.__childVisitorKeys[type]; + if (!children) { + if (this.__fallback) { + children = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + type + '.'); + } + } + + for (i = 0, iz = children.length; i < iz; ++i) { + child = node[children[i]]; + if (child) { + if (Array.isArray(child)) { + for (j = 0, jz = child.length; j < jz; ++j) { + if (child[j]) { + if (isNode(child[j]) || isProperty(type, children[i])) { + this.visit(child[j]); + } + } + } + } else if (isNode(child)) { + this.visit(child); + } + } + } + }; + + /* Dispatching node. */ + Visitor.prototype.visit = function (node) { + var type; + + if (node == null) { + return; + } + + type = node.type || estraverse.Syntax.Property; + if (this.__visitor[type]) { + this.__visitor[type].call(this, node); + return; + } + this.visitChildren(node); + }; + + exports.version = require('./package.json').version; + exports.Visitor = Visitor; + exports.visit = function (node, visitor, options) { + var v = new Visitor(visitor, options); + v.visit(node); + }; +}()); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/tools/node_modules/babel-eslint/node_modules/esutils/LICENSE.BSD b/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/node_modules/estraverse/LICENSE.BSD similarity index 100% rename from tools/node_modules/babel-eslint/node_modules/esutils/LICENSE.BSD rename to tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/node_modules/estraverse/LICENSE.BSD diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/node_modules/estraverse/README.md b/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/node_modules/estraverse/README.md new file mode 100644 index 00000000000000..ccd3377f3e9449 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/node_modules/estraverse/README.md @@ -0,0 +1,153 @@ +### Estraverse [![Build Status](https://secure.travis-ci.org/estools/estraverse.svg)](http://travis-ci.org/estools/estraverse) + +Estraverse ([estraverse](http://github.com/estools/estraverse)) is +[ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm) +traversal functions from [esmangle project](http://github.com/estools/esmangle). + +### Documentation + +You can find usage docs at [wiki page](https://github.com/estools/estraverse/wiki/Usage). + +### Example Usage + +The following code will output all variables declared at the root of a file. + +```javascript +estraverse.traverse(ast, { + enter: function (node, parent) { + if (node.type == 'FunctionExpression' || node.type == 'FunctionDeclaration') + return estraverse.VisitorOption.Skip; + }, + leave: function (node, parent) { + if (node.type == 'VariableDeclarator') + console.log(node.id.name); + } +}); +``` + +We can use `this.skip`, `this.remove` and `this.break` functions instead of using Skip, Remove and Break. + +```javascript +estraverse.traverse(ast, { + enter: function (node) { + this.break(); + } +}); +``` + +And estraverse provides `estraverse.replace` function. When returning node from `enter`/`leave`, current node is replaced with it. + +```javascript +result = estraverse.replace(tree, { + enter: function (node) { + // Replace it with replaced. + if (node.type === 'Literal') + return replaced; + } +}); +``` + +By passing `visitor.keys` mapping, we can extend estraverse traversing functionality. + +```javascript +// This tree contains a user-defined `TestExpression` node. +var tree = { + type: 'TestExpression', + + // This 'argument' is the property containing the other **node**. + argument: { + type: 'Literal', + value: 20 + }, + + // This 'extended' is the property not containing the other **node**. + extended: true +}; +estraverse.traverse(tree, { + enter: function (node) { }, + + // Extending the existing traversing rules. + keys: { + // TargetNodeName: [ 'keys', 'containing', 'the', 'other', '**node**' ] + TestExpression: ['argument'] + } +}); +``` + +By passing `visitor.fallback` option, we can control the behavior when encountering unknown nodes. + +```javascript +// This tree contains a user-defined `TestExpression` node. +var tree = { + type: 'TestExpression', + + // This 'argument' is the property containing the other **node**. + argument: { + type: 'Literal', + value: 20 + }, + + // This 'extended' is the property not containing the other **node**. + extended: true +}; +estraverse.traverse(tree, { + enter: function (node) { }, + + // Iterating the child **nodes** of unknown nodes. + fallback: 'iteration' +}); +``` + +When `visitor.fallback` is a function, we can determine which keys to visit on each node. + +```javascript +// This tree contains a user-defined `TestExpression` node. +var tree = { + type: 'TestExpression', + + // This 'argument' is the property containing the other **node**. + argument: { + type: 'Literal', + value: 20 + }, + + // This 'extended' is the property not containing the other **node**. + extended: true +}; +estraverse.traverse(tree, { + enter: function (node) { }, + + // Skip the `argument` property of each node + fallback: function(node) { + return Object.keys(node).filter(function(key) { + return key !== 'argument'; + }); + } +}); +``` + +### License + +Copyright (C) 2012-2016 [Yusuke Suzuki](http://github.com/Constellation) + (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/node_modules/estraverse/estraverse.js b/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/node_modules/estraverse/estraverse.js new file mode 100644 index 00000000000000..93225bb0c4013e --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/node_modules/estraverse/estraverse.js @@ -0,0 +1,801 @@ +/* + Copyright (C) 2012-2013 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/*jslint vars:false, bitwise:true*/ +/*jshint indent:4*/ +/*global exports:true*/ +(function clone(exports) { + 'use strict'; + + var Syntax, + VisitorOption, + VisitorKeys, + BREAK, + SKIP, + REMOVE; + + function deepCopy(obj) { + var ret = {}, key, val; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + val = obj[key]; + if (typeof val === 'object' && val !== null) { + ret[key] = deepCopy(val); + } else { + ret[key] = val; + } + } + } + return ret; + } + + // based on LLVM libc++ upper_bound / lower_bound + // MIT License + + function upperBound(array, func) { + var diff, len, i, current; + + len = array.length; + i = 0; + + while (len) { + diff = len >>> 1; + current = i + diff; + if (func(array[current])) { + len = diff; + } else { + i = current + 1; + len -= diff + 1; + } + } + return i; + } + + Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7. + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ChainExpression: 'ChainExpression', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7. + ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7. + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DebuggerStatement: 'DebuggerStatement', + DirectiveStatement: 'DirectiveStatement', + DoWhileStatement: 'DoWhileStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + ForOfStatement: 'ForOfStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7. + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportExpression: 'ImportExpression', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + ModuleSpecifier: 'ModuleSpecifier', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; + + VisitorKeys = { + AssignmentExpression: ['left', 'right'], + AssignmentPattern: ['left', 'right'], + ArrayExpression: ['elements'], + ArrayPattern: ['elements'], + ArrowFunctionExpression: ['params', 'body'], + AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7. + BlockStatement: ['body'], + BinaryExpression: ['left', 'right'], + BreakStatement: ['label'], + CallExpression: ['callee', 'arguments'], + CatchClause: ['param', 'body'], + ChainExpression: ['expression'], + ClassBody: ['body'], + ClassDeclaration: ['id', 'superClass', 'body'], + ClassExpression: ['id', 'superClass', 'body'], + ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7. + ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + ConditionalExpression: ['test', 'consequent', 'alternate'], + ContinueStatement: ['label'], + DebuggerStatement: [], + DirectiveStatement: [], + DoWhileStatement: ['body', 'test'], + EmptyStatement: [], + ExportAllDeclaration: ['source'], + ExportDefaultDeclaration: ['declaration'], + ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], + ExportSpecifier: ['exported', 'local'], + ExpressionStatement: ['expression'], + ForStatement: ['init', 'test', 'update', 'body'], + ForInStatement: ['left', 'right', 'body'], + ForOfStatement: ['left', 'right', 'body'], + FunctionDeclaration: ['id', 'params', 'body'], + FunctionExpression: ['id', 'params', 'body'], + GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + Identifier: [], + IfStatement: ['test', 'consequent', 'alternate'], + ImportExpression: ['source'], + ImportDeclaration: ['specifiers', 'source'], + ImportDefaultSpecifier: ['local'], + ImportNamespaceSpecifier: ['local'], + ImportSpecifier: ['imported', 'local'], + Literal: [], + LabeledStatement: ['label', 'body'], + LogicalExpression: ['left', 'right'], + MemberExpression: ['object', 'property'], + MetaProperty: ['meta', 'property'], + MethodDefinition: ['key', 'value'], + ModuleSpecifier: [], + NewExpression: ['callee', 'arguments'], + ObjectExpression: ['properties'], + ObjectPattern: ['properties'], + Program: ['body'], + Property: ['key', 'value'], + RestElement: [ 'argument' ], + ReturnStatement: ['argument'], + SequenceExpression: ['expressions'], + SpreadElement: ['argument'], + Super: [], + SwitchStatement: ['discriminant', 'cases'], + SwitchCase: ['test', 'consequent'], + TaggedTemplateExpression: ['tag', 'quasi'], + TemplateElement: [], + TemplateLiteral: ['quasis', 'expressions'], + ThisExpression: [], + ThrowStatement: ['argument'], + TryStatement: ['block', 'handler', 'finalizer'], + UnaryExpression: ['argument'], + UpdateExpression: ['argument'], + VariableDeclaration: ['declarations'], + VariableDeclarator: ['id', 'init'], + WhileStatement: ['test', 'body'], + WithStatement: ['object', 'body'], + YieldExpression: ['argument'] + }; + + // unique id + BREAK = {}; + SKIP = {}; + REMOVE = {}; + + VisitorOption = { + Break: BREAK, + Skip: SKIP, + Remove: REMOVE + }; + + function Reference(parent, key) { + this.parent = parent; + this.key = key; + } + + Reference.prototype.replace = function replace(node) { + this.parent[this.key] = node; + }; + + Reference.prototype.remove = function remove() { + if (Array.isArray(this.parent)) { + this.parent.splice(this.key, 1); + return true; + } else { + this.replace(null); + return false; + } + }; + + function Element(node, path, wrap, ref) { + this.node = node; + this.path = path; + this.wrap = wrap; + this.ref = ref; + } + + function Controller() { } + + // API: + // return property path array from root to current node + Controller.prototype.path = function path() { + var i, iz, j, jz, result, element; + + function addToPath(result, path) { + if (Array.isArray(path)) { + for (j = 0, jz = path.length; j < jz; ++j) { + result.push(path[j]); + } + } else { + result.push(path); + } + } + + // root node + if (!this.__current.path) { + return null; + } + + // first node is sentinel, second node is root element + result = []; + for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { + element = this.__leavelist[i]; + addToPath(result, element.path); + } + addToPath(result, this.__current.path); + return result; + }; + + // API: + // return type of current node + Controller.prototype.type = function () { + var node = this.current(); + return node.type || this.__current.wrap; + }; + + // API: + // return array of parent elements + Controller.prototype.parents = function parents() { + var i, iz, result; + + // first node is sentinel + result = []; + for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { + result.push(this.__leavelist[i].node); + } + + return result; + }; + + // API: + // return current node + Controller.prototype.current = function current() { + return this.__current.node; + }; + + Controller.prototype.__execute = function __execute(callback, element) { + var previous, result; + + result = undefined; + + previous = this.__current; + this.__current = element; + this.__state = null; + if (callback) { + result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); + } + this.__current = previous; + + return result; + }; + + // API: + // notify control skip / break + Controller.prototype.notify = function notify(flag) { + this.__state = flag; + }; + + // API: + // skip child nodes of current node + Controller.prototype.skip = function () { + this.notify(SKIP); + }; + + // API: + // break traversals + Controller.prototype['break'] = function () { + this.notify(BREAK); + }; + + // API: + // remove node + Controller.prototype.remove = function () { + this.notify(REMOVE); + }; + + Controller.prototype.__initialize = function(root, visitor) { + this.visitor = visitor; + this.root = root; + this.__worklist = []; + this.__leavelist = []; + this.__current = null; + this.__state = null; + this.__fallback = null; + if (visitor.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof visitor.fallback === 'function') { + this.__fallback = visitor.fallback; + } + + this.__keys = VisitorKeys; + if (visitor.keys) { + this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); + } + }; + + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === 'object' && typeof node.type === 'string'; + } + + function isProperty(nodeType, key) { + return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; + } + + function candidateExistsInLeaveList(leavelist, candidate) { + for (var i = leavelist.length - 1; i >= 0; --i) { + if (leavelist[i].node === candidate) { + return true; + } + } + return false; + } + + Controller.prototype.traverse = function traverse(root, visitor) { + var worklist, + leavelist, + element, + node, + nodeType, + ret, + key, + current, + current2, + candidates, + candidate, + sentinel; + + this.__initialize(root, visitor); + + sentinel = {}; + + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; + + // initialize + worklist.push(new Element(root, null, null, null)); + leavelist.push(new Element(null, null, null, null)); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + + ret = this.__execute(visitor.leave, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + continue; + } + + if (element.node) { + + ret = this.__execute(visitor.enter, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || ret === SKIP) { + continue; + } + + node = element.node; + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + + if (candidateExistsInLeaveList(leavelist, candidate[current2])) { + continue; + } + + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', null); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, null); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + if (candidateExistsInLeaveList(leavelist, candidate)) { + continue; + } + + worklist.push(new Element(candidate, key, null, null)); + } + } + } + } + }; + + Controller.prototype.replace = function replace(root, visitor) { + var worklist, + leavelist, + node, + nodeType, + target, + element, + current, + current2, + candidates, + candidate, + sentinel, + outer, + key; + + function removeElem(element) { + var i, + key, + nextElem, + parent; + + if (element.ref.remove()) { + // When the reference is an element of an array. + key = element.ref.key; + parent = element.ref.parent; + + // If removed from array, then decrease following items' keys. + i = worklist.length; + while (i--) { + nextElem = worklist[i]; + if (nextElem.ref && nextElem.ref.parent === parent) { + if (nextElem.ref.key < key) { + break; + } + --nextElem.ref.key; + } + } + } + } + + this.__initialize(root, visitor); + + sentinel = {}; + + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; + + // initialize + outer = { + root: root + }; + element = new Element(root, null, null, new Reference(outer, 'root')); + worklist.push(element); + leavelist.push(element); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + + target = this.__execute(visitor.leave, element); + + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + continue; + } + + target = this.__execute(visitor.enter, element); + + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + element.node = target; + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + element.node = null; + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + + // node may be null + node = element.node; + if (!node) { + continue; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || target === SKIP) { + continue; + } + + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, new Reference(node, key))); + } + } + } + + return outer.root; + }; + + function traverse(root, visitor) { + var controller = new Controller(); + return controller.traverse(root, visitor); + } + + function replace(root, visitor) { + var controller = new Controller(); + return controller.replace(root, visitor); + } + + function extendCommentRange(comment, tokens) { + var target; + + target = upperBound(tokens, function search(token) { + return token.range[0] > comment.range[0]; + }); + + comment.extendedRange = [comment.range[0], comment.range[1]]; + + if (target !== tokens.length) { + comment.extendedRange[1] = tokens[target].range[0]; + } + + target -= 1; + if (target >= 0) { + comment.extendedRange[0] = tokens[target].range[1]; + } + + return comment; + } + + function attachComments(tree, providedComments, tokens) { + // At first, we should calculate extended comment ranges. + var comments = [], comment, len, i, cursor; + + if (!tree.range) { + throw new Error('attachComments needs range information'); + } + + // tokens array is empty, we attach comments to tree as 'leadingComments' + if (!tokens.length) { + if (providedComments.length) { + for (i = 0, len = providedComments.length; i < len; i += 1) { + comment = deepCopy(providedComments[i]); + comment.extendedRange = [0, tree.range[0]]; + comments.push(comment); + } + tree.leadingComments = comments; + } + return tree; + } + + for (i = 0, len = providedComments.length; i < len; i += 1) { + comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); + } + + // This is based on John Freeman's implementation. + cursor = 0; + traverse(tree, { + enter: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + if (comment.extendedRange[1] > node.range[0]) { + break; + } + + if (comment.extendedRange[1] === node.range[0]) { + if (!node.leadingComments) { + node.leadingComments = []; + } + node.leadingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } + + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + + cursor = 0; + traverse(tree, { + leave: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + if (node.range[1] < comment.extendedRange[0]) { + break; + } + + if (node.range[1] === comment.extendedRange[0]) { + if (!node.trailingComments) { + node.trailingComments = []; + } + node.trailingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } + + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + + return tree; + } + + exports.Syntax = Syntax; + exports.traverse = traverse; + exports.replace = replace; + exports.attachComments = attachComments; + exports.VisitorKeys = VisitorKeys; + exports.VisitorOption = VisitorOption; + exports.Controller = Controller; + exports.cloneEnvironment = function () { return clone({}); }; + + return exports; +}(exports)); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/node_modules/estraverse/package.json b/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/node_modules/estraverse/package.json new file mode 100644 index 00000000000000..bc99e7c4a64674 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/node_modules/estraverse/package.json @@ -0,0 +1,40 @@ +{ + "name": "estraverse", + "description": "ECMAScript JS AST traversal functions", + "homepage": "https://github.com/estools/estraverse", + "main": "estraverse.js", + "version": "5.2.0", + "engines": { + "node": ">=4.0" + }, + "maintainers": [ + { + "name": "Yusuke Suzuki", + "email": "utatane.tea@gmail.com", + "web": "http://github.com/Constellation" + } + ], + "repository": { + "type": "git", + "url": "http://github.com/estools/estraverse.git" + }, + "devDependencies": { + "babel-preset-env": "^1.6.1", + "babel-register": "^6.3.13", + "chai": "^2.1.1", + "espree": "^1.11.0", + "gulp": "^3.8.10", + "gulp-bump": "^0.2.2", + "gulp-filter": "^2.0.0", + "gulp-git": "^1.0.1", + "gulp-tag-version": "^1.3.0", + "jshint": "^2.5.6", + "mocha": "^2.1.0" + }, + "license": "BSD-2-Clause", + "scripts": { + "test": "npm run-script lint && npm run-script unit-test", + "lint": "jshint estraverse.js", + "unit-test": "mocha --compilers js:babel-register" + } +} diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/package.json b/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/package.json new file mode 100755 index 00000000000000..dec5b1bc1fd3ac --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/esrecurse/package.json @@ -0,0 +1,52 @@ +{ + "name": "esrecurse", + "description": "ECMAScript AST recursive visitor", + "homepage": "https://github.com/estools/esrecurse", + "main": "esrecurse.js", + "version": "4.3.0", + "engines": { + "node": ">=4.0" + }, + "maintainers": [ + { + "name": "Yusuke Suzuki", + "email": "utatane.tea@gmail.com", + "web": "https://github.com/Constellation" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/estools/esrecurse.git" + }, + "dependencies": { + "estraverse": "^5.2.0" + }, + "devDependencies": { + "babel-cli": "^6.24.1", + "babel-eslint": "^7.2.3", + "babel-preset-es2015": "^6.24.1", + "babel-register": "^6.24.1", + "chai": "^4.0.2", + "esprima": "^4.0.0", + "gulp": "^3.9.0", + "gulp-bump": "^2.7.0", + "gulp-eslint": "^4.0.0", + "gulp-filter": "^5.0.0", + "gulp-git": "^2.4.1", + "gulp-mocha": "^4.3.1", + "gulp-tag-version": "^1.2.1", + "jsdoc": "^3.3.0-alpha10", + "minimist": "^1.1.0" + }, + "license": "BSD-2-Clause", + "scripts": { + "test": "gulp travis", + "unit-test": "gulp test", + "lint": "gulp lint" + }, + "babel": { + "presets": [ + "es2015" + ] + } +} diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/estraverse/LICENSE.BSD b/tools/node_modules/@babel/eslint-parser/node_modules/estraverse/LICENSE.BSD new file mode 100644 index 00000000000000..3e580c355a96e5 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/estraverse/LICENSE.BSD @@ -0,0 +1,19 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/estraverse/README.md b/tools/node_modules/@babel/eslint-parser/node_modules/estraverse/README.md new file mode 100644 index 00000000000000..ccd3377f3e9449 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/estraverse/README.md @@ -0,0 +1,153 @@ +### Estraverse [![Build Status](https://secure.travis-ci.org/estools/estraverse.svg)](http://travis-ci.org/estools/estraverse) + +Estraverse ([estraverse](http://github.com/estools/estraverse)) is +[ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm) +traversal functions from [esmangle project](http://github.com/estools/esmangle). + +### Documentation + +You can find usage docs at [wiki page](https://github.com/estools/estraverse/wiki/Usage). + +### Example Usage + +The following code will output all variables declared at the root of a file. + +```javascript +estraverse.traverse(ast, { + enter: function (node, parent) { + if (node.type == 'FunctionExpression' || node.type == 'FunctionDeclaration') + return estraverse.VisitorOption.Skip; + }, + leave: function (node, parent) { + if (node.type == 'VariableDeclarator') + console.log(node.id.name); + } +}); +``` + +We can use `this.skip`, `this.remove` and `this.break` functions instead of using Skip, Remove and Break. + +```javascript +estraverse.traverse(ast, { + enter: function (node) { + this.break(); + } +}); +``` + +And estraverse provides `estraverse.replace` function. When returning node from `enter`/`leave`, current node is replaced with it. + +```javascript +result = estraverse.replace(tree, { + enter: function (node) { + // Replace it with replaced. + if (node.type === 'Literal') + return replaced; + } +}); +``` + +By passing `visitor.keys` mapping, we can extend estraverse traversing functionality. + +```javascript +// This tree contains a user-defined `TestExpression` node. +var tree = { + type: 'TestExpression', + + // This 'argument' is the property containing the other **node**. + argument: { + type: 'Literal', + value: 20 + }, + + // This 'extended' is the property not containing the other **node**. + extended: true +}; +estraverse.traverse(tree, { + enter: function (node) { }, + + // Extending the existing traversing rules. + keys: { + // TargetNodeName: [ 'keys', 'containing', 'the', 'other', '**node**' ] + TestExpression: ['argument'] + } +}); +``` + +By passing `visitor.fallback` option, we can control the behavior when encountering unknown nodes. + +```javascript +// This tree contains a user-defined `TestExpression` node. +var tree = { + type: 'TestExpression', + + // This 'argument' is the property containing the other **node**. + argument: { + type: 'Literal', + value: 20 + }, + + // This 'extended' is the property not containing the other **node**. + extended: true +}; +estraverse.traverse(tree, { + enter: function (node) { }, + + // Iterating the child **nodes** of unknown nodes. + fallback: 'iteration' +}); +``` + +When `visitor.fallback` is a function, we can determine which keys to visit on each node. + +```javascript +// This tree contains a user-defined `TestExpression` node. +var tree = { + type: 'TestExpression', + + // This 'argument' is the property containing the other **node**. + argument: { + type: 'Literal', + value: 20 + }, + + // This 'extended' is the property not containing the other **node**. + extended: true +}; +estraverse.traverse(tree, { + enter: function (node) { }, + + // Skip the `argument` property of each node + fallback: function(node) { + return Object.keys(node).filter(function(key) { + return key !== 'argument'; + }); + } +}); +``` + +### License + +Copyright (C) 2012-2016 [Yusuke Suzuki](http://github.com/Constellation) + (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/estraverse/estraverse.js b/tools/node_modules/@babel/eslint-parser/node_modules/estraverse/estraverse.js new file mode 100644 index 00000000000000..b106d386a6e1af --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/estraverse/estraverse.js @@ -0,0 +1,782 @@ +/* + Copyright (C) 2012-2013 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/*jslint vars:false, bitwise:true*/ +/*jshint indent:4*/ +/*global exports:true*/ +(function clone(exports) { + 'use strict'; + + var Syntax, + VisitorOption, + VisitorKeys, + BREAK, + SKIP, + REMOVE; + + function deepCopy(obj) { + var ret = {}, key, val; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + val = obj[key]; + if (typeof val === 'object' && val !== null) { + ret[key] = deepCopy(val); + } else { + ret[key] = val; + } + } + } + return ret; + } + + // based on LLVM libc++ upper_bound / lower_bound + // MIT License + + function upperBound(array, func) { + var diff, len, i, current; + + len = array.length; + i = 0; + + while (len) { + diff = len >>> 1; + current = i + diff; + if (func(array[current])) { + len = diff; + } else { + i = current + 1; + len -= diff + 1; + } + } + return i; + } + + Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7. + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7. + ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7. + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DebuggerStatement: 'DebuggerStatement', + DirectiveStatement: 'DirectiveStatement', + DoWhileStatement: 'DoWhileStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + ForOfStatement: 'ForOfStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7. + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportExpression: 'ImportExpression', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + ModuleSpecifier: 'ModuleSpecifier', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; + + VisitorKeys = { + AssignmentExpression: ['left', 'right'], + AssignmentPattern: ['left', 'right'], + ArrayExpression: ['elements'], + ArrayPattern: ['elements'], + ArrowFunctionExpression: ['params', 'body'], + AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7. + BlockStatement: ['body'], + BinaryExpression: ['left', 'right'], + BreakStatement: ['label'], + CallExpression: ['callee', 'arguments'], + CatchClause: ['param', 'body'], + ClassBody: ['body'], + ClassDeclaration: ['id', 'superClass', 'body'], + ClassExpression: ['id', 'superClass', 'body'], + ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7. + ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + ConditionalExpression: ['test', 'consequent', 'alternate'], + ContinueStatement: ['label'], + DebuggerStatement: [], + DirectiveStatement: [], + DoWhileStatement: ['body', 'test'], + EmptyStatement: [], + ExportAllDeclaration: ['source'], + ExportDefaultDeclaration: ['declaration'], + ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], + ExportSpecifier: ['exported', 'local'], + ExpressionStatement: ['expression'], + ForStatement: ['init', 'test', 'update', 'body'], + ForInStatement: ['left', 'right', 'body'], + ForOfStatement: ['left', 'right', 'body'], + FunctionDeclaration: ['id', 'params', 'body'], + FunctionExpression: ['id', 'params', 'body'], + GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + Identifier: [], + IfStatement: ['test', 'consequent', 'alternate'], + ImportExpression: ['source'], + ImportDeclaration: ['specifiers', 'source'], + ImportDefaultSpecifier: ['local'], + ImportNamespaceSpecifier: ['local'], + ImportSpecifier: ['imported', 'local'], + Literal: [], + LabeledStatement: ['label', 'body'], + LogicalExpression: ['left', 'right'], + MemberExpression: ['object', 'property'], + MetaProperty: ['meta', 'property'], + MethodDefinition: ['key', 'value'], + ModuleSpecifier: [], + NewExpression: ['callee', 'arguments'], + ObjectExpression: ['properties'], + ObjectPattern: ['properties'], + Program: ['body'], + Property: ['key', 'value'], + RestElement: [ 'argument' ], + ReturnStatement: ['argument'], + SequenceExpression: ['expressions'], + SpreadElement: ['argument'], + Super: [], + SwitchStatement: ['discriminant', 'cases'], + SwitchCase: ['test', 'consequent'], + TaggedTemplateExpression: ['tag', 'quasi'], + TemplateElement: [], + TemplateLiteral: ['quasis', 'expressions'], + ThisExpression: [], + ThrowStatement: ['argument'], + TryStatement: ['block', 'handler', 'finalizer'], + UnaryExpression: ['argument'], + UpdateExpression: ['argument'], + VariableDeclaration: ['declarations'], + VariableDeclarator: ['id', 'init'], + WhileStatement: ['test', 'body'], + WithStatement: ['object', 'body'], + YieldExpression: ['argument'] + }; + + // unique id + BREAK = {}; + SKIP = {}; + REMOVE = {}; + + VisitorOption = { + Break: BREAK, + Skip: SKIP, + Remove: REMOVE + }; + + function Reference(parent, key) { + this.parent = parent; + this.key = key; + } + + Reference.prototype.replace = function replace(node) { + this.parent[this.key] = node; + }; + + Reference.prototype.remove = function remove() { + if (Array.isArray(this.parent)) { + this.parent.splice(this.key, 1); + return true; + } else { + this.replace(null); + return false; + } + }; + + function Element(node, path, wrap, ref) { + this.node = node; + this.path = path; + this.wrap = wrap; + this.ref = ref; + } + + function Controller() { } + + // API: + // return property path array from root to current node + Controller.prototype.path = function path() { + var i, iz, j, jz, result, element; + + function addToPath(result, path) { + if (Array.isArray(path)) { + for (j = 0, jz = path.length; j < jz; ++j) { + result.push(path[j]); + } + } else { + result.push(path); + } + } + + // root node + if (!this.__current.path) { + return null; + } + + // first node is sentinel, second node is root element + result = []; + for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { + element = this.__leavelist[i]; + addToPath(result, element.path); + } + addToPath(result, this.__current.path); + return result; + }; + + // API: + // return type of current node + Controller.prototype.type = function () { + var node = this.current(); + return node.type || this.__current.wrap; + }; + + // API: + // return array of parent elements + Controller.prototype.parents = function parents() { + var i, iz, result; + + // first node is sentinel + result = []; + for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { + result.push(this.__leavelist[i].node); + } + + return result; + }; + + // API: + // return current node + Controller.prototype.current = function current() { + return this.__current.node; + }; + + Controller.prototype.__execute = function __execute(callback, element) { + var previous, result; + + result = undefined; + + previous = this.__current; + this.__current = element; + this.__state = null; + if (callback) { + result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); + } + this.__current = previous; + + return result; + }; + + // API: + // notify control skip / break + Controller.prototype.notify = function notify(flag) { + this.__state = flag; + }; + + // API: + // skip child nodes of current node + Controller.prototype.skip = function () { + this.notify(SKIP); + }; + + // API: + // break traversals + Controller.prototype['break'] = function () { + this.notify(BREAK); + }; + + // API: + // remove node + Controller.prototype.remove = function () { + this.notify(REMOVE); + }; + + Controller.prototype.__initialize = function(root, visitor) { + this.visitor = visitor; + this.root = root; + this.__worklist = []; + this.__leavelist = []; + this.__current = null; + this.__state = null; + this.__fallback = null; + if (visitor.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof visitor.fallback === 'function') { + this.__fallback = visitor.fallback; + } + + this.__keys = VisitorKeys; + if (visitor.keys) { + this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); + } + }; + + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === 'object' && typeof node.type === 'string'; + } + + function isProperty(nodeType, key) { + return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; + } + + Controller.prototype.traverse = function traverse(root, visitor) { + var worklist, + leavelist, + element, + node, + nodeType, + ret, + key, + current, + current2, + candidates, + candidate, + sentinel; + + this.__initialize(root, visitor); + + sentinel = {}; + + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; + + // initialize + worklist.push(new Element(root, null, null, null)); + leavelist.push(new Element(null, null, null, null)); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + + ret = this.__execute(visitor.leave, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + continue; + } + + if (element.node) { + + ret = this.__execute(visitor.enter, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || ret === SKIP) { + continue; + } + + node = element.node; + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', null); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, null); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, null)); + } + } + } + } + }; + + Controller.prototype.replace = function replace(root, visitor) { + var worklist, + leavelist, + node, + nodeType, + target, + element, + current, + current2, + candidates, + candidate, + sentinel, + outer, + key; + + function removeElem(element) { + var i, + key, + nextElem, + parent; + + if (element.ref.remove()) { + // When the reference is an element of an array. + key = element.ref.key; + parent = element.ref.parent; + + // If removed from array, then decrease following items' keys. + i = worklist.length; + while (i--) { + nextElem = worklist[i]; + if (nextElem.ref && nextElem.ref.parent === parent) { + if (nextElem.ref.key < key) { + break; + } + --nextElem.ref.key; + } + } + } + } + + this.__initialize(root, visitor); + + sentinel = {}; + + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; + + // initialize + outer = { + root: root + }; + element = new Element(root, null, null, new Reference(outer, 'root')); + worklist.push(element); + leavelist.push(element); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + + target = this.__execute(visitor.leave, element); + + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + continue; + } + + target = this.__execute(visitor.enter, element); + + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + element.node = target; + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + element.node = null; + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + + // node may be null + node = element.node; + if (!node) { + continue; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || target === SKIP) { + continue; + } + + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, new Reference(node, key))); + } + } + } + + return outer.root; + }; + + function traverse(root, visitor) { + var controller = new Controller(); + return controller.traverse(root, visitor); + } + + function replace(root, visitor) { + var controller = new Controller(); + return controller.replace(root, visitor); + } + + function extendCommentRange(comment, tokens) { + var target; + + target = upperBound(tokens, function search(token) { + return token.range[0] > comment.range[0]; + }); + + comment.extendedRange = [comment.range[0], comment.range[1]]; + + if (target !== tokens.length) { + comment.extendedRange[1] = tokens[target].range[0]; + } + + target -= 1; + if (target >= 0) { + comment.extendedRange[0] = tokens[target].range[1]; + } + + return comment; + } + + function attachComments(tree, providedComments, tokens) { + // At first, we should calculate extended comment ranges. + var comments = [], comment, len, i, cursor; + + if (!tree.range) { + throw new Error('attachComments needs range information'); + } + + // tokens array is empty, we attach comments to tree as 'leadingComments' + if (!tokens.length) { + if (providedComments.length) { + for (i = 0, len = providedComments.length; i < len; i += 1) { + comment = deepCopy(providedComments[i]); + comment.extendedRange = [0, tree.range[0]]; + comments.push(comment); + } + tree.leadingComments = comments; + } + return tree; + } + + for (i = 0, len = providedComments.length; i < len; i += 1) { + comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); + } + + // This is based on John Freeman's implementation. + cursor = 0; + traverse(tree, { + enter: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + if (comment.extendedRange[1] > node.range[0]) { + break; + } + + if (comment.extendedRange[1] === node.range[0]) { + if (!node.leadingComments) { + node.leadingComments = []; + } + node.leadingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } + + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + + cursor = 0; + traverse(tree, { + leave: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + if (node.range[1] < comment.extendedRange[0]) { + break; + } + + if (node.range[1] === comment.extendedRange[0]) { + if (!node.trailingComments) { + node.trailingComments = []; + } + node.trailingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } + + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + + return tree; + } + + exports.version = require('./package.json').version; + exports.Syntax = Syntax; + exports.traverse = traverse; + exports.replace = replace; + exports.attachComments = attachComments; + exports.VisitorKeys = VisitorKeys; + exports.VisitorOption = VisitorOption; + exports.Controller = Controller; + exports.cloneEnvironment = function () { return clone({}); }; + + return exports; +}(exports)); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/estraverse/package.json b/tools/node_modules/@babel/eslint-parser/node_modules/estraverse/package.json new file mode 100644 index 00000000000000..1138238672309b --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/estraverse/package.json @@ -0,0 +1,40 @@ +{ + "name": "estraverse", + "description": "ECMAScript JS AST traversal functions", + "homepage": "https://github.com/estools/estraverse", + "main": "estraverse.js", + "version": "4.3.0", + "engines": { + "node": ">=4.0" + }, + "maintainers": [ + { + "name": "Yusuke Suzuki", + "email": "utatane.tea@gmail.com", + "web": "http://github.com/Constellation" + } + ], + "repository": { + "type": "git", + "url": "http://github.com/estools/estraverse.git" + }, + "devDependencies": { + "babel-preset-env": "^1.6.1", + "babel-register": "^6.3.13", + "chai": "^2.1.1", + "espree": "^1.11.0", + "gulp": "^3.8.10", + "gulp-bump": "^0.2.2", + "gulp-filter": "^2.0.0", + "gulp-git": "^1.0.1", + "gulp-tag-version": "^1.3.0", + "jshint": "^2.5.6", + "mocha": "^2.1.0" + }, + "license": "BSD-2-Clause", + "scripts": { + "test": "npm run-script lint && npm run-script unit-test", + "lint": "jshint estraverse.js", + "unit-test": "mocha --compilers js:babel-register" + } +} diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/semver/LICENSE b/tools/node_modules/@babel/eslint-parser/node_modules/semver/LICENSE new file mode 100644 index 00000000000000..19129e315fe593 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/semver/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/semver/README.md b/tools/node_modules/@babel/eslint-parser/node_modules/semver/README.md new file mode 100644 index 00000000000000..2293a14fdc3579 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/semver/README.md @@ -0,0 +1,443 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Install + +```bash +npm install semver +```` + +## Usage + +As a node module: + +```js +const semver = require('semver') + +semver.valid('1.2.3') // '1.2.3' +semver.valid('a.b.c') // null +semver.clean(' =v1.2.3 ') // '1.2.3' +semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true +semver.gt('1.2.3', '9.8.7') // false +semver.lt('1.2.3', '9.8.7') // true +semver.minVersion('>=1.0.0') // '1.0.0' +semver.valid(semver.coerce('v2')) // '2.0.0' +semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' +``` + +As a command-line utility: + +``` +$ semver -h + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +--rtl + Coerce version strings right to left + +--ltr + Coerce version strings left to right (default) + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them. +``` + +## Versions + +A "version" is described by the `v2.0.0` specification found at +. + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Ranges + +A `version range` is a set of `comparators` which specify versions +that satisfy the range. + +A `comparator` is composed of an `operator` and a `version`. The set +of primitive `operators` is: + +* `<` Less than +* `<=` Less than or equal to +* `>` Greater than +* `>=` Greater than or equal to +* `=` Equal. If no operator is specified, then equality is assumed, + so this operator is optional, but MAY be included. + +For example, the comparator `>=1.2.7` would match the versions +`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` +or `1.1.0`. + +Comparators can be joined by whitespace to form a `comparator set`, +which is satisfied by the **intersection** of all of the comparators +it includes. + +A range is composed of one or more comparator sets, joined by `||`. A +version matches a range if and only if every comparator in at least +one of the `||`-separated comparator sets is satisfied by the version. + +For example, the range `>=1.2.7 <1.3.0` would match the versions +`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, +or `1.1.0`. + +The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, +`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. + +### Prerelease Tags + +If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then +it will only be allowed to satisfy comparator sets if at least one +comparator with the same `[major, minor, patch]` tuple also has a +prerelease tag. + +For example, the range `>1.2.3-alpha.3` would be allowed to match the +version `1.2.3-alpha.7`, but it would *not* be satisfied by +`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater +than" `1.2.3-alpha.3` according to the SemVer sort rules. The version +range only accepts prerelease tags on the `1.2.3` version. The +version `3.4.5` *would* satisfy the range, because it does not have a +prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. + +The purpose for this behavior is twofold. First, prerelease versions +frequently are updated very quickly, and contain many breaking changes +that are (by the author's design) not yet fit for public consumption. +Therefore, by default, they are excluded from range matching +semantics. + +Second, a user who has opted into using a prerelease version has +clearly indicated the intent to use *that specific* set of +alpha/beta/rc versions. By including a prerelease tag in the range, +the user is indicating that they are aware of the risk. However, it +is still not appropriate to assume that they have opted into taking a +similar risk on the *next* set of prerelease versions. + +Note that this behavior can be suppressed (treating all prerelease +versions as if they were normal versions, for the purpose of range +matching) by setting the `includePrerelease` flag on the options +object to any +[functions](https://github.com/npm/node-semver#functions) that do +range matching. + +#### Prerelease Identifiers + +The method `.inc` takes an additional `identifier` string argument that +will append the value of the string as a prerelease identifier: + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta') +// '1.2.4-beta.0' +``` + +command-line example: + +```bash +$ semver 1.2.3 -i prerelease --preid beta +1.2.4-beta.0 +``` + +Which then can be used to increment further: + +```bash +$ semver 1.2.4-beta.0 -i prerelease +1.2.4-beta.1 +``` + +### Advanced Range Syntax + +Advanced range syntax desugars to primitive comparators in +deterministic ways. + +Advanced ranges may be combined in the same way as primitive +comparators using white space or `||`. + +#### Hyphen Ranges `X.Y.Z - A.B.C` + +Specifies an inclusive set. + +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` + +If a partial version is provided as the first version in the inclusive +range, then the missing pieces are replaced with zeroes. + +* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` + +If a partial version is provided as the second version in the +inclusive range, then all versions that start with the supplied parts +of the tuple are accepted, but nothing that would be greater than the +provided tuple parts. + +* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.0` + +#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` + +Any of `X`, `x`, or `*` may be used to "stand in" for one of the +numeric values in the `[major, minor, patch]` tuple. + +* `*` := `>=0.0.0` (Any version satisfies) +* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) +* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) + +A partial version range is treated as an X-Range, so the special +character is in fact optional. + +* `""` (empty string) := `*` := `>=0.0.0` +* `1` := `1.x.x` := `>=1.0.0 <2.0.0` +* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` + +#### Tilde Ranges `~1.2.3` `~1.2` `~1` + +Allows patch-level changes if a minor version is specified on the +comparator. Allows minor-level changes if not. + +* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` +* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) +* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) +* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` +* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) +* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) +* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. + +#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` + +Allows changes that do not modify the left-most non-zero element in the +`[major, minor, patch]` tuple. In other words, this allows patch and +minor updates for versions `1.0.0` and above, patch updates for +versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. + +Many authors treat a `0.x` version as if the `x` were the major +"breaking-change" indicator. + +Caret ranges are ideal when an author may make breaking changes +between `0.2.4` and `0.3.0` releases, which is a common practice. +However, it presumes that there will *not* be breaking changes between +`0.2.4` and `0.2.5`. It allows for changes that are presumed to be +additive (but non-breaking), according to commonly observed practices. + +* `^1.2.3` := `>=1.2.3 <2.0.0` +* `^0.2.3` := `>=0.2.3 <0.3.0` +* `^0.0.3` := `>=0.0.3 <0.0.4` +* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. +* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the + `0.0.3` version *only* will be allowed, if they are greater than or + equal to `beta`. So, `0.0.3-pr.2` would be allowed. + +When parsing caret ranges, a missing `patch` value desugars to the +number `0`, but will allow flexibility within that value, even if the +major and minor versions are both `0`. + +* `^1.2.x` := `>=1.2.0 <2.0.0` +* `^0.0.x` := `>=0.0.0 <0.1.0` +* `^0.0` := `>=0.0.0 <0.1.0` + +A missing `minor` and `patch` values will desugar to zero, but also +allow flexibility within those values, even if the major version is +zero. + +* `^1.x` := `>=1.0.0 <2.0.0` +* `^0.x` := `>=0.0.0 <1.0.0` + +### Range Grammar + +Putting all this together, here is a Backus-Naur grammar for ranges, +for the benefit of parser authors: + +```bnf +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ +``` + +## Functions + +All methods and classes take a final `options` object argument. All +options in this object are `false` by default. The options supported +are: + +- `loose` Be more forgiving about not-quite-valid semver strings. + (Any resulting output will always be 100% strict compliant, of + course.) For backwards compatibility reasons, if the `options` + argument is a boolean value instead of an object, it is interpreted + to be the `loose` param. +- `includePrerelease` Set to suppress the [default + behavior](https://github.com/npm/node-semver#prerelease-tags) of + excluding prerelease tagged versions from ranges unless they are + explicitly opted into. + +Strict-mode Comparators and Ranges will be strict about the SemVer +strings that they parse. + +* `valid(v)`: Return the parsed version, or null if it's not valid. +* `inc(v, release)`: Return the version incremented by the release + type (`major`, `premajor`, `minor`, `preminor`, `patch`, + `prepatch`, or `prerelease`), or null if it's not valid + * `premajor` in one call will bump the version up to the next major + version and down to a prerelease of that major version. + `preminor`, and `prepatch` work the same way. + * If called from a non-prerelease version, the `prerelease` will work the + same as `prepatch`. It increments the patch version, then makes a + prerelease. If the input version is already a prerelease it simply + increments it. +* `prerelease(v)`: Returns an array of prerelease components, or null + if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` +* `major(v)`: Return the major version number. +* `minor(v)`: Return the minor version number. +* `patch(v)`: Return the patch version number. +* `intersects(r1, r2, loose)`: Return true if the two supplied ranges + or comparators intersect. +* `parse(v)`: Attempt to parse a string as a semantic version, returning either + a `SemVer` object or `null`. + +### Comparison + +* `gt(v1, v2)`: `v1 > v2` +* `gte(v1, v2)`: `v1 >= v2` +* `lt(v1, v2)`: `v1 < v2` +* `lte(v1, v2)`: `v1 <= v2` +* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, + even if they're not the exact same string. You already know how to + compare strings. +* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. +* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions + in descending order when passed to `Array.sort()`. +* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions + are equal. Sorts in ascending order if passed to `Array.sort()`. + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `diff(v1, v2)`: Returns difference between two versions by the release type + (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), + or null if the versions are the same. + +### Comparators + +* `intersects(comparator)`: Return true if the comparators intersect + +### Ranges + +* `validRange(range)`: Return the valid range or null if it's not valid +* `satisfies(version, range)`: Return true if the version satisfies the + range. +* `maxSatisfying(versions, range)`: Return the highest version in the list + that satisfies the range, or `null` if none of them do. +* `minSatisfying(versions, range)`: Return the lowest version in the list + that satisfies the range, or `null` if none of them do. +* `minVersion(range)`: Return the lowest version that can possibly match + the given range. +* `gtr(version, range)`: Return `true` if version is greater than all the + versions possible in the range. +* `ltr(version, range)`: Return `true` if version is less than all the + versions possible in the range. +* `outside(version, range, hilo)`: Return true if the version is outside + the bounds of the range in either the high or low direction. The + `hilo` argument must be either the string `'>'` or `'<'`. (This is + the function called by `gtr` and `ltr`.) +* `intersects(range)`: Return true if any of the ranges comparators intersect + +Note that, since ranges may be non-contiguous, a version might not be +greater than a range, less than a range, *or* satisfy a range! For +example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` +until `2.0.0`, so the version `1.2.10` would not be greater than the +range (because `2.0.1` satisfies, which is higher), nor less than the +range (since `1.2.8` satisfies, which is lower), and it also does not +satisfy the range. + +If you want to know if a version satisfies or does not satisfy a +range, use the `satisfies(version, range)` function. + +### Coercion + +* `coerce(version, options)`: Coerces a string to semver if possible + +This aims to provide a very forgiving translation of a non-semver string to +semver. It looks for the first digit in a string, and consumes all +remaining characters which satisfy at least a partial semver (e.g., `1`, +`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer +versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All +surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes +`3.4.0`). Only text which lacks digits will fail coercion (`version one` +is not valid). The maximum length for any semver component considered for +coercion is 16 characters; longer components will be ignored +(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any +semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value +components are invalid (`9999999999999999.4.7.4` is likely invalid). + +If the `options.rtl` flag is set, then `coerce` will return the right-most +coercible tuple that does not share an ending index with a longer coercible +tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not +`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of +any other overlapping SemVer tuple. + +### Clean + +* `clean(version)`: Clean a string to be a valid semver if possible + +This will return a cleaned and trimmed semver version. If the provided version is not valid a null will be returned. This does not work for ranges. + +ex. +* `s.clean(' = v 2.1.5foo')`: `null` +* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'` +* `s.clean(' = v 2.1.5-foo')`: `null` +* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'` +* `s.clean('=v2.1.5')`: `'2.1.5'` +* `s.clean(' =v2.1.5')`: `2.1.5` +* `s.clean(' 2.1.5 ')`: `'2.1.5'` +* `s.clean('~1.0.0')`: `null` diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/semver/bin/semver.js b/tools/node_modules/@babel/eslint-parser/node_modules/semver/bin/semver.js new file mode 100755 index 00000000000000..666034a75d8442 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/semver/bin/semver.js @@ -0,0 +1,174 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +var argv = process.argv.slice(2) + +var versions = [] + +var range = [] + +var inc = null + +var version = require('../package.json').version + +var loose = false + +var includePrerelease = false + +var coerce = false + +var rtl = false + +var identifier + +var semver = require('../semver') + +var reverse = false + +var options = {} + +main() + +function main () { + if (!argv.length) return help() + while (argv.length) { + var a = argv.shift() + var indexOfEqualSign = a.indexOf('=') + if (indexOfEqualSign !== -1) { + a = a.slice(0, indexOfEqualSign) + argv.unshift(a.slice(indexOfEqualSign + 1)) + } + switch (a) { + case '-rv': case '-rev': case '--rev': case '--reverse': + reverse = true + break + case '-l': case '--loose': + loose = true + break + case '-p': case '--include-prerelease': + includePrerelease = true + break + case '-v': case '--version': + versions.push(argv.shift()) + break + case '-i': case '--inc': case '--increment': + switch (argv[0]) { + case 'major': case 'minor': case 'patch': case 'prerelease': + case 'premajor': case 'preminor': case 'prepatch': + inc = argv.shift() + break + default: + inc = 'patch' + break + } + break + case '--preid': + identifier = argv.shift() + break + case '-r': case '--range': + range.push(argv.shift()) + break + case '-c': case '--coerce': + coerce = true + break + case '--rtl': + rtl = true + break + case '--ltr': + rtl = false + break + case '-h': case '--help': case '-?': + return help() + default: + versions.push(a) + break + } + } + + var options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl } + + versions = versions.map(function (v) { + return coerce ? (semver.coerce(v, options) || { version: v }).version : v + }).filter(function (v) { + return semver.valid(v) + }) + if (!versions.length) return fail() + if (inc && (versions.length !== 1 || range.length)) { return failInc() } + + for (var i = 0, l = range.length; i < l; i++) { + versions = versions.filter(function (v) { + return semver.satisfies(v, range[i], options) + }) + if (!versions.length) return fail() + } + return success(versions) +} + +function failInc () { + console.error('--inc can only be used on a single version with no range') + fail() +} + +function fail () { process.exit(1) } + +function success () { + var compare = reverse ? 'rcompare' : 'compare' + versions.sort(function (a, b) { + return semver[compare](a, b, options) + }).map(function (v) { + return semver.clean(v, options) + }).map(function (v) { + return inc ? semver.inc(v, inc, options, identifier) : v + }).forEach(function (v, i, _) { console.log(v) }) +} + +function help () { + console.log(['SemVer ' + version, + '', + 'A JavaScript implementation of the https://semver.org/ specification', + 'Copyright Isaac Z. Schlueter', + '', + 'Usage: semver [options] [ [...]]', + 'Prints valid versions sorted by SemVer precedence', + '', + 'Options:', + '-r --range ', + ' Print versions that match the specified range.', + '', + '-i --increment []', + ' Increment a version by the specified level. Level can', + ' be one of: major, minor, patch, premajor, preminor,', + " prepatch, or prerelease. Default level is 'patch'.", + ' Only one version may be specified.', + '', + '--preid ', + ' Identifier to be used to prefix premajor, preminor,', + ' prepatch or prerelease version increments.', + '', + '-l --loose', + ' Interpret versions and ranges loosely', + '', + '-p --include-prerelease', + ' Always include prerelease versions in range matching', + '', + '-c --coerce', + ' Coerce a string into SemVer if possible', + ' (does not imply --loose)', + '', + '--rtl', + ' Coerce version strings right to left', + '', + '--ltr', + ' Coerce version strings left to right (default)', + '', + 'Program exits successfully if any valid version satisfies', + 'all supplied ranges, and prints all satisfying versions.', + '', + 'If no satisfying versions are found, then exits failure.', + '', + 'Versions are printed in ascending order, so supplying', + 'multiple versions to the utility will just sort them.' + ].join('\n')) +} diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/semver/package.json b/tools/node_modules/@babel/eslint-parser/node_modules/semver/package.json new file mode 100644 index 00000000000000..bdd442f50022f6 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/semver/package.json @@ -0,0 +1,28 @@ +{ + "name": "semver", + "version": "6.3.0", + "description": "The semantic version parser used by npm.", + "main": "semver.js", + "scripts": { + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --follow-tags" + }, + "devDependencies": { + "tap": "^14.3.1" + }, + "license": "ISC", + "repository": "https://github.com/npm/node-semver", + "bin": { + "semver": "./bin/semver.js" + }, + "files": [ + "bin", + "range.bnf", + "semver.js" + ], + "tap": { + "check-coverage": true + } +} diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/semver/range.bnf b/tools/node_modules/@babel/eslint-parser/node_modules/semver/range.bnf new file mode 100644 index 00000000000000..d4c6ae0d76c9ac --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/semver/range.bnf @@ -0,0 +1,16 @@ +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | [1-9] ( [0-9] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ diff --git a/tools/node_modules/@babel/eslint-parser/node_modules/semver/semver.js b/tools/node_modules/@babel/eslint-parser/node_modules/semver/semver.js new file mode 100644 index 00000000000000..636fa4365a175f --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/node_modules/semver/semver.js @@ -0,0 +1,1596 @@ +exports = module.exports = SemVer + +var debug +/* istanbul ignore next */ +if (typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG)) { + debug = function () { + var args = Array.prototype.slice.call(arguments, 0) + args.unshift('SEMVER') + console.log.apply(console, args) + } +} else { + debug = function () {} +} + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0' + +var MAX_LENGTH = 256 +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +var MAX_SAFE_COMPONENT_LENGTH = 16 + +// The actual regexps go on exports.re +var re = exports.re = [] +var src = exports.src = [] +var t = exports.tokens = {} +var R = 0 + +function tok (n) { + t[n] = R++ +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +tok('NUMERICIDENTIFIER') +src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*' +tok('NUMERICIDENTIFIERLOOSE') +src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+' + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +tok('NONNUMERICIDENTIFIER') +src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' + +// ## Main Version +// Three dot-separated numeric identifiers. + +tok('MAINVERSION') +src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIER] + ')' + +tok('MAINVERSIONLOOSE') +src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')' + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +tok('PRERELEASEIDENTIFIER') +src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] + + '|' + src[t.NONNUMERICIDENTIFIER] + ')' + +tok('PRERELEASEIDENTIFIERLOOSE') +src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] + + '|' + src[t.NONNUMERICIDENTIFIER] + ')' + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +tok('PRERELEASE') +src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] + + '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))' + +tok('PRERELEASELOOSE') +src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))' + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +tok('BUILDIDENTIFIER') +src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+' + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +tok('BUILD') +src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] + + '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))' + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +tok('FULL') +tok('FULLPLAIN') +src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] + + src[t.PRERELEASE] + '?' + + src[t.BUILD] + '?' + +src[t.FULL] = '^' + src[t.FULLPLAIN] + '$' + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +tok('LOOSEPLAIN') +src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] + + src[t.PRERELEASELOOSE] + '?' + + src[t.BUILD] + '?' + +tok('LOOSE') +src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$' + +tok('GTLT') +src[t.GTLT] = '((?:<|>)?=?)' + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +tok('XRANGEIDENTIFIERLOOSE') +src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' +tok('XRANGEIDENTIFIER') +src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*' + +tok('XRANGEPLAIN') +src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + + '(?:' + src[t.PRERELEASE] + ')?' + + src[t.BUILD] + '?' + + ')?)?' + +tok('XRANGEPLAINLOOSE') +src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + + '(?:' + src[t.PRERELEASELOOSE] + ')?' + + src[t.BUILD] + '?' + + ')?)?' + +tok('XRANGE') +src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$' +tok('XRANGELOOSE') +src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$' + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +tok('COERCE') +src[t.COERCE] = '(^|[^\\d])' + + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:$|[^\\d])' +tok('COERCERTL') +re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g') + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +tok('LONETILDE') +src[t.LONETILDE] = '(?:~>?)' + +tok('TILDETRIM') +src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+' +re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g') +var tildeTrimReplace = '$1~' + +tok('TILDE') +src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$' +tok('TILDELOOSE') +src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$' + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +tok('LONECARET') +src[t.LONECARET] = '(?:\\^)' + +tok('CARETTRIM') +src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+' +re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g') +var caretTrimReplace = '$1^' + +tok('CARET') +src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$' +tok('CARETLOOSE') +src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$' + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +tok('COMPARATORLOOSE') +src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$' +tok('COMPARATOR') +src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$' + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +tok('COMPARATORTRIM') +src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + + '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')' + +// this one has to use the /g flag +re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g') +var comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +tok('HYPHENRANGE') +src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[t.XRANGEPLAIN] + ')' + + '\\s*$' + +tok('HYPHENRANGELOOSE') +src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[t.XRANGEPLAINLOOSE] + ')' + + '\\s*$' + +// Star ranges basically just allow anything at all. +tok('STAR') +src[t.STAR] = '(<|>)?=?\\s*\\*' + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + debug(i, src[i]) + if (!re[i]) { + re[i] = new RegExp(src[i]) + } +} + +exports.parse = parse +function parse (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + if (version.length > MAX_LENGTH) { + return null + } + + var r = options.loose ? re[t.LOOSE] : re[t.FULL] + if (!r.test(version)) { + return null + } + + try { + return new SemVer(version, options) + } catch (er) { + return null + } +} + +exports.valid = valid +function valid (version, options) { + var v = parse(version, options) + return v ? v.version : null +} + +exports.clean = clean +function clean (version, options) { + var s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} + +exports.SemVer = SemVer + +function SemVer (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + if (version instanceof SemVer) { + if (version.loose === options.loose) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') + } + + if (!(this instanceof SemVer)) { + return new SemVer(version, options) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + + var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) + + if (!m) { + throw new TypeError('Invalid Version: ' + version) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map(function (id) { + if (/^[0-9]+$/.test(id)) { + var num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() +} + +SemVer.prototype.format = function () { + this.version = this.major + '.' + this.minor + '.' + this.patch + if (this.prerelease.length) { + this.version += '-' + this.prerelease.join('.') + } + return this.version +} + +SemVer.prototype.toString = function () { + return this.version +} + +SemVer.prototype.compare = function (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return this.compareMain(other) || this.comparePre(other) +} + +SemVer.prototype.compareMain = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) +} + +SemVer.prototype.comparePre = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + var i = 0 + do { + var a = this.prerelease[i] + var b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) +} + +SemVer.prototype.compareBuild = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + var i = 0 + do { + var a = this.build[i] + var b = other.build[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) +} + +// preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. +SemVer.prototype.inc = function (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier) + this.inc('pre', identifier) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier) + } + this.inc('pre', identifier) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0] + } else { + var i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + this.prerelease.push(0) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0] + } + } else { + this.prerelease = [identifier, 0] + } + } + break + + default: + throw new Error('invalid increment argument: ' + release) + } + this.format() + this.raw = this.version + return this +} + +exports.inc = inc +function inc (version, release, loose, identifier) { + if (typeof (loose) === 'string') { + identifier = loose + loose = undefined + } + + try { + return new SemVer(version, loose).inc(release, identifier).version + } catch (er) { + return null + } +} + +exports.diff = diff +function diff (version1, version2) { + if (eq(version1, version2)) { + return null + } else { + var v1 = parse(version1) + var v2 = parse(version2) + var prefix = '' + if (v1.prerelease.length || v2.prerelease.length) { + prefix = 'pre' + var defaultResult = 'prerelease' + } + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key + } + } + } + return defaultResult // may be undefined + } +} + +exports.compareIdentifiers = compareIdentifiers + +var numeric = /^[0-9]+$/ +function compareIdentifiers (a, b) { + var anum = numeric.test(a) + var bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +exports.rcompareIdentifiers = rcompareIdentifiers +function rcompareIdentifiers (a, b) { + return compareIdentifiers(b, a) +} + +exports.major = major +function major (a, loose) { + return new SemVer(a, loose).major +} + +exports.minor = minor +function minor (a, loose) { + return new SemVer(a, loose).minor +} + +exports.patch = patch +function patch (a, loose) { + return new SemVer(a, loose).patch +} + +exports.compare = compare +function compare (a, b, loose) { + return new SemVer(a, loose).compare(new SemVer(b, loose)) +} + +exports.compareLoose = compareLoose +function compareLoose (a, b) { + return compare(a, b, true) +} + +exports.compareBuild = compareBuild +function compareBuild (a, b, loose) { + var versionA = new SemVer(a, loose) + var versionB = new SemVer(b, loose) + return versionA.compare(versionB) || versionA.compareBuild(versionB) +} + +exports.rcompare = rcompare +function rcompare (a, b, loose) { + return compare(b, a, loose) +} + +exports.sort = sort +function sort (list, loose) { + return list.sort(function (a, b) { + return exports.compareBuild(a, b, loose) + }) +} + +exports.rsort = rsort +function rsort (list, loose) { + return list.sort(function (a, b) { + return exports.compareBuild(b, a, loose) + }) +} + +exports.gt = gt +function gt (a, b, loose) { + return compare(a, b, loose) > 0 +} + +exports.lt = lt +function lt (a, b, loose) { + return compare(a, b, loose) < 0 +} + +exports.eq = eq +function eq (a, b, loose) { + return compare(a, b, loose) === 0 +} + +exports.neq = neq +function neq (a, b, loose) { + return compare(a, b, loose) !== 0 +} + +exports.gte = gte +function gte (a, b, loose) { + return compare(a, b, loose) >= 0 +} + +exports.lte = lte +function lte (a, b, loose) { + return compare(a, b, loose) <= 0 +} + +exports.cmp = cmp +function cmp (a, op, b, loose) { + switch (op) { + case '===': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a === b + + case '!==': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError('Invalid operator: ' + op) + } +} + +exports.Comparator = Comparator +function Comparator (comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + if (!(this instanceof Comparator)) { + return new Comparator(comp, options) + } + + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) +} + +var ANY = {} +Comparator.prototype.parse = function (comp) { + var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + var m = comp.match(r) + + if (!m) { + throw new TypeError('Invalid comparator: ' + comp) + } + + this.operator = m[1] !== undefined ? m[1] : '' + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } +} + +Comparator.prototype.toString = function () { + return this.value +} + +Comparator.prototype.test = function (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY || version === ANY) { + return true + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + return cmp(version, this.operator, this.semver, this.options) +} + +Comparator.prototype.intersects = function (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + var rangeTmp + + if (this.operator === '') { + if (this.value === '') { + return true + } + rangeTmp = new Range(comp.value, options) + return satisfies(this.value, rangeTmp, options) + } else if (comp.operator === '') { + if (comp.value === '') { + return true + } + rangeTmp = new Range(this.value, options) + return satisfies(comp.semver, rangeTmp, options) + } + + var sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>') + var sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<') + var sameSemVer = this.semver.version === comp.semver.version + var differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<=') + var oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, options) && + ((this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<')) + var oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, options) && + ((this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>')) + + return sameDirectionIncreasing || sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || oppositeDirectionsGreaterThan +} + +exports.Range = Range +function Range (range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (range instanceof Range) { + if (range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + return new Range(range.value, options) + } + + if (!(this instanceof Range)) { + return new Range(range, options) + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First, split based on boolean or || + this.raw = range + this.set = range.split(/\s*\|\|\s*/).map(function (range) { + return this.parseRange(range.trim()) + }, this).filter(function (c) { + // throw out any that are not relevant for whatever reason + return c.length + }) + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + range) + } + + this.format() +} + +Range.prototype.format = function () { + this.range = this.set.map(function (comps) { + return comps.join(' ').trim() + }).join('||').trim() + return this.range +} + +Range.prototype.toString = function () { + return this.range +} + +Range.prototype.parseRange = function (range) { + var loose = this.options.loose + range = range.trim() + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + range = range.replace(hr, hyphenReplace) + debug('hyphen replace', range) + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, re[t.COMPARATORTRIM]) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[t.CARETTRIM], caretTrimReplace) + + // normalize spaces + range = range.split(/\s+/).join(' ') + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + var set = range.split(' ').map(function (comp) { + return parseComparator(comp, this.options) + }, this).join(' ').split(/\s+/) + if (this.options.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function (comp) { + return !!comp.match(compRe) + }) + } + set = set.map(function (comp) { + return new Comparator(comp, this.options) + }, this) + + return set +} + +Range.prototype.intersects = function (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some(function (thisComparators) { + return ( + isSatisfiable(thisComparators, options) && + range.set.some(function (rangeComparators) { + return ( + isSatisfiable(rangeComparators, options) && + thisComparators.every(function (thisComparator) { + return rangeComparators.every(function (rangeComparator) { + return thisComparator.intersects(rangeComparator, options) + }) + }) + ) + }) + ) + }) +} + +// take a set of comparators and determine whether there +// exists a version which can satisfy it +function isSatisfiable (comparators, options) { + var result = true + var remainingComparators = comparators.slice() + var testComparator = remainingComparators.pop() + + while (result && remainingComparators.length) { + result = remainingComparators.every(function (otherComparator) { + return testComparator.intersects(otherComparator, options) + }) + + testComparator = remainingComparators.pop() + } + + return result +} + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators +function toComparators (range, options) { + return new Range(range, options).set.map(function (comp) { + return comp.map(function (c) { + return c.value + }).join(' ').trim().split(' ') + }) +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator (comp, options) { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +function isX (id) { + return !id || id.toLowerCase() === 'x' || id === '*' +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceTilde(comp, options) + }).join(' ') +} + +function replaceTilde (comp, options) { + var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + return comp.replace(r, function (_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0 + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else if (pr) { + debug('replaceTilde pr', pr) + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } else { + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceCaret(comp, options) + }).join(' ') +} + +function replaceCaret (comp, options) { + debug('caret', comp, options) + var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + return comp.replace(r, function (_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + if (M === '0') { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else { + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + (+M + 1) + '.0.0' + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + (+M + 1) + '.0.0' + } + } + + debug('caret return', ret) + return ret + }) +} + +function replaceXRanges (comp, options) { + debug('replaceXRanges', comp, options) + return comp.split(/\s+/).map(function (comp) { + return replaceXRange(comp, options) + }).join(' ') +} + +function replaceXRange (comp, options) { + comp = comp.trim() + var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + return comp.replace(r, function (ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + var xM = isX(M) + var xm = xM || isX(m) + var xp = xm || isX(p) + var anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + pr = options.includePrerelease ? '-0' : '' + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + ret = gtlt + M + '.' + m + '.' + p + pr + } else if (xm) { + ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr + } else if (xp) { + ret = '>=' + M + '.' + m + '.0' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + pr + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars (comp, options) { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re[t.STAR], '') +} + +// This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +function hyphenReplace ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = '>=' + fM + '.0.0' + } else if (isX(fp)) { + from = '>=' + fM + '.' + fm + '.0' + } else { + from = '>=' + from + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = '<' + (+tM + 1) + '.0.0' + } else if (isX(tp)) { + to = '<' + tM + '.' + (+tm + 1) + '.0' + } else if (tpr) { + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr + } else { + to = '<=' + to + } + + return (from + ' ' + to).trim() +} + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false +} + +function testSet (set, version, options) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} + +exports.satisfies = satisfies +function satisfies (version, range, options) { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} + +exports.maxSatisfying = maxSatisfying +function maxSatisfying (versions, range, options) { + var max = null + var maxSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} + +exports.minSatisfying = minSatisfying +function minSatisfying (versions, range, options) { + var min = null + var minSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} + +exports.minVersion = minVersion +function minVersion (range, loose) { + range = new Range(range, loose) + + var minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + comparators.forEach(function (comparator) { + // Clone to avoid manipulating the comparator's semver object. + var compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error('Unexpected operation: ' + comparator.operator) + } + }) + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} + +exports.validRange = validRange +function validRange (range, options) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr +function ltr (version, range, options) { + return outside(version, range, '<', options) +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr +function gtr (version, range, options) { + return outside(version, range, '>', options) +} + +exports.outside = outside +function outside (version, range, hilo, options) { + version = new SemVer(version, options) + range = new Range(range, options) + + var gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + var high = null + var low = null + + comparators.forEach(function (comparator) { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +exports.prerelease = prerelease +function prerelease (version, options) { + var parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} + +exports.intersects = intersects +function intersects (r1, r2, options) { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2) +} + +exports.coerce = coerce +function coerce (version, options) { + if (version instanceof SemVer) { + return version + } + + if (typeof version === 'number') { + version = String(version) + } + + if (typeof version !== 'string') { + return null + } + + options = options || {} + + var match = null + if (!options.rtl) { + match = version.match(re[t.COERCE]) + } else { + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + var next + while ((next = re[t.COERCERTL].exec(version)) && + (!match || match.index + match[0].length !== version.length) + ) { + if (!match || + next.index + next[0].length !== match.index + match[0].length) { + match = next + } + re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length + } + // leave it in a clean state + re[t.COERCERTL].lastIndex = -1 + } + + if (match === null) { + return null + } + + return parse(match[2] + + '.' + (match[3] || '0') + + '.' + (match[4] || '0'), options) +} diff --git a/tools/node_modules/@babel/eslint-parser/package.json b/tools/node_modules/@babel/eslint-parser/package.json new file mode 100644 index 00000000000000..115984fa1189f6 --- /dev/null +++ b/tools/node_modules/@babel/eslint-parser/package.json @@ -0,0 +1,43 @@ +{ + "name": "@babel/eslint-parser", + "version": "7.12.1", + "description": "ESLint parser that allows for linting of experimental syntax transformed by Babel", + "author": "The Babel Team (https://babeljs.io/team)", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "eslint/babel-eslint-parser" + }, + "publishConfig": { + "access": "public" + }, + "bugs": { + "url": "https://github.com/babel/babel/issues" + }, + "homepage": "https://babeljs.io/", + "engines": { + "node": "^10.13.0 || ^12.13.0 || >=14.0.0" + }, + "main": "./lib/index.js", + "type": "commonjs", + "exports": { + ".": "./lib/index.js", + "./package.json": "./package.json" + }, + "peerDependencies": { + "@babel/core": ">=7.11.0", + "eslint": ">=7.5.0" + }, + "dependencies": { + "eslint-scope": "5.1.0", + "eslint-visitor-keys": "^1.3.0", + "semver": "^6.3.0" + }, + "devDependencies": { + "@babel/core": "^7.12.1", + "dedent": "^0.7.0", + "eslint": "^7.5.0", + "lodash.clonedeep": "^4.5.0" + } +} \ No newline at end of file diff --git a/tools/node_modules/@babel/plugin-syntax-class-properties/LICENSE b/tools/node_modules/@babel/plugin-syntax-class-properties/LICENSE new file mode 100644 index 00000000000000..f31575ec773bb1 --- /dev/null +++ b/tools/node_modules/@babel/plugin-syntax-class-properties/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-present Sebastian McKenzie and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/@babel/plugin-syntax-class-properties/README.md b/tools/node_modules/@babel/plugin-syntax-class-properties/README.md new file mode 100644 index 00000000000000..16ace370014e17 --- /dev/null +++ b/tools/node_modules/@babel/plugin-syntax-class-properties/README.md @@ -0,0 +1,19 @@ +# @babel/plugin-syntax-class-properties + +> Allow parsing of class properties + +See our website [@babel/plugin-syntax-class-properties](https://babeljs.io/docs/en/next/babel-plugin-syntax-class-properties.html) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/plugin-syntax-class-properties +``` + +or using yarn: + +```sh +yarn add @babel/plugin-syntax-class-properties --dev +``` diff --git a/tools/node_modules/@babel/plugin-syntax-class-properties/lib/index.js b/tools/node_modules/@babel/plugin-syntax-class-properties/lib/index.js new file mode 100644 index 00000000000000..942008497a77bd --- /dev/null +++ b/tools/node_modules/@babel/plugin-syntax-class-properties/lib/index.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _helperPluginUtils = require("@babel/helper-plugin-utils"); + +var _default = (0, _helperPluginUtils.declare)(api => { + api.assertVersion(7); + return { + name: "syntax-class-properties", + + manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("classProperties", "classPrivateProperties", "classPrivateMethods"); + } + + }; +}); + +exports.default = _default; \ No newline at end of file diff --git a/tools/node_modules/@babel/plugin-syntax-class-properties/node_modules/@babel/helper-plugin-utils/LICENSE b/tools/node_modules/@babel/plugin-syntax-class-properties/node_modules/@babel/helper-plugin-utils/LICENSE new file mode 100644 index 00000000000000..f31575ec773bb1 --- /dev/null +++ b/tools/node_modules/@babel/plugin-syntax-class-properties/node_modules/@babel/helper-plugin-utils/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-present Sebastian McKenzie and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/@babel/plugin-syntax-class-properties/node_modules/@babel/helper-plugin-utils/README.md b/tools/node_modules/@babel/plugin-syntax-class-properties/node_modules/@babel/helper-plugin-utils/README.md new file mode 100644 index 00000000000000..4e6303e08962a2 --- /dev/null +++ b/tools/node_modules/@babel/plugin-syntax-class-properties/node_modules/@babel/helper-plugin-utils/README.md @@ -0,0 +1,19 @@ +# @babel/helper-plugin-utils + +> General utilities for plugins to use + +See our website [@babel/helper-plugin-utils](https://babeljs.io/docs/en/next/babel-helper-plugin-utils.html) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/helper-plugin-utils +``` + +or using yarn: + +```sh +yarn add @babel/helper-plugin-utils --dev +``` diff --git a/tools/node_modules/@babel/plugin-syntax-class-properties/node_modules/@babel/helper-plugin-utils/lib/index.js b/tools/node_modules/@babel/plugin-syntax-class-properties/node_modules/@babel/helper-plugin-utils/lib/index.js new file mode 100644 index 00000000000000..adb0656fa0e768 --- /dev/null +++ b/tools/node_modules/@babel/plugin-syntax-class-properties/node_modules/@babel/helper-plugin-utils/lib/index.js @@ -0,0 +1,77 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.declare = declare; + +function declare(builder) { + return (api, options, dirname) => { + if (!api.assertVersion) { + api = Object.assign(copyApiObject(api), { + assertVersion(range) { + throwVersionError(range, api.version); + } + + }); + } + + return builder(api, options || {}, dirname); + }; +} + +function copyApiObject(api) { + let proto = null; + + if (typeof api.version === "string" && /^7\./.test(api.version)) { + proto = Object.getPrototypeOf(api); + + if (proto && (!has(proto, "version") || !has(proto, "transform") || !has(proto, "template") || !has(proto, "types"))) { + proto = null; + } + } + + return Object.assign({}, proto, api); +} + +function has(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} + +function throwVersionError(range, version) { + if (typeof range === "number") { + if (!Number.isInteger(range)) { + throw new Error("Expected string or integer value."); + } + + range = `^${range}.0.0-0`; + } + + if (typeof range !== "string") { + throw new Error("Expected string or integer value."); + } + + const limit = Error.stackTraceLimit; + + if (typeof limit === "number" && limit < 25) { + Error.stackTraceLimit = 25; + } + + let err; + + if (version.slice(0, 2) === "7.") { + err = new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${version}". ` + `You'll need to update your @babel/core version.`); + } else { + err = new Error(`Requires Babel "${range}", but was loaded with "${version}". ` + `If you are sure you have a compatible version of @babel/core, ` + `it is likely that something in your build process is loading the ` + `wrong version. Inspect the stack trace of this error to look for ` + `the first entry that doesn't mention "@babel/core" or "babel-core" ` + `to see what is calling Babel.`); + } + + if (typeof limit === "number") { + Error.stackTraceLimit = limit; + } + + throw Object.assign(err, { + code: "BABEL_VERSION_UNSUPPORTED", + version, + range + }); +} \ No newline at end of file diff --git a/tools/node_modules/@babel/plugin-syntax-class-properties/node_modules/@babel/helper-plugin-utils/package.json b/tools/node_modules/@babel/plugin-syntax-class-properties/node_modules/@babel/helper-plugin-utils/package.json new file mode 100644 index 00000000000000..282d93f719fe54 --- /dev/null +++ b/tools/node_modules/@babel/plugin-syntax-class-properties/node_modules/@babel/helper-plugin-utils/package.json @@ -0,0 +1,18 @@ +{ + "name": "@babel/helper-plugin-utils", + "version": "7.10.4", + "description": "General utilities for plugins to use", + "author": "Logan Smyth ", + "homepage": "https://babeljs.io/", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "packages/babel-helper-plugin-utils" + }, + "main": "lib/index.js", + "gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df" +} diff --git a/tools/node_modules/@babel/plugin-syntax-class-properties/package.json b/tools/node_modules/@babel/plugin-syntax-class-properties/package.json new file mode 100644 index 00000000000000..584a81d1514bf8 --- /dev/null +++ b/tools/node_modules/@babel/plugin-syntax-class-properties/package.json @@ -0,0 +1,27 @@ +{ + "name": "@babel/plugin-syntax-class-properties", + "version": "7.12.1", + "description": "Allow parsing of class properties", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "packages/babel-plugin-syntax-class-properties" + }, + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "main": "lib/index.js", + "keywords": [ + "babel-plugin" + ], + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + }, + "devDependencies": { + "@babel/core": "^7.12.1" + } +} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/README.md b/tools/node_modules/babel-eslint/README.md deleted file mode 100644 index 6a4f9085e3ac5b..00000000000000 --- a/tools/node_modules/babel-eslint/README.md +++ /dev/null @@ -1,103 +0,0 @@ -# babel-eslint [![npm](https://img.shields.io/npm/v/babel-eslint.svg)](https://www.npmjs.com/package/babel-eslint) [![travis](https://img.shields.io/travis/babel/babel-eslint/master.svg)](https://travis-ci.org/babel/babel-eslint) [![npm-downloads](https://img.shields.io/npm/dm/babel-eslint.svg)](https://www.npmjs.com/package/babel-eslint) - -**babel-eslint** allows you to lint **ALL** valid Babel code with the fantastic -[ESLint](https://github.com/eslint/eslint). - -### Why Use babel-eslint - -You only need to use babel-eslint if you are using types (Flow) or experimental features not supported in ESLint itself yet. Otherwise try the default parser (you don't have to use it just because you are using Babel). - ---- - -> If there is an issue, first check if it can be reproduced with the regular parser or with the latest versions of `eslint` and `babel-eslint`! - -For questions and support please visit the [`#discussion`](https://babeljs.slack.com/messages/discussion/) babel slack channel (sign up [here](https://github.com/babel/notes/issues/38)) or eslint [gitter](https://gitter.im/eslint/eslint)! - -> Note that the `ecmaFeatures` config property may still be required for ESLint to work properly with features not in ECMAScript 5 by default. Examples are `globalReturn` and `modules`). - -## Known Issues - -Flow: -> Check out [eslint-plugin-flowtype](https://github.com/gajus/eslint-plugin-flowtype): An `eslint` plugin that makes flow type annotations global variables and marks declarations as used. Solves the problem of false positives with `no-undef` and `no-unused-vars`. -- `no-undef` for global flow types: `ReactElement`, `ReactClass` [#130](https://github.com/babel/babel-eslint/issues/130#issuecomment-111215076) - - Workaround: define types as globals in `.eslintrc` or define types and import them `import type ReactElement from './types'` -- `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/babel-eslint/issues/132#issuecomment-112815926) - -Modules/strict mode -- `no-unused-vars: [2, {vars: local}]` [#136](https://github.com/babel/babel-eslint/issues/136) - -Please check out [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for React/JSX issues -- `no-unused-vars` with jsx - -Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for other issues - -## How does it work? - -ESLint allows custom parsers. This is great but some of the syntax nodes that Babel supports -aren't supported by ESLint. When using this plugin, ESLint is monkeypatched and your code is -transformed into code that ESLint can understand. All location info such as line numbers, -columns is also retained so you can track down errors with ease. - -Basically `babel-eslint` exports an [`index.js`](/index.js) that a linter can use. -It just needs to export a `parse` method that takes in a string of code and outputs an AST. - -## Usage - -### Supported ESLint versions - -ESLint | babel-eslint ------------- | ------------- -4.x | >= 6.x -3.x | >= 6.x -2.x | >= 6.x -1.x | >= 5.x - -### Install - -Ensure that you have substituted the correct version lock for `eslint` and `babel-eslint` into this command: - -```sh -$ npm install eslint@4.x babel-eslint@8 --save-dev -# or -$ yarn add eslint@4.x babel-eslint@8 -D -``` - -### Setup - -**.eslintrc** - -```json -{ - "parser": "babel-eslint", - "rules": { - "strict": 0 - } -} -``` - -Check out the [ESLint docs](http://eslint.org/docs/rules/) for all possible rules. - -### Configuration - -- `sourceType` can be set to `'module'`(default) or `'script'` if your code isn't using ECMAScript modules. -- `allowImportExportEverywhere` (default `false`) can be set to `true` to allow import and export declarations to appear anywhere a statement is allowed if your build environment supports that. Otherwise import and export declarations can only appear at a program's top level. -- `codeFrame` (default `true`) can be set to `false` to disable the code frame in the reporter. This is useful since some eslint formatters don't play well with it. - -**.eslintrc** - -```json -{ - "parser": "babel-eslint", - "parserOptions": { - "sourceType": "module", - "allowImportExportEverywhere": false, - "codeFrame": true - } -} -``` - -### Run - -```sh -$ eslint your-files-here -``` diff --git a/tools/node_modules/babel-eslint/lib/babylon-to-espree/attachComments.js b/tools/node_modules/babel-eslint/lib/babylon-to-espree/attachComments.js deleted file mode 100644 index 8c608a45ad9473..00000000000000 --- a/tools/node_modules/babel-eslint/lib/babylon-to-espree/attachComments.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; - -// comment fixes -module.exports = function(ast, comments, tokens) { - if (comments.length) { - var firstComment = comments[0]; - var lastComment = comments[comments.length - 1]; - // fixup program start - if (!tokens.length) { - // if no tokens, the program starts at the end of the last comment - ast.start = lastComment.end; - ast.loc.start.line = lastComment.loc.end.line; - ast.loc.start.column = lastComment.loc.end.column; - - if (ast.leadingComments === null && ast.innerComments.length) { - ast.leadingComments = ast.innerComments; - } - } else if (firstComment.start < tokens[0].start) { - // if there are comments before the first token, the program starts at the first token - var token = tokens[0]; - // ast.start = token.start; - // ast.loc.start.line = token.loc.start.line; - // ast.loc.start.column = token.loc.start.column; - - // estraverse do not put leading comments on first node when the comment - // appear before the first token - if (ast.body.length) { - var node = ast.body[0]; - node.leadingComments = []; - var firstTokenStart = token.start; - var len = comments.length; - for (var i = 0; i < len && comments[i].start < firstTokenStart; i++) { - node.leadingComments.push(comments[i]); - } - } - } - // fixup program end - if (tokens.length) { - var lastToken = tokens[tokens.length - 1]; - if (lastComment.end > lastToken.end) { - // If there is a comment after the last token, the program ends at the - // last token and not the comment - // ast.end = lastToken.end; - ast.range[1] = lastToken.end; - ast.loc.end.line = lastToken.loc.end.line; - ast.loc.end.column = lastToken.loc.end.column; - } - } - } else { - if (!tokens.length) { - ast.loc.start.line = 1; - ast.loc.end.line = 1; - } - } - if (ast.body && ast.body.length > 0) { - ast.loc.start.line = ast.body[0].loc.start.line; - ast.range[0] = ast.body[0].start; - } -}; diff --git a/tools/node_modules/babel-eslint/lib/babylon-to-espree/convertTemplateType.js b/tools/node_modules/babel-eslint/lib/babylon-to-espree/convertTemplateType.js deleted file mode 100644 index accde61e56d6a9..00000000000000 --- a/tools/node_modules/babel-eslint/lib/babylon-to-espree/convertTemplateType.js +++ /dev/null @@ -1,92 +0,0 @@ -"use strict"; - -module.exports = function(tokens, tt) { - let curlyBrace = null; - let templateTokens = []; - const result = []; - - function addTemplateType() { - const start = templateTokens[0]; - const end = templateTokens[templateTokens.length - 1]; - - const value = templateTokens.reduce((result, token) => { - if (token.value) { - result += token.value; - } else if (token.type !== tt.template) { - result += token.type.label; - } - - return result; - }, ""); - - result.push({ - type: "Template", - value: value, - start: start.start, - end: end.end, - loc: { - start: start.loc.start, - end: end.loc.end, - }, - }); - - templateTokens = []; - } - - tokens.forEach(token => { - switch (token.type) { - case tt.backQuote: - if (curlyBrace) { - result.push(curlyBrace); - curlyBrace = null; - } - - templateTokens.push(token); - - if (templateTokens.length > 1) { - addTemplateType(); - } - - break; - - case tt.dollarBraceL: - templateTokens.push(token); - addTemplateType(); - break; - - case tt.braceR: - if (curlyBrace) { - result.push(curlyBrace); - } - - curlyBrace = token; - break; - - case tt.template: - if (curlyBrace) { - templateTokens.push(curlyBrace); - curlyBrace = null; - } - - templateTokens.push(token); - break; - - case tt.eof: - if (curlyBrace) { - result.push(curlyBrace); - } - - break; - - default: - if (curlyBrace) { - result.push(curlyBrace); - curlyBrace = null; - } - - result.push(token); - } - }); - - return result; -}; diff --git a/tools/node_modules/babel-eslint/lib/babylon-to-espree/index.js b/tools/node_modules/babel-eslint/lib/babylon-to-espree/index.js deleted file mode 100644 index 6d6e12bfc08686..00000000000000 --- a/tools/node_modules/babel-eslint/lib/babylon-to-espree/index.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -var attachComments = require("./attachComments"); -var convertComments = require("./convertComments"); -var toTokens = require("./toTokens"); -var toAST = require("./toAST"); - -module.exports = function(ast, traverse, tt, code) { - // convert tokens - ast.tokens = toTokens(ast.tokens, tt, code); - - // add comments - convertComments(ast.comments); - - // transform esprima and acorn divergent nodes - toAST(ast, traverse, code); - - // ast.program.tokens = ast.tokens; - // ast.program.comments = ast.comments; - // ast = ast.program; - - // remove File - ast.type = "Program"; - ast.sourceType = ast.program.sourceType; - ast.directives = ast.program.directives; - ast.body = ast.program.body; - delete ast.program; - - attachComments(ast, ast.comments, ast.tokens); -}; diff --git a/tools/node_modules/babel-eslint/lib/babylon-to-espree/toAST.js b/tools/node_modules/babel-eslint/lib/babylon-to-espree/toAST.js deleted file mode 100644 index b3da41f0cb0663..00000000000000 --- a/tools/node_modules/babel-eslint/lib/babylon-to-espree/toAST.js +++ /dev/null @@ -1,118 +0,0 @@ -"use strict"; - -var t = require("@babel/types"); -var convertComments = require("./convertComments"); - -module.exports = function(ast, traverse, code) { - var state = { source: code }; - - // Monkey patch visitor keys in order to be able to traverse the estree nodes - t.VISITOR_KEYS.Property = t.VISITOR_KEYS.ObjectProperty; - t.VISITOR_KEYS.MethodDefinition = [ - "key", - "value", - "decorators", - "returnType", - "typeParameters", - ]; - - traverse(ast, astTransformVisitor, null, state); - - delete t.VISITOR_KEYS.Property; - delete t.VISITOR_KEYS.MethodDefinition; -}; - -var astTransformVisitor = { - noScope: true, - enter(path) { - var node = path.node; - - // private var to track original node type - node._babelType = node.type; - - if (node.innerComments) { - node.trailingComments = node.innerComments; - delete node.innerComments; - } - - if (node.trailingComments) { - convertComments(node.trailingComments); - } - - if (node.leadingComments) { - convertComments(node.leadingComments); - } - }, - exit(path) { - var node = path.node; - - if (path.isJSXText()) { - node.type = "Literal"; - } - - if ( - path.isRestElement() && - path.parent && - path.parent.type === "ObjectPattern" - ) { - node.type = "ExperimentalRestProperty"; - } - - if ( - path.isSpreadElement() && - path.parent && - path.parent.type === "ObjectExpression" - ) { - node.type = "ExperimentalSpreadProperty"; - } - - if (path.isTypeParameter()) { - node.type = "Identifier"; - node.typeAnnotation = node.bound; - delete node.bound; - } - - // flow: prevent "no-undef" - // for "Component" in: "let x: React.Component" - if (path.isQualifiedTypeIdentifier()) { - delete node.id; - } - // for "b" in: "var a: { b: Foo }" - if (path.isObjectTypeProperty()) { - delete node.key; - } - // for "indexer" in: "var a: {[indexer: string]: number}" - if (path.isObjectTypeIndexer()) { - delete node.id; - } - // for "param" in: "var a: { func(param: Foo): Bar };" - if (path.isFunctionTypeParam()) { - delete node.name; - } - - // modules - - if (path.isImportDeclaration()) { - delete node.isType; - } - - // template string range fixes - if (path.isTemplateLiteral()) { - for (var j = 0; j < node.quasis.length; j++) { - var q = node.quasis[j]; - q.range[0] -= 1; - if (q.tail) { - q.range[1] += 1; - } else { - q.range[1] += 2; - } - q.loc.start.column -= 1; - if (q.tail) { - q.loc.end.column += 1; - } else { - q.loc.end.column += 2; - } - } - } - }, -}; diff --git a/tools/node_modules/babel-eslint/lib/babylon-to-espree/toToken.js b/tools/node_modules/babel-eslint/lib/babylon-to-espree/toToken.js deleted file mode 100644 index 44c73529a11159..00000000000000 --- a/tools/node_modules/babel-eslint/lib/babylon-to-espree/toToken.js +++ /dev/null @@ -1,84 +0,0 @@ -"use strict"; - -module.exports = function(token, tt, source) { - var type = token.type; - token.range = [token.start, token.end]; - - if (type === tt.name) { - token.type = "Identifier"; - } else if ( - type === tt.semi || - type === tt.comma || - type === tt.parenL || - type === tt.parenR || - type === tt.braceL || - type === tt.braceR || - type === tt.slash || - type === tt.dot || - type === tt.bracketL || - type === tt.bracketR || - type === tt.ellipsis || - type === tt.arrow || - type === tt.pipeline || - type === tt.star || - type === tt.incDec || - type === tt.colon || - type === tt.question || - type === tt.questionDot || - type === tt.template || - type === tt.backQuote || - type === tt.dollarBraceL || - type === tt.at || - type === tt.logicalOR || - type === tt.logicalAND || - type === tt.nullishCoalescing || - type === tt.bitwiseOR || - type === tt.bitwiseXOR || - type === tt.bitwiseAND || - type === tt.equality || - type === tt.relational || - type === tt.bitShift || - type === tt.plusMin || - type === tt.modulo || - type === tt.exponent || - type === tt.bang || - type === tt.tilde || - type === tt.doubleColon || - type.isAssign - ) { - token.type = "Punctuator"; - if (!token.value) token.value = type.label; - } else if (type === tt.jsxTagStart) { - token.type = "Punctuator"; - token.value = "<"; - } else if (type === tt.jsxTagEnd) { - token.type = "Punctuator"; - token.value = ">"; - } else if (type === tt.jsxName) { - token.type = "JSXIdentifier"; - } else if (type === tt.jsxText) { - token.type = "JSXText"; - } else if (type.keyword === "null") { - token.type = "Null"; - } else if (type.keyword === "false" || type.keyword === "true") { - token.type = "Boolean"; - } else if (type.keyword) { - token.type = "Keyword"; - } else if (type === tt.num) { - token.type = "Numeric"; - token.value = source.slice(token.start, token.end); - } else if (type === tt.string) { - token.type = "String"; - token.value = source.slice(token.start, token.end); - } else if (type === tt.regexp) { - token.type = "RegularExpression"; - var value = token.value; - token.regex = { - pattern: value.pattern, - flags: value.flags, - }; - token.value = `/${value.pattern}/${value.flags}`; - } - - return token; -}; diff --git a/tools/node_modules/babel-eslint/lib/babylon-to-espree/toTokens.js b/tools/node_modules/babel-eslint/lib/babylon-to-espree/toTokens.js deleted file mode 100644 index bb30819bacf717..00000000000000 --- a/tools/node_modules/babel-eslint/lib/babylon-to-espree/toTokens.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -var convertTemplateType = require("./convertTemplateType"); -var toToken = require("./toToken"); - -module.exports = function(tokens, tt, code) { - return convertTemplateType(tokens, tt) - .filter(t => t.type !== "CommentLine" && t.type !== "CommentBlock") - .map(t => toToken(t, tt, code)); -}; diff --git a/tools/node_modules/babel-eslint/lib/index.js b/tools/node_modules/babel-eslint/lib/index.js deleted file mode 100644 index 9e527d26d7f8ce..00000000000000 --- a/tools/node_modules/babel-eslint/lib/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; - -exports.parse = function(code, options) { - return exports.parseForESLint(code, options).ast; -}; - -exports.parseForESLint = function(code, options) { - options = options || {}; - options.ecmaVersion = options.ecmaVersion || 2018; - options.sourceType = options.sourceType || "module"; - options.allowImportExportEverywhere = - options.allowImportExportEverywhere || false; - - return require("./parse-with-scope")(code, options); -}; - -exports.parseNoPatch = function(code, options) { - return require("./parse")(code, options); -}; diff --git a/tools/node_modules/babel-eslint/lib/parse-with-scope.js b/tools/node_modules/babel-eslint/lib/parse-with-scope.js deleted file mode 100644 index 36e3fce5b06712..00000000000000 --- a/tools/node_modules/babel-eslint/lib/parse-with-scope.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -const visitorKeys = require("./visitor-keys"); -const analyzeScope = require("./analyze-scope"); -const parse = require("./parse"); - -module.exports = function(code, options) { - const ast = parse(code, options); - const scopeManager = analyzeScope(ast, options); - - return { ast, scopeManager, visitorKeys }; -}; diff --git a/tools/node_modules/babel-eslint/lib/parse.js b/tools/node_modules/babel-eslint/lib/parse.js deleted file mode 100644 index b23b9dc9fc75f0..00000000000000 --- a/tools/node_modules/babel-eslint/lib/parse.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; - -var babylonToEspree = require("./babylon-to-espree"); -var parse = require("@babel/parser").parse; -var tt = require("@babel/parser").tokTypes; -var traverse = require("@babel/traverse").default; -var codeFrameColumns = require("@babel/code-frame").codeFrameColumns; - -module.exports = function(code, options) { - const legacyDecorators = - options.ecmaFeatures && options.ecmaFeatures.legacyDecorators; - - var opts = { - codeFrame: options.hasOwnProperty("codeFrame") ? options.codeFrame : true, - sourceType: options.sourceType, - allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree - allowReturnOutsideFunction: true, - allowSuperOutsideMethod: true, - ranges: true, - tokens: true, - plugins: [ - ["flow", { all: true }], - "jsx", - "estree", - "asyncFunctions", - "asyncGenerators", - "classConstructorCall", - "classProperties", - legacyDecorators - ? "decorators-legacy" - : ["decorators", { decoratorsBeforeExport: false }], - "doExpressions", - "exponentiationOperator", - "exportDefaultFrom", - "exportNamespaceFrom", - "functionBind", - "functionSent", - "objectRestSpread", - "trailingFunctionCommas", - "dynamicImport", - "numericSeparator", - "optionalChaining", - "importMeta", - "classPrivateProperties", - "bigInt", - "optionalCatchBinding", - "throwExpressions", - ["pipelineOperator", { proposal: "minimal" }], - "nullishCoalescingOperator", - "logicalAssignment", - ], - }; - - var ast; - try { - ast = parse(code, opts); - } catch (err) { - if (err instanceof SyntaxError) { - err.lineNumber = err.loc.line; - err.column = err.loc.column; - - if (opts.codeFrame) { - err.lineNumber = err.loc.line; - err.column = err.loc.column + 1; - - // remove trailing "(LINE:COLUMN)" acorn message and add in esprima syntax error message start - err.message = - "Line " + - err.lineNumber + - ": " + - err.message.replace(/ \((\d+):(\d+)\)$/, "") + - // add codeframe - "\n\n" + - codeFrameColumns( - code, - { - start: { - line: err.lineNumber, - column: err.column, - }, - }, - { highlightCode: true } - ); - } - } - - throw err; - } - - babylonToEspree(ast, traverse, tt, code); - - return ast; -}; diff --git a/tools/node_modules/babel-eslint/lib/require-from-eslint.js b/tools/node_modules/babel-eslint/lib/require-from-eslint.js deleted file mode 100644 index 3834689f54bde4..00000000000000 --- a/tools/node_modules/babel-eslint/lib/require-from-eslint.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const resolve = require("resolve"); -const eslintBase = require.resolve("eslint"); - -module.exports = function requireFromESLint(id) { - const path = resolve.sync(id, { basedir: eslintBase }); - return require(path); -}; diff --git a/tools/node_modules/babel-eslint/lib/visitor-keys.js b/tools/node_modules/babel-eslint/lib/visitor-keys.js deleted file mode 100644 index 921a0bb0165749..00000000000000 --- a/tools/node_modules/babel-eslint/lib/visitor-keys.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -const BABEL_VISITOR_KEYS = require("@babel/types").VISITOR_KEYS; -const ESLINT_VISITOR_KEYS = require("eslint-visitor-keys").KEYS; - -module.exports = Object.assign( - { - Literal: ESLINT_VISITOR_KEYS.Literal, - MethodDefinition: ["decorators"].concat( - ESLINT_VISITOR_KEYS.MethodDefinition - ), - Property: ["decorators"].concat(ESLINT_VISITOR_KEYS.Property), - }, - BABEL_VISITOR_KEYS -); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/generator/README.md b/tools/node_modules/babel-eslint/node_modules/@babel/generator/README.md deleted file mode 100644 index fc980b167d1513..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/generator/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/generator - -> Turns an AST into code. - -See our website [@babel/generator](https://babeljs.io/docs/en/next/babel-generator.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20generator%22+is%3Aopen) associated with this package. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/generator -``` - -or using yarn: - -```sh -yarn add @babel/generator --dev -``` diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/generator/lib/node/parentheses.js b/tools/node_modules/babel-eslint/node_modules/@babel/generator/lib/node/parentheses.js deleted file mode 100644 index 3f98dc18f8e3ab..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/generator/lib/node/parentheses.js +++ /dev/null @@ -1,253 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.NullableTypeAnnotation = NullableTypeAnnotation; -exports.FunctionTypeAnnotation = FunctionTypeAnnotation; -exports.UpdateExpression = UpdateExpression; -exports.ObjectExpression = ObjectExpression; -exports.DoExpression = DoExpression; -exports.Binary = Binary; -exports.IntersectionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation; -exports.TSAsExpression = TSAsExpression; -exports.TSTypeAssertion = TSTypeAssertion; -exports.TSIntersectionType = exports.TSUnionType = TSUnionType; -exports.BinaryExpression = BinaryExpression; -exports.SequenceExpression = SequenceExpression; -exports.AwaitExpression = exports.YieldExpression = YieldExpression; -exports.ClassExpression = ClassExpression; -exports.UnaryLike = UnaryLike; -exports.FunctionExpression = FunctionExpression; -exports.ArrowFunctionExpression = ArrowFunctionExpression; -exports.ConditionalExpression = ConditionalExpression; -exports.OptionalMemberExpression = OptionalMemberExpression; -exports.AssignmentExpression = AssignmentExpression; -exports.NewExpression = NewExpression; - -function t() { - const data = _interopRequireWildcard(require("@babel/types")); - - t = function () { - return data; - }; - - return data; -} - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } - -const PRECEDENCE = { - "||": 0, - "&&": 1, - "|": 2, - "^": 3, - "&": 4, - "==": 5, - "===": 5, - "!=": 5, - "!==": 5, - "<": 6, - ">": 6, - "<=": 6, - ">=": 6, - in: 6, - instanceof: 6, - ">>": 7, - "<<": 7, - ">>>": 7, - "+": 8, - "-": 8, - "*": 9, - "/": 9, - "%": 9, - "**": 10 -}; - -const isClassExtendsClause = (node, parent) => (t().isClassDeclaration(parent) || t().isClassExpression(parent)) && parent.superClass === node; - -function NullableTypeAnnotation(node, parent) { - return t().isArrayTypeAnnotation(parent); -} - -function FunctionTypeAnnotation(node, parent) { - return t().isUnionTypeAnnotation(parent) || t().isIntersectionTypeAnnotation(parent) || t().isArrayTypeAnnotation(parent); -} - -function UpdateExpression(node, parent) { - return t().isMemberExpression(parent, { - object: node - }) || t().isCallExpression(parent, { - callee: node - }) || t().isNewExpression(parent, { - callee: node - }) || isClassExtendsClause(node, parent); -} - -function ObjectExpression(node, parent, printStack) { - return isFirstInStatement(printStack, { - considerArrow: true - }); -} - -function DoExpression(node, parent, printStack) { - return isFirstInStatement(printStack); -} - -function Binary(node, parent) { - if (node.operator === "**" && t().isBinaryExpression(parent, { - operator: "**" - })) { - return parent.left === node; - } - - if (isClassExtendsClause(node, parent)) { - return true; - } - - if ((t().isCallExpression(parent) || t().isNewExpression(parent)) && parent.callee === node || t().isUnaryLike(parent) || t().isMemberExpression(parent) && parent.object === node || t().isAwaitExpression(parent)) { - return true; - } - - if (t().isBinary(parent)) { - const parentOp = parent.operator; - const parentPos = PRECEDENCE[parentOp]; - const nodeOp = node.operator; - const nodePos = PRECEDENCE[nodeOp]; - - if (parentPos === nodePos && parent.right === node && !t().isLogicalExpression(parent) || parentPos > nodePos) { - return true; - } - } - - return false; -} - -function UnionTypeAnnotation(node, parent) { - return t().isArrayTypeAnnotation(parent) || t().isNullableTypeAnnotation(parent) || t().isIntersectionTypeAnnotation(parent) || t().isUnionTypeAnnotation(parent); -} - -function TSAsExpression() { - return true; -} - -function TSTypeAssertion() { - return true; -} - -function TSUnionType(node, parent) { - return t().isTSArrayType(parent) || t().isTSOptionalType(parent) || t().isTSIntersectionType(parent) || t().isTSUnionType(parent) || t().isTSRestType(parent); -} - -function BinaryExpression(node, parent) { - return node.operator === "in" && (t().isVariableDeclarator(parent) || t().isFor(parent)); -} - -function SequenceExpression(node, parent) { - if (t().isForStatement(parent) || t().isThrowStatement(parent) || t().isReturnStatement(parent) || t().isIfStatement(parent) && parent.test === node || t().isWhileStatement(parent) && parent.test === node || t().isForInStatement(parent) && parent.right === node || t().isSwitchStatement(parent) && parent.discriminant === node || t().isExpressionStatement(parent) && parent.expression === node) { - return false; - } - - return true; -} - -function YieldExpression(node, parent) { - return t().isBinary(parent) || t().isUnaryLike(parent) || t().isCallExpression(parent) || t().isMemberExpression(parent) || t().isNewExpression(parent) || t().isAwaitExpression(parent) && t().isYieldExpression(node) || t().isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent); -} - -function ClassExpression(node, parent, printStack) { - return isFirstInStatement(printStack, { - considerDefaultExports: true - }); -} - -function UnaryLike(node, parent) { - return t().isMemberExpression(parent, { - object: node - }) || t().isCallExpression(parent, { - callee: node - }) || t().isNewExpression(parent, { - callee: node - }) || t().isBinaryExpression(parent, { - operator: "**", - left: node - }) || isClassExtendsClause(node, parent); -} - -function FunctionExpression(node, parent, printStack) { - return isFirstInStatement(printStack, { - considerDefaultExports: true - }); -} - -function ArrowFunctionExpression(node, parent) { - return t().isExportDeclaration(parent) || ConditionalExpression(node, parent); -} - -function ConditionalExpression(node, parent) { - if (t().isUnaryLike(parent) || t().isBinary(parent) || t().isConditionalExpression(parent, { - test: node - }) || t().isAwaitExpression(parent) || t().isOptionalMemberExpression(parent) || t().isTaggedTemplateExpression(parent) || t().isTSTypeAssertion(parent) || t().isTSAsExpression(parent)) { - return true; - } - - return UnaryLike(node, parent); -} - -function OptionalMemberExpression(node, parent) { - return t().isCallExpression(parent) || t().isMemberExpression(parent); -} - -function AssignmentExpression(node) { - if (t().isObjectPattern(node.left)) { - return true; - } else { - return ConditionalExpression(...arguments); - } -} - -function NewExpression(node, parent) { - return isClassExtendsClause(node, parent); -} - -function isFirstInStatement(printStack, { - considerArrow = false, - considerDefaultExports = false -} = {}) { - let i = printStack.length - 1; - let node = printStack[i]; - i--; - let parent = printStack[i]; - - while (i > 0) { - if (t().isExpressionStatement(parent, { - expression: node - }) || t().isTaggedTemplateExpression(parent) || considerDefaultExports && t().isExportDefaultDeclaration(parent, { - declaration: node - }) || considerArrow && t().isArrowFunctionExpression(parent, { - body: node - })) { - return true; - } - - if (t().isCallExpression(parent, { - callee: node - }) || t().isSequenceExpression(parent) && parent.expressions[0] === node || t().isMemberExpression(parent, { - object: node - }) || t().isConditional(parent, { - test: node - }) || t().isBinary(parent, { - left: node - }) || t().isAssignmentExpression(parent, { - left: node - })) { - node = parent; - i--; - parent = printStack[i]; - } else { - return false; - } - } - - return false; -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/generator/package.json b/tools/node_modules/babel-eslint/node_modules/@babel/generator/package.json deleted file mode 100644 index 6eca8973ea377b..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/generator/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "author": { - "name": "Sebastian McKenzie", - "email": "sebmck@gmail.com" - }, - "bundleDependencies": false, - "dependencies": { - "@babel/types": "^7.5.5", - "jsesc": "^2.5.1", - "lodash": "^4.17.13", - "source-map": "^0.5.0", - "trim-right": "^1.0.1" - }, - "deprecated": false, - "description": "Turns an AST into code.", - "devDependencies": { - "@babel/helper-fixtures": "^7.5.5", - "@babel/parser": "^7.5.5" - }, - "files": [ - "lib" - ], - "gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43", - "homepage": "https://babeljs.io/", - "license": "MIT", - "main": "lib/index.js", - "name": "@babel/generator", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "https://github.com/babel/babel/tree/master/packages/babel-generator" - }, - "version": "7.5.5" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/helper-function-name/package.json b/tools/node_modules/babel-eslint/node_modules/@babel/helper-function-name/package.json deleted file mode 100644 index dfed420aaecb16..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/helper-function-name/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "bundleDependencies": false, - "dependencies": { - "@babel/helper-get-function-arity": "^7.0.0", - "@babel/template": "^7.1.0", - "@babel/types": "^7.0.0" - }, - "deprecated": false, - "description": "Helper function to change the property 'name' of every function", - "license": "MIT", - "main": "lib/index.js", - "name": "@babel/helper-function-name", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "https://github.com/babel/babel/tree/master/packages/babel-helper-function-name" - }, - "version": "7.1.0" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/helper-get-function-arity/lib/index.js b/tools/node_modules/babel-eslint/node_modules/@babel/helper-get-function-arity/lib/index.js deleted file mode 100644 index 5723401db71236..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/helper-get-function-arity/lib/index.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _default; - -function t() { - const data = _interopRequireWildcard(require("@babel/types")); - - t = function () { - return data; - }; - - return data; -} - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } - -function _default(node) { - const params = node.params; - - for (let i = 0; i < params.length; i++) { - const param = params[i]; - - if (t().isAssignmentPattern(param) || t().isRestElement(param)) { - return i; - } - } - - return params.length; -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/helper-get-function-arity/package.json b/tools/node_modules/babel-eslint/node_modules/@babel/helper-get-function-arity/package.json deleted file mode 100644 index 49d2e854daecb8..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/helper-get-function-arity/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "bundleDependencies": false, - "dependencies": { - "@babel/types": "^7.0.0" - }, - "deprecated": false, - "description": "Helper function to get function arity", - "license": "MIT", - "main": "lib/index.js", - "name": "@babel/helper-get-function-arity", - "repository": { - "type": "git", - "url": "https://github.com/babel/babel/tree/master/packages/babel-helper-get-function-arity" - }, - "version": "7.0.0" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/helper-split-export-declaration/package.json b/tools/node_modules/babel-eslint/node_modules/@babel/helper-split-export-declaration/package.json deleted file mode 100644 index 8f3e0fdbd78168..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/helper-split-export-declaration/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "bundleDependencies": false, - "dependencies": { - "@babel/types": "^7.4.4" - }, - "deprecated": false, - "description": ">", - "gitHead": "2c88694388831b1e5b88e4bbed6781eb2be1edba", - "license": "MIT", - "main": "lib/index.js", - "name": "@babel/helper-split-export-declaration", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "https://github.com/babel/babel/tree/master/packages/babel-helper-split-export-declaration" - }, - "version": "7.4.4" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/parser/README.md b/tools/node_modules/babel-eslint/node_modules/@babel/parser/README.md deleted file mode 100644 index 65092a05347ea1..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/parser/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/parser - -> A JavaScript parser - -See our website [@babel/parser](https://babeljs.io/docs/en/next/babel-parser.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A+parser+%28babylon%29%22+is%3Aopen) associated with this package. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/parser -``` - -or using yarn: - -```sh -yarn add @babel/parser --dev -``` diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/parser/package.json b/tools/node_modules/babel-eslint/node_modules/@babel/parser/package.json deleted file mode 100644 index 4bfd8d41cb84c0..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/parser/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "author": { - "name": "Sebastian McKenzie", - "email": "sebmck@gmail.com" - }, - "bin": { - "parser": "./bin/babel-parser.js" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A JavaScript parser", - "devDependencies": { - "@babel/code-frame": "^7.5.5", - "@babel/helper-fixtures": "^7.5.5", - "charcodes": "^0.2.0", - "unicode-12.0.0": "^0.7.9" - }, - "engines": { - "node": ">=6.0.0" - }, - "files": [ - "bin", - "lib", - "typings" - ], - "gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43", - "homepage": "https://babeljs.io/", - "keywords": [ - "babel", - "javascript", - "parser", - "tc39", - "ecmascript", - "@babel/parser" - ], - "license": "MIT", - "main": "lib/index.js", - "name": "@babel/parser", - "publishConfig": { - "tag": "next" - }, - "repository": { - "type": "git", - "url": "https://github.com/babel/babel/tree/master/packages/babel-parser" - }, - "types": "typings/babel-parser.d.ts", - "version": "7.5.5" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/template/README.md b/tools/node_modules/babel-eslint/node_modules/@babel/template/README.md deleted file mode 100644 index cf8f944396f8ba..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/template/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/template - -> Generate an AST from a string template. - -See our website [@babel/template](https://babeljs.io/docs/en/next/babel-template.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20template%22+is%3Aopen) associated with this package. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/template -``` - -or using yarn: - -```sh -yarn add @babel/template --dev -``` diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/template/package.json b/tools/node_modules/babel-eslint/node_modules/@babel/template/package.json deleted file mode 100644 index 54bdfd6423342b..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/template/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "author": { - "name": "Sebastian McKenzie", - "email": "sebmck@gmail.com" - }, - "bundleDependencies": false, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.4.4", - "@babel/types": "^7.4.4" - }, - "deprecated": false, - "description": "Generate an AST from a string template.", - "gitHead": "2c88694388831b1e5b88e4bbed6781eb2be1edba", - "homepage": "https://babeljs.io/", - "license": "MIT", - "main": "lib/index.js", - "name": "@babel/template", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "https://github.com/babel/babel/tree/master/packages/babel-template" - }, - "version": "7.4.4" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/traverse/lib/path/comments.js b/tools/node_modules/babel-eslint/node_modules/@babel/traverse/lib/path/comments.js deleted file mode 100644 index 09ec514b91a2a4..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/traverse/lib/path/comments.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.shareCommentsWithSiblings = shareCommentsWithSiblings; -exports.addComment = addComment; -exports.addComments = addComments; - -function t() { - const data = _interopRequireWildcard(require("@babel/types")); - - t = function () { - return data; - }; - - return data; -} - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } - -function shareCommentsWithSiblings() { - if (typeof this.key === "string") return; - const node = this.node; - if (!node) return; - const trailing = node.trailingComments; - const leading = node.leadingComments; - if (!trailing && !leading) return; - const prev = this.getSibling(this.key - 1); - const next = this.getSibling(this.key + 1); - const hasPrev = Boolean(prev.node); - const hasNext = Boolean(next.node); - - if (hasPrev && hasNext) {} else if (hasPrev) { - prev.addComments("trailing", trailing); - } else if (hasNext) { - next.addComments("leading", leading); - } -} - -function addComment(type, content, line) { - t().addComment(this.node, type, content, line); -} - -function addComments(type, comments) { - t().addComments(this.node, type, comments); -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/traverse/lib/path/inference/index.js b/tools/node_modules/babel-eslint/node_modules/@babel/traverse/lib/path/inference/index.js deleted file mode 100644 index 80a77d08ae691c..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/traverse/lib/path/inference/index.js +++ /dev/null @@ -1,132 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getTypeAnnotation = getTypeAnnotation; -exports._getTypeAnnotation = _getTypeAnnotation; -exports.isBaseType = isBaseType; -exports.couldBeBaseType = couldBeBaseType; -exports.baseTypeStrictlyMatches = baseTypeStrictlyMatches; -exports.isGenericType = isGenericType; - -var inferers = _interopRequireWildcard(require("./inferers")); - -function t() { - const data = _interopRequireWildcard(require("@babel/types")); - - t = function () { - return data; - }; - - return data; -} - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } - -function getTypeAnnotation() { - if (this.typeAnnotation) return this.typeAnnotation; - let type = this._getTypeAnnotation() || t().anyTypeAnnotation(); - if (t().isTypeAnnotation(type)) type = type.typeAnnotation; - return this.typeAnnotation = type; -} - -function _getTypeAnnotation() { - const node = this.node; - - if (!node) { - if (this.key === "init" && this.parentPath.isVariableDeclarator()) { - const declar = this.parentPath.parentPath; - const declarParent = declar.parentPath; - - if (declar.key === "left" && declarParent.isForInStatement()) { - return t().stringTypeAnnotation(); - } - - if (declar.key === "left" && declarParent.isForOfStatement()) { - return t().anyTypeAnnotation(); - } - - return t().voidTypeAnnotation(); - } else { - return; - } - } - - if (node.typeAnnotation) { - return node.typeAnnotation; - } - - let inferer = inferers[node.type]; - - if (inferer) { - return inferer.call(this, node); - } - - inferer = inferers[this.parentPath.type]; - - if (inferer && inferer.validParent) { - return this.parentPath.getTypeAnnotation(); - } -} - -function isBaseType(baseName, soft) { - return _isBaseType(baseName, this.getTypeAnnotation(), soft); -} - -function _isBaseType(baseName, type, soft) { - if (baseName === "string") { - return t().isStringTypeAnnotation(type); - } else if (baseName === "number") { - return t().isNumberTypeAnnotation(type); - } else if (baseName === "boolean") { - return t().isBooleanTypeAnnotation(type); - } else if (baseName === "any") { - return t().isAnyTypeAnnotation(type); - } else if (baseName === "mixed") { - return t().isMixedTypeAnnotation(type); - } else if (baseName === "empty") { - return t().isEmptyTypeAnnotation(type); - } else if (baseName === "void") { - return t().isVoidTypeAnnotation(type); - } else { - if (soft) { - return false; - } else { - throw new Error(`Unknown base type ${baseName}`); - } - } -} - -function couldBeBaseType(name) { - const type = this.getTypeAnnotation(); - if (t().isAnyTypeAnnotation(type)) return true; - - if (t().isUnionTypeAnnotation(type)) { - for (const type2 of type.types) { - if (t().isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) { - return true; - } - } - - return false; - } else { - return _isBaseType(name, type, true); - } -} - -function baseTypeStrictlyMatches(right) { - const left = this.getTypeAnnotation(); - right = right.getTypeAnnotation(); - - if (!t().isAnyTypeAnnotation(left) && t().isFlowBaseAnnotation(left)) { - return right.type === left.type; - } -} - -function isGenericType(genericName) { - const type = this.getTypeAnnotation(); - return t().isGenericTypeAnnotation(type) && t().isIdentifier(type.id, { - name: genericName - }); -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/traverse/package.json b/tools/node_modules/babel-eslint/node_modules/@babel/traverse/package.json deleted file mode 100644 index f53af95bf56a7c..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/traverse/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "author": { - "name": "Sebastian McKenzie", - "email": "sebmck@gmail.com" - }, - "bundleDependencies": false, - "dependencies": { - "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.5.5", - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.4.4", - "@babel/parser": "^7.5.5", - "@babel/types": "^7.5.5", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.13" - }, - "deprecated": false, - "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", - "devDependencies": { - "@babel/helper-plugin-test-runner": "^7.0.0" - }, - "gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43", - "homepage": "https://babeljs.io/", - "license": "MIT", - "main": "lib/index.js", - "name": "@babel/traverse", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "https://github.com/babel/babel/tree/master/packages/babel-traverse" - }, - "version": "7.5.5" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/README.md b/tools/node_modules/babel-eslint/node_modules/@babel/types/README.md deleted file mode 100644 index 8d33374d3ba416..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/types - -> Babel Types is a Lodash-esque utility library for AST nodes - -See our website [@babel/types](https://babeljs.io/docs/en/next/babel-types.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20types%22+is%3Aopen) associated with this package. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/types -``` - -or using yarn: - -```sh -yarn add @babel/types --dev -``` diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/generated/index.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/generated/index.js deleted file mode 100644 index 06d0127d12981b..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/builders/generated/index.js +++ /dev/null @@ -1,1148 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.arrayExpression = exports.ArrayExpression = ArrayExpression; -exports.assignmentExpression = exports.AssignmentExpression = AssignmentExpression; -exports.binaryExpression = exports.BinaryExpression = BinaryExpression; -exports.interpreterDirective = exports.InterpreterDirective = InterpreterDirective; -exports.directive = exports.Directive = Directive; -exports.directiveLiteral = exports.DirectiveLiteral = DirectiveLiteral; -exports.blockStatement = exports.BlockStatement = BlockStatement; -exports.breakStatement = exports.BreakStatement = BreakStatement; -exports.callExpression = exports.CallExpression = CallExpression; -exports.catchClause = exports.CatchClause = CatchClause; -exports.conditionalExpression = exports.ConditionalExpression = ConditionalExpression; -exports.continueStatement = exports.ContinueStatement = ContinueStatement; -exports.debuggerStatement = exports.DebuggerStatement = DebuggerStatement; -exports.doWhileStatement = exports.DoWhileStatement = DoWhileStatement; -exports.emptyStatement = exports.EmptyStatement = EmptyStatement; -exports.expressionStatement = exports.ExpressionStatement = ExpressionStatement; -exports.file = exports.File = File; -exports.forInStatement = exports.ForInStatement = ForInStatement; -exports.forStatement = exports.ForStatement = ForStatement; -exports.functionDeclaration = exports.FunctionDeclaration = FunctionDeclaration; -exports.functionExpression = exports.FunctionExpression = FunctionExpression; -exports.identifier = exports.Identifier = Identifier; -exports.ifStatement = exports.IfStatement = IfStatement; -exports.labeledStatement = exports.LabeledStatement = LabeledStatement; -exports.stringLiteral = exports.StringLiteral = StringLiteral; -exports.numericLiteral = exports.NumericLiteral = NumericLiteral; -exports.nullLiteral = exports.NullLiteral = NullLiteral; -exports.booleanLiteral = exports.BooleanLiteral = BooleanLiteral; -exports.regExpLiteral = exports.RegExpLiteral = RegExpLiteral; -exports.logicalExpression = exports.LogicalExpression = LogicalExpression; -exports.memberExpression = exports.MemberExpression = MemberExpression; -exports.newExpression = exports.NewExpression = NewExpression; -exports.program = exports.Program = Program; -exports.objectExpression = exports.ObjectExpression = ObjectExpression; -exports.objectMethod = exports.ObjectMethod = ObjectMethod; -exports.objectProperty = exports.ObjectProperty = ObjectProperty; -exports.restElement = exports.RestElement = RestElement; -exports.returnStatement = exports.ReturnStatement = ReturnStatement; -exports.sequenceExpression = exports.SequenceExpression = SequenceExpression; -exports.parenthesizedExpression = exports.ParenthesizedExpression = ParenthesizedExpression; -exports.switchCase = exports.SwitchCase = SwitchCase; -exports.switchStatement = exports.SwitchStatement = SwitchStatement; -exports.thisExpression = exports.ThisExpression = ThisExpression; -exports.throwStatement = exports.ThrowStatement = ThrowStatement; -exports.tryStatement = exports.TryStatement = TryStatement; -exports.unaryExpression = exports.UnaryExpression = UnaryExpression; -exports.updateExpression = exports.UpdateExpression = UpdateExpression; -exports.variableDeclaration = exports.VariableDeclaration = VariableDeclaration; -exports.variableDeclarator = exports.VariableDeclarator = VariableDeclarator; -exports.whileStatement = exports.WhileStatement = WhileStatement; -exports.withStatement = exports.WithStatement = WithStatement; -exports.assignmentPattern = exports.AssignmentPattern = AssignmentPattern; -exports.arrayPattern = exports.ArrayPattern = ArrayPattern; -exports.arrowFunctionExpression = exports.ArrowFunctionExpression = ArrowFunctionExpression; -exports.classBody = exports.ClassBody = ClassBody; -exports.classDeclaration = exports.ClassDeclaration = ClassDeclaration; -exports.classExpression = exports.ClassExpression = ClassExpression; -exports.exportAllDeclaration = exports.ExportAllDeclaration = ExportAllDeclaration; -exports.exportDefaultDeclaration = exports.ExportDefaultDeclaration = ExportDefaultDeclaration; -exports.exportNamedDeclaration = exports.ExportNamedDeclaration = ExportNamedDeclaration; -exports.exportSpecifier = exports.ExportSpecifier = ExportSpecifier; -exports.forOfStatement = exports.ForOfStatement = ForOfStatement; -exports.importDeclaration = exports.ImportDeclaration = ImportDeclaration; -exports.importDefaultSpecifier = exports.ImportDefaultSpecifier = ImportDefaultSpecifier; -exports.importNamespaceSpecifier = exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier; -exports.importSpecifier = exports.ImportSpecifier = ImportSpecifier; -exports.metaProperty = exports.MetaProperty = MetaProperty; -exports.classMethod = exports.ClassMethod = ClassMethod; -exports.objectPattern = exports.ObjectPattern = ObjectPattern; -exports.spreadElement = exports.SpreadElement = SpreadElement; -exports.super = exports.Super = Super; -exports.taggedTemplateExpression = exports.TaggedTemplateExpression = TaggedTemplateExpression; -exports.templateElement = exports.TemplateElement = TemplateElement; -exports.templateLiteral = exports.TemplateLiteral = TemplateLiteral; -exports.yieldExpression = exports.YieldExpression = YieldExpression; -exports.anyTypeAnnotation = exports.AnyTypeAnnotation = AnyTypeAnnotation; -exports.arrayTypeAnnotation = exports.ArrayTypeAnnotation = ArrayTypeAnnotation; -exports.booleanTypeAnnotation = exports.BooleanTypeAnnotation = BooleanTypeAnnotation; -exports.booleanLiteralTypeAnnotation = exports.BooleanLiteralTypeAnnotation = BooleanLiteralTypeAnnotation; -exports.nullLiteralTypeAnnotation = exports.NullLiteralTypeAnnotation = NullLiteralTypeAnnotation; -exports.classImplements = exports.ClassImplements = ClassImplements; -exports.declareClass = exports.DeclareClass = DeclareClass; -exports.declareFunction = exports.DeclareFunction = DeclareFunction; -exports.declareInterface = exports.DeclareInterface = DeclareInterface; -exports.declareModule = exports.DeclareModule = DeclareModule; -exports.declareModuleExports = exports.DeclareModuleExports = DeclareModuleExports; -exports.declareTypeAlias = exports.DeclareTypeAlias = DeclareTypeAlias; -exports.declareOpaqueType = exports.DeclareOpaqueType = DeclareOpaqueType; -exports.declareVariable = exports.DeclareVariable = DeclareVariable; -exports.declareExportDeclaration = exports.DeclareExportDeclaration = DeclareExportDeclaration; -exports.declareExportAllDeclaration = exports.DeclareExportAllDeclaration = DeclareExportAllDeclaration; -exports.declaredPredicate = exports.DeclaredPredicate = DeclaredPredicate; -exports.existsTypeAnnotation = exports.ExistsTypeAnnotation = ExistsTypeAnnotation; -exports.functionTypeAnnotation = exports.FunctionTypeAnnotation = FunctionTypeAnnotation; -exports.functionTypeParam = exports.FunctionTypeParam = FunctionTypeParam; -exports.genericTypeAnnotation = exports.GenericTypeAnnotation = GenericTypeAnnotation; -exports.inferredPredicate = exports.InferredPredicate = InferredPredicate; -exports.interfaceExtends = exports.InterfaceExtends = InterfaceExtends; -exports.interfaceDeclaration = exports.InterfaceDeclaration = InterfaceDeclaration; -exports.interfaceTypeAnnotation = exports.InterfaceTypeAnnotation = InterfaceTypeAnnotation; -exports.intersectionTypeAnnotation = exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation; -exports.mixedTypeAnnotation = exports.MixedTypeAnnotation = MixedTypeAnnotation; -exports.emptyTypeAnnotation = exports.EmptyTypeAnnotation = EmptyTypeAnnotation; -exports.nullableTypeAnnotation = exports.NullableTypeAnnotation = NullableTypeAnnotation; -exports.numberLiteralTypeAnnotation = exports.NumberLiteralTypeAnnotation = NumberLiteralTypeAnnotation; -exports.numberTypeAnnotation = exports.NumberTypeAnnotation = NumberTypeAnnotation; -exports.objectTypeAnnotation = exports.ObjectTypeAnnotation = ObjectTypeAnnotation; -exports.objectTypeInternalSlot = exports.ObjectTypeInternalSlot = ObjectTypeInternalSlot; -exports.objectTypeCallProperty = exports.ObjectTypeCallProperty = ObjectTypeCallProperty; -exports.objectTypeIndexer = exports.ObjectTypeIndexer = ObjectTypeIndexer; -exports.objectTypeProperty = exports.ObjectTypeProperty = ObjectTypeProperty; -exports.objectTypeSpreadProperty = exports.ObjectTypeSpreadProperty = ObjectTypeSpreadProperty; -exports.opaqueType = exports.OpaqueType = OpaqueType; -exports.qualifiedTypeIdentifier = exports.QualifiedTypeIdentifier = QualifiedTypeIdentifier; -exports.stringLiteralTypeAnnotation = exports.StringLiteralTypeAnnotation = StringLiteralTypeAnnotation; -exports.stringTypeAnnotation = exports.StringTypeAnnotation = StringTypeAnnotation; -exports.thisTypeAnnotation = exports.ThisTypeAnnotation = ThisTypeAnnotation; -exports.tupleTypeAnnotation = exports.TupleTypeAnnotation = TupleTypeAnnotation; -exports.typeofTypeAnnotation = exports.TypeofTypeAnnotation = TypeofTypeAnnotation; -exports.typeAlias = exports.TypeAlias = TypeAlias; -exports.typeAnnotation = exports.TypeAnnotation = TypeAnnotation; -exports.typeCastExpression = exports.TypeCastExpression = TypeCastExpression; -exports.typeParameter = exports.TypeParameter = TypeParameter; -exports.typeParameterDeclaration = exports.TypeParameterDeclaration = TypeParameterDeclaration; -exports.typeParameterInstantiation = exports.TypeParameterInstantiation = TypeParameterInstantiation; -exports.unionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation; -exports.variance = exports.Variance = Variance; -exports.voidTypeAnnotation = exports.VoidTypeAnnotation = VoidTypeAnnotation; -exports.jSXAttribute = exports.jsxAttribute = exports.JSXAttribute = JSXAttribute; -exports.jSXClosingElement = exports.jsxClosingElement = exports.JSXClosingElement = JSXClosingElement; -exports.jSXElement = exports.jsxElement = exports.JSXElement = JSXElement; -exports.jSXEmptyExpression = exports.jsxEmptyExpression = exports.JSXEmptyExpression = JSXEmptyExpression; -exports.jSXExpressionContainer = exports.jsxExpressionContainer = exports.JSXExpressionContainer = JSXExpressionContainer; -exports.jSXSpreadChild = exports.jsxSpreadChild = exports.JSXSpreadChild = JSXSpreadChild; -exports.jSXIdentifier = exports.jsxIdentifier = exports.JSXIdentifier = JSXIdentifier; -exports.jSXMemberExpression = exports.jsxMemberExpression = exports.JSXMemberExpression = JSXMemberExpression; -exports.jSXNamespacedName = exports.jsxNamespacedName = exports.JSXNamespacedName = JSXNamespacedName; -exports.jSXOpeningElement = exports.jsxOpeningElement = exports.JSXOpeningElement = JSXOpeningElement; -exports.jSXSpreadAttribute = exports.jsxSpreadAttribute = exports.JSXSpreadAttribute = JSXSpreadAttribute; -exports.jSXText = exports.jsxText = exports.JSXText = JSXText; -exports.jSXFragment = exports.jsxFragment = exports.JSXFragment = JSXFragment; -exports.jSXOpeningFragment = exports.jsxOpeningFragment = exports.JSXOpeningFragment = JSXOpeningFragment; -exports.jSXClosingFragment = exports.jsxClosingFragment = exports.JSXClosingFragment = JSXClosingFragment; -exports.noop = exports.Noop = Noop; -exports.placeholder = exports.Placeholder = Placeholder; -exports.argumentPlaceholder = exports.ArgumentPlaceholder = ArgumentPlaceholder; -exports.awaitExpression = exports.AwaitExpression = AwaitExpression; -exports.bindExpression = exports.BindExpression = BindExpression; -exports.classProperty = exports.ClassProperty = ClassProperty; -exports.optionalMemberExpression = exports.OptionalMemberExpression = OptionalMemberExpression; -exports.pipelineTopicExpression = exports.PipelineTopicExpression = PipelineTopicExpression; -exports.pipelineBareFunction = exports.PipelineBareFunction = PipelineBareFunction; -exports.pipelinePrimaryTopicReference = exports.PipelinePrimaryTopicReference = PipelinePrimaryTopicReference; -exports.optionalCallExpression = exports.OptionalCallExpression = OptionalCallExpression; -exports.classPrivateProperty = exports.ClassPrivateProperty = ClassPrivateProperty; -exports.classPrivateMethod = exports.ClassPrivateMethod = ClassPrivateMethod; -exports.import = exports.Import = Import; -exports.decorator = exports.Decorator = Decorator; -exports.doExpression = exports.DoExpression = DoExpression; -exports.exportDefaultSpecifier = exports.ExportDefaultSpecifier = ExportDefaultSpecifier; -exports.exportNamespaceSpecifier = exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier; -exports.privateName = exports.PrivateName = PrivateName; -exports.bigIntLiteral = exports.BigIntLiteral = BigIntLiteral; -exports.tSParameterProperty = exports.tsParameterProperty = exports.TSParameterProperty = TSParameterProperty; -exports.tSDeclareFunction = exports.tsDeclareFunction = exports.TSDeclareFunction = TSDeclareFunction; -exports.tSDeclareMethod = exports.tsDeclareMethod = exports.TSDeclareMethod = TSDeclareMethod; -exports.tSQualifiedName = exports.tsQualifiedName = exports.TSQualifiedName = TSQualifiedName; -exports.tSCallSignatureDeclaration = exports.tsCallSignatureDeclaration = exports.TSCallSignatureDeclaration = TSCallSignatureDeclaration; -exports.tSConstructSignatureDeclaration = exports.tsConstructSignatureDeclaration = exports.TSConstructSignatureDeclaration = TSConstructSignatureDeclaration; -exports.tSPropertySignature = exports.tsPropertySignature = exports.TSPropertySignature = TSPropertySignature; -exports.tSMethodSignature = exports.tsMethodSignature = exports.TSMethodSignature = TSMethodSignature; -exports.tSIndexSignature = exports.tsIndexSignature = exports.TSIndexSignature = TSIndexSignature; -exports.tSAnyKeyword = exports.tsAnyKeyword = exports.TSAnyKeyword = TSAnyKeyword; -exports.tSUnknownKeyword = exports.tsUnknownKeyword = exports.TSUnknownKeyword = TSUnknownKeyword; -exports.tSNumberKeyword = exports.tsNumberKeyword = exports.TSNumberKeyword = TSNumberKeyword; -exports.tSObjectKeyword = exports.tsObjectKeyword = exports.TSObjectKeyword = TSObjectKeyword; -exports.tSBooleanKeyword = exports.tsBooleanKeyword = exports.TSBooleanKeyword = TSBooleanKeyword; -exports.tSStringKeyword = exports.tsStringKeyword = exports.TSStringKeyword = TSStringKeyword; -exports.tSSymbolKeyword = exports.tsSymbolKeyword = exports.TSSymbolKeyword = TSSymbolKeyword; -exports.tSVoidKeyword = exports.tsVoidKeyword = exports.TSVoidKeyword = TSVoidKeyword; -exports.tSUndefinedKeyword = exports.tsUndefinedKeyword = exports.TSUndefinedKeyword = TSUndefinedKeyword; -exports.tSNullKeyword = exports.tsNullKeyword = exports.TSNullKeyword = TSNullKeyword; -exports.tSNeverKeyword = exports.tsNeverKeyword = exports.TSNeverKeyword = TSNeverKeyword; -exports.tSThisType = exports.tsThisType = exports.TSThisType = TSThisType; -exports.tSFunctionType = exports.tsFunctionType = exports.TSFunctionType = TSFunctionType; -exports.tSConstructorType = exports.tsConstructorType = exports.TSConstructorType = TSConstructorType; -exports.tSTypeReference = exports.tsTypeReference = exports.TSTypeReference = TSTypeReference; -exports.tSTypePredicate = exports.tsTypePredicate = exports.TSTypePredicate = TSTypePredicate; -exports.tSTypeQuery = exports.tsTypeQuery = exports.TSTypeQuery = TSTypeQuery; -exports.tSTypeLiteral = exports.tsTypeLiteral = exports.TSTypeLiteral = TSTypeLiteral; -exports.tSArrayType = exports.tsArrayType = exports.TSArrayType = TSArrayType; -exports.tSTupleType = exports.tsTupleType = exports.TSTupleType = TSTupleType; -exports.tSOptionalType = exports.tsOptionalType = exports.TSOptionalType = TSOptionalType; -exports.tSRestType = exports.tsRestType = exports.TSRestType = TSRestType; -exports.tSUnionType = exports.tsUnionType = exports.TSUnionType = TSUnionType; -exports.tSIntersectionType = exports.tsIntersectionType = exports.TSIntersectionType = TSIntersectionType; -exports.tSConditionalType = exports.tsConditionalType = exports.TSConditionalType = TSConditionalType; -exports.tSInferType = exports.tsInferType = exports.TSInferType = TSInferType; -exports.tSParenthesizedType = exports.tsParenthesizedType = exports.TSParenthesizedType = TSParenthesizedType; -exports.tSTypeOperator = exports.tsTypeOperator = exports.TSTypeOperator = TSTypeOperator; -exports.tSIndexedAccessType = exports.tsIndexedAccessType = exports.TSIndexedAccessType = TSIndexedAccessType; -exports.tSMappedType = exports.tsMappedType = exports.TSMappedType = TSMappedType; -exports.tSLiteralType = exports.tsLiteralType = exports.TSLiteralType = TSLiteralType; -exports.tSExpressionWithTypeArguments = exports.tsExpressionWithTypeArguments = exports.TSExpressionWithTypeArguments = TSExpressionWithTypeArguments; -exports.tSInterfaceDeclaration = exports.tsInterfaceDeclaration = exports.TSInterfaceDeclaration = TSInterfaceDeclaration; -exports.tSInterfaceBody = exports.tsInterfaceBody = exports.TSInterfaceBody = TSInterfaceBody; -exports.tSTypeAliasDeclaration = exports.tsTypeAliasDeclaration = exports.TSTypeAliasDeclaration = TSTypeAliasDeclaration; -exports.tSAsExpression = exports.tsAsExpression = exports.TSAsExpression = TSAsExpression; -exports.tSTypeAssertion = exports.tsTypeAssertion = exports.TSTypeAssertion = TSTypeAssertion; -exports.tSEnumDeclaration = exports.tsEnumDeclaration = exports.TSEnumDeclaration = TSEnumDeclaration; -exports.tSEnumMember = exports.tsEnumMember = exports.TSEnumMember = TSEnumMember; -exports.tSModuleDeclaration = exports.tsModuleDeclaration = exports.TSModuleDeclaration = TSModuleDeclaration; -exports.tSModuleBlock = exports.tsModuleBlock = exports.TSModuleBlock = TSModuleBlock; -exports.tSImportType = exports.tsImportType = exports.TSImportType = TSImportType; -exports.tSImportEqualsDeclaration = exports.tsImportEqualsDeclaration = exports.TSImportEqualsDeclaration = TSImportEqualsDeclaration; -exports.tSExternalModuleReference = exports.tsExternalModuleReference = exports.TSExternalModuleReference = TSExternalModuleReference; -exports.tSNonNullExpression = exports.tsNonNullExpression = exports.TSNonNullExpression = TSNonNullExpression; -exports.tSExportAssignment = exports.tsExportAssignment = exports.TSExportAssignment = TSExportAssignment; -exports.tSNamespaceExportDeclaration = exports.tsNamespaceExportDeclaration = exports.TSNamespaceExportDeclaration = TSNamespaceExportDeclaration; -exports.tSTypeAnnotation = exports.tsTypeAnnotation = exports.TSTypeAnnotation = TSTypeAnnotation; -exports.tSTypeParameterInstantiation = exports.tsTypeParameterInstantiation = exports.TSTypeParameterInstantiation = TSTypeParameterInstantiation; -exports.tSTypeParameterDeclaration = exports.tsTypeParameterDeclaration = exports.TSTypeParameterDeclaration = TSTypeParameterDeclaration; -exports.tSTypeParameter = exports.tsTypeParameter = exports.TSTypeParameter = TSTypeParameter; -exports.numberLiteral = exports.NumberLiteral = NumberLiteral; -exports.regexLiteral = exports.RegexLiteral = RegexLiteral; -exports.restProperty = exports.RestProperty = RestProperty; -exports.spreadProperty = exports.SpreadProperty = SpreadProperty; - -var _builder = _interopRequireDefault(require("../builder")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function ArrayExpression(...args) { - return (0, _builder.default)("ArrayExpression", ...args); -} - -function AssignmentExpression(...args) { - return (0, _builder.default)("AssignmentExpression", ...args); -} - -function BinaryExpression(...args) { - return (0, _builder.default)("BinaryExpression", ...args); -} - -function InterpreterDirective(...args) { - return (0, _builder.default)("InterpreterDirective", ...args); -} - -function Directive(...args) { - return (0, _builder.default)("Directive", ...args); -} - -function DirectiveLiteral(...args) { - return (0, _builder.default)("DirectiveLiteral", ...args); -} - -function BlockStatement(...args) { - return (0, _builder.default)("BlockStatement", ...args); -} - -function BreakStatement(...args) { - return (0, _builder.default)("BreakStatement", ...args); -} - -function CallExpression(...args) { - return (0, _builder.default)("CallExpression", ...args); -} - -function CatchClause(...args) { - return (0, _builder.default)("CatchClause", ...args); -} - -function ConditionalExpression(...args) { - return (0, _builder.default)("ConditionalExpression", ...args); -} - -function ContinueStatement(...args) { - return (0, _builder.default)("ContinueStatement", ...args); -} - -function DebuggerStatement(...args) { - return (0, _builder.default)("DebuggerStatement", ...args); -} - -function DoWhileStatement(...args) { - return (0, _builder.default)("DoWhileStatement", ...args); -} - -function EmptyStatement(...args) { - return (0, _builder.default)("EmptyStatement", ...args); -} - -function ExpressionStatement(...args) { - return (0, _builder.default)("ExpressionStatement", ...args); -} - -function File(...args) { - return (0, _builder.default)("File", ...args); -} - -function ForInStatement(...args) { - return (0, _builder.default)("ForInStatement", ...args); -} - -function ForStatement(...args) { - return (0, _builder.default)("ForStatement", ...args); -} - -function FunctionDeclaration(...args) { - return (0, _builder.default)("FunctionDeclaration", ...args); -} - -function FunctionExpression(...args) { - return (0, _builder.default)("FunctionExpression", ...args); -} - -function Identifier(...args) { - return (0, _builder.default)("Identifier", ...args); -} - -function IfStatement(...args) { - return (0, _builder.default)("IfStatement", ...args); -} - -function LabeledStatement(...args) { - return (0, _builder.default)("LabeledStatement", ...args); -} - -function StringLiteral(...args) { - return (0, _builder.default)("StringLiteral", ...args); -} - -function NumericLiteral(...args) { - return (0, _builder.default)("NumericLiteral", ...args); -} - -function NullLiteral(...args) { - return (0, _builder.default)("NullLiteral", ...args); -} - -function BooleanLiteral(...args) { - return (0, _builder.default)("BooleanLiteral", ...args); -} - -function RegExpLiteral(...args) { - return (0, _builder.default)("RegExpLiteral", ...args); -} - -function LogicalExpression(...args) { - return (0, _builder.default)("LogicalExpression", ...args); -} - -function MemberExpression(...args) { - return (0, _builder.default)("MemberExpression", ...args); -} - -function NewExpression(...args) { - return (0, _builder.default)("NewExpression", ...args); -} - -function Program(...args) { - return (0, _builder.default)("Program", ...args); -} - -function ObjectExpression(...args) { - return (0, _builder.default)("ObjectExpression", ...args); -} - -function ObjectMethod(...args) { - return (0, _builder.default)("ObjectMethod", ...args); -} - -function ObjectProperty(...args) { - return (0, _builder.default)("ObjectProperty", ...args); -} - -function RestElement(...args) { - return (0, _builder.default)("RestElement", ...args); -} - -function ReturnStatement(...args) { - return (0, _builder.default)("ReturnStatement", ...args); -} - -function SequenceExpression(...args) { - return (0, _builder.default)("SequenceExpression", ...args); -} - -function ParenthesizedExpression(...args) { - return (0, _builder.default)("ParenthesizedExpression", ...args); -} - -function SwitchCase(...args) { - return (0, _builder.default)("SwitchCase", ...args); -} - -function SwitchStatement(...args) { - return (0, _builder.default)("SwitchStatement", ...args); -} - -function ThisExpression(...args) { - return (0, _builder.default)("ThisExpression", ...args); -} - -function ThrowStatement(...args) { - return (0, _builder.default)("ThrowStatement", ...args); -} - -function TryStatement(...args) { - return (0, _builder.default)("TryStatement", ...args); -} - -function UnaryExpression(...args) { - return (0, _builder.default)("UnaryExpression", ...args); -} - -function UpdateExpression(...args) { - return (0, _builder.default)("UpdateExpression", ...args); -} - -function VariableDeclaration(...args) { - return (0, _builder.default)("VariableDeclaration", ...args); -} - -function VariableDeclarator(...args) { - return (0, _builder.default)("VariableDeclarator", ...args); -} - -function WhileStatement(...args) { - return (0, _builder.default)("WhileStatement", ...args); -} - -function WithStatement(...args) { - return (0, _builder.default)("WithStatement", ...args); -} - -function AssignmentPattern(...args) { - return (0, _builder.default)("AssignmentPattern", ...args); -} - -function ArrayPattern(...args) { - return (0, _builder.default)("ArrayPattern", ...args); -} - -function ArrowFunctionExpression(...args) { - return (0, _builder.default)("ArrowFunctionExpression", ...args); -} - -function ClassBody(...args) { - return (0, _builder.default)("ClassBody", ...args); -} - -function ClassDeclaration(...args) { - return (0, _builder.default)("ClassDeclaration", ...args); -} - -function ClassExpression(...args) { - return (0, _builder.default)("ClassExpression", ...args); -} - -function ExportAllDeclaration(...args) { - return (0, _builder.default)("ExportAllDeclaration", ...args); -} - -function ExportDefaultDeclaration(...args) { - return (0, _builder.default)("ExportDefaultDeclaration", ...args); -} - -function ExportNamedDeclaration(...args) { - return (0, _builder.default)("ExportNamedDeclaration", ...args); -} - -function ExportSpecifier(...args) { - return (0, _builder.default)("ExportSpecifier", ...args); -} - -function ForOfStatement(...args) { - return (0, _builder.default)("ForOfStatement", ...args); -} - -function ImportDeclaration(...args) { - return (0, _builder.default)("ImportDeclaration", ...args); -} - -function ImportDefaultSpecifier(...args) { - return (0, _builder.default)("ImportDefaultSpecifier", ...args); -} - -function ImportNamespaceSpecifier(...args) { - return (0, _builder.default)("ImportNamespaceSpecifier", ...args); -} - -function ImportSpecifier(...args) { - return (0, _builder.default)("ImportSpecifier", ...args); -} - -function MetaProperty(...args) { - return (0, _builder.default)("MetaProperty", ...args); -} - -function ClassMethod(...args) { - return (0, _builder.default)("ClassMethod", ...args); -} - -function ObjectPattern(...args) { - return (0, _builder.default)("ObjectPattern", ...args); -} - -function SpreadElement(...args) { - return (0, _builder.default)("SpreadElement", ...args); -} - -function Super(...args) { - return (0, _builder.default)("Super", ...args); -} - -function TaggedTemplateExpression(...args) { - return (0, _builder.default)("TaggedTemplateExpression", ...args); -} - -function TemplateElement(...args) { - return (0, _builder.default)("TemplateElement", ...args); -} - -function TemplateLiteral(...args) { - return (0, _builder.default)("TemplateLiteral", ...args); -} - -function YieldExpression(...args) { - return (0, _builder.default)("YieldExpression", ...args); -} - -function AnyTypeAnnotation(...args) { - return (0, _builder.default)("AnyTypeAnnotation", ...args); -} - -function ArrayTypeAnnotation(...args) { - return (0, _builder.default)("ArrayTypeAnnotation", ...args); -} - -function BooleanTypeAnnotation(...args) { - return (0, _builder.default)("BooleanTypeAnnotation", ...args); -} - -function BooleanLiteralTypeAnnotation(...args) { - return (0, _builder.default)("BooleanLiteralTypeAnnotation", ...args); -} - -function NullLiteralTypeAnnotation(...args) { - return (0, _builder.default)("NullLiteralTypeAnnotation", ...args); -} - -function ClassImplements(...args) { - return (0, _builder.default)("ClassImplements", ...args); -} - -function DeclareClass(...args) { - return (0, _builder.default)("DeclareClass", ...args); -} - -function DeclareFunction(...args) { - return (0, _builder.default)("DeclareFunction", ...args); -} - -function DeclareInterface(...args) { - return (0, _builder.default)("DeclareInterface", ...args); -} - -function DeclareModule(...args) { - return (0, _builder.default)("DeclareModule", ...args); -} - -function DeclareModuleExports(...args) { - return (0, _builder.default)("DeclareModuleExports", ...args); -} - -function DeclareTypeAlias(...args) { - return (0, _builder.default)("DeclareTypeAlias", ...args); -} - -function DeclareOpaqueType(...args) { - return (0, _builder.default)("DeclareOpaqueType", ...args); -} - -function DeclareVariable(...args) { - return (0, _builder.default)("DeclareVariable", ...args); -} - -function DeclareExportDeclaration(...args) { - return (0, _builder.default)("DeclareExportDeclaration", ...args); -} - -function DeclareExportAllDeclaration(...args) { - return (0, _builder.default)("DeclareExportAllDeclaration", ...args); -} - -function DeclaredPredicate(...args) { - return (0, _builder.default)("DeclaredPredicate", ...args); -} - -function ExistsTypeAnnotation(...args) { - return (0, _builder.default)("ExistsTypeAnnotation", ...args); -} - -function FunctionTypeAnnotation(...args) { - return (0, _builder.default)("FunctionTypeAnnotation", ...args); -} - -function FunctionTypeParam(...args) { - return (0, _builder.default)("FunctionTypeParam", ...args); -} - -function GenericTypeAnnotation(...args) { - return (0, _builder.default)("GenericTypeAnnotation", ...args); -} - -function InferredPredicate(...args) { - return (0, _builder.default)("InferredPredicate", ...args); -} - -function InterfaceExtends(...args) { - return (0, _builder.default)("InterfaceExtends", ...args); -} - -function InterfaceDeclaration(...args) { - return (0, _builder.default)("InterfaceDeclaration", ...args); -} - -function InterfaceTypeAnnotation(...args) { - return (0, _builder.default)("InterfaceTypeAnnotation", ...args); -} - -function IntersectionTypeAnnotation(...args) { - return (0, _builder.default)("IntersectionTypeAnnotation", ...args); -} - -function MixedTypeAnnotation(...args) { - return (0, _builder.default)("MixedTypeAnnotation", ...args); -} - -function EmptyTypeAnnotation(...args) { - return (0, _builder.default)("EmptyTypeAnnotation", ...args); -} - -function NullableTypeAnnotation(...args) { - return (0, _builder.default)("NullableTypeAnnotation", ...args); -} - -function NumberLiteralTypeAnnotation(...args) { - return (0, _builder.default)("NumberLiteralTypeAnnotation", ...args); -} - -function NumberTypeAnnotation(...args) { - return (0, _builder.default)("NumberTypeAnnotation", ...args); -} - -function ObjectTypeAnnotation(...args) { - return (0, _builder.default)("ObjectTypeAnnotation", ...args); -} - -function ObjectTypeInternalSlot(...args) { - return (0, _builder.default)("ObjectTypeInternalSlot", ...args); -} - -function ObjectTypeCallProperty(...args) { - return (0, _builder.default)("ObjectTypeCallProperty", ...args); -} - -function ObjectTypeIndexer(...args) { - return (0, _builder.default)("ObjectTypeIndexer", ...args); -} - -function ObjectTypeProperty(...args) { - return (0, _builder.default)("ObjectTypeProperty", ...args); -} - -function ObjectTypeSpreadProperty(...args) { - return (0, _builder.default)("ObjectTypeSpreadProperty", ...args); -} - -function OpaqueType(...args) { - return (0, _builder.default)("OpaqueType", ...args); -} - -function QualifiedTypeIdentifier(...args) { - return (0, _builder.default)("QualifiedTypeIdentifier", ...args); -} - -function StringLiteralTypeAnnotation(...args) { - return (0, _builder.default)("StringLiteralTypeAnnotation", ...args); -} - -function StringTypeAnnotation(...args) { - return (0, _builder.default)("StringTypeAnnotation", ...args); -} - -function ThisTypeAnnotation(...args) { - return (0, _builder.default)("ThisTypeAnnotation", ...args); -} - -function TupleTypeAnnotation(...args) { - return (0, _builder.default)("TupleTypeAnnotation", ...args); -} - -function TypeofTypeAnnotation(...args) { - return (0, _builder.default)("TypeofTypeAnnotation", ...args); -} - -function TypeAlias(...args) { - return (0, _builder.default)("TypeAlias", ...args); -} - -function TypeAnnotation(...args) { - return (0, _builder.default)("TypeAnnotation", ...args); -} - -function TypeCastExpression(...args) { - return (0, _builder.default)("TypeCastExpression", ...args); -} - -function TypeParameter(...args) { - return (0, _builder.default)("TypeParameter", ...args); -} - -function TypeParameterDeclaration(...args) { - return (0, _builder.default)("TypeParameterDeclaration", ...args); -} - -function TypeParameterInstantiation(...args) { - return (0, _builder.default)("TypeParameterInstantiation", ...args); -} - -function UnionTypeAnnotation(...args) { - return (0, _builder.default)("UnionTypeAnnotation", ...args); -} - -function Variance(...args) { - return (0, _builder.default)("Variance", ...args); -} - -function VoidTypeAnnotation(...args) { - return (0, _builder.default)("VoidTypeAnnotation", ...args); -} - -function JSXAttribute(...args) { - return (0, _builder.default)("JSXAttribute", ...args); -} - -function JSXClosingElement(...args) { - return (0, _builder.default)("JSXClosingElement", ...args); -} - -function JSXElement(...args) { - return (0, _builder.default)("JSXElement", ...args); -} - -function JSXEmptyExpression(...args) { - return (0, _builder.default)("JSXEmptyExpression", ...args); -} - -function JSXExpressionContainer(...args) { - return (0, _builder.default)("JSXExpressionContainer", ...args); -} - -function JSXSpreadChild(...args) { - return (0, _builder.default)("JSXSpreadChild", ...args); -} - -function JSXIdentifier(...args) { - return (0, _builder.default)("JSXIdentifier", ...args); -} - -function JSXMemberExpression(...args) { - return (0, _builder.default)("JSXMemberExpression", ...args); -} - -function JSXNamespacedName(...args) { - return (0, _builder.default)("JSXNamespacedName", ...args); -} - -function JSXOpeningElement(...args) { - return (0, _builder.default)("JSXOpeningElement", ...args); -} - -function JSXSpreadAttribute(...args) { - return (0, _builder.default)("JSXSpreadAttribute", ...args); -} - -function JSXText(...args) { - return (0, _builder.default)("JSXText", ...args); -} - -function JSXFragment(...args) { - return (0, _builder.default)("JSXFragment", ...args); -} - -function JSXOpeningFragment(...args) { - return (0, _builder.default)("JSXOpeningFragment", ...args); -} - -function JSXClosingFragment(...args) { - return (0, _builder.default)("JSXClosingFragment", ...args); -} - -function Noop(...args) { - return (0, _builder.default)("Noop", ...args); -} - -function Placeholder(...args) { - return (0, _builder.default)("Placeholder", ...args); -} - -function ArgumentPlaceholder(...args) { - return (0, _builder.default)("ArgumentPlaceholder", ...args); -} - -function AwaitExpression(...args) { - return (0, _builder.default)("AwaitExpression", ...args); -} - -function BindExpression(...args) { - return (0, _builder.default)("BindExpression", ...args); -} - -function ClassProperty(...args) { - return (0, _builder.default)("ClassProperty", ...args); -} - -function OptionalMemberExpression(...args) { - return (0, _builder.default)("OptionalMemberExpression", ...args); -} - -function PipelineTopicExpression(...args) { - return (0, _builder.default)("PipelineTopicExpression", ...args); -} - -function PipelineBareFunction(...args) { - return (0, _builder.default)("PipelineBareFunction", ...args); -} - -function PipelinePrimaryTopicReference(...args) { - return (0, _builder.default)("PipelinePrimaryTopicReference", ...args); -} - -function OptionalCallExpression(...args) { - return (0, _builder.default)("OptionalCallExpression", ...args); -} - -function ClassPrivateProperty(...args) { - return (0, _builder.default)("ClassPrivateProperty", ...args); -} - -function ClassPrivateMethod(...args) { - return (0, _builder.default)("ClassPrivateMethod", ...args); -} - -function Import(...args) { - return (0, _builder.default)("Import", ...args); -} - -function Decorator(...args) { - return (0, _builder.default)("Decorator", ...args); -} - -function DoExpression(...args) { - return (0, _builder.default)("DoExpression", ...args); -} - -function ExportDefaultSpecifier(...args) { - return (0, _builder.default)("ExportDefaultSpecifier", ...args); -} - -function ExportNamespaceSpecifier(...args) { - return (0, _builder.default)("ExportNamespaceSpecifier", ...args); -} - -function PrivateName(...args) { - return (0, _builder.default)("PrivateName", ...args); -} - -function BigIntLiteral(...args) { - return (0, _builder.default)("BigIntLiteral", ...args); -} - -function TSParameterProperty(...args) { - return (0, _builder.default)("TSParameterProperty", ...args); -} - -function TSDeclareFunction(...args) { - return (0, _builder.default)("TSDeclareFunction", ...args); -} - -function TSDeclareMethod(...args) { - return (0, _builder.default)("TSDeclareMethod", ...args); -} - -function TSQualifiedName(...args) { - return (0, _builder.default)("TSQualifiedName", ...args); -} - -function TSCallSignatureDeclaration(...args) { - return (0, _builder.default)("TSCallSignatureDeclaration", ...args); -} - -function TSConstructSignatureDeclaration(...args) { - return (0, _builder.default)("TSConstructSignatureDeclaration", ...args); -} - -function TSPropertySignature(...args) { - return (0, _builder.default)("TSPropertySignature", ...args); -} - -function TSMethodSignature(...args) { - return (0, _builder.default)("TSMethodSignature", ...args); -} - -function TSIndexSignature(...args) { - return (0, _builder.default)("TSIndexSignature", ...args); -} - -function TSAnyKeyword(...args) { - return (0, _builder.default)("TSAnyKeyword", ...args); -} - -function TSUnknownKeyword(...args) { - return (0, _builder.default)("TSUnknownKeyword", ...args); -} - -function TSNumberKeyword(...args) { - return (0, _builder.default)("TSNumberKeyword", ...args); -} - -function TSObjectKeyword(...args) { - return (0, _builder.default)("TSObjectKeyword", ...args); -} - -function TSBooleanKeyword(...args) { - return (0, _builder.default)("TSBooleanKeyword", ...args); -} - -function TSStringKeyword(...args) { - return (0, _builder.default)("TSStringKeyword", ...args); -} - -function TSSymbolKeyword(...args) { - return (0, _builder.default)("TSSymbolKeyword", ...args); -} - -function TSVoidKeyword(...args) { - return (0, _builder.default)("TSVoidKeyword", ...args); -} - -function TSUndefinedKeyword(...args) { - return (0, _builder.default)("TSUndefinedKeyword", ...args); -} - -function TSNullKeyword(...args) { - return (0, _builder.default)("TSNullKeyword", ...args); -} - -function TSNeverKeyword(...args) { - return (0, _builder.default)("TSNeverKeyword", ...args); -} - -function TSThisType(...args) { - return (0, _builder.default)("TSThisType", ...args); -} - -function TSFunctionType(...args) { - return (0, _builder.default)("TSFunctionType", ...args); -} - -function TSConstructorType(...args) { - return (0, _builder.default)("TSConstructorType", ...args); -} - -function TSTypeReference(...args) { - return (0, _builder.default)("TSTypeReference", ...args); -} - -function TSTypePredicate(...args) { - return (0, _builder.default)("TSTypePredicate", ...args); -} - -function TSTypeQuery(...args) { - return (0, _builder.default)("TSTypeQuery", ...args); -} - -function TSTypeLiteral(...args) { - return (0, _builder.default)("TSTypeLiteral", ...args); -} - -function TSArrayType(...args) { - return (0, _builder.default)("TSArrayType", ...args); -} - -function TSTupleType(...args) { - return (0, _builder.default)("TSTupleType", ...args); -} - -function TSOptionalType(...args) { - return (0, _builder.default)("TSOptionalType", ...args); -} - -function TSRestType(...args) { - return (0, _builder.default)("TSRestType", ...args); -} - -function TSUnionType(...args) { - return (0, _builder.default)("TSUnionType", ...args); -} - -function TSIntersectionType(...args) { - return (0, _builder.default)("TSIntersectionType", ...args); -} - -function TSConditionalType(...args) { - return (0, _builder.default)("TSConditionalType", ...args); -} - -function TSInferType(...args) { - return (0, _builder.default)("TSInferType", ...args); -} - -function TSParenthesizedType(...args) { - return (0, _builder.default)("TSParenthesizedType", ...args); -} - -function TSTypeOperator(...args) { - return (0, _builder.default)("TSTypeOperator", ...args); -} - -function TSIndexedAccessType(...args) { - return (0, _builder.default)("TSIndexedAccessType", ...args); -} - -function TSMappedType(...args) { - return (0, _builder.default)("TSMappedType", ...args); -} - -function TSLiteralType(...args) { - return (0, _builder.default)("TSLiteralType", ...args); -} - -function TSExpressionWithTypeArguments(...args) { - return (0, _builder.default)("TSExpressionWithTypeArguments", ...args); -} - -function TSInterfaceDeclaration(...args) { - return (0, _builder.default)("TSInterfaceDeclaration", ...args); -} - -function TSInterfaceBody(...args) { - return (0, _builder.default)("TSInterfaceBody", ...args); -} - -function TSTypeAliasDeclaration(...args) { - return (0, _builder.default)("TSTypeAliasDeclaration", ...args); -} - -function TSAsExpression(...args) { - return (0, _builder.default)("TSAsExpression", ...args); -} - -function TSTypeAssertion(...args) { - return (0, _builder.default)("TSTypeAssertion", ...args); -} - -function TSEnumDeclaration(...args) { - return (0, _builder.default)("TSEnumDeclaration", ...args); -} - -function TSEnumMember(...args) { - return (0, _builder.default)("TSEnumMember", ...args); -} - -function TSModuleDeclaration(...args) { - return (0, _builder.default)("TSModuleDeclaration", ...args); -} - -function TSModuleBlock(...args) { - return (0, _builder.default)("TSModuleBlock", ...args); -} - -function TSImportType(...args) { - return (0, _builder.default)("TSImportType", ...args); -} - -function TSImportEqualsDeclaration(...args) { - return (0, _builder.default)("TSImportEqualsDeclaration", ...args); -} - -function TSExternalModuleReference(...args) { - return (0, _builder.default)("TSExternalModuleReference", ...args); -} - -function TSNonNullExpression(...args) { - return (0, _builder.default)("TSNonNullExpression", ...args); -} - -function TSExportAssignment(...args) { - return (0, _builder.default)("TSExportAssignment", ...args); -} - -function TSNamespaceExportDeclaration(...args) { - return (0, _builder.default)("TSNamespaceExportDeclaration", ...args); -} - -function TSTypeAnnotation(...args) { - return (0, _builder.default)("TSTypeAnnotation", ...args); -} - -function TSTypeParameterInstantiation(...args) { - return (0, _builder.default)("TSTypeParameterInstantiation", ...args); -} - -function TSTypeParameterDeclaration(...args) { - return (0, _builder.default)("TSTypeParameterDeclaration", ...args); -} - -function TSTypeParameter(...args) { - return (0, _builder.default)("TSTypeParameter", ...args); -} - -function NumberLiteral(...args) { - console.trace("The node type NumberLiteral has been renamed to NumericLiteral"); - return NumberLiteral("NumberLiteral", ...args); -} - -function RegexLiteral(...args) { - console.trace("The node type RegexLiteral has been renamed to RegExpLiteral"); - return RegexLiteral("RegexLiteral", ...args); -} - -function RestProperty(...args) { - console.trace("The node type RestProperty has been renamed to RestElement"); - return RestProperty("RestProperty", ...args); -} - -function SpreadProperty(...args) { - console.trace("The node type SpreadProperty has been renamed to SpreadElement"); - return SpreadProperty("SpreadProperty", ...args); -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/cloneNode.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/cloneNode.js deleted file mode 100644 index ce9cb8c1f32984..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/clone/cloneNode.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = cloneNode; - -var _definitions = require("../definitions"); - -const has = Function.call.bind(Object.prototype.hasOwnProperty); - -function cloneIfNode(obj, deep) { - if (obj && typeof obj.type === "string" && obj.type !== "CommentLine" && obj.type !== "CommentBlock") { - return cloneNode(obj, deep); - } - - return obj; -} - -function cloneIfNodeOrArray(obj, deep) { - if (Array.isArray(obj)) { - return obj.map(node => cloneIfNode(node, deep)); - } - - return cloneIfNode(obj, deep); -} - -function cloneNode(node, deep = true) { - if (!node) return node; - const { - type - } = node; - const newNode = { - type - }; - - if (type === "Identifier") { - newNode.name = node.name; - - if (has(node, "optional") && typeof node.optional === "boolean") { - newNode.optional = node.optional; - } - - if (has(node, "typeAnnotation")) { - newNode.typeAnnotation = deep ? cloneIfNodeOrArray(node.typeAnnotation, true) : node.typeAnnotation; - } - } else if (!has(_definitions.NODE_FIELDS, type)) { - throw new Error(`Unknown node type: "${type}"`); - } else { - for (const field of Object.keys(_definitions.NODE_FIELDS[type])) { - if (has(node, field)) { - newNode[field] = deep ? cloneIfNodeOrArray(node[field], true) : node[field]; - } - } - } - - if (has(node, "loc")) { - newNode.loc = node.loc; - } - - if (has(node, "leadingComments")) { - newNode.leadingComments = node.leadingComments; - } - - if (has(node, "innerComments")) { - newNode.innerComments = node.innerComments; - } - - if (has(node, "trailingComments")) { - newNode.trailingComments = node.trailingComments; - } - - if (has(node, "extra")) { - newNode.extra = Object.assign({}, node.extra); - } - - return newNode; -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/core.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/core.js deleted file mode 100644 index d759890cf5721b..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/core.js +++ /dev/null @@ -1,725 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.patternLikeCommon = exports.functionDeclarationCommon = exports.functionTypeAnnotationCommon = exports.functionCommon = void 0; - -var _isValidIdentifier = _interopRequireDefault(require("../validators/isValidIdentifier")); - -var _constants = require("../constants"); - -var _utils = _interopRequireWildcard(require("./utils")); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -(0, _utils.default)("ArrayExpression", { - fields: { - elements: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeOrValueType)("null", "Expression", "SpreadElement"))), - default: [] - } - }, - visitor: ["elements"], - aliases: ["Expression"] -}); -(0, _utils.default)("AssignmentExpression", { - fields: { - operator: { - validate: (0, _utils.assertValueType)("string") - }, - left: { - validate: (0, _utils.assertNodeType)("LVal") - }, - right: { - validate: (0, _utils.assertNodeType)("Expression") - } - }, - builder: ["operator", "left", "right"], - visitor: ["left", "right"], - aliases: ["Expression"] -}); -(0, _utils.default)("BinaryExpression", { - builder: ["operator", "left", "right"], - fields: { - operator: { - validate: (0, _utils.assertOneOf)(..._constants.BINARY_OPERATORS) - }, - left: { - validate: (0, _utils.assertNodeType)("Expression") - }, - right: { - validate: (0, _utils.assertNodeType)("Expression") - } - }, - visitor: ["left", "right"], - aliases: ["Binary", "Expression"] -}); -(0, _utils.default)("InterpreterDirective", { - builder: ["value"], - fields: { - value: { - validate: (0, _utils.assertValueType)("string") - } - } -}); -(0, _utils.default)("Directive", { - visitor: ["value"], - fields: { - value: { - validate: (0, _utils.assertNodeType)("DirectiveLiteral") - } - } -}); -(0, _utils.default)("DirectiveLiteral", { - builder: ["value"], - fields: { - value: { - validate: (0, _utils.assertValueType)("string") - } - } -}); -(0, _utils.default)("BlockStatement", { - builder: ["body", "directives"], - visitor: ["directives", "body"], - fields: { - directives: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Directive"))), - default: [] - }, - body: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement"))) - } - }, - aliases: ["Scopable", "BlockParent", "Block", "Statement"] -}); -(0, _utils.default)("BreakStatement", { - visitor: ["label"], - fields: { - label: { - validate: (0, _utils.assertNodeType)("Identifier"), - optional: true - } - }, - aliases: ["Statement", "Terminatorless", "CompletionStatement"] -}); -(0, _utils.default)("CallExpression", { - visitor: ["callee", "arguments", "typeParameters", "typeArguments"], - builder: ["callee", "arguments"], - aliases: ["Expression"], - fields: { - callee: { - validate: (0, _utils.assertNodeType)("Expression") - }, - arguments: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement", "JSXNamespacedName", "ArgumentPlaceholder"))) - }, - optional: { - validate: (0, _utils.assertOneOf)(true, false), - optional: true - }, - typeArguments: { - validate: (0, _utils.assertNodeType)("TypeParameterInstantiation"), - optional: true - }, - typeParameters: { - validate: (0, _utils.assertNodeType)("TSTypeParameterInstantiation"), - optional: true - } - } -}); -(0, _utils.default)("CatchClause", { - visitor: ["param", "body"], - fields: { - param: { - validate: (0, _utils.assertNodeType)("Identifier"), - optional: true - }, - body: { - validate: (0, _utils.assertNodeType)("BlockStatement") - } - }, - aliases: ["Scopable", "BlockParent"] -}); -(0, _utils.default)("ConditionalExpression", { - visitor: ["test", "consequent", "alternate"], - fields: { - test: { - validate: (0, _utils.assertNodeType)("Expression") - }, - consequent: { - validate: (0, _utils.assertNodeType)("Expression") - }, - alternate: { - validate: (0, _utils.assertNodeType)("Expression") - } - }, - aliases: ["Expression", "Conditional"] -}); -(0, _utils.default)("ContinueStatement", { - visitor: ["label"], - fields: { - label: { - validate: (0, _utils.assertNodeType)("Identifier"), - optional: true - } - }, - aliases: ["Statement", "Terminatorless", "CompletionStatement"] -}); -(0, _utils.default)("DebuggerStatement", { - aliases: ["Statement"] -}); -(0, _utils.default)("DoWhileStatement", { - visitor: ["test", "body"], - fields: { - test: { - validate: (0, _utils.assertNodeType)("Expression") - }, - body: { - validate: (0, _utils.assertNodeType)("Statement") - } - }, - aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"] -}); -(0, _utils.default)("EmptyStatement", { - aliases: ["Statement"] -}); -(0, _utils.default)("ExpressionStatement", { - visitor: ["expression"], - fields: { - expression: { - validate: (0, _utils.assertNodeType)("Expression") - } - }, - aliases: ["Statement", "ExpressionWrapper"] -}); -(0, _utils.default)("File", { - builder: ["program", "comments", "tokens"], - visitor: ["program"], - fields: { - program: { - validate: (0, _utils.assertNodeType)("Program") - } - } -}); -(0, _utils.default)("ForInStatement", { - visitor: ["left", "right", "body"], - aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], - fields: { - left: { - validate: (0, _utils.assertNodeType)("VariableDeclaration", "LVal") - }, - right: { - validate: (0, _utils.assertNodeType)("Expression") - }, - body: { - validate: (0, _utils.assertNodeType)("Statement") - } - } -}); -(0, _utils.default)("ForStatement", { - visitor: ["init", "test", "update", "body"], - aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop"], - fields: { - init: { - validate: (0, _utils.assertNodeType)("VariableDeclaration", "Expression"), - optional: true - }, - test: { - validate: (0, _utils.assertNodeType)("Expression"), - optional: true - }, - update: { - validate: (0, _utils.assertNodeType)("Expression"), - optional: true - }, - body: { - validate: (0, _utils.assertNodeType)("Statement") - } - } -}); -const functionCommon = { - params: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Identifier", "Pattern", "RestElement", "TSParameterProperty"))) - }, - generator: { - default: false, - validate: (0, _utils.assertValueType)("boolean") - }, - async: { - validate: (0, _utils.assertValueType)("boolean"), - default: false - } -}; -exports.functionCommon = functionCommon; -const functionTypeAnnotationCommon = { - returnType: { - validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), - optional: true - }, - typeParameters: { - validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"), - optional: true - } -}; -exports.functionTypeAnnotationCommon = functionTypeAnnotationCommon; -const functionDeclarationCommon = Object.assign({}, functionCommon, { - declare: { - validate: (0, _utils.assertValueType)("boolean"), - optional: true - }, - id: { - validate: (0, _utils.assertNodeType)("Identifier"), - optional: true - } -}); -exports.functionDeclarationCommon = functionDeclarationCommon; -(0, _utils.default)("FunctionDeclaration", { - builder: ["id", "params", "body", "generator", "async"], - visitor: ["id", "params", "body", "returnType", "typeParameters"], - fields: Object.assign({}, functionDeclarationCommon, functionTypeAnnotationCommon, { - body: { - validate: (0, _utils.assertNodeType)("BlockStatement") - } - }), - aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Statement", "Pureish", "Declaration"] -}); -(0, _utils.default)("FunctionExpression", { - inherits: "FunctionDeclaration", - aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"], - fields: Object.assign({}, functionCommon, functionTypeAnnotationCommon, { - id: { - validate: (0, _utils.assertNodeType)("Identifier"), - optional: true - }, - body: { - validate: (0, _utils.assertNodeType)("BlockStatement") - } - }) -}); -const patternLikeCommon = { - typeAnnotation: { - validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), - optional: true - }, - decorators: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))) - } -}; -exports.patternLikeCommon = patternLikeCommon; -(0, _utils.default)("Identifier", { - builder: ["name"], - visitor: ["typeAnnotation", "decorators"], - aliases: ["Expression", "PatternLike", "LVal", "TSEntityName"], - fields: Object.assign({}, patternLikeCommon, { - name: { - validate: (0, _utils.chain)(function (node, key, val) { - if (!(0, _isValidIdentifier.default)(val)) {} - }, (0, _utils.assertValueType)("string")) - }, - optional: { - validate: (0, _utils.assertValueType)("boolean"), - optional: true - } - }) -}); -(0, _utils.default)("IfStatement", { - visitor: ["test", "consequent", "alternate"], - aliases: ["Statement", "Conditional"], - fields: { - test: { - validate: (0, _utils.assertNodeType)("Expression") - }, - consequent: { - validate: (0, _utils.assertNodeType)("Statement") - }, - alternate: { - optional: true, - validate: (0, _utils.assertNodeType)("Statement") - } - } -}); -(0, _utils.default)("LabeledStatement", { - visitor: ["label", "body"], - aliases: ["Statement"], - fields: { - label: { - validate: (0, _utils.assertNodeType)("Identifier") - }, - body: { - validate: (0, _utils.assertNodeType)("Statement") - } - } -}); -(0, _utils.default)("StringLiteral", { - builder: ["value"], - fields: { - value: { - validate: (0, _utils.assertValueType)("string") - } - }, - aliases: ["Expression", "Pureish", "Literal", "Immutable"] -}); -(0, _utils.default)("NumericLiteral", { - builder: ["value"], - deprecatedAlias: "NumberLiteral", - fields: { - value: { - validate: (0, _utils.assertValueType)("number") - } - }, - aliases: ["Expression", "Pureish", "Literal", "Immutable"] -}); -(0, _utils.default)("NullLiteral", { - aliases: ["Expression", "Pureish", "Literal", "Immutable"] -}); -(0, _utils.default)("BooleanLiteral", { - builder: ["value"], - fields: { - value: { - validate: (0, _utils.assertValueType)("boolean") - } - }, - aliases: ["Expression", "Pureish", "Literal", "Immutable"] -}); -(0, _utils.default)("RegExpLiteral", { - builder: ["pattern", "flags"], - deprecatedAlias: "RegexLiteral", - aliases: ["Expression", "Literal"], - fields: { - pattern: { - validate: (0, _utils.assertValueType)("string") - }, - flags: { - validate: (0, _utils.assertValueType)("string"), - default: "" - } - } -}); -(0, _utils.default)("LogicalExpression", { - builder: ["operator", "left", "right"], - visitor: ["left", "right"], - aliases: ["Binary", "Expression"], - fields: { - operator: { - validate: (0, _utils.assertOneOf)(..._constants.LOGICAL_OPERATORS) - }, - left: { - validate: (0, _utils.assertNodeType)("Expression") - }, - right: { - validate: (0, _utils.assertNodeType)("Expression") - } - } -}); -(0, _utils.default)("MemberExpression", { - builder: ["object", "property", "computed", "optional"], - visitor: ["object", "property"], - aliases: ["Expression", "LVal"], - fields: { - object: { - validate: (0, _utils.assertNodeType)("Expression") - }, - property: { - validate: function () { - const normal = (0, _utils.assertNodeType)("Identifier", "PrivateName"); - const computed = (0, _utils.assertNodeType)("Expression"); - return function (node, key, val) { - const validator = node.computed ? computed : normal; - validator(node, key, val); - }; - }() - }, - computed: { - default: false - }, - optional: { - validate: (0, _utils.assertOneOf)(true, false), - optional: true - } - } -}); -(0, _utils.default)("NewExpression", { - inherits: "CallExpression" -}); -(0, _utils.default)("Program", { - visitor: ["directives", "body"], - builder: ["body", "directives", "sourceType", "interpreter"], - fields: { - sourceFile: { - validate: (0, _utils.assertValueType)("string") - }, - sourceType: { - validate: (0, _utils.assertOneOf)("script", "module"), - default: "script" - }, - interpreter: { - validate: (0, _utils.assertNodeType)("InterpreterDirective"), - default: null, - optional: true - }, - directives: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Directive"))), - default: [] - }, - body: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement"))) - } - }, - aliases: ["Scopable", "BlockParent", "Block"] -}); -(0, _utils.default)("ObjectExpression", { - visitor: ["properties"], - aliases: ["Expression"], - fields: { - properties: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ObjectMethod", "ObjectProperty", "SpreadElement"))) - } - } -}); -(0, _utils.default)("ObjectMethod", { - builder: ["kind", "key", "params", "body", "computed"], - fields: Object.assign({}, functionCommon, functionTypeAnnotationCommon, { - kind: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), (0, _utils.assertOneOf)("method", "get", "set")), - default: "method" - }, - computed: { - validate: (0, _utils.assertValueType)("boolean"), - default: false - }, - key: { - validate: function () { - const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral"); - const computed = (0, _utils.assertNodeType)("Expression"); - return function (node, key, val) { - const validator = node.computed ? computed : normal; - validator(node, key, val); - }; - }() - }, - decorators: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))) - }, - body: { - validate: (0, _utils.assertNodeType)("BlockStatement") - } - }), - visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], - aliases: ["UserWhitespacable", "Function", "Scopable", "BlockParent", "FunctionParent", "Method", "ObjectMember"] -}); -(0, _utils.default)("ObjectProperty", { - builder: ["key", "value", "computed", "shorthand", "decorators"], - fields: { - computed: { - validate: (0, _utils.assertValueType)("boolean"), - default: false - }, - key: { - validate: function () { - const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral"); - const computed = (0, _utils.assertNodeType)("Expression"); - return function (node, key, val) { - const validator = node.computed ? computed : normal; - validator(node, key, val); - }; - }() - }, - value: { - validate: (0, _utils.assertNodeType)("Expression", "PatternLike") - }, - shorthand: { - validate: (0, _utils.assertValueType)("boolean"), - default: false - }, - decorators: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))), - optional: true - } - }, - visitor: ["key", "value", "decorators"], - aliases: ["UserWhitespacable", "Property", "ObjectMember"] -}); -(0, _utils.default)("RestElement", { - visitor: ["argument", "typeAnnotation"], - builder: ["argument"], - aliases: ["LVal", "PatternLike"], - deprecatedAlias: "RestProperty", - fields: Object.assign({}, patternLikeCommon, { - argument: { - validate: (0, _utils.assertNodeType)("LVal") - } - }) -}); -(0, _utils.default)("ReturnStatement", { - visitor: ["argument"], - aliases: ["Statement", "Terminatorless", "CompletionStatement"], - fields: { - argument: { - validate: (0, _utils.assertNodeType)("Expression"), - optional: true - } - } -}); -(0, _utils.default)("SequenceExpression", { - visitor: ["expressions"], - fields: { - expressions: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression"))) - } - }, - aliases: ["Expression"] -}); -(0, _utils.default)("ParenthesizedExpression", { - visitor: ["expression"], - aliases: ["Expression", "ExpressionWrapper"], - fields: { - expression: { - validate: (0, _utils.assertNodeType)("Expression") - } - } -}); -(0, _utils.default)("SwitchCase", { - visitor: ["test", "consequent"], - fields: { - test: { - validate: (0, _utils.assertNodeType)("Expression"), - optional: true - }, - consequent: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement"))) - } - } -}); -(0, _utils.default)("SwitchStatement", { - visitor: ["discriminant", "cases"], - aliases: ["Statement", "BlockParent", "Scopable"], - fields: { - discriminant: { - validate: (0, _utils.assertNodeType)("Expression") - }, - cases: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("SwitchCase"))) - } - } -}); -(0, _utils.default)("ThisExpression", { - aliases: ["Expression"] -}); -(0, _utils.default)("ThrowStatement", { - visitor: ["argument"], - aliases: ["Statement", "Terminatorless", "CompletionStatement"], - fields: { - argument: { - validate: (0, _utils.assertNodeType)("Expression") - } - } -}); -(0, _utils.default)("TryStatement", { - visitor: ["block", "handler", "finalizer"], - aliases: ["Statement"], - fields: { - block: { - validate: (0, _utils.assertNodeType)("BlockStatement") - }, - handler: { - optional: true, - validate: (0, _utils.assertNodeType)("CatchClause") - }, - finalizer: { - optional: true, - validate: (0, _utils.assertNodeType)("BlockStatement") - } - } -}); -(0, _utils.default)("UnaryExpression", { - builder: ["operator", "argument", "prefix"], - fields: { - prefix: { - default: true - }, - argument: { - validate: (0, _utils.assertNodeType)("Expression") - }, - operator: { - validate: (0, _utils.assertOneOf)(..._constants.UNARY_OPERATORS) - } - }, - visitor: ["argument"], - aliases: ["UnaryLike", "Expression"] -}); -(0, _utils.default)("UpdateExpression", { - builder: ["operator", "argument", "prefix"], - fields: { - prefix: { - default: false - }, - argument: { - validate: (0, _utils.assertNodeType)("Expression") - }, - operator: { - validate: (0, _utils.assertOneOf)(..._constants.UPDATE_OPERATORS) - } - }, - visitor: ["argument"], - aliases: ["Expression"] -}); -(0, _utils.default)("VariableDeclaration", { - builder: ["kind", "declarations"], - visitor: ["declarations"], - aliases: ["Statement", "Declaration"], - fields: { - declare: { - validate: (0, _utils.assertValueType)("boolean"), - optional: true - }, - kind: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), (0, _utils.assertOneOf)("var", "let", "const")) - }, - declarations: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("VariableDeclarator"))) - } - } -}); -(0, _utils.default)("VariableDeclarator", { - visitor: ["id", "init"], - fields: { - id: { - validate: (0, _utils.assertNodeType)("LVal") - }, - definite: { - optional: true, - validate: (0, _utils.assertValueType)("boolean") - }, - init: { - optional: true, - validate: (0, _utils.assertNodeType)("Expression") - } - } -}); -(0, _utils.default)("WhileStatement", { - visitor: ["test", "body"], - aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"], - fields: { - test: { - validate: (0, _utils.assertNodeType)("Expression") - }, - body: { - validate: (0, _utils.assertNodeType)("BlockStatement", "Statement") - } - } -}); -(0, _utils.default)("WithStatement", { - visitor: ["object", "body"], - aliases: ["Statement"], - fields: { - object: { - validate: (0, _utils.assertNodeType)("Expression") - }, - body: { - validate: (0, _utils.assertNodeType)("BlockStatement", "Statement") - } - } -}); \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/es2015.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/es2015.js deleted file mode 100644 index 71e01365390ebf..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/es2015.js +++ /dev/null @@ -1,401 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.classMethodOrDeclareMethodCommon = exports.classMethodOrPropertyCommon = void 0; - -var _utils = _interopRequireWildcard(require("./utils")); - -var _core = require("./core"); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } - -(0, _utils.default)("AssignmentPattern", { - visitor: ["left", "right", "decorators"], - builder: ["left", "right"], - aliases: ["Pattern", "PatternLike", "LVal"], - fields: Object.assign({}, _core.patternLikeCommon, { - left: { - validate: (0, _utils.assertNodeType)("Identifier", "ObjectPattern", "ArrayPattern", "MemberExpression") - }, - right: { - validate: (0, _utils.assertNodeType)("Expression") - }, - decorators: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))) - } - }) -}); -(0, _utils.default)("ArrayPattern", { - visitor: ["elements", "typeAnnotation"], - builder: ["elements"], - aliases: ["Pattern", "PatternLike", "LVal"], - fields: Object.assign({}, _core.patternLikeCommon, { - elements: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("PatternLike"))) - }, - decorators: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))) - } - }) -}); -(0, _utils.default)("ArrowFunctionExpression", { - builder: ["params", "body", "async"], - visitor: ["params", "body", "returnType", "typeParameters"], - aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"], - fields: Object.assign({}, _core.functionCommon, _core.functionTypeAnnotationCommon, { - expression: { - validate: (0, _utils.assertValueType)("boolean") - }, - body: { - validate: (0, _utils.assertNodeType)("BlockStatement", "Expression") - } - }) -}); -(0, _utils.default)("ClassBody", { - visitor: ["body"], - fields: { - body: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ClassMethod", "ClassPrivateMethod", "ClassProperty", "ClassPrivateProperty", "TSDeclareMethod", "TSIndexSignature"))) - } - } -}); -const classCommon = { - typeParameters: { - validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"), - optional: true - }, - body: { - validate: (0, _utils.assertNodeType)("ClassBody") - }, - superClass: { - optional: true, - validate: (0, _utils.assertNodeType)("Expression") - }, - superTypeParameters: { - validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"), - optional: true - }, - implements: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSExpressionWithTypeArguments", "ClassImplements"))), - optional: true - } -}; -(0, _utils.default)("ClassDeclaration", { - builder: ["id", "superClass", "body", "decorators"], - visitor: ["id", "body", "superClass", "mixins", "typeParameters", "superTypeParameters", "implements", "decorators"], - aliases: ["Scopable", "Class", "Statement", "Declaration", "Pureish"], - fields: Object.assign({}, classCommon, { - declare: { - validate: (0, _utils.assertValueType)("boolean"), - optional: true - }, - abstract: { - validate: (0, _utils.assertValueType)("boolean"), - optional: true - }, - id: { - validate: (0, _utils.assertNodeType)("Identifier"), - optional: true - }, - decorators: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))), - optional: true - } - }) -}); -(0, _utils.default)("ClassExpression", { - inherits: "ClassDeclaration", - aliases: ["Scopable", "Class", "Expression", "Pureish"], - fields: Object.assign({}, classCommon, { - id: { - optional: true, - validate: (0, _utils.assertNodeType)("Identifier") - }, - body: { - validate: (0, _utils.assertNodeType)("ClassBody") - }, - superClass: { - optional: true, - validate: (0, _utils.assertNodeType)("Expression") - }, - decorators: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))), - optional: true - } - }) -}); -(0, _utils.default)("ExportAllDeclaration", { - visitor: ["source"], - aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"], - fields: { - source: { - validate: (0, _utils.assertNodeType)("StringLiteral") - } - } -}); -(0, _utils.default)("ExportDefaultDeclaration", { - visitor: ["declaration"], - aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"], - fields: { - declaration: { - validate: (0, _utils.assertNodeType)("FunctionDeclaration", "TSDeclareFunction", "ClassDeclaration", "Expression") - } - } -}); -(0, _utils.default)("ExportNamedDeclaration", { - visitor: ["declaration", "specifiers", "source"], - aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"], - fields: { - declaration: { - validate: (0, _utils.assertNodeType)("Declaration"), - optional: true - }, - specifiers: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ExportSpecifier", "ExportDefaultSpecifier", "ExportNamespaceSpecifier"))) - }, - source: { - validate: (0, _utils.assertNodeType)("StringLiteral"), - optional: true - }, - exportKind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("type", "value")) - } -}); -(0, _utils.default)("ExportSpecifier", { - visitor: ["local", "exported"], - aliases: ["ModuleSpecifier"], - fields: { - local: { - validate: (0, _utils.assertNodeType)("Identifier") - }, - exported: { - validate: (0, _utils.assertNodeType)("Identifier") - } - } -}); -(0, _utils.default)("ForOfStatement", { - visitor: ["left", "right", "body"], - aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], - fields: { - left: { - validate: (0, _utils.assertNodeType)("VariableDeclaration", "LVal") - }, - right: { - validate: (0, _utils.assertNodeType)("Expression") - }, - body: { - validate: (0, _utils.assertNodeType)("Statement") - }, - await: { - default: false, - validate: (0, _utils.assertValueType)("boolean") - } - } -}); -(0, _utils.default)("ImportDeclaration", { - visitor: ["specifiers", "source"], - aliases: ["Statement", "Declaration", "ModuleDeclaration"], - fields: { - specifiers: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ImportSpecifier", "ImportDefaultSpecifier", "ImportNamespaceSpecifier"))) - }, - source: { - validate: (0, _utils.assertNodeType)("StringLiteral") - }, - importKind: { - validate: (0, _utils.assertOneOf)("type", "typeof", "value"), - optional: true - } - } -}); -(0, _utils.default)("ImportDefaultSpecifier", { - visitor: ["local"], - aliases: ["ModuleSpecifier"], - fields: { - local: { - validate: (0, _utils.assertNodeType)("Identifier") - } - } -}); -(0, _utils.default)("ImportNamespaceSpecifier", { - visitor: ["local"], - aliases: ["ModuleSpecifier"], - fields: { - local: { - validate: (0, _utils.assertNodeType)("Identifier") - } - } -}); -(0, _utils.default)("ImportSpecifier", { - visitor: ["local", "imported"], - aliases: ["ModuleSpecifier"], - fields: { - local: { - validate: (0, _utils.assertNodeType)("Identifier") - }, - imported: { - validate: (0, _utils.assertNodeType)("Identifier") - }, - importKind: { - validate: (0, _utils.assertOneOf)("type", "typeof"), - optional: true - } - } -}); -(0, _utils.default)("MetaProperty", { - visitor: ["meta", "property"], - aliases: ["Expression"], - fields: { - meta: { - validate: (0, _utils.assertNodeType)("Identifier") - }, - property: { - validate: (0, _utils.assertNodeType)("Identifier") - } - } -}); -const classMethodOrPropertyCommon = { - abstract: { - validate: (0, _utils.assertValueType)("boolean"), - optional: true - }, - accessibility: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), (0, _utils.assertOneOf)("public", "private", "protected")), - optional: true - }, - static: { - validate: (0, _utils.assertValueType)("boolean"), - optional: true - }, - computed: { - default: false, - validate: (0, _utils.assertValueType)("boolean") - }, - optional: { - validate: (0, _utils.assertValueType)("boolean"), - optional: true - }, - key: { - validate: (0, _utils.chain)(function () { - const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral"); - const computed = (0, _utils.assertNodeType)("Expression"); - return function (node, key, val) { - const validator = node.computed ? computed : normal; - validator(node, key, val); - }; - }(), (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "Expression")) - } -}; -exports.classMethodOrPropertyCommon = classMethodOrPropertyCommon; -const classMethodOrDeclareMethodCommon = Object.assign({}, _core.functionCommon, classMethodOrPropertyCommon, { - kind: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), (0, _utils.assertOneOf)("get", "set", "method", "constructor")), - default: "method" - }, - access: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), (0, _utils.assertOneOf)("public", "private", "protected")), - optional: true - }, - decorators: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))), - optional: true - } -}); -exports.classMethodOrDeclareMethodCommon = classMethodOrDeclareMethodCommon; -(0, _utils.default)("ClassMethod", { - aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"], - builder: ["kind", "key", "params", "body", "computed", "static"], - visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], - fields: Object.assign({}, classMethodOrDeclareMethodCommon, _core.functionTypeAnnotationCommon, { - body: { - validate: (0, _utils.assertNodeType)("BlockStatement") - } - }) -}); -(0, _utils.default)("ObjectPattern", { - visitor: ["properties", "typeAnnotation", "decorators"], - builder: ["properties"], - aliases: ["Pattern", "PatternLike", "LVal"], - fields: Object.assign({}, _core.patternLikeCommon, { - properties: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("RestElement", "ObjectProperty"))) - } - }) -}); -(0, _utils.default)("SpreadElement", { - visitor: ["argument"], - aliases: ["UnaryLike"], - deprecatedAlias: "SpreadProperty", - fields: { - argument: { - validate: (0, _utils.assertNodeType)("Expression") - } - } -}); -(0, _utils.default)("Super", { - aliases: ["Expression"] -}); -(0, _utils.default)("TaggedTemplateExpression", { - visitor: ["tag", "quasi"], - aliases: ["Expression"], - fields: { - tag: { - validate: (0, _utils.assertNodeType)("Expression") - }, - quasi: { - validate: (0, _utils.assertNodeType)("TemplateLiteral") - }, - typeParameters: { - validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"), - optional: true - } - } -}); -(0, _utils.default)("TemplateElement", { - builder: ["value", "tail"], - fields: { - value: { - validate: (0, _utils.assertShape)({ - raw: { - validate: (0, _utils.assertValueType)("string") - }, - cooked: { - validate: (0, _utils.assertValueType)("string"), - optional: true - } - }) - }, - tail: { - validate: (0, _utils.assertValueType)("boolean"), - default: false - } - } -}); -(0, _utils.default)("TemplateLiteral", { - visitor: ["quasis", "expressions"], - aliases: ["Expression", "Literal"], - fields: { - quasis: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TemplateElement"))) - }, - expressions: { - validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression"))) - } - } -}); -(0, _utils.default)("YieldExpression", { - builder: ["argument", "delegate"], - visitor: ["argument"], - aliases: ["Expression", "Terminatorless"], - fields: { - delegate: { - validate: (0, _utils.assertValueType)("boolean"), - default: false - }, - argument: { - optional: true, - validate: (0, _utils.assertNodeType)("Expression") - } - } -}); \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/misc.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/misc.js deleted file mode 100644 index ecc4db67ff1a55..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/definitions/misc.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; - -var _utils = _interopRequireWildcard(require("./utils")); - -var _placeholders = require("./placeholders"); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } - -(0, _utils.default)("Noop", { - visitor: [] -}); -(0, _utils.default)("Placeholder", { - visitor: [], - builder: ["expectedNode", "name"], - fields: { - name: { - validate: (0, _utils.assertNodeType)("Identifier") - }, - expectedNode: { - validate: (0, _utils.assertOneOf)(..._placeholders.PLACEHOLDERS) - } - } -}); \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/utils/inherit.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/utils/inherit.js deleted file mode 100644 index 46b32efe8a5ce5..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/utils/inherit.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = inherit; - -function _uniq() { - const data = _interopRequireDefault(require("lodash/uniq")); - - _uniq = function () { - return data; - }; - - return data; -} - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function inherit(key, child, parent) { - if (child && parent) { - child[key] = (0, _uniq().default)([].concat(child[key], parent[key]).filter(Boolean)); - } -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isScope.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isScope.js deleted file mode 100644 index c808631faf2c61..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isScope.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isScope; - -var _generated = require("./generated"); - -function isScope(node, parent) { - if ((0, _generated.isBlockStatement)(node) && (0, _generated.isFunction)(parent, { - body: node - })) { - return false; - } - - if ((0, _generated.isBlockStatement)(node) && (0, _generated.isCatchClause)(parent, { - body: node - })) { - return false; - } - - return (0, _generated.isScopable)(node); -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isValidIdentifier.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isValidIdentifier.js deleted file mode 100644 index 8c54b7ac8680db..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/lib/validators/isValidIdentifier.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = isValidIdentifier; - -function _esutils() { - const data = _interopRequireDefault(require("esutils")); - - _esutils = function () { - return data; - }; - - return data; -} - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function isValidIdentifier(name) { - if (typeof name !== "string" || _esutils().default.keyword.isReservedWordES6(name, true)) { - return false; - } else if (name === "await") { - return false; - } else { - return _esutils().default.keyword.isIdentifierNameES6(name); - } -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/package.json b/tools/node_modules/babel-eslint/node_modules/@babel/types/package.json deleted file mode 100644 index e13eb11bd5a9ed..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "author": { - "name": "Sebastian McKenzie", - "email": "sebmck@gmail.com" - }, - "bundleDependencies": false, - "dependencies": { - "esutils": "^2.0.2", - "lodash": "^4.17.13", - "to-fast-properties": "^2.0.0" - }, - "deprecated": false, - "description": "Babel Types is a Lodash-esque utility library for AST nodes", - "devDependencies": { - "@babel/generator": "^7.5.5", - "@babel/parser": "^7.5.5" - }, - "gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43", - "homepage": "https://babeljs.io/", - "license": "MIT", - "main": "lib/index.js", - "name": "@babel/types", - "repository": { - "type": "git", - "url": "https://github.com/babel/babel/tree/master/packages/babel-types" - }, - "types": "lib/index.d.ts", - "version": "7.5.5" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/flow.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/flow.js deleted file mode 100644 index daab2411d74235..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/flow.js +++ /dev/null @@ -1,153 +0,0 @@ -"use strict"; - -const t = require("../../"); -const stringifyValidator = require("../utils/stringifyValidator"); -const toFunctionName = require("../utils/toFunctionName"); - -const NODE_PREFIX = "BabelNode"; - -let code = `// NOTE: This file is autogenerated. Do not modify. -// See packages/babel-types/scripts/generators/flow.js for script used. - -declare class ${NODE_PREFIX}Comment { - value: string; - start: number; - end: number; - loc: ${NODE_PREFIX}SourceLocation; -} - -declare class ${NODE_PREFIX}CommentBlock extends ${NODE_PREFIX}Comment { - type: "CommentBlock"; -} - -declare class ${NODE_PREFIX}CommentLine extends ${NODE_PREFIX}Comment { - type: "CommentLine"; -} - -declare class ${NODE_PREFIX}SourceLocation { - start: { - line: number; - column: number; - }; - - end: { - line: number; - column: number; - }; -} - -declare class ${NODE_PREFIX} { - leadingComments?: Array<${NODE_PREFIX}Comment>; - innerComments?: Array<${NODE_PREFIX}Comment>; - trailingComments?: Array<${NODE_PREFIX}Comment>; - start: ?number; - end: ?number; - loc: ?${NODE_PREFIX}SourceLocation; -}\n\n`; - -// - -const lines = []; - -for (const type in t.NODE_FIELDS) { - const fields = t.NODE_FIELDS[type]; - - const struct = ['type: "' + type + '";']; - const args = []; - - Object.keys(t.NODE_FIELDS[type]) - .sort((fieldA, fieldB) => { - const indexA = t.BUILDER_KEYS[type].indexOf(fieldA); - const indexB = t.BUILDER_KEYS[type].indexOf(fieldB); - if (indexA === indexB) return fieldA < fieldB ? -1 : 1; - if (indexA === -1) return 1; - if (indexB === -1) return -1; - return indexA - indexB; - }) - .forEach(fieldName => { - const field = fields[fieldName]; - - let suffix = ""; - if (field.optional || field.default != null) suffix += "?"; - - let typeAnnotation = "any"; - - const validate = field.validate; - if (validate) { - typeAnnotation = stringifyValidator(validate, NODE_PREFIX); - } - - if (typeAnnotation) { - suffix += ": " + typeAnnotation; - } - - args.push(t.toBindingIdentifierName(fieldName) + suffix); - - if (t.isValidIdentifier(fieldName)) { - struct.push(fieldName + suffix + ";"); - } - }); - - code += `declare class ${NODE_PREFIX}${type} extends ${NODE_PREFIX} { - ${struct.join("\n ").trim()} -}\n\n`; - - // Flow chokes on super() and import() :/ - if (type !== "Super" && type !== "Import") { - lines.push( - `declare function ${toFunctionName(type)}(${args.join( - ", " - )}): ${NODE_PREFIX}${type};` - ); - } -} - -for (let i = 0; i < t.TYPES.length; i++) { - let decl = `declare function is${ - t.TYPES[i] - }(node: ?Object, opts?: ?Object): boolean`; - - if (t.NODE_FIELDS[t.TYPES[i]]) { - decl += ` %checks (node instanceof ${NODE_PREFIX}${t.TYPES[i]})`; - } - - lines.push(decl); -} - -lines.push( - `declare function validate(n: BabelNode, key: string, value: mixed): void;`, - `declare function clone(n: T): T;`, - `declare function cloneDeep(n: T): T;`, - `declare function removeProperties(n: T, opts: ?{}): void;`, - `declare function removePropertiesDeep(n: T, opts: ?{}): T;`, - `declare type TraversalAncestors = Array<{ - node: BabelNode, - key: string, - index?: number, - }>; - declare type TraversalHandler = (BabelNode, TraversalAncestors, T) => void; - declare type TraversalHandlers = { - enter?: TraversalHandler, - exit?: TraversalHandler, - };`.replace(/(^|\n) {2}/g, "$1"), - // eslint-disable-next-line - `declare function traverse(n: BabelNode, TraversalHandler | TraversalHandlers, state?: T): void;` -); - -for (const type in t.FLIPPED_ALIAS_KEYS) { - const types = t.FLIPPED_ALIAS_KEYS[type]; - code += `type ${NODE_PREFIX}${type} = ${types - .map(type => `${NODE_PREFIX}${type}`) - .join(" | ")};\n`; -} - -code += `\ndeclare module "@babel/types" { - ${lines - .join("\n") - .replace(/\n/g, "\n ") - .trim()} -}\n`; - -// - -process.stdout.write(code); diff --git a/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/typescript.js b/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/typescript.js deleted file mode 100644 index b6019ec373240d..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/@babel/types/scripts/generators/typescript.js +++ /dev/null @@ -1,200 +0,0 @@ -"use strict"; - -const t = require("../../"); -const stringifyValidator = require("../utils/stringifyValidator"); -const toFunctionName = require("../utils/toFunctionName"); - -let code = `// NOTE: This file is autogenerated. Do not modify. -// See packages/babel-types/scripts/generators/typescript.js for script used. - -interface BaseComment { - value: string; - start: number; - end: number; - loc: SourceLocation; - type: "CommentBlock" | "CommentLine"; -} - -export interface CommentBlock extends BaseComment { - type: "CommentBlock"; -} - -export interface CommentLine extends BaseComment { - type: "CommentLine"; -} - -export type Comment = CommentBlock | CommentLine; - -export interface SourceLocation { - start: { - line: number; - column: number; - }; - - end: { - line: number; - column: number; - }; -} - -interface BaseNode { - leadingComments: ReadonlyArray | null; - innerComments: ReadonlyArray | null; - trailingComments: ReadonlyArray | null; - start: number | null; - end: number | null; - loc: SourceLocation | null; - type: Node["type"]; -} - -export type Node = ${t.TYPES.sort().join(" | ")};\n\n`; - -// - -const lines = []; - -for (const type in t.NODE_FIELDS) { - const fields = t.NODE_FIELDS[type]; - const fieldNames = sortFieldNames(Object.keys(t.NODE_FIELDS[type]), type); - - const struct = ['type: "' + type + '";']; - const args = []; - - fieldNames.forEach(fieldName => { - const field = fields[fieldName]; - let typeAnnotation = stringifyValidator(field.validate, ""); - - if (isNullable(field) && !hasDefault(field)) { - typeAnnotation += " | null"; - } - - if (areAllRemainingFieldsNullable(fieldName, fieldNames, fields)) { - args.push( - `${t.toBindingIdentifierName(fieldName)}${ - isNullable(field) ? "?:" : ":" - } ${typeAnnotation}` - ); - } else { - args.push( - `${t.toBindingIdentifierName(fieldName)}: ${typeAnnotation}${ - isNullable(field) ? " | undefined" : "" - }` - ); - } - - const alphaNumeric = /^\w+$/; - - if (t.isValidIdentifier(fieldName) || alphaNumeric.test(fieldName)) { - struct.push(`${fieldName}: ${typeAnnotation};`); - } else { - struct.push(`"${fieldName}": ${typeAnnotation};`); - } - }); - - code += `export interface ${type} extends BaseNode { - ${struct.join("\n ").trim()} -}\n\n`; - - // super and import are reserved words in JavaScript - if (type !== "Super" && type !== "Import") { - lines.push( - `export function ${toFunctionName(type)}(${args.join(", ")}): ${type};` - ); - } -} - -for (let i = 0; i < t.TYPES.length; i++) { - let decl = `export function is${ - t.TYPES[i] - }(node: object | null | undefined, opts?: object | null): `; - - if (t.NODE_FIELDS[t.TYPES[i]]) { - decl += `node is ${t.TYPES[i]};`; - } else if (t.FLIPPED_ALIAS_KEYS[t.TYPES[i]]) { - decl += `node is ${t.TYPES[i]};`; - } else { - decl += `boolean;`; - } - - lines.push(decl); -} - -lines.push( - `export function validate(n: Node, key: string, value: any): void;`, - `export function clone(n: T): T;`, - `export function cloneDeep(n: T): T;`, - `export function removeProperties( - n: Node, - opts?: { preserveComments: boolean } | null -): void;`, - `export function removePropertiesDeep( - n: T, - opts?: { preserveComments: boolean } | null -): T;`, - `export type TraversalAncestors = ReadonlyArray<{ - node: Node, - key: string, - index?: number, - }>; - export type TraversalHandler = (node: Node, parent: TraversalAncestors, type: T) => void; - export type TraversalHandlers = { - enter?: TraversalHandler, - exit?: TraversalHandler, - };`.replace(/(^|\n) {2}/g, "$1"), - // eslint-disable-next-line - `export function traverse(n: Node, h: TraversalHandler | TraversalHandlers, state?: T): void;` -); - -for (const type in t.DEPRECATED_KEYS) { - code += `/** - * @deprecated Use \`${t.DEPRECATED_KEYS[type]}\` - */ -export type ${type} = ${t.DEPRECATED_KEYS[type]};\n -`; -} - -for (const type in t.FLIPPED_ALIAS_KEYS) { - const types = t.FLIPPED_ALIAS_KEYS[type]; - code += `export type ${type} = ${types - .map(type => `${type}`) - .join(" | ")};\n`; -} -code += "\n"; - -code += "export interface Aliases {\n"; -for (const type in t.FLIPPED_ALIAS_KEYS) { - code += ` ${type}: ${type};\n`; -} -code += "}\n\n"; - -code += lines.join("\n") + "\n"; - -// - -process.stdout.write(code); - -// - -function areAllRemainingFieldsNullable(fieldName, fieldNames, fields) { - const index = fieldNames.indexOf(fieldName); - return fieldNames.slice(index).every(_ => isNullable(fields[_])); -} - -function hasDefault(field) { - return field.default != null; -} - -function isNullable(field) { - return field.optional || hasDefault(field); -} - -function sortFieldNames(fields, type) { - return fields.sort((fieldA, fieldB) => { - const indexA = t.BUILDER_KEYS[type].indexOf(fieldA); - const indexB = t.BUILDER_KEYS[type].indexOf(fieldB); - if (indexA === indexB) return fieldA < fieldB ? -1 : 1; - if (indexA === -1) return 1; - if (indexB === -1) return -1; - return indexA - indexB; - }); -} diff --git a/tools/node_modules/babel-eslint/node_modules/ansi-styles/package.json b/tools/node_modules/babel-eslint/node_modules/ansi-styles/package.json deleted file mode 100644 index 5663ace24b4607..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/ansi-styles/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "ava": { - "require": "babel-polyfill" - }, - "bugs": { - "url": "https://github.com/chalk/ansi-styles/issues" - }, - "bundleDependencies": false, - "dependencies": { - "color-convert": "^1.9.0" - }, - "deprecated": false, - "description": "ANSI escape codes for styling strings in the terminal", - "devDependencies": { - "ava": "*", - "babel-polyfill": "^6.23.0", - "svg-term-cli": "^2.1.1", - "xo": "*" - }, - "engines": { - "node": ">=4" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/chalk/ansi-styles#readme", - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "license": "MIT", - "name": "ansi-styles", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/ansi-styles.git" - }, - "scripts": { - "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor", - "test": "xo && ava" - }, - "version": "3.2.1" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/chalk/package.json b/tools/node_modules/babel-eslint/node_modules/chalk/package.json deleted file mode 100644 index 270fecdc347d42..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/chalk/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "bugs": { - "url": "https://github.com/chalk/chalk/issues" - }, - "bundleDependencies": false, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "deprecated": false, - "description": "Terminal string styling done right", - "devDependencies": { - "ava": "*", - "coveralls": "^3.0.0", - "execa": "^0.9.0", - "flow-bin": "^0.68.0", - "import-fresh": "^2.0.0", - "matcha": "^0.7.0", - "nyc": "^11.0.2", - "resolve-from": "^4.0.0", - "typescript": "^2.5.3", - "xo": "*" - }, - "engines": { - "node": ">=4" - }, - "files": [ - "index.js", - "templates.js", - "types/index.d.ts", - "index.js.flow" - ], - "homepage": "https://github.com/chalk/chalk#readme", - "keywords": [ - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "str", - "ansi", - "style", - "styles", - "tty", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "license": "MIT", - "name": "chalk", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/chalk.git" - }, - "scripts": { - "bench": "matcha benchmark.js", - "coveralls": "nyc report --reporter=text-lcov | coveralls", - "test": "xo && tsc --project types && flow --max-warnings=0 && nyc ava" - }, - "types": "types/index.d.ts", - "version": "2.4.2", - "xo": { - "envs": [ - "node", - "mocha" - ], - "ignores": [ - "test/_flow.js" - ] - } -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/debug/dist/debug.js b/tools/node_modules/babel-eslint/node_modules/debug/dist/debug.js deleted file mode 100644 index 89ad0c2175c3d6..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/debug/dist/debug.js +++ /dev/null @@ -1,912 +0,0 @@ -"use strict"; - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -(function (f) { - if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") { - module.exports = f(); - } else if (typeof define === "function" && define.amd) { - define([], f); - } else { - var g; - - if (typeof window !== "undefined") { - g = window; - } else if (typeof global !== "undefined") { - g = global; - } else if (typeof self !== "undefined") { - g = self; - } else { - g = this; - } - - g.debug = f(); - } -})(function () { - var define, module, exports; - return function () { - function r(e, n, t) { - function o(i, f) { - if (!n[i]) { - if (!e[i]) { - var c = "function" == typeof require && require; - if (!f && c) return c(i, !0); - if (u) return u(i, !0); - var a = new Error("Cannot find module '" + i + "'"); - throw a.code = "MODULE_NOT_FOUND", a; - } - - var p = n[i] = { - exports: {} - }; - e[i][0].call(p.exports, function (r) { - var n = e[i][1][r]; - return o(n || r); - }, p, p.exports, r, e, n, t); - } - - return n[i].exports; - } - - for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) { - o(t[i]); - } - - return o; - } - - return r; - }()({ - 1: [function (require, module, exports) { - /** - * Helpers. - */ - var s = 1000; - var m = s * 60; - var h = m * 60; - var d = h * 24; - var w = d * 7; - var y = d * 365.25; - /** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} [options] - * @throws {Error} throw an error if val is not a non-empty string or a number - * @return {String|Number} - * @api public - */ - - module.exports = function (val, options) { - options = options || {}; - - var type = _typeof(val); - - if (type === 'string' && val.length > 0) { - return parse(val); - } else if (type === 'number' && isNaN(val) === false) { - return options.long ? fmtLong(val) : fmtShort(val); - } - - throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)); - }; - /** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - - - function parse(str) { - str = String(str); - - if (str.length > 100) { - return; - } - - var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str); - - if (!match) { - return; - } - - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - - case 'weeks': - case 'week': - case 'w': - return n * w; - - case 'days': - case 'day': - case 'd': - return n * d; - - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - - default: - return undefined; - } - } - /** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - - - function fmtShort(ms) { - var msAbs = Math.abs(ms); - - if (msAbs >= d) { - return Math.round(ms / d) + 'd'; - } - - if (msAbs >= h) { - return Math.round(ms / h) + 'h'; - } - - if (msAbs >= m) { - return Math.round(ms / m) + 'm'; - } - - if (msAbs >= s) { - return Math.round(ms / s) + 's'; - } - - return ms + 'ms'; - } - /** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - - - function fmtLong(ms) { - var msAbs = Math.abs(ms); - - if (msAbs >= d) { - return plural(ms, msAbs, d, 'day'); - } - - if (msAbs >= h) { - return plural(ms, msAbs, h, 'hour'); - } - - if (msAbs >= m) { - return plural(ms, msAbs, m, 'minute'); - } - - if (msAbs >= s) { - return plural(ms, msAbs, s, 'second'); - } - - return ms + ' ms'; - } - /** - * Pluralization helper. - */ - - - function plural(ms, msAbs, n, name) { - var isPlural = msAbs >= n * 1.5; - return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); - } - }, {}], - 2: [function (require, module, exports) { - // shim for using process in browser - var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it - // don't break things. But we need to wrap it in a try catch in case it is - // wrapped in strict mode code which doesn't define any globals. It's inside a - // function because try/catches deoptimize in certain engines. - - var cachedSetTimeout; - var cachedClearTimeout; - - function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); - } - - function defaultClearTimeout() { - throw new Error('clearTimeout has not been defined'); - } - - (function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } - })(); - - function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } // if setTimeout wasn't available but was latter defined - - - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - } - - function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } // if clearTimeout wasn't available but was latter defined - - - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - } - - var queue = []; - var draining = false; - var currentQueue; - var queueIndex = -1; - - function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - - draining = false; - - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - - if (queue.length) { - drainQueue(); - } - } - - function drainQueue() { - if (draining) { - return; - } - - var timeout = runTimeout(cleanUpNextTick); - draining = true; - var len = queue.length; - - while (len) { - currentQueue = queue; - queue = []; - - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - - queueIndex = -1; - len = queue.length; - } - - currentQueue = null; - draining = false; - runClearTimeout(timeout); - } - - process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - - queue.push(new Item(fun, args)); - - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } - }; // v8 likes predictible objects - - - function Item(fun, array) { - this.fun = fun; - this.array = array; - } - - Item.prototype.run = function () { - this.fun.apply(null, this.array); - }; - - process.title = 'browser'; - process.browser = true; - process.env = {}; - process.argv = []; - process.version = ''; // empty string to avoid regexp issues - - process.versions = {}; - - function noop() {} - - process.on = noop; - process.addListener = noop; - process.once = noop; - process.off = noop; - process.removeListener = noop; - process.removeAllListeners = noop; - process.emit = noop; - process.prependListener = noop; - process.prependOnceListener = noop; - - process.listeners = function (name) { - return []; - }; - - process.binding = function (name) { - throw new Error('process.binding is not supported'); - }; - - process.cwd = function () { - return '/'; - }; - - process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); - }; - - process.umask = function () { - return 0; - }; - }, {}], - 3: [function (require, module, exports) { - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - */ - function setup(env) { - createDebug.debug = createDebug; - createDebug.default = createDebug; - createDebug.coerce = coerce; - createDebug.disable = disable; - createDebug.enable = enable; - createDebug.enabled = enabled; - createDebug.humanize = require('ms'); - Object.keys(env).forEach(function (key) { - createDebug[key] = env[key]; - }); - /** - * Active `debug` instances. - */ - - createDebug.instances = []; - /** - * The currently active debug mode names, and names to skip. - */ - - createDebug.names = []; - createDebug.skips = []; - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". - */ - - createDebug.formatters = {}; - /** - * Selects a color for a debug namespace - * @param {String} namespace The namespace string for the for the debug instance to be colored - * @return {Number|String} An ANSI color code for the given namespace - * @api private - */ - - function selectColor(namespace) { - var hash = 0; - - for (var i = 0; i < namespace.length; i++) { - hash = (hash << 5) - hash + namespace.charCodeAt(i); - hash |= 0; // Convert to 32bit integer - } - - return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; - } - - createDebug.selectColor = selectColor; - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - - function createDebug(namespace) { - var prevTime; - - function debug() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - // Disabled? - if (!debug.enabled) { - return; - } - - var self = debug; // Set `diff` timestamp - - var curr = Number(new Date()); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - args[0] = createDebug.coerce(args[0]); - - if (typeof args[0] !== 'string') { - // Anything else let's inspect with %O - args.unshift('%O'); - } // Apply any `formatters` transformations - - - var index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { - // If we encounter an escaped % then don't increase the array index - if (match === '%%') { - return match; - } - - index++; - var formatter = createDebug.formatters[format]; - - if (typeof formatter === 'function') { - var val = args[index]; - match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` - - args.splice(index, 1); - index--; - } - - return match; - }); // Apply env-specific formatting (colors, etc.) - - createDebug.formatArgs.call(self, args); - var logFn = self.log || createDebug.log; - logFn.apply(self, args); - } - - debug.namespace = namespace; - debug.enabled = createDebug.enabled(namespace); - debug.useColors = createDebug.useColors(); - debug.color = selectColor(namespace); - debug.destroy = destroy; - debug.extend = extend; // Debug.formatArgs = formatArgs; - // debug.rawLog = rawLog; - // env-specific initialization logic for debug instances - - if (typeof createDebug.init === 'function') { - createDebug.init(debug); - } - - createDebug.instances.push(debug); - return debug; - } - - function destroy() { - var index = createDebug.instances.indexOf(this); - - if (index !== -1) { - createDebug.instances.splice(index, 1); - return true; - } - - return false; - } - - function extend(namespace, delimiter) { - var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); - newDebug.log = this.log; - return newDebug; - } - /** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - - - function enable(namespaces) { - createDebug.save(namespaces); - createDebug.names = []; - createDebug.skips = []; - var i; - var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); - var len = split.length; - - for (i = 0; i < len; i++) { - if (!split[i]) { - // ignore empty strings - continue; - } - - namespaces = split[i].replace(/\*/g, '.*?'); - - if (namespaces[0] === '-') { - createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - createDebug.names.push(new RegExp('^' + namespaces + '$')); - } - } - - for (i = 0; i < createDebug.instances.length; i++) { - var instance = createDebug.instances[i]; - instance.enabled = createDebug.enabled(instance.namespace); - } - } - /** - * Disable debug output. - * - * @return {String} namespaces - * @api public - */ - - - function disable() { - var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) { - return '-' + namespace; - }))).join(','); - createDebug.enable(''); - return namespaces; - } - /** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - - - function enabled(name) { - if (name[name.length - 1] === '*') { - return true; - } - - var i; - var len; - - for (i = 0, len = createDebug.skips.length; i < len; i++) { - if (createDebug.skips[i].test(name)) { - return false; - } - } - - for (i = 0, len = createDebug.names.length; i < len; i++) { - if (createDebug.names[i].test(name)) { - return true; - } - } - - return false; - } - /** - * Convert regexp to namespace - * - * @param {RegExp} regxep - * @return {String} namespace - * @api private - */ - - - function toNamespace(regexp) { - return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*'); - } - /** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - - - function coerce(val) { - if (val instanceof Error) { - return val.stack || val.message; - } - - return val; - } - - createDebug.enable(createDebug.load()); - return createDebug; - } - - module.exports = setup; - }, { - "ms": 1 - }], - 4: [function (require, module, exports) { - (function (process) { - /* eslint-env browser */ - - /** - * This is the web browser implementation of `debug()`. - */ - exports.log = log; - exports.formatArgs = formatArgs; - exports.save = save; - exports.load = load; - exports.useColors = useColors; - exports.storage = localstorage(); - /** - * Colors. - */ - - exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; - /** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - // eslint-disable-next-line complexity - - function useColors() { - // NB: In an Electron preload script, document will be defined but not fully - // initialized. Since we know we're in Chrome, we'll just detect this case - // explicitly - if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { - return true; - } // Internet Explorer and Edge do not support colors. - - - if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { - return false; - } // Is webkit? http://stackoverflow.com/a/16459606/376773 - // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - - - return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 - typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker - typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); - } - /** - * Colorize log arguments if enabled. - * - * @api public - */ - - - function formatArgs(args) { - args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); - - if (!this.useColors) { - return; - } - - var c = 'color: ' + this.color; - args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - - var index = 0; - var lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, function (match) { - if (match === '%%') { - return; - } - - index++; - - if (match === '%c') { - // We only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - args.splice(lastC, 0, c); - } - /** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - - - function log() { - var _console; - - // This hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); - } - /** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - - - function save(namespaces) { - try { - if (namespaces) { - exports.storage.setItem('debug', namespaces); - } else { - exports.storage.removeItem('debug'); - } - } catch (error) {// Swallow - // XXX (@Qix-) should we be logging these? - } - } - /** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - - - function load() { - var r; - - try { - r = exports.storage.getItem('debug'); - } catch (error) {} // Swallow - // XXX (@Qix-) should we be logging these? - // If debug isn't set in LS, and we're in Electron, try to load $DEBUG - - - if (!r && typeof process !== 'undefined' && 'env' in process) { - r = process.env.DEBUG; - } - - return r; - } - /** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ - - - function localstorage() { - try { - // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context - // The Browser also has localStorage in the global context. - return localStorage; - } catch (error) {// Swallow - // XXX (@Qix-) should we be logging these? - } - } - - module.exports = require('./common')(exports); - var formatters = module.exports.formatters; - /** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - - formatters.j = function (v) { - try { - return JSON.stringify(v); - } catch (error) { - return '[UnexpectedJSONParseError]: ' + error.message; - } - }; - }).call(this, require('_process')); - }, { - "./common": 3, - "_process": 2 - }] - }, {}, [4])(4); -}); diff --git a/tools/node_modules/babel-eslint/node_modules/debug/package.json b/tools/node_modules/babel-eslint/node_modules/debug/package.json deleted file mode 100644 index 7bc94f7f061070..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/debug/package.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "browser": "./src/browser.js", - "bugs": { - "url": "https://github.com/visionmedia/debug/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io" - }, - { - "name": "Andrew Rhyne", - "email": "rhyneandrew@gmail.com" - } - ], - "dependencies": { - "ms": "^2.1.1" - }, - "deprecated": false, - "description": "small debugging utility", - "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "browserify": "14.4.0", - "chai": "^3.5.0", - "concurrently": "^3.1.0", - "coveralls": "^3.0.2", - "istanbul": "^0.4.5", - "karma": "^3.0.0", - "karma-chai": "^0.1.0", - "karma-mocha": "^1.3.0", - "karma-phantomjs-launcher": "^1.0.2", - "mocha": "^5.2.0", - "mocha-lcov-reporter": "^1.2.0", - "rimraf": "^2.5.4", - "xo": "^0.23.0" - }, - "files": [ - "src", - "dist/debug.js", - "LICENSE", - "README.md" - ], - "homepage": "https://github.com/visionmedia/debug#readme", - "keywords": [ - "debug", - "log", - "debugger" - ], - "license": "MIT", - "main": "./src/index.js", - "name": "debug", - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/debug.git" - }, - "scripts": { - "build": "npm run build:debug && npm run build:test", - "build:debug": "babel -o dist/debug.js dist/debug.es6.js > dist/debug.js", - "build:test": "babel -d dist test.js", - "clean": "rimraf dist coverage", - "lint": "xo", - "prebuild:debug": "mkdir -p dist && browserify --standalone debug -o dist/debug.es6.js .", - "pretest:browser": "npm run build", - "test": "npm run test:node && npm run test:browser", - "test:browser": "karma start --single-run", - "test:coverage": "cat ./coverage/lcov.info | coveralls", - "test:node": "istanbul cover _mocha -- test.js" - }, - "unpkg": "./dist/debug.js", - "version": "4.1.1" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/escape-string-regexp/package.json b/tools/node_modules/babel-eslint/node_modules/escape-string-regexp/package.json deleted file mode 100644 index ced6973347e903..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/escape-string-regexp/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/escape-string-regexp/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Escape RegExp special characters", - "devDependencies": { - "ava": "*", - "xo": "*" - }, - "engines": { - "node": ">=0.8.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/sindresorhus/escape-string-regexp#readme", - "keywords": [ - "escape", - "regex", - "regexp", - "re", - "regular", - "expression", - "string", - "str", - "special", - "characters" - ], - "license": "MIT", - "maintainers": [ - { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - { - "name": "Joshua Boy Nicolai Appelman", - "email": "joshua@jbna.nl", - "url": "jbna.nl" - } - ], - "name": "escape-string-regexp", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/escape-string-regexp.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "1.0.5" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/esutils/README.md b/tools/node_modules/babel-eslint/node_modules/esutils/README.md deleted file mode 100644 index 517526cfb99b97..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/esutils/README.md +++ /dev/null @@ -1,174 +0,0 @@ -### esutils [![Build Status](https://secure.travis-ci.org/estools/esutils.svg)](http://travis-ci.org/estools/esutils) -esutils ([esutils](http://github.com/estools/esutils)) is -utility box for ECMAScript language tools. - -### API - -### ast - -#### ast.isExpression(node) - -Returns true if `node` is an Expression as defined in ECMA262 edition 5.1 section -[11](https://es5.github.io/#x11). - -#### ast.isStatement(node) - -Returns true if `node` is a Statement as defined in ECMA262 edition 5.1 section -[12](https://es5.github.io/#x12). - -#### ast.isIterationStatement(node) - -Returns true if `node` is an IterationStatement as defined in ECMA262 edition -5.1 section [12.6](https://es5.github.io/#x12.6). - -#### ast.isSourceElement(node) - -Returns true if `node` is a SourceElement as defined in ECMA262 edition 5.1 -section [14](https://es5.github.io/#x14). - -#### ast.trailingStatement(node) - -Returns `Statement?` if `node` has trailing `Statement`. -```js -if (cond) - consequent; -``` -When taking this `IfStatement`, returns `consequent;` statement. - -#### ast.isProblematicIfStatement(node) - -Returns true if `node` is a problematic IfStatement. If `node` is a problematic `IfStatement`, `node` cannot be represented as an one on one JavaScript code. -```js -{ - type: 'IfStatement', - consequent: { - type: 'WithStatement', - body: { - type: 'IfStatement', - consequent: {type: 'EmptyStatement'} - } - }, - alternate: {type: 'EmptyStatement'} -} -``` -The above node cannot be represented as a JavaScript code, since the top level `else` alternate belongs to an inner `IfStatement`. - - -### code - -#### code.isDecimalDigit(code) - -Return true if provided code is decimal digit. - -#### code.isHexDigit(code) - -Return true if provided code is hexadecimal digit. - -#### code.isOctalDigit(code) - -Return true if provided code is octal digit. - -#### code.isWhiteSpace(code) - -Return true if provided code is white space. White space characters are formally defined in ECMA262. - -#### code.isLineTerminator(code) - -Return true if provided code is line terminator. Line terminator characters are formally defined in ECMA262. - -#### code.isIdentifierStart(code) - -Return true if provided code can be the first character of ECMA262 Identifier. They are formally defined in ECMA262. - -#### code.isIdentifierPart(code) - -Return true if provided code can be the trailing character of ECMA262 Identifier. They are formally defined in ECMA262. - -### keyword - -#### keyword.isKeywordES5(id, strict) - -Returns `true` if provided identifier string is a Keyword or Future Reserved Word -in ECMA262 edition 5.1. They are formally defined in ECMA262 sections -[7.6.1.1](http://es5.github.io/#x7.6.1.1) and [7.6.1.2](http://es5.github.io/#x7.6.1.2), -respectively. If the `strict` flag is truthy, this function additionally checks whether -`id` is a Keyword or Future Reserved Word under strict mode. - -#### keyword.isKeywordES6(id, strict) - -Returns `true` if provided identifier string is a Keyword or Future Reserved Word -in ECMA262 edition 6. They are formally defined in ECMA262 sections -[11.6.2.1](http://ecma-international.org/ecma-262/6.0/#sec-keywords) and -[11.6.2.2](http://ecma-international.org/ecma-262/6.0/#sec-future-reserved-words), -respectively. If the `strict` flag is truthy, this function additionally checks whether -`id` is a Keyword or Future Reserved Word under strict mode. - -#### keyword.isReservedWordES5(id, strict) - -Returns `true` if provided identifier string is a Reserved Word in ECMA262 edition 5.1. -They are formally defined in ECMA262 section [7.6.1](http://es5.github.io/#x7.6.1). -If the `strict` flag is truthy, this function additionally checks whether `id` -is a Reserved Word under strict mode. - -#### keyword.isReservedWordES6(id, strict) - -Returns `true` if provided identifier string is a Reserved Word in ECMA262 edition 6. -They are formally defined in ECMA262 section [11.6.2](http://ecma-international.org/ecma-262/6.0/#sec-reserved-words). -If the `strict` flag is truthy, this function additionally checks whether `id` -is a Reserved Word under strict mode. - -#### keyword.isRestrictedWord(id) - -Returns `true` if provided identifier string is one of `eval` or `arguments`. -They are restricted in strict mode code throughout ECMA262 edition 5.1 and -in ECMA262 edition 6 section [12.1.1](http://ecma-international.org/ecma-262/6.0/#sec-identifiers-static-semantics-early-errors). - -#### keyword.isIdentifierNameES5(id) - -Return true if provided identifier string is an IdentifierName as specified in -ECMA262 edition 5.1 section [7.6](https://es5.github.io/#x7.6). - -#### keyword.isIdentifierNameES6(id) - -Return true if provided identifier string is an IdentifierName as specified in -ECMA262 edition 6 section [11.6](http://ecma-international.org/ecma-262/6.0/#sec-names-and-keywords). - -#### keyword.isIdentifierES5(id, strict) - -Return true if provided identifier string is an Identifier as specified in -ECMA262 edition 5.1 section [7.6](https://es5.github.io/#x7.6). If the `strict` -flag is truthy, this function additionally checks whether `id` is an Identifier -under strict mode. - -#### keyword.isIdentifierES6(id, strict) - -Return true if provided identifier string is an Identifier as specified in -ECMA262 edition 6 section [12.1](http://ecma-international.org/ecma-262/6.0/#sec-identifiers). -If the `strict` flag is truthy, this function additionally checks whether `id` -is an Identifier under strict mode. - -### License - -Copyright (C) 2013 [Yusuke Suzuki](http://github.com/Constellation) - (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tools/node_modules/babel-eslint/node_modules/esutils/lib/ast.js b/tools/node_modules/babel-eslint/node_modules/esutils/lib/ast.js deleted file mode 100644 index 8faadae1ce736d..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/esutils/lib/ast.js +++ /dev/null @@ -1,144 +0,0 @@ -/* - Copyright (C) 2013 Yusuke Suzuki - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -(function () { - 'use strict'; - - function isExpression(node) { - if (node == null) { return false; } - switch (node.type) { - case 'ArrayExpression': - case 'AssignmentExpression': - case 'BinaryExpression': - case 'CallExpression': - case 'ConditionalExpression': - case 'FunctionExpression': - case 'Identifier': - case 'Literal': - case 'LogicalExpression': - case 'MemberExpression': - case 'NewExpression': - case 'ObjectExpression': - case 'SequenceExpression': - case 'ThisExpression': - case 'UnaryExpression': - case 'UpdateExpression': - return true; - } - return false; - } - - function isIterationStatement(node) { - if (node == null) { return false; } - switch (node.type) { - case 'DoWhileStatement': - case 'ForInStatement': - case 'ForStatement': - case 'WhileStatement': - return true; - } - return false; - } - - function isStatement(node) { - if (node == null) { return false; } - switch (node.type) { - case 'BlockStatement': - case 'BreakStatement': - case 'ContinueStatement': - case 'DebuggerStatement': - case 'DoWhileStatement': - case 'EmptyStatement': - case 'ExpressionStatement': - case 'ForInStatement': - case 'ForStatement': - case 'IfStatement': - case 'LabeledStatement': - case 'ReturnStatement': - case 'SwitchStatement': - case 'ThrowStatement': - case 'TryStatement': - case 'VariableDeclaration': - case 'WhileStatement': - case 'WithStatement': - return true; - } - return false; - } - - function isSourceElement(node) { - return isStatement(node) || node != null && node.type === 'FunctionDeclaration'; - } - - function trailingStatement(node) { - switch (node.type) { - case 'IfStatement': - if (node.alternate != null) { - return node.alternate; - } - return node.consequent; - - case 'LabeledStatement': - case 'ForStatement': - case 'ForInStatement': - case 'WhileStatement': - case 'WithStatement': - return node.body; - } - return null; - } - - function isProblematicIfStatement(node) { - var current; - - if (node.type !== 'IfStatement') { - return false; - } - if (node.alternate == null) { - return false; - } - current = node.consequent; - do { - if (current.type === 'IfStatement') { - if (current.alternate == null) { - return true; - } - } - current = trailingStatement(current); - } while (current); - - return false; - } - - module.exports = { - isExpression: isExpression, - isStatement: isStatement, - isIterationStatement: isIterationStatement, - isSourceElement: isSourceElement, - isProblematicIfStatement: isProblematicIfStatement, - - trailingStatement: trailingStatement - }; -}()); -/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/tools/node_modules/babel-eslint/node_modules/esutils/lib/code.js b/tools/node_modules/babel-eslint/node_modules/esutils/lib/code.js deleted file mode 100644 index 23136af91f9fbc..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/esutils/lib/code.js +++ /dev/null @@ -1,135 +0,0 @@ -/* - Copyright (C) 2013-2014 Yusuke Suzuki - Copyright (C) 2014 Ivan Nikulin - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -(function () { - 'use strict'; - - var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch; - - // See `tools/generate-identifier-regex.js`. - ES5Regex = { - // ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierStart: - NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/, - // ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierPart: - NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/ - }; - - ES6Regex = { - // ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierStart: - NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/, - // ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierPart: - NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ - }; - - function isDecimalDigit(ch) { - return 0x30 <= ch && ch <= 0x39; // 0..9 - } - - function isHexDigit(ch) { - return 0x30 <= ch && ch <= 0x39 || // 0..9 - 0x61 <= ch && ch <= 0x66 || // a..f - 0x41 <= ch && ch <= 0x46; // A..F - } - - function isOctalDigit(ch) { - return ch >= 0x30 && ch <= 0x37; // 0..7 - } - - // 7.2 White Space - - NON_ASCII_WHITESPACES = [ - 0x1680, - 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, - 0x202F, 0x205F, - 0x3000, - 0xFEFF - ]; - - function isWhiteSpace(ch) { - return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || - ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0; - } - - // 7.3 Line Terminators - - function isLineTerminator(ch) { - return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029; - } - - // 7.6 Identifier Names and Identifiers - - function fromCodePoint(cp) { - if (cp <= 0xFFFF) { return String.fromCharCode(cp); } - var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800); - var cu2 = String.fromCharCode(((cp - 0x10000) % 0x400) + 0xDC00); - return cu1 + cu2; - } - - IDENTIFIER_START = new Array(0x80); - for(ch = 0; ch < 0x80; ++ch) { - IDENTIFIER_START[ch] = - ch >= 0x61 && ch <= 0x7A || // a..z - ch >= 0x41 && ch <= 0x5A || // A..Z - ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore) - } - - IDENTIFIER_PART = new Array(0x80); - for(ch = 0; ch < 0x80; ++ch) { - IDENTIFIER_PART[ch] = - ch >= 0x61 && ch <= 0x7A || // a..z - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x30 && ch <= 0x39 || // 0..9 - ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore) - } - - function isIdentifierStartES5(ch) { - return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch)); - } - - function isIdentifierPartES5(ch) { - return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch)); - } - - function isIdentifierStartES6(ch) { - return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch)); - } - - function isIdentifierPartES6(ch) { - return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch)); - } - - module.exports = { - isDecimalDigit: isDecimalDigit, - isHexDigit: isHexDigit, - isOctalDigit: isOctalDigit, - isWhiteSpace: isWhiteSpace, - isLineTerminator: isLineTerminator, - isIdentifierStartES5: isIdentifierStartES5, - isIdentifierPartES5: isIdentifierPartES5, - isIdentifierStartES6: isIdentifierStartES6, - isIdentifierPartES6: isIdentifierPartES6 - }; -}()); -/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/tools/node_modules/babel-eslint/node_modules/esutils/lib/keyword.js b/tools/node_modules/babel-eslint/node_modules/esutils/lib/keyword.js deleted file mode 100644 index 13c8c6a967caf0..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/esutils/lib/keyword.js +++ /dev/null @@ -1,165 +0,0 @@ -/* - Copyright (C) 2013 Yusuke Suzuki - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -(function () { - 'use strict'; - - var code = require('./code'); - - function isStrictModeReservedWordES6(id) { - switch (id) { - case 'implements': - case 'interface': - case 'package': - case 'private': - case 'protected': - case 'public': - case 'static': - case 'let': - return true; - default: - return false; - } - } - - function isKeywordES5(id, strict) { - // yield should not be treated as keyword under non-strict mode. - if (!strict && id === 'yield') { - return false; - } - return isKeywordES6(id, strict); - } - - function isKeywordES6(id, strict) { - if (strict && isStrictModeReservedWordES6(id)) { - return true; - } - - switch (id.length) { - case 2: - return (id === 'if') || (id === 'in') || (id === 'do'); - case 3: - return (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try'); - case 4: - return (id === 'this') || (id === 'else') || (id === 'case') || - (id === 'void') || (id === 'with') || (id === 'enum'); - case 5: - return (id === 'while') || (id === 'break') || (id === 'catch') || - (id === 'throw') || (id === 'const') || (id === 'yield') || - (id === 'class') || (id === 'super'); - case 6: - return (id === 'return') || (id === 'typeof') || (id === 'delete') || - (id === 'switch') || (id === 'export') || (id === 'import'); - case 7: - return (id === 'default') || (id === 'finally') || (id === 'extends'); - case 8: - return (id === 'function') || (id === 'continue') || (id === 'debugger'); - case 10: - return (id === 'instanceof'); - default: - return false; - } - } - - function isReservedWordES5(id, strict) { - return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict); - } - - function isReservedWordES6(id, strict) { - return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict); - } - - function isRestrictedWord(id) { - return id === 'eval' || id === 'arguments'; - } - - function isIdentifierNameES5(id) { - var i, iz, ch; - - if (id.length === 0) { return false; } - - ch = id.charCodeAt(0); - if (!code.isIdentifierStartES5(ch)) { - return false; - } - - for (i = 1, iz = id.length; i < iz; ++i) { - ch = id.charCodeAt(i); - if (!code.isIdentifierPartES5(ch)) { - return false; - } - } - return true; - } - - function decodeUtf16(lead, trail) { - return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; - } - - function isIdentifierNameES6(id) { - var i, iz, ch, lowCh, check; - - if (id.length === 0) { return false; } - - check = code.isIdentifierStartES6; - for (i = 0, iz = id.length; i < iz; ++i) { - ch = id.charCodeAt(i); - if (0xD800 <= ch && ch <= 0xDBFF) { - ++i; - if (i >= iz) { return false; } - lowCh = id.charCodeAt(i); - if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) { - return false; - } - ch = decodeUtf16(ch, lowCh); - } - if (!check(ch)) { - return false; - } - check = code.isIdentifierPartES6; - } - return true; - } - - function isIdentifierES5(id, strict) { - return isIdentifierNameES5(id) && !isReservedWordES5(id, strict); - } - - function isIdentifierES6(id, strict) { - return isIdentifierNameES6(id) && !isReservedWordES6(id, strict); - } - - module.exports = { - isKeywordES5: isKeywordES5, - isKeywordES6: isKeywordES6, - isReservedWordES5: isReservedWordES5, - isReservedWordES6: isReservedWordES6, - isRestrictedWord: isRestrictedWord, - isIdentifierNameES5: isIdentifierNameES5, - isIdentifierNameES6: isIdentifierNameES6, - isIdentifierES5: isIdentifierES5, - isIdentifierES6: isIdentifierES6 - }; -}()); -/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/tools/node_modules/babel-eslint/node_modules/esutils/lib/utils.js b/tools/node_modules/babel-eslint/node_modules/esutils/lib/utils.js deleted file mode 100644 index ce18faa6bc80fa..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/esutils/lib/utils.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2013 Yusuke Suzuki - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -(function () { - 'use strict'; - - exports.ast = require('./ast'); - exports.code = require('./code'); - exports.keyword = require('./keyword'); -}()); -/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/tools/node_modules/babel-eslint/node_modules/esutils/package.json b/tools/node_modules/babel-eslint/node_modules/esutils/package.json deleted file mode 100644 index cffa439c8dafce..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/esutils/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "bugs": { - "url": "https://github.com/estools/esutils/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "utility box for ECMAScript language tools", - "devDependencies": { - "chai": "~1.7.2", - "coffee-script": "~1.6.3", - "jshint": "2.6.3", - "mocha": "~2.2.1", - "regenerate": "~1.3.1", - "unicode-9.0.0": "~0.7.0" - }, - "directories": { - "lib": "./lib" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "LICENSE.BSD", - "README.md", - "lib" - ], - "homepage": "https://github.com/estools/esutils", - "license": "BSD-2-Clause", - "main": "lib/utils.js", - "maintainers": [ - { - "name": "Yusuke Suzuki", - "email": "utatane.tea@gmail.com", - "url": "http://github.com/Constellation" - } - ], - "name": "esutils", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/estools/esutils.git" - }, - "scripts": { - "generate-regex": "node tools/generate-identifier-regex.js", - "lint": "jshint lib/*.js", - "test": "npm run-script lint && npm run-script unit-test", - "unit-test": "mocha --compilers coffee:coffee-script -R spec" - }, - "version": "2.0.3" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/globals/package.json b/tools/node_modules/babel-eslint/node_modules/globals/package.json deleted file mode 100644 index ae094f3054063e..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/globals/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/globals/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Global identifiers from different JavaScript environments", - "devDependencies": { - "ava": "0.21.0", - "xo": "0.18.0" - }, - "engines": { - "node": ">=4" - }, - "files": [ - "index.js", - "globals.json" - ], - "homepage": "https://github.com/sindresorhus/globals#readme", - "keywords": [ - "globals", - "global", - "identifiers", - "variables", - "vars", - "jshint", - "eslint", - "environments" - ], - "license": "MIT", - "name": "globals", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/globals.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "11.12.0", - "xo": { - "ignores": [ - "get-browser-globals.js" - ] - } -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/core.min.js b/tools/node_modules/babel-eslint/node_modules/lodash/core.min.js deleted file mode 100644 index bb543ff54abc0a..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/lodash/core.min.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @license - * Lodash (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE - * Build: `lodash core -o ./dist/lodash.core.js` - */ -;(function(){function n(n){return H(n)&&pn.call(n,"callee")&&!yn.call(n,"callee")}function t(n,t){return n.push.apply(n,t),n}function r(n){return function(t){return null==t?Z:t[n]}}function e(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function u(n,t){return j(t,function(t){return n[t]})}function o(n){return n instanceof i?n:new i(n)}function i(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function c(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function"); -return setTimeout(function(){n.apply(Z,r)},t)}function f(n,t){var r=true;return mn(n,function(n,e,u){return r=!!t(n,e,u)}),r}function a(n,t,r){for(var e=-1,u=n.length;++et}function b(n,t,r,e,u){return n===t||(null==n||null==t||!H(n)&&!H(t)?n!==n&&t!==t:y(n,t,r,e,b,u))}function y(n,t,r,e,u,o){var i=Nn(n),c=Nn(t),f=i?"[object Array]":hn.call(n),a=c?"[object Array]":hn.call(t),f="[object Arguments]"==f?"[object Object]":f,a="[object Arguments]"==a?"[object Object]":a,l="[object Object]"==f,c="[object Object]"==a,a=f==a;o||(o=[]);var p=An(o,function(t){return t[0]==n}),s=An(o,function(n){ -return n[0]==t});if(p&&s)return p[1]==t;if(o.push([n,t]),o.push([t,n]),a&&!l){if(i)r=T(n,t,r,e,u,o);else n:{switch(f){case"[object Boolean]":case"[object Date]":case"[object Number]":r=J(+n,+t);break n;case"[object Error]":r=n.name==t.name&&n.message==t.message;break n;case"[object RegExp]":case"[object String]":r=n==t+"";break n}r=false}return o.pop(),r}return 1&r||(i=l&&pn.call(n,"__wrapped__"),f=c&&pn.call(t,"__wrapped__"),!i&&!f)?!!a&&(r=B(n,t,r,e,u,o),o.pop(),r):(i=i?n.value():n,f=f?t.value():t, -r=u(i,f,r,e,o),o.pop(),r)}function g(n){return typeof n=="function"?n:null==n?X:(typeof n=="object"?d:r)(n)}function _(n,t){return nt&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++ei))return false;for(var c=-1,f=true,a=2&r?[]:Z;++cr?jn(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++rarguments.length,mn)}function G(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=Fn(n), -function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=Z),r}}function J(n,t){return n===t||n!==n&&t!==t}function M(n){var t;return(t=null!=n)&&(t=n.length,t=typeof t=="number"&&-1=t),t&&!U(n)}function U(n){return!!V(n)&&(n=hn.call(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function V(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function H(n){return null!=n&&typeof n=="object"}function K(n){ -return typeof n=="number"||H(n)&&"[object Number]"==hn.call(n)}function L(n){return typeof n=="string"||!Nn(n)&&H(n)&&"[object String]"==hn.call(n)}function Q(n){return typeof n=="string"?n:null==n?"":n+""}function W(n){return null==n?[]:u(n,Dn(n))}function X(n){return n}function Y(n,r,e){var u=Dn(r),o=h(r,u);null!=e||V(r)&&(o.length||!u.length)||(e=r,r=n,n=this,o=h(r,Dn(r)));var i=!(V(e)&&"chain"in e&&!e.chain),c=U(n);return mn(o,function(e){var u=r[e];n[e]=u,c&&(n.prototype[e]=function(){var r=this.__chain__; -if(i||r){var e=n(this.__wrapped__);return(e.__actions__=A(this.__actions__)).push({func:u,args:arguments,thisArg:n}),e.__chain__=r,e}return u.apply(n,t([this.value()],arguments))})}),n}var Z,nn=1/0,tn=/[&<>"']/g,rn=RegExp(tn.source),en=/^(?:0|[1-9]\d*)$/,un=typeof self=="object"&&self&&self.Object===Object&&self,on=typeof global=="object"&&global&&global.Object===Object&&global||un||Function("return this")(),cn=(un=typeof exports=="object"&&exports&&!exports.nodeType&&exports)&&typeof module=="object"&&module&&!module.nodeType&&module,fn=function(n){ -return function(t){return null==n?Z:n[t]}}({"&":"&","<":"<",">":">",'"':""","'":"'"}),an=Array.prototype,ln=Object.prototype,pn=ln.hasOwnProperty,sn=0,hn=ln.toString,vn=on._,bn=Object.create,yn=ln.propertyIsEnumerable,gn=on.isFinite,_n=function(n,t){return function(r){return n(t(r))}}(Object.keys,Object),jn=Math.max,dn=function(){function n(){}return function(t){return V(t)?bn?bn(t):(n.prototype=t,t=new n,n.prototype=Z,t):{}}}();i.prototype=dn(o.prototype),i.prototype.constructor=i; -var mn=function(n,t){return function(r,e){if(null==r)return r;if(!M(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++or&&(r=jn(e+r,0));n:{for(t=g(t),e=n.length,r+=-1;++re||o&&c&&a||!u&&a||!i){r=1;break n}if(!o&&r"']/g,G=RegExp(V.source),H=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nn=/^\w*$/,tn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rn=/[\\^$.*+?()[\]{}|]/g,en=RegExp(rn.source),un=/^\s+|\s+$/g,on=/^\s+/,fn=/\s+$/,cn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,an=/\{\n\/\* \[wrapped with (.+)\] \*/,ln=/,? & /,sn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,hn=/\\(\\)?/g,pn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_n=/\w*$/,vn=/^[-+]0x[0-9a-f]+$/i,gn=/^0b[01]+$/i,dn=/^\[object .+?Constructor\]$/,yn=/^0o[0-7]+$/i,bn=/^(?:0|[1-9]\d*)$/,xn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,jn=/($^)/,wn=/['\n\r\u2028\u2029\\]/g,mn="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",An="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+mn,En="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",kn=RegExp("['\u2019]","g"),Sn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),On=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+En+mn,"g"),In=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",An].join("|"),"g"),Rn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),zn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Wn="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Bn={}; -Bn["[object Float32Array]"]=Bn["[object Float64Array]"]=Bn["[object Int8Array]"]=Bn["[object Int16Array]"]=Bn["[object Int32Array]"]=Bn["[object Uint8Array]"]=Bn["[object Uint8ClampedArray]"]=Bn["[object Uint16Array]"]=Bn["[object Uint32Array]"]=true,Bn["[object Arguments]"]=Bn["[object Array]"]=Bn["[object ArrayBuffer]"]=Bn["[object Boolean]"]=Bn["[object DataView]"]=Bn["[object Date]"]=Bn["[object Error]"]=Bn["[object Function]"]=Bn["[object Map]"]=Bn["[object Number]"]=Bn["[object Object]"]=Bn["[object RegExp]"]=Bn["[object Set]"]=Bn["[object String]"]=Bn["[object WeakMap]"]=false; -var Ln={};Ln["[object Arguments]"]=Ln["[object Array]"]=Ln["[object ArrayBuffer]"]=Ln["[object DataView]"]=Ln["[object Boolean]"]=Ln["[object Date]"]=Ln["[object Float32Array]"]=Ln["[object Float64Array]"]=Ln["[object Int8Array]"]=Ln["[object Int16Array]"]=Ln["[object Int32Array]"]=Ln["[object Map]"]=Ln["[object Number]"]=Ln["[object Object]"]=Ln["[object RegExp]"]=Ln["[object Set]"]=Ln["[object String]"]=Ln["[object Symbol]"]=Ln["[object Uint8Array]"]=Ln["[object Uint8ClampedArray]"]=Ln["[object Uint16Array]"]=Ln["[object Uint32Array]"]=true, -Ln["[object Error]"]=Ln["[object Function]"]=Ln["[object WeakMap]"]=false;var Un={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Cn=parseFloat,Dn=parseInt,Mn=typeof global=="object"&&global&&global.Object===Object&&global,Tn=typeof self=="object"&&self&&self.Object===Object&&self,$n=Mn||Tn||Function("return this")(),Fn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Nn=Fn&&typeof module=="object"&&module&&!module.nodeType&&module,Pn=Nn&&Nn.exports===Fn,Zn=Pn&&Mn.process,qn=function(){ -try{var n=Nn&&Nn.f&&Nn.f("util").types;return n?n:Zn&&Zn.binding&&Zn.binding("util")}catch(n){}}(),Vn=qn&&qn.isArrayBuffer,Kn=qn&&qn.isDate,Gn=qn&&qn.isMap,Hn=qn&&qn.isRegExp,Jn=qn&&qn.isSet,Yn=qn&&qn.isTypedArray,Qn=b("length"),Xn=x({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I", -"\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C", -"\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i", -"\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r", -"\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij", -"\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),nt=x({"&":"&","<":"<",">":">",'"':""","'":"'"}),tt=x({"&":"&","<":"<",">":">",""":'"',"'":"'"}),rt=function x(mn){function An(n){if(yu(n)&&!ff(n)&&!(n instanceof Un)){if(n instanceof On)return n;if(oi.call(n,"__wrapped__"))return Fe(n)}return new On(n)}function En(){}function On(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=T}function Un(n){this.__wrapped__=n, -this.__actions__=[],this.__dir__=1,this.__filtered__=false,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Mn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t=t?n:t)),n}function _t(n,t,e,u,i,o){var f,c=1&t,a=2&t,l=4&t;if(e&&(f=i?e(n,u,i,o):e(n)),f!==T)return f;if(!du(n))return n;if(u=ff(n)){if(f=me(n),!c)return Ur(n,f)}else{var s=vo(n),h="[object Function]"==s||"[object GeneratorFunction]"==s;if(af(n))return Ir(n,c);if("[object Object]"==s||"[object Arguments]"==s||h&&!i){if(f=a||h?{}:Ae(n),!c)return a?Mr(n,lt(f,n)):Dr(n,at(f,n))}else{if(!Ln[s])return i?n:{};f=Ee(n,s,c)}}if(o||(o=new Zn), -i=o.get(n))return i;o.set(n,f),pf(n)?n.forEach(function(r){f.add(_t(r,t,e,r,n,o))}):sf(n)&&n.forEach(function(r,u){f.set(u,_t(r,t,e,u,n,o))});var a=l?a?ve:_e:a?Bu:Wu,p=u?T:a(n);return r(p||n,function(r,u){p&&(u=r,r=n[u]),ot(f,u,_t(r,t,e,u,n,o))}),f}function vt(n){var t=Wu(n);return function(r){return gt(r,n,t)}}function gt(n,t,r){var e=r.length;if(null==n)return!e;for(n=Qu(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===T&&!(u in n)||!i(o))return false}return true}function dt(n,t,r){if(typeof n!="function")throw new ti("Expected a function"); -return bo(function(){n.apply(T,r)},t)}function yt(n,t,r,e){var u=-1,i=o,a=true,l=n.length,s=[],h=t.length;if(!l)return s;r&&(t=c(t,k(r))),e?(i=f,a=false):200<=t.length&&(i=O,a=false,t=new Nn(t));n:for(;++ut}function Rt(n,t){return null!=n&&oi.call(n,t)}function zt(n,t){return null!=n&&t in Qu(n)}function Wt(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=Ku(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,k(t))),s=Ci(p.length,s), -l[a]=!r&&(t||120<=u&&120<=p.length)?new Nn(a&&p):T}var p=n[0],_=-1,v=l[0];n:for(;++_r.length?t:kt(t,hr(r,0,-1)),r=null==t?t:t[Me(Ve(r))],null==r?T:n(r,t,e)}function Ut(n){return yu(n)&&"[object Arguments]"==Ot(n)}function Ct(n){ -return yu(n)&&"[object ArrayBuffer]"==Ot(n)}function Dt(n){return yu(n)&&"[object Date]"==Ot(n)}function Mt(n,t,r,e,u){if(n===t)t=true;else if(null==n||null==t||!yu(n)&&!yu(t))t=n!==n&&t!==t;else n:{var i=ff(n),o=ff(t),f=i?"[object Array]":vo(n),c=o?"[object Array]":vo(t),f="[object Arguments]"==f?"[object Object]":f,c="[object Arguments]"==c?"[object Object]":c,a="[object Object]"==f,o="[object Object]"==c;if((c=f==c)&&af(n)){if(!af(t)){t=false;break n}i=true,a=false}if(c&&!a)u||(u=new Zn),t=i||_f(n)?se(n,t,r,e,Mt,u):he(n,t,f,r,e,Mt,u);else{ -if(!(1&r)&&(i=a&&oi.call(n,"__wrapped__"),f=o&&oi.call(t,"__wrapped__"),i||f)){n=i?n.value():n,t=f?t.value():t,u||(u=new Zn),t=Mt(n,t,r,e,u);break n}if(c)t:if(u||(u=new Zn),i=1&r,f=_e(n),o=f.length,c=_e(t).length,o==c||i){for(a=o;a--;){var l=f[a];if(!(i?l in t:oi.call(t,l))){t=false;break t}}if((c=u.get(n))&&u.get(t))t=c==t;else{c=true,u.set(n,t),u.set(t,n);for(var s=i;++at?r:0,Se(t,r)?n[t]:T}function Xt(n,t,r){var e=-1;return t=c(t.length?t:[$u],k(ye())),n=Gt(n,function(n){return{ -a:c(t,function(t){return t(n)}),b:++e,c:n}}),w(n,function(n,t){var e;n:{e=-1;for(var u=n.a,i=t.a,o=u.length,f=r.length;++e=f?c:c*("desc"==r[e]?-1:1);break n}}e=n.b-t.b}return e})}function nr(n,t){return tr(n,t,function(t,r){return zu(n,r)})}function tr(n,t,r){for(var e=-1,u=t.length,i={};++et||9007199254740991t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Ku(u);++e=u){for(;e>>1,o=n[i];null!==o&&!wu(o)&&(r?o<=t:ot.length?n:kt(n,hr(t,0,-1)),null==n||delete n[Me(Ve(t))]}function jr(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++ie)return e?br(n[0]):[];for(var u=-1,i=Ku(e);++u=e?n:hr(n,t,r)}function Ir(n,t){if(t)return n.slice();var r=n.length,r=gi?gi(r):new n.constructor(r);return n.copy(r),r}function Rr(n){var t=new n.constructor(n.byteLength);return new vi(t).set(new vi(n)), -t}function zr(n,t){return new n.constructor(t?Rr(n.buffer):n.buffer,n.byteOffset,n.length)}function Wr(n,t){if(n!==t){var r=n!==T,e=null===n,u=n===n,i=wu(n),o=t!==T,f=null===t,c=t===t,a=wu(t);if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&nu?T:i,u=1),t=Qu(t);++eo&&f[0]!==a&&f[o-1]!==a?[]:L(f,a), -o-=c.length,or?r?or(t,n):t:(r=or(t,Oi(n/D(t))),Rn.test(t)?Or(M(r),0,n).join(""):r.slice(0,n))}function te(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=Ku(l+c),h=this&&this!==$n&&this instanceof i?f:t;++at||e)&&(1&n&&(i[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=i[3],i[3]=e?Br(e,r,h[4]):r,i[4]=e?L(i[3],"__lodash_placeholder__"):h[4]),(r=h[5])&&(e=i[5],i[5]=e?Lr(e,r,h[6]):r,i[6]=e?L(i[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(i[7]=r),128&n&&(i[8]=null==i[8]?h[8]:Ci(i[8],h[8])),null==i[9]&&(i[9]=h[9]),i[0]=h[0],i[1]=t),n=i[0], -t=i[1],r=i[2],e=i[3],u=i[4],f=i[9]=i[9]===T?c?0:n.length:Ui(i[9]-a,0),!f&&24&t&&(t&=-25),Ue((h?co:yo)(t&&1!=t?8==t||16==t?Kr(n,t,f):32!=t&&33!=t||u.length?Jr.apply(T,i):te(n,t,r,e):Pr(n,t,r),i),n,t)}function ce(n,t,r,e){return n===T||lu(n,ei[r])&&!oi.call(e,r)?t:n}function ae(n,t,r,e,u,i){return du(n)&&du(t)&&(i.set(t,n),Yt(n,t,T,ae,i),i.delete(t)),n}function le(n){return xu(n)?T:n}function se(n,t,r,e,u,i){var o=1&r,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return false;if((c=i.get(n))&&i.get(t))return c==t; -var c=-1,a=true,l=2&r?new Nn:T;for(i.set(n,t),i.set(t,n);++cr&&(r=Ui(e+r,0)),_(n,ye(t,3),r)):-1}function Pe(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==T&&(u=Eu(r),u=0>r?Ui(e+u,0):Ci(u,e-1)), -_(n,ye(t,3),u,true)}function Ze(n){return(null==n?0:n.length)?wt(n,1):[]}function qe(n){return n&&n.length?n[0]:T}function Ve(n){var t=null==n?0:n.length;return t?n[t-1]:T}function Ke(n,t){return n&&n.length&&t&&t.length?er(n,t):n}function Ge(n){return null==n?n:$i.call(n)}function He(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){if(hu(n))return t=Ui(n.length,t),true}),A(t,function(t){return c(n,b(t))})}function Je(t,r){if(!t||!t.length)return[];var e=He(t);return null==r?e:c(e,function(t){ -return n(r,T,t)})}function Ye(n){return n=An(n),n.__chain__=true,n}function Qe(n,t){return t(n)}function Xe(){return this}function nu(n,t){return(ff(n)?r:uo)(n,ye(t,3))}function tu(n,t){return(ff(n)?e:io)(n,ye(t,3))}function ru(n,t){return(ff(n)?c:Gt)(n,ye(t,3))}function eu(n,t,r){return t=r?T:t,t=n&&null==t?n.length:t,fe(n,128,T,T,T,T,t)}function uu(n,t){var r;if(typeof t!="function")throw new ti("Expected a function");return n=Eu(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=T), -r}}function iu(n,t,r){return t=r?T:t,n=fe(n,8,T,T,T,T,T,t),n.placeholder=iu.placeholder,n}function ou(n,t,r){return t=r?T:t,n=fe(n,16,T,T,T,T,T,t),n.placeholder=ou.placeholder,n}function fu(n,t,r){function e(t){var r=c,e=a;return c=a=T,_=t,s=n.apply(e,r)}function u(n){var r=n-p;return n-=_,p===T||r>=t||0>r||g&&n>=l}function i(){var n=Go();if(u(n))return o(n);var r,e=bo;r=n-_,n=t-(n-p),r=g?Ci(n,l-r):n,h=e(i,r)}function o(n){return h=T,d&&c?e(n):(c=a=T,s)}function f(){var n=Go(),r=u(n);if(c=arguments, -a=this,p=n,r){if(h===T)return _=n=p,h=bo(i,t),v?e(n):s;if(g)return lo(h),h=bo(i,t),e(p)}return h===T&&(h=bo(i,t)),s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof n!="function")throw new ti("Expected a function");return t=Su(t)||0,du(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Ui(Su(r.maxWait)||0,t):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==T&&lo(h),_=0,c=p=a=h=T},f.flush=function(){return h===T?s:o(Go())},f}function cu(n,t){function r(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache; -return i.has(u)?i.get(u):(e=n.apply(this,e),r.cache=i.set(u,e)||i,e)}if(typeof n!="function"||null!=t&&typeof t!="function")throw new ti("Expected a function");return r.cache=new(cu.Cache||Fn),r}function au(n){if(typeof n!="function")throw new ti("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function lu(n,t){return n===t||n!==n&&t!==t; -}function su(n){return null!=n&&gu(n.length)&&!_u(n)}function hu(n){return yu(n)&&su(n)}function pu(n){if(!yu(n))return false;var t=Ot(n);return"[object Error]"==t||"[object DOMException]"==t||typeof n.message=="string"&&typeof n.name=="string"&&!xu(n)}function _u(n){return!!du(n)&&(n=Ot(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function vu(n){return typeof n=="number"&&n==Eu(n)}function gu(n){return typeof n=="number"&&-1=n; -}function du(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function yu(n){return null!=n&&typeof n=="object"}function bu(n){return typeof n=="number"||yu(n)&&"[object Number]"==Ot(n)}function xu(n){return!(!yu(n)||"[object Object]"!=Ot(n))&&(n=di(n),null===n||(n=oi.call(n,"constructor")&&n.constructor,typeof n=="function"&&n instanceof n&&ii.call(n)==li))}function ju(n){return typeof n=="string"||!ff(n)&&yu(n)&&"[object String]"==Ot(n)}function wu(n){return typeof n=="symbol"||yu(n)&&"[object Symbol]"==Ot(n); -}function mu(n){if(!n)return[];if(su(n))return ju(n)?M(n):Ur(n);if(wi&&n[wi]){n=n[wi]();for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}return t=vo(n),("[object Map]"==t?W:"[object Set]"==t?U:Uu)(n)}function Au(n){return n?(n=Su(n),n===$||n===-$?1.7976931348623157e308*(0>n?-1:1):n===n?n:0):0===n?n:0}function Eu(n){n=Au(n);var t=n%1;return n===n?t?n-t:n:0}function ku(n){return n?pt(Eu(n),0,4294967295):0}function Su(n){if(typeof n=="number")return n;if(wu(n))return F;if(du(n)&&(n=typeof n.valueOf=="function"?n.valueOf():n, -n=du(n)?n+"":n),typeof n!="string")return 0===n?n:+n;n=n.replace(un,"");var t=gn.test(n);return t||yn.test(n)?Dn(n.slice(2),t?2:8):vn.test(n)?F:+n}function Ou(n){return Cr(n,Bu(n))}function Iu(n){return null==n?"":yr(n)}function Ru(n,t,r){return n=null==n?T:kt(n,t),n===T?r:n}function zu(n,t){return null!=n&&we(n,t,zt)}function Wu(n){return su(n)?qn(n):Vt(n)}function Bu(n){if(su(n))n=qn(n,true);else if(du(n)){var t,r=ze(n),e=[];for(t in n)("constructor"!=t||!r&&oi.call(n,t))&&e.push(t);n=e}else{if(t=[], -null!=n)for(r in Qu(n))t.push(r);n=t}return n}function Lu(n,t){if(null==n)return{};var r=c(ve(n),function(n){return[n]});return t=ye(t),tr(n,r,function(n,r){return t(n,r[0])})}function Uu(n){return null==n?[]:S(n,Wu(n))}function Cu(n){return $f(Iu(n).toLowerCase())}function Du(n){return(n=Iu(n))&&n.replace(xn,Xn).replace(Sn,"")}function Mu(n,t,r){return n=Iu(n),t=r?T:t,t===T?zn.test(n)?n.match(In)||[]:n.match(sn)||[]:n.match(t)||[]}function Tu(n){return function(){return n}}function $u(n){return n; -}function Fu(n){return qt(typeof n=="function"?n:_t(n,1))}function Nu(n,t,e){var u=Wu(t),i=Et(t,u);null!=e||du(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=Et(t,Wu(t)));var o=!(du(e)&&"chain"in e&&!e.chain),f=_u(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Ur(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function Pu(){} -function Zu(n){return Ie(n)?b(Me(n)):rr(n)}function qu(){return[]}function Vu(){return false}mn=null==mn?$n:rt.defaults($n.Object(),mn,rt.pick($n,Wn));var Ku=mn.Array,Gu=mn.Date,Hu=mn.Error,Ju=mn.Function,Yu=mn.Math,Qu=mn.Object,Xu=mn.RegExp,ni=mn.String,ti=mn.TypeError,ri=Ku.prototype,ei=Qu.prototype,ui=mn["__core-js_shared__"],ii=Ju.prototype.toString,oi=ei.hasOwnProperty,fi=0,ci=function(){var n=/[^.]+$/.exec(ui&&ui.keys&&ui.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),ai=ei.toString,li=ii.call(Qu),si=$n._,hi=Xu("^"+ii.call(oi).replace(rn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pi=Pn?mn.Buffer:T,_i=mn.Symbol,vi=mn.Uint8Array,gi=pi?pi.g:T,di=B(Qu.getPrototypeOf,Qu),yi=Qu.create,bi=ei.propertyIsEnumerable,xi=ri.splice,ji=_i?_i.isConcatSpreadable:T,wi=_i?_i.iterator:T,mi=_i?_i.toStringTag:T,Ai=function(){ -try{var n=je(Qu,"defineProperty");return n({},"",{}),n}catch(n){}}(),Ei=mn.clearTimeout!==$n.clearTimeout&&mn.clearTimeout,ki=Gu&&Gu.now!==$n.Date.now&&Gu.now,Si=mn.setTimeout!==$n.setTimeout&&mn.setTimeout,Oi=Yu.ceil,Ii=Yu.floor,Ri=Qu.getOwnPropertySymbols,zi=pi?pi.isBuffer:T,Wi=mn.isFinite,Bi=ri.join,Li=B(Qu.keys,Qu),Ui=Yu.max,Ci=Yu.min,Di=Gu.now,Mi=mn.parseInt,Ti=Yu.random,$i=ri.reverse,Fi=je(mn,"DataView"),Ni=je(mn,"Map"),Pi=je(mn,"Promise"),Zi=je(mn,"Set"),qi=je(mn,"WeakMap"),Vi=je(Qu,"create"),Ki=qi&&new qi,Gi={},Hi=Te(Fi),Ji=Te(Ni),Yi=Te(Pi),Qi=Te(Zi),Xi=Te(qi),no=_i?_i.prototype:T,to=no?no.valueOf:T,ro=no?no.toString:T,eo=function(){ -function n(){}return function(t){return du(t)?yi?yi(t):(n.prototype=t,t=new n,n.prototype=T,t):{}}}();An.templateSettings={escape:J,evaluate:Y,interpolate:Q,variable:"",imports:{_:An}},An.prototype=En.prototype,An.prototype.constructor=An,On.prototype=eo(En.prototype),On.prototype.constructor=On,Un.prototype=eo(En.prototype),Un.prototype.constructor=Un,Mn.prototype.clear=function(){this.__data__=Vi?Vi(null):{},this.size=0},Mn.prototype.delete=function(n){return n=this.has(n)&&delete this.__data__[n], -this.size-=n?1:0,n},Mn.prototype.get=function(n){var t=this.__data__;return Vi?(n=t[n],"__lodash_hash_undefined__"===n?T:n):oi.call(t,n)?t[n]:T},Mn.prototype.has=function(n){var t=this.__data__;return Vi?t[n]!==T:oi.call(t,n)},Mn.prototype.set=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=Vi&&t===T?"__lodash_hash_undefined__":t,this},Tn.prototype.clear=function(){this.__data__=[],this.size=0},Tn.prototype.delete=function(n){var t=this.__data__;return n=ft(t,n),!(0>n)&&(n==t.length-1?t.pop():xi.call(t,n,1), ---this.size,true)},Tn.prototype.get=function(n){var t=this.__data__;return n=ft(t,n),0>n?T:t[n][1]},Tn.prototype.has=function(n){return-1e?(++this.size,r.push([n,t])):r[e][1]=t,this},Fn.prototype.clear=function(){this.size=0,this.__data__={hash:new Mn,map:new(Ni||Tn),string:new Mn}},Fn.prototype.delete=function(n){return n=be(this,n).delete(n),this.size-=n?1:0,n},Fn.prototype.get=function(n){return be(this,n).get(n); -},Fn.prototype.has=function(n){return be(this,n).has(n)},Fn.prototype.set=function(n,t){var r=be(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this},Nn.prototype.add=Nn.prototype.push=function(n){return this.__data__.set(n,"__lodash_hash_undefined__"),this},Nn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.clear=function(){this.__data__=new Tn,this.size=0},Zn.prototype.delete=function(n){var t=this.__data__;return n=t.delete(n),this.size=t.size,n},Zn.prototype.get=function(n){ -return this.__data__.get(n)},Zn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.set=function(n,t){var r=this.__data__;if(r instanceof Tn){var e=r.__data__;if(!Ni||199>e.length)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new Fn(e)}return r.set(n,t),this.size=r.size,this};var uo=Fr(mt),io=Fr(At,true),oo=Nr(),fo=Nr(true),co=Ki?function(n,t){return Ki.set(n,t),n}:$u,ao=Ai?function(n,t){return Ai(n,"toString",{configurable:true,enumerable:false,value:Tu(t),writable:true})}:$u,lo=Ei||function(n){ -return $n.clearTimeout(n)},so=Zi&&1/U(new Zi([,-0]))[1]==$?function(n){return new Zi(n)}:Pu,ho=Ki?function(n){return Ki.get(n)}:Pu,po=Ri?function(n){return null==n?[]:(n=Qu(n),i(Ri(n),function(t){return bi.call(n,t)}))}:qu,_o=Ri?function(n){for(var t=[];n;)a(t,po(n)),n=di(n);return t}:qu,vo=Ot;(Fi&&"[object DataView]"!=vo(new Fi(new ArrayBuffer(1)))||Ni&&"[object Map]"!=vo(new Ni)||Pi&&"[object Promise]"!=vo(Pi.resolve())||Zi&&"[object Set]"!=vo(new Zi)||qi&&"[object WeakMap]"!=vo(new qi))&&(vo=function(n){ -var t=Ot(n);if(n=(n="[object Object]"==t?n.constructor:T)?Te(n):"")switch(n){case Hi:return"[object DataView]";case Ji:return"[object Map]";case Yi:return"[object Promise]";case Qi:return"[object Set]";case Xi:return"[object WeakMap]"}return t});var go=ui?_u:Vu,yo=Ce(co),bo=Si||function(n,t){return $n.setTimeout(n,t)},xo=Ce(ao),jo=function(n){n=cu(n,function(n){return 500===t.size&&t.clear(),n});var t=n.cache;return n}(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(tn,function(n,r,e,u){ -t.push(e?u.replace(hn,"$1"):r||n)}),t}),wo=fr(function(n,t){return hu(n)?yt(n,wt(t,1,hu,true)):[]}),mo=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),ye(r,2)):[]}),Ao=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),T,r):[]}),Eo=fr(function(n){var t=c(n,Er);return t.length&&t[0]===n[0]?Wt(t):[]}),ko=fr(function(n){var t=Ve(n),r=c(n,Er);return t===Ve(r)?t=T:r.pop(),r.length&&r[0]===n[0]?Wt(r,ye(t,2)):[]}),So=fr(function(n){var t=Ve(n),r=c(n,Er);return(t=typeof t=="function"?t:T)&&r.pop(), -r.length&&r[0]===n[0]?Wt(r,T,t):[]}),Oo=fr(Ke),Io=pe(function(n,t){var r=null==n?0:n.length,e=ht(n,t);return ur(n,c(t,function(n){return Se(n,r)?+n:n}).sort(Wr)),e}),Ro=fr(function(n){return br(wt(n,1,hu,true))}),zo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T),br(wt(n,1,hu,true),ye(t,2))}),Wo=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return br(wt(n,1,hu,true),T,t)}),Bo=fr(function(n,t){return hu(n)?yt(n,t):[]}),Lo=fr(function(n){return mr(i(n,hu))}),Uo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T), -mr(i(n,hu),ye(t,2))}),Co=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return mr(i(n,hu),T,t)}),Do=fr(He),Mo=fr(function(n){var t=n.length,t=1=t}),of=Ut(function(){return arguments}())?Ut:function(n){return yu(n)&&oi.call(n,"callee")&&!bi.call(n,"callee")},ff=Ku.isArray,cf=Vn?k(Vn):Ct,af=zi||Vu,lf=Kn?k(Kn):Dt,sf=Gn?k(Gn):Tt,hf=Hn?k(Hn):Nt,pf=Jn?k(Jn):Pt,_f=Yn?k(Yn):Zt,vf=ee(Kt),gf=ee(function(n,t){return n<=t}),df=$r(function(n,t){ -if(ze(t)||su(t))Cr(t,Wu(t),n);else for(var r in t)oi.call(t,r)&&ot(n,r,t[r])}),yf=$r(function(n,t){Cr(t,Bu(t),n)}),bf=$r(function(n,t,r,e){Cr(t,Bu(t),n,e)}),xf=$r(function(n,t,r,e){Cr(t,Wu(t),n,e)}),jf=pe(ht),wf=fr(function(n,t){n=Qu(n);var r=-1,e=t.length,u=2--n)return t.apply(this,arguments)}},An.ary=eu,An.assign=df,An.assignIn=yf,An.assignInWith=bf,An.assignWith=xf,An.at=jf,An.before=uu,An.bind=Ho,An.bindAll=Nf,An.bindKey=Jo,An.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return ff(n)?n:[n]},An.chain=Ye,An.chunk=function(n,t,r){if(t=(r?Oe(n,t,r):t===T)?1:Ui(Eu(t),0),r=null==n?0:n.length,!r||1>t)return[];for(var e=0,u=0,i=Ku(Oi(r/t));et?0:t,e)):[]},An.dropRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Eu(t),t=e-t,hr(n,0,0>t?0:t)):[]},An.dropRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true,true):[]; -},An.dropWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true):[]},An.fill=function(n,t,r,e){var u=null==n?0:n.length;if(!u)return[];for(r&&typeof r!="number"&&Oe(n,t,r)&&(r=0,e=u),u=n.length,r=Eu(r),0>r&&(r=-r>u?0:u+r),e=e===T||e>u?u:Eu(e),0>e&&(e+=u),e=r>e?0:ku(e);r>>0,r?(n=Iu(n))&&(typeof t=="string"||null!=t&&!hf(t))&&(t=yr(t),!t&&Rn.test(n))?Or(M(n),0,r):n.split(t,r):[]},An.spread=function(t,r){if(typeof t!="function")throw new ti("Expected a function");return r=null==r?0:Ui(Eu(r),0), -fr(function(e){var u=e[r];return e=Or(e,0,r),u&&a(e,u),n(t,this,e)})},An.tail=function(n){var t=null==n?0:n.length;return t?hr(n,1,t):[]},An.take=function(n,t,r){return n&&n.length?(t=r||t===T?1:Eu(t),hr(n,0,0>t?0:t)):[]},An.takeRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Eu(t),t=e-t,hr(n,0>t?0:t,e)):[]},An.takeRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),false,true):[]},An.takeWhile=function(n,t){return n&&n.length?jr(n,ye(t,3)):[]},An.tap=function(n,t){return t(n), -n},An.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new ti("Expected a function");return du(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),fu(n,t,{leading:e,maxWait:t,trailing:u})},An.thru=Qe,An.toArray=mu,An.toPairs=zf,An.toPairsIn=Wf,An.toPath=function(n){return ff(n)?c(n,Me):wu(n)?[n]:Ur(jo(Iu(n)))},An.toPlainObject=Ou,An.transform=function(n,t,e){var u=ff(n),i=u||af(n)||_f(n);if(t=ye(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:du(n)&&_u(o)?eo(di(n)):{}; -}return(i?r:mt)(n,function(n,r,u){return t(e,n,r,u)}),e},An.unary=function(n){return eu(n,1)},An.union=Ro,An.unionBy=zo,An.unionWith=Wo,An.uniq=function(n){return n&&n.length?br(n):[]},An.uniqBy=function(n,t){return n&&n.length?br(n,ye(t,2)):[]},An.uniqWith=function(n,t){return t=typeof t=="function"?t:T,n&&n.length?br(n,T,t):[]},An.unset=function(n,t){return null==n||xr(n,t)},An.unzip=He,An.unzipWith=Je,An.update=function(n,t,r){return null==n?n:lr(n,t,kr(r)(kt(n,t)),void 0)},An.updateWith=function(n,t,r,e){ -return e=typeof e=="function"?e:T,null!=n&&(n=lr(n,t,kr(r)(kt(n,t)),e)),n},An.values=Uu,An.valuesIn=function(n){return null==n?[]:S(n,Bu(n))},An.without=Bo,An.words=Mu,An.wrap=function(n,t){return nf(kr(t),n)},An.xor=Lo,An.xorBy=Uo,An.xorWith=Co,An.zip=Do,An.zipObject=function(n,t){return Ar(n||[],t||[],ot)},An.zipObjectDeep=function(n,t){return Ar(n||[],t||[],lr)},An.zipWith=Mo,An.entries=zf,An.entriesIn=Wf,An.extend=yf,An.extendWith=bf,Nu(An,An),An.add=Qf,An.attempt=Ff,An.camelCase=Bf,An.capitalize=Cu, -An.ceil=Xf,An.clamp=function(n,t,r){return r===T&&(r=t,t=T),r!==T&&(r=Su(r),r=r===r?r:0),t!==T&&(t=Su(t),t=t===t?t:0),pt(Su(n),t,r)},An.clone=function(n){return _t(n,4)},An.cloneDeep=function(n){return _t(n,5)},An.cloneDeepWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,5,t)},An.cloneWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,4,t)},An.conformsTo=function(n,t){return null==t||gt(n,t,Wu(t))},An.deburr=Du,An.defaultTo=function(n,t){return null==n||n!==n?t:n},An.divide=nc,An.endsWith=function(n,t,r){ -n=Iu(n),t=yr(t);var e=n.length,e=r=r===T?e:pt(Eu(r),0,e);return r-=t.length,0<=r&&n.slice(r,e)==t},An.eq=lu,An.escape=function(n){return(n=Iu(n))&&H.test(n)?n.replace(K,nt):n},An.escapeRegExp=function(n){return(n=Iu(n))&&en.test(n)?n.replace(rn,"\\$&"):n},An.every=function(n,t,r){var e=ff(n)?u:bt;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.find=Fo,An.findIndex=Ne,An.findKey=function(n,t){return p(n,ye(t,3),mt)},An.findLast=No,An.findLastIndex=Pe,An.findLastKey=function(n,t){return p(n,ye(t,3),At); -},An.floor=tc,An.forEach=nu,An.forEachRight=tu,An.forIn=function(n,t){return null==n?n:oo(n,ye(t,3),Bu)},An.forInRight=function(n,t){return null==n?n:fo(n,ye(t,3),Bu)},An.forOwn=function(n,t){return n&&mt(n,ye(t,3))},An.forOwnRight=function(n,t){return n&&At(n,ye(t,3))},An.get=Ru,An.gt=ef,An.gte=uf,An.has=function(n,t){return null!=n&&we(n,t,Rt)},An.hasIn=zu,An.head=qe,An.identity=$u,An.includes=function(n,t,r,e){return n=su(n)?n:Uu(n),r=r&&!e?Eu(r):0,e=n.length,0>r&&(r=Ui(e+r,0)),ju(n)?r<=e&&-1r&&(r=Ui(e+r,0)),v(n,t,r)):-1},An.inRange=function(n,t,r){return t=Au(t),r===T?(r=t,t=0):r=Au(r),n=Su(n),n>=Ci(t,r)&&n=n},An.isSet=pf,An.isString=ju,An.isSymbol=wu,An.isTypedArray=_f,An.isUndefined=function(n){return n===T},An.isWeakMap=function(n){return yu(n)&&"[object WeakMap]"==vo(n)},An.isWeakSet=function(n){return yu(n)&&"[object WeakSet]"==Ot(n)},An.join=function(n,t){return null==n?"":Bi.call(n,t)},An.kebabCase=Lf,An.last=Ve,An.lastIndexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;if(r!==T&&(u=Eu(r),u=0>u?Ui(e+u,0):Ci(u,e-1)), -t===t){for(r=u+1;r--&&n[r]!==t;);n=r}else n=_(n,d,u,true);return n},An.lowerCase=Uf,An.lowerFirst=Cf,An.lt=vf,An.lte=gf,An.max=function(n){return n&&n.length?xt(n,$u,It):T},An.maxBy=function(n,t){return n&&n.length?xt(n,ye(t,2),It):T},An.mean=function(n){return y(n,$u)},An.meanBy=function(n,t){return y(n,ye(t,2))},An.min=function(n){return n&&n.length?xt(n,$u,Kt):T},An.minBy=function(n,t){return n&&n.length?xt(n,ye(t,2),Kt):T},An.stubArray=qu,An.stubFalse=Vu,An.stubObject=function(){return{}},An.stubString=function(){ -return""},An.stubTrue=function(){return true},An.multiply=rc,An.nth=function(n,t){return n&&n.length?Qt(n,Eu(t)):T},An.noConflict=function(){return $n._===this&&($n._=si),this},An.noop=Pu,An.now=Go,An.pad=function(n,t,r){n=Iu(n);var e=(t=Eu(t))?D(n):0;return!t||e>=t?n:(t=(t-e)/2,ne(Ii(t),r)+n+ne(Oi(t),r))},An.padEnd=function(n,t,r){n=Iu(n);var e=(t=Eu(t))?D(n):0;return t&&et){var e=n;n=t,t=e}return r||n%1||t%1?(r=Ti(),Ci(n+r*(t-n+Cn("1e-"+((r+"").length-1))),t)):ir(n,t)},An.reduce=function(n,t,r){var e=ff(n)?l:j,u=3>arguments.length;return e(n,ye(t,4),r,u,uo)},An.reduceRight=function(n,t,r){var e=ff(n)?s:j,u=3>arguments.length; -return e(n,ye(t,4),r,u,io)},An.repeat=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:Eu(t),or(Iu(n),t)},An.replace=function(){var n=arguments,t=Iu(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},An.result=function(n,t,r){t=Sr(t,n);var e=-1,u=t.length;for(u||(u=1,n=T);++en||9007199254740991=i)return n;if(i=r-D(e),1>i)return e;if(r=o?Or(o,0,i).join(""):n.slice(0,i),u===T)return r+e;if(o&&(i+=r.length-i),hf(u)){if(n.slice(i).search(u)){ -var f=r;for(u.global||(u=Xu(u.source,Iu(_n.exec(u))+"g")),u.lastIndex=0;o=u.exec(f);)var c=o.index;r=r.slice(0,c===T?i:c)}}else n.indexOf(yr(u),i)!=i&&(u=r.lastIndexOf(u),-1e.__dir__?"Right":"")}),e},Un.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),r(["filter","map","takeWhile"],function(n,t){ -var r=t+1,e=1==r||3==r;Un.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:ye(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),r(["head","last"],function(n,t){var r="take"+(t?"Right":"");Un.prototype[n]=function(){return this[r](1).value()[0]}}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Un.prototype[n]=function(){return this.__filtered__?new Un(this):this[r](1)}}),Un.prototype.compact=function(){return this.filter($u)},Un.prototype.find=function(n){ -return this.filter(n).head()},Un.prototype.findLast=function(n){return this.reverse().find(n)},Un.prototype.invokeMap=fr(function(n,t){return typeof n=="function"?new Un(this):this.map(function(r){return Lt(r,n,t)})}),Un.prototype.reject=function(n){return this.filter(au(ye(n)))},Un.prototype.slice=function(n,t){n=Eu(n);var r=this;return r.__filtered__&&(0t)?new Un(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==T&&(t=Eu(t),r=0>t?r.dropRight(-t):r.take(t-n)),r)},Un.prototype.takeRightWhile=function(n){ -return this.reverse().takeWhile(n).reverse()},Un.prototype.toArray=function(){return this.take(4294967295)},mt(Un.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=An[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);u&&(An.prototype[t]=function(){function t(n){return n=u.apply(An,a([n],f)),e&&h?n[0]:n}var o=this.__wrapped__,f=e?[1]:arguments,c=o instanceof Un,l=f[0],s=c||ff(o);s&&r&&typeof l=="function"&&1!=l.length&&(c=s=false);var h=this.__chain__,p=!!this.__actions__.length,l=i&&!h,c=c&&!p; -return!i&&s?(o=c?o:new Un(this),o=n.apply(o,f),o.__actions__.push({func:Qe,args:[t],thisArg:T}),new On(o,h)):l&&c?n.apply(this,f):(o=this.thru(t),l?e?o.value()[0]:o.value():o)})}),r("pop push shift sort splice unshift".split(" "),function(n){var t=ri[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);An.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(ff(u)?u:[],n)}return this[r](function(r){return t.apply(ff(r)?r:[],n)}); -}}),mt(Un.prototype,function(n,t){var r=An[t];if(r){var e=r.name+"";oi.call(Gi,e)||(Gi[e]=[]),Gi[e].push({name:t,func:r})}}),Gi[Jr(T,2).name]=[{name:"wrapper",func:T}],Un.prototype.clone=function(){var n=new Un(this.__wrapped__);return n.__actions__=Ur(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Ur(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Ur(this.__views__),n},Un.prototype.reverse=function(){if(this.__filtered__){var n=new Un(this); -n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},Un.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=ff(t),u=0>r,i=e?t.length:0;n=i;for(var o=this.__views__,f=0,c=-1,a=o.length;++c=this.__values__.length;return{done:n,value:n?T:this.__values__[this.__index__++]}},An.prototype.plant=function(n){ -for(var t,r=this;r instanceof En;){var e=Fe(r);e.__index__=0,e.__values__=T,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},An.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Un?(this.__actions__.length&&(n=new Un(this)),n=n.reverse(),n.__actions__.push({func:Qe,args:[Ge],thisArg:T}),new On(n,this.__chain__)):this.thru(Ge)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return wr(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head, -wi&&(An.prototype[wi]=Xe),An}();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($n._=rt, define(function(){return rt})):Nn?((Nn.exports=rt)._=rt,Fn._=rt):$n._=rt}).call(this); \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/lodash/package.json b/tools/node_modules/babel-eslint/node_modules/lodash/package.json deleted file mode 100644 index ccf80be0796354..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/lodash/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "author": { - "name": "John-David Dalton", - "email": "john.david.dalton@gmail.com" - }, - "bugs": { - "url": "https://github.com/lodash/lodash/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "John-David Dalton", - "email": "john.david.dalton@gmail.com" - }, - { - "name": "Mathias Bynens", - "email": "mathias@qiwi.be" - } - ], - "deprecated": false, - "description": "Lodash modular utilities.", - "homepage": "https://lodash.com/", - "icon": "https://lodash.com/icon.svg", - "keywords": [ - "modules", - "stdlib", - "util" - ], - "license": "MIT", - "main": "lodash.js", - "name": "lodash", - "repository": { - "type": "git", - "url": "git+https://github.com/lodash/lodash.git" - }, - "scripts": { - "test": "echo \"See https://travis-ci.org/lodash-archive/lodash-cli for testing details.\"" - }, - "version": "4.17.15" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/resolve/index.js b/tools/node_modules/babel-eslint/node_modules/resolve/index.js deleted file mode 100644 index eb6ba89e6c210c..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/resolve/index.js +++ /dev/null @@ -1,8 +0,0 @@ -var core = require('./lib/core'); -var async = require('./lib/async'); -async.core = core; -async.isCore = function isCore(x) { return core[x]; }; -async.sync = require('./lib/sync'); - -exports = async; -module.exports = async; diff --git a/tools/node_modules/babel-eslint/node_modules/resolve/package.json b/tools/node_modules/babel-eslint/node_modules/resolve/package.json deleted file mode 100644 index 95353241e58cad..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/resolve/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "bugs": { - "url": "https://github.com/browserify/resolve/issues" - }, - "bundleDependencies": false, - "dependencies": { - "path-parse": "^1.0.6" - }, - "deprecated": false, - "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", - "devDependencies": { - "@ljharb/eslint-config": "^13.1.1", - "eslint": "^5.16.0", - "object-keys": "^1.1.1", - "safe-publish-latest": "^1.1.2", - "tap": "0.4.13", - "tape": "^4.11.0" - }, - "homepage": "https://github.com/browserify/resolve#readme", - "keywords": [ - "resolve", - "require", - "node", - "module" - ], - "license": "MIT", - "main": "index.js", - "name": "resolve", - "repository": { - "type": "git", - "url": "git://github.com/browserify/resolve.git" - }, - "scripts": { - "lint": "eslint .", - "posttest": "npm run test:multirepo", - "prepublish": "safe-publish-latest", - "pretest": "npm run lint", - "pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async", - "test": "npm run --silent tests-only", - "test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test", - "tests-only": "tape test/*.js" - }, - "version": "1.12.0" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/source-map/package.json b/tools/node_modules/babel-eslint/node_modules/source-map/package.json deleted file mode 100644 index 9e2674cec8bd3c..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/source-map/package.json +++ /dev/null @@ -1,188 +0,0 @@ -{ - "author": { - "name": "Nick Fitzgerald", - "email": "nfitzgerald@mozilla.com" - }, - "bugs": { - "url": "https://github.com/mozilla/source-map/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Tobias Koppers", - "email": "tobias.koppers@googlemail.com" - }, - { - "name": "Duncan Beevers", - "email": "duncan@dweebd.com" - }, - { - "name": "Stephen Crane", - "email": "scrane@mozilla.com" - }, - { - "name": "Ryan Seddon", - "email": "seddon.ryan@gmail.com" - }, - { - "name": "Miles Elam", - "email": "miles.elam@deem.com" - }, - { - "name": "Mihai Bazon", - "email": "mihai.bazon@gmail.com" - }, - { - "name": "Michael Ficarra", - "email": "github.public.email@michael.ficarra.me" - }, - { - "name": "Todd Wolfson", - "email": "todd@twolfson.com" - }, - { - "name": "Alexander Solovyov", - "email": "alexander@solovyov.net" - }, - { - "name": "Felix Gnass", - "email": "fgnass@gmail.com" - }, - { - "name": "Conrad Irwin", - "email": "conrad.irwin@gmail.com" - }, - { - "name": "usrbincc", - "email": "usrbincc@yahoo.com" - }, - { - "name": "David Glasser", - "email": "glasser@davidglasser.net" - }, - { - "name": "Chase Douglas", - "email": "chase@newrelic.com" - }, - { - "name": "Evan Wallace", - "email": "evan.exe@gmail.com" - }, - { - "name": "Heather Arthur", - "email": "fayearthur@gmail.com" - }, - { - "name": "Hugh Kennedy", - "email": "hughskennedy@gmail.com" - }, - { - "name": "David Glasser", - "email": "glasser@davidglasser.net" - }, - { - "name": "Simon Lydell", - "email": "simon.lydell@gmail.com" - }, - { - "name": "Jmeas Smith", - "email": "jellyes2@gmail.com" - }, - { - "name": "Michael Z Goddard", - "email": "mzgoddard@gmail.com" - }, - { - "name": "azu", - "email": "azu@users.noreply.github.com" - }, - { - "name": "John Gozde", - "email": "john@gozde.ca" - }, - { - "name": "Adam Kirkton", - "email": "akirkton@truefitinnovation.com" - }, - { - "name": "Chris Montgomery", - "email": "christopher.montgomery@dowjones.com" - }, - { - "name": "J. Ryan Stinnett", - "email": "jryans@gmail.com" - }, - { - "name": "Jack Herrington", - "email": "jherrington@walmartlabs.com" - }, - { - "name": "Chris Truter", - "email": "jeffpalentine@gmail.com" - }, - { - "name": "Daniel Espeset", - "email": "daniel@danielespeset.com" - }, - { - "name": "Jamie Wong", - "email": "jamie.lf.wong@gmail.com" - }, - { - "name": "Eddy Bruël", - "email": "ejpbruel@mozilla.com" - }, - { - "name": "Hawken Rives", - "email": "hawkrives@gmail.com" - }, - { - "name": "Gilad Peleg", - "email": "giladp007@gmail.com" - }, - { - "name": "djchie", - "email": "djchie.dev@gmail.com" - }, - { - "name": "Gary Ye", - "email": "garysye@gmail.com" - }, - { - "name": "Nicolas Lalevée", - "email": "nicolas.lalevee@hibnet.org" - } - ], - "deprecated": false, - "description": "Generates and consumes source maps", - "devDependencies": { - "doctoc": "^0.15.0", - "webpack": "^1.12.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "source-map.js", - "lib/", - "dist/source-map.debug.js", - "dist/source-map.js", - "dist/source-map.min.js", - "dist/source-map.min.js.map" - ], - "homepage": "https://github.com/mozilla/source-map", - "license": "BSD-3-Clause", - "main": "./source-map.js", - "name": "source-map", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/mozilla/source-map.git" - }, - "scripts": { - "build": "webpack --color", - "test": "npm run build && node test/run-tests.js", - "toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md" - }, - "typings": "source-map", - "version": "0.5.7" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/supports-color/package.json b/tools/node_modules/babel-eslint/node_modules/supports-color/package.json deleted file mode 100644 index 9e4eafa8573232..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/supports-color/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "browser": "browser.js", - "bugs": { - "url": "https://github.com/chalk/supports-color/issues" - }, - "bundleDependencies": false, - "dependencies": { - "has-flag": "^3.0.0" - }, - "deprecated": false, - "description": "Detect whether a terminal supports color", - "devDependencies": { - "ava": "^0.25.0", - "import-fresh": "^2.0.0", - "xo": "^0.20.0" - }, - "engines": { - "node": ">=4" - }, - "files": [ - "index.js", - "browser.js" - ], - "homepage": "https://github.com/chalk/supports-color#readme", - "keywords": [ - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "ansi", - "styles", - "tty", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "support", - "supports", - "capability", - "detect", - "truecolor", - "16m" - ], - "license": "MIT", - "name": "supports-color", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/supports-color.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "5.5.0" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/trim-right/index.js b/tools/node_modules/babel-eslint/node_modules/trim-right/index.js deleted file mode 100644 index 666f4b2f4eeb6a..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/trim-right/index.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; -module.exports = function (str) { - var tail = str.length; - - while (/[\s\uFEFF\u00A0]/.test(str[tail - 1])) { - tail--; - } - - return str.slice(0, tail); -}; diff --git a/tools/node_modules/babel-eslint/node_modules/trim-right/package.json b/tools/node_modules/babel-eslint/node_modules/trim-right/package.json deleted file mode 100644 index 4ed056783bb584..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/trim-right/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/trim-right/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Similar to String#trim() but removes only whitespace on the right", - "devDependencies": { - "ava": "0.0.4" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/sindresorhus/trim-right#readme", - "keywords": [ - "trim", - "right", - "string", - "str", - "util", - "utils", - "utility", - "whitespace", - "space", - "remove", - "delete" - ], - "license": "MIT", - "name": "trim-right", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/trim-right.git" - }, - "scripts": { - "test": "node test.js" - }, - "version": "1.0.1" -} \ No newline at end of file diff --git a/tools/node_modules/babel-eslint/node_modules/trim-right/readme.md b/tools/node_modules/babel-eslint/node_modules/trim-right/readme.md deleted file mode 100644 index 0a4438acd7a898..00000000000000 --- a/tools/node_modules/babel-eslint/node_modules/trim-right/readme.md +++ /dev/null @@ -1,30 +0,0 @@ -# trim-right [![Build Status](https://travis-ci.org/sindresorhus/trim-right.svg?branch=master)](https://travis-ci.org/sindresorhus/trim-right) - -> Similar to [`String#trim()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim) but removes only whitespace on the right - - -## Install - -``` -$ npm install --save trim-right -``` - - -## Usage - -```js -var trimRight = require('trim-right'); - -trimRight(' unicorn '); -//=> ' unicorn' -``` - - -## Related - -- [`trim-left`](https://github.com/sindresorhus/trim-left) - Similar to `String#trim()` but removes only whitespace on the left - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/tools/node_modules/babel-eslint/package.json b/tools/node_modules/babel-eslint/package.json deleted file mode 100644 index fae7c72dbbf113..00000000000000 --- a/tools/node_modules/babel-eslint/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "author": { - "name": "Sebastian McKenzie", - "email": "sebmck@gmail.com" - }, - "bugs": { - "url": "https://github.com/babel/babel-eslint/issues" - }, - "bundleDependencies": false, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.0.0", - "@babel/traverse": "^7.0.0", - "@babel/types": "^7.0.0", - "eslint-visitor-keys": "^1.0.0", - "resolve": "^1.12.0" - }, - "deprecated": false, - "description": "Custom parser for ESLint", - "devDependencies": { - "babel-eslint": "^8.2.6", - "dedent": "^0.7.0", - "eslint": "^5.6.0", - "eslint-config-babel": "^7.0.1", - "eslint-plugin-flowtype": "^2.30.3", - "eslint-plugin-import": "^2.14.0", - "eslint-plugin-prettier": "^2.1.2", - "espree": "^3.5.2", - "husky": "^1.0.0-rc.13", - "lint-staged": "^7.2.2", - "mocha": "^5.0.1", - "prettier": "^1.4.4" - }, - "engines": { - "node": ">=6" - }, - "files": [ - "lib" - ], - "homepage": "https://github.com/babel/babel-eslint", - "license": "MIT", - "lint-staged": { - "*.js": [ - "eslint --format=codeframe --fix", - "git add" - ] - }, - "main": "lib/index.js", - "name": "babel-eslint", - "peerDependencies": { - "eslint": ">= 4.12.1" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/babel/babel-eslint.git" - }, - "scripts": { - "changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:' * %s (%an)' | grep -v 'Merge pull request'", - "fix": "eslint lib test --fix", - "lint": "eslint lib test", - "precommit": "lint-staged", - "preversion": "npm test", - "test": "npm run lint && npm run test-only", - "test-only": "mocha && mocha --require test/fixtures/preprocess-to-patch.js" - }, - "version": "10.0.3" -} \ No newline at end of file diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index 0ea302e2cb5d34..45b4ef1acf2eaa 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -265,7 +265,7 @@ The following companies, organizations, and individuals support ESLint's ongoing

          Platinum Sponsors

          Automattic

          Gold Sponsors

          -

          Shopify Salesforce Airbnb Microsoft FOSS Fund Sponsorships

          Silver Sponsors

          +

          Chrome's Web Framework & Tools Performance Fund Shopify Salesforce Airbnb Microsoft FOSS Fund Sponsorships

          Silver Sponsors

          Liftoff AMP Project

          Bronze Sponsors

          Writers Per Hour 2021 calendar Buy.Fineproxy.Org Veikkaajat.com Anagram Solver Bugsnag Stability Monitoring Mixpanel VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Fire Stick Tricks

          diff --git a/tools/node_modules/eslint/bin/eslint.js b/tools/node_modules/eslint/bin/eslint.js index 75b413148695e5..86291b0f52750a 100755 --- a/tools/node_modules/eslint/bin/eslint.js +++ b/tools/node_modules/eslint/bin/eslint.js @@ -14,7 +14,7 @@ require("v8-compile-cache"); // must do this initialization *before* other requires in order to work if (process.argv.includes("--debug")) { - require("debug").enable("eslint:*,-eslint:code-path"); + require("debug").enable("eslint:*,-eslint:code-path,eslintrc:*"); } //------------------------------------------------------------------------------ diff --git a/tools/node_modules/eslint/lib/rules/index.js b/tools/node_modules/eslint/lib/rules/index.js index 3cf26e51bc8392..84f3480df2686a 100644 --- a/tools/node_modules/eslint/lib/rules/index.js +++ b/tools/node_modules/eslint/lib/rules/index.js @@ -169,6 +169,7 @@ module.exports = new LazyLoadingRuleMap(Object.entries({ "no-new-require": () => require("./no-new-require"), "no-new-symbol": () => require("./no-new-symbol"), "no-new-wrappers": () => require("./no-new-wrappers"), + "no-nonoctal-decimal-escape": () => require("./no-nonoctal-decimal-escape"), "no-obj-calls": () => require("./no-obj-calls"), "no-octal": () => require("./no-octal"), "no-octal-escape": () => require("./no-octal-escape"), diff --git a/tools/node_modules/eslint/lib/rules/no-irregular-whitespace.js b/tools/node_modules/eslint/lib/rules/no-irregular-whitespace.js index 0bf69b128e6bf8..15711c6157a9a4 100644 --- a/tools/node_modules/eslint/lib/rules/no-irregular-whitespace.js +++ b/tools/node_modules/eslint/lib/rules/no-irregular-whitespace.js @@ -82,7 +82,7 @@ module.exports = { const commentNodes = sourceCode.getAllComments(); /** - * Removes errors that occur inside a string node + * Removes errors that occur inside the given node * @param {ASTNode} node to check for matching errors. * @returns {void} * @private @@ -91,14 +91,12 @@ module.exports = { const locStart = node.loc.start; const locEnd = node.loc.end; - errors = errors.filter(({ loc: { start: errorLoc } }) => { - if (errorLoc.line >= locStart.line && errorLoc.line <= locEnd.line) { - if (errorLoc.column >= locStart.column && (errorLoc.column <= locEnd.column || errorLoc.line < locEnd.line)) { - return false; - } - } - return true; - }); + errors = errors.filter(({ loc: { start: errorLocStart } }) => ( + errorLocStart.line < locStart.line || + errorLocStart.line === locStart.line && errorLocStart.column < locStart.column || + errorLocStart.line === locEnd.line && errorLocStart.column >= locEnd.column || + errorLocStart.line > locEnd.line + )); } /** diff --git a/tools/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js b/tools/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js new file mode 100644 index 00000000000000..a4b46d9591f5ed --- /dev/null +++ b/tools/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js @@ -0,0 +1,147 @@ +/** + * @fileoverview Rule to disallow `\8` and `\9` escape sequences in string literals. + * @author Milos Djermanovic + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const QUICK_TEST_REGEX = /\\[89]/u; + +/** + * Returns unicode escape sequence that represents the given character. + * @param {string} character A single code unit. + * @returns {string} "\uXXXX" sequence. + */ +function getUnicodeEscape(character) { + return `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = { + meta: { + type: "suggestion", + + docs: { + description: "disallow `\\8` and `\\9` escape sequences in string literals", + category: "Best Practices", + recommended: false, + url: "https://eslint.org/docs/rules/no-nonoctal-decimal-escape", + suggestion: true + }, + + schema: [], + + messages: { + decimalEscape: "Don't use '{{decimalEscape}}' escape sequence.", + + // suggestions + refactor: "Replace '{{original}}' with '{{replacement}}'. This maintains the current functionality.", + escapeBackslash: "Replace '{{original}}' with '{{replacement}}' to include the actual backslash character." + } + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + /** + * Creates a new Suggestion object. + * @param {string} messageId "refactor" or "escapeBackslash". + * @param {int[]} range The range to replace. + * @param {string} replacement New text for the range. + * @returns {Object} Suggestion + */ + function createSuggestion(messageId, range, replacement) { + return { + messageId, + data: { + original: sourceCode.getText().slice(...range), + replacement + }, + fix(fixer) { + return fixer.replaceTextRange(range, replacement); + } + }; + } + + return { + Literal(node) { + if (typeof node.value !== "string") { + return; + } + + if (!QUICK_TEST_REGEX.test(node.raw)) { + return; + } + + const regex = /(?:[^\\]|(?\\.))*?(?\\[89])/suy; + let match; + + while ((match = regex.exec(node.raw))) { + const { previousEscape, decimalEscape } = match.groups; + const decimalEscapeRangeEnd = node.range[0] + match.index + match[0].length; + const decimalEscapeRangeStart = decimalEscapeRangeEnd - decimalEscape.length; + const decimalEscapeRange = [decimalEscapeRangeStart, decimalEscapeRangeEnd]; + const suggest = []; + + // When `regex` is matched, `previousEscape` can only capture characters adjacent to `decimalEscape` + if (previousEscape === "\\0") { + + /* + * Now we have a NULL escape "\0" immediately followed by a decimal escape, e.g.: "\0\8". + * Fixing this to "\08" would turn "\0" into a legacy octal escape. To avoid producing + * an octal escape while fixing a decimal escape, we provide different suggestions. + */ + suggest.push( + createSuggestion( // "\0\8" -> "\u00008" + "refactor", + [decimalEscapeRangeStart - previousEscape.length, decimalEscapeRangeEnd], + `${getUnicodeEscape("\0")}${decimalEscape[1]}` + ), + createSuggestion( // "\8" -> "\u0038" + "refactor", + decimalEscapeRange, + getUnicodeEscape(decimalEscape[1]) + ) + ); + } else { + suggest.push( + createSuggestion( // "\8" -> "8" + "refactor", + decimalEscapeRange, + decimalEscape[1] + ) + ); + } + + suggest.push( + createSuggestion( // "\8" -> "\\8" + "escapeBackslash", + decimalEscapeRange, + `\\${decimalEscape}` + ) + ); + + context.report({ + node, + loc: { + start: sourceCode.getLocFromIndex(decimalEscapeRangeStart), + end: sourceCode.getLocFromIndex(decimalEscapeRangeEnd) + }, + messageId: "decimalEscape", + data: { + decimalEscape + }, + suggest + }); + } + } + }; + } +}; diff --git a/tools/node_modules/eslint/lib/rules/no-useless-constructor.js b/tools/node_modules/eslint/lib/rules/no-useless-constructor.js index 4c34aeda715937..baabe7ec80f3a7 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-constructor.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-constructor.js @@ -162,6 +162,14 @@ module.exports = { return; } + /* + * Prevent crashing on parsers which do not require class constructor + * to have a body, e.g. typescript and flow + */ + if (!node.value.body) { + return; + } + const body = node.value.body.body; const ctorParams = node.value.params; const superClass = node.parent.parent.superClass; diff --git a/tools/node_modules/eslint/node_modules/debug/package.json b/tools/node_modules/eslint/node_modules/debug/package.json index 5f2e838cb3d384..2b1dece47b8c9d 100644 --- a/tools/node_modules/eslint/node_modules/debug/package.json +++ b/tools/node_modules/eslint/node_modules/debug/package.json @@ -74,5 +74,5 @@ "test:coverage": "cat ./coverage/lcov.info | coveralls", "test:node": "istanbul cover _mocha -- test.js" }, - "version": "4.2.0" + "version": "4.3.1" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/debug/src/browser.js b/tools/node_modules/eslint/node_modules/debug/src/browser.js index ac3f7e1339b985..cd0fc35d1ee11e 100644 --- a/tools/node_modules/eslint/node_modules/debug/src/browser.js +++ b/tools/node_modules/eslint/node_modules/debug/src/browser.js @@ -9,6 +9,16 @@ exports.save = save; exports.load = load; exports.useColors = useColors; exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); /** * Colors. diff --git a/tools/node_modules/eslint/node_modules/debug/src/common.js b/tools/node_modules/eslint/node_modules/debug/src/common.js index da7eada619f824..392a8e005a063a 100644 --- a/tools/node_modules/eslint/node_modules/debug/src/common.js +++ b/tools/node_modules/eslint/node_modules/debug/src/common.js @@ -12,16 +12,12 @@ function setup(env) { createDebug.enable = enable; createDebug.enabled = enabled; createDebug.humanize = require('ms'); + createDebug.destroy = destroy; Object.keys(env).forEach(key => { createDebug[key] = env[key]; }); - /** - * Active `debug` instances. - */ - createDebug.instances = []; - /** * The currently active debug mode names, and names to skip. */ @@ -63,6 +59,7 @@ function setup(env) { */ function createDebug(namespace) { let prevTime; + let enableOverride = null; function debug(...args) { // Disabled? @@ -92,7 +89,7 @@ function setup(env) { args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { // If we encounter an escaped % then don't increase the array index if (match === '%%') { - return match; + return '%'; } index++; const formatter = createDebug.formatters[format]; @@ -115,31 +112,28 @@ function setup(env) { } debug.namespace = namespace; - debug.enabled = createDebug.enabled(namespace); debug.useColors = createDebug.useColors(); debug.color = createDebug.selectColor(namespace); - debug.destroy = destroy; debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride, + set: v => { + enableOverride = v; + } + }); // Env-specific initialization logic for debug instances if (typeof createDebug.init === 'function') { createDebug.init(debug); } - createDebug.instances.push(debug); - return debug; } - function destroy() { - const index = createDebug.instances.indexOf(this); - if (index !== -1) { - createDebug.instances.splice(index, 1); - return true; - } - return false; - } - function extend(namespace, delimiter) { const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); newDebug.log = this.log; @@ -177,11 +171,6 @@ function setup(env) { createDebug.names.push(new RegExp('^' + namespaces + '$')); } } - - for (i = 0; i < createDebug.instances.length; i++) { - const instance = createDebug.instances[i]; - instance.enabled = createDebug.enabled(instance.namespace); - } } /** @@ -256,6 +245,14 @@ function setup(env) { return val; } + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + createDebug.enable(createDebug.load()); return createDebug; diff --git a/tools/node_modules/eslint/node_modules/debug/src/node.js b/tools/node_modules/eslint/node_modules/debug/src/node.js index 5e1f1541a05593..79bc085cb0230c 100644 --- a/tools/node_modules/eslint/node_modules/debug/src/node.js +++ b/tools/node_modules/eslint/node_modules/debug/src/node.js @@ -15,6 +15,10 @@ exports.formatArgs = formatArgs; exports.save = save; exports.load = load; exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); /** * Colors. @@ -244,7 +248,9 @@ const {formatters} = module.exports; formatters.o = function (v) { this.inspectOpts.colors = this.useColors; return util.inspect(v, this.inspectOpts) - .replace(/\s*\n\s*/g, ' '); + .split('\n') + .map(str => str.trim()) + .join(' '); }; /** diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index 53d055bc094d51..5f21ce62356fdb 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -154,5 +154,5 @@ "test:cli": "mocha", "webpack": "node Makefile.js webpack" }, - "version": "7.13.0" + "version": "7.14.0" } \ No newline at end of file diff --git a/tools/osx-codesign.sh b/tools/osx-codesign.sh index 7ca80ca7462c3d..346afdbe66e9fd 100644 --- a/tools/osx-codesign.sh +++ b/tools/osx-codesign.sh @@ -1,17 +1,18 @@ -#!/bin/bash +#!/bin/sh set -x set -e -if [ "X$SIGN" == "X" ]; then - echo "No SIGN environment var. Skipping codesign." >&2 +# shellcheck disable=SC2154 +[ -z "$SIGN" ] && \ + echo "No SIGN environment var. Skipping codesign." >&2 && \ exit 0 -fi # All macOS executable binaries in the bundle must be codesigned with the # hardened runtime enabled. # See https://github.com/nodejs/node/pull/31459 +# shellcheck disable=SC2154 codesign \ --sign "$SIGN" \ --entitlements tools/osx-entitlements.plist \ diff --git a/tools/osx-notarize.sh b/tools/osx-notarize.sh index 97bb0912722495..07d3e20e7e9a18 100755 --- a/tools/osx-notarize.sh +++ b/tools/osx-notarize.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Uses gon, from https://github.com/mitchellh/gon, to notarize a generated node-.pkg file # with Apple for installation on macOS Catalina and later as validated by Gatekeeper. @@ -8,18 +8,16 @@ set -e gon_version="0.2.2" gon_exe="${HOME}/.gon/gon_${gon_version}" -__dirname="$(CDPATH= cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" pkgid="$1" -if [ "X${pkgid}" == "X" ]; then - echo "Usage: $0 " +[ -z "$pkgid" ] && \ + echo "Usage: $0 " \ exit 1 -fi -if [ "X$NOTARIZATION_ID" == "X" ]; then - echo "No NOTARIZATION_ID environment var. Skipping notarization." +# shellcheck disable=SC2154 +[ -z "$NOTARIZATION_ID" ] && \ + echo "No NOTARIZATION_ID environment var. Skipping notarization." \ exit 0 -fi set -x diff --git a/tools/osx-productsign.sh b/tools/osx-productsign.sh index 491e3fde62f0b4..b1daedcf7ee228 100644 --- a/tools/osx-productsign.sh +++ b/tools/osx-productsign.sh @@ -1,12 +1,14 @@ -#!/bin/bash +#!/bin/sh set -x set -e -if [ "X$SIGN" == "X" ]; then - echo "No SIGN environment var. Skipping codesign." >&2 +# shellcheck disable=SC2154 +[ -z "$SIGN" ] && \ + echo "No SIGN environment var. Skipping codesign." >&2 && \ exit 0 -fi +# shellcheck disable=SC2154 productsign --sign "$SIGN" "$PKG" "$PKG"-SIGNED +# shellcheck disable=SC2154 mv "$PKG"-SIGNED "$PKG" diff --git a/tools/release.sh b/tools/release.sh index 3c2cc1ea0736e7..8bc398e0d93aeb 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # To promote and sign a release that has been prepared by the build slaves, use: # release.sh @@ -28,7 +28,7 @@ while getopts ":i:s:" option; do echo "Invalid option -$OPTARG." exit 1 ;; - :) + *) echo "Option -$OPTARG takes a parameter." exit 1 ;; @@ -42,50 +42,45 @@ shift $((OPTIND-1)) echo "# Selecting GPG key ..." gpgkey=$(gpg --list-secret-keys --keyid-format SHORT | awk -F'( +|/)' '/^(sec|ssb)/{print $3}') -keycount=$(echo $gpgkey | wc -w) +keycount=$(echo "$gpgkey" | wc -w) -if [ $keycount -eq 0 ]; then +if [ "$keycount" -eq 0 ]; then + # shellcheck disable=SC2016 echo 'Need at least one GPG key, please make one with `gpg --gen-key`' echo 'You will also need to submit your key to a public keyserver, e.g.' echo ' https://sks-keyservers.net/i/#submit' exit 1 -elif [ $keycount -ne 1 ]; then - echo -e 'You have multiple GPG keys:\n' +elif [ "$keycount" -ne 1 ]; then + printf "You have multiple GPG keys:\n\n" gpg --list-secret-keys - while true; do - echo $gpgkey | awk '{ for(i = 1; i <= NF; i++) { print i ") " $i; } }' - echo -n 'Select a key: ' - read keynum - - if $(test "$keynum" -eq "$keynum" > /dev/null 2>&1); then - _gpgkey=$(echo $gpgkey | awk '{ print $'${keynum}'}') - keycount=$(echo $_gpgkey | wc -w) - if [ $keycount -eq 1 ]; then - echo "" - gpgkey=$_gpgkey - break - fi - fi + keynum= + while [ -z "${keynum##*[!0-9]*}" ] || [ "$keynum" -le 0 ] || [ "$keynum" -gt "$keycount" ]; do + echo "$gpgkey" | awk '{ for(i = 1; i <= NF; i++) { print i ") " $i; } }' + printf 'Select a key: ' + read -r keynum done + echo "" + gpgkey=$(echo "$gpgkey" | awk "{ print \$${keynum}}") fi -gpgfing=$(gpg --keyid-format 0xLONG --fingerprint $gpgkey | grep 'Key fingerprint =' | awk -F' = ' '{print $2}' | tr -d ' ') +gpgfing=$(gpg --keyid-format 0xLONG --fingerprint "$gpgkey" | grep 'Key fingerprint =' | awk -F' = ' '{print $2}' | tr -d ' ') + +grep "$gpgfing" README.md || (\ + echo 'Error: this GPG key fingerprint is not listed in ./README.md' && \ + exit 1 \ +) -if ! test "$(grep $gpgfing README.md)"; then - echo 'Error: this GPG key fingerprint is not listed in ./README.md' - exit 1 -fi echo "Using GPG key: $gpgkey" echo " Fingerprint: $gpgfing" -function checktag { - local version=$1 +checktag() { + # local version=$1 - if ! git tag -v $version 2>&1 | grep "${gpgkey}" | grep key > /dev/null; then - echo "Could not find signed tag for \"${version}\" or GPG key is not yours" + if ! git tag -v "$1" 2>&1 | grep "${gpgkey}" | grep key > /dev/null; then + echo "Could not find signed tag for \"$1\" or GPG key is not yours" exit 1 fi } @@ -93,58 +88,61 @@ function checktag { ################################################################################ ## Create and sign checksums file for a given version -function sign { - echo -e "\n# Creating SHASUMS256.txt ..." +sign() { + printf "\n# Creating SHASUMS256.txt ...\n" - local version=$1 + # local version=$1 - ghtaggedversion=$(curl -sL https://raw.githubusercontent.com/nodejs/node/${version}/src/node_version.h \ + ghtaggedversion=$(curl -sL https://raw.githubusercontent.com/nodejs/node/"$1"/src/node_version.h \ | awk '/define NODE_(MAJOR|MINOR|PATCH)_VERSION/{ v = v "." $3 } END{ v = "v" substr(v, 2); print v }') - if [ "${version}" != "${ghtaggedversion}" ]; then + if [ "$1" != "${ghtaggedversion}" ]; then echo "Could not find tagged version on github.com/nodejs/node, did you push your tag?" exit 1 fi - shapath=$(ssh ${customsshkey} ${webuser}@${webhost} $signcmd nodejs $version) + # shellcheck disable=SC2029 + shapath=$(ssh "${customsshkey}" "${webuser}@${webhost}" $signcmd nodejs "$1") - if ! [[ ${shapath} =~ ^/.+/SHASUMS256.txt$ ]]; then - echo 'Error: No SHASUMS file returned by sign!' + echo "${shapath}" | grep -q '^/.*/SHASUMS256.txt$' || \ + echo 'Error: No SHASUMS file returned by sign!' \ exit 1 - fi - echo -e "\n# Signing SHASUMS for ${version}..." + echo "" + echo "# Signing SHASUMS for $1..." - shafile=$(basename $shapath) - shadir=$(dirname $shapath) + shafile=$(basename "$shapath") + shadir=$(dirname "$shapath") tmpdir="/tmp/_node_release.$$" mkdir -p $tmpdir - scp ${customsshkey} ${webuser}@${webhost}:${shapath} ${tmpdir}/${shafile} + scp "${customsshkey}" "${webuser}@${webhost}:${shapath}" "${tmpdir}/${shafile}" - gpg --default-key $gpgkey --clearsign --digest-algo SHA256 ${tmpdir}/${shafile} - gpg --default-key $gpgkey --detach-sign --digest-algo SHA256 ${tmpdir}/${shafile} + gpg --default-key "$gpgkey" --clearsign --digest-algo SHA256 ${tmpdir}/"${shafile}" + gpg --default-key "$gpgkey" --detach-sign --digest-algo SHA256 ${tmpdir}/"${shafile}" echo "Wrote to ${tmpdir}/" - echo -e "Your signed ${shafile}.asc:\n" + echo "Your signed ${shafile}.asc:" + echo "" - cat ${tmpdir}/${shafile}.asc + cat "${tmpdir}/${shafile}.asc" echo "" while true; do - echo -n "Upload files? [y/n] " + printf "Upload files? [y/n] " yorn="" - read yorn + read -r yorn - if [ "X${yorn}" == "Xn" ]; then + if [ "X${yorn}" = "Xn" ]; then break fi - if [ "X${yorn}" == "Xy" ]; then - scp ${customsshkey} ${tmpdir}/${shafile} ${tmpdir}/${shafile}.asc ${tmpdir}/${shafile}.sig ${webuser}@${webhost}:${shadir}/ - ssh ${customsshkey} ${webuser}@${webhost} chmod 644 ${shadir}/${shafile}.asc ${shadir}/${shafile}.sig + if [ "X${yorn}" = "Xy" ]; then + scp "${customsshkey}" "${tmpdir}/${shafile}" "${tmpdir}/${shafile}.asc" "${tmpdir}/${shafile}.sig" "${webuser}@${webhost}:${shadir}/" + #shellcheck disable=SC2029 + ssh "${customsshkey}" "${webuser}@${webhost}" chmod 644 "${shadir}/${shafile}.asc" "${shadir}/${shafile}.sig" break fi done @@ -154,8 +152,8 @@ function sign { if [ -n "${signversion}" ]; then - checktag $signversion - sign $signversion + checktag "$signversion" + sign "$signversion" exit 0 fi @@ -164,16 +162,17 @@ fi ################################################################################ ## Look for releases to promote -echo -e "\n# Checking for releases ..." +printf "\n# Checking for releases ...\n" -promotable=$(ssh ${customsshkey} ${webuser}@${webhost} $promotablecmd nodejs) +promotable=$(ssh "${customsshkey}" "$webuser@$webhost" $promotablecmd nodejs) -if [ "X${promotable}" == "X" ]; then +if [ "X${promotable}" = "X" ]; then echo "No releases to promote!" exit 0 fi -echo -e "Found the following releases / builds ready to promote:\n" +echo "Found the following releases / builds ready to promote:" +echo "" echo "$promotable" | sed 's/^/ * /' echo "" @@ -184,12 +183,12 @@ versions=$(echo "$promotable" | cut -d: -f1) for version in $versions; do while true; do - files=$(echo "$promotable" | grep "^${version}" | sed 's/^'${version}': //') - echo -n "Promote ${version} files (${files})? [y/n] " + files=$(echo "$promotable" | grep "^${version}" | sed 's/^'"${version}"': //') + printf "Promote %s files (%s)? [y/n] " "${version}" "${files}" yorn="" - read yorn + read -r yorn - if [ "X${yorn}" == "Xn" ]; then + if [ "X${yorn}" = "Xn" ]; then break fi @@ -197,15 +196,14 @@ for version in $versions; do continue fi - checktag $version - - echo -e "\n# Promoting ${version}..." + checktag "$version" - ssh ${customsshkey} ${webuser}@${webhost} $promotecmd nodejs $version + echo "" + echo "# Promoting ${version}..." - if [ $? -eq 0 ];then - sign $version - fi + # shellcheck disable=SC2029 + ssh "${customsshkey}" "$webuser@$webhost" $promotecmd nodejs "$version" && \ + sign "$version" break done diff --git a/tools/snapshot/snapshot_builder.cc b/tools/snapshot/snapshot_builder.cc index 94fe1604149c43..eb755b7d29ed7c 100644 --- a/tools/snapshot/snapshot_builder.cc +++ b/tools/snapshot/snapshot_builder.cc @@ -25,7 +25,7 @@ void WriteVector(std::stringstream* ss, const T* vec, size_t size) { } } -std::string FormatBlob(v8::StartupData* blob, +std::string FormatBlob(StartupData* blob, const std::vector& isolate_data_indexes, const EnvSerializeInfo& env_info) { std::stringstream ss; @@ -75,9 +75,9 @@ const EnvSerializeInfo* NodeMainInstance::GetEnvSerializeInfo() { return ss.str(); } -static v8::StartupData SerializeNodeContextInternalFields(Local holder, - int index, - void* env) { +static StartupData SerializeNodeContextInternalFields(Local holder, + int index, + void* env) { void* ptr = holder->GetAlignedPointerFromInternalField(index); if (ptr == nullptr || ptr == env) { return StartupData{nullptr, 0}; diff --git a/tools/update-babel-eslint.sh b/tools/update-babel-eslint.sh index 700194da937dcb..d6de6d25e1d212 100755 --- a/tools/update-babel-eslint.sh +++ b/tools/update-babel-eslint.sh @@ -1,19 +1,19 @@ -#!/usr/bin/env bash +#!/bin/sh # Shell script to update babel-eslint in the source tree to the latest release. # Depends on npm, npx, and node being in $PATH. # This script must be be in the tools directory when it runs because it uses -# $BASH_SOURCE[0] to determine directories to work in. +# $0 to determine directories to work in. -cd "$( dirname "${BASH_SOURCE[0]}" )" -rm -rf node_modules/babel-eslint +cd "$( dirname "${0}" )" || exit +rm -rf node_modules/@babel mkdir babel-eslint-tmp -cd babel-eslint-tmp +cd babel-eslint-tmp || exit npm init --yes -npm install --global-style --no-bin-links --production --no-package-lock babel-eslint@latest +npm install --global-style --no-bin-links --production --no-package-lock @babel/core @babel/eslint-parser@latest @babel/plugin-syntax-class-properties@latest # Use dmn to remove some unneeded files. npx dmn@2.2.2 -f clean @@ -22,5 +22,5 @@ npx dmn@2.2.2 -f clean npx removeNPMAbsolutePaths@1.0.4 . cd .. -mv babel-eslint-tmp/node_modules/babel-eslint node_modules/babel-eslint +mv babel-eslint-tmp/node_modules/@babel node_modules/@babel rm -rf babel-eslint-tmp/