@geastack/compiler 1.0.38 → 1.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geastack/compiler",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.40",
|
|
4
4
|
"description": "The geastack TypeScript-to-C++ compiler: one semantic spine, no source-shaped authority, no boxing of statically typed values.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -37674,6 +37674,69 @@ struct Pattern {
|
|
|
37674
37674
|
using Utf16Regex = RegexMatcher;
|
|
37675
37675
|
using Utf16Match = std::match_results<RegexUnits::const_iterator>;
|
|
37676
37676
|
|
|
37677
|
+
/**
|
|
37678
|
+
* The flags for a search that starts `startUnits` into `input`.
|
|
37679
|
+
*
|
|
37680
|
+
* `match_prev_avail` says the code unit before the range is part of the
|
|
37681
|
+
* input, so `^` must not match at the range start unless that code unit ends
|
|
37682
|
+
* a line under `m`. libstdc++ and the MSVC STL read it that way. libc++
|
|
37683
|
+
* matches `^` at the start of every range, multiline or not, and ignores
|
|
37684
|
+
* `match_not_bol` while `match_prev_avail` is set (as the standard says), so
|
|
37685
|
+
* `/^a/y` at lastIndex 2 matched "x\na" and `split(/^/)` cut at every
|
|
37686
|
+
* position. On libc++ the range start is instead told whether it begins a
|
|
37687
|
+
* line: never without `m`, and with `m` exactly when a line terminator
|
|
37688
|
+
* (ES 22.2.2.6) precedes it. That drops `match_prev_avail`, which libc++ also
|
|
37689
|
+
* reads for `\b`/`\B` at the range start, so it is kept for patterns with no
|
|
37690
|
+
* `^` to misread; with a `^`, `match_not_bow` stands in for a word character
|
|
37691
|
+
* before the range, which is exact except at a word-to-non-word resume point.
|
|
37692
|
+
*/
|
|
37693
|
+
std::regex_constants::match_flag_type searchFlagsFrom(const RegexUnits &input, std::size_t startUnits) const {
|
|
37694
|
+
auto flags = std::regex_constants::match_default;
|
|
37695
|
+
if (startUnits == 0) return flags;
|
|
37696
|
+
#if defined(_LIBCPP_VERSION)
|
|
37697
|
+
if (!hasStartAnchor()) return flags | std::regex_constants::match_prev_avail;
|
|
37698
|
+
const RegexUnit previous = input[startUnits - 1];
|
|
37699
|
+
const bool lineStart = multiline && (previous == L'\n' || previous == L'\r' || previous == 0x2028 || previous == 0x2029);
|
|
37700
|
+
if (!lineStart) flags |= std::regex_constants::match_not_bol;
|
|
37701
|
+
const bool wordBefore = previous == L'_' || (previous >= L'0' && previous <= L'9') || (previous >= L'a' && previous <= L'z') ||
|
|
37702
|
+
(previous >= L'A' && previous <= L'Z');
|
|
37703
|
+
if (wordBefore) flags |= std::regex_constants::match_not_bow;
|
|
37704
|
+
#else
|
|
37705
|
+
(void)input;
|
|
37706
|
+
flags |= std::regex_constants::match_prev_avail;
|
|
37707
|
+
#endif
|
|
37708
|
+
return flags;
|
|
37709
|
+
}
|
|
37710
|
+
|
|
37711
|
+
#if defined(_LIBCPP_VERSION)
|
|
37712
|
+
// Whether the source holds a `^` outside a class: 0 unknown, 1 yes, -1 no.
|
|
37713
|
+
mutable signed char startAnchorState = 0;
|
|
37714
|
+
|
|
37715
|
+
bool hasStartAnchor() const {
|
|
37716
|
+
if (startAnchorState == 0) {
|
|
37717
|
+
const RegexUnits &source = matcherSource();
|
|
37718
|
+
bool escaped = false;
|
|
37719
|
+
bool inClass = false;
|
|
37720
|
+
startAnchorState = -1;
|
|
37721
|
+
for (const RegexUnit unit : source) {
|
|
37722
|
+
if (escaped) {
|
|
37723
|
+
escaped = false;
|
|
37724
|
+
} else if (unit == L'\\') {
|
|
37725
|
+
escaped = true;
|
|
37726
|
+
} else if (inClass) {
|
|
37727
|
+
if (unit == L']') inClass = false;
|
|
37728
|
+
} else if (unit == L'[') {
|
|
37729
|
+
inClass = true;
|
|
37730
|
+
} else if (unit == L'^') {
|
|
37731
|
+
startAnchorState = 1;
|
|
37732
|
+
break;
|
|
37733
|
+
}
|
|
37734
|
+
}
|
|
37735
|
+
}
|
|
37736
|
+
return startAnchorState > 0;
|
|
37737
|
+
}
|
|
37738
|
+
#endif
|
|
37739
|
+
|
|
37677
37740
|
static const Utf16Regex &cachedStdRegex(const RegexUnits &source, std::regex::flag_type flags) {
|
|
37678
37741
|
using Cache = std::map<std::pair<RegexUnits, unsigned>, Utf16Regex>;
|
|
37679
37742
|
GEA_REALM_LOCAL(Cache, cache, {});
|
|
@@ -37756,9 +37819,8 @@ struct Pattern {
|
|
|
37756
37819
|
legacyAnchorState = rewrite.needed ? 1 : -1;
|
|
37757
37820
|
}
|
|
37758
37821
|
if (legacyAnchorState < 0) {
|
|
37759
|
-
|
|
37760
|
-
|
|
37761
|
-
return std::regex_search(input.cbegin() + static_cast<std::ptrdiff_t>(startUnits), input.cend(), match, compiled, flags);
|
|
37822
|
+
return std::regex_search(
|
|
37823
|
+
input.cbegin() + static_cast<std::ptrdiff_t>(startUnits), input.cend(), match, compiled, searchFlagsFrom(input, startUnits));
|
|
37762
37824
|
}
|
|
37763
37825
|
if (startUnits == 0) {
|
|
37764
37826
|
if (std::regex_search(input.cbegin(), input.cend(), match, *legacyAtStart, std::regex_constants::match_continuous)) {
|
|
@@ -37839,9 +37901,7 @@ struct Pattern {
|
|
|
37839
37901
|
const Utf16Regex &compiled = compiledRegex();
|
|
37840
37902
|
Utf16Match match;
|
|
37841
37903
|
auto searchBegin = inputUnits.cbegin() + static_cast<std::ptrdiff_t>(startUnits);
|
|
37842
|
-
|
|
37843
|
-
if (startUnits > 0) searchFlags |= std::regex_constants::match_prev_avail;
|
|
37844
|
-
if (!std::regex_search(searchBegin, inputUnits.cend(), match, compiled, searchFlags)) {
|
|
37904
|
+
if (!std::regex_search(searchBegin, inputUnits.cend(), match, compiled, searchFlagsFrom(inputUnits, startUnits))) {
|
|
37845
37905
|
if (stateful) resetLastIndex();
|
|
37846
37906
|
return MatchSlice{};
|
|
37847
37907
|
}
|
|
@@ -38770,9 +38830,8 @@ inline gea::Ref<gea::ArrayObject<std::string>> splitByPattern(
|
|
|
38770
38830
|
const std::size_t positionMatcherUnits = static_cast<std::size_t>(match[0].first - inputUnits.cbegin());
|
|
38771
38831
|
#else
|
|
38772
38832
|
auto begin = inputUnits.cbegin() + static_cast<std::ptrdiff_t>(cursorMatcherUnits);
|
|
38773
|
-
|
|
38774
|
-
|
|
38775
|
-
if (!std::regex_search(begin, inputUnits.cend(), match, compiled, flags)) break;
|
|
38833
|
+
if (!std::regex_search(begin, inputUnits.cend(), match, compiled, pattern.searchFlagsFrom(inputUnits, cursorMatcherUnits)))
|
|
38834
|
+
break;
|
|
38776
38835
|
const std::size_t positionMatcherUnits = cursorMatcherUnits + static_cast<std::size_t>(match.position(0));
|
|
38777
38836
|
#endif
|
|
38778
38837
|
const std::size_t endMatcherUnits = positionMatcherUnits + static_cast<std::size_t>(match.length(0));
|
|
@@ -46908,7 +46967,12 @@ void styleProperty(Node& node, const std::string& prop, const std::string& prope
|
|
|
46908
46967
|
// The embedded stylesheet already consumes numeric lengths and opacity.
|
|
46909
46968
|
// Avoid formatting a fractional double only to parse it back on every
|
|
46910
46969
|
// animation tick. Unsupported properties retain their string semantics.
|
|
46911
|
-
|
|
46970
|
+
// A handle that writes the number itself skips the Style a `style()` call
|
|
46971
|
+
// returns, and with it a second owner of the node's identity per write.
|
|
46972
|
+
if constexpr (requires { node.setStyleNumberProperty(property, static_cast<double>(value)); }) {
|
|
46973
|
+
if (std::isfinite(static_cast<double>(value)) &&
|
|
46974
|
+
node.setStyleNumberProperty(property, static_cast<double>(value))) return;
|
|
46975
|
+
} else if constexpr (requires { node.style().setNumberProperty(property, static_cast<double>(value)); }) {
|
|
46912
46976
|
if (std::isfinite(static_cast<double>(value)) &&
|
|
46913
46977
|
node.style().setNumberProperty(property, static_cast<double>(value))) return;
|
|
46914
46978
|
}
|